blob: 33ebe0699fdf8135f8746a78f1c99ec5d2025701 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2023, Ideas on Board Oy.
*
* camera_manager.h - Camera manager private data
*/
#pragma once
#include <libcamera/camera_manager.h>
#include <map>
#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/ipa_manager.h"
#include "libcamera/internal/process.h"
namespace libcamera {
class Camera;
class DeviceEnumerator;
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_);
protected:
void run() override;
private:
int init();
void createPipelineHandlers();
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_;
IPAManager ipaManager_;
ProcessManager processManager_;
};
} /* namespace libcamera */
|