[libcamera-devel] [PATCH 2/2] v4l2: v4l2_camera_proxy: Report the proper format name in enum_fmt

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Sep 7 11:07:09 CEST 2021


Hi Paul,

Thank you for the patch.

On Tue, Sep 07, 2021 at 04:13:11PM +0900, Paul Elder wrote:
> Now that libcamera has the V4L2 format names, retrive and report those

s/retrive/retrieve/

> names in ENUM_FMT. While at it, refactor the code slightly with
> PixelFormatInfo.
> 
> This fixes the test failures on v4l2-compliance with the v4l2
> compatilibity layer that were observed in version v4l2-compliance
> version 1.21.0-4838.
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
>  src/v4l2/v4l2_camera_proxy.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index 07b1a90a..ec335ce2 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -270,13 +270,13 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *
>  		return -EINVAL;
>  
>  	PixelFormat format = streamConfig_.formats().pixelformats()[arg->index];
> +	PixelFormatInfo info = PixelFormatInfo::info(format);

const reference. I should make PixelFormatInfo non-copyable.

>  
>  	/* \todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */
>  	arg->flags = 0;

Could you add a patch to address this ? As we don't plan to support
other compressed formats than MJPEG, it can be as simple as setting
V4L2_FMT_FLAG_COMPRESSED iif the format is MJPEG.

> -	/* \todo Add map from format to description. */
>  	utils::strlcpy(reinterpret_cast<char *>(arg->description),
> -		       "Video Format Description", sizeof(arg->description));
> -	arg->pixelformat = PixelFormatInfo::info(format).v4l2Format;
> +		       info.v4l2Name, sizeof(arg->description));
> +	arg->pixelformat = info.v4l2Format;
>  
>  	memset(arg->reserved, 0, sizeof(arg->reserved));
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list