diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-02-06 19:21:32 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-02-09 23:40:15 +0100 |
commit | 85befa816e5a01372b52ecbd345f34815d1b9bc6 (patch) | |
tree | 4572b49b0313d07b812b8faae0a32be24b6713db /src/libcamera/camera_sensor.cpp | |
parent | 3aa42f36c0d7de48e267b6505158ab1e89374285 (diff) |
libcamera: Remove transform from V4L2SubdeviceFormat
Commit 6f6e1bf704fe ("libcamera: camera_sensor: Apply flips at
setFormat()") extended the CameraSensor::setFormat() function
to apply vertical/horizontal flips on the sensor based on the
supplied Transform. To pass the Transform to the function the
V4L2SubdeviceFormat structure has been augmented with a Transform
member.
However as the newly added Transform is not used at all in the
V4L2Subdevice class, it should not be part of V4L2SubdeviceFormat.
Fix that by removing the transform field from V4L2SubdeviceFormat
and pass it as an explicit parameter to CameraSensor::setFormat().
Fixes: 6f6e1bf704fe ("libcamera: camera_sensor: Apply flips at setFormat())
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/camera_sensor.cpp')
-rw-r--r-- | src/libcamera/camera_sensor.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 274ed419..e442b89d 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -16,7 +16,6 @@ #include <string.h> #include <libcamera/property_ids.h> -#include <libcamera/transform.h> #include <libcamera/base/utils.h> @@ -751,7 +750,6 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu .mbus_code = bestCode, .size = *bestSize, .colorSpace = ColorSpace::Raw, - .transform = Transform::Identity, }; return format; @@ -760,6 +758,8 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu /** * \brief Set the sensor output format * \param[in] format The desired sensor output format + * \param[in] transform The transform to be applied on the sensor. + * Defaults to Identity. * * If flips are writable they are configured according to the desired Transform. * Transform::Identity always corresponds to H/V flip being disabled if the @@ -770,18 +770,16 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu * * \return 0 on success or a negative error code otherwise */ -int CameraSensor::setFormat(V4L2SubdeviceFormat *format) +int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform) { /* Configure flips if the sensor supports that. */ if (supportFlips_) { ControlList flipCtrls(subdev_->controls()); flipCtrls.set(V4L2_CID_HFLIP, - static_cast<int32_t>(!!(format->transform & - Transform::HFlip))); + static_cast<int32_t>(!!(transform & Transform::HFlip))); flipCtrls.set(V4L2_CID_VFLIP, - static_cast<int32_t>(!!(format->transform & - Transform::VFlip))); + static_cast<int32_t>(!!(transform & Transform::VFlip))); int ret = subdev_->setControls(&flipCtrls); if (ret) |