From 89b495c054e5704bb68a1cbc876e575c91499b47 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 5 Jan 2021 12:40:38 +0100 Subject: 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 Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/libcamera') 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 &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; -- cgit v1.2.1