summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-02-16 00:03:04 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-06 18:10:48 +0200
commit5467d619251c05f04f737351eb45e191776a420c (patch)
tree7a0c21ca26e37ee207ad2d09230bcb0e19601c21 /src
parent44ff5a18e42ad26a1621edf00f309c86304f13ac (diff)
libcamera: control_serializer: Simplify serialization of ControlValue
Use the ControlValue::data() function to access raw data stored in the control value and simplify serialization. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.binghm@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/control_serializer.cpp35
1 files changed, 1 insertions, 34 deletions
diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
index edf3e5ca..997e87be 100644
--- a/src/libcamera/control_serializer.cpp
+++ b/src/libcamera/control_serializer.cpp
@@ -146,40 +146,7 @@ size_t ControlSerializer::binarySize(const ControlList &list)
void ControlSerializer::store(const ControlValue &value,
ByteStreamBuffer &buffer)
{
- switch (value.type()) {
- case ControlTypeBool: {
- bool data = value.get<bool>();
- buffer.write(&data);
- break;
- }
-
- case ControlTypeByte: {
- uint8_t data = value.get<uint8_t>();
- buffer.write(&data);
- break;
- }
-
- case ControlTypeInteger32: {
- int32_t data = value.get<int32_t>();
- buffer.write(&data);
- break;
- }
-
- case ControlTypeInteger64: {
- uint64_t data = value.get<int64_t>();
- buffer.write(&data);
- break;
- }
-
- case ControlTypeFloat: {
- float data = value.get<float>();
- buffer.write(&data);
- break;
- }
-
- default:
- break;
- }
+ buffer.write(value.data());
}
void ControlSerializer::store(const ControlRange &range,