[libcamera-devel,v2,1/8] libcamera: formats: Support multiple V4L2 pixel formats
diff mbox series

Message ID 20220723095330.43542-2-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
Associate a list of V4L2PixelFormat entries to a libcamera Format in
the PixelFormatInfo. This change prepares for supporting through a
single libcamera Format devices which use different but equivalent
versions of the same format, like V4L2_PIX_FMT_MJPEG and
V4L2_PIX_FMT_JPEG.

Change the existing users to always use the first entry to not break
the build.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 include/libcamera/internal/formats.h |   4 +-
 src/libcamera/formats.cpp            | 248 +++++++++++++--------------
 src/libcamera/v4l2_pixelformat.cpp   |   2 +-
 3 files changed, 127 insertions(+), 127 deletions(-)

Comments

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

Thank you for the patch.

On Sat, Jul 23, 2022 at 11:53:23AM +0200, Jacopo Mondi via libcamera-devel wrote:
> Associate a list of V4L2PixelFormat entries to a libcamera Format in

s/libcamera Format/libcamera PixelFormat/

Or just PixelFormat.

> the PixelFormatInfo. This change prepares for supporting through a
> single libcamera Format devices which use different but equivalent

Same here.

> versions of the same format, like V4L2_PIX_FMT_MJPEG and
> V4L2_PIX_FMT_JPEG.
> 
> Change the existing users to always use the first entry to not break
> the build.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  include/libcamera/internal/formats.h |   4 +-
>  src/libcamera/formats.cpp            | 248 +++++++++++++--------------
>  src/libcamera/v4l2_pixelformat.cpp   |   2 +-
>  3 files changed, 127 insertions(+), 127 deletions(-)
> 
> diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h
> index ee599765be47..90c8b2cda78a 100644
> --- a/include/libcamera/internal/formats.h
> +++ b/include/libcamera/internal/formats.h
> @@ -54,8 +54,8 @@ public:
>  	const char *name;
>  	PixelFormat format;
>  	struct {
> -		V4L2PixelFormat single;
> -		V4L2PixelFormat multi;
> +		std::vector<V4L2PixelFormat> single;
> +		std::vector<V4L2PixelFormat> multi;
>  	} v4l2Formats;

I'd like to merge the two vectors into a single one, and just have

	std::vector<V4L2PixelFormat> v4l2Formats;

That won't allow differentiating between single and multiplanar formats
anymore, but none of the existing code does that. It would still allow
picking the single or multiplanar format supported by the device for a
given libcamera format. If a device supports both single and multiplanar
variants we have no information that we can use to pick one of them in
particular anyway, and that problem should be solved by V4L2 extensions
to add data offset support to planes.

This doesn't have to be done in this patch as long as it's part of the
series, but I'm not sure introducing two vectors and merging them in a
subsequent step would really help.

