libcamera: formats: Merge V4L2 single and multi formats

To each libcamera PixelFormat two V4L2 formats are associated, the
'single' and 'multi' format variants.

The two versions list plane contiguous and non-contiguous format
variants, and an optional argument to V4L2PixelFormat::fromPixelFormat()
was used to select which one to pick.

In order to prepare to remove V4L2PixelFormat::fromPixelFormat(), and
considering that no caller in the codebase uses the non-contiguous
format variant, merge the two formats vectors in a single one and
default the selection to the first available one, which is functionally
equivalent to what is currently implemented.

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-29 11:40:02 +02:00
parent f25ad4a2b1
commit 3bc8844808
4 changed files with 78 additions and 251 deletions
+1 -4
View File
@@ -53,10 +53,7 @@ public:
/* \todo Add support for non-contiguous memory planes */
const char *name;
PixelFormat format;
struct {
V4L2PixelFormat single;
V4L2PixelFormat multi;
} v4l2Formats;
std::vector<V4L2PixelFormat> v4l2Formats;
unsigned int bitsPerPixel;
enum ColourEncoding colourEncoding;
bool packed;
@@ -44,8 +44,7 @@ public:
const char *description() const;
PixelFormat toPixelFormat() const;
static V4L2PixelFormat fromPixelFormat(const PixelFormat &pixelFormat,
bool multiplanar = false);
static V4L2PixelFormat fromPixelFormat(const PixelFormat &pixelFormat);
private:
uint32_t fourcc_;