Skip to main content

VideoEncoder

Trait VideoEncoder 

Source
pub trait VideoEncoder {
    // Required methods
    fn config(&self) -> &EncoderConfig;
    fn format(&self) -> VideoEncoderFormat;
    fn encode<'a>(
        &'a mut self,
        index: FrameIndex,
        frame: FrameSource<'a>,
    ) -> EncoderFuture<'a, Vec<EncodedSample>>;
    fn finish<'a>(&'a mut self) -> EncoderFuture<'a, Vec<EncodedSample>>;

    // Provided methods
    fn implementation(&self) -> CodecImplementation { ... }
    fn backend_name(&self) -> &str { ... }
}
Expand description

Backend-neutral video encoder contract.

Required Methods§

Source

fn config(&self) -> &EncoderConfig

Source

fn format(&self) -> VideoEncoderFormat

Source

fn encode<'a>( &'a mut self, index: FrameIndex, frame: FrameSource<'a>, ) -> EncoderFuture<'a, Vec<EncodedSample>>

Source

fn finish<'a>(&'a mut self) -> EncoderFuture<'a, Vec<EncodedSample>>

Provided Methods§

Source

fn implementation(&self) -> CodecImplementation

Whether this encoder runs on dedicated hardware or in software.

A factory’s VideoEncoderFactory::capability answers the same question before an encoder exists; this is the answer for the encoder actually created, which can differ when a backend that probed as available fails to start and a Prefer factory falls back. The default is Software, which is what every encoder that does not override it is.

Source

fn backend_name(&self) -> &str

A human-readable name for the backend doing the encoding, such as a Media Foundation encoder’s friendly name. For logs and diagnostics only; it is not stable across platforms, drivers or releases.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§