Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102