From cd0f7929ec0bdf3c98e552a6ce2e9147b8c6dd17 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 15 Feb 2020 23:59:54 +0200 Subject: libcamera: controls: Expose raw data in ControlValue Add a data() function to the ControlValue class to expose the raw data stored by the class as a Span. This will be useful to simplify the serialization of ControlValue instances. The size computation for the raw data is moved from the ControlSerializer, which is updated accordingly to use the data() function in order to access the size. Simplification of the ControlSerializer will happen in a subsequent change. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/control_serializer.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/libcamera/control_serializer.cpp') diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp index 803ac16c..2b66ab97 100644 --- a/src/libcamera/control_serializer.cpp +++ b/src/libcamera/control_serializer.cpp @@ -27,17 +27,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Serializer) -namespace { - -static constexpr size_t ControlValueSize[] = { - [ControlTypeNone] = 1, - [ControlTypeBool] = sizeof(bool), - [ControlTypeInteger32] = sizeof(int32_t), - [ControlTypeInteger64] = sizeof(int64_t), -}; - -} /* namespace */ - /** * \class ControlSerializer * \brief Serializer and deserializer for control-related classes @@ -106,7 +95,7 @@ void ControlSerializer::reset() size_t ControlSerializer::binarySize(const ControlValue &value) { - return ControlValueSize[value.type()]; + return value.data().size_bytes(); } size_t ControlSerializer::binarySize(const ControlRange &range) -- cgit v1.2.1