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