[libcamera-devel] [PATCH 02/11] libcamera: controls: Rename ControlRange to ControlInfo

Jacopo Mondi jacopo at jmondi.org
Mon Mar 9 17:24:05 CET 2020


From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

To prepare for storage of additional information in the ControlRange
structure, rename it to ControlInfo.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 include/ipa/ipa_controls.h                    |  2 +-
 include/libcamera/controls.h                  | 16 ++++----
 src/libcamera/control_serializer.cpp          | 33 ++++++++-------
 src/libcamera/controls.cpp                    | 40 +++++++++----------
 src/libcamera/include/control_serializer.h    |  6 +--
 src/libcamera/include/v4l2_controls.h         |  4 +-
 src/libcamera/ipa_controls.cpp                | 38 +++++++++---------
 src/libcamera/pipeline/uvcvideo.cpp           |  4 +-
 src/libcamera/pipeline/vimc.cpp               |  4 +-
 src/libcamera/v4l2_controls.cpp               | 30 +++++++-------
 src/libcamera/v4l2_device.cpp                 |  2 +-
 .../{control_range.cpp => control_info.cpp}   | 10 ++---
 test/controls/meson.build                     |  2 +-
 test/serialization/serialization_test.cpp     |  4 +-
 test/v4l2_videodevice/controls.cpp            |  6 +--
 15 files changed, 100 insertions(+), 101 deletions(-)
 rename test/controls/{control_range.cpp => control_info.cpp} (83%)

diff --git a/include/ipa/ipa_controls.h b/include/ipa/ipa_controls.h
index 37f97d6ad2a4..6d3bf279c22d 100644
--- a/include/ipa/ipa_controls.h
+++ b/include/ipa/ipa_controls.h
@@ -33,7 +33,7 @@ struct ipa_control_value_entry {
 	uint32_t padding[1];
 };
 
