Do not assume directories passed to mkdirRecursive have to be absolute. Fixes bug...
[gnash.git] / libvaapi / VaapiImage.h
blob0393e6938b87c6beb275b93b19226de03be783e4
1 // VaapiImage.h: VA image 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_VAAPIIMAGE_H
21 #define GNASH_VAAPIIMAGE_H
23 #include <boost/scoped_array.hpp>
24 #include <memory>
26 #include "dsodefs.h"
27 #include "vaapi_common.h"
28 #include "VaapiImageFormat.h"
30 // Forward declarations
31 struct SwsContext;
33 namespace gnash {
35 // Forward declarations
36 class VaapiSurface;
37 class VAImageWrapper;
38 class SwsContextWrapper;
40 /// VA image abstraction
41 class DSOEXPORT VaapiImage
43 VaapiImageFormat _format;
44 VAImage _image;
45 boost::uint8_t * _image_data;
47 /// Create VA image
48 bool create(unsigned int width, unsigned int height);
50 /// Destroy VA image
51 void destroy();
53 public:
54 VaapiImage(unsigned int width,
55 unsigned int height,
56 VaapiImageFormat format = VAAPI_IMAGE_RGB32);
57 ~VaapiImage();
59 /// Get VA image ID
60 VAImageID get() const { return _image.image_id; }
62 /// Get image format
63 VaapiImageFormat format() const { return _format; }
65 /// Get image width
66 unsigned int width() const { return _image.width; }
68 /// Get image height
69 unsigned int height() const { return _image.height; }
71 /// Check whether the VA image is mapped
72 bool isMapped() const { return _image_data != NULL; }
74 /// Map image data
75 bool map();
77 /// Unmap image data
78 bool unmap();
80 /// Get number of planes
81 unsigned int getPlaneCount() const { return _image.num_planes; }
83 /// Get pixels for the specified plane
84 boost::uint8_t *getPlane(int plane) const;
86 /// Get scanline pitch for the specified plane
87 unsigned int getPitch(int plane) const;
90 } // gnash namespace
92 #endif // GNASH_VAAPIIMAGE_H
94 // local Variables:
95 // mode: C++
96 // indent-tabs-mode: nil
97 // End: