summaryrefslogtreecommitdiff
path: root/src/libcamera/camera_sensor.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-03-13 10:02:33 +0100
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-04-30 18:40:19 +0200
commit608af3127cd2be4540121cc16ee43b8bc4ac009d (patch)
treed479085ec6c09d94494cf3c0a9d8cad7912abf20 /src/libcamera/camera_sensor.cpp
parent14995410fe8546350d35108398e8b853c9ced002 (diff)
libcamera: camera_sensor: Add tryFormat()
Add a function to the CameraSensor class that allows to test a format without applying it to the subdevice and without modifying any control value associated with the camera sensor. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@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.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index e442b89d..06f31521 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -796,6 +796,23 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform)
}
/**
+ * \brief Try the sensor output format
+ * \param[in] format The desired sensor output format
+ *
+ * The ranges of any controls associated with the sensor are not updated.
+ *
+ * \todo Add support for Transform by changing the format's Bayer ordering
+ * before calling subdev_->setFormat().
+ *
+ * \return 0 on success or a negative error code otherwise
+ */
+int CameraSensor::tryFormat(V4L2SubdeviceFormat *format) const
+{
+ return subdev_->setFormat(pad_, format,
+ V4L2Subdevice::Whence::TryFormat);
+}
+
+/**
* \brief Retrieve the supported V4L2 controls and their information
*
* Control information is updated automatically to reflect the current sensor