Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limitations of gst_parse_launch()?

Tags:

c

gstreamer

From what i understand, gst_parse_launch() creates a new pipeline based on command line syntax describing the pipeline. It automatically takes care of all the intricate details of request pads, sometimes pads etc and constructs the pipeline.

So my question is, why not use this all the time? why bother with adding pad-added-handlers, requesting and linking pads etc?

Are there any situations where using gst_parse_launch() just wont do?

like image 787
rubndsouza Avatar asked Apr 19 '13 09:04

rubndsouza


2 Answers

Many GStreamer elements will use these features to probe which plug-in they should load. The best example that comes to mind is decodebin or playbin plug-ins. With the first one, you just chose the source (for example filesrc).

Now, what happens when playing our media stream ?

At the beginning, the "inside" of decodebin is only :

--- sink -->|[ TypeFind] |

There is no source pad coming out at this time because the element is still not aware of the stream content.

If you have an avi video file, then decodebin will first use a particular GStreamer element to probe what is the container/codec used in the stream. This element (GstTypeFind) will compute a score depending of the similarity between the stream and the codecs/containers.

In this example, TypeFind will hit the avi container, thus it will allocate an avi parser. The "inner" of decodebin is now expanding ... The avi parser analyses the stream to know if there is audio/video sub-streams to parse. If so, typefind comes in again to find which codec is used.

The appropriate decoders are then allocated. Here, decodebin is now fully ready and the downstream element such as sink elements must link against the newly created source pads to get the stream going. This is done through the pad-added signals and the pad linking procedures.

If there was not any of these pad features, this behaviour would not be possible and everything would have to be set up statically, in the metal before getting the stream. This means that you would have to know in advance what is the content of the stream you are about to read (this is a very very heavy constraint !)

A last remark : when you specify a pipeline through the command line (like with gst-launch I guess), you are at a high level interface. Within the elements you specified, the mechanisms of pad linking can be of significant importance ! The thing is you don't have to bother since things will get done. But "have not to bother of something" does not mean that this thing is useless to you.

like image 105
Rerito Avatar answered Oct 02 '22 10:10

Rerito


If you use gst-launch, you can only run a static pipeline. That is you can't seek, can't e.g. change the volume over time, you can't e.g. play a 2nd file.

gst-launch is really meant as a developer tool to try an element or some properties.

like image 44
ensonic Avatar answered Oct 02 '22 11:10

ensonic