This commit is contained in:
tonton Th 2020-01-28 22:11:20 +01:00
parent 379bd1b7de
commit 312f892576

View File

@ -20,9 +20,9 @@
int verbosity;
/* --------------------------------------------------------------------- */
int essai(char *dev, int k)
int essai_get_fmt(char *dev, int k)
{
int vfd, foo;
int vfd, idx, foo;
struct v4l2_format fmt;
struct v4l2_requestbuffers reqbuf;
@ -31,20 +31,22 @@ fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
vfd = open_device(dev);
if (verbosity) fprintf(stderr, "\topen %s -> %d\n", dev, vfd);
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
foo = ioctl(vfd, VIDIOC_G_FMT, &fmt);
fprintf(stderr, "ioctl -> %d\n", foo);
if (0 != foo) {
perror("ioctl G_FMT");
exit(1);
}
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
foo = ioctl(vfd, VIDIOC_G_FMT, &fmt);
fprintf(stderr, "%s : ioctl -> %d\n", __func__, foo);
if (0 != foo) {
perror("ioctl G_FMT");
return -1;
}
pr_v4l2_format("after ioctl VIDIOC_G_FMT", &fmt);
/* this function is bugged */
close(vfd);
return k;
}
/* --------------------------------------------------------------------- */
@ -79,7 +81,7 @@ while ((opt = getopt(argc, argv, "d:hK:v")) != -1) {
if (verbosity) fimg_print_version(0);
foo = essai(device, K);
foo = essai_get_fmt(device, K);
fprintf(stderr, "\tessai -> %d\n", foo);
return 0;