python_plugin_template

Attributes

SIMAAI_META_STR

PLUGIN_CPU_TYPE

Classes

MetaStruct

SimaaiPythonBuffer

ValueType

Create a collection of name/value pairs.

AggregatorTemplate

A Python based gstreamer plugin template. Enables the user to:

Module Contents

python_plugin_template.SIMAAI_META_STR = 'GstSimaMeta'
python_plugin_template.PLUGIN_CPU_TYPE = 'APU'
class python_plugin_template.MetaStruct(buffer_name, stream_id, timestamp, frame_id)
buffer_name
stream_id
timestamp
frame_id
class python_plugin_template.SimaaiPythonBuffer(metadata: MetaStruct, map: gi.repository.Gst.MapInfo)
metadata
data
size
class python_plugin_template.ValueType(*args, **kwds)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

INT64
UINT64
STRING
DOUBLE
class python_plugin_template.AggregatorTemplate(plugin_name, out_size)

A Python based gstreamer plugin template. Enables the user to: - Accept incoming buffers from dynamic pads - Define any custom plugin runtime logic User has to only override the run() function

transmit
silent
config
plugin_name
dynamic_pads = []
src_caps_set = False
timestamp = 0
frame_id = 0
is_pcie = False
in_pcie_buf_id = 0
stream_id = 'unknown-stream'
buffer_name = 'default'
plugin_id = 'python-agg-template'
t0 = None
t1 = None
out_size
request_new_pad(templ, direction=None, name=None)

Handle dynamic pad requests. Pads are created when a new input stream is added dynamically.

do_start()

Handle start even for the aggregator.

finish_buffer(buffer)

Finalizes and pushes the buffer downstream.

do_set_property(property_id, value)
do_get_property(property_id)
extract_metadata(buffer: gi.repository.Gst.Buffer) None

Input: buffer Gst.Buffer: Input buffer from which metadata will be extracted.

insert_metadata(buffer: gi.repository.Gst.Buffer) None

Input: buffer Gst.Buffer: Buffer to be inserted with custom metadata

get_gobject_value(value, value_type: ValueType) gi.repository.GObject.Value
do_aggregate(timeout)

Called when buffers are queued on all sinkpads. Calls the run() function defined by the user

abstractmethod run(input_buffers: List[gi.repository.Gst.Buffer], output_buffer: gi.repository.Gst.Buffer) None

Input: input_buffers: List[Gst.Buffer] List of input buffers, source from each pad. output_buffer: Gst.Buffer Output buffer that needs to be overwritten.

Implement your logic within this function. Process the input buffers, and modify the output buffer.