Skip to main content

FrameInner

Struct FrameInner 

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

The owned body of a refcounted Frame.

Holds an Arena (the bytes), a fixed-size table of (offset_in_arena, length_in_bytes) pairs (one per plane), and a FrameHeader. The plane_count field tracks how many entries of plane_offsets are actually populated. Up to MAX_PLANES planes are supported.

Lifetime: an Arena returns its buffer to the pool when dropped. A Rc<FrameInner> keeps the arena alive via its single owned field, so as long as any clone of a Frame exists the underlying buffer stays out of the pool.

Implementations§

Source§

impl FrameInner

Source

pub fn new( arena: Arena, planes: &[(usize, usize)], header: FrameHeader, ) -> Result<Frame>

Construct a Frame (refcounted Rc<FrameInner>) from an arena, a slice of (offset, length) plane descriptors, and a header. Returns Error::InvalidData if more than MAX_PLANES planes are supplied or if any plane range falls outside the arena’s used region.

Source

pub fn plane_count(&self) -> usize

Number of planes this frame holds.

Source

pub fn plane(&self, i: usize) -> Option<&[u8]>

Read-only access to plane i. Returns None if i is out of range.

Source

pub fn header(&self) -> &FrameHeader

Frame header (width / height / pixel format / pts).

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