pub trait Decoder {
type CodecParameters;
type Frame;
fn codec_parameters(&self) -> Self::CodecParameters;
fn try_push(&mut self, packet: Packet) -> Result<(), CodecError>;
fn try_flush(&mut self) -> Result<(), CodecError>;
fn take(&mut self) -> Result<Option<Self::Frame>, Error>;
fn push(&mut self, packet: Packet) -> Result<(), Error> { ... }
fn flush(&mut self) -> Result<(), Error> { ... }
}
Expand description
A media decoder.
Common decoder operation
- Push a packet to the decoder.
- Take all frames from the decoder until you get None.
- If there are more packets to be decoded, continue with 1.
- Flush the decoder.
- Take all frames from the decoder until you get None.
Required Associated Types§
type CodecParameters
type Frame
Required Methods§
sourcefn codec_parameters(&self) -> Self::CodecParameters
fn codec_parameters(&self) -> Self::CodecParameters
Get codec parameters.
sourcefn try_push(&mut self, packet: Packet) -> Result<(), CodecError>
fn try_push(&mut self, packet: Packet) -> Result<(), CodecError>
Push a given packet to the decoder.
sourcefn try_flush(&mut self) -> Result<(), CodecError>
fn try_flush(&mut self) -> Result<(), CodecError>
Flush the decoder.