pub struct NativeExportDecoder { /* private fields */ }Expand description
Export decoder producing NativeVideoFrames from one FFmpeg session.
Software and hardware sessions share demux, seek and timing (NativeDecoder); the backend
only changes where pixels live.
Implementations§
Source§impl NativeExportDecoder
impl NativeExportDecoder
Sourcepub fn take_stage_timings(&mut self) -> DecodeStageTimings
pub fn take_stage_timings(&mut self) -> DecodeStageTimings
Takes the decode-stage spans accumulated since the last call. Hardware sessions report no
conversion time; their cost is in receive_frame.
Sourcepub const fn is_hardware(&self) -> bool
pub const fn is_hardware(&self) -> bool
Whether this session currently produces device-resident frames.
Sourcepub fn open(source: impl Into<SourceLocation>) -> Result<Self, DecodeError>
pub fn open(source: impl Into<SourceLocation>) -> Result<Self, DecodeError>
Opens the selected video stream using the software implementation.
§Errors
Returns a native decode error if the input or selected stream cannot be opened.
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 with an explicit codec worker allocation.
§Errors
Returns a native decode error for invalid worker counts or stream setup failures.
Sourcepub fn open_vulkan(
source: impl Into<SourceLocation>,
threads: i64,
context: &SharedVulkanContext,
generation: u64,
) -> Result<Self, HardwareOpenError>
pub fn open_vulkan( source: impl Into<SourceLocation>, threads: i64, context: &SharedVulkanContext, generation: u64, ) -> Result<Self, HardwareOpenError>
Opens a Vulkan hardware decoder on the renderer’s logical device.
§Errors
Returns a native decode error if the stream lacks a compatible Vulkan configuration or the decoder cannot use the shared device.
Sourcepub fn streams(&self) -> &[StreamInfo]
pub fn streams(&self) -> &[StreamInfo]
Stream descriptions from the common decode session.
Sourcepub fn dropped_layer(&self) -> Option<&DroppedLayer>
pub fn dropped_layer(&self) -> Option<&DroppedLayer>
What the decoder leaves out (crate::NativeDecoder::dropped_layer).
Sourcepub const fn decodes_alpha_stream(&self) -> bool
pub const fn decodes_alpha_stream(&self) -> bool
Whether the session decodes an alpha stream on the CPU beside its pictures (VP9 alpha).
Sourcepub fn video_duration(&self) -> Option<MediaTime>
pub fn video_duration(&self) -> Option<MediaTime>
Effective end of the selected video source.
Sourcepub fn flush(&mut self) -> Result<(), DecodeError>
pub fn flush(&mut self) -> Result<(), DecodeError>
Resets codec and demux state.
§Errors
Returns a native decode error if the codec state cannot be reset.
Sourcepub fn seek_video(
&mut self,
request: DecodeRequest,
cancel: &CancelToken,
) -> Result<NativeVideoFrame, DecodeError>
pub fn seek_video( &mut self, request: DecodeRequest, cancel: &CancelToken, ) -> Result<NativeVideoFrame, DecodeError>
Seeks and returns the selected native frame.
§Errors
Returns a native decode error for cancellation, seek, decode, or timestamp failures.
Sourcepub fn decode_video_next(
&mut self,
cancel: &CancelToken,
) -> Result<Option<NativeVideoFrame>, DecodeError>
pub fn decode_video_next( &mut self, cancel: &CancelToken, ) -> Result<Option<NativeVideoFrame>, DecodeError>
Decodes the next native frame, or None at end of stream.
§Errors
Returns a native decode error for cancellation or codec failures.
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 Self::decode_video_next returns next is presented, or None at the end.
The frame is decoded now and kept, so a caller can find the frame shown at a time without consuming the next one.
§Errors
Returns a native decode error for cancellation or codec failures.
Sourcepub fn set_decode_policy(&mut self, policy: DecodePolicy)
pub fn set_decode_policy(&mut self, policy: DecodePolicy)
Configures corruption handling on the selected native backend.
Sourcepub fn with_declared_color(
self,
color: Option<ColorMetadata>,
) -> Result<Self, HardwareOpenError>
pub fn with_declared_color( self, color: Option<ColorMetadata>, ) -> Result<Self, HardwareOpenError>
Sets the project’s declared color for this source (NativeDecoder::declare_color).
§Errors
Returns HardwareDecodeFallback::UnsupportedColor for HDR on a hardware
session, which presents SDR only.
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, )
Reports damage before any recovery or terminal error.
Sourcepub fn decode_diagnostics(&mut self) -> &DecodeDiagnostics
pub fn decode_diagnostics(&mut self) -> &DecodeDiagnostics
Cumulative corruption diagnostics for this session.
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
(NativeDecoder::presentation_deadline).
Sourcepub const fn hardware_failure(&self) -> Option<HardwareDecodeFallback>
pub const fn hardware_failure(&self) -> Option<HardwareDecodeFallback>
Why this session’s hardware path gave up, once a call returned DecodeError::Unsupported.
Auto Trait Implementations§
impl !RefUnwindSafe for NativeExportDecoder
impl !Sync for NativeExportDecoder
impl !UnwindSafe for NativeExportDecoder
impl Forget for NativeExportDecoder
impl Freeze for NativeExportDecoderwhere
*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 NativeExportDecoder
impl Send for NativeExportDecoderwhere
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 NativeExportDecoderwhere
*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 NativeExportDecoderwhere
*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