libcamera  v0.0.0+3-3b6e2d50-dirty (2022-01-27T16:18:04+08:00)
Supporting cameras in Linux since 2019
camera.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * Copyright (C) 2021, Google Inc.
4  *
5  * camera.h - Camera private data
6  */
7 #ifndef __LIBCAMERA_INTERNAL_CAMERA_H__
8 #define __LIBCAMERA_INTERNAL_CAMERA_H__
9 
10 #include <atomic>
11 #include <list>
12 #include <memory>
13 #include <set>
14 #include <string>
15 
16 #include <libcamera/base/class.h>
17 
18 #include <libcamera/camera.h>
19 
20 namespace libcamera {
21 
22 class PipelineHandler;
23 class Stream;
24 
26 {
28 
29 public:
31  ~Private();
32 
33  PipelineHandler *pipe() { return pipe_.get(); }
34 
35  std::list<Request *> queuedRequests_;
38 
39  uint32_t requestSequence_;
40 
41 private:
42  enum State {
43  CameraAvailable,
44  CameraAcquired,
45  CameraConfigured,
46  CameraStopping,
47  CameraRunning,
48  };
49 
50  bool isRunning() const;
51  int isAccessAllowed(State state, bool allowDisconnected = false,
52  const char *from = __builtin_FUNCTION()) const;
53  int isAccessAllowed(State low, State high,
54  bool allowDisconnected = false,
55  const char *from = __builtin_FUNCTION()) const;
56 
57  void disconnect();
58  void setState(State state);
59 
60  std::shared_ptr<PipelineHandler> pipe_;
61  std::string id_;
62  std::set<Stream *> streams_;
63  std::set<const Stream *> activeStreams_;
64 
65  bool disconnected_;
66  std::atomic<State> state_;
67 };
68 
69 } /* namespace libcamera */
70 
71 #endif /* __LIBCAMERA_INTERNAL_CAMERA_H__ */
Camera device handling.
Utilities to help constructing class interfaces.
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Base class for camera private data.
Definition: camera.h:26
PipelineHandler * pipe()
Retrieve the pipeline handler related to this camera.
Definition: camera.h:33
ControlInfoMap controlInfo_
The set of controls supported by the camera.
Definition: camera.h:36
uint32_t requestSequence_
The queuing sequence number of the request.
Definition: camera.h:39
ControlList properties_
The list of properties supported by the camera.
Definition: camera.h:37
std::list< Request * > queuedRequests_
The list of queued and not yet completed requests.
Definition: camera.h:35
Camera device.
Definition: camera.h:77
A map of ControlId to ControlInfo.
Definition: controls.h:306
Associate a list of ControlId with their values for an object.
Definition: controls.h:350
Base class for private data managed through a d-pointer.
Definition: class.h:65
Private()
Construct an instance of an Extensible class private data.
Definition: class.cpp:194
Create and manage cameras based on a set of media devices.
Definition: pipeline_handler.h:37
Top-level libcamera namespace.
Definition: bound_method.h:15