[gst-devel] sink bin with multiple sink elements

Gregory McGarry g.mcgarry at ieee.org
Thu Mar 5 02:20:32 CET 2009


 Edward Hervey wrote:


> > I created an audio sink element and a video sink element and ghosted the pins 
> to GstBin.  It works fine when both the audio and video pads are linked, but it 
> doesn't work if only one of the pads is linked.  In this case, the pipeline 
> wedges.  I think GstBin may be waiting for messages from the unlinked sink 
> element.
> > 
> > I then tried to change the pads in the bin to request pads and create 
> instances of the video and audio elements when a request arrives.  This doesn't 
> work reliably:
> > 
> > (bin:10041): GStreamer-WARNING **: adding flushing pad 'video' to running 
> element 'mybin0'
> > (bin:9997): GStreamer-WARNING **: adding flushing pad 'audio' to running 
> element 'mybin0'
> > 
> > Do you have any recommendations on when to add the elements to the bin and how 
> to ghost the pads correctly?
> 
>   Using request pads (and only creating/adding the elements at that
> time) is the correct way to do it.
>   Since you're adding the pads in PAUSED/PLAYING, you will have to
> activate them before adding them to yourself.
>   gst_pad_set_active(newpad, TRUE);
> 
>   Finally, to make sure your elements are in the right state, once
> you've added them and just before returning the requested pad, you need
> to call 'gst_element_sync_state_with_parent(newelement)' on each of the
> newly added elements. This will ensure they're in the correct state.


Thanks for tip.

My bin now contains two sink elements; one for video and one for audio.  I funnel all data from the video and audio sinks into my library.

When I open my library I need to know if both audio and video will be available.  I defer opening the library until the first sink render() is invoked.  Hopefully set_caps() has been invoked on each sink, so I know if the library should be opened for audio and video.

Well, this isn't always the case.  It seems that flvdemux and avidemux will start decoding one of the streams well before the other has invoked request_new_pad().  The behaviour isn't deterministic, since it sometimes works, other times it doesn't.

When is there an opportunity to synchronise all sinks inside a bin?

Thanks.



      Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox




More information about the gstreamer-devel mailing list