• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

VaapiSurface.h

Go to the documentation of this file.
00001 // VaapiSurface.h: VA surface abstraction
00002 // 
00003 // Copyright (C) 2009, 2010 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_VAAPISURFACE_H
00021 #define GNASH_VAAPISURFACE_H
00022 
00023 #include "vaapi_common.h"
00024 #include <vector>
00025 
00026 namespace gnash {
00027 
00028 // Forward declarations
00029 class VaapiContext;
00030 class VaapiSubpicture;
00031 
00033 struct VaapiRectangle : public VARectangle {
00034     VaapiRectangle(unsigned int w = 0, unsigned int h = 0)
00035         { x = 0; y = 0; width = w; height = h; }
00036 
00037     VaapiRectangle(int x_, int y_, unsigned int w, unsigned int h)
00038         { x = x_; y = y_; width = w; height = h; }
00039 };
00040 
00042 class VaapiSurfaceImplBase {
00043     uintptr_t           _surface;
00044     unsigned int        _width;
00045     unsigned int        _height;
00046 
00047 protected:
00048     void reset(uintptr_t surface) { _surface = surface; }
00049 
00050 public:
00051     VaapiSurfaceImplBase(unsigned int width, unsigned int height);
00052     virtual ~VaapiSurfaceImplBase() { }
00053 
00055     uintptr_t surface() const { return _surface; }
00056 
00058     unsigned int width() const { return _width; }
00059 
00061     unsigned int height() const { return _height; }
00062 };
00063 
00065 class VaapiSurface {
00066     std::auto_ptr<VaapiSurfaceImplBase> _impl;
00067     std::vector< boost::shared_ptr<VaapiSubpicture> > _subpictures;
00068 
00069     friend class VaapiContext;
00070     VaapiContext *_context;
00071 
00073     void setContext(VaapiContext *context) { _context = context; }
00074 
00075 public:
00076     VaapiSurface(unsigned int width, unsigned int height);
00077 
00079     VaapiContext *getContext() const { return _context; }
00080 
00082     VASurfaceID get() const { return static_cast<VASurfaceID>(_impl->surface()); }
00083 
00085     unsigned int width() const { return _impl->width(); }
00086 
00088     unsigned int height() const { return _impl->height(); }
00089 
00091     void clear();
00092 
00094     bool associateSubpicture(boost::shared_ptr<VaapiSubpicture> subpicture,
00095                              VaapiRectangle const & src_rect,
00096                              VaapiRectangle const & dst_rect);
00097 
00099     bool deassociateSubpicture(boost::shared_ptr<VaapiSubpicture> subpicture);
00100 };
00101 
00102 } // gnash namespace
00103 
00104 #endif // GNASH_VAAPISURFACE_H
00105 
00106 // local Variables:
00107 // mode: C++
00108 // indent-tabs-mode: nil
00109 // End:
00110 

Generated on Thu Sep 30 2010 14:35:04 for Gnash by  doxygen 1.7.1