[PATCH] py: Add bindings for ControlId array information

Paul Elder paul.elder at ideasonboard.com
Thu Oct 10 11:02:10 CEST 2024


Add python bindings for querying whether or not a ControlId is an array
type, and the size.

Example usage:
>>> cid
libcamera.ControlId(28, FrameDurationLimits, ControlType.Integer64)
>>> cid.isArray
True
>>> cid.size
2

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 src/py/libcamera/py_main.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index 983b76f6e998..898ef319dc69 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -400,6 +400,8 @@ PYBIND11_MODULE(_libcamera, m)
 		.def_property_readonly("id", &ControlId::id)
 		.def_property_readonly("name", &ControlId::name)
 		.def_property_readonly("type", &ControlId::type)
+		.def_property_readonly("isArray", &ControlId::isArray)
+		.def_property_readonly("size", &ControlId::size)
 		.def("__str__", [](const ControlId &self) { return self.name(); })
 		.def("__repr__", [](const ControlId &self) {
 			return py::str("libcamera.ControlId({}, {}, {})")
-- 
2.39.2



More information about the libcamera-devel mailing list