Gnash  0.8.11dev
VaapiImage.h
Go to the documentation of this file.
1 // VaapiImage.h: VA image 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_VAAPIIMAGE_H
21 #define GNASH_VAAPIIMAGE_H
22 
23 #include <memory>
24 
25 #include "dsodefs.h"
26 #include "vaapi_common.h"
27 #include "VaapiImageFormat.h"
28 
29 // Forward declarations
30 struct SwsContext;
31 
32 namespace gnash {
33 
34 // Forward declarations
35 class VaapiSurface;
36 class VAImageWrapper;
37 class SwsContextWrapper;
38 
41 {
42  VaapiImageFormat _format;
43  VAImage _image;
44  std::uint8_t * _image_data;
45 
47  bool create(unsigned int width, unsigned int height);
48 
50  void destroy();
51 
52 public:
53  VaapiImage(unsigned int width,
54  unsigned int height,
56  ~VaapiImage();
57 
59  VAImageID get() const { return _image.image_id; }
60 
62  VaapiImageFormat format() const { return _format; }
63 
65  unsigned int width() const { return _image.width; }
66 
68  unsigned int height() const { return _image.height; }
69 
71  bool isMapped() const { return _image_data != NULL; }
72 
74  bool map();
75 
77  bool unmap();
78 
80  unsigned int getPlaneCount() const { return _image.num_planes; }
81 
83  std::uint8_t *getPlane(int plane) const;
84 
86  unsigned int getPitch(int plane) const;
87 };
88 
89 } // gnash namespace
90 
91 #endif // GNASH_VAAPIIMAGE_H
92 
93 // local Variables:
94 // mode: C++
95 // indent-tabs-mode: nil
96 // End:
97 
98 
unsigned int height() const
Get image height.
Definition: VaapiImage.h:68
VaapiImageFormat
Image types.
Definition: VaapiImageFormat.h:34
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Definition: klash_part.cpp:329
unsigned int getPlaneCount() const
Get number of planes.
Definition: VaapiImage.h:80
Definition: klash_part.cpp:329
Packed RGB 8:8:8, 32-bit, A R G B, native endian byte-order.
Definition: VaapiImageFormat.h:52
bool isMapped() const
Check whether the VA image is mapped.
Definition: VaapiImage.h:71
#define DSOEXPORT
Definition: dsodefs.h:55
VaapiImageFormat format() const
Get image format.
Definition: VaapiImage.h:62
VA image abstraction.
Definition: VaapiImage.h:40
unsigned int width() const
Get image width.
Definition: VaapiImage.h:65