diff options
-rw-r--r-- | include/libcamera/internal/camera_sensor.h | 1 | ||||
-rw-r--r-- | src/libcamera/camera_sensor.cpp | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 928c61af..02c77ab0 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -56,6 +56,7 @@ public: const Size &size) const; int setFormat(V4L2SubdeviceFormat *format, Transform transform = Transform::Identity); + int tryFormat(V4L2SubdeviceFormat *format) const; const ControlInfoMap &controls() const; ControlList getControls(const std::vector<uint32_t> &ids); 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 |