Bash completion or tab completion is the capability of the shell (bash in this case) to be able to autocomplete words for commands, parameters, etc. on hitting the tab key.
Bash completion for Gstreamer is the capability for gst-launch and gst-inspect to autocomplete elements and their
corresponding pads and parameters. For example, gst-inspect-1.0 v4l2<tab>
will show all the list of available elements
(plugins) in the systems that start with v4l2.
$ gst-inspect-1.0 v4l2<tab>
v4l2radio v4l2sink v4l2src
On Ubuntu (20.04 as of this writing), the default installation of Gstreamer from APT does not provide bash-completion. I could not find any installation packages or gst-plugins that enable bash-completion. However, bash-completion is a feature that is available in Gstreamer and is provided by https://github.com/GStreamer/gstreamer/tree/master/data/bash-completion. It looks like the Ubuntu distribution package of Gstreamer is not compiled with the bash-completion feature.
Therefore, bash-completion for Gstreamer can be enabled by a) building and installing Gstreamer from source or b) manually get these bash-completion files from Gstreamer source, modify it for pre-installed binaries, and place it in the bash-completion path.
There are several ways to enable bash completion -- /etc/bash_completion.d/
, /usr/share/bash-completion/
, or ~/.bash_completion
.
Gstreamer, and other modern packages, use /usr/share/bash-completion/
. This can be enabled as mentioned in the below
sections.
Follow the Gstreamer build-from-source instructions from official docs. As of writing, the latest version of Gstreamer
(1.17.2) has bash completion enabled by default. If not it can be forcefully enabled with
meson -Dgstreamer:bash-completion=enabled <build_dir>
. Build and install will copy the required files to
/usr/share/bash-completion/
or /usr/local/share/bash-completion
or any other install prefix path.
If building Gstreamer from source is not preferred, bash-completion can still be enabled by copying all files from
https://github.com/GStreamer/gstreamer/tree/master/data/bash-completion into the corresponding dirs under /usr/share/
.
Then, in /usr/share/bash-completion/helpers/gst
, set _GST_HELPER
variable to appropriate path for gst-completion-helper
file.
For example,
_GST_HELPER="/usr/libexec/gstreamer-1.0/gst-completion-helper"