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(source: impl Into<SourceLocation>) -> Result<Self, DecodeError>
pub fn open(source: impl Into<SourceLocation>) -> Result<Self, DecodeError>
Opens the deterministically selected video stream.
§Errors
Returns an error when no decodable video stream exists.
Sourcepub fn open_with_threads(
source: impl Into<SourceLocation>,
threads: i64,
) -> Result<Self, DecodeError>
pub fn open_with_threads( source: impl Into<SourceLocation>, 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 decodes_alpha_stream(&self) -> bool
pub const fn decodes_alpha_stream(&self) -> bool
Whether this decoder decodes an alpha stream beside its pictures (VP9 alpha).
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 Forget for NativeDecoder
impl Freeze for NativeDecoderwhere
*const AVFormatContext is !null: Freeze,
*const AVIOContext is !null: Freeze,
*const Opaque is !null: Freeze,
PhantomData<Opaque>: Freeze,
*const ArcInner<Mutex<Option<Error>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Option<Error>>>>: Freeze,
*const ArcInner<InputInterrupt> is !null: Freeze,
PhantomData<ArcInner<InputInterrupt>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<StreamInfo>: Freeze,
*const AVCodecContext is !null: Freeze,
*const SwsContext is !null: Freeze,
*const AVFrame is !null: Freeze,
PhantomData<RawFrame>: Freeze,
*const dyn Fn(DecodeDiagnostic) + Send + Sync is !null: Freeze,
PhantomData<dyn Fn(DecodeDiagnostic) + Send + Sync>: Freeze,
PhantomData<CorruptPacket>: Freeze,
PhantomData<ConcealedAudioGap>: Freeze,
PhantomData<DroppedAudioOverlap>: Freeze,
PhantomData<VideoRecoveryGap>: Freeze,
PhantomData<Result<Option<AVPacket>, RsmpegError>>: Freeze,
&'static str: Freeze,
PhantomData<u8>: Freeze,
PhantomData<DecodedFrame>: Freeze,
*const LeafNode<i64, SetValZST> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(i64, SetValZST)>>: Freeze,
impl Move for NativeDecoder
impl Send for NativeDecoderwhere
AVFormatContextInput: Send,
AVIOContext: Send,
BoxRaw<Opaque>: Send,
Arc<Mutex<Option<Error>>>: Send,
Arc<InputInterrupt>: Send,
RawVecInner: Send,
AVCodecContext: Send,
SwsContext: Send,
AVFrame: Send,
BoxRaw<dyn Fn(DecodeDiagnostic) + Send + Sync>: Send,
&'static str: Send,
AVPacket: Send,
NodeRef<Owned, i64, SetValZST, LeafOrInternal>: Send,
BoxRaw<(i64, SetValZST)>: Send,
impl Unpin for NativeDecoderwhere
*const AVFormatContext is !null: Unpin,
*const AVIOContext is !null: Unpin,
Box<Opaque>: Unpin,
Arc<Mutex<Option<Error>>>: Unpin,
Arc<InputInterrupt>: Unpin,
*const u8 is !null: Unpin,
*const AVCodecContext is !null: Unpin,
*const SwsContext is !null: Unpin,
*const AVFrame is !null: Unpin,
Box<dyn Fn(DecodeDiagnostic) + Send + Sync>: Unpin,
&'static str: Unpin,
*const AVPacket is !null: Unpin,
*const LeafNode<i64, SetValZST> is !null: Unpin,
Box<(i64, SetValZST)>: Unpin,
impl UnsafeUnpin for NativeDecoderwhere
*const AVFormatContext is !null: UnsafeUnpin,
*const AVIOContext is !null: UnsafeUnpin,
*const Opaque is !null: UnsafeUnpin,
PhantomData<Opaque>: UnsafeUnpin,
*const ArcInner<Mutex<Option<Error>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Option<Error>>>>: UnsafeUnpin,
*const ArcInner<InputInterrupt> is !null: UnsafeUnpin,
PhantomData<ArcInner<InputInterrupt>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<StreamInfo>: UnsafeUnpin,
*const AVCodecContext is !null: UnsafeUnpin,
*const SwsContext is !null: UnsafeUnpin,
*const AVFrame is !null: UnsafeUnpin,
PhantomData<RawFrame>: UnsafeUnpin,
*const dyn Fn(DecodeDiagnostic) + Send + Sync is !null: UnsafeUnpin,
PhantomData<dyn Fn(DecodeDiagnostic) + Send + Sync>: UnsafeUnpin,
PhantomData<CorruptPacket>: UnsafeUnpin,
PhantomData<ConcealedAudioGap>: UnsafeUnpin,
PhantomData<DroppedAudioOverlap>: UnsafeUnpin,
PhantomData<VideoRecoveryGap>: UnsafeUnpin,
PhantomData<Result<Option<AVPacket>, RsmpegError>>: UnsafeUnpin,
&'static str: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<DecodedFrame>: UnsafeUnpin,
*const LeafNode<i64, SetValZST> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(i64, SetValZST)>>: UnsafeUnpin,
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