Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder: Send {
    // Required methods
    fn send_packet(&mut self, packet: &Packet) -> Result<()>;
    fn receive_frame(&mut self) -> Result<Frame>;

    // Provided methods
    fn configure(&mut self, _params: &CodecParams) -> Result<()> { ... }
    fn flush(&mut self) { ... }
}
Expand description

Decodes compressed Packets into raw Frames.

Drive it the FFmpeg way: feed packets with send_packet, then pull frames with receive_frame until it returns Error::Again (needs more input) or Error::Eof.

Required Methods§

Source

fn send_packet(&mut self, packet: &Packet) -> Result<()>

Submit one compressed packet for decoding.

Source

fn receive_frame(&mut self) -> Result<Frame>

Retrieve the next decoded frame, if one is ready.

Returns Error::Again when more packets are needed, or Error::Eof once fully drained.

Provided Methods§

Source

fn configure(&mut self, _params: &CodecParams) -> Result<()>

Receive the stream’s parameters before decoding begins. Default: ignore them (the bitstream is self-describing). Called once, after construction.

Source

fn flush(&mut self)

Signal end-of-input so buffered frames can be flushed out via subsequent receive_frame calls. Default: no buffering.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§