1 // VaapiSurface.h: VA surface abstraction
3 // Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
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.
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.
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
25 #include "vaapi_common.h"
30 // Forward declarations
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
{
50 void reset(uintptr_t surface
) { _surface
= surface
; }
53 VaapiSurfaceImplBase(unsigned int width
, unsigned int height
);
54 virtual ~VaapiSurfaceImplBase() { }
57 uintptr_t surface() const { return _surface
; }
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
; }
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()); }
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
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
);
107 #endif // GNASH_VAAPISURFACE_H
111 // indent-tabs-mode: nil