Gnash  0.8.10
gtk_glue_agg_vaapi.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
00003 //   2011 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 #ifdef HAVE_CONFIG_H
00021 #include "gnashconfig.h"
00022 #endif
00023 
00024 #include "gtk_glue.h"
00025 
00026 #include <gtk/gtk.h>
00027 #include <gdk/gdk.h>
00028 #include <boost/shared_ptr.hpp>
00029 #include <boost/scoped_array.hpp>
00030 #include <memory>
00031 #include "vaapi/VaapiImageFormat.h"
00032 
00033 namespace gnash
00034 {
00035 
00036 // Forward declarations
00037 class VaapiImage;
00038 class VaapiSurface;
00039 class VaapiSubpicture;
00040 class VaapiRectangle;
00041 class VaapiVideoWindow;
00042 class Renderer_agg_base;
00043 class movie_root;
00044 
00045 class GtkAggVaapiGlue : public GtkGlue
00046 {
00047 public:
00048     GtkAggVaapiGlue();
00049     ~GtkAggVaapiGlue();
00050 
00051     bool init(int argc, char **argv[]);
00052     void prepDrawingArea(GtkWidget *drawing_area);
00053     Renderer* createRenderHandler();
00054     void setRenderHandlerSize(int width, int height);
00055     virtual void beforeRendering(movie_root* stage);
00056     void render();
00057     void render(GdkRegion * const);
00058     void configure(GtkWidget *const widget, GdkEventConfigure *const event);
00059 
00060 private:
00061     VaapiVideoWindow *getVideoWindow(boost::shared_ptr<VaapiSurface> surface,
00062                                      GdkWindow *parent_window,
00063                                      VaapiRectangle const & rect);
00064 
00065     void resetRenderSurface(unsigned int width, unsigned int height);
00066 
00067 private:
00068     Renderer_agg_base                  *_agg_renderer;
00069     VaapiImageFormat                    _vaapi_image_format;
00070     boost::shared_ptr<VaapiImage>       _vaapi_image;
00071     unsigned int                        _vaapi_image_width;
00072     unsigned int                        _vaapi_image_height;
00073     boost::shared_ptr<VaapiSubpicture>  _vaapi_subpicture;
00074     std::auto_ptr<VaapiSurface>         _vaapi_surface;
00075     unsigned int                        _window_width;
00076     unsigned int                        _window_height;
00077     bool                                _window_is_setup;
00078 };
00079 
00080 } // namespace gnash