[gst-devel] sink element with multiple sink pads

Edward Hervey bilboed at gmail.com
Tue Feb 10 09:46:33 CET 2009


On Mon, 2009-02-09 at 23:41 -0800, Gregory McGarry wrote:
> Hi Edward.
> 
> Edward Hervey wrote:
> 
> 
> > On Mon, 2008-12-08 at 22:23 -0800, Gregory McGarry wrote:
> > > I'm working on a plugin which wraps a library.  The library requires
> > >  roughly synchronised audio and/or video frames.
> > 
> >   Using GstBaseSink is definitely a must-have to have synchronized
> > rendering (across several sinks).
> > 
> > > 3) element derived from GstBin which contains audio and video sink elements
> > 
> >   I'd say this one is definitely the fastest to implement, and you won't
> > have to worry about all the 'smartness' (locking, threading,
> > synchronization, message emission, seek handling, ...) that GstBaseSink
> > provides if you implement your individual-stream sinks with it.
> 
> Thanks for your recommendations.  Indeed it was quite simple to get audio/video working with GstBin.
> 
> 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.

    Edward

> 
> Thanks for you advice.
> 
> 
> 
>       Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more





More information about the gstreamer-devel mailing list