Listening EOS event from a bin

Tim Müller tim at centricular.com
Sat Oct 25 10:58:50 PDT 2014


On Wed, 2014-10-22 at 18:20 +0300, Engin FIRAT wrote:

Hi,

> I have bin element which consists of matroskamux and filesink elements
> in a pipeline. Moreover I have created a ghostpad which is simply sink
> pad of the matroskamuxer. I want to change the filesink's location. In
> order to achieve this, I send an EOS signal to bin's sink pad and have
> been trying to handle EOS event when all elements in the bin got that
> event. But I cannot find an appropriate way to handle this EOS event
> from bin. How can I listen for this event? 

If the filesink is the only sink in the pipeline, wait for a
GST_MESSAGE_EOS on the pipeline's GstBus.

If there are multiple sinks in the pipeline, the bins/pipeline will only
post an EOS message to the application if *all* sinks have posted an EOS
message. But often you only want to know about the filesink having
received the EOS, and other branches/sinks should remain running.

To do that, you can set the "message-forward" property on your bin and
the pipeline, then you will get a GST_MESSAGE_ELEMENT with a structure
name of "GstBinForwarded" containing the actual EOS message inside, even
if none of the other sinks are EOS.

Here's a small demo app that does something similar:
http://people.freedesktop.org/~tpm/code/test-backlog-recording-h264.c

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list