Skip to main content

VideoFrameReader

Trait VideoFrameReader 

Source
pub trait VideoFrameReader:
    Any
    + Send
    + Sync {
    // Required method
    fn frame_for(&self, display_time: Instant) -> Option<Arc<dyn VideoFrame>>;
}
Expand description

The pictures of the one source a reader is given to, read from any thread as they are drawn. It takes one source at a time, as Android’s ImageReader takes one producer: given to a second while the first still feeds it, it is refused, and the second sends its frames nowhere. A reader keeps no frame for later: one not read before the next arrives is dropped.

A host gets its own type back from a reader it is given by downcasting through Any.

Required Methods§

Source

fn frame_for(&self, display_time: Instant) -> Option<Arc<dyn VideoFrame>>

The frame to show at display_time, the moment the picture being drawn reaches the screen: a player’s frame for that moment of the video, as a display link asks AVFoundation’s video output for each refresh’s target time, and a camera’s newest. None when it is the frame handed out last, or none came.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§