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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Jan 5 13:51:25 CET 2021


Hi Jacopo,

Thank you for the patch.

On Tue, Jan 05, 2021 at 01:31:25PM +0100, Jacopo Mondi wrote:
> 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.
> +	 */

Could we use the largest format instead ? Otherwise, if the current
format isn't the largest, we'll end up with a pixel array size that is
smaller than what the camera could produce.

Other than that this is exactly what I had in mind.

> +	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;
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list