pub trait Decoder: Send {
// Required methods
fn codec_id(&self) -> &CodecId;
fn send_packet(&mut self, packet: &Packet) -> Result<()>;
fn receive_frame(&mut self) -> Result<Frame>;
fn flush(&mut self) -> Result<()>;
// Provided method
fn set_execution_context(&mut self, _ctx: &ExecutionContext) { ... }
}Expand description
A packet-to-frame decoder.
Required Methods§
fn codec_id(&self) -> &CodecId
Sourcefn send_packet(&mut self, packet: &Packet) -> Result<()>
fn send_packet(&mut self, packet: &Packet) -> Result<()>
Feed one compressed packet. May or may not produce a frame immediately —
call receive_frame in a loop afterwards.
Sourcefn receive_frame(&mut self) -> Result<Frame>
fn receive_frame(&mut self) -> Result<Frame>
Pull the next decoded frame, if any. Returns Error::NeedMore when the
decoder needs another packet.
Provided Methods§
Sourcefn set_execution_context(&mut self, _ctx: &ExecutionContext)
fn set_execution_context(&mut self, _ctx: &ExecutionContext)
Advisory: announce the runtime environment (today: a thread budget
for codec-internal parallelism). Called at most once, before the
first send_packet. Default no-op; codecs that want to run
slice-/GOP-/tile-parallel override this to capture the budget.
Ignoring the hint is always safe — callers must still work with
a decoder that runs serial.