• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

VideoDecoderFfmpegVaapi.h

Go to the documentation of this file.
00001 // vaapi.h: VA API acceleration.
00002 // 
00003 //     Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA    02110-1301    USA
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 } // gnash.media.ffmpeg namespace 
00075 } // gnash.media namespace 
00076 } // gnash namespace
00077 
00078 #endif /* GNASH_MEDIA_VIDEODECODERFFMPEGVAAPI_H */

Generated on Thu Sep 30 2010 14:35:04 for Gnash by  doxygen 1.7.1