From 86fa7300fa915060e25257b41d8ebb514dd55435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 9 May 2023 23:07:57 +0000 Subject: libcamera: camera: Take span of StreamRole instead of vector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the parameter type of `generateConfiguration()` from `const std::vector&` to `libcamera::Span`. A span is almost always preferable to a const vector ref because it does not force dynamic allocation when none are needed, and it allows any contiguous container to be used. A new overload is added that accepts an initializer list so that cam->generateConfiguration({ ... }) keeps working. There is no API break since a span can be constructed from a vector and the initializer list overload takes care of the initializer lists, but this change causes an ABI break. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart [Kieran: Apply checkstyle fixups] Signed-off-by: Kieran Bingham --- src/py/libcamera/py_main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/py') diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index 5a5f1a37..01fb15a9 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -208,7 +208,10 @@ PYBIND11_MODULE(_libcamera, m) }) /* Keep the camera alive, as StreamConfiguration contains a Stream* */ - .def("generate_configuration", &Camera::generateConfiguration, py::keep_alive<0, 1>()) + .def("generate_configuration", [](Camera &self, const std::vector &roles) { + return self.generateConfiguration(roles); + }, py::keep_alive<0, 1>()) + .def("configure", [](Camera &self, CameraConfiguration *config) { int ret = self.configure(config); if (ret) -- cgit v1.2.1