Include program counter on action limit notification log
[gnash.git] / libvaapi / VaapiSurface.h
blob7d5ba48f907f888efa72b1653279ee7261af8ba4
1 // VaapiSurface.h: VA surface abstraction
2 //
3 // Copyright (C) 2009, 2010 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
20 #ifndef GNASH_VAAPISURFACE_H
21 #define GNASH_VAAPISURFACE_H
23 #include <vector>
25 #include "vaapi_common.h"
26 #include "dsodefs.h"
28 namespace gnash {
30 // Forward declarations
31 class VaapiContext;
32 class VaapiSubpicture;
34 /// VA rectangle abstraction
35 struct VaapiRectangle : public VARectangle {
36 VaapiRectangle(unsigned int w = 0, unsigned int h = 0)
37 { x = 0; y = 0; width = w; height = h; }
39 VaapiRectangle(int x_, int y_, unsigned int w, unsigned int h)
40 { x = x_; y = y_; width = w; height = h; }
43 /// VA surface base representation
44 class VaapiSurfaceImplBase {
45 uintptr_t _surface;
46 unsigned int _width;
47 unsigned int _height;
49 protected:
50 void reset(uintptr_t surface) { _surface = surface; }
52 public:
53 VaapiSurfaceImplBase(unsigned int width, unsigned int height);
54 virtual ~VaapiSurfaceImplBase() { }
56 /// Get VA surface
57 uintptr_t surface() const { return _surface; }
59 /// Get surface width
60 unsigned int width() const { return _width; }
62 /// Get surface height
63 unsigned int height() const { return _height; }
66 /// VA surface abstraction
67 class DSOEXPORT VaapiSurface
69 std::auto_ptr<VaapiSurfaceImplBase> _impl;
70 std::vector< boost::shared_ptr<VaapiSubpicture> > _subpictures;
72 friend class VaapiContext;
73 VaapiContext *_context;
75 /// Set parent VA context
76 void setContext(VaapiContext *context) { _context = context; }
78 public:
79 VaapiSurface(unsigned int width, unsigned int height);
81 /// Return parent VA context
82 VaapiContext *getContext() const { return _context; }
84 /// Return VA surface id
85 VASurfaceID get() const { return static_cast<VASurfaceID>(_impl->surface()); }
87 /// Get surface width
88 unsigned int width() const { return _impl->width(); }
90 /// Get surface height
91 unsigned int height() const { return _impl->height(); }
93 /// Clear surface with black color
94 void clear();
96 /// Associate subpicture to the surface
97 bool associateSubpicture(boost::shared_ptr<VaapiSubpicture> subpicture,
98 VaapiRectangle const & src_rect,
99 VaapiRectangle const & dst_rect);
101 /// Deassociate subpicture from the surface
102 bool deassociateSubpicture(boost::shared_ptr<VaapiSubpicture> subpicture);
105 } // gnash namespace
107 #endif // GNASH_VAAPISURFACE_H
109 // local Variables:
110 // mode: C++
111 // indent-tabs-mode: nil
112 // End: