summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2021-12-10 14:44:22 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-13 11:29:02 +0200
commit4a5680998136cd4cd22e2ba40d9f09333b85942a (patch)
tree6ba34c3d01bd48f66410160ea84323e1e90772f8
parentc8a4b52e3aa3b4724b482c42cb20c3fda7e6572c (diff)
libcamera: v4l2_subdevice: Support passing ColorSpaces to V4L2 subdevices
The ColorSpace from the StreamConfiguration is now handled appropriately in the V4L2Subdevice. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/v4l2_subdevice.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index b782325a..fa216e85 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -415,6 +415,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format,
format->size.width = subdevFmt.format.width;
format->size.height = subdevFmt.format.height;
format->mbus_code = subdevFmt.format.code;
+ format->colorSpace = toColorSpace(subdevFmt.format);
return 0;
}
@@ -442,6 +443,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,
subdevFmt.format.height = format->size.height;
subdevFmt.format.code = format->mbus_code;
subdevFmt.format.field = V4L2_FIELD_NONE;
+ fromColorSpace(format->colorSpace, subdevFmt.format);
int ret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt);
if (ret) {
@@ -454,6 +456,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,
format->size.width = subdevFmt.format.width;
format->size.height = subdevFmt.format.height;
format->mbus_code = subdevFmt.format.code;
+ format->colorSpace = toColorSpace(subdevFmt.format);
return 0;
}