Skip to main content

VideoDecoder

Trait VideoDecoder 

Source
pub trait VideoDecoder {
    type Surface: DecodedSurface;

    // Required methods
    fn capabilities(&self) -> DecoderCapabilities;
    fn configure(&mut self, config: CodecConfig) -> Result<(), VideoError>;
    fn submit(
        &mut self,
        frame: EncodedAccessUnit,
    ) -> Result<SubmitOutcome, VideoError>;
    fn latest_frame(&mut self) -> Option<DecodedFrame<Self::Surface>>;
    fn flush(&mut self) -> Result<(), VideoError>;
    fn stats(&self) -> DecoderStats;
}
Expand description

Common behavior implemented by platform video decoders.

Required Associated Types§

Source

type Surface: DecodedSurface

Native decoded surface type produced by this backend.

Required Methods§

Source

fn capabilities(&self) -> DecoderCapabilities

Query decoder support on the current machine.

Source

fn configure(&mut self, config: CodecConfig) -> Result<(), VideoError>

Explicitly configure or reconfigure the platform decoder.

Source

fn submit( &mut self, frame: EncodedAccessUnit, ) -> Result<SubmitOutcome, VideoError>

Submit one complete encoded Annex-B access unit.

Source

fn latest_frame(&mut self) -> Option<DecodedFrame<Self::Surface>>

Take the newest decoded frame, if one is ready.

Source

fn flush(&mut self) -> Result<(), VideoError>

Clear decoder state and queued work.

Native backends finish work when their platform API supports a synchronous drain. WebCodecs closes immediately; use WebDecoder::flush_async when browser output must be drained first.

Source

fn stats(&self) -> DecoderStats

Read cumulative decoder statistics.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§