Dears, <br><br>I found the reason why my buffer_alloc() is not called. <br>So I answer this question by myself and for your reference if some body needs it.<br><br>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.<br>
<br>It is independent of pull-mode or push-mode.<br><br>The source, videotestsrc, is an example to use gst_pad_alloc_buffer().<br><br>France Hsu<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Hi! Tim,<br>
<br>
Thanks for your reply.<br>
I would misunderstand the meaning of "pull-mode sink".<br>
You mean, pull-mode and buffer allocated by sink are two different things,<br>
right?<br>
<br>
In the fact, my sink is for a HW device, so I want the source to use the HW<br>
buffer (allocated in sink) for data flow, not to allocate by source itself.<br>
<br>
I wish to use udpsrc for the pipeline, and found it is based on GstPushSrc.<br>
(Therefore, I thought I should implement a pull-based sink, and find a<br>
pull-based source)<br>
$ gst-launch udpsrc udp://IP:PORT ! mysink<br>
<br>
However, my buffer_alloc function is not called.<br>
<br>
France Hsu<br>
<br>
<br>
> Hi,<br>
><br>
> > I'm a newbie for gstreamer and working on a sink that I wish it would<br>
> > provide buffer for source. I think it would be a pull-based sink.<br>
> > (...)<br>
> > I implemented this sink based on base-sink, and added the virtual<br>
> > function: buffer_alloc() (gst_my_sink_buffer_alloc) and render()<br>
> > (gst_my_sink_render).<br>
><br>
> What kind of sink is this?<br>
><br>
> There's no need for the sink to operate in pull mode to be able to<br>
> provide buffers to upstream. It should be sufficient to implement a<br>
> buffer alloc function.<br>
><br>
> Take for example:<br>
><br>
> $ GST_DEBUG=*src:5,*sink:5 videotestsrc num-buffers=2 ! ximagesink<br>
><br>
> This will operate in push mode, but videotestsrc will call<br>
> gst_pad_alloc_buffer() to get a buffer from ximagesink and then fill<br>
> that with data and push it back to ximagesink.<br>
><br>
> Pull mode for sinks is something that's not really used much in practice<br>
> and is rarely useful. Maybe you could provide some more details of what<br>
> you're trying to do?<br>
><br>
> Cheers<br>
> -Tim<br>
><br>
><br></blockquote></div>