[libcamera-devel] [PATCH 06/11] libcamera: v4l2_controls: Cache query control information
Jacopo Mondi
jacopo at jmondi.org
Mon Mar 9 17:24:09 CET 2020
Cache the V4L2 control info retrieved with VIDIOC_QUERY_EXT_CTRL
at control listing time for later use.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/include/v4l2_device.h | 1 +
src/libcamera/v4l2_device.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
index 6bfddefe336c..e1fd048cc85a 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> ctrlsInfo_;
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 179476e9afad..65e97f92b01f 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -382,6 +382,7 @@ void V4L2Device::listControls()
controlIds_.emplace_back(std::make_unique<V4L2ControlId>(ctrl));
ctrls.emplace(controlIds_.back().get(), V4L2ControlInfo(ctrl));
+ ctrlsInfo_[ctrl.id] = ctrl;
}
controls_ = std::move(ctrls);
--
2.25.0
More information about the libcamera-devel
mailing list