-struct ipa_control_range_entry {
+struct ipa_control_info_entry {
 	uint32_t id;
 	uint32_t type;
 	uint32_t offset;
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 3d2250f43f3c..9c6cbffb88b5 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -229,12 +229,12 @@ private:
 	Control &operator=(const Control &) = delete;
 };
 
-class ControlRange
+class ControlInfo
 {
 public:
-	explicit ControlRange(const ControlValue &min = 0,
-			      const ControlValue &max = 0,
-			      const ControlValue &def = 0);
+	explicit ControlInfo(const ControlValue &min = 0,
+			     const ControlValue &max = 0,
+			     const ControlValue &def = 0);
 
 	const ControlValue &min() const { return min_; }
 	const ControlValue &max() const { return max_; }
@@ -242,12 +242,12 @@ public:
 
 	std::string toString() const;
 
-	bool operator==(const ControlRange &other) const
+	bool operator==(const ControlInfo &other) const
 	{
 		return min_ == other.min_ && max_ == other.max_;
 	}
 
-	bool operator!=(const ControlRange &other) const
+	bool operator!=(const ControlInfo &other) const
 	{
 		return !(*this == other);
 	}
@@ -260,10 +260,10 @@ private:
 
 using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;
 
-class ControlInfoMap : private std::unordered_map<const ControlId *, ControlRange>
+class ControlInfoMap : private std::unordered_map<const ControlId *, ControlInfo>
 {
 public:
-	using Map = std::unordered_map<const ControlId *, ControlRange>;
+	using Map = std::unordered_map<const ControlId *, ControlInfo>;
 
 	ControlInfoMap() = default;
 	ControlInfoMap(const ControlInfoMap &other) = default;
diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
index dcc63d20c06c..eef875f4d96c 100644
--- a/src/libcamera/control_serializer.cpp
+++ b/src/libcamera/control_serializer.cpp
@@ -99,9 +99,9 @@ size_t ControlSerializer::binarySize(const ControlValue &value)
 	return value.data().size_bytes();
 }
 
-size_t ControlSerializer::binarySize(const ControlRange &range)
+size_t ControlSerializer::binarySize(const ControlInfo &info)
 {
-	return binarySize(range.min()) + binarySize(range.max());
+	return binarySize(info.min()) + binarySize(info.max());
 }
 
 /**
@@ -116,7 +116,7 @@ size_t ControlSerializer::binarySize(const ControlRange &range)
 size_t ControlSerializer::binarySize(const ControlInfoMap &infoMap)
 {
 	size_t size = sizeof(struct ipa_controls_header)
-		    + infoMap.size() * sizeof(struct ipa_control_range_entry);
+		    + infoMap.size() * sizeof(struct ipa_control_info_entry);
 
 	for (const auto &ctrl : infoMap)
 		size += binarySize(ctrl.second);
@@ -150,11 +150,10 @@ void ControlSerializer::store(const ControlValue &value,
 	buffer.write(value.data());
 }
 
-void ControlSerializer::store(const ControlRange &range,
-			      ByteStreamBuffer &buffer)
+void ControlSerializer::store(const ControlInfo &info, ByteStreamBuffer &buffer)
 {
-	store(range.min(), buffer);
-	store(range.max(), buffer);
+	store(info.min(), buffer);
+	store(info.max(), buffer);
 }
 
 /**
@@ -176,7 +175,7 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap,
 {
 	/* Compute entries and data required sizes. */
 	size_t entriesSize = infoMap.size()
-			   * sizeof(struct ipa_control_range_entry);
+			   * sizeof(struct ipa_control_info_entry);
 	size_t valuesSize = 0;
 	for (const auto &ctrl : infoMap)
 		valuesSize += binarySize(ctrl.second);
@@ -200,15 +199,15 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap,
 
 	for (const auto &ctrl : infoMap) {
 		const ControlId *id = ctrl.first;
-		const ControlRange &range = ctrl.second;
+		const ControlInfo &info = ctrl.second;
 
-		struct ipa_control_range_entry entry;
+		struct ipa_control_info_entry entry;
 		entry.id = id->id();
 		entry.type = id->type();
 		entry.offset = values.offset();
 		entries.write(&entry);
 
-		store(range, values);
+		store(info, values);
 	}
 
 	if (buffer.overflow())
@@ -343,13 +342,13 @@ ControlValue ControlSerializer::loadControlValue(ControlType type,
 	return ControlValue();
 }
 
-ControlRange ControlSerializer::loadControlRange(ControlType type,
-						 ByteStreamBuffer &b)
+ControlInfo ControlSerializer::loadControlInfo(ControlType type,
+					       ByteStreamBuffer &b)
 {
 	ControlValue min = loadControlValue(type, b);
 	ControlValue max = loadControlValue(type, b);
 
-	return ControlRange(min, max);
+	return ControlInfo(min, max);
 }
 
 /**
@@ -397,7 +396,7 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &
 	ControlInfoMap::Map ctrls;
 
 	for (unsigned int i = 0; i < hdr->entries; ++i) {
-		const struct ipa_control_range_entry *entry =
+		const struct ipa_control_info_entry *entry =
 			entries.read<decltype(*entry)>();
 		if (!entry) {
 			LOG(Serializer, Error) << "Out of data";
@@ -419,9 +418,9 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &
 			return {};
 		}
 
-		/* Create and store the ControlRange. */
+		/* Create and store the ControlInfo. */
 		ctrls.emplace(controlIds_.back().get(),
-			      loadControlRange(type, values));
+			      loadControlInfo(type, values));
 	}
 
 	/*
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 833a436c64df..53649fe897db 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -414,50 +414,50 @@ void ControlValue::set(ControlType type, bool isArray, const void *data,
  */
 
 /**
- * \class ControlRange
+ * \class ControlInfo
  * \brief Describe the limits of valid values for a Control
  *
- * The ControlRange expresses the constraints on valid values for a control.
+ * The ControlInfo expresses the constraints on valid values for a control.
  * The constraints depend on the object the control applies to, and are
  * constant for the lifetime of that object. They are typically constructed by
  * pipeline handlers to describe the controls they support.
  */
 
 /**
- * \brief Construct a ControlRange with minimum and maximum range parameters
+ * \brief Construct a ControlInfo with minimum and maximum range parameters
  * \param[in] min The control minimum value
  * \param[in] max The control maximum value
  * \param[in] def The control default value
  */
