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

Function enum_formats

rustcv-camera/src/backend/linux/sys.rs:113–125  ·  view source on GitHub ↗

Enumerate supported pixel formats (VIDIOC_ENUM_FMT). 枚举设备支持的像素格式(VIDIOC_ENUM_FMT)。 Call with `index` starting from 0, incrementing until `EINVAL` is returned (indicating no more formats). `index` 从 0 开始递增调用,直到返回 `EINVAL`(表示枚举完毕)。

(fd: RawFd, index: u32)

Source from the content-addressed store, hash-verified

111/// (indicating no more formats).
112/// `index` 从 0 开始递增调用,直到返回 `EINVAL`(表示枚举完毕)。
113pub fn enum_formats(fd: RawFd, index: u32) -> io::Result<v4l2_fmtdesc> {
114 let mut desc: v4l2_fmtdesc = unsafe { std::mem::zeroed() };
115 desc.index = index;
116 desc.type_ = V4L2_BUF_TYPE_VIDEO_CAPTURE;
117 unsafe {
118 v4l2_ioctl(
119 fd,
120 VIDIOC_ENUM_FMT,
121 &mut desc as *mut _ as *mut libc::c_void,
122 )?;
123 }
124 Ok(desc)
125}
126
127/// Enumerate supported frame sizes for a given pixel format (VIDIOC_ENUM_FRAMESIZES).
128/// 枚举指定像素格式下支持的帧尺寸(VIDIOC_ENUM_FRAMESIZES)。

Callers 1

negotiate_formatMethod · 0.85

Calls 1

v4l2_ioctlFunction · 0.85

Tested by

no test coverage detected