Search code examples
gstreamergstreamer-1.0

How to alter the behaviour of gstreamer autoaudiosink, autovideosink etc,


gstreamer has autoaudiosink, autovideosink, autoaudiosrc, autovideosrc.

How does this work when there are multiple sources or sinks that match

ex: videosink on windows can be opengl or directx,

How does gstreamer decide which one to use?

Is there any possibility to alter this?


Solution

  • How does gstreamer decide which one to use?

    GStreamer has a very general autoplugging mechanism so that it can do the right thing. The documentation is quite terse, but let's go over it for the autovideosink case.

    In a first step, autoplugging will try to filter out the relevant elements on your system: for example, if the input of a decodebin element is an H264 stream, it will find only elements that advertise video/xh264 caps on their sink pads. In the case of autovideosink, it will filter all elements that have added explicit "Sink" and "Video" tags to find the relevant elements.

    In a second step, it still needs to select the best match out of the set of elements that we just collected. For that, GStreamer picks the plugin with the hightest "rank". Plugins have a default rank, but you can modify it programmatically (how to do this has been answered elsewhere).

    Note: some elements (like decodebin) also provide extra API for even more fine-grained control.

    Is there any possibility to alter this?

    So the short answer is here: by modifying the plugin rank.

    It's also good to note that application developers will generally pick a given sink (for example glimagesink) and optimize for that case, by configuring the properties of that element.