pub struct NativeDecoder { /* private fields */ }Expand description
Software video decoder with exact timestamp conversion and drain semantics.
Implementations§
Source§impl NativeDecoder
impl NativeDecoder
Sourcepub fn set_decode_policy(&mut self, policy: DecodePolicy)
pub fn set_decode_policy(&mut self, policy: DecodePolicy)
Selects strict failure (default) or bounded, reported recovery.
Sourcepub fn declare_color(&mut self, color: Option<ColorMetadata>)
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.
Sourcepub fn set_decode_reporter(
&mut self,
reporter: impl Fn(DecodeDiagnostic) + Send + Sync + 'static,
)
pub fn set_decode_reporter( &mut self, reporter: impl Fn(DecodeDiagnostic) + Send + Sync + 'static, )
Receives each diagnostic before recovery continues, including before errors.
Sourcepub fn decode_diagnostics(&self) -> &DecodeDiagnostics
pub fn decode_diagnostics(&self) -> &DecodeDiagnostics
Cumulative corruption and concealment diagnostics, including seeks.
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, DecodeError>
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.
Sourcepub fn open_with_threads(
path: impl AsRef<Path>,
threads: i64,
) -> Result<Self, DecodeError>
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.
Sourcepub fn video_duration(&self) -> Option<MediaTime>
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.
Sourcepub fn presentation_deadline(&self, time: MediaTime) -> MediaTime
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.
Sourcepub fn peek_video_pts(
&mut self,
cancel: &CancelToken,
) -> Result<Option<MediaTime>, DecodeError>
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
impl Decoder for NativeDecoder
Source§fn streams(&self) -> &[StreamInfo]
fn streams(&self) -> &[StreamInfo]
Source§fn flush(&mut self) -> Result<(), DecodeError>
fn flush(&mut self) -> Result<(), DecodeError>
Source§fn seek(
&mut self,
request: DecodeRequest,
cancel: &CancelToken,
) -> Result<DecodeResult, DecodeError>
fn seek( &mut self, request: DecodeRequest, cancel: &CancelToken, ) -> Result<DecodeResult, DecodeError>
Source§fn decode_next(
&mut self,
cancel: &CancelToken,
) -> Result<DecodeEvent, DecodeError>
fn decode_next( &mut self, cancel: &CancelToken, ) -> Result<DecodeEvent, DecodeError>
Auto Trait Implementations§
impl !RefUnwindSafe for NativeDecoder
impl !Sync for NativeDecoder
impl !UnwindSafe for NativeDecoder
impl Freeze for NativeDecoder
impl Send for NativeDecoder
impl Unpin for NativeDecoder
impl UnsafeUnpin for NativeDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more