diff options
-rw-r--r-- | video/camera.cpp | 17 | ||||
-rw-r--r-- | video/camera.hpp | 4 |
2 files changed, 17 insertions, 4 deletions
diff --git a/video/camera.cpp b/video/camera.cpp index c33ab13a..b5cf3120 100644 --- a/video/camera.cpp +++ b/video/camera.cpp @@ -37,14 +37,27 @@ bool show_dialog(const QString& camera_name) return false; } -std::unique_ptr<camera_impl> make_camera(const QString& name) +std::unique_ptr<camera_impl> make_camera_(const QString& name) { QMutexLocker l(&mtx); for (auto& camera : metadata) for (const QString& name_ : camera->camera_names()) if (name_ == name) - return camera->make_camera(name); + return camera->make_camera(name_); + + return nullptr; +} + +std::unique_ptr<camera_impl> make_camera(const QString& name) +{ + if (auto ret = make_camera_(name)) + return ret; + + for (auto& camera : metadata) + for (const QString& name_ : camera->camera_names()) + if (auto ret = camera->make_camera(name_); ret) + return ret; return nullptr; } diff --git a/video/camera.hpp b/video/camera.hpp index 9ff2821b..250bad36 100644 --- a/video/camera.hpp +++ b/video/camera.hpp @@ -85,8 +85,8 @@ namespace video { using camera_impl = impl::camera; -OTR_VIDEO_EXPORT -std::unique_ptr<camera_impl> make_camera(const QString& name); +OTR_VIDEO_EXPORT std::unique_ptr<camera_impl> make_camera(const QString& name); +OTR_VIDEO_EXPORT std::unique_ptr<camera_impl> make_camera_(const QString& name); OTR_VIDEO_EXPORT std::vector<QString> camera_names(); |