diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2022-08-12 14:23:24 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2022-08-20 11:35:35 +0530 |
commit | f094c2922ad5708c876796f0ae5e7732b51e9c66 (patch) | |
tree | 567e2e82850374550fadeaff5a5a71216645705a /src/libcamera/v4l2_subdevice.cpp | |
parent | 3200bb635ccd64d5997bc372d9fa6bc894b2f9d0 (diff) |
libcamera: v4l2: Set colorspace flags
The colorspace fields are read-only from an application point of view,
both on video devices and on subdevs, unless the
V4L2_PIX_FMT_FLAG_SET_CSC or V4L2_MBUS_FRAMEFMT_SET_CSC flags
(respectively) are set when calling the S_FMT ioctl.
Set the flags accordingly within the V4L2SubDevice and V4L2Device when
a colorspace is being set by the application.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/libcamera/v4l2_subdevice.cpp')
-rw-r--r-- | src/libcamera/v4l2_subdevice.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index e5d20f2c..d8fd92e3 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -526,7 +526,13 @@ 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); + if (format->colorSpace) { + fromColorSpace(format->colorSpace, subdevFmt.format); + + /* The CSC flag is only applicable to source pads. */ + if (entity_->pads()[pad]->flags() & MEDIA_PAD_FL_SOURCE) + subdevFmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC; + } int ret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt); if (ret) { |