[{"id":22870,"web_url":"https://patchwork.libcamera.org/comment/22870/","msgid":"<YnQRZ8Pn0w1dmv1O@pendragon.ideasonboard.com>","date":"2022-05-05T18:03:19","subject":"Re: [libcamera-devel] [PATCH v7 12/13] py: add support for setting\n\tRectangle and Size controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi and David,\n\nThank you for the patch.\n\nOn Thu, May 05, 2022 at 01:41:03PM +0300, Tomi Valkeinen wrote:\n> From: David Plowman <david.plowman@raspberrypi.com>\n> \n> Allows, for example, ScalerCrop to be controlled for digital zoom.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/py/libcamera/pymain.cpp | 10 ++++++++--\n>  1 file changed, 8 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/pymain.cpp\n> index 6375e326..b9b52f6b 100644\n> --- a/src/py/libcamera/pymain.cpp\n> +++ b/src/py/libcamera/pymain.cpp\n> @@ -101,8 +101,14 @@ static ControlValue PyToControlValue(const py::object &ob, ControlType type)\n>  \t\treturn ControlValueMaybeArray<float>(ob);\n>  \tcase ControlTypeString:\n>  \t\treturn ControlValue(ob.cast<string>());\n> -\tcase ControlTypeRectangle:\n> -\tcase ControlTypeSize:\n> +\tcase ControlTypeRectangle: {\n> +\t\tauto array = ob.cast<std::array<int32_t, 4>>();\n> +\t\treturn ControlValue(Rectangle(array[0], array[1], array[2], array[3]));\n> +\t}\n> +\tcase ControlTypeSize: {\n> +\t\tauto array = ob.cast<std::array<int32_t, 2>>();\n> +\t\treturn ControlValue(Size(array[0], array[1]));\n> +\t}\n>  \tcase ControlTypeNone:\n>  \tdefault:\n>  \t\tthrow runtime_error(\"Control type not implemented\");","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 727A7C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 May 2022 18:03:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2381965643;\n\tThu,  5 May 2022 20:03:24 +0200 (CEST)","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 AEBC3603AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 May 2022 20:03:22 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 49067492;\n\tThu,  5 May 2022 20:03:22 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651773804;\n\tbh=xfW5OGFDt5AgHP8H0FInFAgrtzs5DZABW26fpvmHGjg=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=0ve2BDZ+kOGOCOFCUK445Wg/UJMr5HfhOAxAF5gxRMKHS03o6vFIdCX+VEPdAb2QI\n\tcR7ha/giOdzjSTsfUio6YWhMe3DO9C1LPqrREGO9ttGc6fcKdtiADaLrnSrSJzdqVS\n\t1MreobWMTMirUpPF4GHIl2Bw0aMmzaZ026OxyDkwa+wxcuFSx7LF+/lRz739tYcEG3\n\tz273O4EdFzZWQ2S9xjOXYngqcIR6Hlr0vbx/6FoSU57IGhk2D3ACkKBk8RjYUvUcom\n\taaQyCBdrBlxZAcv9Nz2eBjeJlryjadrl4u/1xih9x7tEenhkJ9EsR84lP2Emn32LrP\n\tItSB0MIbX6Bdg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651773802;\n\tbh=xfW5OGFDt5AgHP8H0FInFAgrtzs5DZABW26fpvmHGjg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=WnXFATKxOzgY0m+0bOgQz2P1NHM2DTadQTo50RURLanZ+ea9X0EyGit0ZKmL+2Xo3\n\tJI/RAf8IaQywf68PKMun1irNnmAvtBUOTxvPU0jeXWLOaJhAHTB6+MoHWPwzvau1mx\n\ttVlmeHt4PsPkvbuwHQJlRypJ/Sk6Wk11RoFfoNb0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WnXFATKx\"; dkim-atps=neutral","Date":"Thu, 5 May 2022 21:03:19 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YnQRZ8Pn0w1dmv1O@pendragon.ideasonboard.com>","References":"<20220505104104.70841-1-tomi.valkeinen@ideasonboard.com>\n\t<20220505104104.70841-13-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220505104104.70841-13-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v7 12/13] py: add support for setting\n\tRectangle and Size controls","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]