summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-01-05 12:40:38 +0100
committerJacopo Mondi <jacopo@jmondi.org>2021-01-18 10:39:14 +0100
commit89b495c054e5704bb68a1cbc876e575c91499b47 (patch)
treefbaf308110ed8f822445623616689df5b57f8eff /src
parentc35123e6f91b6269cf6f5ae9216aeccebc545c75 (diff)
libcamera: uvc: Initialize the pixel array properties
Initialize the pixel array properties in the UVC pipeline handler as they're now initialized in the CameraSensor class, which the UVC pipeline handler does not use. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/uvcvideo/uvcvideo.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index 7cb310e2..08a59417 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -509,6 +509,22 @@ int UVCCameraData::init(MediaDevice *media)
properties_.set(properties::Location, properties::CameraLocationExternal);
properties_.set(properties::Model, utils::toAscii(media->model()));
+ /*
+ * Get the current format in order to initialize the sensor array
+ * properties.
+ */
+ Size resolution;
+ for (const auto &it : video_->formats()) {
+ const std::vector<SizeRange> &sizeRanges = it.second;
+ for (const SizeRange &sizeRange : sizeRanges) {
+ if (sizeRange.max > resolution)
+ resolution = sizeRange.max;
+ }
+ }
+
+ properties_.set(properties::PixelArraySize, resolution);
+ properties_.set(properties::PixelArrayActiveAreas, { Rectangle(resolution) });
+
/* Initialise the supported controls. */
ControlInfoMap::Map ctrls;