summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_controls.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-14 02:08:44 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-15 22:33:33 +0300
commit319d6ae8e3ad1a47a674e85015de9ea811e84564 (patch)
tree7d1ccddf9997bb58be692e51bf217d49d8000622 /src/libcamera/v4l2_controls.cpp
parentc957c8580a30d5940f0d4893497f38e05c7f8e92 (diff)
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>
Diffstat (limited to 'src/libcamera/v4l2_controls.cpp')
-rw-r--r--src/libcamera/v4l2_controls.cpp94
1 files changed, 2 insertions, 92 deletions
diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
index 33816571..37ff034e 100644
--- a/src/libcamera/v4l2_controls.cpp
+++ b/src/libcamera/v4l2_controls.cpp
@@ -127,101 +127,11 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
}
/**
- * \class V4L2ControlInfoMap
- * \brief A map of controlID to ControlRange for V4L2 controls
- */
-
-/**
- * \brief Move assignment operator from a ControlInfoMap
- * \param[in] info The control info map
- *
- * Populate the map by replacing its contents with those of \a info using move
- * semantics. Upon return the \a info map will be empty.
- *
- * This is the only supported way to populate a V4L2ControlInfoMap.
- *
- * \return The populated V4L2ControlInfoMap
- */
-V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(ControlInfoMap &&info)
-{
- ControlInfoMap::operator=(std::move(info));
-
- idmap_.clear();
- for (const auto &ctrl : *this)
- idmap_[ctrl.first->id()] = ctrl.first;
-
- return *this;
-}
-
-/**
- * \brief Access specified element by numerical ID
- * \param[in] id The numerical ID
- * \return A reference to the element whose ID is equal to \a id
- */
-V4L2ControlInfoMap::mapped_type &V4L2ControlInfoMap::at(unsigned int id)
-{
- return at(idmap_.at(id));
-}
-
-/**
- * \brief Access specified element by numerical ID
- * \param[in] id The numerical ID
- * \return A const reference to the element whose ID is equal to \a id
- */
-const V4L2ControlInfoMap::mapped_type &V4L2ControlInfoMap::at(unsigned int id) const
-{
- return at(idmap_.at(id));
-}
-
-/**
- * \brief Count the number of elements matching a numerical ID
- * \param[in] id The numerical ID
- * \return The number of elements matching the numerical \a id
- */
-V4L2ControlInfoMap::size_type V4L2ControlInfoMap::count(unsigned int id) const
-{
- return count(idmap_.at(id));
-}
-
-/**
- * \brief Find the element matching a numerical ID
- * \param[in] id The numerical ID
- * \return An iterator pointing to the element matching the numerical \a id, or
- * end() if no such element exists
- */
-V4L2ControlInfoMap::iterator V4L2ControlInfoMap::find(unsigned int id)
-{
- return find(idmap_.at(id));
-}
-
-/**
- * \brief Find the element matching a numerical ID
- * \param[in] id The numerical ID
- * \return A const iterator pointing to the element matching the numerical
- * \a id, or end() if no such element exists
- */
-V4L2ControlInfoMap::const_iterator V4L2ControlInfoMap::find(unsigned int id) const
-{
- return find(idmap_.at(id));
-}
-
-/**
- * \fn const ControlIdMap &V4L2ControlInfoMap::idmap() const
- * \brief Retrieve the ControlId map
- *
- * Constructing ControlList instances for V4L2 controls requires a ControlIdMap
- * for the V4L2 device that the control list targets. This helper method
- * returns a suitable idmap for that purpose.
- *
- * \return The ControlId map
- */
-
-/**
* \class V4L2ControlList
* \brief A list of controls for a V4L2 device
*
* This class specialises the ControList class for use with V4L2 devices. It
- * offers a convenience API to create a ControlList from a V4L2ControlInfoMap.
+ * offers a convenience API to create a ControlList from a ControlInfoMap.
*
* V4L2ControlList allows easy construction of a ControlList containing V4L2
* controls for a device. It can be used to construct the list of controls
@@ -231,7 +141,7 @@ V4L2ControlInfoMap::const_iterator V4L2ControlInfoMap::find(unsigned int id) con
*/
/**
- * \fn V4L2ControlList::V4L2ControlList(const V4L2ControlInfoMap &info)
+ * \fn V4L2ControlList::V4L2ControlList(const ControlInfoMap &info)
* \brief Construct a V4L2ControlList associated with a V4L2 device
* \param[in] info The V4L2 device control info map
*/