Skip to main content

DecodedYUV

Struct DecodedYUV 

Source
pub struct DecodedYUV<'a> { /* private fields */ }
Expand description

Frame returned by the Decoder and provides safe data access.

Implementations§

Source§

impl DecodedYUV<'_>

Source

pub const fn dimensions_uv(&self) -> (usize, usize)

Returns the unpadded U size.

This is often smaller (by half) than the image size.

Source

pub const fn timestamp(&self) -> Timestamp

Timestamp of this frame in milliseconds(?) with respect to the video stream.

Source

pub fn split<const N: usize>(&self) -> [YUVSlices<'_>; N]

Cut the YUV buffer into vertical sections.

The slices do not overlap. If N does not divide the buffer, then the last YUVSlice has fewer pixel rows.

Source

pub fn write_rgb8(&self, target: &mut [u8])

Writes the image into a byte buffer of size w*h*3.

§Panics

Panics if the target image dimension don’t match the configured format.

Source

pub fn write_rgba8(&self, target: &mut [u8])

Writes the image into a byte buffer of size w*h*4.

§Panics

Panics if the target image dimension don’t match the configured format.

Trait Implementations§

Source§

impl<'a> Debug for DecodedYUV<'a>

Source§

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

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

impl YUVSource for DecodedYUV<'_>

Source§

fn dimensions_i32(&self) -> (i32, i32)

Size of the image as (w, h).
Source§

fn dimensions(&self) -> (usize, usize)

Size of the image as (w, h).
Source§

fn strides(&self) -> (usize, usize, usize)

YUV strides as (y, u, v). Read more
Source§

fn strides_i32(&self) -> (i32, i32, i32)

YUV strides as (y, u, v). Read more
Source§

fn y(&self) -> &[u8]

Y buffer, should be of size dimension.1 * strides.0.
Source§

fn u(&self) -> &[u8]

U buffer, should be of size dimension.1 * strides.1.
Source§

fn v(&self) -> &[u8]

V buffer, should be of size dimension.1 * strides.2.
Source§

fn rgb8_len(&self) -> usize

Estimates how many bytes you’ll need to store this YUV in an &[u8] RGB array. Read more
Source§

fn rgba8_len(&self) -> usize

Estimates how many bytes you’ll need to store this YUV in an &[u8] RGBA array. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for DecodedYUV<'a>

§

impl<'a> RefUnwindSafe for DecodedYUV<'a>

§

impl<'a> Send for DecodedYUV<'a>

§

impl<'a> Sync for DecodedYUV<'a>

§

impl<'a> Unpin for DecodedYUV<'a>

§

impl<'a> UnsafeUnpin for DecodedYUV<'a>

§

impl<'a> UnwindSafe for DecodedYUV<'a>

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.