Skip to main content

FrameSink

Trait FrameSink 

Source
pub trait FrameSink: Send {
    // Required method
    fn push_frame(
        &mut self,
        rgba: &[u8],
        width: u32,
        height: u32,
        pts: Duration,
    );

    // Provided method
    fn flush(&mut self) { ... }
}
Expand description

A sink that receives decoded video frames as contiguous RGBA bytes.

Implementations must be SendPlayerRunner calls push_frame from a dedicated presentation thread.

§Threading

push_frame is called exclusively from PlayerRunner::run. Do not call back into PlayerRunner from inside push_frame — this will deadlock.

Required Methods§

Source

fn push_frame(&mut self, rgba: &[u8], width: u32, height: u32, pts: Duration)

Receive a video frame at its presentation time.

rgba is a contiguous, row-major RGBA buffer:

  • 4 bytes per pixel (R, G, B, A), alpha always 255
  • Total size: width * height * 4 bytes
  • Row stride: width * 4 bytes (no padding)

Provided Methods§

Source

fn flush(&mut self)

Called when playback ends (EOF or PlayerHandle::stop). Default: no-op.

Implementations should flush any pending output here.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§