00001 #ifndef vidl_vil1_avicodec_h
00002 #define vidl_vil1_avicodec_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00031
00032
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
00052
00053
00054 enum AVIEncoderType { ASKUSER, USEPREVIOUS, UNCOMPRESSED, CINEPACK };
00055
00056
00057 AVIEncoderType encoder_type;
00058
00059
00060 AVICOMPRESSOPTIONS opts;
00061
00062 bool encoder_options_valid;
00063
00064
00065
00066
00067
00068
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
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