Show a patch.

GET /api/patches/21482/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21482,
    "url": "https://patchwork.libcamera.org/api/patches/21482/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21482/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20241002212632.2463458-2-kieran.bingham@ideasonboard.com>",
    "date": "2024-10-02T21:26:29",
    "name": "[v2,1/4] libcamera: media_device: Add helper to return matching entities",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c37b49e72d5214594347ce6398749dcced43a4ef",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21482/mbox/",
    "series": [
        {
            "id": 4650,
            "url": "https://patchwork.libcamera.org/api/series/4650/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4650",
            "date": "2024-10-02T21:26:28",
            "name": "MediaPipeline: Complex input device support",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4650/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21482/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21482/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 AC2E1C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Oct 2024 21:26:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B74D963510;\n\tWed,  2 Oct 2024 23:26:42 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 125406351F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Oct 2024 23:26:38 +0200 (CEST)",
            "from Monstersaurus.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 179BA968;\n\tWed,  2 Oct 2024 23:25:05 +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=\"gWudTBsF\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727904305;\n\tbh=r8owuYlalLJ22tjZS0HNJ5QAf+oxLDCm5akMRV85+Bw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gWudTBsFforxob2AAge4JYzYfYq2h3szZlhrQMo7sDk8UPje8co0eRqidDwBWIe7U\n\tcitehGsIeR6onXXYpOTqgn121mUccvDrYQQmt1eIBtbFwwzbOvl5fdm64l4t6Xdz2m\n\tlTG3CVsVdMnfQHErT22yv8tDU6OvzwdljplpE9uE=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <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>",
        "Subject": "[PATCH v2 1/4] libcamera: media_device: Add helper to return\n\tmatching entities",
        "Date": "Wed,  2 Oct 2024 22:26:29 +0100",
        "Message-Id": "<20241002212632.2463458-2-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20241002212632.2463458-1-kieran.bingham@ideasonboard.com>",
        "References": "<20241002212632.2463458-1-kieran.bingham@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": "Provide 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>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/media_device.h |  2 ++\n src/libcamera/media_device.cpp            | 25 ++++++++++++++++++++++-\n 2 files changed, 26 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 d71dad74df70..65080a4afdca 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -793,7 +793,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@@ -828,4 +828,27 @@ 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 as defined by the\n+ * MEDIA_ENT_F_* macros of the Media Controller API.\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": [
        "v2",
        "1/4"
    ]
}