aboutsummaryrefslogtreecommitdiffstats
path: root/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
diff options
context:
space:
mode:
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>2020-08-28 17:17:18 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-09-09 15:50:29 +0200
commitd2f76464d9cf3036aa67ca89420e8753210a4def (patch)
treef34858b3d3afd40a3c712b4f5d9dbcd462f38e93 /utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
parentdedeb53218d1e6b8da584a3c1aaa404f424c3647 (diff)
utils: v4l2-ctl: support V4L2_CAP_IO_MC in v4l2-ctl '--list-formats-*' commands
Add optional <mbus_code> arg to 'v4l2-ctl --list-formats-*' commands for capture, metadata and output devices. If <mbus_code> is given and the device has capability V4L2_CAP_IO_MC then list only the formats that matches the mbus code. The mbus_code is ignored for devices that don't use it or don't have the V4L2_CAP_IO_MC capability. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/v4l2-ctl/v4l2-ctl-vidcap.cpp')
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-vidcap.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index 5abab5e7..3d0f27db 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -23,13 +23,21 @@ static unsigned set_fmts;
static __u32 width, height, pixfmt, field, flags;
static __u32 bytesperline[VIDEO_MAX_PLANES];
static __u32 sizeimage[VIDEO_MAX_PLANES];
+static unsigned mbus_code;
void vidcap_usage()
{
printf("\nVideo Capture Formats options:\n"
- " --list-formats display supported video formats [VIDIOC_ENUM_FMT]\n"
- " --list-formats-ext display supported video formats including frame sizes\n"
- " and intervals\n"
+ " --list-formats [<mbus_code>]\n"
+ " display supported video formats. <mbus_code> is an optional\n"
+ " media bus code, if the device has capability V4L2_CAP_IO_MC\n"
+ " then only formats that support this media bus code are listed\n"
+ " [VIDIOC_ENUM_FMT]\n"
+ " --list-formats-ext [<mbus_code>]\n"
+ " display supported video formats including frame sizes and intervals\n"
+ " <mbus_code> is an optional media bus code, if the device has\n"
+ " capability V4L2_CAP_IO_MC then only formats that support this\n"
+ " media bus code are listed [VIDIOC_ENUM_FMT]\n"
" --list-framesizes <f>\n"
" list supported framesizes for pixelformat <f>\n"
" [VIDIOC_ENUM_FRAMESIZES]\n"
@@ -117,6 +125,11 @@ void vidcap_cmd(int ch, char *optarg)
std::exit(EXIT_FAILURE);
}
break;
+ case OptListFormats:
+ case OptListFormatsExt:
+ if (optarg)
+ mbus_code = strtoul(optarg, 0L, 0);
+ break;
case OptListFrameSizes:
be_pixfmt = strlen(optarg) == 7 && !memcmp(optarg + 4, "-BE", 3);
if (be_pixfmt || strlen(optarg) == 4) {
@@ -298,12 +311,12 @@ void vidcap_list(cv4l_fd &fd)
{
if (options[OptListFormats]) {
printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats(fd, vidcap_buftype);
+ print_video_formats(fd, vidcap_buftype, mbus_code);
}
if (options[OptListFormatsExt]) {
printf("ioctl: VIDIOC_ENUM_FMT\n");
- print_video_formats_ext(fd, vidcap_buftype);
+ print_video_formats_ext(fd, vidcap_buftype, mbus_code);
}
if (options[OptListFields]) {

Privacy Policy