[libcamera-devel,v2,05/11] android: camera_device: Report EXPOSURE_TIME
diff mbox series

Message ID 20210119143711.153517-6-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
Instead of reporting a fake value in the dynamic metadata for the
EXPOSURE_TIME control, use the value provided by the pipeline.

The metadata is only meaningfull in FULL mode.

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

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d22142337d04..0484bb9a6557 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1871,11 +1871,6 @@  CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
 	resultMetadata->addEntry(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW,
 				 &rolling_shutter_skew, 1);
 
-	/* 16.6 msec */
-	const int64_t exposure_time = 16600000;
-	resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME,
-				 &exposure_time, 1);
-
 	const uint8_t lens_shading_map_mode =
 				ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF;
 	resultMetadata->addEntry(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE,
@@ -1893,6 +1888,12 @@  CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,
 					 &pipeline_depth, 1);
 	}
 
+	if (metadata.contains(controls::ExposureTime)) {
+		int32_t exposure = metadata.get(controls::ExposureTime);
+		resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME,
+					 &exposure, 1);
+	}
+
 	/*
 	 * Return the result metadata pack even is not valid: get() will return
 	 * nullptr.