libcamera: v4l2_videodevice: Add crop/selection control

Add control for cropping/selection on a V4L2 video device through
the VIDIOC_S_SELECTION ioctl. This is similar to the existing cropping
control available on V4L2 sub-devices.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck
2020-02-13 22:19:07 +02:00
committed by Laurent Pinchart
parent 5dc5fb2ac5
commit ea3a00bc33
2 changed files with 53 additions and 0 deletions
+5
View File
@@ -182,6 +182,9 @@ public:
int setFormat(V4L2DeviceFormat *format);
ImageFormats formats();
int setCrop(Rectangle *rect);
int setCompose(Rectangle *rect);
int exportBuffers(unsigned int count,
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
int importBuffers(unsigned int count);
@@ -216,6 +219,8 @@ private:
std::vector<unsigned int> enumPixelformats();
std::vector<SizeRange> enumSizes(unsigned int pixelFormat);
int setSelection(unsigned int target, Rectangle *rect);
int requestBuffers(unsigned int count);
std::unique_ptr<FrameBuffer> createBuffer(const struct v4l2_buffer &buf);
FileDescriptor exportDmabufFd(unsigned int index, unsigned int plane);