Skip to main content

Decoder

Trait Decoder 

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

Source

fn streams(&self) -> &[StreamInfo]

Returns deterministic stream metadata and stream selection.

Source

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.

Source

fn seek( &mut self, request: DecodeRequest, cancel: &CancelToken, ) -> Result<DecodeResult, DecodeError>

Seeks and returns what is presented at the request’s time.

For video that is the frame whose presentation interval contains the time: the last frame whose timestamp is at or before the time’s presentation deadline, the time plus the stream’s presentation slack (alpha2_time::presentation_slack), which absorbs the rounding a stored timestamp went through. A seek starts from the keyframe at or before that deadline. Deciding so takes the frame after, which the next Self::decode_next returns. A stream whose first frame is later answers with that frame, and past the last frame the last one answers, however far past: a stream shows its last picture after its end as it shows its first before its start. A stream with no frame at all is DecodeError::OutOfRange. For audio it is the block holding the time’s sample.

§Errors

Returns cancellation, range, unsupported-media, or adapter failures.

Source

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

Implementors§