00001 /* 00002 * Copyright (C) Massimo Cora' 2006 <maxcvs@email.it> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 00020 #ifndef _BASEINPUTVIDEO_H_ 00021 #define _BASEINPUTVIDEO_H_ 00022 00023 #include <cv.h> 00024 #include <highgui.h> 00025 00032 class BaseInputVideo 00033 { 00034 public: 00035 BaseInputVideo(); 00036 virtual ~BaseInputVideo(); 00037 00039 virtual bool init_device () = 0; 00040 00045 virtual bool is_multi_stream () = 0; 00046 00047 // 00048 // single-stream implementable functions 00049 // 00050 00056 virtual IplImage * get_next_frame () = 0; 00057 00058 // 00059 // multi-stream implementable functions 00060 // 00061 00068 virtual IplImage * get_next_frame_by_stream_id( int stream_id ) = 0; 00069 00080 static void 00081 add_image_by_stream_id( IplImage* image, 00082 int stream_id, 00083 char* __unused__, 00084 void* callback_data ); 00085 00086 00087 protected: 00088 // the program flow will be something like that for multi-stream mode: 00089 // 00090 // Device ===(grab IplImage)====> BufferedImageMultiVideoSource ====> parsing callback function 00091 // (can be external) 00092 // || 00093 // add_image_by_stream_id() <===============++ 00094 // add_image_by_stream_id() <===============++ 00095 // add_image_by_stream_id() <===============++ 00096 // ... 00097 // 00098 // In our case we have: 00099 // OStream streamer_ctrl OmniStuff 00100 // | | | 00101 // |> parsable_image_cb ------>| | 00102 // | |>register_all_image_callbacks -------> | 00103 // | |>OmniAlgoSimpleDetection_loop () -------> | 00104 // | | 00105 // | | 00106 // |<----------------------------------------------- add_image_by_stream_id <| 00107 // 00108 // 00109 // The add_image_by_stream_id will add a parsed image to a buffer of BufferedImageMultiVideoSource. 00110 // I.e. the added images could be tracked/detected faces. Then the MJPEGVideoSource 00111 // and H263plusVideoSource classes will take case of sending the buffers on the net 00112 // when available. 00113 00122 typedef void (on_parsable_image_cb)( IplImage* image, 00123 void* this_klass_callback_data, 00124 void* callback_data ); 00125 }; 00126 00127 00128 #endif //_BASEINPUTVIDEO_H_ 00129