diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera_manager.cpp | 4 | ||||
-rw-r--r-- | src/libcamera/device_enumerator.cpp | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index de6d5d82..30827976 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -155,12 +155,12 @@ void CameraManager::Private::createPipelineHandlers() } } - /* \todo Register hot-plug callback here */ + enumerator_->devicesAdded.connect(this, &Private::createPipelineHandlers); } void CameraManager::Private::cleanup() { - /* \todo Unregister hot-plug callback here */ + enumerator_->devicesAdded.disconnect(this, &Private::createPipelineHandlers); /* * Release all references to cameras to ensure they all get destroyed diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index e21a2a7d..647974b1 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -228,6 +228,16 @@ std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(const std::string &d } /** +* \var DeviceEnumerator::devicesAdded +* \brief Notify of new media devices being found +* +* This signal is emitted when the device enumerator finds new media devices in +* the system. It may be emitted for every newly detected device, or once for +* multiple devices, at the discretion of the device enumerator. Not all device +* enumerator types may support dynamic detection of new devices. +*/ + +/** * \brief Add a media device to the enumerator * \param[in] media media device instance to add * @@ -242,6 +252,9 @@ void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> &&media) << "Added device " << media->deviceNode() << ": " << media->driver(); devices_.push_back(std::move(media)); + + /* \todo To batch multiple additions, emit with a small delay here. */ + devicesAdded.emit(); } /** |