summaryrefslogtreecommitdiff
path: root/src/libcamera/control_serializer.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-01 22:02:37 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-20 16:47:45 +0200
commite5a9e6e9cd3e12efe9ce078171fbe67d7d41a771 (patch)
treec73bc72211ca61c44eda396151b466d4a7a8c1ab /src/libcamera/control_serializer.cpp
parent73b7ba9da5fe7b1aec62af091ad36403cd3505c4 (diff)
libcamera: controls: Rename ControlRange to ControlInfo
To prepare for storage of additional information in the ControlRange structure, rename it to ControlInfo. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/control_serializer.cpp')
-rw-r--r--src/libcamera/control_serializer.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
index dcc63d20..eef875f4 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));
}
/*