Skip to content

gst_init: fix docs - unknown command line args don't crash init

sezanzeb requested to merge sezanzeb/gstreamer:patch-1 into main

The docstring (https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/master/gst/gst.c#L461) says "unknown command line options cause this function to abort program execution."

However, the man page (https://linux.die.net/man/3/gstreamer) says: "Initializes GStreamer. Automatically parses @ARGV, stripping any options known to GStreamer."

The tutorial does not strip arguments before calling init as well: https://gstreamer.freedesktop.org/documentation/gstreamer/gst.html?gi-language=c and calling the compiled binary with ./basic-tutorial-1 lakjsf kehrt kehwr kwehr kjawerqw does not crash the program.

The python bindings also don't crash:

>>> import gi
>>> gi.require_version('Gst', '1.0')
>>> from gi.repository import Gst
>>> Gst.init_check(['a', 's', 'd', 'f'])
(True, argv=['a', 's', 'd', 'f'])
>>> Gst.init(['a', 's', 'd', 'f'])
['a', 's', 'd', 'f']
>>>

So I guess the docstring is wrong.

Thanks for considering this PR

Merge request reports