Skip to main content

Sink

Trait Sink 

Source
pub trait Sink: Element {
    // Required methods
    fn consume(&mut self, buf: MediaBuffer) -> Result<()>;
    fn control(&mut self, msg: ControlMsg) -> Result<()>;
}
Expand description

Anything that can receive a buffer pushed from upstream — the input side of an element, or a plain terminal sink. Every Sink is named (via Element) so bus events (e.g. EOS) can identify which one they came from.

This is the only “connection” primitive in the pipeline. By default, consuming a buffer is a plain function call on the caller’s thread — zero overhead. Thread boundaries are introduced explicitly by wrapping a Sink in a crate::queue::Queue, not by elements spawning their own threads.

Required Methods§

Source

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

Source

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

Reacts to a ControlMsg (pause/resume/stop) and, for anything with a downstream of its own, forwards it on — same shape as consume, just a separate channel from MediaBuffer so it can reach every element (not just ones that already know how to interpret a data buffer) and, at a crate::queue::Queue, jump ahead of whatever data is backed up instead of waiting behind it. No default: every Sink has to consciously decide what this means for it, rather than silently dropping it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Sink for AudioResampler

Source§

impl Sink for AudioVolume

Source§

impl Sink for D3d11Decoder

Available on Windows and crate feature d3d11 and (crate features d3d11 or d3d12) only.
Source§

impl Sink for D3d11Download

Available on Windows and crate feature d3d11 only.
Source§

impl Sink for D3d11NvencEncoder

Available on Windows and crate feature d3d11 only.
Source§

impl Sink for D3d11Renderer

Available on Windows and crate feature d3d11 and (crate features d3d11 or d3d12 or wasapi-renderer) only.
Source§

impl Sink for D3d11Upload

Available on Windows and crate feature d3d11 and (crate features d3d11 or d3d12) only.
Source§

impl Sink for D3d11VideoCompositorInputSink

Available on Windows and crate feature d3d11 only.
Source§

impl Sink for D3d12Renderer

Available on Windows and crate feature d3d12 and (crate features d3d11 or d3d12 or wasapi-renderer) only.
Source§

impl Sink for D3d12Upload

Available on Windows and crate feature d3d12 and (crate features d3d11 or d3d12) only.
Source§

impl Sink for D3d12vaDecoder

Available on Windows and crate feature d3d12 and (crate features d3d11 or d3d12) only.
Source§

impl Sink for FrameCounter

Source§

impl Sink for HlsMuxerStreamSink

Source§

impl Sink for MixerInputSink

Source§

impl Sink for Mp4MuxerStreamSink

Source§

impl Sink for Pacer

Source§

impl Sink for PacketCounter

Source§

impl Sink for Queue

Source§

impl Sink for RtspSink

Source§

impl Sink for Scaler

Source§

impl Sink for SwAudioEncoder

Source§

impl Sink for SwDecoder

Source§

impl Sink for SwEncoder

Source§

impl Sink for Tee

Source§

impl Sink for VideoCompositorInputSink

Source§

impl Sink for VideoSynchronizer

Source§

impl Sink for WasapiRenderer

Available on Windows and crate feature wasapi-renderer and (crate features d3d11 or d3d12 or wasapi-renderer) only.
Source§

impl Sink for WebRtcTrackSink

Available on crate feature webrtc only.
Source§

impl<F, C> Sink for AppSink<F, C>
where F: FnMut(MediaBuffer) -> Result<()> + Send + 'static, C: FnMut(ControlMsg) -> Result<()> + Send + 'static,

Source§

impl<F> Sink for OrtDetector<F>
where F: FnMut(&Video, &[Detection]) -> Result<()> + Send + 'static,

Available on crate feature ort only.