{"id":19643,"url":"https://patchwork.libcamera.org/api/1.1/patches/19643/?format=json","web_url":"https://patchwork.libcamera.org/patch/19643/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20240308104219.52676-1-jacopo.mondi@ideasonboard.com>","date":"2024-03-08T10:42:18","name":"cam: capture_script: Make parseRectangles work for non-array","commit_ref":"01935edbba586df820db002671da7bd0a348ad8e","pull_url":null,"state":"accepted","archived":false,"hash":"1bb9db99eb65e0a0aba951e00d5d7eff976df13b","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19643/mbox/","series":[{"id":4206,"url":"https://patchwork.libcamera.org/api/1.1/series/4206/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4206","date":"2024-03-08T10:42:18","name":"cam: capture_script: Make parseRectangles work for non-array","version":1,"mbox":"https://patchwork.libcamera.org/series/4206/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19643/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19643/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 1DFBBBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Mar 2024 10:42:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 60E026286F;\n\tFri,  8 Mar 2024 11:42:34 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C95F461C85\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Mar 2024 11:42:32 +0100 (CET)","from localhost.localdomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A192D552;\n\tFri,  8 Mar 2024 11:42:13 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"j10G9Rs9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1709894533;\n\tbh=C8tI18VxyDXTxnQSohYHj6lPNZwxiX11dfbWdAKwZ/0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=j10G9Rs97k4Es3JgQV06yHZXXhkYWNQCOepb4EFccJ/u7+d6UjiNEziJGLbg3mOEj\n\tos2i1y4gTDlXMcUI0zEGBvR82geN2yKag8VMEgwdL9M83jKZXQ3fjwMGYRydlNM0tW\n\twYWUGdVnaeG4JZ9y1Ck5RxO2R+wfmTZwfIvVo7aM=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH] cam: capture_script: Make parseRectangles work for non-array","Date":"Fri,  8 Mar 2024 11:42:18 +0100","Message-ID":"<20240308104219.52676-1-jacopo.mondi@ideasonboard.com>","X-Mailer":"git-send-email 2.43.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Paul Elder <paul.elder@ideasonboard.com>\n\nparseRectangles currently always parses Rectangle controls as an array\nof Rectangles. This causes non-array Rectangle controls to not be parsed\ncorrectly, as when the ControlValue is get()ed, the non-array assertion\nwill fail.\n\nSet the ControlValue with a single Rectangle in case a single Rectangle\nhas been specified in the yaml capture script to fix that.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/apps/cam/capture_script.cpp | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)","diff":"diff --git a/src/apps/cam/capture_script.cpp b/src/apps/cam/capture_script.cpp\nindex 062a7258e414..1215713fac18 100644\n--- a/src/apps/cam/capture_script.cpp\n+++ b/src/apps/cam/capture_script.cpp\n@@ -351,7 +351,10 @@ ControlValue CaptureScript::parseRectangles()\n \t}\n \n \tControlValue controlValue;\n-\tcontrolValue.set(Span<const Rectangle>(rectangles));\n+\tif (rectangles.size() == 1)\n+\t\tcontrolValue.set(rectangles.at(0));\n+\telse\n+\t\tcontrolValue.set(Span<const Rectangle>(rectangles));\n \n \treturn controlValue;\n }\n","prefixes":[]}