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
@@ -8,6 +8,7 @@
|
||||
#define __LIBCAMERA_PIPELINE_HANDLER_H__
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -16,7 +17,7 @@ namespace libcamera {
|
||||
class CameraManager;
|
||||
class DeviceEnumerator;
|
||||
|
||||
class PipelineHandler
|
||||
class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>
|
||||
{
|
||||
public:
|
||||
PipelineHandler(CameraManager *manager);
|
||||
@@ -34,7 +35,7 @@ public:
|
||||
PipelineHandlerFactory(const char *name);
|
||||
virtual ~PipelineHandlerFactory() { };
|
||||
|
||||
virtual PipelineHandler *create(CameraManager *manager) = 0;
|
||||
virtual std::shared_ptr<PipelineHandler> create(CameraManager *manager) = 0;
|
||||
|
||||
const std::string &name() const { return name_; }
|
||||
|
||||
@@ -50,9 +51,9 @@ class handler##Factory final : public PipelineHandlerFactory \
|
||||
{ \
|
||||
public: \
|
||||
handler##Factory() : PipelineHandlerFactory(#handler) {} \
|
||||
PipelineHandler *create(CameraManager *manager) \
|
||||
std::shared_ptr<PipelineHandler> create(CameraManager *manager) \
|
||||
{ \
|
||||
return new handler(manager); \
|
||||
return std::make_shared<handler>(manager); \
|
||||
} \
|
||||
}; \
|
||||
static handler##Factory global_##handler##Factory;
|
||||
|
||||
Reference in New Issue
Block a user