From patchwork Wed Mar 27 17:27:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Vuillaumier X-Patchwork-Id: 19818 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 9DCD7BD160 for ; Wed, 27 Mar 2024 17:28:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 42D7561C41; Wed, 27 Mar 2024 18:28:09 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="CLg7nvJ+"; dkim-atps=neutral Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:260f::601]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BBA6761C41 for ; Wed, 27 Mar 2024 18:28:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PO2E9VIXYLkNNtqRyJPboTQSiuQXw0ieTzkcxYX7DnDitnAuGQKXjdfyLHry1NuWrQryOOLt2b+8r5sZdLcqsPoe70w+9YogXA8ui5Om9/mJkSjqZH+1pejj5cKZrN6Y+NJ+EfGAW7BvZkQdca+b4oNbPez/lvkzIIPkFDzWpcntR3MCAGy4+McIrVenkp2tpmJhqKKVKfgr3Mf/6S/gb/qnZy0Ko7X1CHwhtY2+k6W87QqNEzA1rXOKK3tTTCjpMn3F0/3qikMBrjqbnl32iL1SdzuvfZxrZ31CZS4YhmyKwsGobZCwUyaLjlsOvnkH7CLtL48YgHY8ywh0KzQG3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=cbZY5mDsaoIkvG7DsMeYN5dwsnE9gUW1PuIC2hgbtJw=; b=RsYc7stwsxhRlU+xmL/ay+iHw6JMws8KRRuAcXfB79VQoWCmRPRfarvqGg2lbCRDEYrVOyKktS7Zck3nDzznqSNVS6vFZ7BBvGXZ04ug2EoV8/kB9qM2VzfFmY1nH3ZIiCvHmURfRIOWm36Bkjt5R0AboGJ466jk1EMKubjK95fOWGFpMzKac62KDgbIJO+D5lzTbJpEqY0d9KpkhLgysnxvND+T2/NgnuvAXRW6uCZf9gp39GxoLYB7j/LC9NHMoozxLwwHo8x3w9OaPyZeRziJhHet12i/62di5TAjuQmwLNsWz9k5a7c2le7nxH4cPG8k69t2tWNmLx2lr95xTA== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cbZY5mDsaoIkvG7DsMeYN5dwsnE9gUW1PuIC2hgbtJw=; b=CLg7nvJ+lgw4OQcerSgNRZDl2g2VL5x4fVo6OFGgjIx01dDQsYO2ExVHFWpD1kA1v4h1VtQuOtt3Plil3Duf+ZXGZfU9+dQzAdUBG+wlEHc2oHvp5NWumfJa08iPgSFPqvMVcWNjSYlxYm/mzUeBKhwMNSfW3W0+/72Z5WkxYHM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) by AM0PR04MB6913.eurprd04.prod.outlook.com (2603:10a6:208:184::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Wed, 27 Mar 2024 17:28:06 +0000 Received: from AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::2208:ff47:a8fe:dea6]) by AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::2208:ff47:a8fe:dea6%5]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 17:28:06 +0000 From: Julien Vuillaumier To: libcamera-devel@lists.libcamera.org Cc: julien.vuillaumier@nxp.com, Jacopo Mondi Subject: [PATCH v3 1/2] libcamera: pipeline: Add a get factory by name helper Date: Wed, 27 Mar 2024 18:27:30 +0100 Message-Id: <20240327172731.434048-2-julien.vuillaumier@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240327172731.434048-1-julien.vuillaumier@nxp.com> References: <20240327172731.434048-1-julien.vuillaumier@nxp.com> X-ClientProxiedBy: AM0PR02CA0167.eurprd02.prod.outlook.com (2603:10a6:20b:28d::34) To AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8147:EE_|AM0PR04MB6913:EE_ X-MS-Office365-Filtering-Correlation-Id: 73554931-df74-44f5-3a5d-08dc4e834347 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5rAds6swk2wwI7PVDvRfdt98xE1aR/qzSy8gfiphZBpOQDyov+Z6sZhV3BcbsxcW+rSI47h+wFhlgcgP4BAfliVu9SRerDexE8peg1bE/FDKjEl5ahbk2pUWf4b+Mh0cZoKf2xbdSiopl4cg0A+ohjuKU6JjQnBhXFV75XXyz4b+VjzATr804QpYyqW6sT42kO3+RqFb04W+DCir24FbcILB0BSovwF30MNHHwsfLnmhTRGjMVFmBAHbFuROK3t/q/iooE5692mQbY5l7AITHOk18Knvov4rxOOvuqtqAg43LCz83025J8TRNijQZQXipAv+Hp5R3slXa5MNZykOyvOuAHRJChpMZJ802X0UNAKXdAcfQP563RMEe+ZizYDrOC5qiXk3kTtwvdN15pt4ZuSUh7PRQh0+DQljKY84U5uc777QPyLXioVsWooVt+icV6tAcaaE9w5TbZ2Bqpw7FPkpMdVHxQPua+ADbuyU7GIgszlA/q5F9C9ce9tuw//oWE12nr6G53Mya+hhQkkAzGDWkncAVp0Mt6uL7dcMTE1Jo9hwc3/ScANjmPgBBu90ZNuqkQiZH49SbYbZ5i83jadSEx47GnKWw1PwbWrMAO9F7N+dkNGtEnrHW790ffMtGQiZjZvAQ0caXJC/LJ+QJImYKNuESLtxLggeGzkUI9j+1T3z1Ed3vrup+3bv1Q5SFsSUBf+oM6hdKPwrdSK465CuBs7cZBTrsfHMndUKVL8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8147.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(52116005)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BGqk8eqtN1U3JsqFnpDwZgdU5CMxcYqDlj1vmvrf8e+CYK2/ol26KSUwKxmSQTSrd6xLB3ahmLif9dlQfImf0nqidXbZos50d6ymV+31VOsjJ2yBht/u+UI0C1MmcyU1PLJJVNWrX7ACCIY1I69bAy+az+L9dEQDTrc7h2dGtJeNIMnR6f3jFqW/OauTKPU7bEsq9gheMrPFYTOry1Xnyq8d2pFyRXEXzX/qjqQ1OpEdof5U09udDe1AfPseHOpqJaG+/cEwFcESFgtW3lPVEEVUzfxeh9evd23aNsrqBp4bRDz/JUJvg2zqa/LsJIswN1SDyKrZ4AVpQ1e8KPQCrhiGsnn5v9jtqs7BwEVfYAuFt3NylbiI0mmnDieESOBFudoIEjByrj8OR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MnlfVtlOmTf1pqEsE2+4YrhUZVJbhsEGzid3ZsKGvCv7yQAh3ob4BX4+WIO8/hFHNhlkCGe1UloMhUmhEG+gGi7B0AfM/LkGd153FugbpvTJjAXfW0afTEQbG/ztLnJYu09jL/tcYi/qLqDcFQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73554931-df74-44f5-3a5d-08dc4e834347 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8147.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 17:28:06.2691 (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: f+UUkEwvlsww7SMhqw88BAs2FPQAIVii44b01ETM9TX6P+Fgb20kkD7NA1k1Rkfy1bx0Xppp2YwCloJavNyKziR3wJ1/Vza6Zx1pQdiZw3M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6913 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" Add a static helper to the PipelineHandlerFactoryBase class to allow retrieving a pipeline by name. Signed-off-by: Julien Vuillaumier Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- include/libcamera/internal/pipeline_handler.h | 1 + src/libcamera/pipeline_handler.cpp | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index c96944f4..19361a40 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -114,6 +114,7 @@ public: const std::string &name() const { return name_; } static std::vector &factories(); + static const PipelineHandlerFactoryBase *getFactoryByName(const std::string &name); private: static void registerType(PipelineHandlerFactoryBase *factory); diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 29e0c98a..c926f454 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -794,6 +794,28 @@ std::vector &PipelineHandlerFactoryBase::factories return factories; } +/** + * \brief Return the factory for the pipeline handler with name \a name + * \param[in] name The pipeline handler name + * \return The factory of the pipeline with name \a name, or nullptr if not found + */ +const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(const std::string &name) +{ + const std::vector &factories = + PipelineHandlerFactoryBase::factories(); + + auto iter = std::find_if(factories.begin(), + factories.end(), + [&name](const PipelineHandlerFactoryBase *f) { + return f->name() == name; + }); + + if (iter != factories.end()) + return *iter; + + return nullptr; +} + /** * \class PipelineHandlerFactory * \brief Registration of PipelineHandler classes and creation of instances