diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-01-22 16:31:39 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-01-24 22:24:11 +0200 |
commit | 5b02e03199b79165086135236d8fb9b2c673aae1 (patch) | |
tree | 84fe12868edf1c9a50d19a96455138975cb751af /src/libcamera/pipeline_handler.cpp | |
parent | a29b7fc7d5b3cca3738728961cb2f5c9600cc960 (diff) |
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.
Diffstat (limited to 'src/libcamera/pipeline_handler.cpp')
-rw-r--r-- | src/libcamera/pipeline_handler.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 45788487..3850ea8f 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -32,11 +32,21 @@ LOG_DEFINE_CATEGORY(Pipeline) * * The PipelineHandler matches the media devices provided by a DeviceEnumerator * with the pipelines it supports and creates corresponding Camera devices. + * + * Pipeline handler instances are reference-counted through std::shared_ptr<>. + * They implement std::enable_shared_from_this<> in order to create new + * std::shared_ptr<> in code paths originating from member functions of the + * PipelineHandler class where only the 'this' pointer is available. */ /** * \brief Construct a PipelineHandler instance * \param[in] manager The camera manager + * + * In order to honour the std::enable_shared_from_this<> contract, + * PipelineHandler instances shall never be constructed manually, but always + * through the PipelineHandlerFactory::create() method implemented by the + * respective factories. */ PipelineHandler::PipelineHandler(CameraManager *manager) : manager_(manager) |