[gst-devel] how to restart a pipeline
Arnout Vandecappelle
arnout at mind.be
Tue Oct 14 22:17:35 CEST 2008
On Thursday 09 October 2008 05:14:07 you wrote:
> Hi Pavel ,
> You can Unlink the elements ,then set state of pipeline as NULL ,then set
> next file to play using the same pipeline,then Link the elements and set
> state as PLAY.
However, before unlinking the elements, you should send an EOS through them,
otherwise the stream will not close properly. For most pipelines this
probably doesn't matter, but for instance the matroskamux sets the duration
when it receives EOS.
Here's an example (prev_elt is the last element you want to keep, sink is the
element you want to remove/replace; if you have several, all of them should
be removed from the pipeline):
gst_pad_push_event(gst_element_get_pad(prev_elt, "src"), gst_event_new_eos());
gst_element_unlink (prev_elt, sink);
gst_element_set_state (sink, GST_STATE_NULL);
gst_bin_remove(pipeline, sink);
gst_bin_add(pipeline, new_sink);
gst_element_link(prev_elt, new_sink);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
This example assumes you don't need to preroll on your new elements... You
mileage may vary.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: D206 D44B 5155 DF98 550D 3F2A 2213 88AA A1C7 C933
More information about the gstreamer-devel
mailing list