A zero-copy frame borrowing data from the camera's mmap buffer. 零拷贝帧,借用摄像头 mmap 缓冲区中的数据。 The lifetime `'a` is tied to the [`Camera`](crate::Camera) that produced it. While a `Frame` exists, the camera cannot produce the next frame (enforced by `&mut self` borrow on `next_frame()`). 生命周期 `'a` 绑定到产生它的 [`Camera`](crate::Camera)。 当 `Frame` 存在时,摄像头无法产生下一帧 (由 `next_frame()` 的 `&mut self` 借用强制保证)。 # E
| 50 | /// // let frame2 = cam.next_frame()?; // error! |
| 51 | /// ``` |
| 52 | pub struct Frame<'a> { |
| 53 | /// Raw pixel data from the mmap buffer. Only contains `bytesused` bytes. |
| 54 | /// 来自 mmap 缓冲区的原始像素数据。仅包含 `bytesused` 字节。 |
| 55 | data: &'a [u8], |
| 56 | |
| 57 | /// Image width in pixels. |
| 58 | /// 图像宽度(像素)。 |
| 59 | width: u32, |
| 60 | |
| 61 | /// Image height in pixels. |
| 62 | /// 图像高度(像素)。 |
| 63 | height: u32, |
| 64 | |
| 65 | /// Pixel format of the raw data (e.g., MJPEG, YUYV). |
| 66 | /// 原始数据的像素格式(如 MJPEG、YUYV)。 |
| 67 | pixel_format: PixelFormat, |
| 68 | |
| 69 | /// Driver-assigned frame sequence number. |
| 70 | /// 驱动分配的帧序号。 |
| 71 | /// |
| 72 | /// Gaps in sequence numbers indicate dropped frames. |
| 73 | /// 序号中的间隔表示发生了丢帧。 |
| 74 | sequence: u64, |
| 75 | |
| 76 | /// Kernel capture timestamp in microseconds. |
| 77 | /// 内核采集时间戳(微秒)。 |
| 78 | timestamp_us: u64, |
| 79 | |
| 80 | /// Marker to tie the lifetime to the camera/backend. |
| 81 | /// 用于将生命周期绑定到摄像头/后端的标记。 |
| 82 | _marker: PhantomData<&'a ()>, |
| 83 | } |
| 84 | |
| 85 | impl<'a> Frame<'a> { |
| 86 | /// Create a new Frame (crate-internal constructor). |
nothing calls this directly
no outgoing calls
no test coverage detected