From 5467d619251c05f04f737351eb45e191776a420c Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 16 Feb 2020 00:03:04 +0200 Subject: 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 Reviewed-by: Kieran Bingham --- src/libcamera/control_serializer.cpp | 35 +---------------------------------- 1 file changed, 1 insertion(+), 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(); - buffer.write(&data); - break; - } - - case ControlTypeByte: { - uint8_t data = value.get(); - buffer.write(&data); - break; - } - - case ControlTypeInteger32: { - int32_t data = value.get(); - buffer.write(&data); - break; - } - - case ControlTypeInteger64: { - uint64_t data = value.get(); - buffer.write(&data); - break; - } - - case ControlTypeFloat: { - float data = value.get(); - buffer.write(&data); - break; - } - - default: - break; - } + buffer.write(value.data()); } void ControlSerializer::store(const ControlRange &range, -- cgit v1.2.1