pub trait Encoder {
type CodecParameters;
type Frame;
// Required methods
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>;
// Provided methods
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.