how to write a custom bin
Michael Gruner
michael.gruner at ridgerun.com
Wed Jan 26 23:08:45 UTC 2022
Hello Tom
Some answers inline.
Michael
> On 26 Jan 2022, at 15:54, tom via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> 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 <https://github.com/GStreamer/gst-plugins-good/blob/master/gst/autodetect/gstautodetect.c> element will build a bin based on the plug-ins installed in your system. Here’s another example <https://github.com/RidgeRun/gst-inference/blob/master/gst/inferenceutils/gstinferencecrop.cc> 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() <https://gstreamer.freedesktop.org/documentation/gstreamer/gstghostpad.html?gi-language=c#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: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220126/c06ce924/attachment.htm>
More information about the gstreamer-devel
mailing list