23,217
社区成员




static int GetVideo_Support_fmt(pVd vd)
{
struct v4l2_fmtdesc fmt_desc;
int ret = -1;
memset(&fmt_desc, 0, sizeof(struct v4l2_fmtdesc));
fmt_desc.index=0;
fmt_desc.type= vd->type; //V4L2_BUF_TYPE_VIDEO_CAPTURE;
printf("Support format:\n");
while(ioctl(vd->fd, VIDIOC_ENUM_FMT, &fmt_desc) != -1)
{
fmt_desc.index++;
printf("\t%d.%s\n",fmt_desc.index,fmt_desc.description);
printf("{ pixelformat = ''%c%c%c%c'', description = ''%s'' }\n", \
fmt_desc.pixelformat & 0xFF, \
(fmt_desc.pixelformat >> 8) & 0xFF, \
(fmt_desc.pixelformat >> 16) & 0xFF, \
(fmt_desc.pixelformat >> 24) & 0xFF,\
fmt_desc.description);
ret = enum_frame_sizes(vd->fd , fmt_desc.pixelformat);
if (ret != 0)
printf("Unable to enumerate frame sizes\n");
}
//printf("\n");
if(errno != EINVAL) {
printf("error num:%d",errno);
perror("ERROR enumerating frame formats:");
// return (-1);
}
return 0;
}