summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-08-22 23:20:43 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-08-22 23:32:52 +0200
commitf3a8b21deaf9ea8622390896f20e7ba72234f949 (patch)
tree4d3760028c35465ab292a57e5b2b66bc81c454dd
parentd9b7cfc83407e367c194b2db895115870b703aa6 (diff)
Support device caps
Use the V4L2 video device caps instead of the global caps when available. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--yavta.c8
1 files 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 "