summaryrefslogtreecommitdiff
path: root/src/libcamera/ipa_module.cpp
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2019-07-12 01:27:23 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2019-07-12 15:52:37 +0900
commit099815b85377ac68147e789f491ef26c57da3956 (patch)
tree7c60e752f0b1760ba4c8baa9fa69e0e69083f0f6 /src/libcamera/ipa_module.cpp
parentdfc9a8db0921d7af1a0ebf958127853965000732 (diff)
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 <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/ipa_module.cpp')
-rw-r--r--src/libcamera/ipa_module.cpp24
1 files changed, 24 insertions, 0 deletions
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 <algorithm>
+#include <array>
#include <dlfcn.h>
#include <elf.h>
#include <errno.h>
@@ -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<const char *, sizeof(char *)> 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 */