From 099815b85377ac68147e789f491ef26c57da3956 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Fri, 12 Jul 2019 01:27:23 +0900 Subject: libcamera: ipa_module: add isOpenSource 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 --- src/libcamera/ipa_module.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/libcamera/ipa_module.cpp') diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 9cead715..93bb4889 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -7,6 +7,8 @@ #include "ipa_module.h" +#include +#include #include #include #include @@ -469,4 +471,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::array 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 */ -- cgit v1.2.1