From patchwork Fri Jan 29 14:26:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11059 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AB96BC33BB for ; Fri, 29 Jan 2021 14:26:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 322D5683BB; Fri, 29 Jan 2021 15:26:04 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 735D5683AD for ; Fri, 29 Jan 2021 15:26:00 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 39F7F2000F for ; Fri, 29 Jan 2021 14:26:00 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 29 Jan 2021 15:26:15 +0100 Message-Id: <20210129142615.669464-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210129142615.669464-1-jacopo@jmondi.org> References: <20210129142615.669464-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] android: camera_device: Use reference to settings X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In preparation to use the keys part of a capture request to fill in the result metadata, instantiate a reference to descriptor_->settings_ and use it. While at it, move the 'ret' variable declaration to the beginning of the function and rename it in 'found', as it will be used in many places and move the \todo comment up as it applies to all metadata whose value is copied from settings. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Paul Elder --- src/android/camera_device.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index b66e7c71884a..0c424978838d 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1936,7 +1936,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, int64_t timestamp) { const ControlList &metadata = descriptor->request_->metadata(); + const CameraMetadata &settings = descriptor->settings_; camera_metadata_ro_entry_t entry; + bool found; /* * \todo Keep this in sync with the actual number of entries. @@ -1961,6 +1963,12 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, return nullptr; } + /* + * \todo The value of the results metadata copied from the settings + * will have to be passed to the libcamera::Camera and extracted + * from libcamera::Request::metadata. + */ + uint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF; resultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1); @@ -1975,10 +1983,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, aeFpsTarget.data(), aeFpsTarget.size()); value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE; - /* \todo Handle IPA appropriately */ - bool ret = descriptor->settings_.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry); + found = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry); resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, - ret ? entry.data.u8 : &value, 1); + found ? entry.data.u8 : &value, 1); value = ANDROID_CONTROL_AE_STATE_CONVERGED; resultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1); @@ -2022,8 +2029,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, value = ANDROID_FLASH_STATE_UNAVAILABLE; resultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1); - ret = descriptor->settings_.getEntry(ANDROID_LENS_APERTURE, &entry); - if (ret) + if (settings.getEntry(ANDROID_LENS_APERTURE, &entry)) resultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1); float focal_length = 1.0;