[gst-devel] gstreamer-launch commandline completion

Erik Walthinsen omega at temple-baptist.com
Sun May 6 09:38:20 CEST 2001

Wim commented that he wanted to be able to use tab completion for -launch
commandlines.  Well, I just added that to CVS.

bash provides the ability to do custom completion based on a program.  Now
in CVS is a program called gstreamer-complete, which does this.  It makes
use of the arguments that bash places on the commandline, as well as a new
XML registry (hopefully one that can be merged into the primary registry),
to provide extremely context-sensitive tab completion.

It currently has the following features:

1) Completion of element names
  a) only 'source' elements at the beginning of the cmdline
  b) only elements *with* source pads elsewhere (i.e. not source elements)
2) Completion of pad names and arguments immediately following elements
  a) pad names have '!' automatically appended
      (pad names are not expanded to handle [n-m] ranges yet)
  b) arguments have '=' appended, plus a second entry with '=...'
      (this keeps bash from putting a space after the '=')

I can now type the following:


and get:

./gstreamer-launch fakesrc src! fakesink

To set this up, you need to do a couple things.  First of all, run
./gstreamer-compprep, which generates the completion registry.  It's
placed right next to the existing registry, so make sure you have write

Second, you need to tell bash to use the completion program:

complete -c gstreamer-complete gstreamer-launch

You'll want to of course provide the absolute path to gstreamer-complete.

Intended short-term improvements:

1) Handle pads and args more than one word away from the element name
2) Complete the enums of arguments
3) Complete the sinkpad-name side of connections if peer element specified

These both require that I parse both ways through the cmdline to find the
element names, which is a bit harder than anything I've had to do so far.

Much more intriguing possibilities exist:

1) Only show elements that are compatibile with the current pad
2) Automatically select only DECOUPLED elements after a thread boundary
3) your idea here...

This can get pretty ridiculous, but that's the point, so all you regular
users of gstreamer-launch, um, LAUNCH your ideas at the list!


      Erik Walthinsen <omega at temple-baptist.com> - System Administrator
       /  \                GStreamer - The only way to stream!
      |    | M E G A        ***** http://gstreamer.net/ *****
      _\  /_

More information about the gstreamer-devel mailing list