aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-31 13:40:48 (GMT)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-01-31 14:13:16 (GMT)
commit4c0c905d23c65158d7a090097489ec8e6bcfa4db (patch)
treefa7117922331bb727af6efd27008adb1164c8a79
parentdd24c7654e9b3bc8a85a2a4dadb26b295b5fc4ff (diff)
v4l2-compliance: add V4L2_EVENT_SOURCE_CHANGE/EOS checks
Codecs have special requirements w.r.t. these event. Verify that they are implemented correctly. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/v4l2-compliance/v4l2-test-controls.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp
index 4d86035..4f354a4 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -866,6 +866,34 @@ int testEvents(struct node *node)
}
}
+ struct v4l2_event_subscription sub = { 0 };
+
+ sub.type = V4L2_EVENT_EOS;
+ bool have_eos = !doioctl(node, VIDIOC_SUBSCRIBE_EVENT, &sub);
+ if (have_eos)
+ fail_on_test(doioctl(node, VIDIOC_UNSUBSCRIBE_EVENT, &sub));
+ sub.type = V4L2_EVENT_SOURCE_CHANGE;
+ bool have_source_change = !doioctl(node, VIDIOC_SUBSCRIBE_EVENT, &sub);
+ if (have_source_change)
+ fail_on_test(doioctl(node, VIDIOC_UNSUBSCRIBE_EVENT, &sub));
+
+ switch (node->codec_mask) {
+ case STATEFUL_ENCODER:
+ fail_on_test(have_source_change || !have_eos);
+ break;
+ case STATEFUL_DECODER:
+ fail_on_test(!have_source_change || !have_eos);
+ break;
+ case STATELESS_ENCODER:
+ case STATELESS_DECODER:
+ fail_on_test(have_source_change || have_eos);
+ break;
+ default:
+ break;
+ }
+ if (node->can_output && !node->is_m2m)
+ fail_on_test(have_source_change);
+
if (node->controls.empty())
return ENOTTY;
return 0;

Privacy Policy