[libcamera-devel] [PATCH v4 6/6] libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG
Jacopo Mondi
jacopo at jmondi.org
Tue Aug 2 18:01:36 CEST 2022
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.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
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 b760ec0eff82..4746d38c30d2 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 264ca80aab27..8ec442d6b84d 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 */
--
2.37.1
More information about the libcamera-devel
mailing list