static GstBuffer * gst_my_sink_buffer_allocate (GstPad *pad,
guint64 offset,
guint size);
static void
gst_my_sink_init (GstMySink *sink)
{
[..]
gst_pad_set_bufferalloc_function (sink->sinkpad,
gst_my_sink_buffer_allocate);
}
static void
gst_my_sink_buffer_free (GstBuffer *buf)
{
GstMySink *sink = GST_MY_SINK (GST_BUFFER_PRIVATE (buf));
/* Do whatever is needed here. */
[..]
}
static GstBuffer *
gst_my_sink_buffer_allocate (GstPad *pad,
guint64 offset,
guint size)
{
GstBuffer *buf = gst_buffer_new ();
/* So here it's up to you to wrap your private buffers and
* return that. */
GST_BUFFER_FREE_DATA_FUNC (buf) = gst_my_sink_buffer_free;
GST_BUFFER_PRIVATE (buf) = sink;
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
[..]
return buf;
}
|