[gst-devel] Playing/pausing/swapping separate bins/elements within a running pipeline - pause problem

Nick Daniels somebodys.home.is at gmail.com
Sun Jan 31 17:40:55 CET 2010


Hi there,

I was hoping someone may be able to help me on this...I'm rather stuck!

I have managed to successfully swap out bins (I found these posts
particularly useful for this:
http://n4.nabble.com/Dynamically-adding-and-removing-branches-of-a-tee-td973635.html,
http://n4.nabble.com/Any-ways-to-add-remove-branches-to-from-a-running-pipeline-td973959.html#a973959)
however I'm having a small problem playing/pausing/swapping the seperate
bins.

I've pasted a diagram of the test pipeline at
http://pastebin.com/f15fc14a4to make it easier to see. It's basically
made up of two bins linked into the
videomixer element outputting to a xvimagesink. The bins are made up of a
filesrc, decodebin with a tee leading to a preview xvimagesink and the bin's
ghost src pad (which then leads to the videomixer).

What I want to be able to do is disconnect bin1 from the videomixer, pause
it, play it etc (without affecting bin2 still connected to the videomixer)
and then swap it back into the videomixer.

I have managed to disconnect bin1 and pause it, but when I start playing it
plays from where the video would have been if I hadn't paused, not from
where it was paused (I assume this is because it is using the pipeline's
clock for playback which is still running for the remaining, unpaused
bin???). What do I have to do to make sure it plays back from the correct
place? I've detailed the method I used to disconnect bin1 and pause/play it
below.

Any insight into what's going on would be very helpful :)

Many thanks,
Nick

=============================================================

This is my method to disconnect bin1 from the videomixer:

1. Block bin1's source pad
     pad = gst_element_get_static_pad (bin1, "src");
     gst_pad_set_blocked(pad,TRUE);

2. Unlink bin1 and videomixer and release videomixer's request pad
     gst_element_unlink (bin1, mixer);
     gst_element_release_request_pad(mixer, mixerpad);

3. Add fakesink to pipeline and set state to READY
     gst_bin_add (GST_BIN (pipeline), fakesink);
     gst_element_set_state (fakesink, GST_STATE_READY);

4. Link fakesink to bin1 and set state to PLAYING
     gst_element_link (bin1, fakesink);
     gst_element_set_state (fakesink, GST_STATE_PLAYING);

5. Unblock bin1's ghost pad
     gst_pad_set_blocked(pad,FALSE);

This works fine, no problems.

Ok now I want to pause bin1 so I do:

     gst_element_set_state (fakesink, GST_STATE_PAUSED);
     gst_element_set_state (bin1, GST_STATE_PAUSED);

Great it's paused. Now the problem...I want to play it again.

     gst_element_set_state (fakesink, GST_STATE_PLAYING);
     gst_element_set_state (bin1, GST_STATE_PLAYING);

Instead of continuing playing from when I paused it, it plays from where it
would have been if I hadn't paused it (it skips forward). I assume this is
because its using the pipeline's (or the other bin's?) clock? Is this a bug?
Is there a way to make sure this bin plays back from where it was paused?

I've also tried putting it to the READY state instead of PAUSED. This works,
but when I set it to PLAYING again the following error appears in the
console 21 times, and the video plays back at a very fast rate.
     (test:5682): GLib-GObject-WARNING **: invalid uninstantiatable type
`<invalid>' in cast to `GstElement'
     (test:5682): GLib-GObject-WARNING **: invalid uninstantiatable type
`<invalid>' in cast to `GObject'
     (test:5682): GLib-GObject-CRITICAL **: g_object_get: assertion
`G_IS_OBJECT (object)' failed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100131/ef8d7253/attachment.htm>


More information about the gstreamer-devel mailing list