[{"id":37097,"web_url":"https://patchwork.libcamera.org/comment/37097/","msgid":"<176426093188.890597.1545596124282013444@ping.linuxembedded.co.uk>","date":"2025-11-27T16:28:51","subject":"Re: [PATCH v3 1/2] libamera: media_pipeline: Add accessor for\n\tMediaPipeline list of entities","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Antoine Bouyer (2025-11-27 15:45:17)\n> From: Andrei Gansari <andrei.gansari@nxp.com>\n> \n> Exposes internal MediaEntity::Entity list to help extracting more\n> information regarding linked entities.\n> \n> For example, when the pad index of the last device in the list need to be\n> retrieved from the media pipeline user.\n> \n> Exposes as const to with a dedicated access to prevent any corruption from\n> user. Then it is still protected so as when the list was private.\n> \n> Since MediaPipeline::Entity needs also to be moved to public, then need to\n> add some documentation in cpp source. Existing documentation from header\n> file is applied when available.\n> \n> Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>\n> Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/media_pipeline.h | 29 ++++---------\n>  src/libcamera/media_pipeline.cpp            | 46 +++++++++++++++++++++\n>  2 files changed, 53 insertions(+), 22 deletions(-)\n> \n> diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h\n> index a7a4b8c559cd..f62e3e8c58b0 100644\n> --- a/include/libcamera/internal/media_pipeline.h\n> +++ b/include/libcamera/internal/media_pipeline.h\n> @@ -23,36 +23,21 @@ struct V4L2SubdeviceFormat;\n>  class MediaPipeline\n>  {\n>  public:\n> -       int init(MediaEntity *source, std::string_view sink);\n> -       int initLinks();\n> -       int configure(CameraSensor *sensor, V4L2SubdeviceFormat *);\n> -\n> -private:\n>         struct Entity {\n> -               /* The media entity, always valid. */\n>                 MediaEntity *entity;\n> -               /*\n> -                * Whether or not the entity is a subdev that supports the\n> -                * routing API.\n> -                */\n>                 bool supportsRouting;\n> -               /*\n> -                * The local sink pad connected to the upstream entity, null for\n> -                * the camera sensor at the beginning of the pipeline.\n> -                */\n>                 const MediaPad *sink;\n> -               /*\n> -                * The local source pad connected to the downstream entity, null\n> -                * for the video node at the end of the pipeline.\n> -                */\n>                 const MediaPad *source;\n> -               /*\n> -                * The link on the source pad, to the downstream entity, null\n> -                * for the video node at the end of the pipeline.\n> -                */\n>                 MediaLink *sourceLink;\n>         };\n>  \n> +       int init(MediaEntity *source, std::string_view sink);\n> +       int initLinks();\n> +       int configure(CameraSensor *sensor, V4L2SubdeviceFormat *);\n> +\n> +       const std::list<Entity> &entities() const { return entities_; }\n> +\n> +private:\n>         std::list<Entity> entities_;\n>  };\n>  \n> diff --git a/src/libcamera/media_pipeline.cpp b/src/libcamera/media_pipeline.cpp\n> index c4e9f69b8f6a..3c5517314a4a 100644\n> --- a/src/libcamera/media_pipeline.cpp\n> +++ b/src/libcamera/media_pipeline.cpp\n> @@ -43,6 +43,52 @@ LOG_DEFINE_CATEGORY(MediaPipeline)\n>   * two entities in a media graph.\n>   */\n>  \n> +/**\n> + * \\struct MediaPipeline::Entity\n> + * \\brief A node composing the media pipeline\n> + *\n> + * The MediaPipeline::Entity structure stores how a MediaEntity composing a\n> + * media pipeline is connected to other media entities. It stores pointers\n> + * to the source pad, the sink pad and the media link traversed by the media\n> + * pipeline, as well as a flag that reports if the entity supports internal\n> + * routing.\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::entity\n> + * \\brief Pointer to the libcamera::MediaEntity, always valid\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::supportsRouting\n> + * \\brief Whether or not the entity is a subdev that supports the routing API\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::sink\n> + * \\brief The local libcamera::MediaPad sink pad connected to the upstream entity,\n> + * null for the camera sensor at the beginning of the pipeline\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::source\n> + * \\brief The local libcamera::MediaPad source pad connected to the upstream entity,\n> + * null for the last node at the end of the pipeline\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::sourceLink\n> + * \\brief The link on the libcamera::MediaLink source pad, to the downstream entity,\n> + * null for the last node at the end of the pipeline\n> + */\n> +\n> +/**\n> + * \\fn MediaPipeline::entities()\n> + * \\brief Retrieve list of entities composing the media pipeline\n> + * \\return The list of MediaPipeline::Entity entities composing the media\n> + * pipeline\n> + */\n> +\n>  /**\n>   * \\brief Retrieve all source pads connected to a sink pad through active routes\n>   *\n> -- \n> 2.51.2\n>","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 437E8C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 Nov 2025 16:28:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9122B606A0;\n\tThu, 27 Nov 2025 17:28:55 +0100 (CET)","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 8E397606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Nov 2025 17:28:54 +0100 (CET)","from pendragon.ideasonboard.com\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 1AE4CA8F;\n\tThu, 27 Nov 2025 17:26:44 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kSoViI8Q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764260804;\n\tbh=DNUHfthWXpajxcMzAiL5/GaxTKO0gdCX8VCQFpjDbqg=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=kSoViI8Q6Lcq7hRg7rmvvymu5nio8s6Z0vJ9hH9yll3gCCMsZJ69OJtF58RCkyLBb\n\tId2k+ekkHdcWJfZnd7dNVh8jTKvh0dIMcDjehx8nvl/agcprXBm+GNsATSx0Rswu4P\n\tdaWmANVY2/Xn9BU5d12dGbnoc1X+S4oL45mBnfJA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251127154519.2038844-2-antoine.bouyer@nxp.com>","References":"<20251127154519.2038844-1-antoine.bouyer@nxp.com>\n\t<20251127154519.2038844-2-antoine.bouyer@nxp.com>","Subject":"Re: [PATCH v3 1/2] libamera: media_pipeline: Add accessor for\n\tMediaPipeline list of entities","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"julien.vuillaumier@nxp.com, jacopo.mondi@ideasonboard.com,\n\tbarnabas.pocze@ideasonboard.com, isaac.scott@ideasonboard.com,\n\tAndrei Gansari <andrei.gansari@nxp.com>,\n\tAntoine Bouyer <antoine.bouyer@nxp.com>","To":"Antoine Bouyer <antoine.bouyer@nxp.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 27 Nov 2025 16:28:51 +0000","Message-ID":"<176426093188.890597.1545596124282013444@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]