How do handle EOS in this case?

Tim-Philipp Müller t.i.m at zen.co.uk
Sun Oct 9 08:13:57 PDT 2011


On Fri, 2011-10-07 at 16:00 -0700, kevin kelly wrote:

Hi,

> I just wrote a personal decoder element. The situation is like this way:
> 
> I am using filesrc to read a file and at the end of the file, the decoder
> element will receive a EOS event. 
> and then the program will hang there since there is no data coming.
> 
> but when I use following command line:
> 
> gst-launch filesrc location=my_personal_file ! some_other_filter ! fakesink
> dump=1
> 
> I will get such prints on the screen when filesrc reading at the end of
> file:
> 
> Got EOS from element "pipeline0".
> Execution ened after 7198734556 ns.
> Setting pipeline to PAUSED ...
> Setting pipeline to READY ...
> Setting pipeline to NULL ...
> Freeing pipeline....
>
> How should I handle EOS event in my decoder element to get the same result
> as I use fakesink element? I want the pipeline automatically switch to
> PAUSED/READY/NULL, then quit the program.

Your decoder will receive an EOS event via the sink pad's event function
(assuming it is operating in push mode). In there, your decoder should
process any remaining data that it may still have cached internally (ie.
force decoding+output of any remaining data) and then push the event
further downstream to the next element.

That way, it will end up in the sink, which will then post an EOS
message, which the application will take as cue to stop the pipeline.

Cheers
 -Tim



More information about the gstreamer-devel mailing list