-ControlRange::ControlRange(const ControlValue &min,
-			   const ControlValue &max,
-			   const ControlValue &def)
+ControlInfo::ControlInfo(const ControlValue &min,
+			 const ControlValue &max,
+			 const ControlValue &def)
 	: min_(min), max_(max), def_(def)
 {
 }
 
 /**
- * \fn ControlRange::min()
+ * \fn ControlInfo::min()
  * \brief Retrieve the minimum value of the control
  * \return A ControlValue with the minimum value for the control
  */
 
 /**
- * \fn ControlRange::max()
+ * \fn ControlInfo::max()
  * \brief Retrieve the maximum value of the control
  * \return A ControlValue with the maximum value for the control
  */
 
 /**
- * \fn ControlRange::def()
+ * \fn ControlInfo::def()
  * \brief Retrieve the default value of the control
  * \return A ControlValue with the default value for the control
  */
 
 /**
- * \brief Provide a string representation of the ControlRange
+ * \brief Provide a string representation of the ControlInfo
  */
-std::string ControlRange::toString() const
+std::string ControlInfo::toString() const
 {
 	std::stringstream ss;
 
@@ -467,15 +467,15 @@ std::string ControlRange::toString() const
 }
 
 /**
- * \fn bool ControlRange::operator==()
- * \brief Compare ControlRange instances for equality
- * \return True if the ranges have identical min and max, false otherwise
+ * \fn bool ControlInfo::operator==()
+ * \brief Compare ControlInfo instances for equality
+ * \return True if the constraints have identical min and max, false otherwise
  */
 
 /**
- * \fn bool ControlRange::operator!=()
- * \brief Compare ControlRange instances for non equality
- * \return False if the ranges have identical min and max, true otherwise
+ * \fn bool ControlInfo::operator!=()
+ * \brief Compare ControlInfo instances for non equality
+ * \return True if the constraints have different min and max, false otherwise
  */
 
 /**
@@ -489,10 +489,10 @@ std::string ControlRange::toString() const
 
 /**
  * \class ControlInfoMap
- * \brief A map of ControlId to ControlRange
+ * \brief A map of ControlId to ControlInfo
  *
  * The ControlInfoMap class describes controls supported by an object as an
- * unsorted map of ControlId pointers to ControlRange instances. Unlike the
+ * unsorted map of ControlId pointers to ControlInfo instances. Unlike the
  * standard std::unsorted_map<> class, it is designed the be immutable once
  * constructed, and thus only exposes the read accessors of the
  * std::unsorted_map<> base class.
@@ -656,7 +656,7 @@ void ControlInfoMap::generateIdmap()
 		if (ctrl.first->type() != ctrl.second.min().type()) {
 			LOG(Controls, Error)
 				<< "Control " << utils::hex(ctrl.first->id())
-				<< " type and range type mismatch";
+				<< " type and info type mismatch";
 			idmap_.clear();
 			clear();
 			return;
diff --git a/src/libcamera/include/control_serializer.h b/src/libcamera/include/control_serializer.h
index 026e62340328..70aa28fd5f58 100644
--- a/src/libcamera/include/control_serializer.h
+++ b/src/libcamera/include/control_serializer.h
@@ -35,17 +35,17 @@ public:
 
 private:
 	static size_t binarySize(const ControlValue &value);
-	static size_t binarySize(const ControlRange &range);
+	static size_t binarySize(const ControlInfo &info);
 
 	static void store(const ControlValue &value, ByteStreamBuffer &buffer);
-	static void store(const ControlRange &range, ByteStreamBuffer &buffer);
+	static void store(const ControlInfo &info, ByteStreamBuffer &buffer);
 
 	template<typename T>
 	ControlValue loadControlValue(ByteStreamBuffer &buffer, bool isArray,
 				      unsigned int count);
 	ControlValue loadControlValue(ControlType type, ByteStreamBuffer &buffer,
 				      bool isArray = false, unsigned int count = 1);
-	ControlRange loadControlRange(ControlType type, ByteStreamBuffer &buffer);
+	ControlInfo loadControlInfo(ControlType type, ByteStreamBuffer &buffer);
 
 	unsigned int serial_;
 	std::vector<std::unique_ptr<ControlId>> controlIds_;
diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h
index 882546a89340..cffe9efd9919 100644
--- a/src/libcamera/include/v4l2_controls.h
+++ b/src/libcamera/include/v4l2_controls.h
@@ -20,10 +20,10 @@ public:
 	V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl);
 };
 
-class V4L2ControlRange : public ControlRange
+class V4L2ControlInfo : public ControlInfo
 {
 public:
-	V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);
+	V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl);
 };
 
 } /* namespace libcamera */
