Skip to main content

SrcPad

Struct SrcPad 

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

An output port an Element owns. Data only ever leaves an element through one of its src pads — there is no other way to reach downstream.

This is what fan-out is, in this design: an element with more than one src pad is a tee — there’s no separate “Tee” primitive in the pad/element model itself. crate::elements::FileDemuxer is the plain form of it: one pad per container stream, chosen once at wiring time via a normal &mut [SrcPad]. crate::elements::Tee is the one deliberate exception to that plain shape — its pads live behind a lock instead, so a TeeHandle can add or remove one from a different thread than whatever is driving it; see that module for why.

Implementations§

Source§

impl SrcPad

Source

pub fn new(name: impl Into<String>) -> Self

Source

pub fn name(&self) -> &str

Source

pub fn is_linked(&self) -> bool

Source

pub fn peer_identity(&self) -> Option<(ElementType, Arc<str>)>

The linked sink’s own identity, without touching the link itself — lets a caller that just saw SrcPad::push/SrcPad::control fail (e.g. crate::elements::Tee, fanning out to several pads at once) report which downstream element the failure actually came from, instead of only knowing its own. None for an unlinked pad.

Source

pub fn push(&mut self, buf: MediaBuffer) -> Result<()>

Pushes a buffer to whatever this pad is linked to. Pushing into an unlinked pad silently drops the buffer (e.g. a demuxer stream nobody cared to link).

Source

pub fn control(&mut self, msg: ControlMsg) -> Result<()>

Forwards a ControlMsg to whatever this pad is linked to — mirrors SrcPad::push, just for control instead of data. Pushing into an unlinked pad is a no-op, same as push.

Auto Trait Implementations§

§

impl !RefUnwindSafe for SrcPad

§

impl !Sync for SrcPad

§

impl !UnwindSafe for SrcPad

§

impl Freeze for SrcPad

§

impl Send for SrcPad

§

impl Unpin for SrcPad

§

impl UnsafeUnpin for SrcPad

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more