pipeparts.pipetools module

Utilities for constructing pipeline elements

pipeparts.pipetools.clean_property_name(name: str)[source]

Utility function for cleaning a property name, handles two cases:

  1. Underscores to hyphens: property_name -> property-name

  2. Removes trailing underscores originally used to avoid collisions with builtin: math_ -> math.

    The specific list of builtin collisions detected is defined in PROPERTY_BUILTIN_NAMES

Args:
name:

str, the python property name

Returns:

str, the formatted gstreamer compatible element property name

pipeparts.pipetools.make_element_with_src(pipeline: Pipeline, src: Union[Element, Pad], elem_type_name: str, **properties)[source]

Create a new element of the type defined by the given element factory. If name is None, then the element will receive a guaranteed unique name, consisting of the element factory name and a number. If name is given, it will be given the name supplied.

Args:
pipeline:

Pipeline, the existing pipeline to which the new element will be added

src:

Element or Pad, the element or pad to use as a source for the new element

elem_type_name:

str or None, name of new element, or None to automatically create a unique name

**properties:

dict, keyword arguments to be set as properties on the new element

References:

[1] https://lazka.github.io/pgi-docs/Gst-1.0/classes/ElementFactory.html#Gst.ElementFactory.make

Raises:
RuntimeError:

If any problem occurs creating the element.

Returns:

Element, the new element