From patchwork Thu Jul 11 18:50:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1661 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D793860BC8 for ; Thu, 11 Jul 2019 20:51:07 +0200 (CEST) Received: from neptunite.amanokami.net (softbank126163157105.bbtec.net [126.163.157.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 89D8B31C; Thu, 11 Jul 2019 20:51:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562871067; bh=o9wA7F2M8MqSKml05Uk3iGKZlmjeZKKBMDFS0trE3FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qmKUkSjFAD0GkgNSYAivyOyFPPew7cE9C7Eh+QHsXGzb7Ej/7rBj7d1FhoLhZxtwm dxxWxNPCosOhwRKoDdp5eiu2bmWpa009mmVkkDid2rUiHmNa8a03EfFn2EcKEcYwSr ErJSmw/ZlKZDz/seXCEWuV88HTuz9txGyfAtHiwY= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Jul 2019 03:50:41 +0900 Message-Id: <20190711185047.11671-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190711185047.11671-1-paul.elder@ideasonboard.com> References: <20190711185047.11671-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/8] libcamera: ipa_module: add isOpenSource X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 18:51:08 -0000 Add a method to IPAModule to check if the module is open source. This uses the license field of the member IPAModuleInfo. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- New in v4 src/libcamera/include/ipa_module.h | 2 ++ src/libcamera/ipa_module.cpp | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h index b88ae5d..18e9223 100644 --- a/src/libcamera/include/ipa_module.h +++ b/src/libcamera/include/ipa_module.h @@ -35,6 +35,8 @@ public: bool match(PipelineHandler *pipe, uint32_t minVersion, uint32_t maxVersion) const; + bool isOpenSource() const; + private: struct IPAModuleInfo info_; diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 9cead71..788915e 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -7,6 +7,7 @@ #include "ipa_module.h" +#include #include #include #include @@ -469,4 +470,26 @@ bool IPAModule::match(PipelineHandler *pipe, !strcmp(info_.pipelineName, pipe->name()); } +/** + * \brief Verify if the IPA module is open source + * + * \sa IPAModuleInfo::license + */ +bool IPAModule::isOpenSource() const +{ + static std::vector osLicenses = { + "GPL-2.0-only", + "GPL-2.0-or-later", + "GPL-3.0-only", + "GPL-3.0-or-later", + "LGPL-2.1-only", + "LGPL-2.1-or-later", + "LGPL-3.0-only", + "LGPL-3.0-or-later", + }; + + return std::find(osLicenses.begin(), osLicenses.end(), info_.license) + != osLicenses.end(); +} + } /* namespace libcamera */