PyFuncElement

Inheritance diagram of PyFuncElement

PyFuncElement inheritance diagram

class savant.config.schema.PyFuncElement(module, class_name, kwargs=None, dev_mode=False, element='pyfunc', element_type=None, version='v1', name=None, properties=<factory>)

A pipeline element that will use an object implementing BasePyFuncPlugin to apply custom processing to gstreamer buffers.

For example,

- element: pyfunc
  module: module.pyfunc_implementation_module
  class_name: PyFuncImplementationClass
__call__(*args, **kwargs)

Calls resolved PyFunc implementation if its a subclass of BasePyFuncCallableImpl, otherwise no-op.

check_reload()

Checks if reload is needed and reloads in case it is.

dev_mode: bool = False

Whether the pyfunc is in dev mode.

element_type: str | None = None

Element type/subtype, can be defined as a substring of the element.

For example, detector in

- element: nvinfer@detector
property full_name

Full element name.

property instance: BasePyFuncImpl

Returns resolved PyFunc implementation.

kwargs: Dict[str, Any] | None = None

Class initialization keyword arguments.

load_user_code()

Load (or reload) the user module/class specified in the PyFunc fields. It’s necessary to call this at least once before starting the pipeline.

name: str | None = None

GstElement instance name. Arbitrary string, useful for identifying pipeline elements.

version: str = 'v1'

Element version, can be defined as a substring of the element.

For example, v1 in

- element: nvinfer@detector:v1
properties: Dict[str, Any]

GstElement properties.

module: str

Name to import or module path.

class_name: str

Python class name to instantiate.

element: str = 'pyfunc'

"pyfunc" is the fixed gstreamer element class for PyFuncElement.