Skip to main content

VideoEncoder

Trait VideoEncoder 

Source
pub trait VideoEncoder: Send {
    // Required methods
    fn write_frame(
        &mut self,
        pixel_buffer: &[RgbColor],
    ) -> Result<(), VideoError>;
    fn finish(&mut self) -> Result<(), VideoError>;
    fn frames_written(&self) -> u64;
}
Expand description

Trait for video encoders.

Implement this trait to add support for new video formats.

Required Methods§

Source

fn write_frame(&mut self, pixel_buffer: &[RgbColor]) -> Result<(), VideoError>

Write a frame to the video.

The pixel buffer is in RGB format as (R, G, B) tuples, as a flat array of width × height values.

Source

fn finish(&mut self) -> Result<(), VideoError>

Finish encoding and flush any remaining data.

Source

fn frames_written(&self) -> u64

Get the number of frames written so far.

Implementors§