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 Send — PlayerRunner 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§
Sourcefn push_frame(&mut self, rgba: &[u8], width: u32, height: u32, pts: Duration)
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 * 4bytes - Row stride:
width * 4bytes (no padding)
Provided Methods§
Sourcefn flush(&mut self)
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".