From patchwork Mon Dec 9 17:48:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22267 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 878A8C32DB for ; Mon, 9 Dec 2024 17:48:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2040567E79; Mon, 9 Dec 2024 18:48:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WJY4vplz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E326B67E71 for ; Mon, 9 Dec 2024 18:48:12 +0100 (CET) Received: from pb-laptop.local (185.221.143.90.nat.pool.zt.hu [185.221.143.90]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4092C502 for ; Mon, 9 Dec 2024 18:47:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733766461; bh=+qM61pwwECbpyrxtiqVOfH8Yz4HtnWILUvTD/U3EbIQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WJY4vplzfGMLbvDglbo+bcUJy0iKX6OHzyzR0q9lls/Z+h1L6HxjIVjTja3slMoCV KOLmpKS22UgHp07AUficX/ww6aIRQgbI7/NerPziIfp3NQ+fgQ/sKVG2CLxjqBOYXT MqGJHYtuKC0jA+R+r0nqkd/OAH4mJr3qb3qxnCpc= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 6/6] Documentation: guides: pipeline-handler: Query pixel formats once Date: Mon, 9 Dec 2024 18:48:06 +0100 Message-ID: <20241209174806.283905-6-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241209174806.283905-1-barnabas.pocze@ideasonboard.com> References: <20241209174806.283905-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" There is no reason to create an entire new copy of the same thing, so use the already existing `formats` object. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- Documentation/guides/pipeline-handler.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst index a798733db..069a69cdd 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -932,9 +932,9 @@ Add the following function implementation to your file: StreamConfiguration &cfg = config_[0]; - const std::vector formats = cfg.formats().pixelformats(); + const std::vector &formats = cfg.formats().pixelformats(); if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) { - cfg.pixelFormat = cfg.formats().pixelformats()[0]; + cfg.pixelFormat = formats[0]; LOG(VIVID, Debug) << "Adjusting format to " << cfg.pixelFormat.toString(); status = Adjusted; }