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§
Sourcetype Surface: DecodedSurface
type Surface: DecodedSurface
Native decoded surface type produced by this backend.
Required Methods§
Sourcefn capabilities(&self) -> DecoderCapabilities
fn capabilities(&self) -> DecoderCapabilities
Query decoder support on the current machine.
Sourcefn configure(&mut self, config: CodecConfig) -> Result<(), VideoError>
fn configure(&mut self, config: CodecConfig) -> Result<(), VideoError>
Explicitly configure or reconfigure the platform decoder.
Sourcefn submit(
&mut self,
frame: EncodedAccessUnit,
) -> Result<SubmitOutcome, VideoError>
fn submit( &mut self, frame: EncodedAccessUnit, ) -> Result<SubmitOutcome, VideoError>
Submit one complete encoded Annex-B access unit.
Sourcefn latest_frame(&mut self) -> Option<DecodedFrame<Self::Surface>>
fn latest_frame(&mut self) -> Option<DecodedFrame<Self::Surface>>
Take the newest decoded frame, if one is ready.
Sourcefn flush(&mut self) -> Result<(), VideoError>
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.
Sourcefn stats(&self) -> DecoderStats
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".