summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-02-27 14:48:01 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-23 16:45:18 +0200
commit2c6e6fbc961aaa345355fd92603e770b0221f0c4 (patch)
treec5ed8f56337bb06c5db771fbda766c25998f270f
parent8daf20485b90af2065e3db0e3fd0cd5b72fd7ac4 (diff)
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 <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/include/v4l2_device.h1
-rw-r--r--src/libcamera/v4l2_device.cpp2
2 files changed, 3 insertions, 0 deletions
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<unsigned int, struct v4l2_query_ext_ctrl> controlInfo_;
std::vector<std::unique_ptr<V4L2ControlId>> 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<V4L2ControlId>(ctrl));
+ controlInfo_.emplace(ctrl.id, ctrl);
+
ctrls.emplace(controlIds_.back().get(), V4L2ControlInfo(ctrl));
}