/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Copyright (C) 2019, Google Inc. * * control_serializer.h - Control (de)serializer */ #ifndef __LIBCAMERA_CONTROL_SERIALIZER_H__ #define __LIBCAMERA_CONTROL_SERIALIZER_H__ #include #include #include #include namespace libcamera { class ByteStreamBuffer; class ControlSerializer { public: ControlSerializer(); void reset(); static size_t binarySize(const ControlInfoMap &info); static size_t binarySize(const ControlList &list); int serialize(const ControlInfoMap &info, ByteStreamBuffer &buffer); int serialize(const ControlList &list, ByteStreamBuffer &buffer); template T deserialize(ByteStreamBuffer &buffer); private: static size_t binarySize(const ControlValue &value); static size_t binarySize(const ControlRange &range); static void store(const ControlValue &value, ByteStreamBuffer &buffer); static void store(const ControlRange &range, ByteStreamBuffer &buffer); template T load(ControlType type, ByteStreamBuffer &b); unsigned int serial_; std::vector> controlIds_; std::map infoMaps_; std::map infoMapHandles_; }; } /* namespace libcamera */ #endif /* __LIBCAMERA_CONTROL_SERIALIZER_H__ */