00001 #ifndef mvl2_video_from_avi_windows_h_ 00002 #define mvl2_video_from_avi_windows_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 // If we must use windows.h, we should at least sanitise it first 00010 #ifndef NOMINMAX 00011 # define NOMINMAX 00012 #endif 00013 00014 #include <windows.h> 00015 #include <vfw.h> 00016 #include <vil/vil_image_view.h> 00017 #include <mvl2/mvl2_video_reader.h> 00018 00019 //: A class to get video input from avi file 00020 class mvl2_video_from_avi: public mvl2_video_reader 00021 { 00022 public: 00023 00024 //: Dflt ctor 00025 mvl2_video_from_avi(); 00026 00027 //: Destructor 00028 virtual ~mvl2_video_from_avi(); 00029 00030 //: Initialize the file (format can by Grey, RGB, or more complex) 00031 virtual bool initialize( int width, int height, 00032 vcl_string format, vcl_string file_name); 00033 00034 //: Tidy up 00035 virtual void uninitialize(); 00036 00037 //: Set the size of image captured 00038 virtual void set_capture_size(int width,int height); 00039 00040 //: Return width of image (in pixels) 00041 virtual int get_width() const; 00042 00043 //: Return height of image (in pixels) 00044 virtual int get_height() const; 00045 00046 //: Return the frame rate in frames per second 00047 virtual double get_frame_rate() const; 00048 00049 //: Set the frame rate in frames per second 00050 virtual void set_frame_rate(double frame_rate); 00051 00052 //: Move frame counter on to next frame 00053 virtual int next_frame(); 00054 virtual int seek(int frame_number); 00055 00056 //: Reset frame counter to zero 00057 virtual void reset_frame(); 00058 00059 //: Put frame data into the given image 00060 virtual bool get_frame(vil_image_view<vxl_byte>& image); 00061 00062 //: Name of the class 00063 virtual vcl_string is_a() const; 00064 00065 //: Create a copy on the heap and return base class pointer 00066 virtual mvl2_video_reader* clone() const; 00067 00068 private: 00069 00070 // Windows specific handle to stream 00071 PAVISTREAM ppavi_; 00072 // Windows specific format handling 00073 void getVideoFormat(BITMAPINFO& bmp_info) const; 00074 }; 00075 00076 #endif // mvl2_video_from_avi_windows_h_