summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_device.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-12 20:20:39 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-13 20:37:47 +0300
commit2fe723440a91ab9e086b90ffae912bf0f877daf2 (patch)
tree06fab01f8b65e0a9e865d2062210460c935ff83a /src/libcamera/v4l2_device.cpp
parent90d0f193eb2102a6aee3c519eda5ced67a6841f1 (diff)
libcamera: v4l2_controls: Turn V4L2ControlInfoMap into a class
In preparation for extending V4L2ControlInfoMap with control idmap support, turn it into a real class. Make it inherit from std::map<> instead of wrapping it to keep the API simple. V4L2ControlInfoMap is meant to be constructed with a set of control info, and never modified afterwards. To ensure this, inherit from std::map<> with private access specifier, and explicitly expose the std::map<> methods that do not allow insertion or removal of elements. A custom move assignment operator is implemented to allow efficient construction of the V4L2ControlInfoMap. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/v4l2_device.cpp')
-rw-r--r--src/libcamera/v4l2_device.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 8c599843..1f755f0f 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -340,6 +340,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp)
*/
void V4L2Device::listControls()
{
+ std::map<unsigned int, V4L2ControlInfo> ctrls;
struct v4l2_query_ext_ctrl ctrl = {};
/* \todo Add support for menu and compound controls. */
@@ -368,10 +369,12 @@ void V4L2Device::listControls()
continue;
}
- controls_.emplace(std::piecewise_construct,
- std::forward_as_tuple(ctrl.id),
- std::forward_as_tuple(ctrl));
+ ctrls.emplace(std::piecewise_construct,
+ std::forward_as_tuple(ctrl.id),
+ std::forward_as_tuple(ctrl));
}
+
+ controls_ = std::move(ctrls);
}
/*