Struct rustsynth::frame::Frame

source ·
pub struct Frame<'core> { /* private fields */ }
Expand description

One frame of a clip.

Implementations§

source§

impl<'core> Frame<'core>

source

pub fn video_format(&self) -> Option<VideoFormat>

source

pub fn width(&self, plane: i32) -> i32

Returns the width of a plane, in pixels.

The width depends on the plane number because of the possible chroma subsampling.

Panics

Panics if plane >= format().plane_count().

source

pub fn height(&self, plane: i32) -> i32

Returns the height of a plane, in pixels.

The height depends on the plane number because of the possible chroma subsampling.

Panics

Panics if plane >= format().plane_count().

source

pub fn stride(&self, plane: i32) -> isize

Returns the distance in bytes between two consecutive lines of a plane.

Panics

Panics if plane >= format().plane_count().

source

pub fn length(&self) -> i32

source

pub fn plane_row<T: Component>(&self, plane: i32, row: i32) -> &[T]

Returns a slice of a plane’s pixel row.

Panics

Panics if the requested plane, row or component type is invalid.

source

pub fn plane_row_mut<T: Component>(&mut self, plane: i32, row: i32) -> &mut [T]

Returns a mutable slice of a plane’s pixel row.

Panics

Panics if the requested plane, row or component type is invalid.

source

pub fn plane<T: Component>(&self, plane: i32) -> Result<&[T], NonZeroPadding>

Returns a slice of the plane’s pixels.

The length of the returned slice is height() * width(). If the pixel data has non-zero padding (that is, stride() is larger than width()), an error is returned, since returning the data slice would open access to uninitialized bytes.

Panics

Panics if the requested plane or component type is invalid.

source

pub fn plane_mut<T: Component>( &mut self, plane: i32 ) -> Result<&mut [T], NonZeroPadding>

Returns a mutable slice of the plane’s pixels.

The length of the returned slice is height() * width(). If the pixel data has non-zero padding (that is, stride() is larger than width()), an error is returned, since returning the data slice would open access to uninitialized bytes.

Panics

Panics if the requested plane or component type is invalid.

source

pub fn data_ptr(&self, plane: i32) -> *const u8

Returns a pointer to the plane’s pixels.

The pointer points to an array with a length of height() * stride() and is valid for as long as the frame is alive.

Panics

Panics if plane >= format().plane_count().

source

pub fn data_ptr_mut(&mut self, plane: i32) -> *mut u8

Returns a mutable pointer to the plane’s pixels.

The pointer points to an array with a length of height() * stride() and is valid for as long as the frame is alive.

Panics

Panics if plane >= format().plane_count().

source

pub fn data_row(&self, plane: i32, row: i32) -> &[u8]

Returns a slice of a plane’s pixel row.

The length of the returned slice is equal to width() * format().bytes_per_sample().

Panics

Panics if plane >= format().plane_count() or if row >= height().

source

pub fn data_row_mut(&mut self, plane: i32, row: i32) -> &mut [u8]

Returns a mutable slice of a plane’s pixel row.

The length of the returned slice is equal to width() * format().bytes_per_sample().

Panics

Panics if plane >= format().plane_count() or if row >= height().

source

pub fn data(&self, plane: i32) -> Result<&[u8], NonZeroPadding>

Returns a slice of the plane’s pixels.

The length of the returned slice is height() * width() * format().bytes_per_sample(). If the pixel data has non-zero padding (that is, stride() is larger than width()), an error is returned, since returning the data slice would open access to uninitialized bytes.

Panics

Panics if plane >= format().plane_count() or if row >= height().

source

pub fn data_mut(&mut self, plane: i32) -> Result<&mut [u8], NonZeroPadding>

Returns a mutable slice of the plane’s pixels.

The length of the returned slice is height() * width() * format().bytes_per_sample(). If the pixel data has non-zero padding (that is, stride() is larger than width()), an error is returned, since returning the data slice would open access to uninitialized bytes.

Panics

Panics if plane >= format().plane_count() or if row >= height().

source

pub fn props(&self) -> MapRef<'_, '_>

Returns a map of frame’s properties.

source

pub fn props_mut(&mut self) -> MapRefMut<'_, '_>

Returns a mutable map of frame’s properties.

Trait Implementations§

source§

impl<'core> Debug for Frame<'core>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'core> Drop for Frame<'core>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'core> Send for Frame<'core>

source§

impl<'core> Sync for Frame<'core>

Auto Trait Implementations§

§

impl<'core> RefUnwindSafe for Frame<'core>

§

impl<'core> Unpin for Frame<'core>

§

impl<'core> UnwindSafe for Frame<'core>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.