Files
external_libcamera/include/libcamera/camera_manager.h
Laurent Pinchart 8b0de29c41 libcamera: camera_manager: Make the class a singleton
There can only be a single camera manager instance in the application.
Creating it as a singleton helps avoiding mistakes. It also allows the
camera manager to be used as a storage of global data, such as the
future event dispatcher.

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>
2019-01-08 16:23:16 +02:00

42 lines
784 B
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* camera_manager.h - Camera management
*/
#ifndef __LIBCAMERA_CAMERA_MANAGER_H__
#define __LIBCAMERA_CAMERA_MANAGER_H__
#include <string>
#include <vector>
namespace libcamera {
class Camera;
class DeviceEnumerator;
class PipelineHandler;
class CameraManager
{
public:
int start();
void stop();
std::vector<std::string> list() const;
Camera *get(const std::string &name);
static CameraManager *instance();
private:
CameraManager();
CameraManager(const CameraManager &) = delete;
void operator=(const CameraManager &) = delete;
DeviceEnumerator *enumerator_;
std::vector<PipelineHandler *> pipes_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_CAMERA_MANAGER_H__ */