[libcamera-devel] [PATCH v7 07/10] libcamera: uvc: Initialize the pixel array properties

Jacopo Mondi jacopo at jmondi.org
Fri Jan 15 18:00:30 CET 2021


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 at ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index 7cb310e20511..08a594175091 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;
 
-- 
2.29.2



More information about the libcamera-devel mailing list