Skip to main content

Frame

Struct Frame 

Source
pub struct Frame { /* private fields */ }
Expand description

Immutable ref-counted frame handle.

Implementations§

Source§

impl Frame

Source

pub const fn format(&self) -> &FormatDescriptor

Returns frame format descriptor.

Source

pub const fn width(&self) -> usize

Returns frame width.

Source

pub const fn height(&self) -> usize

Returns frame height.

Source

pub const fn metadata(&self) -> &Metadata

Returns frame metadata.

Source

pub const fn actual_alignment(&self) -> usize

Returns actual alignment used for this frame allocation.

Source

pub fn plane<T: Sample>(&self, index: usize) -> Result<Plane<T>>

Returns typed immutable plane view.

Source

pub fn with_metadata(&self, metadata: Metadata) -> Self

Creates frame clone that shares all plane buffers and replaces metadata.

Source

pub fn shares_plane_storage(&self, other: &Self, plane_index: usize) -> bool

Returns true when both frames share same backing storage for a plane index.

Source

pub fn shares_plane_storage_at( &self, plane_index: usize, other: &Self, other_plane_index: usize, ) -> bool

Returns true when selected planes share the same backing storage.

Source

pub fn view( &self, left: usize, top: usize, width: usize, height: usize, ) -> Result<Self>

Creates zero-copy crop-like view over parent plane storage.

Source

pub fn single_plane_view( &self, plane_index: usize, format: FormatDescriptor, ) -> Result<Self>

Creates a zero-copy frame containing one source plane as plane 0 of format.

Source

pub fn from_plane_sources( format: FormatDescriptor, width: usize, height: usize, sources: &[(&Self, usize)], metadata: Metadata, ) -> Result<Self>

Creates a zero-copy frame from existing plane storage.

Source

pub unsafe fn raw_plane(&self, index: usize) -> Result<RawPlane>

Returns raw pointer and stride view for expert Rust and ABI adapters.

§Safety

Caller must honor plane bounds from height and stride_bytes, and must interpret sample values using returned sample_type. Pointer remains valid only while frame storage remains alive through this frame or another shared owner.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.