[libcamera-devel] [PATCH 2/7] libcamera: formats: Search PixelFormatInfo on multiple formats

Pavel Machek pavel at ucw.cz
Fri Jul 15 22:58:58 CEST 2022


Hi!

> The PixelFormatInfo::info(const V4L2PixelFormat &format) function
> returns the PixelFormatInfo associated with a V4L2 pixel format.
> 
> As we prepare to associate multiple V4L2 formats to a single
> PixelFormatInfo rework the function to search the given V4L2 format
> in a list.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

> +++ b/src/libcamera/formats.cpp
> @@ -994,10 +994,19 @@ const PixelFormatInfo &PixelFormatInfo::info(const PixelFormat &format)
>   */
>  const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
>  {
> +	auto matchFormats = [&format](const std::vector<V4L2PixelFormat> &formats) {
> +		const auto &it = std::find_if(formats.begin(), formats.end(),
> +					      [&format](const V4L2PixelFormat &fmt) {
> +						      return format == fmt;
> +					      });
> +
> +		return it == formats.end() ? false : true;

I'd do it != formats.end() here.

Best regards,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20220715/33602606/attachment.sig>


More information about the libcamera-devel mailing list