core/vidl_vil1/vidl_vil1_mpegcodec.h

Go to the documentation of this file.
00001 #ifndef vidl_vil1_mpegcodec_h
00002 #define vidl_vil1_mpegcodec_h
00003 //:
00004 // \file
00005 //
00006 // \author l.e.galup
00007 //  this class sets up and executes the vidl_vil1_mpegcodec_helper, which
00008 //  is a wrapped port of mpeg2dec. it accepts the vo open function ptr
00009 //  in the constructor. this was done this way to make it more extensible,
00010 //  in case other video outputs would be added later.
00011 //
00012 //  To use:
00013 //  1) load the file
00014 //  2) set the attributes. format, demux, ...
00015 //  3) then use get_section. the get section call will actualize
00016 //     initialize the helper class. its a one shot deal. once
00017 //     initialized, you are stuck with that roi. i could change
00018 //     this later, if it proves necessary.
00019 //
00020 //  this class works on both mpeg1 and mpeg2.
00021 // \date July 2002
00022 
00023 #include <vidl_vil1/vidl_vil1_mpegcodec_helper.h>
00024 #include <vidl_vil1/vidl_vil1_codec.h>
00025 #include <vidl_vil1/vidl_vil1_codec_sptr.h>
00026 
00027 class vil1_image;
00028 
00029 //: Allows user to load MPEG files as vxl video.
00030 class vidl_vil1_mpegcodec : public vidl_vil1_codec
00031 {
00032   //--- these are set by load/save
00033   vidl_vil1_mpegcodec_helper * decoder_;
00034   frame_buffer * buffers_;
00035   bool inited;
00036 
00037   //-------------------------------------------------
00038 
00039  public:
00040   vidl_vil1_mpegcodec();
00041   ~vidl_vil1_mpegcodec();
00042 
00043   //Casting methods overridden here...
00044   vidl_vil1_mpegcodec* castto_vidl_vil1_mpegcodec(){return this;}
00045 
00046   //-----------------------------------------------------
00047   //pure virtual methods
00048   //------------------------------------------
00049 
00050   bool   get_section(int frame_position,
00051                      void* ib,
00052                      int x0,
00053                      int y0,
00054                      int xs,
00055                      int ys) const;
00056   int    put_section(int /*frame_position*/,
00057                      void* /*ib*/,
00058                      int /*x0*/,
00059                      int /*y0*/,
00060                      int /*xs*/,
00061                      int /*ys*/){return 0;}
00062 
00063   virtual bool probe(vcl_string const& fname);
00064   virtual vidl_vil1_codec_sptr load(vcl_string const& fname, char mode = 'r' );
00065   bool save(vidl_vil1_movie*  /*movie*/, vcl_string const&  /*fname*/){return true;}
00066   virtual vcl_string type() const {return "MPEG";}
00067 
00068   //-----------------------------------------------
00069   //initialization methods.
00070   //these must be set by the user before init is called,
00071   //but after load. init must be called, before get_section is
00072   //called.
00073   void set_grey_scale(bool grey);
00074   void set_demux_video();
00075   void set_pid(vcl_string pid);
00076   bool init();
00077 };
00078 
00079 #endif // vidl_vil1_mpegcodec_h

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