[gst-devel] getting GdkPixbuf from gdkpixbufsink

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Jan 9 19:56:39 CET 2009


On Fri, 2009-01-09 at 17:17 +0000, mapping at sheerman-chase.org.uk wrote:

Hi,

> I have started by modifying gst-player-0.0.0, changed it to use the  
> gdkpixbufsink sink and waiting to process messages on the bus. I am  
> seeing the element/pixbuf messages without a problem. I then call the  
> following on the bus message:
> 
> buff = gst_structure_get_value (msg->structure,"pixbuf");
> 
> which gives me a non-zero pointer. I was expecting that is a GdkPixbuf  
> object. The problem I get is when I do GDK_IS_PIXBUF(buff) it returns  
> false. Any ideas why?

It returns a const GValue * from which you can retrieve the GdkPixbuf
object via

  pixbuf = g_value_dup_object (val);

(which gives you a reference to the pixbuf which you need to drop with
g_object_unref(pixbuf) when you don't need it any longer)


> Or am I meant to retrieve "last-pixbuf" from the sink directly?

You can do that as well. The "last-pixbuf" property is useful if you
want to check the pixbuf in your own time/interval and you're just
interested in the current pixbuf and not interested whether you're
missing any or not.

If you want to evaluate each and every pixbuf, you need to process the
messages.

There's also an example at:
http://webcvs.freedesktop.org/gstreamer/gst-plugins-good/tests/icles/gdkpixbufsink-test.c?view=markup

Cheers
 -Tim






More information about the gstreamer-devel mailing list