libcamera: controls: Merge ControlInfoMap and V4L2ControlInfoMap

The ControlInfoMap and V4L2ControlInfoMap classes are very similar, with
the latter adding convenience accessors based on numerical IDs for the
former, as well as a cached idmap. Both features can be useful for
ControlInfoMap in the context of serialisation, and merging the two
classes will further simplify the IPA API.

Import all the features of V4L2ControlInfoMap into ControlInfoMap,
turning the latter into a real class. A few new constructors and
assignment operators are added for completeness.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart
2019-10-14 02:08:44 +03:00
parent c957c8580a
commit 319d6ae8e3
16 changed files with 220 additions and 154 deletions
+7 -4
View File
@@ -411,7 +411,9 @@ int VimcCameraData::init(MediaDevice *media)
return -ENODEV;
/* Initialise the supported controls. */
const V4L2ControlInfoMap &controls = sensor_->controls();
const ControlInfoMap &controls = sensor_->controls();
ControlInfoMap::Map ctrls;
for (const auto &ctrl : controls) {
const ControlRange &range = ctrl.second;
const ControlId *id;
@@ -430,11 +432,12 @@ int VimcCameraData::init(MediaDevice *media)
continue;
}
controlInfo_.emplace(std::piecewise_construct,
std::forward_as_tuple(id),
std::forward_as_tuple(range));
ctrls.emplace(std::piecewise_construct,
std::forward_as_tuple(id),
std::forward_as_tuple(range));
}
controlInfo_ = std::move(ctrls);
return 0;
}