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§
fn consume(&mut self, buf: MediaBuffer) -> Result<()>
Sourcefn control(&mut self, msg: ControlMsg) -> Result<()>
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§
impl Sink for AudioResampler
impl Sink for AudioVolume
impl Sink for D3d11Decoder
d3d11 and (crate features d3d11 or d3d12) only.impl Sink for D3d11Download
d3d11 only.impl Sink for D3d11NvencEncoder
d3d11 only.impl Sink for D3d11Renderer
d3d11 and (crate features d3d11 or d3d12 or wasapi-renderer) only.impl Sink for D3d11Upload
d3d11 and (crate features d3d11 or d3d12) only.impl Sink for D3d11VideoCompositorInputSink
d3d11 only.impl Sink for D3d12Renderer
d3d12 and (crate features d3d11 or d3d12 or wasapi-renderer) only.impl Sink for D3d12Upload
d3d12 and (crate features d3d11 or d3d12) only.impl Sink for D3d12vaDecoder
d3d12 and (crate features d3d11 or d3d12) only.impl Sink for FrameCounter
impl Sink for HlsMuxerStreamSink
impl Sink for MixerInputSink
impl Sink for Mp4MuxerStreamSink
impl Sink for Pacer
impl Sink for PacketCounter
impl Sink for Queue
impl Sink for RtspSink
impl Sink for Scaler
impl Sink for SwAudioEncoder
impl Sink for SwDecoder
impl Sink for SwEncoder
impl Sink for Tee
impl Sink for VideoCompositorInputSink
impl Sink for VideoSynchronizer
impl Sink for WasapiRenderer
wasapi-renderer and (crate features d3d11 or d3d12 or wasapi-renderer) only.impl Sink for WebRtcTrackSink
webrtc only.impl<F, C> Sink for AppSink<F, C>where
F: FnMut(MediaBuffer) -> Result<()> + Send + 'static,
C: FnMut(ControlMsg) -> Result<()> + Send + 'static,
impl<F> Sink for OrtDetector<F>
ort only.