From patchwork Wed Jul 17 10:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 20689 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 AA50ABDB1C for ; Wed, 17 Jul 2024 10:09:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3BB9663383; Wed, 17 Jul 2024 12:09:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="C7BTKLe6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2BE6C63369 for ; Wed, 17 Jul 2024 12:09:28 +0200 (CEST) Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 34768ABE; Wed, 17 Jul 2024 12:08:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1721210930; bh=xqXoeB7ybBMidkZKEB9nnUbEtQ8XMotOtU/aedcAEG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7BTKLe6ATdgIf/BcQBeWmmD+zmzS3tWspxCj8tQaGCOPc4WW2c9nlLeX63ZsOSQe lO0fUiPmhkGgZYfE1Gej3Xa91es/T8tnOEkuEVtWC010EAnd4xJRKBh7CXurIiOciL Hy4BBrg9IjhlrbfaS55uGo8Ap8kJ3JwB6Se6BKfg= From: Jacopo Mondi To: Umang Jain , libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi Subject: [RFC 3/9] libcamera: converter: Allow registering with feature Date: Wed, 17 Jul 2024 12:09:06 +0200 Message-ID: <20240717100913.16640-4-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240717100913.16640-1-jacopo.mondi@ideasonboard.com> References: <20240717100913.16640-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 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" Provide a way to overload the REGISTER_CONVERTER() macro to allow it to be called with or without an optional set of features. Signed-off-by: Jacopo Mondi --- include/libcamera/internal/converter.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index ead465170d01..035e6ffff135 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -116,8 +116,17 @@ public: } }; -#define REGISTER_CONVERTER(name, converter, compatibles) \ +#define __REGISTER_CONVERTER(name, converter, compatibles, features) \ static ConverterFactory global_##converter##Factory(name, compatibles, \ - Converter::Feature::None); + features); +#define __REGISTER_CONVERTER_NO_FEAT(name, converter, compatibles) \ + __REGISTER_CONVERTER(name, converter, compatibles, Converter::Feature::None); + +#define __register_converter_expand(_1, _2, _3, _4, EXT, ...) \ + __REGISTER_CONVERTER ## EXT + +#define REGISTER_CONVERTER(name, converter, compatibles, ...) \ + __register_converter_expand(name, converter, compatibles, ##__VA_ARGS__, , _NO_FEAT) \ + (name, converter, compatibles, ##__VA_ARGS__) } /* namespace libcamera */