v4l2-ctl: print the v4l2_fmtdesc flags field.
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Jul 2011 10:01:59 +0000 (12:01 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Jul 2011 10:01:59 +0000 (12:01 +0200)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-ctl/v4l2-ctl.cpp

index e6fcd19..28d40a4 100644 (file)
@@ -1257,18 +1257,24 @@ static void print_frmival(const struct v4l2_frmivalenum &frmival, const char *pr
        }
 }
 
+static const flag_def fmtdesc_def[] = {
+       { V4L2_FMT_FLAG_COMPRESSED, "compressed" },
+       { V4L2_FMT_FLAG_EMULATED, "emulated" },
+       { 0, NULL }
+};
+
 static void print_video_formats(int fd, enum v4l2_buf_type type)
 {
        struct v4l2_fmtdesc fmt;
 
-       fmt.index = 0;
+       memset(&fmt, 0, sizeof(fmt));
        fmt.type = type;
        while (test_ioctl(fd, VIDIOC_ENUM_FMT, &fmt) >= 0) {
                printf("\tIndex       : %d\n", fmt.index);
                printf("\tType        : %s\n", buftype2s(type).c_str());
                printf("\tPixel Format: '%s'", fcc2s(fmt.pixelformat).c_str());
                if (fmt.flags)
-                       printf(" (compressed)");
+                       printf(" (%s)", flags2s(fmt.flags, fmtdesc_def).c_str());
                printf("\n");
                printf("\tName        : %s\n", fmt.description);
                printf("\n");
@@ -1289,7 +1295,7 @@ static void print_video_formats_ext(int fd, enum v4l2_buf_type type)
                printf("\tType        : %s\n", buftype2s(type).c_str());
                printf("\tPixel Format: '%s'", fcc2s(fmt.pixelformat).c_str());
                if (fmt.flags)
-                       printf(" (compressed)");
+                       printf(" (%s)", flags2s(fmt.flags, fmtdesc_def).c_str());
                printf("\n");
                printf("\tName        : %s\n", fmt.description);
                frmsize.pixel_format = fmt.pixelformat;