[libcamera-devel] py: Add constructor for SensorConfiguration
diff mbox series

Message ID 20230927163422.15924-1-david.plowman@raspberrypi.com
State Not Applicable
Headers show
Series
  • [libcamera-devel] py: Add constructor for SensorConfiguration
Related show

Commit Message

David Plowman Sept. 27, 2023, 4:34 p.m. UTC
The SensorConfiguration is optional within the CameraConfiguration, so
Python applications need a constructor to create a SensorConfiguration
object that can be put there.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/py/libcamera/py_main.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

David Plowman Sept. 28, 2023, 9:19 a.m. UTC | #1
Sorry, please ignore this patch. It's assuming the Python bindings
have been updated for the SensorConfiguration, but on master they
haven't been yet! Anyway, that patch needs submitting first so I'll do
that, and roll this fix in directly.

Thanks
David

On Wed, 27 Sept 2023 at 17:34, David Plowman
<david.plowman@raspberrypi.com> wrote:
>
> The SensorConfiguration is optional within the CameraConfiguration, so
> Python applications need a constructor to create a SensorConfiguration
> object that can be put there.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/py/libcamera/py_main.cpp | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index c36e6e6c..8df04520 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -283,6 +283,7 @@ PYBIND11_MODULE(_libcamera, m)
>                 });
>
>         pySensorConfiguration
> +               .def(py::init<>())
>                 .def_readwrite("bit_depth", &SensorConfiguration::bitDepth)
>                 .def_readwrite("output_size", &SensorConfiguration::outputSize);
>
> --
> 2.39.2
>

Patch
diff mbox series

diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index c36e6e6c..8df04520 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -283,6 +283,7 @@  PYBIND11_MODULE(_libcamera, m)
 		});
 
 	pySensorConfiguration
+		.def(py::init<>())
 		.def_readwrite("bit_depth", &SensorConfiguration::bitDepth)
 		.def_readwrite("output_size", &SensorConfiguration::outputSize);