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_MEDIA_VIDEODECODERFFMPEGVAAPI_H
00020 #define GNASH_MEDIA_VIDEODECODERFFMPEGVAAPI_H
00021
00022 #include "VaapiContext.h"
00023 #include "VaapiSurface.h"
00024 #include "VaapiSurfaceProxy.h"
00025
00026 extern "C" {
00027 #include <libavcodec/avcodec.h>
00028 #include <libavcodec/vaapi.h>
00029 }
00030
00031 namespace gnash {
00032 namespace media {
00033 namespace ffmpeg {
00034
00036 class VaapiSurfaceFfmpeg : public VaapiSurfaceProxy {
00037 unsigned int _pic_num;
00038
00039 public:
00040 VaapiSurfaceFfmpeg(boost::shared_ptr<VaapiSurface> surface,
00041 boost::shared_ptr<VaapiContext> context)
00042 : VaapiSurfaceProxy(surface, context), _pic_num(0)
00043 { }
00044
00045 unsigned int getPicNum() const
00046 { return _pic_num; }
00047
00048 void setPicNum(unsigned int pic_num)
00049 { _pic_num = pic_num; }
00050 };
00051
00052 void vaapi_set_surface(AVFrame *pic, VaapiSurfaceFfmpeg *surface);
00053
00054 static inline VaapiSurfaceFfmpeg *vaapi_get_surface(const AVFrame *pic)
00055 {
00056 return reinterpret_cast<VaapiSurfaceFfmpeg *>(pic->data[0]);
00057 }
00058
00060 class VaapiContextFfmpeg : public vaapi_context {
00061 boost::shared_ptr<VaapiContext> _context;
00062
00063 public:
00064 VaapiContextFfmpeg(enum CodecID codec_id);
00065
00066 bool initDecoder(unsigned int width, unsigned int height);
00067
00068 VaapiSurfaceFfmpeg *getSurface()
00069 { return new VaapiSurfaceFfmpeg(_context->acquireSurface(), _context); }
00070
00071 static VaapiContextFfmpeg *create(enum CodecID codec_id);
00072 };
00073
00074 }
00075 }
00076 }
00077
00078 #endif