MCPcopy Create free account
hub / github.com/RustCV/RustCV / V4l2Backend

Class V4l2Backend

rustcv-camera/src/backend/linux/mod.rs:65–95  ·  view source on GitHub ↗

V4L2 capture backend using direct ioctl calls and mmap buffers. 使用直接 ioctl 调用和 mmap 缓冲区的 V4L2 采集后端。

Source from the content-addressed store, hash-verified

63/// V4L2 capture backend using direct ioctl calls and mmap buffers.
64/// 使用直接 ioctl 调用和 mmap 缓冲区的 V4L2 采集后端。
65pub(crate) struct V4l2Backend {
66 /// File descriptor for the opened /dev/videoN device.
67 /// 已打开的 /dev/videoN 设备的文件描述符。
68 fd: RawFd,
69
70 /// Memory-mapped buffers. Index matches V4L2 buffer index.
71 /// 内存映射缓冲区。索引与 V4L2 缓冲区索引对应。
72 buffers: Vec<MmapBuffer>,
73
74 /// Index of the currently dequeued buffer (held by user via Frame<'a>).
75 /// `None` if no buffer is currently held.
76 /// 当前被出队的缓冲区索引(由用户通过 Frame<'a> 持有)。
77 /// 如果没有缓冲区被持有则为 `None`。
78 pending_queue: Option<usize>,
79
80 /// Negotiated image width in pixels.
81 /// 协商后的图像宽度(像素)。
82 width: u32,
83
84 /// Negotiated image height in pixels.
85 /// 协商后的图像高度(像素)。
86 height: u32,
87
88 /// Negotiated pixel format.
89 /// 协商后的像素格式。
90 pixel_format: PixelFormat,
91
92 /// Whether streaming is currently active.
93 /// 流是否正在运行。
94 streaming: bool,
95}
96
97impl V4l2Backend {
98 /// Create a new (uninitialized) V4L2 backend.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected