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:
send_packet()— feed compressed datareceive_frame()— pull decoded data (may need multiple calls)flush()— reset state after seeking
Required Methods§
Sourcefn send_packet(&mut self, packet: Option<&Packet>) -> Result<()>
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).
Sourcefn receive_frame(&mut self) -> Result<Frame>
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.
Sourcefn descriptor(&self) -> &CodecDescriptor
fn descriptor(&self) -> &CodecDescriptor
Get the codec descriptor.