diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2024-09-16 01:50:43 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-09-25 23:56:47 +0300 |
commit | ab67fdd210e30ad3806f10cb5f6d4e325059f8de (patch) | |
tree | 1f2caf1fb99b848ae5cb1a850ea0a7ea0804c0d1 /include | |
parent | 505e49b76ed4f3040182f66a1c3884ea1648a612 (diff) |
libcamera: controls: Add array information to ControlId
Add to ControlId information on whether or not it is an array control,
and the size of the control if it is an array control.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/controls.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 96a774cc..25f67ed9 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -46,50 +46,60 @@ struct control_type { template<> struct control_type<void> { static constexpr ControlType value = ControlTypeNone; + static constexpr std::size_t size = 0; }; template<> struct control_type<bool> { static constexpr ControlType value = ControlTypeBool; + static constexpr std::size_t size = 0; }; template<> struct control_type<uint8_t> { static constexpr ControlType value = ControlTypeByte; + static constexpr std::size_t size = 0; }; template<> struct control_type<int32_t> { static constexpr ControlType value = ControlTypeInteger32; + static constexpr std::size_t size = 0; }; template<> struct control_type<int64_t> { static constexpr ControlType value = ControlTypeInteger64; + static constexpr std::size_t size = 0; }; template<> struct control_type<float> { static constexpr ControlType value = ControlTypeFloat; + static constexpr std::size_t size = 0; }; template<> struct control_type<std::string> { static constexpr ControlType value = ControlTypeString; + static constexpr std::size_t size = 0; }; template<> struct control_type<Rectangle> { static constexpr ControlType value = ControlTypeRectangle; + static constexpr std::size_t size = 0; }; template<> struct control_type<Size> { static constexpr ControlType value = ControlTypeSize; + static constexpr std::size_t size = 0; }; template<typename T, std::size_t N> struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> { + static constexpr std::size_t size = N; }; } /* namespace details */ @@ -215,11 +225,14 @@ class ControlId { public: ControlId(unsigned int id, const std::string &name, ControlType type, + std::size_t size = 0, const std::map<std::string, int32_t> &enumStrMap = {}); unsigned int id() const { return id_; } const std::string &name() const { return name_; } ControlType type() const { return type_; } + bool isArray() const { return size_ > 0; } + std::size_t size() const { return size_; } const std::map<int32_t, std::string> &enumerators() const { return reverseMap_; } private: @@ -228,6 +241,7 @@ private: unsigned int id_; std::string name_; ControlType type_; + std::size_t size_; std::map<std::string, int32_t> enumStrMap_; std::map<int32_t, std::string> reverseMap_; }; @@ -259,7 +273,8 @@ public: using type = T; Control(unsigned int id, const char *name, const std::map<std::string, int32_t> &enumStrMap = {}) - : ControlId(id, name, details::control_type<std::remove_cv_t<T>>::value, enumStrMap) + : ControlId(id, name, details::control_type<std::remove_cv_t<T>>::value, + details::control_type<std::remove_cv_t<T>>::size, enumStrMap) { } |