summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-02-20 11:48:13 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-03-01 12:33:04 +0100
commita56f8a57b554e97116086a1d4078f7462e068486 (patch)
treee59a5130399026c4d55c18514db39e383ea640b1 /src
parent204d5c9f09e8513717e968a1ab31c2f0d4b8efb3 (diff)
libcamera: v4l2_subdevice: Update crop/compose rectangle
Update the crop/compose rectangle provided to setCrop()/setCompose() methods with the rectangle sizes set by the device driver after a S_SELECTION ioctl operation. While at there, fix the use of 'top' and 'left' field of the selection rectangle, which where wrongly used. Fixes: 468176fa07d9 ("libcamera: Add V4L2Subdevice") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/v4l2_subdevice.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index d7b61ba0..87377762 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -258,8 +258,8 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
sel.target = target;
sel.flags = 0;
- sel.r.left = rect->y;
- sel.r.top = rect->x;
+ sel.r.left = rect->x;
+ sel.r.top = rect->y;
sel.r.width = rect->w;
sel.r.height = rect->h;
@@ -272,6 +272,11 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
return ret;
}
+ rect->x = sel.r.left;
+ rect->y = sel.r.top;
+ rect->w = sel.r.width;
+ rect->h = sel.r.height;
+
return 0;
}