Skip to main content

PyAggregator

Struct PyAggregator 

Source
pub struct PyAggregator { /* private fields */ }
Expand description

A gst-python-ml batched element hosted as a first-class g2g aggregator.

Implementations§

Source§

impl PyAggregator

Source

pub fn new( module: impl Into<String>, class: impl Into<String>, inputs: usize, ) -> Self

Host class from Python module as an inputs-way batching aggregator.

Source

pub fn with_accept(self, caps: Caps) -> Self

Override the accepted input caps.

Source

pub fn with_produce(self, caps: Caps) -> Self

Emit caps downstream instead of the negotiated input caps, for a hosted element that changes media type.

Source

pub fn with_draw_label(self, on: bool) -> Self

Set the draw-label flag forwarded to the Python element.

Source

pub fn with_cuda_frames(self, on: bool) -> Self

Batch GPU-resident CUDA frames: they reach the hosted element as __cuda_array_interface__ planes through g2g_process_cuda_batch, and the anchor flows on still device-resident. Also drives what this element asks each input branch to allocate (see MultiInputElement::propose_allocation_for_input).

Source

pub fn emitted_count(&self) -> u64

Count of frames emitted downstream, which is one per batch unless the hosted element emits several buffers from one. Useful in tests.

Trait Implementations§

Source§

impl Debug for PyAggregator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl MultiInputElement for PyAggregator

Source§

fn propose_allocation_for_input( &self, _input: usize, caps: &Caps, ) -> Option<AllocationParams>

Ask every input’s branch to allocate in the domain the hosted code reads, so a decoder that can do either keeps its frames device-resident for a cuda-frames batch (the per-pad form of what PyTransform proposes). Only the domain and the frame size are constrained: this element allocates nothing of its own.

Source§

type ProcessFuture<'a> = Pin<Box<dyn Future<Output = Result<(), G2gError>> + 'a>> where Self: 'a

Source§

fn input_count(&self) -> usize

Source§

fn intercept_caps( &self, _input: usize, upstream_caps: &Caps, ) -> Result<Caps, G2gError>

Phase 1 for one input pad: narrow that input’s proposed caps.
Source§

fn configure_pipeline( &mut self, _input: usize, absolute_caps: &Caps, ) -> Result<ConfigureOutcome, G2gError>

Phase 2 for one input pad: fixate and configure that input.
Source§

fn output_caps(&self) -> Result<Caps, G2gError>

The merged-output caps, valid once every input has been configured.
Source§

fn process<'a>( &'a mut self, input: usize, packet: PipelinePacket, out: &'a mut dyn OutputSink, ) -> Self::ProcessFuture<'a>

Combine one packet from input into the merged output. Read more
Source§

fn properties(&self) -> &'static [PropertySpec]

Runtime properties this muxer exposes (M104), mirroring AsyncElement::properties. Default: none. A muxer overrides this (with set_property / get_property) to be settable by name from a gst-launch line, the same as a transform.
Source§

fn set_property( &mut self, name: &str, value: PropValue, ) -> Result<(), PropError>

Set a property by name (M104). Default: every name is unknown.
Source§

fn get_property(&self, name: &str) -> Option<PropValue>

Read a property back by name (M104). Default: None.
Source§

fn input_pts_ordered(&self) -> bool

Whether the runner should deliver this element’s inputs in global presentation-timestamp order. Default false (arrival-order round-robin, the historical behavior). When true, the runner merges the per-input streams by DataFrame PTS, releasing the globally-earliest only once every still-open input has one queued, so process(pad, DataFrame(..)) arrives in non-decreasing PTS across all pads. Read more
Source§

fn tick_interval_ns(&self) -> Option<u64>

Deadline tick period in nanoseconds, or None (the default) for no ticks. Read more
Source§

fn reverse_channel(&self, _input: usize) -> Option<ReverseChannel>

A ReverseChannel for input pad input, if this session routes reverse signals (WebRTC PLI / BWE) back to individual upstream sources. The runner clones it before running and polls it after each push from that source, surfacing any pending signal as a PushOutcome. Default None: no per-input reverse channel (a plain muxer imposes none).
Source§

