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