plugins: reverse candidates order to fetch higher versions first
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 8 Oct 2021 20:34:07 +0000 (20:34 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Fri, 8 Oct 2021 20:34:07 +0000 (20:34 +0000)
modules/core/src/parallel/plugin_parallel_wrapper.impl.hpp
modules/highgui/src/plugin_wrapper.impl.hpp
modules/videoio/src/backend_plugin.cpp

index a5649b6..b9b3105 100644 (file)
@@ -223,6 +223,9 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
             continue;
         std::vector<std::string> candidates;
         cv::glob(utils::fs::join(path, plugin_expr), candidates);
+        // Prefer candisates with higher versions
+        // TODO: implemented accurate versions-based comparator
+        std::sort(candidates.begin(), candidates.end(), std::greater<std::string>());
         CV_LOG_DEBUG(NULL, "    - " << path << ": " << candidates.size());
         copy(candidates.begin(), candidates.end(), back_inserter(results));
     }
index 97aea69..23f0ecf 100644 (file)
@@ -224,6 +224,9 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
             continue;
         std::vector<std::string> candidates;
         cv::glob(utils::fs::join(path, plugin_expr), candidates);
+        // Prefer candisates with higher versions
+        // TODO: implemented accurate versions-based comparator
+        std::sort(candidates.begin(), candidates.end(), std::greater<std::string>());
         CV_LOG_DEBUG(NULL, "    - " << path << ": " << candidates.size());
         copy(candidates.begin(), candidates.end(), back_inserter(results));
     }
index e42c986..039083c 100644 (file)
@@ -373,6 +373,9 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
             continue;
         std::vector<std::string> candidates;
         cv::glob(utils::fs::join(path, plugin_expr), candidates);
+        // Prefer candisates with higher versions
+        // TODO: implemented accurate versions-based comparator
+        std::sort(candidates.begin(), candidates.end(), std::greater<std::string>());
         CV_LOG_INFO(NULL, "    - " << path << ": " << candidates.size());
         copy(candidates.begin(), candidates.end(), back_inserter(results));
     }