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 <boost/scoped_array.hpp>
24 #include <memory>
25 
26 #include "dsodefs.h"
27 #include "vaapi_common.h"
28 #include "VaapiImageFormat.h"
29 
30 // Forward declarations
31 struct SwsContext;
32 
33 namespace gnash {
34 
35 // Forward declarations
36 class VaapiSurface;
37 class VAImageWrapper;
38 class SwsContextWrapper;
39 
42 {
44  VAImage _image;
45  boost::uint8_t * _image_data;
46 
48  bool create(unsigned int width, unsigned int height);
49 
51  void destroy();
52 
53 public:
54  VaapiImage(unsigned int width,
55  unsigned int height,
57  ~VaapiImage();
58 
60  VAImageID get() const { return _image.image_id; }
61 
63  VaapiImageFormat format() const { return _format; }
64 
66  unsigned int width() const { return _image.width; }
67 
69  unsigned int height() const { return _image.height; }
70 
72  bool isMapped() const { return _image_data != NULL; }
73 
75  bool map();
76 
78  bool unmap();
79 
81  unsigned int getPlaneCount() const { return _image.num_planes; }
82 
84  boost::uint8_t *getPlane(int plane) const;
85 
87  unsigned int getPitch(int plane) const;
88 };
89 
90 } // gnash namespace
91 
92 #endif // GNASH_VAAPIIMAGE_H
93 
94 // local Variables:
95 // mode: C++
96 // indent-tabs-mode: nil
97 // End:
98 
99