From ddd267c348b018dc330665539aa573b32c4f6b6e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 23 Jul 2021 05:01:53 +0300 Subject: libcamera: pipeline_handler: Drop CameraData class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CameraData class isn't used anymore. Drop it. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- include/libcamera/internal/pipeline_handler.h | 26 +----- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- src/libcamera/pipeline_handler.cpp | 94 +--------------------- 8 files changed, 9 insertions(+), 123 deletions(-) diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 24b0c5ca..1e48f707 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -7,14 +7,12 @@ #ifndef __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ #define __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ -#include #include #include #include #include #include -#include #include #include @@ -34,23 +32,6 @@ class MediaDevice; class PipelineHandler; class Request; -class CameraData -{ -public: - explicit CameraData(PipelineHandler *pipe) - : pipe_(pipe) - { - } - virtual ~CameraData() = default; - - PipelineHandler *pipe_; - ControlInfoMap controlInfo_; - ControlList properties_; - -private: - LIBCAMERA_DISABLE_COPY(CameraData) -}; - class PipelineHandler : public std::enable_shared_from_this, public Object { @@ -87,15 +68,11 @@ public: const char *name() const { return name_; } protected: - void registerCamera(std::shared_ptr camera, - std::unique_ptr data); + void registerCamera(std::shared_ptr camera); void hotplugMediaDevice(MediaDevice *media); virtual int queueRequestDevice(Camera *camera, Request *request) = 0; - CameraData *cameraData(const Camera *camera); - const CameraData *cameraData(const Camera *camera) const; - CameraManager *manager_; private: @@ -104,7 +81,6 @@ private: std::vector> mediaDevices_; std::vector> cameras_; - std::map> cameraData_; const char *name_; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index e0dc0f3d..e4d44b4d 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1166,7 +1166,7 @@ int PipelineHandlerIPU3::registerCameras() std::shared_ptr camera = Camera::create(std::move(data), cameraId, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); LOG(IPU3, Info) << "Registered Camera[" << numCameras << "] \"" diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index b615e4fa..b2674ac0 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1108,7 +1108,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(std::move(data), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); return true; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 519abc7c..0bbe9ed8 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -974,7 +974,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(std::move(data), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); return 0; } diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 947f3f1f..ef7687ea 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1050,7 +1050,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(std::move(data), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); registered = true; } diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index b6b1fd35..973ecd5b 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -472,7 +472,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) std::set streams{ &data->stream_ }; std::shared_ptr camera = Camera::create(std::move(data), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); /* Enable hot-unplug notifications. */ hotplugMediaDevice(media); diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 1181806b..baeb6a7e 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -477,7 +477,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(std::move(data), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); return true; } diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 0e571d89..62d29cbe 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -39,55 +39,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Pipeline) -/** - * \class CameraData - * \brief Base class for platform-specific data associated with a camera - * - * The CameraData base abstract class represents platform specific-data - * a pipeline handler might want to associate with a Camera to access them - * at a later time. - * - * Pipeline handlers are expected to extend this base class with platform - * specific implementation, associate instances of the derived classes - * using the registerCamera() function, and access them at a later time - * with cameraData(). - */ - -/** - * \fn CameraData::CameraData(PipelineHandler *pipe) - * \brief Construct a CameraData instance for the given pipeline handler - * \param[in] pipe The pipeline handler - * - * The reference to the pipeline handler is stored internally, the caller shall - * guarantee that the pointer remains valid as long as the CameraData instance - * exists. - */ - -/** - * \var CameraData::pipe_ - * \brief The pipeline handler related to this CameraData instance - * - * The pipe_ pointer provides access to the PipelineHandler object that this - * instance is related to. It is set when the CameraData instance is created - * and remains valid until the instance is destroyed. - */ - -/** - * \var CameraData::controlInfo_ - * \brief The set of controls supported by the camera - * - * The control information shall be initialised by the pipeline handler when - * creating the camera, and shall not be modified afterwards. - */ - -/** - * \var CameraData::properties_ - * \brief The list of properties supported by the camera - * - * The list of camera properties shall be initialised by the pipeline handler - * when creating the camera, and shall not be modified afterwards. - */ - /** * \class PipelineHandler * \brief Create and manage cameras based on a set of media devices @@ -471,28 +422,14 @@ void PipelineHandler::completeRequest(Request *request) /** * \brief Register a camera to the camera manager and pipeline handler * \param[in] camera The camera to be added - * \param[in] data Pipeline-specific data for the camera * * This function is called by pipeline handlers to register the cameras they - * handle with the camera manager. It associates the pipeline-specific \a data - * with the camera, for later retrieval with cameraData(). Ownership of \a data - * is transferred to the PipelineHandler. + * handle with the camera manager. * * \context This function shall be called from the CameraManager thread. */ -void PipelineHandler::registerCamera(std::shared_ptr camera, - std::unique_ptr data) +void PipelineHandler::registerCamera(std::shared_ptr camera) { - /* - * To be removed once all pipeline handlers will have migrated from - * CameraData to Camera::Private. - */ - if (data) { - camera->_d()->controlInfo_ = std::move(data->controlInfo_); - camera->_d()->properties_ = std::move(data->properties_); - } - - cameraData_[camera.get()] = std::move(data); cameras_.push_back(camera); if (mediaDevices_.empty()) @@ -586,33 +523,6 @@ void PipelineHandler::disconnect() } } -/** - * \brief Retrieve the pipeline-specific data associated with a Camera - * \param[in] camera The camera whose data to retrieve - * \return A pointer to the pipeline-specific data passed to registerCamera(). - * The returned pointer is a borrowed reference and is guaranteed to remain - * valid until the pipeline handler is destroyed. It shall not be deleted - * manually by the caller. - */ -CameraData *PipelineHandler::cameraData(const Camera *camera) -{ - ASSERT(cameraData_.count(camera)); - return cameraData_[camera].get(); -} - -/** - * \brief Retrieve the pipeline-specific data associated with a Camera - * \param[in] camera The camera whose data to retrieve - * \sa cameraData() - * \return A const pointer to the pipeline-specific data passed to - * registerCamera(). - */ -const CameraData *PipelineHandler::cameraData(const Camera *camera) const -{ - ASSERT(cameraData_.count(camera)); - return cameraData_.at(camera).get(); -} - /** * \var PipelineHandler::manager_ * \brief The Camera manager associated with the pipeline handler -- cgit v1.2.1