libcamera: include/libcamera/internal/camera.h Source File

libcamera v0.5.0 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 <set>
14#include <stdint.h>
15#include <string>
16
17#include <libcamera/base/class.h>
18
19#include <libcamera/camera.h>
20
21namespace libcamera {
22
23class CameraControlValidator;
24class PipelineHandler;
25class Stream;
26
27 class Camera::Private : public Extensible::Private
28{
29 LIBCAMERA_DECLARE_PUBLIC(Camera)
30
31public:
32 Private(PipelineHandler *pipe);
33 ~Private();
34
35 PipelineHandler *pipe() { return pipe_.get(); }
36 const PipelineHandler *pipe() const { return pipe_.get(); }
37
38 std::list<Request *> queuedRequests_;
39 ControlInfoMap controlInfo_;
40 ControlList properties_;
41
42 uint32_t requestSequence_;
43
44 const CameraControlValidator *validator() const { return validator_.get(); }
45
46private:
47 enum State {
48 CameraAvailable,
49 CameraAcquired,
50 CameraConfigured,
51 CameraStopping,
52 CameraRunning,
53 };
54
55 bool isAcquired() const;
56 bool isRunning() const;
57 int isAccessAllowed(State state, bool allowDisconnected = false,
58 const char *from = __builtin_FUNCTION()) const;
59 int isAccessAllowed(State low, State high,
60 bool allowDisconnected = false,
61 const char *from = __builtin_FUNCTION()) const;
62
63 void disconnect();
64 void setState(State state);
65
66 std::shared_ptr<PipelineHandler> pipe_;
67 std::string id_;
68 std::set<Stream *> streams_;
69 std::set<const Stream *> activeStreams_;
70
71 bool disconnected_;
72 std::atomic<State> state_;
73
74 std::unique_ptr<CameraControlValidator> validator_;
75};
76
77} /* namespace libcamera */
camera.h
Camera device handling.
class.h
Utilities to help constructing class interfaces.
LIBCAMERA_DECLARE_PUBLIC
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Definition class.h:57
libcamera::CameraControlValidator
A control validator for Camera instances.
Definition camera_controls.h:17
libcamera::Camera::Private
Base class for camera private data.
Definition camera.h:28
libcamera::Camera::Private::requestSequence_
uint32_t requestSequence_
The queuing sequence number of the request.
Definition camera.h:42
libcamera::Camera::Private::queuedRequests_
std::list< Request * > queuedRequests_
The list of queued and not yet completed requests.
Definition camera.h:38
libcamera::Camera::Private::pipe
const PipelineHandler * pipe() const
Retrieve the pipeline handler related to this camera.
Definition camera.h:36
libcamera::Camera::Private::properties_
ControlList properties_
The list of properties supported by the camera.
Definition camera.h:40
libcamera::Camera::Private::Private
Private(PipelineHandler *pipe)
Construct a Camera::Private instance.
Definition camera.cpp:590
libcamera::Camera::Private::pipe
PipelineHandler * pipe()
Retrieve the pipeline handler related to this camera.
Definition camera.h:35
libcamera::Camera::Private::controlInfo_
ControlInfoMap controlInfo_
The set of controls supported by the camera.
Definition camera.h:39
libcamera::Camera::Private::validator
const CameraControlValidator * validator() const
Retrieve the control validator related to this camera.
Definition camera.h:44
libcamera::ControlInfoMap
A map of ControlId to ControlInfo.
Definition controls.h:367
libcamera::ControlList
Associate a list of ControlId with their values for an object.
Definition controls.h:411
libcamera::Extensible::Private
Base class for private data managed through a d-pointer.
Definition class.h:65
libcamera::Extensible::Private::Private
Private()
Construct an instance of an Extensible class private data.
Definition class.cpp:194
libcamera::PipelineHandler
Create and manage cameras based on a set of media devices.
Definition pipeline_handler.h:35
libcamera::Stream
Video stream for a camera.
Definition stream.h:76
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17