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>)
Sets the project’s declared color for this source, which replaces the frame and stream 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 const fn dropped_layer(&self) -> Option<&DroppedLayer>
pub const fn dropped_layer(&self) -> Option<&DroppedLayer>
What this decoder leaves out (unreadable alpha, extra HEVC layers), or None.
Sourcepub fn video_duration(&self) -> Option<MediaTime>
pub fn video_duration(&self) -> Option<MediaTime>
Effective end of the selected video source.
Includes the container duration, which browser APIs expose, since the stream can end a few ticks earlier from time-base rounding.
Sourcepub fn presentation_deadline(&self, time: MediaTime) -> MediaTime
pub fn presentation_deadline(&self, time: MediaTime) -> MediaTime
The latest timestamp a frame may carry and still be shown at time: time plus
the stream’s alpha2_time::presentation_slack.
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.
The frame is decoded now and kept for that call, so a caller can find the frame shown at a time without consuming the next one.
§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