aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>2020-07-03 20:02:39 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-09-26 12:20:54 +0200
commit53baf567f48eb22085b4a55fd1d9c9d6276e1fe6 (patch)
tree35489f0861cee8eb4a45d113f3f06cc66497d6bf
parent8658f963e020b3420ada91d28791f64714adb7fa (diff)
v4l2-ctl: subdev: Add the flags to the list of supported mbus formats
Add a new function mbus2s to that prints a descriptive string of the supported flags of the the v4l2_subdev_mbus_code_enum Use this function in the print_mbus_code function. Also add a macro MBUS_DEF(enc_type) to create the two arries 'mbus_hsv_def' and mbus_ycbcr_def' that maps flags to string according to the enc_type (ycbcr/hsv) Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/common/v4l2-info.cpp19
-rw-r--r--utils/common/v4l2-info.h4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-subdev.cpp10
3 files changed, 31 insertions, 2 deletions
diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp
index af8151a2..cd80a80d 100644
--- a/utils/common/v4l2-info.cpp
+++ b/utils/common/v4l2-info.cpp
@@ -373,6 +373,25 @@ std::string fmtdesc2s(unsigned flags, bool is_hsv)
return flags2s(flags, fmtdesc_ycbcr_def);
}
+#define MBUS_DEF(enc_type) \
+static const flag_def mbus_ ## enc_type ## _def[] = { \
+ { V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE, "csc-colorspace" }, \
+ { V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC, "csc-"#enc_type }, \
+ { V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION, "csc-quantization" }, \
+ { V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC, "csc-xfer-func" }, \
+ { 0, NULL } \
+};
+
+MBUS_DEF(ycbcr)
+MBUS_DEF(hsv)
+
+std::string mbus2s(unsigned flags, bool is_hsv)
+{
+ if (is_hsv)
+ return flags2s(flags, mbus_hsv_def);
+ return flags2s(flags, mbus_ycbcr_def);
+}
+
static const flag_def selection_targets_def[] = {
{ V4L2_SEL_TGT_CROP_ACTIVE, "crop" },
{ V4L2_SEL_TGT_CROP_DEFAULT, "crop_default" },
diff --git a/utils/common/v4l2-info.h b/utils/common/v4l2-info.h
index f2f41f51..789b1f43 100644
--- a/utils/common/v4l2-info.h
+++ b/utils/common/v4l2-info.h
@@ -9,6 +9,7 @@
#include <string>
#include <linux/videodev2.h>
+#include <linux/v4l2-subdev.h>
/* Print capability information */
void v4l2_info_capability(const v4l2_capability &cap);
@@ -51,6 +52,9 @@ std::string pixflags2s(unsigned flags);
/* Return sliced vbi services description */
std::string service2s(unsigned service);
+/* Return v4l2_subdev_mbus_code_enum flags description */
+std::string mbus2s(unsigned flags, bool is_hsv);
+
/* Return v4l2_fmtdesc flags description */
std::string fmtdesc2s(unsigned flags, bool is_hsv);
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index 1ef6e1a8..8f6bb3d6 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -560,10 +560,10 @@ static void print_mbus_code(__u32 code)
if (mbus_names[i].code == code)
break;
if (mbus_names[i].name)
- printf("\t0x%04x: MEDIA_BUS_FMT_%s\n",
+ printf("\t0x%04x: MEDIA_BUS_FMT_%s",
mbus_names[i].code, mbus_names[i].name);
else
- printf("\t0x%04x\n", code);
+ printf("\t0x%04x", code);
}
static void print_mbus_codes(int fd, __u32 pad)
@@ -580,6 +580,12 @@ static void print_mbus_codes(int fd, __u32 pad)
if (ret)
break;
print_mbus_code(mbus_code.code);
+ if (mbus_code.flags) {
+ bool is_hsv = mbus_code.code == MEDIA_BUS_FMT_AHSV8888_1X32;
+
+ printf(", %s", mbus2s(mbus_code.flags, is_hsv).c_str());
+ }
+ printf("\n");
mbus_code.index++;
}
}

Privacy Policy