libcamera v0.5.2
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
camera.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2021, Google Inc.
4 *
5 * Camera private data
6 */
7
8#pragma once
9
10#include <atomic>
11#include <list>
12#include <memory>
13#include <queue>
14#include <set>
15#include <stdint.h>
16#include <string>
17
19
20#include <libcamera/camera.h>
21
22namespace libcamera {
23
25class PipelineHandler;
26class Stream;
27
29{
31
32public:
33 Private(PipelineHandler *pipe);
34 ~Private();
35
36 PipelineHandler *pipe() { return pipe_.get(); }
37 const PipelineHandler *pipe() const { return pipe_.get(); }
38
39 std::list<Request *> queuedRequests_;
40 std::queue<Request *> waitingRequests_;
43
45
46 const CameraControlValidator *validator() const { return validator_.get(); }
47
48private:
49 enum State {
50 CameraAvailable,
51 CameraAcquired,
52 CameraConfigured,
53 CameraStopping,
54 CameraRunning,
55 };
56
57 bool isAcquired() const;
58 bool isRunning() const;
59 int isAccessAllowed(State state, bool allowDisconnected = false,
60 const char *from = __builtin_FUNCTION()) const;
61 int isAccessAllowed(State low, State high,
62 bool allowDisconnected = false,
63 const char *from = __builtin_FUNCTION()) const;
64
65 void disconnect();
66 void setState(State state);
67
68 std::shared_ptr<PipelineHandler> pipe_;
69 std::string id_;
70 std::set<Stream *> streams_;
71 std::set<const Stream *> activeStreams_;
72
73 bool disconnected_;
74 std::atomic<State> state_;
75
76 std::unique_ptr<CameraControlValidator> validator_;
77};
78
79} /* namespace libcamera */
Camera device handling.
Utilities to help constructing class interfaces.
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Definition class.h:57
A control validator for Camera instances.
Definition camera_controls.h:17
Base class for camera private data.
Definition camera.h:29
uint32_t requestSequence_
The queuing sequence number of the request.
Definition camera.h:44
std::list< Request * > queuedRequests_
The list of queued and not yet completed requests.
Definition camera.h:39
const PipelineHandler * pipe() const
Retrieve the pipeline handler related to this camera.
Definition camera.h:37
std::queue< Request * > waitingRequests_
The queue of waiting requests.
Definition camera.h:40
ControlList properties_
The list of properties supported by the camera.
Definition camera.h:42
Private(PipelineHandler *pipe)
Construct a Camera::Private instance.
Definition camera.cpp:590
PipelineHandler * pipe()
Retrieve the pipeline handler related to this camera.
Definition camera.h:36
ControlInfoMap controlInfo_
The set of controls supported by the camera.
Definition camera.h:41
const CameraControlValidator * validator() const
Retrieve the control validator related to this camera.
Definition camera.h:46
A map of ControlId to ControlInfo.
Definition controls.h:367
Associate a list of ControlId with their values for an object.
Definition controls.h:411
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:34
Video stream for a camera.
Definition stream.h:76
Top-level libcamera namespace.
Definition backtrace.h:17