From f3a8b21deaf9ea8622390896f20e7ba72234f949 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 22 Aug 2013 23:20:43 +0200 Subject: Support device caps Use the V4L2 video device caps instead of the global caps when available. Signed-off-by: Laurent Pinchart --- yavta.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yavta.c b/yavta.c index 03fd98f..67072b3 100644 --- a/yavta.c +++ b/yavta.c @@ -180,6 +180,7 @@ static unsigned int v4l2_format_code(const char *name) static int video_open(struct device *dev, const char *devname, int no_query) { struct v4l2_capability cap; + unsigned int capabilities; int ret; memset(dev, 0, sizeof *dev); @@ -208,9 +209,12 @@ static int video_open(struct device *dev, const char *devname, int no_query) if (ret < 0) return 0; - if (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) + capabilities = cap.capabilities & V4L2_CAP_DEVICE_CAPS + ? cap.device_caps : cap.capabilities; + + if (capabilities & V4L2_CAP_VIDEO_CAPTURE) dev->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - else if (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) + else if (capabilities & V4L2_CAP_VIDEO_OUTPUT) dev->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; else { printf("Error opening device %s: neither video capture " -- cgit v1.2.3