enumerate image formats
This commit is contained in:
@@ -19,6 +19,37 @@
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int enum_image_formats(int fd, char *txt, int k)
|
||||
{
|
||||
int foo, idx;
|
||||
struct v4l2_fmtdesc fmtd;
|
||||
|
||||
printf("-- image formats enumeration (%s)\n", txt);
|
||||
|
||||
idx = 0;
|
||||
for (;;) {
|
||||
memset(&fmtd, 0, sizeof(fmtd));
|
||||
fmtd.index = idx;
|
||||
fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
foo = ioctl(fd, VIDIOC_ENUM_FMT, &fmtd);
|
||||
// fprintf(stderr, "B idx=%d, foo=%d, errno=%d\n", idx, foo, errno);
|
||||
if (foo) {
|
||||
if (EINVAL==errno) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
perror(__func__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pr_v4l2_fmtdesc(__func__, &fmtd);
|
||||
|
||||
idx++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
static int enum_inputs(int fd, char *txt, int k)
|
||||
{
|
||||
@@ -124,7 +155,7 @@ while (0 == ioctl (fd, VIDIOC_QUERYCTRL, &qctrl)) {
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int show_webcam_infos(char *devname, int k)
|
||||
int show_webcam_infos(char *devname, char *title, int k)
|
||||
{
|
||||
int vfd, foo;
|
||||
|
||||
@@ -162,8 +193,9 @@ if (-1 == ioctl(vfd, VIDIOC_ENUMINPUT, &input)) {
|
||||
}
|
||||
pr_v4l2_input("input 0", &input);
|
||||
|
||||
foo = enum_inputs(vfd, "is that working ?", 0);
|
||||
foo = enum_inputs(vfd, "on peut voir quoi ?", 0);
|
||||
|
||||
foo = enum_image_formats(vfd, "Experimental", 0);
|
||||
|
||||
fputs("--\n", stderr);
|
||||
foo = enum_controls(vfd, "is that working ?", 0);
|
||||
@@ -216,7 +248,7 @@ while ((opt = getopt(argc, argv, "d:hK:lv")) != -1) {
|
||||
|
||||
if (verbosity) fimg_print_version(0);
|
||||
|
||||
foo = show_webcam_infos(device, K);
|
||||
foo = show_webcam_infos(device, "", K);
|
||||
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user