{"id":23103,"url":"https://patchwork.libcamera.org/api/1.1/patches/23103/?format=json","web_url":"https://patchwork.libcamera.org/patch/23103/","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":"<20250402073919.183330-2-paul.elder@ideasonboard.com>","date":"2025-04-02T07:39:16","name":"[v4,1/3] libcamera: media_device: Add helper to return matching entities","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d8da3c15ac92d26001c9e55969cbedb6c1176301","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23103/mbox/","series":[{"id":5105,"url":"https://patchwork.libcamera.org/api/1.1/series/5105/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5105","date":"2025-04-02T07:39:15","name":"MediaPipeline: Complex input device support","version":4,"mbox":"https://patchwork.libcamera.org/series/5105/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23103/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23103/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 44BF8C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Apr 2025 07:39:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0288268988;\n\tWed,  2 Apr 2025 09:39:36 +0200 (CEST)","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 B1E2E6897E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Apr 2025 09:39:33 +0200 (CEST)","from neptunite.flets-east.jp (unknown\n\t[IPv6:2404:7a81:160:2100:c59e:fbfb:58d5:f44f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DA2D66A2;\n\tWed,  2 Apr 2025 09:37:38 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UTM+W09k\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743579461;\n\tbh=Ma3dIhyFjaPxIkz181zRHR5CC73LPECDwdBvgGDXvhc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UTM+W09kiUc6cX7jCyMbAJgrxoa0Tv5YBGiISORJ6umjpQoMUsgTw8KL0QTVxw0bb\n\tDNAEM06wsB4cFsg734awanxKEJ1WMigXpfCsR9ofQRauQLHQ8baip1EYoitfoJf94l\n\tzoS/FDgQ+0S4FwSd5AR00RY/Ytaqg9QzJvUAL54o=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v4 1/3] libcamera: media_device: Add helper to return\n\tmatching entities","Date":"Wed,  2 Apr 2025 16:39:16 +0900","Message-ID":"<20250402073919.183330-2-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.47.2","In-Reply-To":"<20250402073919.183330-1-paul.elder@ideasonboard.com>","References":"<20250402073919.183330-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":"From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nProvide a helper on the MediaDevice to return a list of all\navailable entities which match a given function in the graph.\n\nAs a drive by, also fix a whitespace error in the documentation of\nMediaDevice::setupLink.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n include/libcamera/internal/media_device.h |  2 ++\n src/libcamera/media_device.cpp            | 24 ++++++++++++++++++++++-\n 2 files changed, 25 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\nindex e412d3a0b7e3..b3a48b98d64b 100644\n--- a/include/libcamera/internal/media_device.h\n+++ b/include/libcamera/internal/media_device.h\n@@ -55,6 +55,8 @@ public:\n \n \tSignal<> disconnected;\n \n+\tstd::vector<MediaEntity *> locateEntities(unsigned int function);\n+\n protected:\n \tstd::string logPrefix() const override;\n \ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex 75abd91d736a..353f34a81eca 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -794,7 +794,7 @@ void MediaDevice::fixupEntityFlags(struct media_v2_entity *entity)\n  * low-level link setup as it performs no checks on the validity of the \\a\n  * flags, and assumes that the supplied \\a flags are valid for the link (e.g.\n  * immutable links cannot be disabled).\n-*\n+ *\n  * \\sa MediaLink::setEnabled(bool enable)\n  *\n  * \\return 0 on success or a negative error code otherwise\n@@ -829,4 +829,26 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n \treturn 0;\n }\n \n+/**\n+ * \\brief Identify all entities of a common function in the MediaDevice\n+ * \\param[in] function The entity function to search for\n+ *\n+ * Search all entities within the graph of the MediaDevice and return\n+ * a vector of those which match the given function.\n+ *\n+ * \\return A vector of matching entities\n+ */\n+std::vector<MediaEntity *> MediaDevice::locateEntities(unsigned int function)\n+{\n+\tstd::vector<MediaEntity *> found;\n+\n+\t/* Gather all the entities matching the function they expose. */\n+\tfor (MediaEntity *entity : entities()) {\n+\t\tif (entity->function() == function)\n+\t\t\tfound.push_back(entity);\n+\t}\n+\n+\treturn found;\n+}\n+\n } /* namespace libcamera */\n","prefixes":["v4","1/3"]}