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

Message ID 20190904125427.13943-6-jacopo@jmondi.org
State Superseded
Headers show
Series
  • android: Rework metadata tags
Related show

Commit Message

Jacopo Mondi Sept. 4, 2019, 12:54 p.m. UTC
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@jmondi.org>
---
 src/android/camera_device.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch

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