libcamera: camera: Move Camera::Private to header file

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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart
2021-07-23 00:19:09 +03:00
parent c46f82fd1b
commit a0143dc893
3 changed files with 66 additions and 38 deletions
+63
View File
@@ -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 <atomic>
#include <memory>
#include <set>
#include <string>
#include <libcamera/base/class.h>
#include <libcamera/camera.h>
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<Stream *> &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<PipelineHandler> pipe_;
std::string id_;
std::set<Stream *> streams_;
std::set<const Stream *> activeStreams_;
private:
bool disconnected_;
std::atomic<State> state_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_INTERNAL_CAMERA_H__ */
+1
View File
@@ -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',