From 78f49d5e348814ae8d7c6bd0c2686112f790ca88 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Thu, 28 Jan 2021 17:45:44 +0900 Subject: android: camera_device: Fix exposure time tag in exif and android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ExposureTime libcamera control is in microseconds while android and our exif component use nanoseconds. Convert it appropriately. CTS also expects the ExposureTime exif tag to match the ExposureTime set in the android result metadata. Fix it. Signed-off-by: Paul Elder Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/android/camera_device.cpp | 2 +- src/android/jpeg/post_processor_jpeg.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/android') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 741dc8cf..c1025e81 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -2058,7 +2058,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, } if (metadata.contains(controls::ExposureTime)) { - int32_t exposure = metadata.get(controls::ExposureTime); + int64_t exposure = metadata.get(controls::ExposureTime) * 1000ULL; resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME, &exposure, 1); } diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index cac0087b..1cbab30c 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -112,8 +112,8 @@ int PostProcessorJpeg::process(const FrameBuffer &source, */ exif.setTimestamp(std::time(nullptr), 0ms); - /* \todo Get this information from libcamera::Request::metadata */ - exif.setExposureTime(0); + ret = resultMetadata->getEntry(ANDROID_SENSOR_EXPOSURE_TIME, &entry); + exif.setExposureTime(ret ? *entry.data.i64 : 0); ret = requestMetadata.getEntry(ANDROID_LENS_APERTURE, &entry); if (ret) exif.setAperture(*entry.data.f); -- cgit v1.2.1