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.