[{"id":31179,"web_url":"https://patchwork.libcamera.org/comment/31179/","msgid":"<20240911222533.GL4470@pendragon.ideasonboard.com>","date":"2024-09-11T22:25:33","subject":"Re: [PATCH v2 1/4] libcamera: media_object: Add MediaPad string\n\trepresentations","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Sep 11, 2024 at 11:18:13PM +0200, Kieran Bingham wrote:\n> Facilitate easy representations of a MediaPad object by preparing\n> it as a string and supporting output streams.\n> \n> A MediaPad will be report in the following style:\n> \n>   'imx283 1-001a'[0]\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> v2:\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(+)\n> \n> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\n> index 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:\n> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\n> index 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","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 C4463BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Sep 2024 22:26:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 53513634FB;\n\tThu, 12 Sep 2024 00:26:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 49209634E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Sep 2024 00:26:07 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(213-229-8-243.static.upcbusiness.at [213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 35CED496;\n\tThu, 12 Sep 2024 00:24:49 +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=\"HStWyGyK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726093489;\n\tbh=tkFqrmZTWZJcLtVcJ92O+TMBOJZUnH7f4WKhlOrUsbU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=HStWyGyKUazn3DzwlzrkMqzMdHVLN1sy3gPvBVW4G1ompeRtP+VqGan9Gp57PGamw\n\tf+9YLh06asOq5QzbuvjbLlUvATDCvLbrHotg/CIjAeM7iIb4aEkADDXcvxUbSE6kO8\n\trScqn/Pa0ZTClV3lDcsi0nCIpMgMufYfT0+eokkU=","Date":"Thu, 12 Sep 2024 01:25:33 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH v2 1/4] libcamera: media_object: Add MediaPad string\n\trepresentations","Message-ID":"<20240911222533.GL4470@pendragon.ideasonboard.com>","References":"<20240911211816.73763-1-kieran.bingham@ideasonboard.com>\n\t<20240911211816.73763-2-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240911211816.73763-2-kieran.bingham@ideasonboard.com>","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>"}}]