From 22dcaeacd03bc4d17fd33bdf17c516a74a1883c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 7 Mar 2025 17:13:17 +0100 Subject: libcamera: camera: Ensure correct id maps are always set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Camera::Private::properties_` is a default constructed `ControlList`, therefore it does not have an associated `ControlIdMap`. `controlInfo_` is in a similar situation. Extend the `Camera::Private` constructor to initialize the control id map of both properly. Multiple pipeline handlers copy the sensor's property list and set that as camera properties, and since the `CameraSensor{Legacy,Raw}` classes set the proper id map, the camera properties will have it too. However, some pipelines, e.g. `uvcvideo` or `virtual`, do not do so, and thus there will be no id map set. To fix this, extend the `Camera::Private` constructor to set `properties::properties`. As for `controlInfo_`, all pipeline handlers overwrite it during camera initialization (and thus it will have the correct id map), but still initialize the id map so that it is set at all times. Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/camera.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 56c58519..c180a5fd 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -587,7 +588,8 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF * \param[in] pipe The pipeline handler responsible for the camera device */ Camera::Private::Private(PipelineHandler *pipe) - : requestSequence_(0), pipe_(pipe->shared_from_this()), + : controlInfo_({}, controls::controls), properties_(properties::properties), + requestSequence_(0), pipe_(pipe->shared_from_this()), disconnected_(false), state_(CameraAvailable) { } -- cgit v1.2.1