pub trait Decoder {
// Required methods
fn streams(&self) -> &[StreamInfo];
fn flush(&mut self) -> Result<(), DecodeError>;
fn seek(
&mut self,
request: DecodeRequest,
cancel: &CancelToken,
) -> Result<DecodeResult, DecodeError>;
fn decode_next(
&mut self,
cancel: &CancelToken,
) -> Result<DecodeEvent, DecodeError>;
}Expand description
Stateful media decoder implemented by a platform binding.
Required Methods§
Sourcefn streams(&self) -> &[StreamInfo]
fn streams(&self) -> &[StreamInfo]
Returns deterministic stream metadata and stream selection.
Sourcefn flush(&mut self) -> Result<(), DecodeError>
fn flush(&mut self) -> Result<(), DecodeError>
Flushes queued packets and frames without changing stream selection.
§Errors
Returns a platform-neutral adapter failure when flushing fails.
Sourcefn seek(
&mut self,
request: DecodeRequest,
cancel: &CancelToken,
) -> Result<DecodeResult, DecodeError>
fn seek( &mut self, request: DecodeRequest, cancel: &CancelToken, ) -> Result<DecodeResult, DecodeError>
Seeks and returns what is presented at the request’s time.
For video this is the last frame at or before the time plus the stream’s
alpha2_time::presentation_slack, which absorbs timestamp rounding. Finding it
decodes the following frame, which the next Self::decode_next returns. Times before
the first frame return the first, times after the last return the last, and a stream
without frames is DecodeError::OutOfRange. For audio it is the block holding the
time’s sample.
§Errors
Returns cancellation, range, unsupported-media, or adapter failures.
Sourcefn decode_next(
&mut self,
cancel: &CancelToken,
) -> Result<DecodeEvent, DecodeError>
fn decode_next( &mut self, cancel: &CancelToken, ) -> Result<DecodeEvent, DecodeError>
Advances packet draining by one observable event.
§Errors
Returns cancellation, unsupported-media, or adapter failures.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".