libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG

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@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Jacopo Mondi 2022-07-15 14:23:59 +02:00
parent d1abe2bdc8
commit ac54f2ac6d
2 changed files with 6 additions and 1 deletions

View file

@ -785,7 +785,10 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
{ formats::MJPEG, { { formats::MJPEG, {
.name = "MJPEG", .name = "MJPEG",
.format = formats::MJPEG, .format = formats::MJPEG,
.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), }, .v4l2Formats = {
V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
V4L2PixelFormat(V4L2_PIX_FMT_JPEG),
},
.bitsPerPixel = 0, .bitsPerPixel = 0,
.colourEncoding = PixelFormatInfo::ColourEncodingYUV, .colourEncoding = PixelFormatInfo::ColourEncodingYUV,
.packed = false, .packed = false,

View file

@ -183,6 +183,8 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
/* Compressed formats. */ /* Compressed formats. */
{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
{ formats::MJPEG, "Motion-JPEG" } }, { formats::MJPEG, "Motion-JPEG" } },
{ V4L2PixelFormat(V4L2_PIX_FMT_JPEG),
{ formats::MJPEG, "JPEG JFIF" } },
}; };
} /* namespace */ } /* namespace */