[libcamera-devel,v2,04/11] android: camera_device: Register EXPOSURE_TIME_RANGE
diff mbox series

Message ID 20210119143711.153517-5-jacopo@jmondi.org
State Accepted
Delegated to: Jacopo Mondi
Headers show
Series
  • android: Exposure times + scaler crop + android metadata
Related show

Commit Message

Jacopo Mondi Jan. 19, 2021, 2:37 p.m. UTC
Register the EXPOSURE_TIME_RANGE static metadata inspecting the
ExposureTime control limits as reported by the camera.

If such information is not available, do not register the property.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index a136f8e33843..d22142337d04 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -888,11 +888,15 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 					  &filterArr, 1);
 	}
 
-	int64_t exposureTimeRange[] = {
-		100000, 200000000,
-	};
-	staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,
-				  &exposureTimeRange, 2);
+	const auto &exposureInfo = controlsInfo.find(&controls::ExposureTime);
+	if (exposureInfo != controlsInfo.end()) {
+		int64_t exposureTimeRange[2] = {
+			exposureInfo->second.min().get<int32_t>() * 1000LL,
+			exposureInfo->second.max().get<int32_t>() * 1000LL,
+		};
+		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,
+					  &exposureTimeRange, 2);
+	}
 
 	staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation_, 1);