libcamera: controls: Add rectangle and size control types

Add two control types to store rectangles and sizes. These will be
useful for the properties related to the pixel array.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart 2020-02-29 03:39:46 +02:00
parent 8a9be175a7
commit d4680c8ca2
2 changed files with 25 additions and 0 deletions

View file

@ -13,6 +13,7 @@
#include <string>
#include <unordered_map>
#include <libcamera/geometry.h>
#include <libcamera/span.h>
namespace libcamera {
@ -27,6 +28,8 @@ enum ControlType {
ControlTypeInteger64,
ControlTypeFloat,
ControlTypeString,
ControlTypeRectangle,
ControlTypeSize,
};
namespace details {
@ -70,6 +73,16 @@ struct control_type<std::string> {
static constexpr ControlType value = ControlTypeString;
};
template<>
struct control_type<Rectangle> {
static constexpr ControlType value = ControlTypeRectangle;
};
template<>
struct control_type<Size> {
static constexpr ControlType value = ControlTypeSize;
};
template<typename T, std::size_t N>
struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {
};