pythia.utils.gst#

Deepstream interface, utilities and customization.

pythia.utils.gst.element_repr(element: Object) str[source]#

Compute element strig based on its hierarchy.

Parameters:

element – The gstreamer element.

Returns:

The element’s string representation.

Example

>>> from gi.repository import Gst
>>> Gst.init()
>>> pipeline = Gst.parse_launch(
...   "bin ( videotestsrc ! identity name=eye ) ! fakesink"
... )
>>> element_repr(pipeline.get_by_name("eye"))
'/Pipeline:pipeline0/Bin:bin1/GstIdentity:eye'
pythia.utils.gst.get_element(gst_bin: Bin, name) Element[source]#

Get element from bin.

Parameters:
  • gst_bin – parent where the element is to be located.

  • name – name of the element to locate.

Returns:

The found element.

Raises:

NameError – internal gst getter returned None.

pythia.utils.gst.get_sinkpad(gst_bin: Bin, element_name: str) Pad[source]#

Get sinkpad element from element.

Parameters:
  • gst_bin – parent where the element is to be located.

  • element_name – name of the element to locate the sink pad.

Returns:

The found source pad.

pythia.utils.gst.get_srcpad(gst_bin: Bin, element_name: str) Pad[source]#

Get srcpad element from element.

Parameters:
  • gst_bin – parent where the element is to be located.

  • element_name – name of the element to locate the source pad.

Returns:

The found source pad.

pythia.utils.gst.get_static_pad(element: Element, direction: Literal['sink', 'src']) Pad[source]#

Get static pad from element.

Parameters:
  • element – element where the pad is located.

  • direction – pad direction - “sink” or “source”.

Returns:

The found pad.

Raises:

ValueError – Unable to get the pad.

pythia.utils.gst.gst_init() None[source]#

Initialize Gstreamer.

pythia.utils.gst.gst_iter(iterator: Iterator) Iterator[source]#

Iterate pythonically over a Gst.Iterator.

Parameters:

iterator – the iterator which produces values.

Yields:

The values from the iterator

pythia.utils.gst.long_to_uint64(long: int) int[source]#

Return the C 64-bit unsigned int datatype.

Parameters:

long – the long value to convert.

Returns:

The converted unit64