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.