>  	unsigned int bitsPerPixel;
>  	enum ColourEncoding colourEncoding;
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 283ecb3d89d8..f7e9adc7ff77 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -157,8 +157,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "RGB565",
>  		.format = formats::RGB565,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGB565),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGB565) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -170,8 +170,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "RGB565_BE",
>  		.format = formats::RGB565_BE,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGB565X),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGB565X) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -183,8 +183,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "BGR888",
>  		.format = formats::BGR888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGB24),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGB24) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 24,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -196,8 +196,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "RGB888",
>  		.format = formats::RGB888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_BGR24),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_BGR24) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 24,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -209,8 +209,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "XRGB8888",
>  		.format = formats::XRGB8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_XBGR32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -222,8 +222,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "XBGR8888",
>  		.format = formats::XBGR8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGBX32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -235,8 +235,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "RGBX8888",
>  		.format = formats::RGBX8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_BGRX32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_BGRX32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -248,8 +248,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "BGRX8888",
>  		.format = formats::BGRX8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -261,8 +261,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "ABGR8888",
>  		.format = formats::ABGR8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGBA32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -274,8 +274,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "ARGB8888",
>  		.format = formats::ARGB8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_ABGR32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -287,8 +287,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "BGRA8888",
>  		.format = formats::BGRA8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_ARGB32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -300,8 +300,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "RGBA8888",
>  		.format = formats::RGBA8888,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_BGRA32),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 32,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
> @@ -315,8 +315,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YUYV",
>  		.format = formats::YUYV,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_YUYV),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YUYV) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -328,8 +328,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YVYU",
>  		.format = formats::YVYU,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_YVYU),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YVYU) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -341,8 +341,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "UYVY",
>  		.format = formats::UYVY,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_UYVY),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_UYVY) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -354,8 +354,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "VYUY",
>  		.format = formats::VYUY,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_VYUY),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_VYUY) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -369,8 +369,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "NV12",
>  		.format = formats::NV12,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV12),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV12M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV12) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV12M) },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -382,8 +382,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "NV21",
>  		.format = formats::NV21,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV21),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV21M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV21) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV21M) },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -395,8 +395,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "NV16",
>  		.format = formats::NV16,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV16),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV16M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV16) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV16M) },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -408,8 +408,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "NV61",
>  		.format = formats::NV61,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV61),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV61M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV61) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV61M) },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -421,8 +421,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "NV24",
>  		.format = formats::NV24,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV24),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV24) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 24,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -434,8 +434,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "NV42",
>  		.format = formats::NV42,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV42),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV42) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 24,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -447,8 +447,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YUV420",
>  		.format = formats::YUV420,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_YUV420),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV420M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YUV420) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YUV420M) },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -460,8 +460,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YVU420",
>  		.format = formats::YVU420,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_YVU420),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU420M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YVU420) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YVU420M) },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -473,8 +473,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YUV422",
>  		.format = formats::YUV422,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_YUV422P),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV422M),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YUV422P) },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YUV422M) },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -486,8 +486,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YVU422",
>  		.format = formats::YVU422,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU422M),
> +			.single = { V4L2PixelFormat() },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YVU422M) },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -499,8 +499,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YUV444",
>  		.format = formats::YUV444,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
> +			.single = { V4L2PixelFormat() },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YUV444M) },
>  		},
>  		.bitsPerPixel = 24,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -512,8 +512,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "YVU444",
>  		.format = formats::YVU444,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(),
> -			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU444M),
> +			.single = { V4L2PixelFormat() },
> +			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YVU444M) },
>  		},
>  		.bitsPerPixel = 24,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -527,8 +527,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "R8",
>  		.format = formats::R8,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_GREY),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_GREY) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 8,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -540,8 +540,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "R10",
>  		.format = formats::R10,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_Y10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_Y10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -553,8 +553,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "R12",
>  		.format = formats::R12,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_Y12),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_Y12) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -566,8 +566,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "R10_CSI2P",
>  		.format = formats::R10,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_Y10P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -581,8 +581,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR8",
>  		.format = formats::SBGGR8,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 8,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -594,8 +594,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG8",
>  		.format = formats::SGBRG8,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 8,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -607,8 +607,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG8",
>  		.format = formats::SGRBG8,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 8,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -620,8 +620,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB8",
>  		.format = formats::SRGGB8,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 8,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -633,8 +633,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR10",
>  		.format = formats::SBGGR10,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -646,8 +646,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG10",
>  		.format = formats::SGBRG10,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -659,8 +659,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG10",
>  		.format = formats::SGRBG10,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -672,8 +672,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB10",
>  		.format = formats::SRGGB10,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -685,8 +685,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR10_CSI2P",
>  		.format = formats::SBGGR10_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -698,8 +698,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG10_CSI2P",
>  		.format = formats::SGBRG10_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -711,8 +711,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG10_CSI2P",
>  		.format = formats::SGRBG10_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -724,8 +724,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB10_CSI2P",
>  		.format = formats::SRGGB10_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -737,8 +737,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR12",
>  		.format = formats::SBGGR12,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -750,8 +750,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG12",
>  		.format = formats::SGBRG12,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -763,8 +763,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG12",
>  		.format = formats::SGRBG12,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -776,8 +776,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB12",
>  		.format = formats::SRGGB12,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -789,8 +789,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR12_CSI2P",
>  		.format = formats::SBGGR12_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -802,8 +802,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG12_CSI2P",
>  		.format = formats::SGBRG12_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -815,8 +815,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG12_CSI2P",
>  		.format = formats::SGRBG12_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -828,8 +828,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB12_CSI2P",
>  		.format = formats::SRGGB12_CSI2P,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -841,8 +841,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR16",
>  		.format = formats::SBGGR16,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -854,8 +854,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG16",
>  		.format = formats::SGBRG16,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -867,8 +867,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG16",
>  		.format = formats::SGRBG16,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -880,8 +880,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB16",
>  		.format = formats::SRGGB16,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -893,8 +893,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SBGGR10_IPU3",
>  		.format = formats::SBGGR10_IPU3,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -907,8 +907,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGBRG10_IPU3",
>  		.format = formats::SGBRG10_IPU3,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -920,8 +920,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SGRBG10_IPU3",
>  		.format = formats::SGRBG10_IPU3,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -933,8 +933,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "SRGGB10_IPU3",
>  		.format = formats::SRGGB10_IPU3,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 10,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> @@ -948,8 +948,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.name = "MJPEG",
>  		.format = formats::MJPEG,
>  		.v4l2Formats = {
> -			.single = V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
> -			.multi = V4L2PixelFormat(),
> +			.single = { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG) },
> +			.multi = { V4L2PixelFormat() },
>  		},
>  		.bitsPerPixel = 0,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -996,8 +996,8 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
>  {
>  	const auto &info = std::find_if(pixelFormatInfo.begin(), pixelFormatInfo.end(),
>  					[format](auto pair) {
> -						return pair.second.v4l2Formats.single == format ||
> -						       pair.second.v4l2Formats.multi == format;
> +						return pair.second.v4l2Formats.single[0] == format ||
> +						       pair.second.v4l2Formats.multi[0] == format;
>  					});
>  	if (info == pixelFormatInfo.end())
>  		return pixelFormatInfoInvalid;
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index 58fc4e9d2032..cf6c1858bd1a 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -321,7 +321,7 @@ V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat,
>  	if (!info.isValid())
>  		return V4L2PixelFormat();
>  
> -	return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single;
> +	return multiplanar ? info.v4l2Formats.multi[0] : info.v4l2Formats.single[0];
>  }
>  
>  /**

Patch
diff mbox series

diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h
index ee599765be47..90c8b2cda78a 100644
--- a/include/libcamera/internal/formats.h
+++ b/include/libcamera/internal/formats.h
@@ -54,8 +54,8 @@  public:
 	const char *name;
 	PixelFormat format;
 	struct {
-		V4L2PixelFormat single;
-		V4L2PixelFormat multi;
+		std::vector<V4L2PixelFormat> single;
+		std::vector<V4L2PixelFormat> multi;
 	} v4l2Formats;
 	unsigned int bitsPerPixel;
 	enum ColourEncoding colourEncoding;
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index 283ecb3d89d8..f7e9adc7ff77 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -157,8 +157,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "RGB565",
 		.format = formats::RGB565,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGB565),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGB565) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -170,8 +170,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "RGB565_BE",
 		.format = formats::RGB565_BE,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGB565X),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGB565X) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -183,8 +183,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "BGR888",
 		.format = formats::BGR888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGB24),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGB24) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -196,8 +196,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "RGB888",
 		.format = formats::RGB888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_BGR24),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_BGR24) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -209,8 +209,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "XRGB8888",
 		.format = formats::XRGB8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_XBGR32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -222,8 +222,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "XBGR8888",
 		.format = formats::XBGR8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGBX32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -235,8 +235,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "RGBX8888",
 		.format = formats::RGBX8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_BGRX32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_BGRX32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -248,8 +248,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "BGRX8888",
 		.format = formats::BGRX8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -261,8 +261,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "ABGR8888",
 		.format = formats::ABGR8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_RGBA32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -274,8 +274,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "ARGB8888",
 		.format = formats::ARGB8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_ABGR32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -287,8 +287,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "BGRA8888",
 		.format = formats::BGRA8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_ARGB32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -300,8 +300,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "RGBA8888",
 		.format = formats::RGBA8888,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_BGRA32),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 32,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRGB,
@@ -315,8 +315,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YUYV",
 		.format = formats::YUYV,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_YUYV),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YUYV) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -328,8 +328,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YVYU",
 		.format = formats::YVYU,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_YVYU),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YVYU) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -341,8 +341,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "UYVY",
 		.format = formats::UYVY,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_UYVY),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_UYVY) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -354,8 +354,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "VYUY",
 		.format = formats::VYUY,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_VYUY),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_VYUY) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -369,8 +369,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "NV12",
 		.format = formats::NV12,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV12),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV12M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV12) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV12M) },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -382,8 +382,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "NV21",
 		.format = formats::NV21,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV21),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV21M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV21) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV21M) },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -395,8 +395,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "NV16",
 		.format = formats::NV16,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV16),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV16M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV16) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV16M) },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -408,8 +408,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "NV61",
 		.format = formats::NV61,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV61),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_NV61M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV61) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_NV61M) },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -421,8 +421,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "NV24",
 		.format = formats::NV24,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV24),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV24) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -434,8 +434,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "NV42",
 		.format = formats::NV42,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_NV42),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_NV42) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -447,8 +447,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YUV420",
 		.format = formats::YUV420,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_YUV420),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV420M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YUV420) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YUV420M) },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -460,8 +460,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YVU420",
 		.format = formats::YVU420,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_YVU420),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU420M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YVU420) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YVU420M) },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -473,8 +473,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YUV422",
 		.format = formats::YUV422,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_YUV422P),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV422M),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_YUV422P) },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YUV422M) },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -486,8 +486,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YVU422",
 		.format = formats::YVU422,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU422M),
+			.single = { V4L2PixelFormat() },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YVU422M) },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -499,8 +499,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YUV444",
 		.format = formats::YUV444,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
+			.single = { V4L2PixelFormat() },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YUV444M) },
 		},
 		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -512,8 +512,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "YVU444",
 		.format = formats::YVU444,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(),
-			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU444M),
+			.single = { V4L2PixelFormat() },
+			.multi = { V4L2PixelFormat(V4L2_PIX_FMT_YVU444M) },
 		},
 		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -527,8 +527,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "R8",
 		.format = formats::R8,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_GREY),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_GREY) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 8,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -540,8 +540,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "R10",
 		.format = formats::R10,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_Y10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_Y10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -553,8 +553,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "R12",
 		.format = formats::R12,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_Y12),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_Y12) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -566,8 +566,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "R10_CSI2P",
 		.format = formats::R10,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_Y10P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -581,8 +581,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR8",
 		.format = formats::SBGGR8,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 8,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -594,8 +594,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG8",
 		.format = formats::SGBRG8,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 8,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -607,8 +607,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG8",
 		.format = formats::SGRBG8,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 8,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -620,8 +620,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB8",
 		.format = formats::SRGGB8,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 8,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -633,8 +633,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR10",
 		.format = formats::SBGGR10,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -646,8 +646,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG10",
 		.format = formats::SGBRG10,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -659,8 +659,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG10",
 		.format = formats::SGRBG10,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -672,8 +672,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB10",
 		.format = formats::SRGGB10,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -685,8 +685,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR10_CSI2P",
 		.format = formats::SBGGR10_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -698,8 +698,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG10_CSI2P",
 		.format = formats::SGBRG10_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -711,8 +711,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG10_CSI2P",
 		.format = formats::SGRBG10_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -724,8 +724,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB10_CSI2P",
 		.format = formats::SRGGB10_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -737,8 +737,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR12",
 		.format = formats::SBGGR12,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -750,8 +750,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG12",
 		.format = formats::SGBRG12,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -763,8 +763,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG12",
 		.format = formats::SGRBG12,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -776,8 +776,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB12",
 		.format = formats::SRGGB12,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -789,8 +789,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR12_CSI2P",
 		.format = formats::SBGGR12_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -802,8 +802,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG12_CSI2P",
 		.format = formats::SGBRG12_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -815,8 +815,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG12_CSI2P",
 		.format = formats::SGRBG12_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -828,8 +828,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB12_CSI2P",
 		.format = formats::SRGGB12_CSI2P,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -841,8 +841,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR16",
 		.format = formats::SBGGR16,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -854,8 +854,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG16",
 		.format = formats::SGBRG16,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -867,8 +867,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG16",
 		.format = formats::SGRBG16,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -880,8 +880,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB16",
 		.format = formats::SRGGB16,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -893,8 +893,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SBGGR10_IPU3",
 		.format = formats::SBGGR10_IPU3,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -907,8 +907,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGBRG10_IPU3",
 		.format = formats::SGBRG10_IPU3,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -920,8 +920,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SGRBG10_IPU3",
 		.format = formats::SGRBG10_IPU3,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -933,8 +933,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "SRGGB10_IPU3",
 		.format = formats::SRGGB10_IPU3,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 10,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
@@ -948,8 +948,8 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.name = "MJPEG",
 		.format = formats::MJPEG,
 		.v4l2Formats = {
-			.single = V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
-			.multi = V4L2PixelFormat(),
+			.single = { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG) },
+			.multi = { V4L2PixelFormat() },
 		},
 		.bitsPerPixel = 0,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -996,8 +996,8 @@  const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
 {
 	const auto &info = std::find_if(pixelFormatInfo.begin(), pixelFormatInfo.end(),
 					[format](auto pair) {
-						return pair.second.v4l2Formats.single == format ||
-						       pair.second.v4l2Formats.multi == format;
+						return pair.second.v4l2Formats.single[0] == format ||
+						       pair.second.v4l2Formats.multi[0] == format;
 					});
 	if (info == pixelFormatInfo.end())
 		return pixelFormatInfoInvalid;
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 58fc4e9d2032..cf6c1858bd1a 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -321,7 +321,7 @@  V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat,
 	if (!info.isValid())
 		return V4L2PixelFormat();
 
-	return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single;
+	return multiplanar ? info.v4l2Formats.multi[0] : info.v4l2Formats.single[0];
 }
 
 /**