From patchwork Fri Nov 14 15:43:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Bouyer X-Patchwork-Id: 25073 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3C8F6C32DB for ; Fri, 14 Nov 2025 15:41:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C07D960A80; Fri, 14 Nov 2025 16:41:54 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="eI/iGl3S"; dkim-atps=neutral Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazlp170110003.outbound.protection.outlook.com [IPv6:2a01:111:f403:c207::3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4DDA8609D8 for ; Fri, 14 Nov 2025 16:41:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EJ5rOJogrkSkchSCmoh03M50WvlUHu2Y1yf0tXdinTDqij937CRKElifZsP6hST2lGxozT8W5uUCIf/qe6/4Ug5uxJM3MKDkwDUZxB2rQ9XG3k9VhI2cGkpxOZZoCFTeVh+wEMJzWiChVT1pSs++Jz9qcnev6e2WfOQsS2vgsobEWP2CUizfaThjtjcAinC2sMKqr5ouTkmsmNtjvzZfw0i2ym/m4QQdYfghvsbUU9+dVLJtcOexIc/RKREYLvmp2BZeBYScTU+l0oqq2TwK7C69gKJWUFpAQR0+DeeiSkNIvIZ58lOtPn/kkkvx9xEZmr5EnD3TbYqnEnbSljtFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JRexS7c3AqEGKu5NQLAj5oGpqtUjrovH5NEuBy84eEI=; b=L3fgk9vDu5PxjN9TZPcc6SbZk/Md5cf6cIV2TeNTL72sFqVJA7iOClyHO5jCFUhUxv3GdDcCluBnzme0/fwuBM5mQjxkXNTRWMwczCsph+/zwYdsvclZLa/zMS0yKK61bwutEZXC1lR7Azo1MHRxFar/HUVsxfMgpQSbJRae0IBdltq9Jq+3MVA9H2WsI/EZbY1yduj1fXv307iMWPfuQQNn64STR9vWw68DonhMr5uvOaw5mpEFOTEYCjvMW1h4YuW27YWkt986zWKp1d2c11ujHBR0tbqRqlFw+zVLSRURC+GUlv9bo+S57u0yo5YjEpyWXxXf6h8/8gz59xTocQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JRexS7c3AqEGKu5NQLAj5oGpqtUjrovH5NEuBy84eEI=; b=eI/iGl3So2tpfJ1tYg+V9rOV7578h7IOrRp2eUjEfc2qka00sh1ZO/GZlq5/oSMURrUr551BfbTYW4NVhxEegFijC6TnTAyCwgTCvAyjARxHvA4pjqIW357jVIGbLBI7OBk2CEqAwvqAd55oS73+a+8JjGt8Qhwbt6EmQWYOFooAYzqb9oDNmF28T1Ny87adkOmViYAwYhaJSgrabQUmwc5cvTns274YRzxvKWFa6kE9w35mBl2LPJB4f25kWkoxl505m0DPZfo4Cpmtm6iyRpK+zgi+z/jUT8Qk/SI8BUdj9V5Si/h9f3i3N/YZKzb4CLyhJBppZpLHSJbj8YgDQQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GVXPR04MB9831.eurprd04.prod.outlook.com (2603:10a6:150:11c::8) by GV1PR04MB10108.eurprd04.prod.outlook.com (2603:10a6:150:1a2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.16; Fri, 14 Nov 2025 15:41:51 +0000 Received: from GVXPR04MB9831.eurprd04.prod.outlook.com ([fe80::4634:3d9c:c4a:641a]) by GVXPR04MB9831.eurprd04.prod.outlook.com ([fe80::4634:3d9c:c4a:641a%6]) with mapi id 15.20.9320.018; Fri, 14 Nov 2025 15:41:51 +0000 From: Antoine Bouyer To: libcamera-devel@lists.libcamera.org Cc: julien.vuillaumier@nxp.com, jacopo.mondi@ideasonboard.com, barnabas.pocze@ideasonboard.com, Andrei Gansari , Antoine Bouyer Subject: [PATCH v2 1/2] libamera: media_pipeline: Add accessor for MediaPipeline list of entities Date: Fri, 14 Nov 2025 16:43:40 +0100 Message-Id: <20251114154341.654850-2-antoine.bouyer@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251114154341.654850-1-antoine.bouyer@nxp.com> References: <20251114154341.654850-1-antoine.bouyer@nxp.com> X-ClientProxiedBy: AS4P192CA0039.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:658::20) To GVXPR04MB9831.eurprd04.prod.outlook.com (2603:10a6:150:11c::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GVXPR04MB9831:EE_|GV1PR04MB10108:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a548076-00ae-4a43-1f8c-08de2394543b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|19092799006|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: +JYBcoCyoKg2EWyew/aDLDEirPemqNb5zLDSew6dMocxtM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J6YmUpkKJM5hykvy0eRlus9RE+0e3YN76DESEJk2ZRz0NJ+Sqj24sm3vr2/clWNkae9jozBcSKm1hFSLY5u0W9UNsBvSsV20E+CgzF93B3MsJOrx8H5v0QUsswx7AY5cLwfj7I7VpOKD8SZFCbIlxEjQfRfHYTFekcuPTcD5qBX0m7iTEyxLtlSZDvK8qXOloow1DmTNFOhd/Pd9cN16LBEa9znlCJ6XP40rRIIaQzMOjyCAywkxTtKiBL3pfBuNdxfFkK7wq8LT8uTbvdSlkYEaJWwv96HeXT/1D1XMRwcTjHDQpo8Y6IYuoINFRRTMSpcSsw9Z1nvVGo0epqNZ/d7m2jbEFqKMOa1BBfNTMTOjf1HPEp2Bwe5TgEZAEad0htT9posDPnNBpaTN2Kzs9WkKS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GVXPR04MB9831.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(19092799006)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M78TTe1j+32zWkQbbuA2EWmNOB2CsleGv43ATWEZ6ce/zTJiJAUjArc2i6c9HQZiJDJrgauLNoLiYXZeTZ017mpJ8766QE7YL7JcN6OsSHZ0Tr1fyXdmMr3Bsm76u4qvRAMOTCKeCXEdOjr8+UlWQbWcFf02vZ4aufrsnji79zxJGBk10rDdMdgaGJhAGNxtQHUebok3YWuGK08Kn4iDB17BstcalnTCDSBwJzDyVwLwxe/LGRq2qlkLZxhelw10VrQ7cpyqAJTPu1xiE1mIGdoLzKXNq3Qpi+9xsw9tAArnXhnvlWMQmfxYEOGZotV+O2NLVjtWFA7K5RLlJ9rLRd56RKUeAj+IJCxKo8edNLP+NTcd1YhQZ9GYDFKS/OC1aqlXAILiyU0VWWC6bd0BOGUsfzyvrH5hLiWIjWu1GOQ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I14z4eexRV46FQ0ck+FX4jX6OBQj0af4xmzIYg6ZtDYEn1sXTHNc9nuB5Kz3lM2vsdBqxaEK8iNXBg/xKtY1TuN1YNDHacrC7Y14xewMXmjovyRWU+zMvzV76P9KwCWBvPBng== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a548076-00ae-4a43-1f8c-08de2394543b X-MS-Exchange-CrossTenant-AuthSource: GVXPR04MB9831.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2025 15:41:51.0165 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yrTmNsN1Dn5A9QrrcmqsJ4wo6LtSLt7Qa7MKBeF+5Vi08BlNAOqnMfkF3t8CsVsvgZreSo75cmgXFAi3oPlS7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10108 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Andrei Gansari Exposes internal MediaEntity::Entity list to help extracting more information regarding linked entities. For example, when the pad index of the last device in the list need to be retrieved from the media pipeline user. Exposes as const to with a dedicated access to prevent any corruption from user. Then it is still protected so as when the list was private. Since MediaPipeline::Entity needs also to be moved to public, then need to add some documentation in cpp source. Existing documentation from header file is applied when available. Signed-off-by: Andrei Gansari Signed-off-by: Antoine Bouyer Reviewed-by: Jacopo Mondi --- include/libcamera/internal/media_pipeline.h | 29 ++++---------- src/libcamera/media_pipeline.cpp | 44 +++++++++++++++++++++ 2 files changed, 51 insertions(+), 22 deletions(-) diff --git a/include/libcamera/internal/media_pipeline.h b/include/libcamera/internal/media_pipeline.h index a7a4b8c559cd..f62e3e8c58b0 100644 --- a/include/libcamera/internal/media_pipeline.h +++ b/include/libcamera/internal/media_pipeline.h @@ -23,36 +23,21 @@ struct V4L2SubdeviceFormat; class MediaPipeline { public: - int init(MediaEntity *source, std::string_view sink); - int initLinks(); - int configure(CameraSensor *sensor, V4L2SubdeviceFormat *); - -private: struct Entity { - /* The media entity, always valid. */ MediaEntity *entity; - /* - * Whether or not the entity is a subdev that supports the - * routing API. - */ bool supportsRouting; - /* - * The local sink pad connected to the upstream entity, null for - * the camera sensor at the beginning of the pipeline. - */ const MediaPad *sink; - /* - * The local source pad connected to the downstream entity, null - * for the video node at the end of the pipeline. - */ const MediaPad *source; - /* - * The link on the source pad, to the downstream entity, null - * for the video node at the end of the pipeline. - */ MediaLink *sourceLink; }; + int init(MediaEntity *source, std::string_view sink); + int initLinks(); + int configure(CameraSensor *sensor, V4L2SubdeviceFormat *); + + const std::list &entities() const { return entities_; } + +private: std::list entities_; }; diff --git a/src/libcamera/media_pipeline.cpp b/src/libcamera/media_pipeline.cpp index c4e9f69b8f6a..1bb55a507fce 100644 --- a/src/libcamera/media_pipeline.cpp +++ b/src/libcamera/media_pipeline.cpp @@ -43,6 +43,50 @@ LOG_DEFINE_CATEGORY(MediaPipeline) * two entities in a media graph. */ +/** + * \struct MediaPipeline::Entity + * \brief A node composing the media pipeline + * + * The MediaPipeline::Entity struct stores how a MediaEntity composing a + * media pipeline is connected to other media entities. Source and sink pads + * are stored, so as whether the entity itself does support internal routing. + */ + +/** + * \var MediaPipeline::Entity::entity + * Pointer to the libcamera::MediaEntity, always valid + */ + +/** + * \var MediaPipeline::Entity::supportsRouting + * Whether or not the entity is a subdev that supports the routing API + */ + +/** + * \var MediaPipeline::Entity::sink + * The local libcamera::MediaPad sink pad connected to the upstream entity, + * null for the camera sensor at the beginning of the pipeline. + */ + +/** + * \var MediaPipeline::Entity::source + * The local libcamera::MediaPad source pad connected to the upstream entity, + * null for the last node at the end of the pipeline. + */ + +/** + * \var MediaPipeline::Entity::sourceLink + * The link on the libcamera::MediaLink source pad, to the downstream entity, + * null for the last node at the end of the pipeline. + */ + +/** + * \fn MediaPipeline::entities() + * \brief Retrieve list of entities composing the media pipeline + * \return The list of MediaPipeline::Entity entities composing the media + * pipeline. + */ + /** * \brief Retrieve all source pads connected to a sink pad through active routes *