pub trait VideoStream {
// Required methods
fn width(&self) -> u32;
fn height(&self) -> u32;
fn frame_rate(&self) -> f32;
fn next_frame(&mut self) -> Option<VideoFrame>;
// Provided method
fn frame_count_hint(&self) -> Option<u64> { ... }
}Expand description
Pull-based source of decoded video frames.
Implementations may be lazy (stream from disk on each next_frame) or
eager (decode the whole stream up front). The contract is just:
successive calls return successive frames; None signals end-of-stream.
Frame dimensions are reported by width /
height and must remain constant across the stream
(we don’t support resolution changes mid-playback in v1).
Required Methods§
Sourcefn frame_rate(&self) -> f32
fn frame_rate(&self) -> f32
Source frame rate (frames per second). Used by the player loop to
time uploads; backends without a known fixed rate may return their
nominal rate (e.g. AVFoundation’s nominalFrameRate on the track).
Sourcefn next_frame(&mut self) -> Option<VideoFrame>
fn next_frame(&mut self) -> Option<VideoFrame>
Pull the next frame. Returns None at end-of-stream.
Provided Methods§
Sourcefn frame_count_hint(&self) -> Option<u64>
fn frame_count_hint(&self) -> Option<u64>
Total frame count, if known up-front. None for live streams.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".