rien n'est simple, mais il faut avancer

This commit is contained in:
phyto 2019-07-03 15:29:24 +02:00
parent 47ec3c8ab5
commit 9c845b5d04
2 changed files with 14 additions and 4 deletions

View File

@ -22,8 +22,9 @@ int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int essai(char *dev, int k) int essai(char *dev, int k)
{ {
int vfd, foo; int vfd, foo;
struct v4l2_format fmt; struct v4l2_format fmt;
struct v4l2_requestbuffers reqbuf;
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k); fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, dev, k);
@ -43,11 +44,17 @@ pr_v4l2_format("before ioctl", &fmt);
foo = ioctl(vfd, VIDIOC_S_FMT, &fmt); foo = ioctl(vfd, VIDIOC_S_FMT, &fmt);
fprintf(stderr, "ioctl -> %d\n", foo); fprintf(stderr, "ioctl -> %d\n", foo);
if (foo < 0)) perror("ioctl S_FMT"); if (foo < 0) {
perror("ioctl S_FMT");
exit(1);
}
pr_v4l2_format("after ioctl", &fmt); pr_v4l2_format("after ioctl", &fmt);
/* todo V4L2_BUF_TYPE_VIDEO_CAPTURE */ /* todo V4L2_BUF_TYPE_VIDEO_CAPTURE */
memset(&reqbuf, 0, sizeof(reqbuf));
pr_v4l2_requestbuffers("after 0", &reqbuf);
return k; return k;
} }
@ -66,6 +73,9 @@ puts("\t-d\tselect the video device");
puts("\t-K\tset the K parameter"); puts("\t-K\tset the K parameter");
puts("\t-l\tlist video devices"); puts("\t-l\tlist video devices");
puts("\t-v\tincrease verbosity"); puts("\t-v\tincrease verbosity");
if (verbosity) { puts(""); fimg_print_version(1); }
exit(0); exit(0);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -52,7 +52,7 @@ return 0;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr) int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr)
{ {
fprintf(FP, "-- v4l2_requestbuffers, at %p\n", ptr); fprintf(FP, "-- v4l2_requestbuffers, %s %p\n", txt, ptr);
fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */ fprintf(FP, " type %d\n", ptr->type); /* enum v4l2_buf_type */