question how to add own customized element between source element and decodebin2 element when using playbin2

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Nov 13 06:09:58 PST 2012


On Tue, 2012-11-13 at 05:40 -0800, Christophe Oosterlynck wrote:

> I'm looking to do the same thing. Right after the source, I want to insert
> another element and let playbin2 do the rest.
> 
> From what I see I have 2 possibilities:
> * react to "notify::source" signal, add the extra element to the bin, link
> it to the source and let playbin2 continue
> * wait until playbin2 has finished constructing the whole pipeline, unlink
> source and next element and insert extra element in between.
> 
> Can I do one of these safely or shouldn't I fiddle with the playbin2
> pipeline behind its back?
> 
> What I want to achieve with this: buffer a live udp source.
> The buffering mechanism in playbin2 is not usable for live sources as you
> cannot pause them. I want to insert a queue element right behind the udpsrc
> element with min-threshold-bytes. This works when I create a custom pipeline
> with gst-launch. If this is not the best way to handle this, let me know.
> Nevertheless, I'm still interested in the answer to my question on fiddling
> with the playbin2 pipeline.

You should not fiddle with playbin's pipeline, and certainly not link
elements behind its back. It won't work. Even if it does work, it might
stop working tomorrow. And we won't even feel bad for a second if your
app breaks doing things like that ;)

The only sane way to do things like this is to write your own element,
which could be a GstBin subclass where you add some source and whatever
additional elements you want and then create a ghost source pad. You can
then register a new (or existing, if you must) URI protocol for it, so
if you do playbin uri=fooudp://a.b.c.d:port it will plug your bin.

Or you could try to come up with API for playbin to add such a thing,
but I think would need to be rather well-justified and deemed
interesting enough to be added.

(What does your "routine" element do, "BCXA" ?)

 Cheers
  -Tim



More information about the gstreamer-devel mailing list