Skip to main content

NativeExportDecoder

Struct NativeExportDecoder 

Source
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

Source

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.

Source

pub const fn is_hardware(&self) -> bool

Whether this session currently produces device-resident frames.

Source

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.

Source

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.

Source

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.

Source

pub fn streams(&self) -> &[StreamInfo]

Stream descriptions from the common decode session.

Source

pub fn video_duration(&self) -> Option<MediaTime>

Effective end of the selected video source.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn set_decode_policy(&mut self, policy: DecodePolicy)

Configures corruption handling on the selected native backend.

Source

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.

Source

pub fn set_decode_reporter( &mut self, reporter: impl Fn(DecodeDiagnostic) + Send + Sync + 'static, )

Reports damage before any recovery or terminal error.

Source

pub fn decode_diagnostics(&mut self) -> &DecodeDiagnostics

Cumulative corruption diagnostics for this session.

Source

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).

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,