From 2c6e6fbc961aaa345355fd92603e770b0221f0c4 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Thu, 27 Feb 2020 14:48:01 +0100 Subject: libcamera: v4l2_controls: Cache query control information Cache the V4L2 control info retrieved with VIDIOC_QUERY_EXT_CTRL at control listing time for later use. Signed-off-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/include/v4l2_device.h | 1 + src/libcamera/v4l2_device.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h index 6bfddefe..ce8edd98 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_device.h @@ -48,6 +48,7 @@ private: const struct v4l2_ext_control *v4l2Ctrls, unsigned int count); + std::map controlInfo_; std::vector> controlIds_; ControlInfoMap controls_; std::string deviceNode_; diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 179476e9..7eded67c 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -381,6 +381,8 @@ void V4L2Device::listControls() } controlIds_.emplace_back(std::make_unique(ctrl)); + controlInfo_.emplace(ctrl.id, ctrl); + ctrls.emplace(controlIds_.back().get(), V4L2ControlInfo(ctrl)); } -- cgit v1.2.1