Trait ac_ffmpeg::codec::Encoder

source ·
pub trait Encoder {
    type CodecParameters;
    type Frame;

    fn codec_parameters(&self) -> Self::CodecParameters;
    fn try_push(&mut self, frame: Self::Frame) -> Result<(), CodecError>;
    fn try_flush(&mut self) -> Result<(), CodecError>;
    fn take(&mut self) -> Result<Option<Packet>, Error>;

    fn push(&mut self, frame: Self::Frame) -> Result<(), Error> { ... }
    fn flush(&mut self) -> Result<(), Error> { ... }
}
Expand description

A media encoder.

Common encoder operation

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

Required Associated Types§

Required Methods§

Get codec parameters.

Push a given frame to the encoder.

Flush the encoder.

Take the next packet from the encoder.

Provided Methods§

Push a given frame to the encoder.

Panics

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

Flush the encoder.

Panics

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

Implementors§