Skip to main content

VideoStream

Trait VideoStream 

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§

fn width(&self) -> u32

Frame width in pixels. Constant across the stream.

fn height(&self) -> u32

Frame height in pixels. Constant across the stream.

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).

fn next_frame(&mut self) -> Option<VideoFrame>

Pull the next frame. Returns None at end-of-stream.

Provided Methods§

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".

Implementors§

§

impl VideoStream for GstreamerPipeStream

§

impl VideoStream for MockVideoStream