[v4,1/2] libcamera: pipeline_handler: Add accessor for useCount_
diff mbox series

Message ID 20251103140325.88535-2-antoine.bouyer@nxp.com
State New
Headers show
Series
  • imx8-isi: Move isi routing into acquireDevice
Related show

Commit Message

Antoine Bouyer Nov. 3, 2025, 2:03 p.m. UTC
Add an accessor for useCount_ parameter, so that PipelineHandler
child classes can access it to verify whether the media device
is already locked or not.

Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/internal/pipeline_handler.h | 1 +
 src/libcamera/pipeline_handler.cpp            | 6 ++++++
 2 files changed, 7 insertions(+)

Comments

Barnabás Pőcze Nov. 3, 2025, 3:54 p.m. UTC | #1
Hi

2025. 11. 03. 15:03 keltezéssel, Antoine Bouyer írta:
> Add an accessor for useCount_ parameter, so that PipelineHandler
> child classes can access it to verify whether the media device
> is already locked or not.
> 
> Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>   include/libcamera/internal/pipeline_handler.h | 1 +
>   src/libcamera/pipeline_handler.cpp            | 6 ++++++
>   2 files changed, 7 insertions(+)
> 
> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
> index e89d6a33e398..8fe970317fdd 100644
> --- a/include/libcamera/internal/pipeline_handler.h
> +++ b/include/libcamera/internal/pipeline_handler.h
> @@ -73,6 +73,7 @@ public:
>   protected:
>   	void registerCamera(std::shared_ptr<Camera> camera);
>   	void hotplugMediaDevice(MediaDevice *media);
> +	unsigned int useCount() { return useCount_; };

The method should be `const` qualified.


>   
>   	virtual int queueRequestDevice(Camera *camera, Request *request) = 0;
>   	virtual void stopDevice(Camera *camera) = 0;
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index e5f9e55c9783..3f7c20aced13 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -811,6 +811,12 @@ void PipelineHandler::disconnect()
>    * \return The pipeline handler name
>    */
>   
> + /**
> + * \fn PipelineHandler::useCount()
> + * \brief Retrieve the pipeline handler user count
> + * \return The pipeline handler user count
> + */

Maybe I would say something like "\return The number of acquired cameras of the pipeline handler"
since it's not immediately clear to me what the "user count" is.


Regards,
Barnabás Pőcze

> +
>   /**
>    * \fn PipelineHandler::cameraManager() const
>    * \brief Retrieve the CameraManager that this pipeline handler belongs to

Patch
diff mbox series

diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index e89d6a33e398..8fe970317fdd 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -73,6 +73,7 @@  public:
 protected:
 	void registerCamera(std::shared_ptr<Camera> camera);
 	void hotplugMediaDevice(MediaDevice *media);
+	unsigned int useCount() { return useCount_; };
 
 	virtual int queueRequestDevice(Camera *camera, Request *request) = 0;
 	virtual void stopDevice(Camera *camera) = 0;
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index e5f9e55c9783..3f7c20aced13 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -811,6 +811,12 @@  void PipelineHandler::disconnect()
  * \return The pipeline handler name
  */
 
+ /**
+ * \fn PipelineHandler::useCount()
+ * \brief Retrieve the pipeline handler user count
+ * \return The pipeline handler user count
+ */
+
 /**
  * \fn PipelineHandler::cameraManager() const
  * \brief Retrieve the CameraManager that this pipeline handler belongs to