contrib/mul/mvl2/mvl2_video_writer.h
Go to the documentation of this file.
00001 #ifndef mvl2_video_writer_linux_h_
00002 #define mvl2_video_writer_linux_h_
00003 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00004 #pragma interface
00005 #endif
00006 //:
00007 // \file
00008 // \brief A class for writing videos
00009 // \author Franck Bettinger
00010 // \author Louise Butcher
00011 //
00012 // \verbatim
00013 //  Modifications
00014 //   10 Sep. 2004 Peter Vanroose  Inlined all 1-line methods in class decl
00015 // \endverbatim
00016 
00017 #include <vcl_string.h>
00018 #include <vxl_config.h>
00019 #include <vil/vil_image_view.h>
00020 
00021 //: A class for writing videos
00022 
00023 class mvl2_video_writer
00024 {
00025  public:
00026 
00027   //: Dflt ctor
00028   mvl2_video_writer() {}
00029 
00030   //: Destructor
00031   virtual ~mvl2_video_writer() { if (is_opened()) close(); }
00032 
00033   //: Set the video codec fourcc
00034   //  return true if it is a correct codec
00035   virtual bool  set_codec(char, char, char, char)=0;
00036 
00037   //: Initialize the file (format can be Grey, RGB, or more complex)
00038   virtual bool  open( int width, int height,
00039                       vcl_string format, vcl_string file_name)=0;
00040 
00041   //: Tidy up and close the file
00042   virtual void  close() {}
00043 
00044   //: Check whether camera is initialised
00045   virtual bool  is_opened() const {return is_initialized_;}
00046 
00047   //: Return width of image (in pixels)
00048   virtual int get_width() const {return width_;}
00049 
00050   //: Return height of image (in pixels)
00051   virtual int get_height() const {return height_;}
00052 
00053   //: Return the index of the current frame
00054   virtual int get_frame_number() const {return current_frame_;}
00055 
00056   //: Return the frame rate in frames per second
00057   virtual double get_frame_rate() const {return frame_rate_;}
00058 
00059   //: Set the frame rate in frames per second
00060   virtual void set_frame_rate(double frame_rate)=0;
00061 
00062   //: Set the quality of the recorded video
00063   virtual void set_quality(int qual)=0;
00064 
00065   //: Put frame data into the given image
00066   virtual void write_frame(vil_image_view<vxl_byte>& image)=0;
00067 
00068   //: Name of the class
00069   virtual vcl_string is_a() const { return vcl_string("mvl2_video_writer"); }
00070 
00071   //: Create a copy on the heap and return base class pointer
00072   virtual mvl2_video_writer* clone() const=0;
00073 
00074  protected:
00075 
00076   bool use_colour_;
00077   bool is_initialized_;
00078   int  current_frame_;
00079   double frame_rate_;
00080   int width_;
00081   int height_;
00082   int quality_;
00083   bool firstcall_;
00084 };
00085 
00086 #endif // mvl2_video_writer_linux_h_