:66.718KB : :1 :2022-10-08 14:18:47
V4L2 Camera编程如果开发者对于本文件有需要的可以参考。
Linux环境基于V4L2框架的Camera编程
void start_capturing (int fd)
{
unsigned int i,ret;
enum v4l2_buf_type type;
printf("n_buffers:%d\n", n_buffers);
for (i = 0; i < n_buffers; i) {
struct v4l2_buffer buf;
CLEAR (buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = i;
buf.flags = V4L2_BUF_FLAG_TIMECODE|V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
ret = ioctl (fd, VIDIOC_QBUF, &buf);
if (-1 == ret)
errno_exit ("VIDIOC_QBUF");
}
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ret = ioctl (fd, VIDIOC_STREAMON, &type);
if (-1 == ret) {
errno_exit ("VIDIOC_STREAMON");
}
}