how to write a custom bin

Michael Gruner michael.gruner at
Wed Jan 26 23:08:45 UTC 2022

Hello Tom

Some answers inline.


> On 26 Jan 2022, at 15:54, tom via gstreamer-devel <gstreamer-devel at> wrote:
> I would like to wrap a part of my pipeline in a single bin so I can wrap some of the data-probes in an element and we can use it as a single element using gst-launch-1.0.
> What base class should I use ? It's not really a Transformation , more of a Bin.
> So i used GstBin as the base 'class', setup my elements in the init(), connected up the data-probes
> but when I gst-inspect-1.0 the element it doesn't pickup the sink and src pads of the internal pipeline.
> 1. Am i heading in the right direction with using GstBin ?

Yes, implementing GstBin sounds right.

> 2. Is there an example of a custom bin that i can look at ?

The gstautodetect.c <> element will build a bin based on the plug-ins installed in your system. Here’s another example <> which builds the internal pipeline in the init, and installs a probe to the internal pad, pretty much like you want to. 

> 3. Do i need to create my own sink and source pads manually and link them to the internal pipeline or can I use the pads from the ends of the internal pipeline directly ?

You can only link pads that are in the same hierarchy. The internal pads, being inside a bin, cannot be linked with the rest of the pipeline. You need to create a ghost pad, and assign the internal pad as the ghost pad’s target. Take a look at gst_ghost_pad_new() <>, Having the ghost pad associated to the respective target, you can the add the ghost pad to your bin.

> thanks,
> tom

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list