diff --git a/src/libcamera/ipa_controls.cpp b/src/libcamera/ipa_controls.cpp
index da4724b178e2..b1d14190e3fe 100644
--- a/src/libcamera/ipa_controls.cpp
+++ b/src/libcamera/ipa_controls.cpp
@@ -18,7 +18,7 @@
  * transfer them through the IPA C interface and IPA IPC transports.
  *
  * A control packet contains a list of entries, each of them describing a single
- * control range or control value. The packet starts with a fixed-size header
+ * control info or control value. The packet starts with a fixed-size header
  * described by the ipa_controls_header structure, followed by an array of
  * fixed-size entries. Each entry is associated with data, stored either
  * directly in the entry, or in a data section after the entries array.
@@ -79,19 +79,19 @@
  *         | |                         |    |                      |
  *         \ |                         |    |                      |
  *           +-------------------------+    |                      |
- *         / | ipa_control_range_entry |    | hdr.data_offset      |
+ *         / | ipa_control_info_entry  |    | hdr.data_offset      |
  *         | | #0                      |    |                      |
  * Control | +-------------------------+    |                      |
- *   range | | ...                     |    |                      |
+ *    info | | ...                     |    |                      |
  * entries | +-------------------------+    |                      |
- *         | | ipa_control_range_entry |    |             hdr.size |
+ *         | | ipa_control_info_entry  |    |             hdr.size |
  *         \ | #hdr.entries - 1        |    |                      |
  *           +-------------------------+    |                      |
  *           | empty space (optional)  |    |                      |
  *           +-------------------------+ <--´  .                   |
  *         / | ...                     |       | entry[n].offset   |
  *    Data | | ...                     |       |                   |
- * section | | range data for entry #n | <-----´                   |
+ * section | | info data for entry #n  | <-----´                   |
  *         \ | ...                     |                           |
  *           +-------------------------+                           |
  *           | empty space (optional)  |                           |
@@ -100,8 +100,8 @@
  *
  * The packet header is identical to the ControlList packet header.
  *
- * Entries are described by the ipa_control_range_entry structure. They contain
- * the numerical ID and type of the control. The control range data is stored
+ * Entries are described by the ipa_control_info_entry structure. They contain
+ * the numerical ID and type of the control. The control info data is stored
  * in the data section as described by the following diagram.
  *
  * ~~~~
@@ -117,10 +117,10 @@
  * ~~~~
  *
  * The minimum and maximum value are stored in the platform's native data
- * format. The ipa_control_range_entry::offset field stores the offset from the
- * beginning of the data section to the range data.
+ * format. The ipa_control_info_entry::offset field stores the offset from the
+ * beginning of the data section to the info data.
  *
- * Range data in the data section shall be stored in the same order as the
+ * Info data in the data section shall be stored in the same order as the
  * entries array, shall be aligned to a multiple of 8 bytes, and shall be
  * contiguous in memory.
  *
@@ -178,18 +178,18 @@ static_assert(sizeof(ipa_control_value_entry) == 16,
 	      "Invalid ABI size change for struct ipa_control_value_entry");
 
 /**
- * \struct ipa_control_range_entry
- * \brief Description of a serialized ControlRange entry
- * \var ipa_control_range_entry::id
+ * \struct ipa_control_info_entry
+ * \brief Description of a serialized ControlInfo entry
+ * \var ipa_control_info_entry::id
  * The numerical ID of the control
- * \var ipa_control_range_entry::type
+ * \var ipa_control_info_entry::type
  * The type of the control (defined by enum ControlType)
- * \var ipa_control_range_entry::offset
+ * \var ipa_control_info_entry::offset
  * The offset in bytes from the beginning of the data section to the control
- * range data (shall be a multiple of 8 bytes)
- * \var ipa_control_range_entry::padding
+ * info data (shall be a multiple of 8 bytes)
+ * \var ipa_control_info_entry::padding
  * Padding bytes (shall be set to 0)
  */
 
