How do I handle EOS event in this case?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I handle EOS event in this case?

kevin kelly
This post was updated on .
Hello, there,

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 from pipeline 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 following 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.

thank you so much for your input.

Reply | Threaded
Open this post in threaded view
|

Re: How do handle EOS in this case?

Tim-Philipp Müller-2
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do handle EOS in this case?

kevin kelly
Thanks Tim, but my decoder is the last element on the pipeline, the decoder has no src pad and how can I "push the event further downstream to the next element"? I think we need another way to handle this EOS event.  thanks.