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

gtk_glue_agg_xv.h

Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // 
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 //
00018 
00019 #ifdef HAVE_CONFIG_H
00020 #include "gnashconfig.h"
00021 #endif
00022 
00023 #include "gtk_glue.h"
00024 #include "MediaHandler.h"
00025 
00026 #include <string>
00027 #include <gtk/gtk.h>
00028 #include <gdk/gdk.h>
00029 #include <boost/scoped_array.hpp>
00030 
00031 #include <X11/Xlib.h>
00032 
00033 #include <X11/extensions/XShm.h>
00034 #include <X11/extensions/Xv.h>
00035 #include <X11/extensions/Xvlib.h>
00036 
00037 
00038 namespace gnash
00039 {
00040 
00041 class GtkAggXvGlue : public GtkGlue
00042 {
00043   public:
00044     GtkAggXvGlue();
00045     ~GtkAggXvGlue();
00046 
00047     bool init(int argc, char **argv[]);
00048     void prepDrawingArea(GtkWidget *drawing_area);
00049     Renderer* createRenderHandler();
00050     void beforeRendering();
00051     void render();
00052     void render(int minx, int miny, int maxx, int maxy);
00053     void configure(GtkWidget *const widget, GdkEventConfigure *const event);
00054 
00055   private:
00056     bool findXvPort(Display* display);
00057     bool grabXvPort(Display *display, XvPortID port);
00058     bool create_xv_image(unsigned int width, unsigned int height);
00059     bool create_xv_shmimage(unsigned int width, unsigned int height);
00060     void destroy_x_image();
00061     void setupRendering();
00062     void decode_mask(unsigned long mask, unsigned int *shift, unsigned int *size);
00063     bool isFormatBetter(const XvImageFormatValues& oldformat,
00064                         const XvImageFormatValues& newformat);
00065     bool ensurePortGrabbed(Display *display, XvPortID port);
00066     std::string findPixelFormat(const XvImageFormatValues& format);
00067 
00069     boost::scoped_array<boost::uint8_t> _offscreenbuf;
00070     Renderer *_agg_renderer;
00071     size_t _stride;
00072 
00074     XvImage* _xv_image;           
00075     bool _xv_image_is_shared;
00076     XvPortID _xv_port;
00077     unsigned int _xv_max_width;
00078     unsigned int _xv_max_height;
00079     int _window_width;
00080     int _window_height;
00081     int _movie_width;
00082     int _movie_height;
00083     
00084     media::MediaHandler* _mediaHandler;
00085     std::auto_ptr<media::VideoConverter> _video_converter;
00086     
00087     XvImageFormatValues _xv_format;
00088 
00089     XShmSegmentInfo *_shm_info;
00090 };
00091 
00092 } // namespace gnash
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 

Generated on Fri Mar 16 2012 15:46:10 for Gnash by  doxygen 1.7.1