Gnash  0.8.11dev
VaapiSurface.h
Go to the documentation of this file.
1 // VaapiSurface.h: VA surface abstraction
2 //
3 // Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 
20 #ifndef GNASH_VAAPISURFACE_H
21 #define GNASH_VAAPISURFACE_H
22 
23 #include <vector>
24 
25 #include "vaapi_common.h"
26 #include "dsodefs.h"
27 
28 namespace gnash {
29 
30 // Forward declarations
31 class VaapiContext;
32 class VaapiSubpicture;
33 
35 struct VaapiRectangle : public VARectangle {
36  VaapiRectangle(unsigned int w = 0, unsigned int h = 0)
37  { x = 0; y = 0; width = w; height = h; }
38 
39  VaapiRectangle(int x_, int y_, unsigned int w, unsigned int h)
40  { x = x_; y = y_; width = w; height = h; }
41 };
42 
45  uintptr_t _surface;
46  unsigned int _width;
47  unsigned int _height;
48 
49 protected:
50  void reset(uintptr_t surface) { _surface = surface; }
51 
52 public:
53  VaapiSurfaceImplBase(unsigned int width, unsigned int height);
54  virtual ~VaapiSurfaceImplBase() { }
55 
57  uintptr_t surface() const { return _surface; }
58 
60  unsigned int width() const { return _width; }
61 
63  unsigned int height() const { return _height; }
64 };
65 
68 {
69  std::unique_ptr<VaapiSurfaceImplBase> _impl;
70  std::vector< std::shared_ptr<VaapiSubpicture> > _subpictures;
71 
72  friend class VaapiContext;
73  VaapiContext *_context;
74 
76  void setContext(VaapiContext *context) { _context = context; }
77 
78 public:
79  VaapiSurface(unsigned int width, unsigned int height);
80 
82  VaapiContext *getContext() const { return _context; }
83 
85  VASurfaceID get() const { return static_cast<VASurfaceID>(_impl->surface()); }
86 
88  unsigned int width() const { return _impl->width(); }
89 
91  unsigned int height() const { return _impl->height(); }
92 
94  void clear();
95 
97  bool associateSubpicture(std::shared_ptr<VaapiSubpicture> subpicture,
98  VaapiRectangle const & src_rect,
99  VaapiRectangle const & dst_rect);
100 
102  bool deassociateSubpicture(std::shared_ptr<VaapiSubpicture> subpicture);
103 };
104 
105 } // gnash namespace
106 
107 #endif // GNASH_VAAPISURFACE_H
108 
109 // local Variables:
110 // mode: C++
111 // indent-tabs-mode: nil
112 // End:
113 
VA rectangle abstraction.
Definition: VaapiSurface.h:35
void reset(uintptr_t surface)
Definition: VaapiSurface.h:50
void clear()
Clean up the font library.
Definition: fontlib.cpp:36
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Definition: klash_part.cpp:329
unsigned int width() const
Get surface width.
Definition: VaapiSurface.h:88
VaapiRectangle(int x_, int y_, unsigned int w, unsigned int h)
Definition: VaapiSurface.h:39
Definition: klash_part.cpp:329
unsigned int height() const
Get surface height.
Definition: VaapiSurface.h:91
std::int32_t x
Definition: BitmapData_as.cpp:434
#define DSOEXPORT
Definition: dsodefs.h:55
uintptr_t surface() const
Get VA surface.
Definition: VaapiSurface.h:57
virtual ~VaapiSurfaceImplBase()
Definition: VaapiSurface.h:54
VA surface base representation.
Definition: VaapiSurface.h:44
unsigned int width() const
Get surface width.
Definition: VaapiSurface.h:60
std::int32_t y
Definition: BitmapData_as.cpp:435
VaapiContext * getContext() const
Return parent VA context.
Definition: VaapiSurface.h:82
Definition: GnashKey.h:154
w
Definition: test.py:8
unsigned int height() const
Get surface height.
Definition: VaapiSurface.h:63
VaapiRectangle(unsigned int w=0, unsigned int h=0)
Definition: VaapiSurface.h:36
VA surface abstraction.
Definition: VaapiSurface.h:67
VA context abstraction.
Definition: VaapiContext.h:51