pub enum NativeVideoFrame {
Cpu(DecodedVideoFrame),
Hardware {
metadata: NativeVideoFrameMetadata,
surface: Arc<dyn HardwareFrameLease>,
},
}Expand description
One decoded export frame with either owned CPU pixels or an opaque surface.
Variants§
Cpu(DecodedVideoFrame)
Software-decoded frame.
Hardware
Hardware-decoded frame whose platform details remain behind its lease.
Fields
metadata: NativeVideoFrameMetadataPresentation and cache identity.
surface: Arc<dyn HardwareFrameLease>Ref-counted decoder-surface ownership.
Implementations§
Source§impl NativeVideoFrame
impl NativeVideoFrame
Sourcepub fn metadata(&self) -> NativeVideoFrameMetadata
pub fn metadata(&self) -> NativeVideoFrameMetadata
Returns metadata without exposing the backing representation.
Sourcepub const fn is_hardware(&self) -> bool
pub const fn is_hardware(&self) -> bool
Whether this frame is backed by a decoder surface rather than CPU pixels.
Sourcepub fn as_cpu(&self) -> Option<&DecodedVideoFrame>
pub fn as_cpu(&self) -> Option<&DecodedVideoFrame>
Returns the software frame when this is the CPU variant.
Sourcepub fn to_cpu(&self) -> Result<DecodedVideoFrame, DecodeError>
pub fn to_cpu(&self) -> Result<DecodedVideoFrame, DecodeError>
A CPU copy of this frame: the frame itself when it already is one, or
the decoder surface’s pixels downloaded through FFmpeg.
This is the fallback for a surface the renderer could not import, so the frame still reaches the export instead of failing it. Timing and presentation come from this frame’s metadata; the pixels go through the same conversion a software decoder’s frames do.
§Errors
Returns a native decode error when the surface cannot be downloaded or converted.
Sourcepub fn retained_bytes(&self) -> u64
pub fn retained_bytes(&self) -> u64
Approximate retained bytes for separate CPU and surface budgets.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for NativeVideoFrame
impl !UnwindSafe for NativeVideoFrame
impl Freeze for NativeVideoFrame
impl Send for NativeVideoFrame
impl Sync for NativeVideoFrame
impl Unpin for NativeVideoFrame
impl UnsafeUnpin for NativeVideoFrame
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