Gnash  0.8.10
VaapiImage.h
Go to the documentation of this file.
00001 // VaapiImage.h: VA image abstraction
00002 // 
00003 // Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 //
00019 
00020 #ifndef GNASH_VAAPIIMAGE_H
00021 #define GNASH_VAAPIIMAGE_H
00022 
00023 #include <boost/scoped_array.hpp>
00024 #include <memory>
00025 
00026 #include "dsodefs.h"
00027 #include "vaapi_common.h"
00028 #include "VaapiImageFormat.h"
00029 
00030 // Forward declarations
00031 struct SwsContext;
00032 
00033 namespace gnash {
00034 
00035 // Forward declarations
00036 class VaapiSurface;
00037 class VAImageWrapper;
00038 class SwsContextWrapper;
00039 
00041 class DSOEXPORT VaapiImage
00042 {
00043     VaapiImageFormat    _format;
00044     VAImage             _image;
00045     boost::uint8_t *    _image_data;
00046 
00048     bool create(unsigned int width, unsigned int height);
00049 
00051     void destroy();
00052 
00053 public:
00054     VaapiImage(unsigned int     width,
00055                unsigned int     height,
00056                VaapiImageFormat format = VAAPI_IMAGE_RGB32);
00057     ~VaapiImage();
00058 
00060     VAImageID get() const { return _image.image_id; }
00061 
00063     VaapiImageFormat format() const { return _format; }
00064 
00066     unsigned int width() const { return _image.width; }
00067 
00069     unsigned int height() const { return _image.height; }
00070 
00072     bool isMapped() const { return _image_data != NULL; }
00073 
00075     bool map();
00076 
00078     bool unmap();
00079 
00081     unsigned int getPlaneCount() const { return _image.num_planes; }
00082 
00084     boost::uint8_t *getPlane(int plane) const;
00085 
00087     unsigned int getPitch(int plane) const;
00088 };
00089 
00090 } // gnash namespace
00091 
00092 #endif // GNASH_VAAPIIMAGE_H
00093 
00094 // local Variables:
00095 // mode: C++
00096 // indent-tabs-mode: nil
00097 // End:
00098 
00099