[libcamera-devel,v2,6/7] v4l2: v4l2_camera_proxy: Set the compressed flag in enum_fmt
diff mbox series

Message ID 20210908081437.4022697-7-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • v4l2-compat fixes
Related show

Commit Message

Paul Elder Sept. 8, 2021, 8:14 a.m. UTC
Set the compressed flag in ENUM_FMT if the format is MJPEG. As the only
compressed format that libcamera currently supports is MJPEG, this
should be sufficient.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 src/v4l2/v4l2_camera_proxy.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Laurent Pinchart Sept. 8, 2021, 9:24 a.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Wed, Sep 08, 2021 at 05:14:36PM +0900, Paul Elder wrote:
> Set the compressed flag in ENUM_FMT if the format is MJPEG. As the only
> compressed format that libcamera currently supports is MJPEG, this
> should be sufficient.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/v4l2/v4l2_camera_proxy.cpp | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index 5fbfcdd7..9de94fa1 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -276,8 +276,7 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *
>  	PixelFormat format = streamConfig_.formats().pixelformats()[arg->index];
>  	const V4L2PixelFormat &v4l2Format = V4L2PixelFormat::fromPixelFormat(format);
>  
> -	/* \todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */
> -	arg->flags = 0;
> +	arg->flags = format == formats::MJPEG ? V4L2_FMT_FLAG_COMPRESSED : 0;
>  	utils::strlcpy(reinterpret_cast<char *>(arg->description),
>  		       v4l2Format.toDescription(), sizeof(arg->description));
>  	arg->pixelformat = v4l2Format;

Patch
diff mbox series

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 5fbfcdd7..9de94fa1 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -276,8 +276,7 @@  int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *
 	PixelFormat format = streamConfig_.formats().pixelformats()[arg->index];
 	const V4L2PixelFormat &v4l2Format = V4L2PixelFormat::fromPixelFormat(format);
 
-	/* \todo Set V4L2_FMT_FLAG_COMPRESSED for compressed formats. */
-	arg->flags = 0;
+	arg->flags = format == formats::MJPEG ? V4L2_FMT_FLAG_COMPRESSED : 0;
 	utils::strlcpy(reinterpret_cast<char *>(arg->description),
 		       v4l2Format.toDescription(), sizeof(arg->description));
 	arg->pixelformat = v4l2Format;