Cameras are listed through a double indirection, first iterating over all available pipeline handlers, and then listing the cameras they each support. To simplify the API make the pipeline handlers register the cameras with the camera manager directly, which lets the camera manager easily expose the list of all available cameras. The PipelineHandler API gets simplified as the handlers don't need to expose the list of cameras they have created. 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>
52 lines
1.1 KiB
C++
52 lines
1.1 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 <vector>
|
|
|
|
namespace libcamera {
|
|
|
|
class Camera;
|
|
class DeviceEnumerator;
|
|
class EventDispatcher;
|
|
class PipelineHandler;
|
|
|
|
class CameraManager
|
|
{
|
|
public:
|
|
int start();
|
|
void stop();
|
|
|
|
const std::vector<Camera *> &cameras() const { return cameras_; }
|
|
Camera *get(const std::string &name);
|
|
|
|
void addCamera(Camera *camera);
|
|
|
|
static CameraManager *instance();
|
|
|
|
void setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);
|
|
EventDispatcher *eventDispatcher();
|
|
|
|
private:
|
|
CameraManager();
|
|
CameraManager(const CameraManager &) = delete;
|
|
void operator=(const CameraManager &) = delete;
|
|
~CameraManager();
|
|
|
|
std::unique_ptr<DeviceEnumerator> enumerator_;
|
|
std::vector<PipelineHandler *> pipes_;
|
|
std::vector<Camera *> cameras_;
|
|
|
|
std::unique_ptr<EventDispatcher> dispatcher_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|
|
|
|
#endif /* __LIBCAMERA_CAMERA_MANAGER_H__ */
|