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§
Sourcefn params(&self) -> &CodecParameters
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.
Sourcefn next_frame(&mut self) -> Result<Frame>
fn next_frame(&mut self) -> Result<Frame>
Produce the next frame. Returns Error::Eof at end of stream.
Provided Methods§
Sourcefn metadata(&self) -> &[(String, String)]
fn metadata(&self) -> &[(String, String)]
Source-level metadata as ordered (key, value) pairs. Default is empty.
Sourcefn duration_micros(&self) -> Option<i64>
fn duration_micros(&self) -> Option<i64>
Source-level duration in microseconds, if known. Default is
None.