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 _BUFFEREDIMAGEMULTIVIDEOSOURCE_H_ 00021 #define _BUFFEREDIMAGEMULTIVIDEOSOURCE_H_ 00022 00023 00024 // opencv 00025 #include <cv.h> 00026 #include <highgui.h> 00027 00028 #include "BaseInputVideo.hh" 00029 #include "OStreamConfig.hh" 00030 00031 #include <list> 00032 #include <vector> 00033 #include <cv.h> 00034 #include <highgui.h> 00035 00036 using namespace std; 00037 00042 class BufferedImageMultiVideoSource : public BaseInputVideo 00043 { 00044 public: 00045 00046 // being a special input video case, we can pass an input_single_video as single video source 00047 // avoiding to reimplement two cases for hardware [webcam] and software [file]. 00048 00058 BufferedImageMultiVideoSource( unsigned int streams_num, on_parsable_image_cb *f, 00059 void* parsable_image_callback_data, 00060 BaseInputVideo *input_single_video ); 00061 virtual ~BufferedImageMultiVideoSource(); 00062 00064 bool init_device (); 00065 00067 bool is_multi_stream (); 00068 00069 virtual IplImage * get_next_frame (); 00070 00071 00072 // 00073 // multi-stream implementable functions 00074 // 00075 00080 IplImage * get_next_frame_by_stream_id( int stream_id ); 00081 00088 static void add_image_by_stream_id( IplImage *image, int stream_id, char* __unused__, 00089 void* callback_data ); 00090 00091 private: // functions 00092 00097 on_parsable_image_cb * f_parsable_cb; 00098 00099 private: // data 00100 00102 vector< list<IplImage*>* > *_streams_vector; 00103 00105 unsigned int _streams_num; 00106 00108 BaseInputVideo *_input_single_video; 00109 00111 bool _initialized; 00112 00118 void *_parsable_image_callback_data; 00119 }; 00120 00121 00122 #endif //_BUFFEREDIMAGEMULTIVIDEOSOURCE_H_ 00123