aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-08-21 16:33:22 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2012-08-21 16:38:22 +0200
commitee58aa47645cb92b82b4881c5ed2f142b20bc8db (patch)
tree7e8ffc05998ef393c240eeb8843164fd579d5479
parent574f9328842eaa1b1e767ce9a1abd8cd869e783c (diff)
v4l2-compliance: add VIDIOC_(TRY_)DECODER_CMD tests.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp2
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.h1
-rw-r--r--utils/v4l2-compliance/v4l2-test-codecs.cpp30
3 files changed, 32 insertions, 1 deletions
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index a22b8752..64ba5d73 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -660,6 +660,7 @@ int main(int argc, char **argv)
printf("Codec ioctls:\n");
printf("\ttest VIDIOC_(TRY_)ENCODER_CMD: %s\n", ok(testEncoder(&node)));
+ printf("\ttest VIDIOC_(TRY_)DECODER_CMD: %s\n", ok(testDecoder(&node)));
printf("\n");
/* Buffer ioctls */
@@ -673,7 +674,6 @@ int main(int argc, char **argv)
VIDIOC_CROPCAP, VIDIOC_G/S_CROP, VIDIOC_G/S_SELECTION
VIDIOC_S_FBUF/OVERLAY
- VIDIOC_(TRY_)DECODER_CMD
VIDIOC_G_ENC_INDEX
VIDIOC_QBUF/DQBUF/QUERYBUF/PREPARE_BUFS
VIDIOC_STREAMON/OFF
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 9480cc2e..5a862310 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -191,6 +191,7 @@ int testSlicedVBICap(struct node *node);
// Codec ioctl tests
int testEncoder(struct node *node);
+int testDecoder(struct node *node);
// Buffer ioctl tests
int testReqBufs(struct node *node);
diff --git a/utils/v4l2-compliance/v4l2-test-codecs.cpp b/utils/v4l2-compliance/v4l2-test-codecs.cpp
index 60f861a2..6a5efa94 100644
--- a/utils/v4l2-compliance/v4l2-test-codecs.cpp
+++ b/utils/v4l2-compliance/v4l2-test-codecs.cpp
@@ -60,3 +60,33 @@ int testEncoder(struct node *node)
fail_on_test(ret != EPERM && ret != EINVAL);
return 0;
}
+
+int testDecoder(struct node *node)
+{
+ struct v4l2_decoder_cmd cmd;
+ int ret;
+
+ memset(&cmd, 0xff, sizeof(cmd));
+ memset(&cmd.raw, 0, sizeof(cmd.raw));
+ ret = doioctl(node, VIDIOC_DECODER_CMD, &cmd);
+ if (ret == ENOTTY)
+ return ret;
+ fail_on_test(ret != EINVAL);
+ ret = doioctl(node, VIDIOC_TRY_DECODER_CMD, &cmd);
+ fail_on_test(ret == ENOTTY);
+ fail_on_test(ret != EINVAL);
+ cmd.cmd = V4L2_DEC_CMD_STOP;
+ cmd.flags = V4L2_DEC_CMD_STOP_IMMEDIATELY;
+ ret = doioctl(node, VIDIOC_TRY_DECODER_CMD, &cmd);
+ fail_on_test(ret != 0);
+ ret = doioctl(node, VIDIOC_DECODER_CMD, &cmd);
+ fail_on_test(ret != 0);
+ cmd.cmd = V4L2_DEC_CMD_PAUSE;
+ cmd.flags = 0;
+ ret = doioctl(node, VIDIOC_DECODER_CMD, &cmd);
+ fail_on_test(ret != EPERM && ret != EINVAL);
+ cmd.cmd = V4L2_DEC_CMD_RESUME;
+ ret = doioctl(node, VIDIOC_DECODER_CMD, &cmd);
+ fail_on_test(ret != EPERM && ret != EINVAL);
+ return 0;
+}

Privacy Policy