[{"id":26035,"web_url":"https://patchwork.libcamera.org/comment/26035/","msgid":"<CAEmqJPprg8J9TvVe3hY+pkt-qxqBrf5+gZU-sw_FLnskOU9RpA@mail.gmail.com>","date":"2022-12-09T14:20:02","subject":"Re: [libcamera-devel] [PATCH] py: Support controls that use an\n\tarray of Rectangles","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThank you for your patch.\n\nOn Thu, 8 Dec 2022 at 13:44, David Plowman via libcamera-devel <\nlibcamera-devel@lists.libcamera.org> wrote:\n\n> The Python bindings will now accept, or return, a list or tuple of\n> libcamera.Rectangle objects for such controls.\n>\n> This had previously been omitted, but now we have, for example, the\n> AfWindows control which requires this feature.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n> ---\n>  src/py/libcamera/py_helpers.cpp | 8 +++-----\n>  1 file changed, 3 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/py/libcamera/py_helpers.cpp\n> b/src/py/libcamera/py_helpers.cpp\n> index f685e606..79891ab6 100644\n> --- a/src/py/libcamera/py_helpers.cpp\n> +++ b/src/py/libcamera/py_helpers.cpp\n> @@ -46,10 +46,8 @@ py::object controlValueToPy(const ControlValue &cv)\n>                 return valueOrTuple<float>(cv);\n>         case ControlTypeString:\n>                 return py::cast(cv.get<std::string>());\n> -       case ControlTypeRectangle: {\n> -               const Rectangle *v = reinterpret_cast<const Rectangle\n> *>(cv.data().data());\n> -               return py::cast(v);\n> -       }\n> +       case ControlTypeRectangle:\n> +               return valueOrTuple<Rectangle>(cv);\n>         case ControlTypeSize: {\n>                 const Size *v = reinterpret_cast<const Size\n> *>(cv.data().data());\n>                 return py::cast(v);\n> @@ -88,7 +86,7 @@ ControlValue pyToControlValue(const py::object &ob,\n> ControlType type)\n>         case ControlTypeString:\n>                 return ControlValue(ob.cast<std::string>());\n>         case ControlTypeRectangle:\n> -               return ControlValue(ob.cast<Rectangle>());\n> +               return controlValueMaybeArray<Rectangle>(ob);\n>         case ControlTypeSize:\n>                 return ControlValue(ob.cast<Size>());\n>         case ControlTypeNone:\n> --\n> 2.30.2\n>\n>","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 2C24ABE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Dec 2022 14:20:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 82C7F61F1C;\n\tFri,  9 Dec 2022 15:20:20 +0100 (CET)","from mail-io1-xd33.google.com (mail-io1-xd33.google.com\n\t[IPv6:2607:f8b0:4864:20::d33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52AE461F1B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Dec 2022 15:20:18 +0100 (CET)","by mail-io1-xd33.google.com with SMTP id d123so2079672iof.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 09 Dec 2022 06:20:18 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670595620;\n\tbh=Ujvu2dzuVDbDjhm2EiSPhOUD5OKecAfz6dkWyiMQKK8=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=FtlgU3LQRU16Em5PjknDLTPc51pZwB6IY7qwS3Xn8kBpGRnZpd1xet/7V3WUGeu5+\n\twUHv08KMFKO//C7alPL12IOmvbnPt1qsCbfiQLSxRWskt3PqcXJ2GOJFeMXz/ARORG\n\t1ztQ2mt6/tZ0j0rTTswwcdNV4oNk2As1Awn2tGEXk80MkGdnyZ7zZOS3H+pU06m2nq\n\tpWFu7Pi3/5PXbBfoGaJMVUwbQ0kxE8IH+WohatfAywp9n+hC3jUZqIZV34z4pALsVA\n\tIwV/0pkkyT4TIiFbuIvP9Ub0o3l/9AN2opiBIoiV9GZycAfEAF5dFEgrMknyruojct\n\tA4BkrLeEdIKRg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=gFByH57+s+xSsNcG+EHwSkYtd9ELoId2wOzIG6tTClc=;\n\tb=aTMRYRJPLEeft58MM3vC5nE1lIead9+ZW42183MsA8e9jguvnFCNdBD9DYzpvpW+Gr\n\tb3pNfMDC37TQDZmNgNy+wSQKgiWB2ocFR/E1I9Eg64EjnWvOp0x6oWFce0aov8VyTmIq\n\t4o0SvR0oIPVUP8yy8vwkEAPPDJPqxyMrO2O7rzTujRSTN2oob8X6rlczbinh7x0qTkj5\n\t4TMf0a4h6TKxNh+ZLSd3kaV/HHdVyYdQPsTN2sJbvyO5+jQ66EgO6PLkJ4Eudut7+8k/\n\t8NU0p0kRcJuvlG5GDM5kIyw6HIRGWgO5lqaq0iNrdoP1KKkru6ePAZUezZwlRIoJd0MX\n\trULw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"aTMRYRJP\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=gFByH57+s+xSsNcG+EHwSkYtd9ELoId2wOzIG6tTClc=;\n\tb=mEJrf2M3Wmt3tF+4AkSSnwK2oxBdyS8GOM/Zj5D0RbLoffJUP4zDO4cioDO58bWpeZ\n\tQB+DwZ5RrqP9wy3GMN4Th1I8lxJJYhu6LZ2NBIjB2wkHwhQYUDNkhtN4hyqZd6QIAMJ+\n\tZlal9lwTQKzJfoMngytEYskrzJEwMEBvuMlYw1+MHmqb2wwrA6cH75mX4IVH8gqNDfeu\n\tbfA6kGqp5Wb+RGt6Mv1l3sS9hsn720QXDGvBBf8eydgOo9ycRnBYmkGto7GAeA4sJqll\n\tu/gQpI5qXvj4wEa3LYHV2fY4KhN+JYtB/nbZOVbLf9eex/1CRH0JDBXAjIQ0WC9QheOu\n\tzreg==","X-Gm-Message-State":"ANoB5pkd7uCditRWVZ759dpITph1VYCcl8dhGiTbelXmo4UIJQ+GnWG5\n\tGsQUukPOLxO0Fn96KvR89bqqhRPJAxrYxLCtarF5Dg==","X-Google-Smtp-Source":"AA0mqf43eQsDWgNrerA2lfHzAV+OnCfpOyMEM+YJG7TeG3LOeSvqyhWB37Gowqz+4U8gwFZgAuX1YBdEUp94T0c9Rp0=","X-Received":"by 2002:a6b:c84f:0:b0:6e0:2b9e:b1c4 with SMTP id\n\ty76-20020a6bc84f000000b006e02b9eb1c4mr4580986iof.186.1670595616992;\n\tFri, 09 Dec 2022 06:20:16 -0800 (PST)","MIME-Version":"1.0","References":"<20221208134414.2917-1-david.plowman@raspberrypi.com>","In-Reply-To":"<20221208134414.2917-1-david.plowman@raspberrypi.com>","Date":"Fri, 9 Dec 2022 14:20:02 +0000","Message-ID":"<CAEmqJPprg8J9TvVe3hY+pkt-qxqBrf5+gZU-sw_FLnskOU9RpA@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Content-Type":"multipart/alternative; boundary=\"0000000000005091b605ef65dafd\"","Subject":"Re: [libcamera-devel] [PATCH] py: Support controls that use an\n\tarray of Rectangles","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26036,"web_url":"https://patchwork.libcamera.org/comment/26036/","msgid":"<72ca3b79-738b-564e-9320-ce621d6a0c85@ideasonboard.com>","date":"2022-12-09T15:34:07","subject":"Re: [libcamera-devel] [PATCH] py: Support controls that use an\n\tarray of Rectangles","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 08/12/2022 15:44, David Plowman via libcamera-devel wrote:\n> The Python bindings will now accept, or return, a list or tuple of\n> libcamera.Rectangle objects for such controls.\n> \n> This had previously been omitted, but now we have, for example, the\n> AfWindows control which requires this feature.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n\nReviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\n  Tomi","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 6E98EBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Dec 2022 15:34:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BE4D261F1C;\n\tFri,  9 Dec 2022 16:34:12 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CB2B561F1B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Dec 2022 16:34:10 +0100 (CET)","from [192.168.1.15] (91-154-32-225.elisa-laajakaista.fi\n\t[91.154.32.225])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 42027480;\n\tFri,  9 Dec 2022 16:34:10 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670600052;\n\tbh=Dv/e7W9l4EM94U+cykBCUlVgo++H94CUCTZYk5P+fRo=;\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:\n\tFrom;\n\tb=dufHae5TyBnri2fVk2z8822OgxJfQDeFfSoyS7r7YBYVIJAx7daiq55R4UyqIcgHU\n\tMe+141LsiJOnQ4TFsoGV5/1nTw1J8jCMfpIdVNtaGnHjnHrOjSj74sD8C5Gi+bWr7i\n\t5Wy9ZlDyQvxNUM0edituRSlAzwqpuT1MBwWWaUnbESzIX/4ElpbWpDVQFuqJFaD48V\n\tpnwbe9LjPYuEWQL/uJJAIDR+6eLLHrQQbBAZ3iMQODgTtU6MO6NsSc6p0L2+/qVJZu\n\tsrS03G2fnACfKt7IilzuTgPzltPVPF0k5iazE3SikvZn8JAMAhOVCUTn/9RSyDLAP9\n\tfKHGKFYj8MhkA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1670600050;\n\tbh=Dv/e7W9l4EM94U+cykBCUlVgo++H94CUCTZYk5P+fRo=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=RlO83g++SSt5CuofWxo6+CkBVLKZCB+tPD9V2FT9LJC4cQvHYSZ9FFn15QtpPqP6l\n\tpt6L3s2ff9vykBrGAq8vL7qnqg7RCSFBRQcialuz4P+y+CKCKeDxQGkzRP688pKdF4\n\tXShn6KgoIah+YSghQP+rSeONiu7bcDp9ydp5XJM0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RlO83g++\"; dkim-atps=neutral","Message-ID":"<72ca3b79-738b-564e-9320-ce621d6a0c85@ideasonboard.com>","Date":"Fri, 9 Dec 2022 17:34:07 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.4.2","Content-Language":"en-US","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20221208134414.2917-1-david.plowman@raspberrypi.com>","In-Reply-To":"<20221208134414.2917-1-david.plowman@raspberrypi.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] py: Support controls that use an\n\tarray of Rectangles","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]