summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2016-11-29 12:08:13 +0100
committerSylwester Nawrocki <s.nawrocki@samsung.com>2016-11-29 12:17:09 +0100
commitf50ace41a0d05bea2f5f1a5c7d769b22b956bd94 (patch)
tree9f92cc362bdc21922a6728b59d2a2c941153eef4
parentd515a17762da3f2142b25abd82a5236550d60ed1 (diff)
v4l2-jpeg-codec-test: V4L2 capabilities testing fix
Use device caps and test only for V4L2_CAP_VIDEO_M2M when available to avoid errors with recent kernels. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
-rw-r--r--v4l2-jpeg-codec-test/test-jpeg.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/v4l2-jpeg-codec-test/test-jpeg.c b/v4l2-jpeg-codec-test/test-jpeg.c
index 2e17057..f723bf4 100644
--- a/v4l2-jpeg-codec-test/test-jpeg.c
+++ b/v4l2-jpeg-codec-test/test-jpeg.c
@@ -32,6 +32,10 @@
#include <linux/fb.h>
#include <linux/videodev2.h>
+#ifndef V4L2_CAP_VIDEO_M2M
+#define V4L2_CAP_VIDEO_M2M 0x00008000
+#endif
+
#include <sys/mman.h>
#define VIDEO_DEV_NAME "/dev/video"
@@ -410,13 +414,24 @@ int main(int argc, char *argv[])
ret = ioctl(vid_fd, VIDIOC_QUERYCAP, &cap);
perror_exit(ret != 0, "ioctl");
- if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
- fprintf(stderr, "Device does not support capture\n");
- exit(EXIT_FAILURE);
- }
- if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
- fprintf(stderr, "Device does not support output\n");
- exit(EXIT_FAILURE);
+
+ if (cap.device_caps | V4L2_CAP_DEVICE_CAPS) {
+ if (!(cap.device_caps & V4L2_CAP_VIDEO_M2M)) {
+ fprintf(stderr, "Device %s does not support mem-to-mem (%#x)\n",
+ video_node_name, cap.device_caps);
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+ fprintf(stderr, "Device %s does not support capture (%#x)\n",
+ video_node_name, cap.capabilities);
+ exit(EXIT_FAILURE);
+ }
+ if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
+ fprintf(stderr, "Device %s does not support output (%#x)\n",
+ video_node_name, cap.capabilities);
+ exit(EXIT_FAILURE);
+ }
}
/* set input format */