Expand description
Host gst-python-ml elements as first-class glass2glass elements (M198).
Experimental (Tier 3 in STABILITY.md): no stability promise.
gst-python-ml factored its ML logic away from GStreamer: the inference
tasks/, the engine MLEngineMixin, and the per-frame work all run with no
framework types, behind three seams selected by the PYML_BACKEND env var:
FrameIO (read/write/append-blob a buffer), AnalyticsBackend (attach
detection metadata), and the element base classes. Today only a gst
backend exists. This crate is the g2g host those seams target: it embeds
CPython in the g2g process, exposes a native g2g module that backs
FrameIO / AnalyticsBackend against the live Rust [Frame], and wraps a
hosted element instance in a g2g [AsyncElement] so it negotiates caps and
flows frames like any other node.
Build layers:
- default (
std): thePyTransformshell and the pixel-format mapping ([format]) compile. Caps negotiation works; the per-frame Python call returns [G2gError::UnsupportedDomain] because there is no interpreter. This keeps the crate incargo check --workspacewithout libpython. python: pulls pyo3 + numpy, embeds CPython, and runs the hosted element for real. OS-coupled, off the no_std / RTOS baseline.
Two zero-copy frame paths reach the hosted element: System memory over the
Python buffer protocol (g2g_process), and a GPU-resident CUDA frame over
__cuda_array_interface__ / __dlpack__, one g2g.CudaPlane per NV12 plane
handed to g2g_process_cuda (or its batch and produce siblings). The host
and cuda_plane modules carry the contracts, the plane layout, and the
CUDA-context caveat.
This crate links std unconditionally (embedding CPython is the most
OS-coupled thing in the tree). The std feature only forwards to
g2g-core/std; it is not a no_std gate on this crate.
Modules§
- format
- The shared pixel-format contract between g2g and the gst-python-ml backend.
Structs§
- PyAggregator
- A gst-python-ml batched element hosted as a first-class g2g aggregator.
- PySource
- A Python frame source hosted as a first-class g2g source.
- PyTransform
- A gst-python-ml element hosted as a first-class g2g transform.
Functions§
- register
- Register the hosted Python elements as
gst-launch/ autoplug factories onregistry, so they are instantiable by name like any built-in: