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§
Sourcefn send_packet(&mut self, packet: &Packet) -> Result<()>
fn send_packet(&mut self, packet: &Packet) -> Result<()>
Submit one compressed packet for decoding.
Sourcefn receive_frame(&mut self) -> Result<Frame>
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§
Sourcefn configure(&mut self, _params: &CodecParams) -> Result<()>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".