Skip to main content

GraphNodeRef

Enum GraphNodeRef 

Source
pub enum GraphNodeRef<'a> {
    Source(Box<dyn DynSourceLoop + 'a>),
    Element(Box<dyn DynAsyncElement + 'a>),
    Muxer(Box<dyn DynMultiInputElement + 'a>),
    FanoutSource(Box<dyn DynMultiOutputSource + 'a>),
    Demux(Box<dyn DynMultiOutputElement + 'a>),
}
Expand description

Element payload for a Graph driven by run_graph. Sources, transforms/sinks, and muxers implement different traits (a source has no input pad, a muxer has many), so the payload is an enum the runner matches on per node kind. A tee carries no element (Graph::add_tee takes none).

The 'a lifetime is the lifetime of the boxed elements. Owned 'static elements (the common case, GraphNode) use source / element / muxer; the convenience wrappers build a borrowing graph over their &mut element references with source_ref / element_ref / muxer_ref, so they can call run_graph without taking ownership and the caller keeps its elements.

Variants§

§

Source(Box<dyn DynSourceLoop + 'a>)

§

Element(Box<dyn DynAsyncElement + 'a>)

§

Muxer(Box<dyn DynMultiInputElement + 'a>)

§

FanoutSource(Box<dyn DynMultiOutputSource + 'a>)

A terminal fan-out source (M727): 0 inputs, N outputs it generates itself (a WebRTC session receiving several tracks). Graph::add_fanout_src.

§

Demux(Box<dyn DynMultiOutputElement + 'a>)

A content-routing demultiplexer: 1 input, N outputs. Structurally a tee (its node kind is Tee(n)), so it negotiates as a tee at startup, but it carries a MultiOutputElement that routes each packet to a chosen output instead of broadcasting, and emits per-output CapsChanged so each branch retypes from the byte-stream input (M210). Graph::add_demux.

Implementations§

Source§

impl<'a> GraphNodeRef<'a>

Source

pub fn source<S: SourceLoop + 'static>(source: S) -> Self

Box an owned source (add_source).

Source

pub fn element<E: AsyncElement + 'static>(element: E) -> Self

Box an owned transform or sink (add_transform / add_sink).

Source

pub fn muxer<M: MultiInputElement + 'static>(muxer: M) -> Self

Box an owned fan-in muxer (add_muxer).

Source

pub fn fanout_source<S: MultiOutputSource + 'static>(source: S) -> Self

Box an owned terminal fan-out source (add_fanout_src).

Source

pub fn source_ref(source: &'a mut (dyn DynSourceLoop + 'a)) -> Self

Box a borrowed source, for a borrowing graph (the convenience wrappers).

Source

pub fn element_ref(element: &'a mut (dyn DynAsyncElement + 'a)) -> Self

Box a borrowed transform or sink.

Source

pub fn muxer_ref(muxer: &'a mut (dyn DynMultiInputElement + 'a)) -> Self

Box a borrowed fan-in muxer.

Source

pub fn fanout_source_ref( source: &'a mut (dyn DynMultiOutputSource + 'a), ) -> Self

Box a borrowed terminal fan-out source.

Source

pub fn demux<D: MultiOutputElement + 'static>(demux: D) -> Self

Box an owned fan-out demultiplexer (add_demux).

Source

pub fn demux_ref(demux: &'a mut (dyn DynMultiOutputElement + 'a)) -> Self

Box a borrowed fan-out demultiplexer.

Source

pub fn log_category(&self) -> &'static str

The element’s log category (M179), its short type name, e.g. videotestsrc. The runner uses it to derive instance names (<category>N); a DOT dump uses it as the node label before the run assigns the suffixed name. Fan-in / fan-out elements don’t expose a category on their dyn trait (the runner doesn’t name them either), so they report their structural role.

Source

pub fn output_memory(&self) -> MemoryDomainKind

The memory domain of the frames this node emits on its output pad(s) (M285): the source’s / element’s output_memory, surfaced per edge for the DOT dump so a GPU / zero-copy link is marked. Fan-in / fan-out elements are reported as System (their domain is the upstream’s; the per-edge derivation does not propagate through them yet).

Source

pub fn output_domains(&self) -> DomainSet

The full set of memory domains this node can emit (M351), the producer-capability half of the two-sided allocation-domain negotiation. A source’s / element’s output_domains; fan-in / fan-out nodes report a System singleton (their domain follows the upstream, like output_memory).

Source

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

The runtime properties this node’s element declares, whatever its shape. The animated-property check (M882) reads it to validate a ControlProgram against the element it targets.

Source

pub fn input_domains(&self) -> DomainSet

The memory domains this node accepts on its input pad(s) (M354), for the converter auto-plug and the allocation cascade. A muxer declares one set covering every input pad; a terminal fan-out source has no input, so it reports DomainSet::ALL (no requirement), as does a source.

Trait Implementations§

Source§

impl Debug for GraphNodeRef<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for GraphNodeRef<'a>

§

impl<'a> !Sync for GraphNodeRef<'a>

§

impl<'a> !UnwindSafe for GraphNodeRef<'a>

§

impl<'a> Freeze for GraphNodeRef<'a>

§

impl<'a> Send for GraphNodeRef<'a>

§

impl<'a> Unpin for GraphNodeRef<'a>

§

impl<'a> UnsafeUnpin for GraphNodeRef<'a>

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> ElementBound for T
where T: Send,

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.