libcamera: ipa_module: allow instantiation of IPAInterface

Add functions for loading the IPAInterface factory function from an IPA
module shared object, and for creating an instance of an IPAInterface.
These functions will be used by IPAManager, from which a PipelineHandler
will request an IPAInterface.

Also update meson to add the "-ldl" linker argument, to allow loading of
the factory function from a shared object.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder
2019-06-05 10:44:52 -04:00
parent 9b4eb44581
commit 7faa67889f
3 changed files with 94 additions and 4 deletions
+12
View File
@@ -7,8 +7,10 @@
#ifndef __LIBCAMERA_IPA_MODULE_H__
#define __LIBCAMERA_IPA_MODULE_H__
#include <memory>
#include <string>
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
namespace libcamera {
@@ -17,16 +19,26 @@ class IPAModule
{
public:
explicit IPAModule(const std::string &libPath);
~IPAModule();
bool isValid() const;
const struct IPAModuleInfo &info() const;
bool load();
std::unique_ptr<IPAInterface> createInstance();
private:
struct IPAModuleInfo info_;
std::string libPath_;
bool valid_;
bool loaded_;
void *dlHandle_;
typedef IPAInterface *(*IPAIntfFactory)(void);
IPAIntfFactory ipaCreate_;
int loadIPAModuleInfo();
};