From 48b2b7928c792ef9785b0face9dd71fa4cafa13c Mon Sep 17 00:00:00 2001 From: Antoine Bouyer Date: Tue, 4 Nov 2025 14:49:26 +0100 Subject: [PATCH] libcamera: pipeline_handler: Add accessor for useCount_ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kieran Bingham Reviewed-by: Barnabás Pőcze [Kieran: fix extraneous ;] Signed-off-by: Kieran Bingham --- 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 e89d6a33..b2078577 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); void hotplugMediaDevice(MediaDevice *media); + unsigned int useCount() const { 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 e5f9e55c..15fb3256 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's used camera count + * \return The number of acquired cameras of the pipeline handler + */ + /** * \fn PipelineHandler::cameraManager() const * \brief Retrieve the CameraManager that this pipeline handler belongs to