pipeutil module

Boilerplate code, shorthand, and utility functions for creating GStreamer elements and pipelines.

pipeutil.gstlal_element_register(clazz)[source]

Class decorator for registering a Python element. Note that decorator syntax was extended from functions to classes in Python 2.6, so until 2.6 becomes the norm we have to invoke this as a function instead of by saying:

@gstlal_element_register
class foo(Gst.Element):
        ...

Until then, you have to do:

class foo(Gst.Element):
        ...
gstlal_element_register(foo)
pipeutil.mkelem(elemname, props={})[source]

Instantiate an element named elemname and optionally set some of its properties from the dictionary props.

pipeutil.mkelems_in_bin(bin, *pipedesc)[source]

Create an array of elements from a list of tuples, add them to a bin, link them sequentially, and return the list. Example:

mkelem(bin, (‘audiotestsrc’, {‘wave’:9}), (‘audioresample’,))

is equivalent to

audiotestsrc wave=9 ! audioresample

pipeutil.splice(bin, pad, element)[source]

Splice element into an existing bin by teeing off an existing pad.

If necessary, a tee is added to the pipeline in order to splice the new element.

bin is an instance of Gst.Bin or Gst.Pipeline. pad is a string that describes any pad inside that bin. The syntax used in gst-launch is understood. For example, the string ‘foo.bar.bat’ means the pad called ‘bat’ on the element called ‘bar’ in the bin called ‘foo’ inside bin. ‘foo.bar.’ refers to any pad on the element ‘bar’. element_or_pad is either an element or a pad.

FIXME: implicit pad names not yet understood.