diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2024-09-16 01:24:20 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-09-25 23:54:42 +0300 |
commit | 505e49b76ed4f3040182f66a1c3884ea1648a612 (patch) | |
tree | 608f4c1c54df6f24316cd00485f042af45d81319 /src/py | |
parent | ab48009a81c929d37d236554ca0914b9a8994a4a (diff) |
py: Add bindings for ControlId enum name
Add python bindings for querying enum value names from a ControlId.
Example usage:
>>> cid
libcamera.ControlId(16, AwbMode, ControlType.Integer32)
>>> cid.enumerators()
{0: 'AwbAuto', 1: 'AwbIncandescent', 2: 'AwbTungsten', 3: 'AwbFluorescent', 4: 'AwbIndoor', 5: 'AwbDaylight', 6: 'AwbCloudy', 7: 'AwbCustom'}
>>> cinfo
libcamera.ControlInfo([2..5])
>>> cinfo.values
[2, 3, 5]
>>> [cid.enumerators()[v] for v in cinfo.values]
['AwbTungsten', 'AwbFluorescent', 'AwbDaylight']
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/py')
-rw-r--r-- | src/py/libcamera/py_main.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index ab33f38a..983b76f6 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -404,7 +404,8 @@ PYBIND11_MODULE(_libcamera, m) .def("__repr__", [](const ControlId &self) { return py::str("libcamera.ControlId({}, {}, {})") .format(self.id(), self.name(), self.type()); - }); + }) + .def("enumerators", &ControlId::enumerators); pyControlInfo .def_property_readonly("min", [](const ControlInfo &self) { |