Message ID | 20190711185047.11671-3-paul.elder@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thank you for the patch. On Fri, Jul 12, 2019 at 03:50:41AM +0900, Paul Elder wrote: > 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> > --- > 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 <algorithm> > #include <dlfcn.h> > #include <elf.h> > #include <errno.h> > @@ -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<const char *> osLicenses = { std::array would be cheaper than std::vector. With that fixed, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + "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 */
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 <algorithm> #include <dlfcn.h> #include <elf.h> #include <errno.h> @@ -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<const 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 */
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> --- New in v4 src/libcamera/include/ipa_module.h | 2 ++ src/libcamera/ipa_module.cpp | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)