[{"id":36821,"web_url":"https://patchwork.libcamera.org/comment/36821/","msgid":"<qokokbp36ncgcujjr72pzbh5acuus3n3s5vgy4loqt2a2gbk7n@vljcdjoag3ne>","date":"2025-11-14T16:25:47","subject":"Re: [PATCH v2 1/2] libamera: media_pipeline: Add accessor for\n\tMediaPipeline list of entities","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hello\n\nOn Fri, Nov 14, 2025 at 04:43:40PM +0100, Antoine Bouyer wrote:\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> ---\n>  include/libcamera/internal/media_pipeline.h | 29 ++++----------\n>  src/libcamera/media_pipeline.cpp            | 44 +++++++++++++++++++++\n>  2 files changed, 51 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> -\tint init(MediaEntity *source, std::string_view sink);\n> -\tint initLinks();\n> -\tint configure(CameraSensor *sensor, V4L2SubdeviceFormat *);\n> -\n> -private:\n>  \tstruct Entity {\n> -\t\t/* The media entity, always valid. */\n>  \t\tMediaEntity *entity;\n> -\t\t/*\n> -\t\t * Whether or not the entity is a subdev that supports the\n> -\t\t * routing API.\n> -\t\t */\n>  \t\tbool supportsRouting;\n> -\t\t/*\n> -\t\t * The local sink pad connected to the upstream entity, null for\n> -\t\t * the camera sensor at the beginning of the pipeline.\n> -\t\t */\n>  \t\tconst MediaPad *sink;\n> -\t\t/*\n> -\t\t * The local source pad connected to the downstream entity, null\n> -\t\t * for the video node at the end of the pipeline.\n> -\t\t */\n>  \t\tconst MediaPad *source;\n> -\t\t/*\n> -\t\t * The link on the source pad, to the downstream entity, null\n> -\t\t * for the video node at the end of the pipeline.\n> -\t\t */\n>  \t\tMediaLink *sourceLink;\n>  \t};\n>\n> +\tint init(MediaEntity *source, std::string_view sink);\n> +\tint initLinks();\n> +\tint configure(CameraSensor *sensor, V4L2SubdeviceFormat *);\n> +\n> +\tconst std::list<Entity> &entities() const { return entities_; }\n> +\n> +private:\n>  \tstd::list<Entity> entities_;\n>  };\n>\n> diff --git a/src/libcamera/media_pipeline.cpp b/src/libcamera/media_pipeline.cpp\n> index c4e9f69b8f6a..1bb55a507fce 100644\n> --- a/src/libcamera/media_pipeline.cpp\n> +++ b/src/libcamera/media_pipeline.cpp\n> @@ -43,6 +43,50 @@ 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 struct stores how a MediaEntity composing a\ns/struct/structure\n\n> + * media pipeline is connected to other media entities. Source and sink pads\n> + * are stored, so as whether the entity itself does support internal routing.\n\nIt stores pointers to the source pad, the sink pad and the media link\ntraversed by the media pipeline, as well as a flag that reports if the\nentity supports internal routing.\n\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::entity\n> + * Pointer to the libcamera::MediaEntity, always valid\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::supportsRouting\n> + * Whether or not the entity is a subdev that supports the routing API\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::sink\n> + * The local libcamera::MediaPad sink pad connected to the upstream entity,\n> + * null for the camera sensor at the beginning of the pipeline.\n\nSome phrases ends with a '.' some don't.\n\nAlso, should these be \\brief ? (in case they are, no '.' at the end)\n\n> + */\n> +\n> +/**\n> + * \\var MediaPipeline::Entity::source\n> + * 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> + * 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\nNo '.' at the end\n\nMinors apart\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n> + */\n> +\n>  /**\n>   * \\brief Retrieve all source pads connected to a sink pad through active routes\n>   *\n> --\n> 2.34.1\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 2553AC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Nov 2025 16:25:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6722C609D8;\n\tFri, 14 Nov 2025 17:25:52 +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 10B39606E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Nov 2025 17:25:51 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E7B0F664;\n\tFri, 14 Nov 2025 17:23:49 +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=\"aVRDQgqf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763137430;\n\tbh=LkHO7HlfSX7yWIdx8X9gNnZuUMWL1lIVtXz/wvJ9Vf8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aVRDQgqfzyYb8kXLVy0Ei84Yl+gpK1g1Ny2519e2dVyLomCEjqg3shnPK2w7ktoe6\n\tH0XZIcmM9L+xe0+8/ZM/7h2S4azuVYEUwTMRU3YRr9MD7wL4oq9/x/f/1MljPwV8HC\n\tHJFwwAVDfJe1sJ5/wzHvdSsoJDktPgzYkdMFZ3i0=","Date":"Fri, 14 Nov 2025 17:25:47 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Antoine Bouyer <antoine.bouyer@nxp.com>","Cc":"libcamera-devel@lists.libcamera.org, julien.vuillaumier@nxp.com, \n\tjacopo.mondi@ideasonboard.com, barnabas.pocze@ideasonboard.com, \n\tAndrei Gansari <andrei.gansari@nxp.com>","Subject":"Re: [PATCH v2 1/2] libamera: media_pipeline: Add accessor for\n\tMediaPipeline list of entities","Message-ID":"<qokokbp36ncgcujjr72pzbh5acuus3n3s5vgy4loqt2a2gbk7n@vljcdjoag3ne>","References":"<20251114154341.654850-1-antoine.bouyer@nxp.com>\n\t<20251114154341.654850-2-antoine.bouyer@nxp.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251114154341.654850-2-antoine.bouyer@nxp.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>"}}]