[{"id":23941,"web_url":"https://patchwork.libcamera.org/comment/23941/","msgid":"<20220715205858.GA11583@duo.ucw.cz>","date":"2022-07-15T20:58:58","subject":"Re: [libcamera-devel] [PATCH 2/7] libcamera: formats: Search\n\tPixelFormatInfo on multiple formats","submitter":{"id":49,"url":"https://patchwork.libcamera.org/api/people/49/","name":"Pavel Machek","email":"pavel@ucw.cz"},"content":"Hi!\n\n> The PixelFormatInfo::info(const V4L2PixelFormat &format) function\n> returns the PixelFormatInfo associated with a V4L2 pixel format.\n> \n> As we prepare to associate multiple V4L2 formats to a single\n> PixelFormatInfo rework the function to search the given V4L2 format\n> in a list.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\n> +++ b/src/libcamera/formats.cpp\n> @@ -994,10 +994,19 @@ const PixelFormatInfo &PixelFormatInfo::info(const PixelFormat &format)\n>   */\n>  const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)\n>  {\n> +\tauto matchFormats = [&format](const std::vector<V4L2PixelFormat> &formats) {\n> +\t\tconst auto &it = std::find_if(formats.begin(), formats.end(),\n> +\t\t\t\t\t      [&format](const V4L2PixelFormat &fmt) {\n> +\t\t\t\t\t\t      return format == fmt;\n> +\t\t\t\t\t      });\n> +\n> +\t\treturn it == formats.end() ? false : true;\n\nI'd do it != formats.end() here.\n\nBest regards,\n\t\t\t\t\t\t\t\tPavel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E27F6BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Jul 2022 20:59:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2D26D63312;\n\tFri, 15 Jul 2022 22:59:01 +0200 (CEST)","from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 091E86330A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Jul 2022 22:59:00 +0200 (CEST)","by jabberwock.ucw.cz (Postfix, from userid 1017)\n\tid 6BC3E1C0001; Fri, 15 Jul 2022 22:58:59 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657918741;\n\tbh=t0gC38KfbPCRrWCuIuzJ8zSSgoDpah7H27EHQMvYm6E=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=3c2XODVC1N+usoyBDutdhiiNpVqzo0Fzn2H7O1cURRn4UAmLdrsfQKUPvRejn0aSq\n\tdWltUi5zgotiwxxMsBzhQcTiklXiJELMx05ynf6VpBQqDnhffniMpakMa02roRsZUb\n\tUo/MtJ1avRNsWWhaQhJ6w3K83LuJxpBAzXBsDoDUHG09z4yq2EgwnkBLwOXfl2xB5Y\n\tf/o9h59uGnBn7ypFkEk50pV19JClNqsdKeihsMbXGm31HfJLJQfad01IEek4+0Zclz\n\tYXRKXGgtL1VgaVv3grZJOSBDeOW58TDv83VipH/5q3WkfGn1npJLPyPkG3J4LmdAtB\n\temqD6JW2VwBxQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1;\n\tt=1657918739;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=H5OsD2jfnkJ/vQe2iK8quNaQmdILiSsyVFstgUI9UJQ=;\n\tb=UjDwS4p0KmINB7QcxizomFMK0FnIuSgB6UUk+F0KhzPZwq+ESCNSn/jkpskGUduPe4Pp0n\n\tyo8Y90qhY9Cp+X5FeDWGAt+nqEI/WRoipkfxXAYvF+VSmnUaP+cFlP1gQQHGnrjd19uZGH\n\th0H6guzJFuk3U66OcFZT/1bRgN7qF5o="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ucw.cz header.i=@ucw.cz\n\theader.b=\"UjDwS4p0\"; dkim-atps=neutral","Date":"Fri, 15 Jul 2022 22:58:58 +0200","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20220715205858.GA11583@duo.ucw.cz>","References":"<20220715135007.53574-1-jacopo@jmondi.org>\n\t<20220715135007.53574-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha1;\n\tprotocol=\"application/pgp-signature\"; boundary=\"UlVJffcvxoiEqYs2\"","Content-Disposition":"inline","In-Reply-To":"<20220715135007.53574-3-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 2/7] libcamera: formats: Search\n\tPixelFormatInfo on multiple formats","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Pavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Pavel Machek <pavel@ucw.cz>","Cc":"libcamera-devel@lists.libcamera.org, jozef@mlich.cz","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]