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§
Sourcefn write_frame(&mut self, pixel_buffer: &[RgbColor]) -> Result<(), VideoError>
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.
Sourcefn finish(&mut self) -> Result<(), VideoError>
fn finish(&mut self) -> Result<(), VideoError>
Finish encoding and flush any remaining data.
Sourcefn frames_written(&self) -> u64
fn frames_written(&self) -> u64
Get the number of frames written so far.