Loading...
Searching...
No Matches
camera.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2021, Google Inc.
*
* Camera private data
*/
#pragma once
#include <atomic>
#include <list>
#include <memory>
#include <queue>
#include <set>
#include <stdint.h>
#include <string>
#include <libcamera/base/class.h>
#include <libcamera/camera.h>
namespace libcamera {
class CameraControlValidator;
class PipelineHandler;
class Stream;
class Camera::Private : public Extensible::Private
{
LIBCAMERA_DECLARE_PUBLIC(Camera)
public:
Private(PipelineHandler *pipe);
~Private();
PipelineHandler *pipe() { return pipe_.get(); }
const PipelineHandler *pipe() const { return pipe_.get(); }
std::list<Request *> queuedRequests_;
std::queue<Request *> waitingRequests_;
ControlInfoMap controlInfo_;
ControlList properties_;
uint32_t requestSequence_;
const CameraControlValidator *validator() const { return validator_.get(); }
private:
enum State {
CameraAvailable,
CameraAcquired,
CameraConfigured,
CameraStopping,
CameraRunning,
};
bool isAcquired() const;
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_;
bool disconnected_;
std::atomic<State> state_;
std::unique_ptr<CameraControlValidator> validator_;
};
} /* 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:29
libcamera::Camera::Private::requestSequence_
uint32_t requestSequence_
The queuing sequence number of the request.
Definition camera.h:44
libcamera::Camera::Private::queuedRequests_
std::list< Request * > queuedRequests_
The list of queued and not yet completed requests.
Definition camera.h:39
libcamera::Camera::Private::pipe
const PipelineHandler * pipe() const
Retrieve the pipeline handler related to this camera.
Definition camera.h:37
libcamera::Camera::Private::waitingRequests_
std::queue< Request * > waitingRequests_
The queue of waiting requests.
Definition camera.h:40
libcamera::Camera::Private::properties_
ControlList properties_
The list of properties supported by the camera.
Definition camera.h:42
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:36
libcamera::Camera::Private::controlInfo_
ControlInfoMap controlInfo_
The set of controls supported by the camera.
Definition camera.h:41
libcamera::Camera::Private::validator
const CameraControlValidator * validator() const
Retrieve the control validator related to this camera.
Definition camera.h:46
libcamera::ControlInfoMap
A map of ControlId to ControlInfo.
Definition controls.h:365
libcamera::ControlList
Associate a list of ControlId with their values for an object.
Definition controls.h:409
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:34
libcamera::Stream
Video stream for a camera.
Definition stream.h:76
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17