From 200d535ca85f23e6c562335c5d9badb5be4db28f Mon Sep 17 00:00:00 2001 From: Yudhistira Erlandinata Date: Mon, 30 Sep 2024 16:02:24 +0200 Subject: libcamera: controls: Add ControlTypePoint Add a control_type<> specialization for libcamera::Point to allow storing data of that type in a ControlValue instance. The new control type will be used by controls introduced in the next patches. Signed-off-by: Yudhistira Erlandinata Co-developed-by: Becker Hsieh Co-developed-by: Harvey Yang Reviewed-by: Jacopo Mondi Signed-off-by: Jacopo Mondi Reviewed-by: Harvey Yang Reviewed-by: Laurent Pinchart --- include/libcamera/controls.h | 6 ++++++ src/libcamera/controls.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index c5131870..ca60bbac 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -35,6 +35,7 @@ enum ControlType { ControlTypeString, ControlTypeRectangle, ControlTypeSize, + ControlTypePoint, }; namespace details { @@ -97,6 +98,11 @@ struct control_type { static constexpr std::size_t size = 0; }; +template<> +struct control_type { + static constexpr ControlType value = ControlTypePoint; +}; + template struct control_type> : public control_type> { static constexpr std::size_t size = N; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index ea439730..62185d64 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -60,6 +60,7 @@ static constexpr size_t ControlValueSize[] = { [ControlTypeString] = sizeof(char), [ControlTypeRectangle] = sizeof(Rectangle), [ControlTypeSize] = sizeof(Size), + [ControlTypePoint] = sizeof(Point), }; } /* namespace */ @@ -254,6 +255,11 @@ std::string ControlValue::toString() const str += value->toString(); break; } + case ControlTypePoint: { + const Point *value = reinterpret_cast(data); + str += value->toString(); + break; + } case ControlTypeNone: case ControlTypeString: break; -- cgit v1.2.1