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
impl SrcPad
pub fn new(name: impl Into<String>) -> Self
pub fn name(&self) -> &str
pub fn is_linked(&self) -> bool
Sourcepub fn peer_identity(&self) -> Option<(ElementType, Arc<str>)>
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.
Sourcepub fn push(&mut self, buf: MediaBuffer) -> Result<()>
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).
Sourcepub fn control(&mut self, msg: ControlMsg) -> Result<()>
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.