Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder: Send {
    // Required methods
    fn send_packet(&mut self, packet: Option<&Packet>) -> Result<()>;
    fn receive_frame(&mut self) -> Result<Frame>;
    fn flush(&mut self);
    fn descriptor(&self) -> &CodecDescriptor;
}
Expand description

Decoder trait — the main abstraction for all decoders.

Follows FFmpeg’s send/receive model:

  1. send_packet() — feed compressed data
  2. receive_frame() — pull decoded data (may need multiple calls)
  3. flush() — reset state after seeking

Required Methods§

Source

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

Send a compressed packet to the decoder. Pass None to signal end-of-stream (drain mode).

Source

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

Receive a decoded frame from the decoder. Returns Error::Again when more input is needed. Returns Error::Eof when all data has been drained.

Source

fn flush(&mut self)

Flush the decoder (reset internal state for seeking).

Source

fn descriptor(&self) -> &CodecDescriptor

Get the codec descriptor.

Implementors§