From patchwork Mon Dec 9 17:48:01 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: 22262 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 2EFCFBD80A for ; Mon, 9 Dec 2024 17:48:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 77B9467E74; Mon, 9 Dec 2024 18:48:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SsihS3I5"; 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 D207966132 for ; Mon, 9 Dec 2024 18:48:11 +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 053B1502 for ; Mon, 9 Dec 2024 18:47:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733766460; bh=UQIX/9EeIYX+XoqtMfPYpX56t3PKVaz3iwpJ+1qMiXY=; h=From:To:Subject:Date:From; b=SsihS3I52LcL7GE5exFrYcnzWFbNHuIxW/GEft16bY3kdSmdgINIvXnbbnBnZymLS pzYn75MJCYnjHypyo75x/DR4xR0F1dWfQMbwLNZAqDQ9eETVeb1x7We10dAGX/se4q Nt3wv6MvFqiTwcbvkWX4Uvh5J23a6ahO7NZwo+KE= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 1/6] Documentation: guides: pipeline-handler: Fix camera creation Date: Mon, 9 Dec 2024 18:48:01 +0100 Message-ID: <20241209174806.283905-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.47.1 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" 1. The unique_ptr containing the private data must be passed to `Camera::create()`. 2. `registerCamera()` needs only the pointer to the `Camera` Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- Documentation/guides/pipeline-handler.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst index 69e832a55..94527c401 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -527,8 +527,8 @@ PipelineHandler successfully matched and constructed a device. .. code-block:: cpp std::set streams{ &data->stream_ }; - std::shared_ptr camera = Camera::create(this, data->video_->deviceName(), streams); - registerCamera(std::move(camera), std::move(data)); + std::shared_ptr camera = Camera::create(std::move(data), data->video_->deviceName(), streams); + registerCamera(std::move(camera)); return true; @@ -554,8 +554,7 @@ Our match function should now look like the following: /* Create and register the camera. */ std::set streams{ &data->stream_ }; - const std::string &id = data->video_->deviceName(); - std::shared_ptr camera = Camera::create(data.release(), id, streams); + std::shared_ptr camera = Camera::create(std::move(data), data->video_->deviceName(), streams); registerCamera(std::move(camera)); return true; From patchwork Mon Dec 9 17:48:02 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: 22263 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 80AE5BD80A for ; Mon, 9 Dec 2024 17:48:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1B17867E7B; Mon, 9 Dec 2024 18:48:17 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="eA+Y4/E2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A89867E62 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 4309F788 for ; Mon, 9 Dec 2024 18:47:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733766460; bh=rG/8tVS2744L7eQxiiOQG/P2UY20szdGc/7n7zbNSmI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eA+Y4/E2mUoQdOAdrVMkGRCrkudUlI4zOBgYrenuZOoaOWVM30ySW8dWXNZSGdJws P3WzEN7CtGLJs25iZRd5LyA+zZA4rObC+TCc+P2mc3na+LCSn+Q67iaAF8jC0VgrZA OJZv5mKThVM7o8wHvqzNkvhnOKWxd5ZypIc0WCt8= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 2/6] Documentation: guides: pipeline-handler: Fix property list file name Date: Mon, 9 Dec 2024 18:48:02 +0100 Message-ID: <20241209174806.283905-2-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" It is `property_ids_core.yaml`. 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 94527c401..1574fe738 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -592,11 +592,11 @@ immutable properties of the ``Camera`` device. The libcamera controls and properties are defined in YAML form which is processed to automatically generate documentation and interfaces. Controls are defined by the src/libcamera/`control_ids_core.yaml`_ file and camera properties -are defined by src/libcamera/`properties_ids_core.yaml`_. +are defined by src/libcamera/`property_ids_core.yaml`_. .. _controls framework: https://libcamera.org/api-html/controls_8h.html .. _control_ids_core.yaml: https://libcamera.org/api-html/control__ids_8h.html -.. _properties_ids_core.yaml: https://libcamera.org/api-html/property__ids_8h.html +.. _property_ids_core.yaml: https://libcamera.org/api-html/property__ids_8h.html Pipeline handlers can optionally register the list of controls an application can set as well as a list of immutable camera properties. Being both From patchwork Mon Dec 9 17:48:03 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: 22264 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 A8696BD80A for ; Mon, 9 Dec 2024 17:48:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9CA1967E73; Mon, 9 Dec 2024 18:48:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FBTWjL+U"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3807167E69 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 7F9C783D for ; Mon, 9 Dec 2024 18:47:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733766460; bh=TIq/o2U8aiMo7e9ir94fSU/5FtT5nScZxkcpOc3FEAs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FBTWjL+U5lrec0NfA/RmG84Jzgp/so2k9ZmB0PRj3mJt2zgSfVXqMcZTaMoJX+SBw k2KYQo29INMasX+Q91DSfEERhV3Oe4VDdEQUZIERtbKcUXcQJrXzcfwjFnWb84dGMd Wwt9SaqLdzoW/HJcCPzsLEsWv++qycS0dVMLCrC0= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 3/6] Documentation: guides: pipeline-handler: Fix configuration creation Date: Mon, 9 Dec 2024 18:48:03 +0100 Message-ID: <20241209174806.283905-3-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" `PipelineHandler::generateConfiguration()` returns an `std::unique_ptr`. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- Documentation/guides/pipeline-handler.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst index 1574fe738..ec5cf4d55 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -799,8 +799,7 @@ derived class, and assign it to a base class pointer. .. code-block:: cpp - VividCameraData *data = cameraData(camera); - CameraConfiguration *config = new VividCameraConfiguration(); + std::unique_ptr config = std::make_unique(); A ``CameraConfiguration`` is specific to each pipeline, so you can only create it from the pipeline handler code path. Applications can also generate an empty From patchwork Mon Dec 9 17:48:04 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: 22265 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 D553CC32D4 for ; Mon, 9 Dec 2024 17:48:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2544767E69; Mon, 9 Dec 2024 18:48:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZtTQhiW+"; 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 7222567E6F 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 BB1E7502 for ; Mon, 9 Dec 2024 18:47:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733766460; bh=yXD2cLwbO83KUEZKW4fjCbhrU00THLQz4/2BmtR0UgQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZtTQhiW+ocWj+3+8p+3KY0fw/upDnUe45o3hGndG+jkhgo6wvK4SryF3491alI35f 0Br1nkQtvPkhBl90aMtvZZg9rkS5ofPeLI5/5H5MALj1p8+KfYl4A/PrhNGzs2kqgw fyx7MoZ/YJ3FWe1vBSVgxYF5MIXG4vU20RYN2K8M= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 4/6] Documentation: guides: pipeline-handler: Fix `Camera::create()` link Date: Mon, 9 Dec 2024 18:48:04 +0100 Message-ID: <20241209174806.283905-4-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" Since 6b4771d4604c ("libcamera: camera: Hide Camera::create() from the public API") `Camera::create()` is documented in the internal documentation. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- Documentation/guides/pipeline-handler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst index ec5cf4d55..b65145e3a 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -521,7 +521,7 @@ handler and camera manager using `registerCamera`_. Finally with a successful construction, we return 'true' indicating that the PipelineHandler successfully matched and constructed a device. -.. _Camera::create: https://libcamera.org/api-html/classlibcamera_1_1Camera.html#a453740e0d2a2f495048ae307a85a2574 +.. _Camera::create: https://libcamera.org/internal-api-html/classlibcamera_1_1Camera.html#adf5e6c22411f953bfaa1ae21155d6c31 .. _registerCamera: https://libcamera.org/api-html/classlibcamera_1_1PipelineHandler.html#adf02a7f1bbd87aca73c0e8d8e0e6c98b .. code-block:: cpp From patchwork Mon Dec 9 17:48:05 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: 22266 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 D3C1CBD80A for ; Mon, 9 Dec 2024 17:48:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 62CE167E78; Mon, 9 Dec 2024 18:48:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="eH1YHlrB"; 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 AC47867E70 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 04E8E352 for ; Mon, 9 Dec 2024 18:47:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733766461; bh=4VZNf5jdzfDC7xoWfALBPaWKz9TzBRsZDhpukgxGsAw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eH1YHlrBkxEezK1zEeIvopWseHxfSFc31fjo740v25dMayluQsX+Efn4XKDihLN6V IGivJw2ksdxYv6FKeSVwIJk0Gf1W5O51nfH+eGXDgwxryuFwyIsOgCX5chYSrnz+zu TU2ppuiLOUBuj2qPFXeEbc8/4snMUM4CejuhEek0= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 5/6] Documentation: guides: pipeline-handler: Simplify format collection Date: Mon, 9 Dec 2024 18:48:05 +0100 Message-ID: <20241209174806.283905-5-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" I believe a simple range based for loop is easier to understand here than `std::transform()`. Furthermore, using a for loop enables the easy filtering of invalid pixel formats. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- Documentation/guides/pipeline-handler.rst | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst index b65145e3a..a798733db 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -827,9 +827,7 @@ To generate a ``StreamConfiguration``, you need a list of pixel formats and frame sizes which are supported as outputs of the stream. You can fetch a map of the ``V4LPixelFormat`` and ``SizeRange`` supported by the underlying output device, but the pipeline handler needs to convert this to a -``libcamera::PixelFormat`` type to pass to applications. We do this here using -``std::transform`` to convert the formats and populate a new ``PixelFormat`` map -as shown below. +``libcamera::PixelFormat`` type to pass to applications. Continue adding the following code example to our ``generateConfiguration`` implementation. @@ -839,14 +837,12 @@ implementation. std::map> v4l2Formats = data->video_->formats(); std::map> deviceFormats; - std::transform(v4l2Formats.begin(), v4l2Formats.end(), - std::inserter(deviceFormats, deviceFormats.begin()), - [&](const decltype(v4l2Formats)::value_type &format) { - return decltype(deviceFormats)::value_type{ - format.first.toPixelFormat(), - format.second - }; - }); + + for (auto &[v4l2PixelFormat, sizes] : v4l2Formats) { + PixelFormat pixelFormat = v4l2PixelFormat.toPixelFormat(); + if (pixelFormat.isValid()) + deviceFormats.try_emplace(pixelFormat, std::move(sizes)); + } The `StreamFormats`_ class holds information about the pixel formats and frame sizes that a stream can support. The class groups size information by the pixel 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; }