Re: write a media player using gtk+



On Fri, 2007-11-30 at 11:31 +0000, jcupitt gmail com wrote:
On Nov 30, 2007 2:45 AM, Bin Chen <binary chen gmail com> wrote:
image, but I am not familiar with XLib, so I want to know if it is
possible to use pure GTK+ API to achieve this? What about the
performance comparing to use XLib directly?

You can use gdk_draw_rgb_image() to paint an RGB array to the screen:

http://library.gnome.org/devel/gdk/unstable/gdk-GdkRGB.html#gdk-draw-rgb-image

This is a wrapper over the XImage functions, including XShm when
available, plus some nice dithering code. It's about as quick as you
can get with vanilla X11 calls. There's a tiny program in
gtk+-2.x.x/tests/testrgb.c which benchmarks your computer for drawing
speed with his operation. You could try that and see if it's going to
be quick enough for you.

If you want to go faster, you need to use another (non-X11) rendering
path. One possibility is the Xv extension, another is to go via
OpenGL. Both are somewhat hairy :-( and much less portable. As Ken
says, unless you really want to do this all yourself, GStreamer might
be the way to go.

Do you know how you get the video memory address of the gdk drawable? I
want to use memcpy to do the copying, because the gdk-draw-rgb-image
can't be accessed during two different threads.

Thanks.
Bin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]