aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-30 13:47:57 (GMT)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-30 13:47:57 (GMT)
commit708f9052e1d2a905b10a03ed4d18e2d2c54b1350 (patch)
treec39504ee753b99075fb6914b2fa41666db756e79
parentf24e04a82e8ca1bf9021b74bd098789f78321bb3 (diff)
v4l2-compliance: determine the codec type
This information will be used in follow-up patches. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp38
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.h7
2 files changed, 45 insertions, 0 deletions
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index ad66039..12f77f5 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -458,6 +458,43 @@ static void signal_handler_interrupt(int signum)
exit(-1);
}
+static void determine_codec_type(struct node &node)
+{
+ struct v4l2_fmtdesc fmt_desc;
+ int num_cap_fmts = 0;
+ int num_compressed_cap_fmts = 0;
+ int num_out_fmts = 0;
+ int num_compressed_out_fmts = 0;
+
+ node.codec_type = NOT_CODEC;
+ if (!node.has_vid_m2m())
+ return;
+
+ if (node.enum_fmt(fmt_desc, true, 0, node.g_type()))
+ return;
+
+ do {
+ if (fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED)
+ num_compressed_cap_fmts++;
+ num_cap_fmts++;
+ } while (!node.enum_fmt(fmt_desc));
+
+
+ if (node.enum_fmt(fmt_desc, true, 0, v4l_type_invert(node.g_type())))
+ return;
+
+ do {
+ if (fmt_desc.flags & V4L2_FMT_FLAG_COMPRESSED)
+ num_compressed_out_fmts++;
+ num_out_fmts++;
+ } while (!node.enum_fmt(fmt_desc));
+
+ if (num_compressed_out_fmts == 0 && num_compressed_cap_fmts == num_cap_fmts)
+ node.codec_type = ENCODER;
+ else if (num_compressed_cap_fmts == 0 && num_compressed_out_fmts == num_out_fmts)
+ node.codec_type = DECODER;
+}
+
static int testCap(struct node *node)
{
struct v4l2_capability vcap;
@@ -692,6 +729,7 @@ void testNode(struct node &node, struct node &expbuf_node, media_type type,
is_vivid = driver == "vivid";
if (is_vivid)
node.bus_info = (const char *)vcap.bus_info;
+ determine_codec_type(node);
} else {
memset(&vcap, 0, sizeof(vcap));
}
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index f5e221f..03b4e72 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -64,6 +64,12 @@ enum poll_mode {
POLL_MODE_EPOLL,
};
+enum codec_type {
+ NOT_CODEC,
+ ENCODER,
+ DECODER
+};
+
struct test_query_ext_ctrl: v4l2_query_ext_ctrl {
__u64 menu_mask;
};
@@ -104,6 +110,7 @@ struct base_node {
unsigned std_compound_controls;
unsigned priv_controls;
unsigned priv_compound_controls;
+ enum codec_type codec_type;
__u32 media_version;
media_entity_desc entity;
media_pad_desc *pads;

Privacy Policy