libcamera: camera: Associate cameras with their pipeline handler
The PipelineHandler which creates a Camera is responsible for serving any operation requested by the user. In order forward the public API calls, the camera needs to store a reference to its pipeline handler. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- Changes since v1: - Create pipeline handlers is shared pointers, make them inherit from std::enable_shared_from_this<> and stored them in shared pointers.
This commit is contained in:
committed by
Laurent Pinchart
parent
a29b7fc7d5
commit
5b02e03199
@@ -12,10 +12,13 @@
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
class PipelineHandler;
|
||||
|
||||
class Camera final
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Camera> create(const std::string &name);
|
||||
static std::shared_ptr<Camera> create(PipelineHandler *pipe,
|
||||
const std::string &name);
|
||||
|
||||
Camera(const Camera &) = delete;
|
||||
void operator=(const Camera &) = delete;
|
||||
@@ -23,9 +26,10 @@ public:
|
||||
const std::string &name() const;
|
||||
|
||||
private:
|
||||
explicit Camera(const std::string &name);
|
||||
Camera(PipelineHandler *pipe, const std::string &name);
|
||||
~Camera();
|
||||
|
||||
std::shared_ptr<PipelineHandler> pipe_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
~CameraManager();
|
||||
|
||||
std::unique_ptr<DeviceEnumerator> enumerator_;
|
||||
std::vector<PipelineHandler *> pipes_;
|
||||
std::vector<std::shared_ptr<PipelineHandler>> pipes_;
|
||||
std::vector<std::shared_ptr<Camera>> cameras_;
|
||||
|
||||
std::unique_ptr<EventDispatcher> dispatcher_;
|
||||
|
||||
Reference in New Issue
Block a user