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
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2021, Google Inc.
*
* camera.h - Camera private data
*/
#ifndef __LIBCAMERA_INTERNAL_CAMERA_H__
#define __LIBCAMERA_INTERNAL_CAMERA_H__
#include <atomic>
#include <memory>
#include <set>
#include <string>
#include <libcamera/base/class.h>
#include <libcamera/camera.h>
namespace libcamera {
class PipelineHandler;
class Stream;
class Camera::Private : public Extensible::Private
{
LIBCAMERA_DECLARE_PUBLIC(Camera)
public:
enum State {
CameraAvailable,
CameraAcquired,
CameraConfigured,
CameraStopping,
CameraRunning,
};
Private(PipelineHandler *pipe, const std::string &id,
const std::set<Stream *> &streams);
~Private();
bool isRunning() const;
int isAccessAllowed(State state, bool allowDisconnected = false,
const char *from = __builtin_FUNCTION()) const;
int isAccessAllowed(State low, State high,
bool allowDisconnected = false,
const char *from = __builtin_FUNCTION()) const;
void disconnect();
void setState(State state);
std::shared_ptr<PipelineHandler> pipe_;
std::string id_;
std::set<Stream *> streams_;
std::set<const Stream *> activeStreams_;
private:
bool disconnected_;
std::atomic<State> state_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_INTERNAL_CAMERA_H__ */
|