Skip to main content

FrameSource

Trait FrameSource 

Source
pub trait FrameSource: Send {
    // Required methods
    fn params(&self) -> &CodecParameters;
    fn next_frame(&mut self) -> Result<Frame>;

    // Provided methods
    fn metadata(&self) -> &[(String, String)] { ... }
    fn duration_micros(&self) -> Option<i64> { ... }
}
Expand description

A producer of already-decoded Frames.

Used by synthetic generators (testsrc, sine sweep, gradient image, …) that emit decoded frames natively. The pipeline executor consumes frames directly, skipping both the container-demux and decode stages.

Required Methods§

Source

fn params(&self) -> &CodecParameters

Codec parameters describing the frames this source emits. Stable across the lifetime of the source. Even though the frames are already decoded, downstream filters and encoders need the parameter shape (sample rate / pixel format / channel layout / frame rate / …) to configure themselves.

Source

fn next_frame(&mut self) -> Result<Frame>

Produce the next frame. Returns Error::Eof at end of stream.

Provided Methods§

Source

fn metadata(&self) -> &[(String, String)]

Source-level metadata as ordered (key, value) pairs. Default is empty.

Source

fn duration_micros(&self) -> Option<i64>

Source-level duration in microseconds, if known. Default is None.

Implementors§