[PATCH] cam: capture_script: Make parseRectangles work for non-array
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Fri Mar 8 11:42:18 CET 2024
From: Paul Elder <paul.elder at ideasonboard.com>
parseRectangles currently always parses Rectangle controls as an array
of Rectangles. This causes non-array Rectangle controls to not be parsed
correctly, as when the ControlValue is get()ed, the non-array assertion
will fail.
Set the ControlValue with a single Rectangle in case a single Rectangle
has been specified in the yaml capture script to fix that.
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
---
src/apps/cam/capture_script.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/apps/cam/capture_script.cpp b/src/apps/cam/capture_script.cpp
index 062a7258e414..1215713fac18 100644
--- a/src/apps/cam/capture_script.cpp
+++ b/src/apps/cam/capture_script.cpp
@@ -351,7 +351,10 @@ ControlValue CaptureScript::parseRectangles()
}
ControlValue controlValue;
- controlValue.set(Span<const Rectangle>(rectangles));
+ if (rectangles.size() == 1)
+ controlValue.set(rectangles.at(0));
+ else
+ controlValue.set(Span<const Rectangle>(rectangles));
return controlValue;
}
--
2.43.2
More information about the libcamera-devel
mailing list