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>
This commit is contained in:
parent
dfc9a8db09
commit
099815b853
2 changed files with 26 additions and 0 deletions
|
@ -35,6 +35,8 @@ public:
|
||||||
bool match(PipelineHandler *pipe,
|
bool match(PipelineHandler *pipe,
|
||||||
uint32_t minVersion, uint32_t maxVersion) const;
|
uint32_t minVersion, uint32_t maxVersion) const;
|
||||||
|
|
||||||
|
bool isOpenSource() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct IPAModuleInfo info_;
|
struct IPAModuleInfo info_;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "ipa_module.h"
|
#include "ipa_module.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -469,4 +471,26 @@ bool IPAModule::match(PipelineHandler *pipe,
|
||||||
!strcmp(info_.pipelineName, pipe->name());
|
!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 */
|
} /* namespace libcamera */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue