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

Jacopo Mondi jacopo at jmondi.org
Tue Jan 5 13:31:25 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 ue.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index 7cb310e20511..1efced949762 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -509,6 +509,19 @@ 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.
+	 */
+	V4L2DeviceFormat format;
+	ret = video_->getFormat(&format);
+	if (ret)
+		return ret;
+
+	properties_.set(properties::PixelArraySize, format.size);
+	properties_.set(properties::PixelArrayActiveAreas,
+			{ Rectangle(format.size) });
+
 	/* Initialise the supported controls. */
 	ControlInfoMap::Map ctrls;
 
-- 
2.29.2



More information about the libcamera-devel mailing list