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:
@@ -304,24 +304,20 @@ PixelFormat V4L2PixelFormat::toPixelFormat() const
|
||||
/**
|
||||
* \brief Convert \a pixelFormat to its corresponding V4L2PixelFormat
|
||||
* \param[in] pixelFormat The PixelFormat to convert
|
||||
* \param[in] multiplanar V4L2 Multiplanar API support flag
|
||||
*
|
||||
* Multiple V4L2 formats may exist for one PixelFormat when the format uses
|
||||
* multiple planes, as V4L2 defines separate 4CCs for contiguous and separate
|
||||
* planes formats. Set the \a multiplanar parameter to false to select a format
|
||||
* with contiguous planes, or to true to select a format with non-contiguous
|
||||
* planes.
|
||||
* Multiple V4L2 formats may exist for one PixelFormat as V4L2 defines separate
|
||||
* 4CCs for contiguous and non-contiguous versions of the same image format.
|
||||
* When that is the case, this function returns the contiguous planes format.
|
||||
*
|
||||
* \return The V4L2PixelFormat corresponding to \a pixelFormat
|
||||
*/
|
||||
V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat,
|
||||
bool multiplanar)
|
||||
V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat)
|
||||
{
|
||||
const PixelFormatInfo &info = PixelFormatInfo::info(pixelFormat);
|
||||
if (!info.isValid())
|
||||
return V4L2PixelFormat();
|
||||
|
||||
return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single;
|
||||
return info.v4l2Formats[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user