From e597598abf19e4e0372240f9819df559c62f97d2 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 23 Jan 2019 21:53:17 +0200 Subject: libcamera: pipeline_handler: Store the camera manager pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of passing the camera manager pointer to the match() function, and later to more PipelineHandler functions, store it in the PipelineHandler::manager_ member variable at construction time and access it from there. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/pipeline_handler.cpp | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'src/libcamera/pipeline_handler.cpp') diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index c24feeaf..45788487 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -34,18 +34,30 @@ LOG_DEFINE_CATEGORY(Pipeline) * with the pipelines it supports and creates corresponding Camera devices. */ +/** + * \brief Construct a PipelineHandler instance + * \param[in] manager The camera manager + */ +PipelineHandler::PipelineHandler(CameraManager *manager) + : manager_(manager) +{ +} + +PipelineHandler::~PipelineHandler() +{ +} + /** * \fn PipelineHandler::match(DeviceEnumerator *enumerator) * \brief Match media devices and create camera instances - * \param manager The camera manager * \param enumerator The enumerator providing all media devices found in the * system * * This function is the main entry point of the pipeline handler. It is called - * by the camera manager with the \a manager and \a enumerator passed as - * arguments. It shall acquire from the \a enumerator all the media devices it - * needs for a single pipeline, create one or multiple Camera instances and - * register them with the \a manager. + * by the camera manager with the \a enumerator passed as an argument. It shall + * acquire from the \a enumerator all the media devices it needs for a single + * pipeline, create one or multiple Camera instances and register them with the + * camera manager. * * If all media devices needed by the pipeline handler are found, they must all * be acquired by a call to MediaDevice::acquire(). This function shall then @@ -66,6 +78,15 @@ LOG_DEFINE_CATEGORY(Pipeline) * created, or false otherwise */ +/** + * \var PipelineHandler::manager_ + * \brief The Camera manager associated with the pipeline handler + * + * The camera manager pointer is stored in the pipeline handler for the + * convenience of pipeline handler implementations. It remains valid and + * constant for the whole lifetime of the pipeline handler. + */ + /** * \class PipelineHandlerFactory * \brief Registration of PipelineHandler classes and creation of instances @@ -96,8 +117,11 @@ PipelineHandlerFactory::PipelineHandlerFactory(const char *name) /** * \fn PipelineHandlerFactory::create() * \brief Create an instance of the PipelineHandler corresponding to the factory + * \param[in] manager The camera manager * - * This virtual function is implemented by the REGISTER_PIPELINE_HANDLER() macro. + * This virtual function is implemented by the REGISTER_PIPELINE_HANDLER() + * macro. It creates a pipeline handler instance associated with the camera + * \a manager. * * \return a pointer to a newly constructed instance of the PipelineHandler * subclass corresponding to the factory -- cgit v1.2.1