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

libcamera v0.4.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 <string>
15
16#include <libcamera/base/class.h>
17
18#include <libcamera/camera.h>
19
20namespace libcamera {
21
22class CameraControlValidator;
23class PipelineHandler;
24class Stream;
25
26 class Camera::Private : public Extensible::Private
27{
28 LIBCAMERA_DECLARE_PUBLIC(Camera)
29
30public:
31 Private(PipelineHandler *pipe);
32 ~Private();
33
34 PipelineHandler *pipe() { return pipe_.get(); }
35 const PipelineHandler *pipe() const { return pipe_.get(); }
36
37 std::list<Request *> queuedRequests_;
38 ControlInfoMap controlInfo_;
39 ControlList properties_;
40
41 uint32_t requestSequence_;
42
43 const CameraControlValidator *validator() const { return validator_.get(); }
44
45private:
46 enum State {
47 CameraAvailable,
48 CameraAcquired,
49 CameraConfigured,
50 CameraStopping,
51 CameraRunning,
52 };
53
54 bool isAcquired() const;
55 bool isRunning() const;
56 int isAccessAllowed(State state, bool allowDisconnected = false,
57 const char *from = __builtin_FUNCTION()) const;
58 int isAccessAllowed(State low, State high,
59 bool allowDisconnected = false,
60 const char *from = __builtin_FUNCTION()) const;
61
62 void disconnect();
63 void setState(State state);
64
65 std::shared_ptr<PipelineHandler> pipe_;
66 std::string id_;
67 std::set<Stream *> streams_;
68 std::set<const Stream *> activeStreams_;
69
70 bool disconnected_;
71 std::atomic<State> state_;
72
73 std::unique_ptr<CameraControlValidator> validator_;
74};
75
76} /* 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:27
libcamera::Camera::Private::requestSequence_
uint32_t requestSequence_
The queuing sequence number of the request.
Definition camera.h:41
libcamera::Camera::Private::queuedRequests_
std::list< Request * > queuedRequests_
The list of queued and not yet completed requests.
Definition camera.h:37
libcamera::Camera::Private::pipe
const PipelineHandler * pipe() const
Retrieve the pipeline handler related to this camera.
Definition camera.h:35
libcamera::Camera::Private::properties_
ControlList properties_
The list of properties supported by the camera.
Definition camera.h:39
libcamera::Camera::Private::Private
Private(PipelineHandler *pipe)
Construct a Camera::Private instance.
Definition camera.cpp:588
libcamera::Camera::Private::pipe
PipelineHandler * pipe()
Retrieve the pipeline handler related to this camera.
Definition camera.h:34
libcamera::Camera::Private::controlInfo_
ControlInfoMap controlInfo_
The set of controls supported by the camera.
Definition camera.h:38
libcamera::Camera::Private::validator
const CameraControlValidator * validator() const
Retrieve the control validator related to this camera.
Definition camera.h:43
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