Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_VIDEODECODERFFMPEG_H
00020 #define GNASH_VIDEODECODERFFMPEG_H
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025
00026 #include <vector>
00027 #include <memory>
00028 #include "dsodefs.h"
00029 #include "log.h"
00030 #include "VideoDecoder.h"
00031 #include "MediaParser.h"
00032 #include "ffmpegHeaders.h"
00033
00034 namespace gnash {
00035 namespace media {
00036 namespace ffmpeg {
00037
00038
00039 class CodecContextWrapper;
00040 #ifdef HAVE_SWSCALE_H
00041 class SwsContextWrapper;
00042 #endif
00043
00044
00046 class VideoDecoderFfmpeg : public VideoDecoder {
00047
00048 public:
00049
00050 DSOEXPORT VideoDecoderFfmpeg(videoCodecType format, int width, int height);
00051
00052 DSOEXPORT VideoDecoderFfmpeg(const VideoInfo& info);
00053
00054 DSOEXPORT ~VideoDecoderFfmpeg();
00055
00056 void push(const EncodedVideoFrame& buffer);
00057
00058 std::auto_ptr<GnashImage> pop();
00059
00060 bool peek();
00061
00062 int width() const;
00063
00064 int height() const;
00065
00066 private:
00067
00069
00072 static CodecID flashToFfmpegCodec(videoCodecType format);
00073
00083 std::auto_ptr<GnashImage> frameToImage(AVCodecContext* srcCtx,
00084 const AVFrame& srcFrame);
00085
00086 void init(enum CodecID format, int width, int height,
00087 boost::uint8_t* extradata=0, int extradataSize=0);
00088
00089 std::auto_ptr<GnashImage> decode(const boost::uint8_t* input,
00090 boost::uint32_t input_size);
00091
00092 std::auto_ptr<GnashImage> decode(const EncodedVideoFrame* vf)
00093 {
00094 return decode(vf->data(), vf->dataSize());
00095 }
00096
00097 AVCodec* _videoCodec;
00098 std::auto_ptr<CodecContextWrapper> _videoCodecCtx;
00099
00100 #if HAVE_SWSCALE_H
00101
00102
00107 std::auto_ptr<SwsContextWrapper> _swsContext;
00108 #endif
00109
00110 std::vector<const EncodedVideoFrame*> _video_frames;
00111 };
00112
00113 }
00114 }
00115 }
00116
00117 #endif // __VIDEODECODERFFMPEG_H__