pub trait AnimationEncoder: Send {
// Required methods
fn write_frame(&mut self, image: &Rgb8Image) -> Result<()>;
fn finish(self: Box<Self>) -> Result<()>;
}Expand description
Accepts rendered frames one at a time and finishes a file. Implemented per container so the caller can stream a long recording without holding every frame in memory.
Send because finishing an MP4 blocks on ffmpeg exiting, and the Python bindings release the
GIL around that — a wait that can take seconds must not hold up every other thread.
Required Methods§
Sourcefn write_frame(&mut self, image: &Rgb8Image) -> Result<()>
fn write_frame(&mut self, image: &Rgb8Image) -> Result<()>
Writes one frame. Frames must all share the dimensions of the first.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".