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 
gnash::VaapiImage::width
unsigned int width() const
Get image width.
Definition: VaapiImage.h:65
VaapiException.h
height
@ height
Definition: klash_part.cpp:329
gnash::VaapiGlobalContext
VA API global context.
Definition: VaapiGlobalContext.h:33
gnash::VaapiImage::getPitch
unsigned int getPitch(int plane) const
Get scanline pitch for the specified plane.
Definition: VaapiImage.cpp:166
gnash::VaapiGlobalContext::getImageFormat
const VAImageFormat * getImageFormat(VaapiImageFormat format) const
Get the VA image format matching format.
Definition: VaapiGlobalContext.cpp:96
gnash::VaapiGlobalContext::display
VADisplay display() const
Get the VA display.
Definition: VaapiGlobalContext.h:71
dsodefs.h
gnash::VaapiImage::unmap
bool unmap()
Unmap image data.
Definition: VaapiImage.cpp:134
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
_
#define _(String)
Definition: log.h:44
gnash::VaapiImage::isMapped
bool isMapped() const
Check whether the VA image is mapped.
Definition: VaapiImage.h:71
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
GNASH_REPORT_FUNCTION
#define GNASH_REPORT_FUNCTION
Definition: log.h:452
gnash::VaapiGlobalContext::get
static VaapiGlobalContext * get()
Get the unique global VA context.
Definition: VaapiGlobalContext.cpp:130
VaapiImageFormat.h
gnash::VaapiImage::height
unsigned int height() const
Get image height.
Definition: VaapiImage.h:68
gnash::VaapiImage::~VaapiImage
~VaapiImage()
Definition: VaapiImage.cpp:51
gnash::string_of_FOURCC
const char * string_of_FOURCC(std::uint32_t fourcc)
Return a string representation of a FOURCC.
Definition: vaapi_utils.cpp:61
gnash::VaapiImage::VaapiImage
VaapiImage(unsigned int width, unsigned int height, VaapiImageFormat format=VAAPI_IMAGE_RGB32)
Definition: VaapiImage.cpp:32
gnash::vaapi_check_status
bool vaapi_check_status(VAStatus status, const char *msg)
Check VA status for success or print out an error.
Definition: vaapi_utils.cpp:51
VaapiImageFormat
VaapiImageFormat
Image types.
Definition: VaapiImageFormat.h:34
gnash::VaapiImage
VA image abstraction.
Definition: VaapiImage.h:41
gnash::VaapiImage::getPlaneCount
unsigned int getPlaneCount() const
Get number of planes.
Definition: VaapiImage.h:80
VaapiImage.h
gnash::VaapiImage::format
VaapiImageFormat format() const
Get image format.
Definition: VaapiImage.h:62
vaapi_common.h
VaapiGlobalContext.h
VaapiSurface.h
log.h
gnash::VaapiImage::get
VAImageID get() const
Get VA image ID.
Definition: VaapiImage.h:59
gnash::VaapiImage::map
bool map()
Map image data.
Definition: VaapiImage.cpp:109
VAAPI_IMAGE_RGB32
@ VAAPI_IMAGE_RGB32
Packed RGB 8:8:8, 32-bit, A R G B, native endian byte-order.
Definition: VaapiImageFormat.h:52
DSOEXPORT
#define DSOEXPORT
Definition: dsodefs.h:55
gnash::VaapiException
VA exception abstraction.
Definition: VaapiException.h:29
width
@ width
Definition: klash_part.cpp:329
vaapi_utils.h
gnash::VaapiImage::getPlane
std::uint8_t * getPlane(int plane) const
Get pixels for the specified plane.
Definition: VaapiImage.cpp:156