summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera_manager.cpp3
-rw-r--r--src/libcamera/ipa_manager.cpp25
2 files changed, 23 insertions, 5 deletions
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 849377ad..da806fa7 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -15,6 +15,7 @@
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/event_dispatcher_poll.h"
+#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/log.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/thread.h"
@@ -63,6 +64,8 @@ private:
std::vector<std::shared_ptr<PipelineHandler>> pipes_;
std::unique_ptr<DeviceEnumerator> enumerator_;
+
+ IPAManager ipaManager_;
};
CameraManager::Private::Private(CameraManager *cm)
diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp
index 505cf610..e7fddf42 100644
--- a/src/libcamera/ipa_manager.cpp
+++ b/src/libcamera/ipa_manager.cpp
@@ -93,8 +93,21 @@ LOG_DEFINE_CATEGORY(IPAManager)
* plain C API, or to transmit the data to the isolated process through IPC.
*/
+IPAManager *IPAManager::self_ = nullptr;
+
+/**
+ * \brief Construct an IPAManager instance
+ *
+ * The IPAManager class is meant to only be instantiated once, by the
+ * CameraManager. Pipeline handlers shall use the instance() function to access
+ * the IPAManager instance.
+ */
IPAManager::IPAManager()
{
+ if (self_)
+ LOG(IPAManager, Fatal)
+ << "Multiple IPAManager objects are not allowed";
+
unsigned int ipaCount = 0;
/* User-specified paths take precedence. */
@@ -134,27 +147,29 @@ IPAManager::IPAManager()
if (!ipaCount)
LOG(IPAManager, Warning)
<< "No IPA found in '" IPA_MODULE_DIR "'";
+
+ self_ = this;
}
IPAManager::~IPAManager()
{
for (IPAModule *module : modules_)
delete module;
+
+ self_ = nullptr;
}
/**
* \brief Retrieve the IPA manager instance
*
- * The IPAManager is a singleton and can't be constructed manually. This
- * function shall instead be used to retrieve the single global instance of the
- * manager.
+ * The IPAManager is constructed by the CameraManager. This function shall be
+ * used to retrieve the single instance of the manager.
*
* \return The IPA manager instance
*/
IPAManager *IPAManager::instance()
{
- static IPAManager ipaManager;
- return &ipaManager;
+ return self_;
}
/**