[libcamera-devel] [PATCH 2/2] DNI: How to use a draft control
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Oct 7 20:57:19 CEST 2020
This just shows how the draft state can be used on a control or
property.
Expressing a draft key on the property_ids or control_ids yaml
descriptions will automatically move the entrys to the draft namespace.
---
src/libcamera/camera_sensor.cpp | 2 +-
src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-
src/libcamera/property_ids.yaml | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 78c7ceec7c44..4e899d180d95 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -249,7 +249,7 @@ int CameraSensor::init()
propertyValue = rotationControl->second.def().get<int32_t>();
else
propertyValue = 0;
- properties_.set(properties::Rotation, propertyValue);
+ properties_.set(properties::draft::Rotation, propertyValue);
/* Enumerate, sort and cache media bus codes and sizes. */
formats_ = subdev_->formats(pad_);
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 26dbd2573e04..c1468178f163 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -270,7 +270,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
* error means the platform can never run. Let's just print a warning
* and continue regardless; the rotation is effectively set to zero.
*/
- int32_t rotation = data_->sensor_->properties().get(properties::Rotation);
+ int32_t rotation = data_->sensor_->properties().get(properties::draft::Rotation);
bool success;
Transform rotationTransform = transformFromRotation(rotation, &success);
if (!success)
diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml
index 7261263a9ba3..e3400cc9d469 100644
--- a/src/libcamera/property_ids.yaml
+++ b/src/libcamera/property_ids.yaml
@@ -28,6 +28,7 @@ controls:
- Rotation:
type: int32_t
+ draft: true
description: |
The camera rotation is expressed as the angular difference in degrees
between two reference systems, one relative to the camera module, and
--
2.25.1
More information about the libcamera-devel
mailing list