From patchwork Fri Mar 8 10:42:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 19643 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 1DFBBBD160 for ; Fri, 8 Mar 2024 10:42:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 60E026286F; Fri, 8 Mar 2024 11:42:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="j10G9Rs9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C95F461C85 for ; Fri, 8 Mar 2024 11:42:32 +0100 (CET) Received: from localhost.localdomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A192D552; Fri, 8 Mar 2024 11:42:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1709894533; bh=C8tI18VxyDXTxnQSohYHj6lPNZwxiX11dfbWdAKwZ/0=; h=From:To:Cc:Subject:Date:From; b=j10G9Rs97k4Es3JgQV06yHZXXhkYWNQCOepb4EFccJ/u7+d6UjiNEziJGLbg3mOEj os2i1y4gTDlXMcUI0zEGBvR82geN2yKag8VMEgwdL9M83jKZXQ3fjwMGYRydlNM0tW wYWUGdVnaeG4JZ9y1Ck5RxO2R+wfmTZwfIvVo7aM= From: Jacopo Mondi 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 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: , Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Paul Elder parseRectangles currently always parses Rectangle controls as an array of Rectangles. This causes non-array Rectangle controls to not be parsed correctly, as when the ControlValue is get()ed, the non-array assertion will fail. Set the ControlValue with a single Rectangle in case a single Rectangle has been specified in the yaml capture script to fix that. Signed-off-by: Paul Elder Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain --- src/apps/cam/capture_script.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apps/cam/capture_script.cpp b/src/apps/cam/capture_script.cpp index 062a7258e414..1215713fac18 100644 --- a/src/apps/cam/capture_script.cpp +++ b/src/apps/cam/capture_script.cpp @@ -351,7 +351,10 @@ ControlValue CaptureScript::parseRectangles() } ControlValue controlValue; - controlValue.set(Span(rectangles)); + if (rectangles.size() == 1) + controlValue.set(rectangles.at(0)); + else + controlValue.set(Span(rectangles)); return controlValue; }