00001 // This is brl/bbas/vidl2/vidl2_ffmpeg_istream.h 00002 #ifndef vidl2_ffmpeg_istream_h_ 00003 #define vidl2_ffmpeg_istream_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief A video input stream using FFMPEG to decoded files 00010 // 00011 // \author Matt Leotta 00012 // \date 21 Dec 2005 00013 // 00014 // \verbatim 00015 // Modifications 00016 // Matt Leotta 21 Dec 2005 Adapted from code by Amitha Perera 00017 // \endverbatim 00018 00019 #include "vidl2_istream.h" 00020 #include <vcl_string.h> 00021 00022 00023 //: A video input stream using FFMPEG to decoded files 00024 class vidl2_ffmpeg_istream 00025 : public vidl2_istream 00026 { 00027 public: 00028 //: Constructor - default 00029 vidl2_ffmpeg_istream(); 00030 00031 //: Constructor - from a filename 00032 vidl2_ffmpeg_istream(const vcl_string& filename); 00033 00034 //: Destructor 00035 virtual ~vidl2_ffmpeg_istream(); 00036 00037 //: Open a new stream using a filename 00038 virtual bool open(const vcl_string& filename); 00039 00040 //: Close the stream 00041 virtual void close(); 00042 00043 //: Return true if the stream is open for reading 00044 virtual bool is_open() const; 00045 00046 //: Return true if the stream is in a valid state 00047 virtual bool is_valid() const; 00048 00049 //: Return true if the stream support seeking 00050 virtual bool is_seekable() const; 00051 00052 //: Return the number of frames if known 00053 // returns -1 for non-seekable streams 00054 virtual int num_frames() const; 00055 00056 //: Return the current frame number 00057 virtual unsigned int frame_number() const; 00058 00059 //: Return the width of each frame 00060 virtual unsigned int width() const; 00061 00062 //: Return the height of each frame 00063 virtual unsigned int height() const; 00064 00065 //: Return the pixel format 00066 virtual vidl2_pixel_format format() const; 00067 00068 //: Return the frame rate (FPS, 0.0 if unspecified) 00069 virtual double frame_rate() const; 00070 00071 //: Advance to the next frame (but don't acquire an image) 00072 virtual bool advance(); 00073 00074 //: Read the next frame from the stream (advance and acquire) 00075 virtual vidl2_frame_sptr read_frame(); 00076 00077 //: Return the current frame in the stream 00078 virtual vidl2_frame_sptr current_frame(); 00079 00080 //: Seek to the given frame number 00081 // \returns true if successful 00082 virtual bool seek_frame(unsigned int frame_number); 00083 00084 private: 00085 //: The private implementation (PIMPL) details. 00086 // This isolates the clients from the ffmpeg details 00087 struct pimpl; 00088 pimpl* is_; 00089 }; 00090 00091 #endif // vidl2_ffmpeg_istream_h_
1.5.1