ac_ffmpeg::codec

Trait Decoder

Source
pub trait Decoder {
    type CodecParameters;
    type Frame;

    // Required methods
    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>;

    // Provided methods
    fn push(&mut self, packet: Packet) -> Result<(), Error> { ... }
    fn flush(&mut self) -> Result<(), Error> { ... }
}
Expand description

A media decoder.

§Common decoder operation

  1. Push a packet to the decoder.
  2. Take all frames from the decoder until you get None.
  3. If there are more packets to be decoded, continue with 1.
  4. Flush the decoder.
  5. Take all frames from the decoder until you get None.

Required Associated Types§

Required Methods§

Source

fn codec_parameters(&self) -> Self::CodecParameters

Get codec parameters.

Source

fn try_push(&mut self, packet: Packet) -> Result<(), CodecError>

Push a given packet to the decoder.

Source

fn try_flush(&mut self) -> Result<(), CodecError>

Flush the decoder.

Source

fn take(&mut self) -> Result<Option<Self::Frame>, Error>

Take the next frame from the decoder.

Provided Methods§

Source

fn push(&mut self, packet: Packet) -> Result<(), Error>

Push a given packet to the decoder.

§Panics

The method panics if the operation is not expected (i.e. another operation needs to be done).

Source

fn flush(&mut self) -> Result<(), Error>

Flush the decoder.

§Panics

The method panics if the operation is not expected (i.e. another operation needs to be done).

Implementors§