-static_assert(sizeof(ipa_control_range_entry) == 16,
-	      "Invalid ABI size change for struct ipa_control_range_entry");
+static_assert(sizeof(ipa_control_info_entry) == 16,
+	      "Invalid ABI size change for struct ipa_control_info_entry");
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 29afb121aa46..24abc986112f 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -342,7 +342,7 @@ int UVCCameraData::init(MediaEntity *entity)
 	ControlInfoMap::Map ctrls;
 
 	for (const auto &ctrl : controls) {
-		const ControlRange &range = ctrl.second;
+		const ControlInfo &info = ctrl.second;
 		const ControlId *id;
 
 		switch (ctrl.first->id()) {
@@ -365,7 +365,7 @@ int UVCCameraData::init(MediaEntity *entity)
 			continue;
 		}
 
-		ctrls.emplace(id, range);
+		ctrls.emplace(id, info);
 	}
 
 	controlInfo_ = std::move(ctrls);
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 5d3d12fef30b..529909714bf5 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -431,7 +431,7 @@ int VimcCameraData::init(MediaDevice *media)
 	ControlInfoMap::Map ctrls;
 
 	for (const auto &ctrl : controls) {
-		const ControlRange &range = ctrl.second;
+		const ControlInfo &info = ctrl.second;
 		const ControlId *id;
 
 		switch (ctrl.first->id()) {
@@ -448,7 +448,7 @@ int VimcCameraData::init(MediaDevice *media)
 			continue;
 		}
 
-		ctrls.emplace(id, range);
+		ctrls.emplace(id, info);
 	}
 
 	controlInfo_ = std::move(ctrls);
diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
index 7446c3880330..4861f9778df3 100644
--- a/src/libcamera/v4l2_controls.cpp
+++ b/src/libcamera/v4l2_controls.cpp
@@ -104,37 +104,37 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)
 }
 
 /**
- * \class V4L2ControlRange
- * \brief Convenience specialisation of ControlRange for V4L2 controls
+ * \class V4L2ControlInfo
+ * \brief Convenience specialisation of ControlInfo for V4L2 controls
  *
- * The V4L2ControlRange class is a specialisation of the ControlRange for V4L2
+ * The V4L2ControlInfo class is a specialisation of the ControlInfo for V4L2
  * controls. It offers a convenience constructor from a struct
- * v4l2_query_ext_ctrl, and is otherwise equivalent to the ControlRange class.
+ * v4l2_query_ext_ctrl, and is otherwise equivalent to the ControlInfo class.
  */
 
 /**
- * \brief Construct a V4L2ControlRange from a struct v4l2_query_ext_ctrl
+ * \brief Construct a V4L2ControlInfo from a struct v4l2_query_ext_ctrl
  * \param[in] ctrl The struct v4l2_query_ext_ctrl as returned by the kernel
  */
-V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
+V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
 {
 	switch (ctrl.type) {
 	case V4L2_CTRL_TYPE_BOOLEAN:
-		ControlRange::operator=(ControlRange(static_cast<bool>(ctrl.minimum),
-						     static_cast<bool>(ctrl.maximum),
-						     static_cast<bool>(ctrl.default_value)));
+		ControlInfo::operator=(ControlInfo(static_cast<bool>(ctrl.minimum),
+						   static_cast<bool>(ctrl.maximum),
+						   static_cast<bool>(ctrl.default_value)));
 		break;
 
 	case V4L2_CTRL_TYPE_INTEGER64:
-		ControlRange::operator=(ControlRange(static_cast<int64_t>(ctrl.minimum),
-						     static_cast<int64_t>(ctrl.maximum),
-						     static_cast<int64_t>(ctrl.default_value)));
+		ControlInfo::operator=(ControlInfo(static_cast<int64_t>(ctrl.minimum),
+						   static_cast<int64_t>(ctrl.maximum),
+						   static_cast<int64_t>(ctrl.default_value)));
 		break;
 
 	default:
-		ControlRange::operator=(ControlRange(static_cast<int32_t>(ctrl.minimum),
-						     static_cast<int32_t>(ctrl.maximum),
-						     static_cast<int32_t>(ctrl.default_value)));
+		ControlInfo::operator=(ControlInfo(static_cast<int32_t>(ctrl.minimum),
+						   static_cast<int32_t>(ctrl.maximum),
+						   static_cast<int32_t>(ctrl.default_value)));
 		break;
 	}
 }
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 1698d2451449..98639bd0f07f 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -381,7 +381,7 @@ void V4L2Device::listControls()
 		}
 
 		controlIds_.emplace_back(std::make_unique<V4L2ControlId>(ctrl));
-		ctrls.emplace(controlIds_.back().get(), V4L2ControlRange(ctrl));
+		ctrls.emplace(controlIds_.back().get(), V4L2ControlInfo(ctrl));
 	}
 
 	controls_ = std::move(ctrls);
