[gst-devel] passing gstbuffer to videosink

Felipe Contreras felipe.contreras at gmail.com
Tue Aug 14 18:37:02 CEST 2007


On 8/12/07, pritesh <digitaldsp at excite.com> wrote:
>
> hi all,
>
> i have created a plugin for a hardware h264 decoder , (dsp processor)
>
> the decoder has exposed api for decoding , and displaying the picture.
>
>
> now in my decoder plugin after calling the decode frame api , the decoded data is in a fixed location , and i dont want to call display api from decoder plugin ,
> i want it to be called from my videosink plugin. because of av sync
>
>
> now i want to pass a GstBuffer to videosink plugin , created using gst_buffer_new() api
>
> and having  GST_BUFFER_DATA(buf) = decoder->frambuf
>                   GST_BUFFER_SIZE(buf)  = width * height * 1.5
>                   GST_BUFFER_TIMESTAMP(buf) = timestamp
>                   GST_BUFFER_DURATION(buf) = duration
>
> can i set the caps on this gstbuffer  using  gst_buffer_set_caps(buf,GST_PAD_CAPS(decoder->srcpad))

Of course.

>
> what will happen if do gst_buffer_unref on this buffer in sink .

You can check in the documentation:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#gst-buffer-unref

Decreases the refcount of the buffer. If the refcount reaches 0, the
buffer will be freed. If GST_BUFFER_MALLOCDATA() is non-NULL, this
pointer will also be freed at this time.

So if you don't want your frame to be freed on gst_buffer_unref, don't
do the following:
GST_BUFFER_MALLOCDATA(buf) = decoder->frambuf


I would like to take this chance to recommend you to check
GstOpenMAX[1] (an OpenMAX IL wrapper). OpenMAX IL is meant --among
other things-- to provide a standard API for these kinds of
decoding/encoding routines.

Best regards.

[1] http://freedesktop.org/wiki/GstOpenMAX

-- 
Felipe Contreras




More information about the gstreamer-devel mailing list