Skip to main content

Frame

Struct Frame 

Source
pub struct Frame<'a> {
    pub width: u32,
    pub height: u32,
    pub pixel_format: PixelFormat,
    pub timestamp_ns: u64,
    pub frame_id: u64,
    /* private fields */
}
Expand description

Borrowed view of a single received frame.

The lifetime 'a is tied to the adapter-owned buffer that fed this invocation; callers must not escape Frame past the end of their callback.

Fields§

§width: u32

Frame width in pixels.

§height: u32

Frame height in pixels.

§pixel_format: PixelFormat

Decoded pixel format.

§timestamp_ns: u64

Wall-clock timestamp captured by the adapter at frame arrival, expressed in nanoseconds since the Unix epoch.

This is intentionally NOT the GenICam Timestamp register on VmbFrame_t, which is camera-clock-relative (counts from the camera’s last power-on for most Allied Vision USB models) and therefore unsuitable for wall-clock-aware downstream consumers.

§frame_id: u64

Monotonically increasing frame identifier assigned by the SDK.

Implementations§

Source§

impl<'a> Frame<'a>

Source

pub fn new( data: &'a [u8], width: u32, height: u32, pixel_format: PixelFormat, timestamp_ns: u64, frame_id: u64, ) -> Self

Build a borrowed frame view. Intended to be called by a VmbRuntime adapter (either the real FFI adapter or an in-memory fake) after it has decoded the SDK’s frame descriptor into plain Rust types.

Source

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

Raw byte view of the frame.

Source

pub fn to_vec(&self) -> Vec<u8>

Copy the frame bytes into a new Vec<u8>. This is the typical callback path: copy out before returning so the adapter can re-queue.

Source

pub fn len(&self) -> usize

Length of the borrowed buffer in bytes.

Source

pub fn is_empty(&self) -> bool

Returns true if the borrowed buffer is empty.

Auto Trait Implementations§

§

impl<'a> Freeze for Frame<'a>

§

impl<'a> RefUnwindSafe for Frame<'a>

§

impl<'a> Send for Frame<'a>

§

impl<'a> Sync for Frame<'a>

§

impl<'a> Unpin for Frame<'a>

§

impl<'a> UnsafeUnpin for Frame<'a>

§

impl<'a> UnwindSafe for Frame<'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.