{"id":21239,"url":"https://patchwork.libcamera.org/api/1.1/patches/21239/?format=json","web_url":"https://patchwork.libcamera.org/patch/21239/","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":"<20240911211816.73763-2-kieran.bingham@ideasonboard.com>","date":"2024-09-11T21:18:13","name":"[v2,1/4] libcamera: media_object: Add MediaPad string representations","commit_ref":"6837607ca3f5ef0c516198494c5211cd7be0b165","pull_url":null,"state":"accepted","archived":false,"hash":"a44cb78ac08ac624eb46a28fc8299386d814e5af","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21239/mbox/","series":[{"id":4582,"url":"https://patchwork.libcamera.org/api/1.1/series/4582/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4582","date":"2024-09-11T21:18:12","name":"MediaLink: Provide a string representation","version":2,"mbox":"https://patchwork.libcamera.org/series/4582/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21239/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21239/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 2AB28C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Sep 2024 21:18:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 22150634FB;\n\tWed, 11 Sep 2024 23:18:31 +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 114B2618FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Sep 2024 23:18:27 +0200 (CEST)","from charm.tail69b4.ts.net (213-229-8-243.static.upcbusiness.at\n\t[213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1B903BEB;\n\tWed, 11 Sep 2024 23:17:08 +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=\"Aqq9XBjQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726089429;\n\tbh=Id4vMYqI1c9QGcCATKKJjSKJvL/AixamOqvOzqZxSgM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Aqq9XBjQfrYR7cVQCOS3ui38unXyywY/H9u8umZ9PlAz1jINUg2CC/xFp3jSE+WFH\n\tjapu4/AD6cF37qSGyQRhtB15oTWu9TSbHolvgpuP1VKZJHHlgNiBGk6/8HshfXBKPT\n\tg1RlJT5qClgdM/GYMV/ViKb0zhmXTCqd3PRK5+78=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v2 1/4] libcamera: media_object: Add MediaPad string\n\trepresentations","Date":"Wed, 11 Sep 2024 23:18:13 +0200","Message-ID":"<20240911211816.73763-2-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.46.0","In-Reply-To":"<20240911211816.73763-1-kieran.bingham@ideasonboard.com>","References":"<20240911211816.73763-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":"Facilitate easy representations of a MediaPad object by preparing\nit as a string and supporting output streams.\n\nA MediaPad will be report in the following style:\n\n  'imx283 1-001a'[0]\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nv2:\n - New patch\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..d80d5f4574c7 100644\n--- a/include/libcamera/internal/media_object.h\n+++ b/include/libcamera/internal/media_object.h\n@@ -71,6 +71,8 @@ public:\n \n \tvoid addLink(MediaLink *link);\n \n+\tstd::string toString() const;\n+\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(MediaPad)\n \n@@ -85,6 +87,8 @@ private:\n \tstd::vector<MediaLink *> links_;\n };\n \n+std::ostream &operator<<(std::ostream &out, const MediaPad &pad);\n+\n class MediaEntity : public MediaObject\n {\n public:\ndiff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\nindex 1b191a1e4df8..25f16707ab73 100644\n--- a/src/libcamera/media_object.cpp\n+++ b/src/libcamera/media_object.cpp\n@@ -235,6 +235,31 @@ void MediaPad::addLink(MediaLink *link)\n \tlinks_.push_back(link);\n }\n \n+/**\n+ * \\brief Generate a string representation of the MediaPad\n+ * \\return A string representing the MediaPad\n+ */\n+std::string MediaPad::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 MediaPad into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] pad The MediaPad\n+ * \\return The output stream \\a out\n+ */\n+std::ostream &operator<<(std::ostream &out, const MediaPad &pad)\n+{\n+\tout << \"'\" << pad.entity()->name() << \"'[\" << pad.index() << \"]\";\n+\n+\treturn out;\n+}\n+\n /**\n  * \\class MediaEntity\n  * \\brief The MediaEntity represents an entity in the media graph\n","prefixes":["v2","1/4"]}