{"id":22355,"url":"https://patchwork.libcamera.org/api/1.1/patches/22355/?format=json","web_url":"https://patchwork.libcamera.org/patch/22355/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241216154124.203650-10-stefan.klug@ideasonboard.com>","date":"2024-12-16T15:40:49","name":"[v4,09/20] libcamera: converter: Add function to check if a stream was configured","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"2dc81153e5def255ccf945e94f615157a661a40b","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22355/mbox/","series":[{"id":4896,"url":"https://patchwork.libcamera.org/api/1.1/series/4896/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4896","date":"2024-12-16T15:40:40","name":"rkisp1: Fix aspect ratio and ScalerCrop","version":4,"mbox":"https://patchwork.libcamera.org/series/4896/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22355/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22355/checks/","tags":{},"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 494C5C32FB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Dec 2024 15:42:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C75BC67F8A;\n\tMon, 16 Dec 2024 16:42:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A04DF67F81\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 16:42:11 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bfdf:3a3c:e45:66e3])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F3D6E82A;\n\tMon, 16 Dec 2024 16:41:34 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"CN2/oJLJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734363695;\n\tbh=WLz7itERtgpZabbFOsaQnEE+iI6KY8pZaV0GPVV/gv4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=CN2/oJLJZxRgcVTlGHpSSH8sUcqu45TJn1PMH1diJeTuV9fYaQdH9tjtGvSiyuKY3\n\tURPqocdYl5hIJmM4wKlr30rIpNOyE4xdgS68ldLrqyZpRG9sftu7YGiqYjb9TxtWIb\n\tvVMX+oyrfBPvDjAA9drdafItZHWwY7otl8mcI5mg=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v4 09/20] libcamera: converter: Add function to check if a\n\tstream was configured","Date":"Mon, 16 Dec 2024 16:40:49 +0100","Message-ID":"<20241216154124.203650-10-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20241216154124.203650-1-stefan.klug@ideasonboard.com>","References":"<20241216154124.203650-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a isConfigured() function to be able to check if a given stream was\nconfigured in the converter. This is useful in pipelines to either query\ndevice or stream specific crop bounds depending on whether the stream is\nconfigured or not.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v4:\n- Added this patch\n---\n include/libcamera/internal/converter.h                    | 1 +\n include/libcamera/internal/converter/converter_v4l2_m2m.h | 1 +\n src/libcamera/converter.cpp                               | 7 +++++++\n src/libcamera/converter/converter_v4l2_m2m.cpp            | 8 ++++++++\n 4 files changed, 17 insertions(+)","diff":"diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h\nindex 04187a2a96e8..afea4624041b 100644\n--- a/include/libcamera/internal/converter.h\n+++ b/include/libcamera/internal/converter.h\n@@ -56,6 +56,7 @@ public:\n \n \tvirtual int configure(const StreamConfiguration &inputCfg,\n \t\t\t      const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs) = 0;\n+\tvirtual bool isConfigured(const Stream *stream) const = 0;\n \tvirtual int exportBuffers(const Stream *stream, unsigned int count,\n \t\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0;\n \ndiff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\nindex 402a803959b9..1ccbfc7c2d4e 100644\n--- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n+++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n@@ -50,6 +50,7 @@ public:\n \tint configure(const StreamConfiguration &inputCfg,\n \t\t      const std::vector<std::reference_wrapper<StreamConfiguration>>\n \t\t      &outputCfg) override;\n+\tbool isConfigured(const Stream *stream) const override;\n \tint exportBuffers(const Stream *stream, unsigned int count,\n \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;\n \ndiff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp\nindex 73c02fdcf4bb..09ebf4f57d12 100644\n--- a/src/libcamera/converter.cpp\n+++ b/src/libcamera/converter.cpp\n@@ -126,6 +126,13 @@ Converter::~Converter()\n  * \\return 0 on success or a negative error code otherwise\n  */\n \n+/**\n+ * \\fn Converter::isConfigured()\n+ * \\brief Check if a given stream is configured\n+ * \\param[in] stream The output stream\n+ * \\return True if the \\a stream is configured or false otherwise\n+ */\n+\n /**\n  * \\fn Converter::exportBuffers()\n  * \\brief Export buffers from the converter device\ndiff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\nindex 342aa32dab52..83daca15b37e 100644\n--- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n+++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n@@ -437,6 +437,14 @@ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg,\n \treturn 0;\n }\n \n+/**\n+ * \\copydoc libcamera::Converter::isConfigured\n+ */\n+bool V4L2M2MConverter::isConfigured(const Stream *stream) const\n+{\n+\treturn streams_.find(stream) != streams_.end();\n+}\n+\n /**\n  * \\copydoc libcamera::Converter::exportBuffers\n  */\n","prefixes":["v4","09/20"]}