Skip to main content

VideoEncoder

Trait VideoEncoder 

Source
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§

Source

type Error: Error + Send + Sync + 'static

The implementation’s error.

Required Methods§

Source

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).

Source

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.

Source

fn end_input(&mut self) -> Result<(), SessionError<Self::Error>>

Declare end of input; idempotent. Then receive until EndOfStream.

Source

fn output_config(&self) -> Option<&CodecConfig>

Codec configuration a muxer needs before the first packet.

Provided Methods§

Source

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".

Implementations on Foreign Types§

Source§

impl<E: VideoEncoder + ?Sized> VideoEncoder for Box<E>

Source§

type Error = <E as VideoEncoder>::Error

Source§

fn send( &mut self, frame: &Frame, pulse: Option<&dyn Pulse>, ) -> Result<SendStatus, SessionError<E::Error>>

Source§

fn receive( &mut self, pulse: Option<&dyn Pulse>, ) -> Result<Receive<Packet>, SessionError<E::Error>>

Source§

fn end_input(&mut self) -> Result<(), SessionError<E::Error>>

Source§

fn output_config(&self) -> Option<&CodecConfig>

Source§

fn output_fidelity(&self) -> Option<Fidelity>

Implementors§