Skip to main content

FrameEncoder

Trait FrameEncoder 

Source
pub trait FrameEncoder: Send {
    // Required methods
    fn encode_frame(&mut self, frame: &Frame) -> Result<Vec<u8>>;
    fn flush(&mut self) -> Result<Vec<u8>>;
}
Expand description

A frame-level encoder that converts raw Frame values to encoded bytes.

Implementations wrap a codec encoder and optional container muxer.

Required Methods§

Source

fn encode_frame(&mut self, frame: &Frame) -> Result<Vec<u8>>

Encode a single decoded frame.

Returns the encoded byte payload (may be empty for encoders that buffer internally).

§Errors

Returns an error if encoding fails (e.g. invalid frame dimensions, codec state error).

Source

fn flush(&mut self) -> Result<Vec<u8>>

Flush any internally buffered frames.

Must be called at end-of-stream. Returns any remaining encoded bytes.

§Errors

Returns an error if the flush operation fails.

Implementors§