Skip to content

Commit 200d535

Browse files
Yudhistira ErlandinataJacopo Mondi
Yudhistira Erlandinata
authored and
Jacopo Mondi
committed
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 <[email protected]> Co-developed-by: Becker Hsieh <[email protected]> Co-developed-by: Harvey Yang <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Jacopo Mondi <[email protected]> Reviewed-by: Harvey Yang <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]>
1 parent 724bbf7 commit 200d535

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/libcamera/controls.h

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ enum ControlType {
3535
ControlTypeString,
3636
ControlTypeRectangle,
3737
ControlTypeSize,
38+
ControlTypePoint,
3839
};
3940

4041
namespace details {
@@ -97,6 +98,11 @@ struct control_type<Size> {
9798
static constexpr std::size_t size = 0;
9899
};
99100

101+
template<>
102+
struct control_type<Point> {
103+
static constexpr ControlType value = ControlTypePoint;
104+
};
105+
100106
template<typename T, std::size_t N>
101107
struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {
102108
static constexpr std::size_t size = N;

src/libcamera/controls.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static constexpr size_t ControlValueSize[] = {
6060
[ControlTypeString] = sizeof(char),
6161
[ControlTypeRectangle] = sizeof(Rectangle),
6262
[ControlTypeSize] = sizeof(Size),
63+
[ControlTypePoint] = sizeof(Point),
6364
};
6465

6566
} /* namespace */
@@ -254,6 +255,11 @@ std::string ControlValue::toString() const
254255
str += value->toString();
255256
break;
256257
}
258+
case ControlTypePoint: {
259+
const Point *value = reinterpret_cast<const Point *>(data);
260+
str += value->toString();
261+
break;
262+
}
257263
case ControlTypeNone:
258264
case ControlTypeString:
259265
break;

0 commit comments

Comments
 (0)