summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_pixelformat.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-07-29 11:40:02 +0200
committerJacopo Mondi <jacopo@jmondi.org>2022-08-03 15:07:19 +0200
commit3bc8844808c5c72f9c83927ec0e93434d9d40e22 (patch)
treedf6f9d1ee6e509da7179437e1e68757fae663589 /src/libcamera/v4l2_pixelformat.cpp
parentf25ad4a2b16bc8a0d44e8ca11c46f185b47c34b5 (diff)
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>
Diffstat (limited to 'src/libcamera/v4l2_pixelformat.cpp')
-rw-r--r--src/libcamera/v4l2_pixelformat.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index bdcdc3be..9f74bd37 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -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];
}
/**