[libcamera-devel,v2,8/8] libcamera: v4l2_pixelformat: Map formats::MJPEG to V4L2_PIX_FMT_JPEG
diff mbox series

Message ID 20220723095330.43542-9-jacopo@jmondi.org
State Superseded, archived
Headers show
Series
  • libcamera: Map multiple V4L2 formats to a single libcamera::format
Related show

Commit Message

Jacopo Mondi July 23, 2022, 9:53 a.m. UTC
Map the application visibile formats::MJPEG format to the V4L2_PIX_FMT_JPEG
format.

Both V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG map to the same libcamera
MJPEG format.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/v4l2_pixelformat.cpp | 2 ++
 1 file changed, 2 insertions(+)

--
2.37.1

Comments

Laurent Pinchart July 23, 2022, 5:49 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Sat, Jul 23, 2022 at 11:53:30AM +0200, Jacopo Mondi via libcamera-devel wrote:
> Map the application visibile formats::MJPEG format to the V4L2_PIX_FMT_JPEG
> format.
> 
> Both V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG map to the same libcamera
> MJPEG format.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/libcamera/v4l2_pixelformat.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index 7ab63f092a28..8d3bc5d534c5 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -183,6 +183,8 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
>  	/* Compressed formats. */
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
>  		{ formats::MJPEG, "Motion-JPEG" } },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_JPEG),
> +		{ formats::MJPEG, "JPEG JFIF" } },

Maybe swapped for alphabetical order ?

Otherwise it looks good to me, but I'd squash it with 7/8.

>  };
> 
>  } /* namespace */

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 7ab63f092a28..8d3bc5d534c5 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -183,6 +183,8 @@  const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
 	/* Compressed formats. */
 	{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
 		{ formats::MJPEG, "Motion-JPEG" } },
+	{ V4L2PixelFormat(V4L2_PIX_FMT_JPEG),
+		{ formats::MJPEG, "JPEG JFIF" } },
 };

 } /* namespace */