python_plugin_template ====================== .. py:module:: python_plugin_template Attributes ---------- .. autoapisummary:: python_plugin_template.SIMAAI_META_STR python_plugin_template.PLUGIN_CPU_TYPE Classes ------- .. autoapisummary:: python_plugin_template.MetaStruct python_plugin_template.SimaaiPythonBuffer python_plugin_template.ValueType python_plugin_template.AggregatorTemplate Module Contents --------------- .. py:data:: SIMAAI_META_STR :value: 'GstSimaMeta' .. py:data:: PLUGIN_CPU_TYPE :value: 'APU' .. py:class:: MetaStruct(buffer_name, stream_id, timestamp, frame_id) .. py:attribute:: buffer_name .. py:attribute:: stream_id .. py:attribute:: timestamp .. py:attribute:: frame_id .. py:class:: SimaaiPythonBuffer(metadata: MetaStruct, map: gi.repository.Gst.MapInfo) .. py:attribute:: metadata .. py:attribute:: data .. py:attribute:: size .. py:class:: 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 - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: INT64 .. py:attribute:: UINT64 .. py:attribute:: STRING .. py:attribute:: DOUBLE .. py:class:: 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 .. py:attribute:: transmit .. py:attribute:: silent .. py:attribute:: config .. py:attribute:: plugin_name .. py:attribute:: dynamic_pads :value: [] .. py:attribute:: src_caps_set :value: False .. py:attribute:: timestamp :value: 0 .. py:attribute:: frame_id :value: 0 .. py:attribute:: is_pcie :value: False .. py:attribute:: in_pcie_buf_id :value: 0 .. py:attribute:: stream_id :value: 'unknown-stream' .. py:attribute:: buffer_name :value: 'default' .. py:attribute:: plugin_id :value: 'python-agg-template' .. py:attribute:: t0 :value: None .. py:attribute:: t1 :value: None .. py:attribute:: out_size .. py:method:: request_new_pad(templ, direction=None, name=None) Handle dynamic pad requests. Pads are created when a new input stream is added dynamically. .. py:method:: do_start() Handle start even for the aggregator. .. py:method:: finish_buffer(buffer) Finalizes and pushes the buffer downstream. .. py:method:: do_set_property(property_id, value) .. py:method:: do_get_property(property_id) .. py:method:: extract_metadata(buffer: gi.repository.Gst.Buffer) -> None Input: buffer Gst.Buffer: Input buffer from which metadata will be extracted. .. py:method:: insert_metadata(buffer: gi.repository.Gst.Buffer) -> None Input: buffer Gst.Buffer: Buffer to be inserted with custom metadata .. py:method:: get_gobject_value(value, value_type: ValueType) -> gi.repository.GObject.Value .. py:method:: do_aggregate(timeout) Called when buffers are queued on all sinkpads. Calls the run() function defined by the user .. py:method:: run(input_buffers: List[gi.repository.Gst.Buffer], output_buffer: gi.repository.Gst.Buffer) -> None :abstractmethod: 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.