{"id":23033,"url":"https://patchwork.libcamera.org/api/patches/23033/?format=json","web_url":"https://patchwork.libcamera.org/patch/23033/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20250326084800.1880530-2-paul.elder@ideasonboard.com>","date":"2025-03-26T08:47:58","name":"[v2,1/2] libcamera: pipeline: Add function to clear acquired media devices","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b4ea1e6f1f6170f1cd4e97ade1c2cde26cb237e1","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23033/mbox/","series":[{"id":5082,"url":"https://patchwork.libcamera.org/api/series/5082/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5082","date":"2025-03-26T08:47:57","name":"pipeline: simple: Fix matching with an empty media graph","version":2,"mbox":"https://patchwork.libcamera.org/series/5082/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23033/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23033/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 AB5FCC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 08:48:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 511376895D;\n\tWed, 26 Mar 2025 09:48:14 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D90F6894B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 09:48:11 +0100 (CET)","from neptunite.flets-east.jp (unknown\n\t[IPv6:2404:7a81:160:2100:7402:917d:ea0c:6d4c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 399FD99F;\n\tWed, 26 Mar 2025 09:46:21 +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=\"Tfz4eUvt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742978783;\n\tbh=DesQDtS8FHV2a9taqydsAbbCEbQnkOwFxix2KOxgJ3w=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Tfz4eUvtUEkeDjiIJ8pHEn+NrgPnwA58xP7J0sdSN6wQXfCDUDLTLg5lC0lGKkXYV\n\t3AuAP/QKo8XhwZO20G8ZtjUvcNfpEDFDsafFjR9ALJ7IWz4Cqv3mbua6rO0p10Pmqt\n\t/YFKgptAEhkNqAao54fOJSjpYrRfiuiraV0fmv70=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Paul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v2 1/2] libcamera: pipeline: Add function to clear acquired\n\tmedia devices","Date":"Wed, 26 Mar 2025 17:47:58 +0900","Message-ID":"<20250326084800.1880530-2-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.47.2","In-Reply-To":"<20250326084800.1880530-1-paul.elder@ideasonboard.com>","References":"<20250326084800.1880530-1-paul.elder@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":"Some pipeline handler implementations, such as the simple pipeline\nhandler, can encounter systems with multiple media devices that can be\nsupported.\n\nIn a subsequent patch, the simple pipeline handler will be updated so\nthat it will continue to match other media graphs even if the first\nmedia graph it encounters has an invalid media device. In this case,\nthere would be a mix of invalid and valid media devices in\nmediaDevices_.\n\nAdd a function to clear mediaDevices_ so that this can be\nprevented.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nNew in v2\n---\n include/libcamera/internal/pipeline_handler.h |  2 ++\n src/libcamera/pipeline_handler.cpp            | 15 +++++++++++++++\n 2 files changed, 17 insertions(+)","diff":"diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex 972a2fa65310..5fa8bc2f66ee 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -71,6 +71,8 @@ public:\n \tCameraManager *cameraManager() const { return manager_; }\n \n protected:\n+\tvoid clearMediaDevices();\n+\n \tvoid registerCamera(std::shared_ptr<Camera> camera);\n \tvoid hotplugMediaDevice(MediaDevice *media);\n \ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex d84dff3c9f19..8f12957b75fa 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -142,6 +142,21 @@ MediaDevice *PipelineHandler::acquireMediaDevice(DeviceEnumerator *enumerator,\n \treturn media.get();\n }\n \n+/**\n+ * \\brief Clear the list of acquired media devices for this PipelineHandler instance\n+ *\n+ * This is meant to be used when the Pipeline Handler needs to search multiple\n+ * media graphs to create multiple instances of itself, and a partial match\n+ * needs to be canceled as an invalid media device was detected. This is to\n+ * prevent mediaDevices_ from having a mix of invalid media devices from a\n+ * previous failed match and valid media devices from the current succeeding\n+ * match.\n+ */\n+void PipelineHandler::clearMediaDevices()\n+{\n+\tmediaDevices_.clear();\n+}\n+\n /**\n  * \\brief Acquire exclusive access to the pipeline handler for the process\n  *\n","prefixes":["v2","1/2"]}