Skip to main content

Frame

Struct Frame 

Source
pub struct Frame<'a> {
    pub data: &'a [u8],
    pub width: u32,
    pub height: u32,
    pub stride: usize,
    pub format: PixelFormat,
    pub sequence: u64,
    pub timestamp: Timestamp,
    pub metadata: FrameMetadata,
    pub backend_handle: &'a dyn BackendBufferHandle,
}
Expand description

核心帧结构体 使用生命周期 ’a 绑定到底层 Ring Buffer,实现零拷贝。

Fields§

§data: &'a [u8]

原始图像数据切片

§width: u32

图像宽度 (Pixels)

§height: u32

图像高度 (Pixels)

§stride: usize

【关键】跨距/步长 (Bytes per line) GPU 和 SIMD 往往要求 256/512 字节对齐,Stride 可能大于 width * bpp

§format: PixelFormat

像素格式 (含 Bayer, MJPEG 等)

§sequence: u64

帧索引 (用于底层 Buffer 回收或丢帧统计)

§timestamp: Timestamp

时间戳集合 (工业级同步核心)

§metadata: FrameMetadata

帧级元数据 (曝光、增益、GPIO状态)

§backend_handle: &'a dyn BackendBufferHandle

内部句柄 (用于实现 Backend 特有的互操作,如 export_dmabuf)

Trait Implementations§

Source§

impl<'a> Debug for Frame<'a>

Source§

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

Formats the value using the given formatter. Read more

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.