{"id":11518,"url":"https://patchwork.libcamera.org/api/patches/11518/?format=json","web_url":"https://patchwork.libcamera.org/patch/11518/","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":"<20210308170728.2212649-3-jacopo@jmondi.org>","date":"2021-03-08T17:07:27","name":"[libcamera-devel,2/3] android: camera_device: Fail template on no FPS range","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"31b996c1259ee9823004e51aa799089f67bd825e","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/11518/mbox/","series":[{"id":1770,"url":"https://patchwork.libcamera.org/api/series/1770/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1770","date":"2021-03-08T17:07:25","name":"android: Fix capture templates for video recording","version":1,"mbox":"https://patchwork.libcamera.org/series/1770/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11518/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11518/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 7D363BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Mar 2021 17:07:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E5E3F68AB1;\n\tMon,  8 Mar 2021 18:07:10 +0100 (CET)","from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE66B68AA4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Mar 2021 18:07:08 +0100 (CET)","from uno.homenet.telecomitalia.it\n\t(host-79-22-58-175.retail.telecomitalia.it [79.22.58.175])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 662E920000E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Mar 2021 17:07:08 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  8 Mar 2021 18:07:27 +0100","Message-Id":"<20210308170728.2212649-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.30.0","In-Reply-To":"<20210308170728.2212649-1-jacopo@jmondi.org>","References":"<20210308170728.2212649-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 2/3] android: camera_device: Fail template\n\ton no FPS range","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":"The camera supported FPS range is crucial to distinguish between\ncapture templates for preview and video recording. If the pipeline\nhandler did not specify an available FPS range by registering the\ncontrols::FrameDurations property so far the control was simply not\nadded to the generated capture template.\n\nIn order to prepare to generate templates for video recording which\nrequire a fixed FPS range, fail earlier in generating any template at\nall if the available FPS range is not provided by the Camera.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 36 +++++++++++++++++++----------------\n 1 file changed, 20 insertions(+), 16 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex c72e0c73eb5e..0621ec26feb8 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1386,6 +1386,26 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n \t\treturn nullptr;\n \t}\n \n+\t/* Get the FPS range registered in the static metadata. */\n+\tcamera_metadata_ro_entry_t entry;\n+\tbool found = staticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,\n+\t\t\t\t\t       &entry);\n+\tif (!found) {\n+\t\tLOG(HAL, Error) << \"Cannot create capture template without FPS range\";\n+\t\treturn nullptr;\n+\t}\n+\n+\t/*\n+\t * \\todo Depending on the requested CaptureIntent, the FPS range\n+\t * needs to be adjusted. For example, the capture template for\n+\t * video capture intent shall report a fixed value.\n+\t *\n+\t * Also assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n+\t * has been assembled as {{min, max} {max, max}}.\n+\t */\n+\trequestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n+\t\t\t\t  entry.data.i32, 2);\n+\n \tuint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON;\n \trequestTemplate->addEntry(ANDROID_CONTROL_AE_MODE,\n \t\t\t\t  &aeMode, 1);\n@@ -1402,22 +1422,6 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n \trequestTemplate->addEntry(ANDROID_CONTROL_AE_LOCK,\n \t\t\t\t  &aeLock, 1);\n \n-\t/* Get the FPS range registered in the static metadata. */\n-\tcamera_metadata_ro_entry_t entry;\n-\tbool found = staticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,\n-\t\t\t\t\t       &entry);\n-\tif (found)\n-\t\t/*\n-\t\t * \\todo Depending on the requested CaptureIntent, the FPS range\n-\t\t * needs to be adjusted. For example, the capture template for\n-\t\t * video capture intent shall report a fixed value.\n-\t\t *\n-\t\t * Also assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n-\t\t * has been assembled as {{min, max} {max, max}}.\n-\t\t */\n-\t\trequestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n-\t\t\t\t\t  entry.data.i32, 2);\n-\n \tuint8_t aeAntibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO;\n \trequestTemplate->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE,\n \t\t\t\t  &aeAntibandingMode, 1);\n","prefixes":["libcamera-devel","2/3"]}