From 7abdf7b43e2a7ebeccbac4831da3ac8b0e972fca Mon Sep 17 00:00:00 2001 From: tth Date: Sat, 31 Aug 2019 19:46:37 +0200 Subject: [PATCH] enum_image_framesizes not working --- v4l2/video-infos.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/v4l2/video-infos.c b/v4l2/video-infos.c index 88a3329..6d64094 100644 --- a/v4l2/video-infos.c +++ b/v4l2/video-infos.c @@ -19,6 +19,38 @@ int verbosity; +/* --------------------------------------------------------------------- */ +/* + * this code was written from a strace output :) + */ +int enum_image_framesizes(int fd, char *txt, int k) +{ +int foo, idx; +struct v4l2_frmsizeenum fmtsz; + +printf("-- image framesizes enumeration (%s)\n", txt); + +for (idx=0; ; idx++) { + memset(&fmtsz, 0, sizeof(fmtsz)); + fmtsz.index = idx; + foo = ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &fmtsz); + + if (foo) { + if (EINVAL==errno) { + break; + } + else { + perror(__func__); + break; + } + } + + printf("%4d %4d %4d\n", idx, fmtsz.pixel_format, fmtsz.type); + + } + +return 0; +} /* --------------------------------------------------------------------- */ int enum_image_formats(int fd, char *txt, int k) { @@ -61,7 +93,7 @@ int index, foo; struct v4l2_input input; char ligne[50]; -printf("-- inputs enumeration '%s'\n", txt); +printf("-- inputs enumeration (%s)\n", txt); index = 0; for(;;) { @@ -219,6 +251,7 @@ foo = enum_controls(vfd, "is that working ?", 0); foo = enum_extended_controls(vfd, "looking for extended", 0); +enum_image_framesizes(vfd, "code pas fini", 0); close(vfd);