mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 09:35:06 +03:00
libcamera: pipeline_handler: Add functions to lock a whole pipeline
Add lock() and unlock() which are backed by the MediaDevice implementation and lock all media devices claimed by a pipeline handler instance. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
d6a8860747
commit
d07975950c
2 changed files with 39 additions and 0 deletions
|
@ -57,6 +57,9 @@ public:
|
||||||
MediaDevice *acquireMediaDevice(DeviceEnumerator *enumerator,
|
MediaDevice *acquireMediaDevice(DeviceEnumerator *enumerator,
|
||||||
const DeviceMatch &dm);
|
const DeviceMatch &dm);
|
||||||
|
|
||||||
|
bool lock();
|
||||||
|
void unlock();
|
||||||
|
|
||||||
virtual CameraConfiguration
|
virtual CameraConfiguration
|
||||||
streamConfiguration(Camera *camera, const std::vector<StreamUsage> &usages) = 0;
|
streamConfiguration(Camera *camera, const std::vector<StreamUsage> &usages) = 0;
|
||||||
virtual int configureStreams(Camera *camera, const CameraConfiguration &config) = 0;
|
virtual int configureStreams(Camera *camera, const CameraConfiguration &config) = 0;
|
||||||
|
|
|
@ -181,6 +181,42 @@ MediaDevice *PipelineHandler::acquireMediaDevice(DeviceEnumerator *enumerator,
|
||||||
return media.get();
|
return media.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Lock all media devices acquired by the pipeline
|
||||||
|
*
|
||||||
|
* This method shall not be called from pipeline handler implementation, as the
|
||||||
|
* Camera class handles locking directly.
|
||||||
|
*
|
||||||
|
* \return True if the devices could be locked, false otherwise
|
||||||
|
* \sa unlock()
|
||||||
|
* \sa MediaDevice::lock()
|
||||||
|
*/
|
||||||
|
bool PipelineHandler::lock()
|
||||||
|
{
|
||||||
|
for (std::shared_ptr<MediaDevice> &media : mediaDevices_) {
|
||||||
|
if (!media->lock()) {
|
||||||
|
unlock();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Unlock all media devices acquired by the pipeline
|
||||||
|
*
|
||||||
|
* This method shall not be called from pipeline handler implementation, as the
|
||||||
|
* Camera class handles locking directly.
|
||||||
|
*
|
||||||
|
* \sa lock()
|
||||||
|
*/
|
||||||
|
void PipelineHandler::unlock()
|
||||||
|
{
|
||||||
|
for (std::shared_ptr<MediaDevice> &media : mediaDevices_)
|
||||||
|
media->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn PipelineHandler::streamConfiguration()
|
* \fn PipelineHandler::streamConfiguration()
|
||||||
* \brief Retrieve a group of stream configurations for a specified camera
|
* \brief Retrieve a group of stream configurations for a specified camera
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue