Show a patch.

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

{
    "id": 20945,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/20945/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20945/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20240815210925.4172287-2-kieran.bingham@ideasonboard.com>",
    "date": "2024-08-15T21:09:23",
    "name": "[1/3] libcamera: media_object: Add MediaLink string representations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e436e3a42365e5093b170afcd5be0fb6b4f31a35",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20945/mbox/",
    "series": [
        {
            "id": 4525,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4525/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4525",
            "date": "2024-08-15T21:09:22",
            "name": "MediaLink: Provide a string representation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4525/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20945/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20945/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 19A1BC32A9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Aug 2024 21:09:37 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7EC59633B9;\n\tThu, 15 Aug 2024 23:09:33 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DA3D63369\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 23:09:29 +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 58457842;\n\tThu, 15 Aug 2024 23:08:30 +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=\"qD2zxVGI\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723756110;\n\tbh=KRH7DLE8YUQMpDhhmLHXdUnhZQ8N8jgHd1lCNBPsKDg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=qD2zxVGIRyInyOB6AGJZA8X0MhNVBFYk798rMycbPsntIsdRNcYXAvx38aMfgyo/Z\n\tkHSdhPjMN6So8s6MBwmzjPQalbxnVXRrqweTNTo9P6W7dCaGzoao+kwVsL9KUZHF+y\n\tSw5fjvCV4paoDXbg3vBUN6y2j7t+dCY04skl77bM=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH 1/3] libcamera: media_object: Add MediaLink string\n\trepresentations",
        "Date": "Thu, 15 Aug 2024 22:09:23 +0100",
        "Message-Id": "<20240815210925.4172287-2-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240815210925.4172287-1-kieran.bingham@ideasonboard.com>",
        "References": "<20240815210925.4172287-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": "Various parts of libcamera print the representation of a MediaLink by\ninline joining the parts to make a string representation.\n\nThis repeated use case can be supported with a common helper to print\nthe MediaLink in a common manner using the existing toString() and\noperator<< overload style to make it easier to report on MediaLink\ntypes.\n\nThis implementation will report in the following style:\n\n  'imx283 1-001a'[0] -> 'video-mux'[0]\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/media_object.h |  4 ++++\n src/libcamera/media_object.cpp            | 25 +++++++++++++++++++++++\n 2 files changed, 29 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\nindex c9d77511a991..3ebef938bc49 100644\n--- a/include/libcamera/internal/media_object.h\n+++ b/include/libcamera/internal/media_object.h\n@@ -48,6 +48,8 @@ public:\n \tunsigned int flags() const { return flags_; }\n \tint setEnabled(bool enable);\n \n+\tstd::string toString() const;\n+\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(MediaLink)\n \n@@ -61,6 +63,8 @@ private:\n \tunsigned int flags_;\n };\n \n+std::ostream &operator<<(std::ostream &out, const MediaLink &link);\n+\n class MediaPad : public MediaObject\n {\n public:\ndiff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\nindex 1b191a1e4df8..fa2c44b0abb6 100644\n--- a/src/libcamera/media_object.cpp\n+++ b/src/libcamera/media_object.cpp\n@@ -146,6 +146,31 @@ MediaLink::MediaLink(const struct media_v2_link *link, MediaPad *source,\n {\n }\n \n+std::string MediaLink::toString() const\n+{\n+\tstd::stringstream ss;\n+\tss << *this;\n+\n+\treturn ss.str();\n+}\n+\n+/**\n+ * \\brief Insert a text representation of a Link into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] r The MediaLink\n+ * \\return The output stream \\a out\n+ */\n+std::ostream &operator<<(std::ostream &out, const MediaLink &link)\n+{\n+\tout << \"'\"\n+\t    << link.source()->entity()->name() << \"'[\"\n+\t    << link.source()->index() << \"] -> '\"\n+\t    << link.sink()->entity()->name() << \"'[\"\n+\t    << link.sink()->index() << \"]\";\n+\n+\treturn out;\n+}\n+\n /**\n  * \\fn MediaLink::source()\n  * \\brief Retrieve the link's source pad\n",
    "prefixes": [
        "1/3"
    ]
}