Gnash
0.8.10
|
00001 // VaapiContext.h: VA context abstraction 00002 // 00003 // Copyright (C) 2009, 2010, 2011, 2012 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 00020 #ifndef GNASH_VAAPICONTEXT_H 00021 #define GNASH_VAAPICONTEXT_H 00022 00023 00024 #include <queue> 00025 00026 #include "log.h" 00027 #include "vaapi_common.h" 00028 00029 namespace gnash { 00030 00031 // Forward declarations 00032 class VaapiSurface; 00033 00035 enum VaapiCodec { 00036 VAAPI_CODEC_UNKNOWN, 00037 VAAPI_CODEC_MPEG2, 00038 VAAPI_CODEC_MPEG4, 00039 VAAPI_CODEC_H264, 00040 VAAPI_CODEC_VC1 00041 }; 00042 00044 class VaapiContextData { 00045 public: 00046 virtual ~VaapiContextData() 00047 { /* do nothing */ } 00048 }; 00049 00051 class DSOEXPORT VaapiContext { 00052 typedef boost::shared_ptr<VaapiSurface> VaapiSurfaceSP; 00053 00054 VADisplay _display; 00055 VAConfigID _config; 00056 VAContextID _context; 00057 VaapiCodec _codec; 00058 VAProfile _profile; 00059 VAEntrypoint _entrypoint; 00060 std::queue<VaapiSurfaceSP> _surfaces; 00061 unsigned int _picture_width; 00062 unsigned int _picture_height; 00063 std::auto_ptr<VaapiContextData> _user_data; 00064 00065 bool construct(); 00066 void destruct(); 00067 bool createContext(unsigned int width, unsigned int height); 00068 void destroyContext(); 00069 00070 public: 00071 VaapiContext(VAProfile profile, VAEntrypoint entrypoint); 00072 ~VaapiContext(); 00073 00075 bool initDecoder(unsigned int width, unsigned int height); 00076 00078 VAContextID get() const { return _context; } 00079 00081 boost::shared_ptr<VaapiSurface> acquireSurface(); 00082 00084 void releaseSurface(boost::shared_ptr<VaapiSurface> surface); 00085 00087 void setData(std::auto_ptr<VaapiContextData> user_data) { _user_data = user_data; } 00088 00090 VaapiContextData *getData() const { return _user_data.get(); } 00091 }; 00092 00093 } // gnash namespace 00094 00095 #endif // GNASH_VAAPICONTEXT_H 00096 00097 // local Variables: 00098 // mode: C++ 00099 // indent-tabs-mode: nil 00100 // End: 00101 00102