static int v4l2_set_fmt(void)
struct v4l2_format fmt;
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.width = WIDTH;
fmt.fmt.pix.height = HEIGHT;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
if (::ioctl(fd, VIDIOC_S_FMT, &fmt) == -1)
{
printf("Camara set fmt is errror.\n");
return -1;
}
printf("width: %d\n", fmt.fmt.pix.width);
printf("height: %d\n", fmt.fmt.pix.height);
return 0;
}
就是这个子函数运行后输出的信息不对
本来#define WIDTH 320
#define HEIGHT 240
但是最后两个printf输出分别是176,144