[libcamera-devel] [PATCH v3 6/6] libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Jul 29 20:41:11 CEST 2022
Hi Jacopo,
Thank you for the patch.
On Fri, Jul 29, 2022 at 06:00:14PM +0200, Jacopo Mondi via libcamera-devel wrote:
> The V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG formats are under-specified
> and are used interchangeably by kernel drivers.
>
> Map both of them to formats::MJPEG and use the newly re-introduced
> V4L2VideoDevice::toV4L2PixelFormat() to map to the one actually used by
> the video device.
This patches doesn't change usage of toV4L2PixelFormat(), I would drop
"and use ...".
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
> src/libcamera/formats.cpp | 5 ++++-
> src/libcamera/v4l2_pixelformat.cpp | 2 ++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 6921d5c43bcb..ff77ab23dda7 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -785,7 +785,10 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
> { formats::MJPEG, {
> .name = "MJPEG",
> .format = formats::MJPEG,
> - .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), },
> + .v4l2Formats = {
> + V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
> + V4L2PixelFormat(V4L2_PIX_FMT_JPEG),
> + },
> .bitsPerPixel = 0,
> .colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> .packed = false,
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index bca97d1e3b4f..6abd2fa18312 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 */
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list