core/vidl_vil1/vidl_vil1_avicodec.h

Go to the documentation of this file.
00001 #ifndef vidl_vil1_avicodec_h
00002 #define vidl_vil1_avicodec_h
00003 //:
00004 // \file 
00005 // \author Andy Molnar
00006 // \date October 1998
00007 //
00008 // \verbatim
00009 //  Modifications
00010 //   Nicolas Dano, september 1999
00011 //     - Transformed the basic AVI image reading into AVI Video
00012 //     - Added the possibility to save video in AVI format
00013 //   Julien ESTEVE, June 2000
00014 //     Ported from TargetJr
00015 //   10/4/2001 Ian Scott (Manchester) Converted perceps header to doxygen
00016 // \endverbatim
00017 
00018 #include <vcl_compiler.h>
00019 #include <vidl_vil1/vidl_vil1_codec.h>
00020 #include <vidl_vil1/vidl_vil1_avicodec_sptr.h>
00021 #include <vidl_vil1/vidl_vil1_frame_sptr.h>
00022 #if defined(VCL_VC) || defined(VCL_BORLAND) || defined(__MINGW32__)
00023 # include <windows.h>
00024 # undef min
00025 # undef max
00026 # include <vfw.h>
00027 #endif
00028 
00029 
00030 //: Allows user to load Microsoft AVI movie files as vxl video.
00031 // (Works only if compiled with a microsoft compiler)
00032 // See also vidl_vil1_codec
00033 class vidl_vil1_avicodec : public vidl_vil1_codec
00034 {
00035  public:
00036   vidl_vil1_avicodec();
00037  ~vidl_vil1_avicodec();
00038 
00039   //-----------------------------------------------------
00040 
00041   virtual bool   get_section(int position, void* ib, int x0, int y0, int xs, int ys) const;
00042   virtual int    put_section(int position, void* ib, int x0, int y0, int xs, int ys);
00043 
00044   //-----------------------------------------------------
00045   virtual bool probe(vcl_string const& fname);
00046   virtual vidl_vil1_codec_sptr load(vcl_string const& fname, char mode = 'r' );
00047   virtual bool save(vidl_vil1_movie* movie, vcl_string const& fname);
00048   virtual vcl_string type() const { return "AVI"; }
00049   virtual vidl_vil1_avicodec* castto_vidl_vil1_avicodec(){return this;}
00050 
00051   // Set of encoders that this class knows how to configure by itself,
00052   // without having to open a windows dialog in which the user
00053   // has to select the encoder.
00054   enum AVIEncoderType { ASKUSER, USEPREVIOUS, UNCOMPRESSED, CINEPACK };
00055 
00056   /// Type of encoder to use.
00057   AVIEncoderType encoder_type;
00058 
00059   /// Video for windows compressor options data structure.
00060   AVICOMPRESSOPTIONS opts;
00061 
00062   bool encoder_options_valid;
00063 
00064   // This function sets the encoder that is internally used to create the
00065   // AVI. Using this function avoids the windows dialog asking
00066   // the user for the compressor.
00067   // Depending on the choosen encoder, the parameters of opts are set by this
00068   // function.
00069   void choose_encoder(AVIEncoderType encoder);
00070 
00071  private:
00072    PAVIFILE avi_file_;
00073    PAVISTREAM avi_stream_;
00074    PGETFRAME avi_get_frame_;
00075 
00076    AVIFILEINFO avi_file_info_;
00077    AVISTREAMINFO avi_stream_info_;
00078 
00079   // Helpers
00080   HANDLE  make_dib(vidl_vil1_frame_sptr frame, UINT bits);
00081 
00082  protected:
00083    bool read_header();
00084    bool write_header();
00085 };
00086 
00087 
00088 #endif // vidl_vil1_avicodec_h

Generated on Tue Dec 2 05:09:13 2008 for core/vidl_vil1 by  doxygen 1.5.1