[libcamera-devel] [PATCH 5/7] android: camera_device: Clone settings in request descriptor

Jacopo Mondi jacopo at jmondi.org
Thu Jan 21 17:53:03 CET 2021


When a Camera3RequestDescriptor instance is created to wrap a
camera3_capture_request_t the settings associated with the request
are cloned for later re-use.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/android/camera_device.cpp | 4 +++-
 src/android/camera_device.h   | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 578fb2271a9e..9733c84612bd 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -22,7 +22,6 @@
 #include "libcamera/internal/log.h"
 #include "libcamera/internal/utils.h"
 
-#include "camera_metadata.h"
 #include "system/graphics.h"
 
 using namespace libcamera;
@@ -311,6 +310,9 @@ CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(
 	 */
 	frameBuffers_.reserve(numBuffers_);
 
+	/* Clone the controls associated with the camera3 request. */
+	settings_ = CameraMetadata(camera3Request->settings);
+
 	/*
 	 * Create the libcamera::Request unique_ptr<> to tie its lifetime
 	 * to the descriptor's one. Set the descriptor's address as the
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index ab3c848edd0a..bad3be8e8066 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -24,12 +24,11 @@
 #include "libcamera/internal/log.h"
 #include "libcamera/internal/message.h"
 
+#include "camera_metadata.h"
 #include "camera_stream.h"
 #include "camera_worker.h"
 #include "jpeg/encoder.h"
 
-class CameraMetadata;
-
 class MappedCamera3Buffer : public libcamera::MappedBuffer
 {
 public:
@@ -82,6 +81,7 @@ private:
 		uint32_t numBuffers_;
 		camera3_stream_buffer_t *buffers_;
 		std::vector<std::unique_ptr<libcamera::FrameBuffer>> frameBuffers_;
+		CameraMetadata settings_;
 		std::unique_ptr<CaptureRequest> request_;
 	};
 
-- 
2.29.2



More information about the libcamera-devel mailing list