[gst-devel] How to implement a pull-based sink?

Hsu France france.hsu.b at gmail.com
Tue Feb 9 07:20:45 CET 2010


Dears,

I found the reason why my buffer_alloc() is not called.
So I answer this question by myself and for your reference if some body
needs it.

At first, I used the udpsrc as my source, but udpsrc malloc the buffer
itself, and doesn't use gst_pad_alloc_buffer(). gst_pad_alloc_buffer() will
invoke the sink's buffer_alloc() function.

It is independent of pull-mode or push-mode.

The source, videotestsrc, is an example to use gst_pad_alloc_buffer().

France Hsu


>
> Hi! Tim,
>
> Thanks for your reply.
> I would misunderstand the meaning of "pull-mode sink".
> You mean, pull-mode and buffer allocated by sink are two different things,
> right?
>
> In the fact, my sink is for a HW device, so I want the source to use the HW
> buffer (allocated in sink) for data flow, not to allocate by source itself.
>
> I wish to use udpsrc for the pipeline, and found it is based on GstPushSrc.
> (Therefore, I thought I should implement a pull-based sink, and find a
> pull-based source)
> $ gst-launch udpsrc udp://IP:PORT ! mysink
>
> However, my buffer_alloc function is not called.
>
> France Hsu
>
>
> > Hi,
> >
> > > I'm a newbie for gstreamer and  working on a sink that I wish it would
> > > provide buffer for source. I think it would be a pull-based sink.
> > >  (...)
> > > I implemented this sink based on base-sink, and added the virtual
> > > function: buffer_alloc() (gst_my_sink_buffer_alloc) and render()
> > > (gst_my_sink_render).
> >
> > What kind of sink is this?
> >
> > There's no need for the sink to operate in pull mode to be able to
> > provide buffers to upstream. It should be sufficient to implement a
> > buffer alloc function.
> >
> > Take for example:
> >
> >  $ GST_DEBUG=*src:5,*sink:5 videotestsrc num-buffers=2 ! ximagesink
> >
> > This will operate in push mode, but videotestsrc will call
> > gst_pad_alloc_buffer() to get a buffer from ximagesink and then fill
> > that with data and push it back to ximagesink.
> >
> > Pull mode for sinks is something that's not really used much in practice
> > and is rarely useful. Maybe you could provide some more details of what
> > you're trying to do?
> >
> >  Cheers
> >  -Tim
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100209/805bb3a4/attachment.htm>


More information about the gstreamer-devel mailing list