Files
external_libcamera/include/libcamera/camera_manager.h
Laurent Pinchart 549d982f61 libcamera: camera_manager: Inherit from Extensible
Use the d-pointer infrastructure offered by the Extensible class to
replace the custom implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-11-08 00:11:17 +02:00

60 lines
1.4 KiB
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 <memory>
#include <string>
#include <sys/types.h>
#include <vector>
#include <libcamera/extensible.h>
#include <libcamera/object.h>
#include <libcamera/signal.h>
namespace libcamera {
class Camera;
class EventDispatcher;
class CameraManager : public Object, public Extensible
{
LIBCAMERA_DECLARE_PRIVATE(CameraManager)
public:
CameraManager();
CameraManager(const CameraManager &) = delete;
CameraManager &operator=(const CameraManager &) = delete;
~CameraManager();
int start();
void stop();
std::vector<std::shared_ptr<Camera>> cameras() const;
std::shared_ptr<Camera> get(const std::string &name);
std::shared_ptr<Camera> get(dev_t devnum);
void addCamera(std::shared_ptr<Camera> camera,
const std::vector<dev_t> &devnums);
void removeCamera(std::shared_ptr<Camera> camera);
static const std::string &version() { return version_; }
void setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);
EventDispatcher *eventDispatcher();
Signal<std::shared_ptr<Camera>> cameraAdded;
Signal<std::shared_ptr<Camera>> cameraRemoved;
private:
static const std::string version_;
static CameraManager *self_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_CAMERA_MANAGER_H__ */