00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef FFMPEG_MEDIA_DECODER_H
00012 #define FFMPEG_MEDIA_DECODER_H
00013
00014 #include <wx/string.h>
00015 #include <wx/image.h>
00016 struct AVFormatContext;
00017 struct AVCodecContext;
00018 struct AVFrame;
00019 struct AVStream;
00020
00021 class wxFfmpegMediaDecoder
00022 {
00023 public:
00024 wxFfmpegMediaDecoder();
00025 virtual ~wxFfmpegMediaDecoder();
00026 static void Init();
00027
00028 virtual bool Load(const wxString& fileName);
00029 virtual void Close();
00030
00031 double GetDuration();
00032 bool SetPosition(double pos);
00033
00034 virtual wxSize GetVideoSize();
00035
00036 virtual bool BeginDecode(int width = -1, int height = -1);
00037 virtual wxImage GetNextFrame();
00038 virtual void EndDecode();
00039
00040 private:
00041 AVFormatContext* m_formatCtx;
00042 int m_videoStream;
00043 AVCodecContext* m_codecCtx;
00044 AVFrame* m_frame;
00045 int m_width;
00046 int m_height;
00047 bool OpenVideoDecoder();
00048 void CloseVideoDecoder();
00049 };
00050
00051 #endif //FFMPEG_MEDIA_DECODER_H