Skip to main content

VideoFrame

Struct VideoFrame 

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

One exported video frame: tightly packed 8-bit pixels plus metadata.

The byte buffer is owned and has no row padding — as_bytes().len() equals width * height * layout.bytes_per_pixel() and the row stride equals width * layout.bytes_per_pixel(). This is the shape ML/CV consumers expect (feed it straight into an ndarray view, a tensor, or an image encoder).

Implementations§

Source§

impl VideoFrame

Source

pub fn width(&self) -> u32

Frame width in pixels.

Source

pub fn height(&self) -> u32

Frame height in pixels.

Source

pub fn layout(&self) -> PixelLayout

The packed pixel layout of as_bytes.

Source

pub fn pts_us(&self) -> Option<i64>

Post-filter presentation time in microseconds, normalized to the start of the extraction window (the stream start when no start_time_us was set). Vsync passthrough preserves the source timing one-to-one; None when the frame carried no usable timestamp.

Source

pub fn index(&self) -> u64

0-based export index (counts delivered frames in order).

Source

pub fn as_bytes(&self) -> &[u8]

The packed pixel bytes. Length is width * height * bytes_per_pixel; rows are tight (row_bytes() each) and top-down.

Source

pub fn into_vec(self) -> Vec<u8>

Consumes the frame and returns the owned packed buffer (no copy).

Source

pub fn row_bytes(&self) -> usize

Bytes per row: width * layout.bytes_per_pixel().

Trait Implementations§

Source§

impl Debug for VideoFrame

Source§

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

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

impl Drop for VideoFrame

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,