[gst-devel] gst_buffer_new

Tim Müller t.i.m at zen.co.uk
Wed Aug 8 10:51:38 CEST 2007


On Wed, 2007-08-08 at 04:41 -0400, pritesh wrote:

> i create a GstBuffer using buf = gst_buffer_new();
> 
> is this valid
> 
> GST_BUFFER_DATA(buf) = outbuf;
> 
> here outbuf is guchar* pointer which has yuv data (from decoder ) .
> 
> can i pass this "buf" to videosink plugin . how this buffer will be
> unreferenced.
> 

It is valid, but the data won't be freed this way.  For that to happen,
you'd also need to assign GST_BUFFER_MALLOCDATA(buf), but that assumes
your data was allocated via g_malloc() and friends.  In order to use a
custom free function you'd need to implement your own GstBuffer subclass
(see gstfilesrc.c in core or efence.c in gst-plugins-good for an
example).

Cheers
 -Tim






More information about the gstreamer-devel mailing list