Gnash
0.8.10
|
00001 // VaapiSurface.h: VA surface 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_VAAPISURFACE_H 00021 #define GNASH_VAAPISURFACE_H 00022 00023 #include <vector> 00024 00025 #include "vaapi_common.h" 00026 #include "dsodefs.h" 00027 00028 namespace gnash { 00029 00030 // Forward declarations 00031 class VaapiContext; 00032 class VaapiSubpicture; 00033 00035 struct VaapiRectangle : public VARectangle { 00036 VaapiRectangle(unsigned int w = 0, unsigned int h = 0) 00037 { x = 0; y = 0; width = w; height = h; } 00038 00039 VaapiRectangle(int x_, int y_, unsigned int w, unsigned int h) 00040 { x = x_; y = y_; width = w; height = h; } 00041 }; 00042 00044 class VaapiSurfaceImplBase { 00045 uintptr_t _surface; 00046 unsigned int _width; 00047 unsigned int _height; 00048 00049 protected: 00050 void reset(uintptr_t surface) { _surface = surface; } 00051 00052 public: 00053 VaapiSurfaceImplBase(unsigned int width, unsigned int height); 00054 virtual ~VaapiSurfaceImplBase() { } 00055 00057 uintptr_t surface() const { return _surface; } 00058 00060 unsigned int width() const { return _width; } 00061 00063 unsigned int height() const { return _height; } 00064 }; 00065 00067 class DSOEXPORT VaapiSurface 00068 { 00069 std::auto_ptr<VaapiSurfaceImplBase> _impl; 00070 std::vector< boost::shared_ptr<VaapiSubpicture> > _subpictures; 00071 00072 friend class VaapiContext; 00073 VaapiContext *_context; 00074 00076 void setContext(VaapiContext *context) { _context = context; } 00077 00078 public: 00079 VaapiSurface(unsigned int width, unsigned int height); 00080 00082 VaapiContext *getContext() const { return _context; } 00083 00085 VASurfaceID get() const { return static_cast<VASurfaceID>(_impl->surface()); } 00086 00088 unsigned int width() const { return _impl->width(); } 00089 00091 unsigned int height() const { return _impl->height(); } 00092 00094 void clear(); 00095 00097 bool associateSubpicture(boost::shared_ptr<VaapiSubpicture> subpicture, 00098 VaapiRectangle const & src_rect, 00099 VaapiRectangle const & dst_rect); 00100 00102 bool deassociateSubpicture(boost::shared_ptr<VaapiSubpicture> subpicture); 00103 }; 00104 00105 } // gnash namespace 00106 00107 #endif // GNASH_VAAPISURFACE_H 00108 00109 // local Variables: 00110 // mode: C++ 00111 // indent-tabs-mode: nil 00112 // End: 00113