GNOME Bugzilla – Bug 575814
flag for EOS on gst-launch when exiting with ctrl-c
Last modified: 2009-03-27 12:48:37 UTC
When using gst-launch to record from a webcam, pressing ctrl-c just sets the pipeline to null and some muxers (I've tested avimux and qtmux) doesn't properly finish their files because they expect an EOS to do so. It is proposed that a flag is added in gst-launch, something like '--eos-on-shutdown'. This would force EOS on sources and wait for the sinks to get them before quitting.
Created attachment 130930 [details] [review] My suggestion This is my proposed patch to enhance it. One thing I thought about is when the user presses ctrl-c when an EOS is already at the pipeline. What happens when we try to push another one? Is that possible?
At a glance it looks good. I think you should store the state of what's been going on. If --eos-on-shutdown and CTRL-C => send EOS => mark state as having sent EOS If you press CTRL-C again => see that we've already sent EOS => Do the normal shutdown (current behaviour).
Small nitpick and two suggestions: - would be nice if you turned the defines into an enum type (EventLoopResult or something similar) - another PRINT "Waiting for ..." after the send_event() would be good, I think - how about another PRINT after the last event_loop run to tell the user either that we got an EOS message and all is well, or something else happened and we didn't shut down cleanly?
Created attachment 131036 [details] [review] Updated patch Updated with the suggestions
Created attachment 131064 [details] [review] Updated patch
Looks nice. Two comments: typedef enum _EventLoopResult { NO_ERROR = 0, ERROR, INTERRUPT } EventLoopResult; I wonder how hight the chances are that this clashes with some defines. What about typedef enum _EventLoopResult { ELR_NO_ERROR = 0, ELR_ERROR, ELR_INTERRUPT } EventLoopResult; also in main, just spell out the variable. eos_on_shutd -> eos_on_shutdown
Created attachment 131442 [details] [review] Updated patch
Committed. git commit hash: 5fa36d9f3d8d2fddc5171de927f0640f5ef056b4