Skip to main content

NativeDecoder

Struct NativeDecoder 

Source
pub struct NativeDecoder { /* private fields */ }
Expand description

Software video decoder with exact timestamp conversion and drain semantics.

Implementations§

Source§

impl NativeDecoder

Source

pub fn set_decode_policy(&mut self, policy: DecodePolicy)

Selects strict failure (default) or bounded, reported recovery.

Source

pub fn declare_color(&mut self, color: Option<ColorMetadata>)

Takes the color a project declares for this source (its color_metadata), which every decoded frame then carries in place of what the frame and the stream are tagged with: a declaration corrects missing or wrong tags. None leaves the tags in charge.

Source

pub fn set_decode_reporter( &mut self, reporter: impl Fn(DecodeDiagnostic) + Send + Sync + 'static, )

Receives each diagnostic before recovery continues, including before errors.

Source

pub fn decode_diagnostics(&self) -> &DecodeDiagnostics

Cumulative corruption and concealment diagnostics, including seeks.

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, DecodeError>

Opens the deterministically selected video stream.

§Errors

Returns an error when no decodable video stream exists.

Source

pub fn open_with_threads( path: impl AsRef<Path>, threads: i64, ) -> Result<Self, DecodeError>

Opens the selected stream with an explicit FFmpeg worker allocation.

§Errors

Returns an error when no decodable video stream exists.

Source

pub fn video_duration(&self) -> Option<MediaTime>

Effective end of the selected video source.

The container duration is included because browser media APIs expose that duration when authoring a clip, while FFmpeg’s selected stream can end a few ticks earlier because of time-base rounding.

Source

pub fn presentation_deadline(&self, time: MediaTime) -> MediaTime

The latest timestamp a frame of this stream may carry and still be the one shown at time: time plus the stream’s alpha2_time::presentation_slack, from its time base and the rounding its first timestamps show. The frame shown is the last one at or before it.

Source

pub fn peek_video_pts( &mut self, cancel: &CancelToken, ) -> Result<Option<MediaTime>, DecodeError>

When the frame the next Decoder::decode_next returns is presented, or None at the end of the stream.

The frame is decoded now and kept for that call, so a caller can find the frame presented at a time (the last one at or before its Self::presentation_deadline) without consuming the one after.

§Errors

Returns cancellation and decode failures.

Trait Implementations§

Source§

impl Decoder for NativeDecoder

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. Read more
Source§

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

Seeks and returns what is presented at the request’s time. Read more
Source§

fn decode_next( &mut self, cancel: &CancelToken, ) -> Result<DecodeEvent, DecodeError>

Advances packet draining by one observable event. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,