diff --git a/test/controls/control_range.cpp b/test/controls/control_info.cpp
similarity index 83%
rename from test/controls/control_range.cpp
rename to test/controls/control_info.cpp
index 06ec3506ee62..1e05e13129ca 100644
--- a/test/controls/control_range.cpp
+++ b/test/controls/control_info.cpp
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2019, Google Inc.
  *
- * control_range.cpp - ControlRange tests
+ * control_info.cpp - ControlInfo tests
  */
 
 #include <iostream>
@@ -15,7 +15,7 @@
 using namespace std;
 using namespace libcamera;
 
-class ControlRangeTest : public Test
+class ControlInfoTest : public Test
 {
 protected:
 	int run()
@@ -24,7 +24,7 @@ protected:
 		 * Test information retrieval from a range with no minimum and
 		 * maximum.
 		 */
-		ControlRange brightness;
+		ControlInfo brightness;
 
 		if (brightness.min().get<int32_t>() != 0 ||
 		    brightness.max().get<int32_t>() != 0) {
@@ -36,7 +36,7 @@ protected:
 		 * Test information retrieval from a control with a minimum and
 		 * a maximum value.
 		 */
-		ControlRange contrast(10, 200);
+		ControlInfo contrast(10, 200);
 
 		if (contrast.min().get<int32_t>() != 10 ||
 		    contrast.max().get<int32_t>() != 200) {
@@ -48,4 +48,4 @@ protected:
 	}
 };
 
-TEST_REGISTER(ControlRangeTest)
+TEST_REGISTER(ControlInfoTest)
diff --git a/test/controls/meson.build b/test/controls/meson.build
index 16a7f33fdcc6..7fff2413007e 100644
--- a/test/controls/meson.build
+++ b/test/controls/meson.build
@@ -1,7 +1,7 @@
 control_tests = [
+    [ 'control_info',               'control_info.cpp' ],
     [ 'control_info_map',           'control_info_map.cpp' ],
     [ 'control_list',               'control_list.cpp' ],
-    [ 'control_range',              'control_range.cpp' ],
     [ 'control_value',              'control_value.cpp' ],
 ]
 
diff --git a/test/serialization/serialization_test.cpp b/test/serialization/serialization_test.cpp
index 68e0512a04ca..11d0f0f30031 100644
--- a/test/serialization/serialization_test.cpp
+++ b/test/serialization/serialization_test.cpp
@@ -22,7 +22,7 @@ using namespace libcamera;
 
 bool SerializationTest::equals(const ControlInfoMap &lhs, const ControlInfoMap &rhs)
 {
-	std::map<unsigned int, ControlRange> rlhs;
+	std::map<unsigned int, ControlInfo> rlhs;
 	std::transform(lhs.begin(), lhs.end(), std::inserter(rlhs, rlhs.end()),
 			[](const ControlInfoMap::value_type &v)
 				-> decltype(rlhs)::value_type
@@ -30,7 +30,7 @@ bool SerializationTest::equals(const ControlInfoMap &lhs, const ControlInfoMap &
 				return { v.first->id(), v.second };
 			});
 
-	std::map<unsigned int, ControlRange> rrhs;
+	std::map<unsigned int, ControlInfo> rrhs;
 	std::transform(rhs.begin(), rhs.end(), std::inserter(rrhs, rrhs.end()),
 			[](const ControlInfoMap::value_type &v)
 				-> decltype(rrhs)::value_type
diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
index 1b71bf0633b4..478de3707a3c 100644
--- a/test/v4l2_videodevice/controls.cpp
+++ b/test/v4l2_videodevice/controls.cpp
@@ -41,9 +41,9 @@ protected:
 			return TestFail;
 		}
 
-		const ControlRange &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second;
-		const ControlRange &contrast = infoMap.find(V4L2_CID_CONTRAST)->second;
-		const ControlRange &saturation = infoMap.find(V4L2_CID_SATURATION)->second;
+		const ControlInfo &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second;
+		const ControlInfo &contrast = infoMap.find(V4L2_CID_CONTRAST)->second;
+		const ControlInfo &saturation = infoMap.find(V4L2_CID_SATURATION)->second;
 
 		/* Test getting controls. */
 		ControlList ctrls(infoMap);
-- 
2.25.0



More information about the libcamera-devel mailing list