{"id":21685,"url":"https://patchwork.libcamera.org/api/patches/21685/?format=json","web_url":"https://patchwork.libcamera.org/patch/21685/","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":"<20241018145856.914816-5-stefan.klug@ideasonboard.com>","date":"2024-10-18T14:58:38","name":"[v2,4/4] pycamera: Add missing code for ControlTypePoint","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"217302df1a33ca17d0e1df1cd3577dc209f5f598","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21685/mbox/","series":[{"id":4720,"url":"https://patchwork.libcamera.org/api/series/4720/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4720","date":"2024-10-18T14:58:34","name":"A few small fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/4720/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21685/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21685/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 81E3DC32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 14:59:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F8F96538F;\n\tFri, 18 Oct 2024 16:59:15 +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 9333D6538A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 16:59:11 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:77a0:ddb9:22bf:b8d9])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C9142514;\n\tFri, 18 Oct 2024 16:57:27 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Vn11++Dt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729263447;\n\tbh=ChoflgYzHLwzEK6erfk9LwIgLxPfLPtRhkvqJyf/PZ4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Vn11++DtzAvo5h5OBWoOUsGUedgLEo1TMGfvzukd+qvOkoLIMrug1beI8wJMnN6Ek\n\tBu3IFkwa02HO/358HCMDpNo0oS8Ag9pEruIqphhpwB7x1iljfc/ozN3KC/o+/VNARZ\n\t9qsaJ/VwK9lazt3mdGz15OnbojFNMkzD/hrn3g28=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v2 4/4] pycamera: Add missing code for ControlTypePoint","Date":"Fri, 18 Oct 2024 16:58:38 +0200","Message-ID":"<20241018145856.914816-5-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20241018145856.914816-1-stefan.klug@ideasonboard.com>","References":"<20241018145856.914816-1-stefan.klug@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"In the python bindings ControlTypePoint is not handled in the\ncorresponding conversion functions. Add that.\n\nWhile at it, sort the listings in the same order as the enum in\ncontrols.h.\n\nFixes: 200d535ca85f (\"libcamera: controls: Add ControlTypePoint\")\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- Collected tags\n---\n src/py/libcamera/py_enums.cpp   |  3 ++-\n src/py/libcamera/py_helpers.cpp | 16 ++++++++++------\n 2 files changed, 12 insertions(+), 7 deletions(-)","diff":"diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp\nindex ca6aeb868cbe..9e75ec1a97b3 100644\n--- a/src/py/libcamera/py_enums.cpp\n+++ b/src/py/libcamera/py_enums.cpp\n@@ -32,7 +32,8 @@ void init_py_enums(py::module &m)\n \t\t.value(\"Float\", ControlType::ControlTypeFloat)\n \t\t.value(\"String\", ControlType::ControlTypeString)\n \t\t.value(\"Rectangle\", ControlType::ControlTypeRectangle)\n-\t\t.value(\"Size\", ControlType::ControlTypeSize);\n+\t\t.value(\"Size\", ControlType::ControlTypeSize)\n+\t\t.value(\"Point\", ControlType::ControlTypePoint);\n \n \tpy::enum_<Orientation>(m, \"Orientation\")\n \t\t.value(\"Rotate0\", Orientation::Rotate0)\ndiff --git a/src/py/libcamera/py_helpers.cpp b/src/py/libcamera/py_helpers.cpp\nindex 79891ab63862..1ad1d4c1a1cd 100644\n--- a/src/py/libcamera/py_helpers.cpp\n+++ b/src/py/libcamera/py_helpers.cpp\n@@ -34,6 +34,8 @@ static py::object valueOrTuple(const ControlValue &cv)\n py::object controlValueToPy(const ControlValue &cv)\n {\n \tswitch (cv.type()) {\n+\tcase ControlTypeNone:\n+\t\treturn py::none();\n \tcase ControlTypeBool:\n \t\treturn valueOrTuple<bool>(cv);\n \tcase ControlTypeByte:\n@@ -46,14 +48,14 @@ py::object controlValueToPy(const ControlValue &cv)\n \t\treturn valueOrTuple<float>(cv);\n \tcase ControlTypeString:\n \t\treturn py::cast(cv.get<std::string>());\n-\tcase ControlTypeRectangle:\n-\t\treturn valueOrTuple<Rectangle>(cv);\n \tcase ControlTypeSize: {\n \t\tconst Size *v = reinterpret_cast<const Size *>(cv.data().data());\n \t\treturn py::cast(v);\n \t}\n-\tcase ControlTypeNone:\n-\t\treturn py::none();\n+\tcase ControlTypeRectangle:\n+\t\treturn valueOrTuple<Rectangle>(cv);\n+\tcase ControlTypePoint:\n+\t\treturn valueOrTuple<Point>(cv);\n \tdefault:\n \t\tthrow std::runtime_error(\"Unsupported ControlValue type\");\n \t}\n@@ -73,6 +75,8 @@ static ControlValue controlValueMaybeArray(const py::object &ob)\n ControlValue pyToControlValue(const py::object &ob, ControlType type)\n {\n \tswitch (type) {\n+\tcase ControlTypeNone:\n+\t\treturn ControlValue();\n \tcase ControlTypeBool:\n \t\treturn ControlValue(ob.cast<bool>());\n \tcase ControlTypeByte:\n@@ -89,8 +93,8 @@ ControlValue pyToControlValue(const py::object &ob, ControlType type)\n \t\treturn controlValueMaybeArray<Rectangle>(ob);\n \tcase ControlTypeSize:\n \t\treturn ControlValue(ob.cast<Size>());\n-\tcase ControlTypeNone:\n-\t\treturn ControlValue();\n+\tcase ControlTypePoint:\n+\t\treturn controlValueMaybeArray<Point>(ob);\n \tdefault:\n \t\tthrow std::runtime_error(\"Control type not implemented\");\n \t}\n","prefixes":["v2","4/4"]}