summaryrefslogtreecommitdiff
path: root/include/libcamera/camera_manager.h
blob: 4b941fd9183bca6805955f9c780abf345d6f3168 (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
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2018, Google Inc.
 *
 * camera_manager.h - Camera management
 */
#ifndef __LIBCAMERA_CAMERA_MANAGER_H__
#define __LIBCAMERA_CAMERA_MANAGER_H__

#include <memory>
#include <string>
#include <vector>

namespace libcamera {

class Camera;
class DeviceEnumerator;
class EventDispatcher;
class PipelineHandler;

class CameraManager
{
public:
	int start();
	void stop();

	const std::vector<Camera *> &cameras() const { return cameras_; }
	Camera *get(const std::string &name);

	void addCamera(Camera *camera);

	static CameraManager *instance();

	void setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);
	EventDispatcher *eventDispatcher();

private:
	CameraManager();
	CameraManager(const CameraManager &) = delete;
	void operator=(const CameraManager &) = delete;
	~CameraManager();

	std::unique_ptr<DeviceEnumerator> enumerator_;
	std::vector<PipelineHandler *> pipes_;
	std::vector<Camera *> cameras_;

	std::unique_ptr<EventDispatcher> dispatcher_;
};

} /* namespace libcamera */

#endif /* __LIBCAMERA_CAMERA_MANAGER_H__ */