{"id":11059,"url":"https://patchwork.libcamera.org/api/patches/11059/?format=json","web_url":"https://patchwork.libcamera.org/patch/11059/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210129142615.669464-4-jacopo@jmondi.org>","date":"2021-01-29T14:26:15","name":"[libcamera-devel,3/3] android: camera_device: Use reference to settings","commit_ref":"94d42ce0143ed683b979a69b4ad4b76ec924347c","pull_url":null,"state":"accepted","archived":false,"hash":"772a412fe48c31894de0199e28fc0cc92f50c9fd","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11059/mbox/","series":[{"id":1626,"url":"https://patchwork.libcamera.org/api/series/1626/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1626","date":"2021-01-29T14:26:12","name":"android: Add missing Request keys","version":1,"mbox":"https://patchwork.libcamera.org/series/1626/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11059/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11059/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AB96BC33BB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 29 Jan 2021 14:26:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 322D5683BB;\n\tFri, 29 Jan 2021 15:26:04 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 735D5683AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 15:26:00 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 39F7F2000F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 14:26:00 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","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\n\tto settings","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"In preparation to use the keys part of a capture request to\nfill in the result metadata, instantiate a reference to\ndescriptor_->settings_ and use it.\n\nWhile at it, move the 'ret' variable declaration to the beginning of\nthe function and rename it in 'found', as it will be used in many\nplaces and move the \\todo comment up as it applies to all metadata\nwhose value is copied from settings.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 16 +++++++++++-----\n 1 file changed, 11 insertions(+), 5 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex b66e7c71884a..0c424978838d 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1936,7 +1936,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n \t\t\t\tint64_t timestamp)\n {\n \tconst ControlList &metadata = descriptor->request_->metadata();\n+\tconst CameraMetadata &settings = descriptor->settings_;\n \tcamera_metadata_ro_entry_t entry;\n+\tbool found;\n \n \t/*\n \t * \\todo Keep this in sync with the actual number of entries.\n@@ -1961,6 +1963,12 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n \t\treturn nullptr;\n \t}\n \n+\t/*\n+\t * \\todo The value of the results metadata copied from the settings\n+\t * will have to be passed to the libcamera::Camera and extracted\n+\t * from libcamera::Request::metadata.\n+\t */\n+\n \tuint8_t value = ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF;\n \tresultMetadata->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &value, 1);\n \n@@ -1975,10 +1983,9 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n \t\t\t\t aeFpsTarget.data(), aeFpsTarget.size());\n \n \tvalue = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;\n-\t/* \\todo Handle IPA appropriately */\n-\tbool ret = descriptor->settings_.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);\n+\tfound = settings.getEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &entry);\n \tresultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,\n-\t\t\t\t ret ? entry.data.u8 : &value, 1);\n+\t\t\t\t found ? entry.data.u8 : &value, 1);\n \n \tvalue = ANDROID_CONTROL_AE_STATE_CONVERGED;\n \tresultMetadata->addEntry(ANDROID_CONTROL_AE_STATE, &value, 1);\n@@ -2022,8 +2029,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n \tvalue = ANDROID_FLASH_STATE_UNAVAILABLE;\n \tresultMetadata->addEntry(ANDROID_FLASH_STATE, &value, 1);\n \n-\tret = descriptor->settings_.getEntry(ANDROID_LENS_APERTURE, &entry);\n-\tif (ret)\n+\tif (settings.getEntry(ANDROID_LENS_APERTURE, &entry))\n \t\tresultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1);\n \n \tfloat focal_length = 1.0;\n","prefixes":["libcamera-devel","3/3"]}