diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera.cpp | 2 | ||||
-rw-r--r-- | src/libcamera/pipeline_handler.cpp | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index c4f65c1a..2d947a44 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -870,7 +870,7 @@ int Camera::release() return ret == -EACCES ? -EBUSY : ret; if (d->isAcquired()) - d->pipe_->release(); + d->pipe_->release(this); d->setState(Private::CameraAvailable); diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 825aff5a..cfade490 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -183,6 +183,7 @@ bool PipelineHandler::acquire() /** * \brief Release exclusive access to the pipeline handler + * \param[in] camera The camera for which to release data * * This function releases access to the pipeline handler previously acquired by * a call to acquire(). Every release() call shall match a previous successful @@ -196,7 +197,7 @@ bool PipelineHandler::acquire() * * \sa acquire() */ -void PipelineHandler::release() +void PipelineHandler::release(Camera *camera) { MutexLocker locker(lock_); @@ -204,9 +205,22 @@ void PipelineHandler::release() unlockMediaDevices(); + releaseDevice(camera); + --useCount_; } +/** + * \brief Release resources associated with this camera + * \param[in] camera The camera for which to release resources + * + * Pipeline handlers may override this in order to perform cleanup operations + * when a camera is released, such as freeing memory. + */ +void PipelineHandler::releaseDevice([[maybe_unused]] Camera *camera) +{ +} + void PipelineHandler::unlockMediaDevices() { for (std::shared_ptr<MediaDevice> &media : mediaDevices_) |