Loading...
Searching...
No Matches
camera_manager.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2023, Ideas on Board Oy.
*
* Camera manager private data
*/
#pragma once
#include <libcamera/camera_manager.h>
#include <memory>
#include <sys/types.h>
#include <vector>
#include <libcamera/base/class.h>
#include <libcamera/base/mutex.h>
#include <libcamera/base/thread.h>
#include <libcamera/base/thread_annotations.h>
#include "libcamera/internal/global_configuration.h"
#include "libcamera/internal/process.h"
namespace libcamera {
class Camera;
class DeviceEnumerator;
class IPAManager;
class PipelineHandlerFactoryBase;
class CameraManager::Private : public Extensible::Private, public Thread
{
LIBCAMERA_DECLARE_PUBLIC(CameraManager)
public:
Private();
int start();
void addCamera(std::shared_ptr<Camera> camera) LIBCAMERA_TSA_EXCLUDES(mutex_);
void removeCamera(std::shared_ptr<Camera> camera) LIBCAMERA_TSA_EXCLUDES(mutex_);
const GlobalConfiguration &configuration() const
{
return configuration_;
}
IPAManager *ipaManager() const { return ipaManager_.get(); }
protected:
void run() override;
private:
int init();
void createPipelineHandlers();
void pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory);
void cleanup() LIBCAMERA_TSA_EXCLUDES(mutex_);
/*
* This mutex protects
*
* - initialized_ and status_ during initialization
* - cameras_ after initialization
*/
mutable Mutex mutex_;
std::vector<std::shared_ptr<Camera>> cameras_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
ConditionVariable cv_;
bool initialized_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
int status_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
std::unique_ptr<DeviceEnumerator> enumerator_;
std::unique_ptr<IPAManager> ipaManager_;
const GlobalConfiguration configuration_;
};
} /* namespace libcamera */
camera_manager.h
The camera manager.
class.h
Utilities to help constructing class interfaces.
LIBCAMERA_DECLARE_PUBLIC
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Definition class.h:57
libcamera::Camera
Camera device.
Definition camera.h:115
libcamera::DeviceEnumerator
Enumerate, store and search media devices.
Definition device_enumerator.h:40
libcamera::Extensible::Private
Base class for private data managed through a d-pointer.
Definition class.h:65
libcamera::Extensible::Private::Private
Private()
Construct an instance of an Extensible class private data.
Definition class.cpp:194
libcamera::IPAManager
Manager for IPA modules.
Definition ipa_manager.h:30
libcamera::PipelineHandlerFactoryBase
Base class for pipeline handler factories.
Definition pipeline_handler.h:106
libcamera::Thread
A thread of execution.
Definition thread.h:32
libcamera::Thread::start
void start()
Start the thread.
Definition thread.cpp:253
libcamera::Thread::run
virtual void run()
Main function of the thread.
Definition thread.cpp:344
mutex.h
Mutex classes with clang thread safety annotation.
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
process.h
Process object.
thread.h
Thread support.