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
- Push a frame to the encoder.
- Take all packets from the encoder until you get None.
- If there are more frames to be encoded, continue with 1.
- Flush the encoder.
- Take all packets from the encoder 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, frame: Self::Frame) -> Result<(), CodecError>
fn try_push(&mut self, frame: Self::Frame) -> Result<(), CodecError>
Push a given frame to the encoder.
sourcefn try_flush(&mut self) -> Result<(), CodecError>
fn try_flush(&mut self) -> Result<(), CodecError>
Flush the encoder.