pub trait VideoEncoder {
type Error: Error + Send + Sync + 'static;
// Required methods
fn send(
&mut self,
frame: &Frame,
pulse: Option<&dyn Pulse>,
) -> Result<SendStatus, SessionError<Self::Error>>;
fn receive(
&mut self,
pulse: Option<&dyn Pulse>,
) -> Result<Receive<Packet>, SessionError<Self::Error>>;
fn end_input(&mut self) -> Result<(), SessionError<Self::Error>>;
fn output_config(&self) -> Option<&CodecConfig>;
// Provided method
fn output_fidelity(&self) -> Option<Fidelity> { ... }
}Expand description
A video encoder session: frames in, packets out, in decode order. See the module docs for the protocol.
Required Associated Types§
Required Methods§
Sourcefn send(
&mut self,
frame: &Frame,
pulse: Option<&dyn Pulse>,
) -> Result<SendStatus, SessionError<Self::Error>>
fn send( &mut self, frame: &Frame, pulse: Option<&dyn Pulse>, ) -> Result<SendStatus, SessionError<Self::Error>>
Offer a frame handle. The encoder clones it to queue (no pixel copy is required by the contract; a backend may copy into padded planes).
Sourcefn receive(
&mut self,
pulse: Option<&dyn Pulse>,
) -> Result<Receive<Packet>, SessionError<Self::Error>>
fn receive( &mut self, pulse: Option<&dyn Pulse>, ) -> Result<Receive<Packet>, SessionError<Self::Error>>
One packet at a time, in decode order, carrying the presentation timestamp of the frame it shows.
Sourcefn end_input(&mut self) -> Result<(), SessionError<Self::Error>>
fn end_input(&mut self) -> Result<(), SessionError<Self::Error>>
Declare end of input; idempotent. Then receive until EndOfStream.
Sourcefn output_config(&self) -> Option<&CodecConfig>
fn output_config(&self) -> Option<&CodecConfig>
Codec configuration a muxer needs before the first packet.
Provided Methods§
Sourcefn output_fidelity(&self) -> Option<Fidelity>
fn output_fidelity(&self) -> Option<Fidelity>
Fidelity guaranteed by this actual prepared encoder for every accepted input frame. None means unqualified, not lossy or lossless. A guarantee must not be inferred from codec identity or an unvalidated request. This describes encoding only; preceding conversion may lose samples. Fixed-configuration operations bind this value with output_config and reject a later change before publishing staged output.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".