| 21 | /// ``` |
| 22 | #[derive(Debug, Clone)] |
| 23 | pub struct CameraConfig { |
| 24 | /// Requested width in pixels. `None` = let the driver choose. |
| 25 | /// 请求的宽度(像素)。`None` = 由驱动自行选择。 |
| 26 | pub(crate) width: Option<u32>, |
| 27 | |
| 28 | /// Requested height in pixels. `None` = let the driver choose. |
| 29 | /// 请求的高度(像素)。`None` = 由驱动自行选择。 |
| 30 | pub(crate) height: Option<u32>, |
| 31 | |
| 32 | /// Requested frames per second. `None` = driver default (usually 30). |
| 33 | /// 请求的帧率。`None` = 驱动默认值(通常为 30)。 |
| 34 | pub(crate) fps: Option<u32>, |
| 35 | |
| 36 | /// Requested pixel format. `None` = auto-select based on fps. |
| 37 | /// 请求的像素格式。`None` = 根据帧率自动选择。 |
| 38 | /// |
| 39 | /// Auto-selection strategy: |
| 40 | /// - fps < 60: prefer MJPEG (lower USB bandwidth) |
| 41 | /// - fps >= 60: prefer YUYV/NV12 (lower decode overhead) |
| 42 | /// |
| 43 | /// 自动选择策略: |
| 44 | /// - fps < 60:优先 MJPEG(USB 带宽更低) |
| 45 | /// - fps >= 60:优先 YUYV/NV12(解码开销更小) |
| 46 | pub(crate) pixel_format: Option<PixelFormat>, |
| 47 | |
| 48 | /// Number of kernel mmap buffers to allocate. |
| 49 | /// 要分配的内核 mmap 缓冲区数量。 |
| 50 | /// |
| 51 | /// More buffers = more tolerance for processing jitter, |
| 52 | /// but uses more kernel memory. |
| 53 | /// Default is 5, which provides ~166ms of buffer at 30fps. |
| 54 | /// |
| 55 | /// 缓冲区越多 = 对处理抖动的容忍度越高,但消耗更多内核内存。 |
| 56 | /// 默认为 5,在 30fps 下提供约 166ms 的缓冲余量。 |
| 57 | pub(crate) buffer_count: u32, |
| 58 | } |
| 59 | |
| 60 | impl Default for CameraConfig { |
| 61 | fn default() -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected