From a0143dc8939829639c7c4f1e023dae93be578744 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 23 Jul 2021 00:19:09 +0300 Subject: libcamera: camera: Move Camera::Private to header file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Camera::Private class is defined in camera.cpp. To prepare for allowing it to be subclassed by pipeline handlers, move it to a new internal/camera.h header. The \file comment block in camera.cpp now needs to explicitly tell which camera.h file it refers to. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- include/libcamera/internal/camera.h | 63 ++++++++++++++++++++++++++++++++++ include/libcamera/internal/meson.build | 1 + 2 files changed, 64 insertions(+) create mode 100644 include/libcamera/internal/camera.h (limited to 'include') diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h new file mode 100644 index 00000000..9ef5d8ae --- /dev/null +++ b/include/libcamera/internal/camera.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Google Inc. + * + * camera.h - Camera private data + */ +#ifndef __LIBCAMERA_INTERNAL_CAMERA_H__ +#define __LIBCAMERA_INTERNAL_CAMERA_H__ + +#include +#include +#include +#include + +#include + +#include + +namespace libcamera { + +class PipelineHandler; +class Stream; + +class Camera::Private : public Extensible::Private +{ + LIBCAMERA_DECLARE_PUBLIC(Camera) + +public: + enum State { + CameraAvailable, + CameraAcquired, + CameraConfigured, + CameraStopping, + CameraRunning, + }; + + Private(PipelineHandler *pipe, const std::string &id, + const std::set &streams); + ~Private(); + + 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 pipe_; + std::string id_; + std::set streams_; + std::set activeStreams_; + +private: + bool disconnected_; + std::atomic state_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_INTERNAL_CAMERA_H__ */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 6d4eb7ed..dac1a2d3 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -12,6 +12,7 @@ libcamera_tracepoint_header = custom_target( libcamera_internal_headers = files([ 'bayer_format.h', 'byte_stream_buffer.h', + 'camera.h', 'camera_controls.h', 'camera_sensor.h', 'camera_sensor_properties.h', -- cgit v1.2.1