[libcamera-devel] [RFC PATCH v2 10/12] android: camera_device: Translate android controls to libcamera controls

Paul Elder paul.elder at ideasonboard.com
Thu Apr 22 11:41:00 CEST 2021


Translate the newly added android controls that are required to FULL
compliance into libcamera controls before sending them to the Camera.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 src/android/camera_device.cpp | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 99c67555..30692a67 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -2136,15 +2136,46 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)
 
 	/* Translate the Android request settings to libcamera controls. */
 	camera_metadata_ro_entry_t entry;
+	ControlList &controls = descriptor->request_->controls();
+
 	if (settings.getEntry(ANDROID_SCALER_CROP_REGION, &entry)) {
 		const int32_t *data = entry.data.i32;
 		Rectangle cropRegion{ data[0], data[1],
 				      static_cast<unsigned int>(data[2]),
 				      static_cast<unsigned int>(data[3]) };
-		ControlList &controls = descriptor->request_->controls();
 		controls.set(controls::ScalerCrop, cropRegion);
 	}
 
+	if (settings.getEntry(ANDROID_SENSOR_EXPOSURE_TIME, &entry))
+		controls.set(controls::ExposureTime, *entry.data.i64 / 1000ULL);
+
+	if (settings.getEntry(ANDROID_BLACK_LEVEL_LOCK, &entry))
+		controls.set(controls::draft::BlackLevelLocked, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_CONTROL_AE_LOCK, &entry))
+		controls.set(controls::AeLocked, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry))
+		controls.set(controls::draft::AePrecaptureTrigger, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_CONTROL_AWB_MODE, &entry))
+		controls.set(controls::AwbMode, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_CONTROL_AWB_LOCK, &entry))
+		controls.set(controls::AwbLocked, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_EDGE_MODE, &entry))
+		controls.set(controls::draft::EdgeMode, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_NOISE_REDUCTION_MODE, &entry))
+		controls.set(controls::draft::NoiseReductionMode, *entry.data.u8);
+
+	if (settings.getEntry(ANDROID_SENSOR_SENSITIVITY, &entry))
+		controls.set(controls::draft::SensorSensitivity, *entry.data.i32);
+
+	if (settings.getEntry(ANDROID_TONEMAP_MODE, &entry))
+		controls.set(controls::draft::TonemapMode, *entry.data.u8);
+
 	return 0;
 }
 
-- 
2.27.0



More information about the libcamera-devel mailing list