core/vidl/vidl_ffmpeg_ostream.h
Go to the documentation of this file.
00001 // This is core/vidl/vidl_ffmpeg_ostream.h
00002 #ifndef vidl_ffmpeg_ostream_h_
00003 #define vidl_ffmpeg_ostream_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief A video output stream to an encoded file using FFMPEG
00010 //
00011 // \author Matt Leotta
00012 // \date 3 Jan 2006
00013 //
00014 // \verbatim
00015 //  Modifications
00016 //   Matt Leotta   3 Jan 2006   Adapted from code by Amitha Perera
00017 // \endverbatim
00018 
00019 #include "vidl_ostream.h"
00020 #include <vcl_string.h>
00021 #include "vidl_ffmpeg_ostream_params.h"
00022 
00023 
00024 //: The parameters used to initialize a ffmpeg writer.
00025 struct vidl_ffmpeg_ostream_params;
00026 
00027 
00028 //: A video output stream to an encoded file using FFMPEG
00029 class vidl_ffmpeg_ostream
00030   : public vidl_ostream
00031 {
00032  public:
00033   //: Constructor
00034   vidl_ffmpeg_ostream();
00035 
00036   //: Constructor - opens a stream
00037   vidl_ffmpeg_ostream(const vcl_string& filenam,
00038                       const vidl_ffmpeg_ostream_params& parms);
00039 
00040   //: Destructor
00041   virtual ~vidl_ffmpeg_ostream();
00042 
00043   //: Open the stream
00044   virtual bool open();
00045 
00046   //: Close the stream
00047   virtual void close();
00048 
00049   //: Return true if the stream is open for writing
00050   virtual bool is_open() const;
00051 
00052   //: Write and image to the stream
00053   // \retval false if the image could not be written
00054   virtual bool write_frame(const vidl_frame_sptr& frame);
00055 
00056   //: Set the filename
00057   void set_filename(const vcl_string& filenam) { filename_ = filenam; }
00058 
00059   //: Set the parameters
00060   void set_params(const vidl_ffmpeg_ostream_params& parms) { params_ = parms; }
00061 
00062   //: Access the filename
00063   vcl_string filename() const { return filename_; }
00064 
00065   //: Access the parameters
00066   const vidl_ffmpeg_ostream_params& params() const { return params_; }
00067 
00068  private:
00069   //: The private implementation (PIMPL) details
00070   //  This isolates the clients from the ffmpeg details
00071   struct pimpl;
00072   pimpl* os_;
00073 
00074   //: The filename to open
00075   vcl_string filename_;
00076 
00077   //: The parameters
00078   vidl_ffmpeg_ostream_params params_;
00079 };
00080 
00081 #endif // vidl_ffmpeg_ostream_h_