@@ -71,6 +71,8 @@ public:
CameraManager *cameraManager() const { return manager_; }
protected:
+ void clearMediaDevices();
+
void registerCamera(std::shared_ptr<Camera> camera);
void hotplugMediaDevice(MediaDevice *media);
@@ -142,6 +142,21 @@ MediaDevice *PipelineHandler::acquireMediaDevice(DeviceEnumerator *enumerator,
return media.get();
}
+/**
+ * \brief Clear the list of acquired media devices for this PipelineHandler instance
+ *
+ * This is meant to be used when the Pipeline Handler needs to search multiple
+ * media graphs to create multiple instances of itself, and a partial match
+ * needs to be canceled as an invalid media device was detected. This is to
+ * prevent mediaDevices_ from having a mix of invalid media devices from a
+ * previous failed match and valid media devices from the current succeeding
+ * match.
+ */
+void PipelineHandler::clearMediaDevices()
+{
+ mediaDevices_.clear();
+}
+
/**
* \brief Acquire exclusive access to the pipeline handler for the process
*
Some pipeline handler implementations, such as the simple pipeline handler, can encounter systems with multiple media devices that can be supported. In a subsequent patch, the simple pipeline handler will be updated so that it will continue to match other media graphs even if the first media graph it encounters has an invalid media device. In this case, there would be a mix of invalid and valid media devices in mediaDevices_. Add a function to clear mediaDevices_ so that this can be prevented. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- New in v2 --- include/libcamera/internal/pipeline_handler.h | 2 ++ src/libcamera/pipeline_handler.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+)