[libcamera-devel] [PATCH v4 5/7] android: camera: Fix handling of capture intent

Jacopo Mondi jacopo at jmondi.org
Wed Sep 4 14:54:25 CEST 2019


The android control.CaptureIntent metadata tag which is returned as part
of the constructed template shall depend on the template type provided
to the construct_default_request_settings() HAL callback.

Currently the libcamera HAL implementation fixes its value the first
time the template is constructed and never updates it.

Fix this by updating the metadata tag value using the provided template
type.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/android/camera_device.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 969c8192c316..e96821ad523b 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -544,8 +544,18 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)
 		return nullptr;
 	}
 
-	if (requestTemplate_)
+	if (requestTemplate_) {
+		camera_metadata_entry_t captureIntentEntry;
+
+		find_camera_metadata_entry(requestTemplate_,
+			ANDROID_CONTROL_CAPTURE_INTENT, &captureIntentEntry);
+		ret = update_camera_metadata_entry(requestTemplate_,
+				captureIntentEntry.index,
+				&captureIntent, 1, &captureIntentEntry);
+		METADATA_ASSERT(ret);
+
 		return requestTemplate_;
+	}
 
 	/* \todo Use correct sizes */
 	#define REQUEST_TEMPLATE_ENTRIES	  30
-- 
2.23.0



More information about the libcamera-devel mailing list