fn is_terminal(&self) -> bool

Whether this element is a terminal fan-in (a session sink that consumes its inputs and produces no merged output, e.g. a WebRTC publisher). A terminal element may end a graph with nothing downstream (Graph::add_fanin_sink); a merging muxer without a downstream stays a parse error, since its output would be silently dropped. Default false.
Source§

fn output_follows_input(&self) -> Option<usize>

If Some(pad), the merged output’s caps are the negotiated caps of input pad pad (an identity-passthrough mux: an overlay / watermark / alpha mixer that decorates a primary stream with a sidecar one). The solver then derives the output edge from that input edge instead of from caps_constraint_for_output, so the element need not know the output caps up front. Default None: the output is independent (a container interleave, a fixed-size compositor), declared by caps_constraint_for_output.
Source§

fn input_pad_index(&self, req: &PadRequest, ordinal: usize) -> Option<usize>

Map a named input-pad request to this element’s concrete input index (M481), so a gst-launch line can reference request pads by name (... ! mux.audio_0, ... ! o.text) instead of relying on the order the branches are written. The transpose of the demuxer’s output-pad selection (M476): req.kind is Video / Audio / Text / Any with an ordinal. Read more
Source§

fn accepts_runtime_input(&self, _pad: usize, _caps: &Caps) -> bool

Whether this element takes another input at runtime (M975), asked before a source added through DynamicFaninHandle::add_input is attached to pad, with the caps that source would arrive with. The runner has already checked pad against the declared input_count and the pad’s own caps_constraint_as_input; this is the element’s veto for what neither expresses: a session with no spare pad of that media kind, a container that cannot carry a second video track. Refusing fails that one add (G2gError::InputRefused reaches the caller), and the run continues on the inputs it already has. Read more
Source§

fn caps_constraint_as_input(&self, input: usize) -> CapsConstraint<'_>
where Self: Sized,

M18 step 1: declare this input pad’s negotiation-time constraint. Default wraps intercept_caps(input, ...) as a LegacySink (per-pad legacy bridge). Migrated muxers override to return native variants (typically AcceptsAny for per-frame-tagged interleave muxers, or Accepts(set) for per-input format-restricted muxers). Read more
Source§

fn caps_constraint_for_output(&self) -> Result<CapsConstraint<'_>, G2gError>
where Self: Sized,

M18 step 1: declare the merged output’s negotiation-time constraint, evaluated against the muxer’s current configured inputs. Default eagerly calls output_caps() and wraps as LegacySource. Migrated muxers with static or input-derived output may override with Produces(set) or DerivedOutput(fn). Read more
Source§

fn propose_allocation_for_output( &self, _caps: &Caps, ) -> Option<AllocationParams>

The allocation this muxer’s merged output needs, given the output’s negotiated caps. Default None: a container muxer’s byte output has no memory-domain tie to its inputs, so it imposes nothing downstream. A muxer whose output pool is derived from its inputs overrides it (a device-resident interleave writing into a surface sized by its video pads). Read more
Source§

fn configure_allocation_for_output(&mut self, _params: &AllocationParams)

Absorb the allocation now in force on the merged output: this muxer’s own re-derived proposal, or a downstream consumer’s demand that re-cascaded into the output boundary. Default: ignore. Read more
Source§

fn input_domains(&self) -> DomainSet

The memory domains this fan-in accepts on every input pad, mirroring AsyncElement::input_domains. Default DomainSet::ALL (no requirement). A muxer that reads host memory narrows it to System, and the allocation cascade turns that into a download demand on each GPU producer feeding a pad. Per-pad domains are not expressible: a fan-in whose pads differ declares the union it can take on any pad and rejects the rest at configure_pipeline.
Source§

fn set_instance_name(&mut self, _name: String)

Receive this instance’s log name and a per-instance log category override, mirroring AsyncElement::set_instance_name / set_log_category. Default: ignore. A muxer that logs about itself stores them in a LogName.
Source§

