pub struct NativeExportDecoder { /* private fields */ }Expand description
Export decoder producing NativeVideoFrames from one FFmpeg session.
Software and hardware sessions share the same demux, seek, and timing
logic (NativeDecoder); a hardware backend changes only where the
frame’s 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.
A hardware session reports no conversion time because it produces a
surface rather than pixels; its 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(path: impl AsRef<Path>) -> Result<Self, DecodeError>
pub fn open(path: impl AsRef<Path>) -> 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(
path: impl AsRef<Path>,
threads: i64,
) -> Result<Self, DecodeError>
pub fn open_with_threads( path: impl AsRef<Path>, 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(
path: impl AsRef<Path>,
threads: i64,
context: &SharedVulkanContext,
generation: u64,
) -> Result<Self, HardwareOpenError>
pub fn open_vulkan( path: impl AsRef<Path>, 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 hardware 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 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 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 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>
Takes the color a project declares for this source, which every frame
then carries (NativeDecoder::declare_color).
§Errors
Returns HardwareDecodeFallback::UnsupportedColor for a hardware
session declared HDR: the hardware path presents SDR only, as it
refuses a stream tagged HDR when it opens.
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 of this stream may carry and still be
the one 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 has returned
DecodeError::Unsupported for it.
Auto Trait Implementations§
impl !RefUnwindSafe for NativeExportDecoder
impl !Sync for NativeExportDecoder
impl !UnwindSafe for NativeExportDecoder
impl Freeze for NativeExportDecoder
impl Send for NativeExportDecoder
impl Unpin for NativeExportDecoder
impl UnsafeUnpin for NativeExportDecoder
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