[gst-devel] Synchronizing between "disconnected" sink and source

Steve Fink sphink at gmail.com
Wed Jun 6 23:56:30 CEST 2007


I am trying to write a plugin element that keeps a copy of all data
received on its sink, and at a later time produces on one or more
sources. Currently, I am basing it off of GstBaseAudioSink, because it
seems like I fit its requirements: I have exactly one sink pad, and as
far as I know I don't need to get involved in capabilities
negotiation. I'm not sure if the latter is correct, though. I don't
think I ever will need to even look at the data that I copy from the
sink; only the metadata (timestamps).

The element feels rather different from all the example elements I've
looked at. From the point of view of capabilities negotiation, it's
like tee (the data formats on the sink get propagated to the sources.)
>From a dataflow perspective, it's both a sink element (because it
records data coming in on its sink pad) and a source element (it will
later generate buffers on its source pad(s)). But it isn't a filter,
because the receipt of a buffer on the sink pad does not trigger a
buffer to be pushed to a source pad.

What I'm not sure of is how to handle the data flow between the sink
and the source. I'm unclear on what threads are (or might be)
involved.

My current thinking is that I'll have a GstTask to feed the source
pads, and a mutex to protect access to the saved buffers. Will that
work, or could that deadlock because of some interaction with the
scheduler that I don't know about?

The audio sink I looked at uses a ringbuffer to transfer data, but
that's not really the right pattern here -- I don't want to ever
consume any of the data I've copied away, even after I've written it
to an output. But not using a ringbuffer looks like it may end up
causing me problems in inheriting from GstBaseAudioSink, since it very
much expects its child classes to be creating and providing a
ringbuffer.

How do I catch the data, by the way? I'm used to filter elements,
where I could define my own chain function that does it, but I'm not a
chain element in that I don't have anything to produce on a source pad
at that point. How do pure sink elements get their data?

Yes, I have bitten off more than I can chew. Still, any tips?




More information about the gstreamer-devel mailing list