fn set_log_category(&mut self, _category: String)

Source§

fn metadata(&self) -> ElementMetadata

Static introspection metadata for this muxer (M178), the gst-inspect “Factory Details” (long-name / classification / description / author), mirroring AsyncElement::metadata. Default: empty. A muxer overrides it with a const ElementMetadata.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DynMultiInputElement for T

Source§

fn input_count(&self) -> usize

Source§

fn input_pts_ordered(&self) -> bool

Dyn-safe mirror of MultiInputElement::input_pts_ordered: whether the runner delivers inputs in global PTS order rather than arrival order.
Source§

fn output_follows_input(&self) -> Option<usize>

Dyn-safe mirror of MultiInputElement::output_follows_input: the input pad whose caps the merged output follows (identity-passthrough mux), if any.
Source§

fn tick_interval_ns(&self) -> Option<u64>

Dyn-safe mirror of MultiInputElement::tick_interval_ns: the deadline tick period this element wants, if any.
Source§

fn input_pad_index(&self, req: &PadRequest, ordinal: usize) -> Option<usize>

Dyn-safe mirror of MultiInputElement::input_pad_index (M481): map a named request pad to the concrete input index, for the launch parser.
Source§

fn caps_constraint_as_input(&self, input: usize) -> CapsConstraint<'_>

Source§

fn caps_constraint_for_output(&self) -> Result<CapsConstraint<'_>, G2gError>

Source§

fn input_domains(&self) -> DomainSet

Source§

fn propose_allocation_for_input( &self, input: usize, caps: &Caps, ) -> Option<AllocationParams>

Source§

fn propose_allocation_for_output(&self, caps: &Caps) -> Option<AllocationParams>

Source§

fn configure_allocation_for_output(&mut self, params: &AllocationParams)

Source§

fn output_caps(&self) -> Result<Caps, G2gError>

Dyn-safe mirror of MultiInputElement::output_caps.
Source§

fn configure_pipeline( &mut self, input: usize, absolute_caps: &Caps, ) -> Result<ConfigureOutcome, G2gError>

Source§

fn process<'a>( &'a mut self, input: usize, packet: PipelinePacket, out: &'a mut dyn OutputSink, ) -> Pin<Box<dyn Future<Output = Result<(), G2gError>> + 'a>>

Source§

fn properties(&self) -> &'static [PropertySpec]

Source§

fn set_property( &mut self, name: &str, value: PropValue, ) -> Result<(), PropError>

Source§

fn get_property(&self, name: &str) -> Option<PropValue>

Source§

fn metadata(&self) -> ElementMetadata

Dyn-safe mirror of MultiInputElement::metadata, for the gst-inspect “Factory Details” of an erased fan-in muxer.
Source§

fn reverse_channel(&self, input: usize) -> Option<ReverseChannel>

Dyn-safe mirror of MultiInputElement::reverse_channel, so a terminal fan-in node’s arm can route a per-input reverse signal (WebRTC PLI / BWE) back to the upstream feeding that pad. Default None.
Source§

fn is_terminal(&self) -> bool

Dyn-safe mirror of MultiInputElement::is_terminal.
Source§

fn accepts_runtime_input(&self, pad: usize, caps: &Caps) -> bool

Dyn-safe mirror of MultiInputElement::accepts_runtime_input: whether this element takes an input added at runtime on pad with caps.
Source§

fn set_instance_name(&mut self, name: String)

Dyn-safe mirror of MultiInputElement::set_instance_name, so the runner can name an erased muxer instance for logging.
Source§

fn set_log_category(&mut self, category: String)

Source§

fn drive_muxer_arm<'s>( self: Box<T>, io: MuxerArmIo<'s>, ) -> Pin<Box<dyn Future<Output = Result<u64, G2gError>> + 's>>
where T: 's,

Source§

fn drive_fanin_sink_arm<'s>( self: Box<T>, io: FaninSinkArmIo, ) -> Pin<Box<dyn Future<Output = Result<u64, G2gError>> + 's>>
where T: 's,

Source§

impl<T> ElementBound for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.