00001 #ifndef mvl2_video_from_avi_linux_h_ 00002 #define mvl2_video_from_avi_linux_h_ 00003 //: 00004 // \file 00005 // \brief A class to get video input from file 00006 // \author Franck Bettinger 00007 00008 #include <vcl_string.h> 00009 #include <avifile.h> 00010 #include <vil/vil_image_view.h> 00011 #include <mvl2/mvl2_video_reader.h> 00012 00013 // Cannot forward declare these, since they are typedefs (defined in avifile.h) 00014 //class IAviReadFile; 00015 //class IAviReadStream; 00016 00017 //: A class to get video input from avi file 00018 class mvl2_video_from_avi: public mvl2_video_reader 00019 { 00020 public: 00021 00022 //: Dflt ctor 00023 mvl2_video_from_avi(); 00024 00025 //: Destructor 00026 virtual ~mvl2_video_from_avi(); 00027 00028 //: Initialize the file (format can by Grey, RGB, or more complex) 00029 virtual bool initialize( int width, int height, 00030 vcl_string format, vcl_string file_name); 00031 00032 //: Tidy up 00033 virtual void uninitialize(); 00034 00035 //: Set the size of image captured 00036 virtual void set_capture_size(int width,int height); 00037 00038 //: Return width of image (in pixels) 00039 virtual int get_width() const; 00040 00041 //: Return height of image (in pixels) 00042 virtual int get_height() const; 00043 00044 //: Return the frame rate in frames per second 00045 virtual double get_frame_rate() const; 00046 00047 //: Set the frame rate in frames per second 00048 virtual void set_frame_rate(double frame_rate); 00049 00050 //: Move frame counter on to next frame 00051 virtual int next_frame(); 00052 00053 //: Reset frame counter to zero 00054 virtual void reset_frame(); 00055 00056 //: Put frame data into the given image 00057 virtual bool get_frame(vil_image_view<vxl_byte>& image); 00058 00059 //: Name of the class 00060 virtual vcl_string is_a() const; 00061 00062 //: Create a copy on the heap and return base class pointer 00063 virtual mvl2_video_reader* clone() const; 00064 00065 //: Returns the number of frames available from the beginning of the stream or -1 if unknown 00066 virtual int length(); 00067 00068 //: Move frame counter on to given frame if relevant 00069 // Use only when necessary, because it's slow. 00070 virtual int seek(unsigned int frame_number); 00071 00072 private: 00073 00074 vxl_byte* buffer_; 00075 IAviReadFile* moviefile_; 00076 IAviReadStream* moviestream_; 00077 }; 00078 00079 #endif // mvl2_video_from_avi_linux_h_