[libcamera-devel] [PATCH v2 05/10] libcamera: ipa_module: match IPA module with pipeline handler

Paul Elder paul.elder at ideasonboard.com
Tue Jun 4 01:16:32 CEST 2019


Add a method to IPAModule to check if it matches with a given pipeline
handler.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
New patch, but this IPAModule::match method used to be IPAManager::match

 src/libcamera/include/ipa_module.h |  4 ++++
 src/libcamera/ipa_module.cpp       | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h
index 557435c..48ff2b6 100644
--- a/src/libcamera/include/ipa_module.h
+++ b/src/libcamera/include/ipa_module.h
@@ -13,6 +13,8 @@
 #include <libcamera/ipa/ipa_interface.h>
 #include <libcamera/ipa/ipa_module_info.h>
 
+#include "pipeline_handler.h"
+
 namespace libcamera {
 
 class IPAModule
@@ -29,6 +31,8 @@ public:
 
 	std::unique_ptr<IPAInterface> createInstance();
 
+	bool match(PipelineHandler *pipe) const;
+
 private:
 	struct IPAModuleInfo info_;
 
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
index 91d97ae..c1b04fe 100644
--- a/src/libcamera/ipa_module.cpp
+++ b/src/libcamera/ipa_module.cpp
@@ -18,6 +18,7 @@
 #include <unistd.h>
 
 #include "log.h"
+#include "pipeline_handler.h"
 
 /**
  * \file ipa_module.h
@@ -417,4 +418,22 @@ std::unique_ptr<IPAInterface> IPAModule::createInstance()
 	return std::unique_ptr<IPAInterface>(ipaCreate_());
 }
 
+/**
+ * \brief Match this IPAModule with a PipelineHandler
+ * \param[in] pipe Pipeline handler to match with
+ *
+ * Checks if this IPA module matches the \a pipe pipeline handler.
+ * Matching is based on the fields of the IPA module info, and the
+ * corresponding attributes of the pipeline handler, such as pipeline version
+ * and name.
+ *
+ * \return true if the pipeline handler matches the IPA module, false otherwise
+ */
+bool IPAModule::match(PipelineHandler *pipe) const
+{
+	return info_.moduleAPIVersion == IPA_MODULE_API_VERSION &&
+	       info_.pipelineVersion == pipe->version() &&
+	       !strcmp(info_.pipelineName, pipe->name());
+}
+
 } /* namespace libcamera */
-- 
2.20.1



More information about the libcamera-devel mailing list