[gst-devel] downstream allocated buffers
ds at schleef.org
Wed Jan 12 12:54:22 CET 2005
On Wed, Jan 12, 2005 at 05:58:53PM +0100, Wim Taymans wrote:
> On Wed, 2005-01-12 at 21:40 +0530, Thirupathiah Annapureddy wrote:
> > Hi All,
> > How can a downstream element can enforce the upstream peer to use its
> > own buffers. For example, in the following pipeline
> > filesrc -> custom decoder -> file sink
> > I want the file src to read the data into the buffers allocated by the
> > custom decoder. custom decoder allocates mmaped dmable buffers from
> > the driver. This technique can reduce the memory copy overhead. how
> > can we ensure that the filesrc always reads the data into the buffers
> > allocated by the custom decoder?
You should create a function that allocates the kind of buffers
you want sent to your sink pad, and register it using
gst_pad_set_bufferalloc_function(). Upstream elements may
choose to use this if it is convenient. However, you should
always be prepared to accept "normal" buffers and memcpy() the
data to the correct place.
filesrc already creates special buffers, since they point to
mmap()ed regions. It would be of little benefit to use peer
allocated buffers in filesrc.
> I would like to see the old GstBufferPool resurected as it allows for
> this kind of operations.
Um, no. We have a replacement that actually works.
More information about the gstreamer-devel