From patchwork Thu Nov 27 15:45:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Bouyer X-Patchwork-Id: 25263 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 56765C3257 for ; Thu, 27 Nov 2025 15:43:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 01E1660A8B; Thu, 27 Nov 2025 16:43:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="DKjNUqii"; dkim-atps=neutral Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazlp170100001.outbound.protection.outlook.com [IPv6:2a01:111:f403:c200::1]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0FE99609DE for ; Thu, 27 Nov 2025 16:43:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DD4jmopyFv+MRcUlWuAW730duFspdXT22f4r/UyFK5h5xLqftCTBXCvq9Ku2YxmNvSns98tVCzF84dLIhDYGzWrqfcTXLkP3cEyxdw20v9t2a+dBiTdCAYHeJ1kYJFf5SXkU1kYbEYdjyC7sTIPUL0J2No+sUQo2PSng9AjgSdVkNQANGAzuk5gtbq636WQDiI12M8bbAYqAhfNwt8K2Nuly+a6xpk5FRw4zdlr7XmZZB7eXB1C58MSHAHnPhzC+kA7u4EU1Wx+6pirsKxyeUia1SXW+PScc0kVvllOwJ7Rn0kCLVtUwcEIQAEe9XyGQTP4Qazd09rWaxTYOgDvkug== 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=Z9PLhjHueBpnxxQO7TX9nxeB/ptvoO+Zse7m66cYjYc=; b=inTn+NnosoXuQfuo+SyK/teklI8bj9jNgcN6isMM+bryznDDSKb2MTKbJTMdEDU5qc+kcMFzi25eS5psEk57mi93DclQuaAc/WmclG9KKaikjU5ycd0v/Mo5ZruI9ynz6cSc8Df/atBDQ16XuCT4iZ1AbjY/LTStJQq8xzCqKEzDUBrj+5VCbfdebhgE+IcKaZcedHY/eK0Q2YrLbizfKQuc6ASdKk+sPPcOjTkhqO96jAdRnjte4uxdU/K6/vhX9z4W6PbOW4aHT7sTPVEAlexeoj3Mlkgf/36jAfVE9de93emRxpQlyCnyM3r1dd7q3yENhcnKkvEmd6qwnCB9QQ== 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=Z9PLhjHueBpnxxQO7TX9nxeB/ptvoO+Zse7m66cYjYc=; b=DKjNUqiilv32QnV1jmwyo+zhYXY3K2Edo35cInIVy7QA28PFRWRvQ7pRHtDS1XjxIu4mNT6vThG5x1ZWpXGudGYSCfI6gkQJ/8jwITA9EIS387zySF6dfObDeqJ+57duwxaLcnOEcsEbvQvc9yWFIGyHj+lSJr9tKjXi4T06nTodpuQqzMU1WR7gIsN5mmlOzJzdU6P0XMIVSckY8lqerZLYAsspQ2TU0LO9PxVS4l+fSiOx/jLn0sNXUdn8HBbTm/BWw3f1L5yIhDKro4jCx/R1KHBGTpUrNCGpxVWfK9RfvvHaQhGv1qlbLsGAg16+h984HboBMQ+Omrygwx4gHg== 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 PR3PR04MB7372.eurprd04.prod.outlook.com (2603:10a6:102:80::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.13; Thu, 27 Nov 2025 15:43:38 +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.9366.009; Thu, 27 Nov 2025 15:43:38 +0000 From: Antoine Bouyer To: libcamera-devel@lists.libcamera.org Cc: julien.vuillaumier@nxp.com, jacopo.mondi@ideasonboard.com, barnabas.pocze@ideasonboard.com, isaac.scott@ideasonboard.com, Andrei Gansari , Antoine Bouyer Subject: [PATCH v3 1/2] libamera: media_pipeline: Add accessor for MediaPipeline list of entities Date: Thu, 27 Nov 2025 16:45:17 +0100 Message-ID: <20251127154519.2038844-2-antoine.bouyer@nxp.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251127154519.2038844-1-antoine.bouyer@nxp.com> References: <20251127154519.2038844-1-antoine.bouyer@nxp.com> X-ClientProxiedBy: SJ0PR05CA0173.namprd05.prod.outlook.com (2603:10b6:a03:339::28) To GVXPR04MB9831.eurprd04.prod.outlook.com (2603:10a6:150:11c::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GVXPR04MB9831:EE_|PR3PR04MB7372:EE_ X-MS-Office365-Filtering-Correlation-Id: bafb26e7-6ed7-4548-7f29-08de2dcbbbbe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|19092799006|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 6nRbAXtuVI4p3y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MU3fF7hb5+CNHWMtsJNp0ZMhRvJ+Eu6dSFzJN2i0ZGx9pEHOMGNnMLW98bv9Kb1MKY3aVDq9cg5uOxOL9C6r2B9wfzUFRiofQZnWxvJTb266UNFj4hS4oqRhz1QH0dkOgT1ORE9N2plYQWw0d7henMh1UffBgo4wNNRVG2oMwQnIMIJmpxKVZZqIfGwDH+IqDVmpj9U2XDaH8NaAPLst62bUkuVse+W4gaMnxtQ3LHnli0wnHqvWIxoVrUZD24bYyWb+bCVxZe65rmspt/273BSUVb9IWjH6sJ1DiycLrbxH9LRjwHst0Kpj8mfS9QQD0NZN/FYpIqnQkZt62Ng8TkGz2N5s8eWvdCpTyV3YvO1gLYyPUYdKeuFXbBe0eMekQ0AjzsgjIBoZ4eaxT+MnPuGsvy47tquxDm6yELIu3Uqsjh2VAT+2UJxZSzDk7vkA 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)(1800799024)(366016)(19092799006)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ihBs8r5A2t6V8kkoYKM7zl/rTg0HEUCu5DDzZvacJJN1NsDPGqHl0xGt33W9Xa8H1CfdFkGGLEzJCPUU4ytn6S+LyEMzZ8k8XA+QYRWnmmqwOdxTkP3X/pSur8kFcyLBXkKIli3iQ+CFpuTn3eOTDPT22tZPo+ziQC7iaKjq6b0WqVbSOSCwqnKNI73E4HA4kqdL5krER6RcK19UuWRMkg6x/C1RfbFWMTAseT84WiJSQoy9SAFP4ZGvCmNjslWpWXTs+w6a3Lmd3ZdPu3/BPjr9MrpM7nXv/ybZBrQgbBZfzhTdQhMYn2maC9+1Pa9pYODoO6sSTW34srld+I+DCDI04lsNpk8qIAJ3wDzQOIwLICk3xnHx8LvUN4pm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lswkpesNULFFhN1kxEv8WpJg8SCk2a0mqSnVBXIiXe4q3d7Bv88ZraVaoxDco/xbxThmOhbbdl+JN5i73DFUH8AEXaOcVg04SgNmLbp3gXrqayHWJlYOrnsb7moPeZgwAA1I3KPkvYU7fFyaI0ki4BseppOw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bafb26e7-6ed7-4548-7f29-08de2dcbbbbe X-MS-Exchange-CrossTenant-AuthSource: GVXPR04MB9831.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2025 15:43:38.6336 (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: BneHqcKjhIocSom+py9HvzO7qgILEh/aQwePvjW5oZULh/D1SHgfU4ceYJJjeVCxlrgBFrqGj7sXOcJa9+avXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7372 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 Reviewed-by: Kieran Bingham --- include/libcamera/internal/media_pipeline.h | 29 ++++--------- src/libcamera/media_pipeline.cpp | 46 +++++++++++++++++++++ 2 files changed, 53 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..3c5517314a4a 100644 --- a/src/libcamera/media_pipeline.cpp +++ b/src/libcamera/media_pipeline.cpp @@ -43,6 +43,52 @@ LOG_DEFINE_CATEGORY(MediaPipeline) * two entities in a media graph. */ +/** + * \struct MediaPipeline::Entity + * \brief A node composing the media pipeline + * + * The MediaPipeline::Entity structure stores how a MediaEntity composing a + * media pipeline is connected to other media entities. It stores pointers + * to the source pad, the sink pad and the media link traversed by the media + * pipeline, as well as a flag that reports if the entity supports internal + * routing. + */ + +/** + * \var MediaPipeline::Entity::entity + * \brief Pointer to the libcamera::MediaEntity, always valid + */ + +/** + * \var MediaPipeline::Entity::supportsRouting + * \brief Whether or not the entity is a subdev that supports the routing API + */ + +/** + * \var MediaPipeline::Entity::sink + * \brief 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 + * \brief 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 + * \brief 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 *