{"id":21695,"url":"https://patchwork.libcamera.org/api/1.1/patches/21695/?format=json","web_url":"https://patchwork.libcamera.org/patch/21695/","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":"<20241018160638.936993-5-stefan.klug@ideasonboard.com>","date":"2024-10-18T16:06:33","name":"[v4,4/4] pycamera: Add missing code for ControlTypePoint","commit_ref":"2460049b67660500a74537e5d7c073d265122834","pull_url":null,"state":"accepted","archived":false,"hash":"217302df1a33ca17d0e1df1cd3577dc209f5f598","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21695/mbox/","series":[{"id":4722,"url":"https://patchwork.libcamera.org/api/1.1/series/4722/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4722","date":"2024-10-18T16:06:29","name":"A few small fixes","version":4,"mbox":"https://patchwork.libcamera.org/series/4722/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21695/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21695/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 D3599C32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 16:06:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7FF9365399;\n\tFri, 18 Oct 2024 18:06:56 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 25D2C65396\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 18:06:54 +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 5150721C;\n\tFri, 18 Oct 2024 18:05:10 +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=\"T0pDom2R\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729267510;\n\tbh=ChoflgYzHLwzEK6erfk9LwIgLxPfLPtRhkvqJyf/PZ4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=T0pDom2RgyeNWJKY4vu9oD0u12IwXQqpgmNEO0fmxJmDdKs2nScMWzKak8fnNZmpK\n\tpz/lMuOuKbUmvui8v0caYFcl0ltEdiMMwBT8q40uCtH6pgKI5fqXtEvz60ecX6sQYA\n\tgNvXVTn8CdIFEPdYXrkJMz8bTkULEPxWilqoWIYI=","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 v4 4/4] pycamera: Add missing code for ControlTypePoint","Date":"Fri, 18 Oct 2024 18:06:33 +0200","Message-ID":"<20241018160638.936993-5-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20241018160638.936993-1-stefan.klug@ideasonboard.com>","References":"<20241018160638.936993-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":["v4","4/4"]}