00001 // This is brl/bbas/vidl2/vidl2_ffmpeg_ostream.h 00002 #ifndef vidl2_ffmpeg_ostream_h_ 00003 #define vidl2_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 "vidl2_ostream.h" 00020 #include <vcl_string.h> 00021 #include "vidl2_ffmpeg_ostream_params.h" 00022 00023 00024 //: The parameters used to initialize a ffmpeg writer. 00025 struct vidl2_ffmpeg_ostream_params; 00026 00027 00028 //: A video output stream to an encoded file using FFMPEG 00029 class vidl2_ffmpeg_ostream 00030 : public vidl2_ostream 00031 { 00032 public: 00033 //: Constructor 00034 vidl2_ffmpeg_ostream(); 00035 00036 //: Constructor - opens a stream 00037 vidl2_ffmpeg_ostream(const vcl_string& filename, 00038 const vidl2_ffmpeg_ostream_params& params); 00039 00040 //: Destructor 00041 virtual ~vidl2_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 vidl2_frame_sptr& frame); 00055 00056 //: Set the filename 00057 void set_filename(const vcl_string& filename) { filename_ = filename; } 00058 00059 //: Set the parameters 00060 void set_params(const vidl2_ffmpeg_ostream_params& params) { params_ = params; } 00061 00062 //: Access the filename 00063 vcl_string filename() const { return filename_; } 00064 00065 //: Access the parameters 00066 const vidl2_ffmpeg_ostream_params& params() const { return params_; } 00067 00068 00069 private: 00070 //: The private implementation (PIMPL) details 00071 // This isolates the clients from the ffmpeg details 00072 struct pimpl; 00073 pimpl* os_; 00074 00075 //: The filename to open 00076 vcl_string filename_; 00077 00078 //: The parameters 00079 vidl2_ffmpeg_ostream_params params_; 00080 }; 00081 00082 #endif // vidl2_ffmpeg_ostream_h_
1.4.4