From 1ac65d73afec6248e0a3459e45b9acf4f0038a3f Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 24 Aug 2020 22:28:02 +0300 Subject: [PATCH] Reconstruct files --- applications/reconstruct2/src/main.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/applications/reconstruct2/src/main.cpp b/applications/reconstruct2/src/main.cpp index 4fe250a90..5fded260a 100644 --- a/applications/reconstruct2/src/main.cpp +++ b/applications/reconstruct2/src/main.cpp @@ -83,10 +83,13 @@ static void run(ftl::Configurable *root) { pipeline->append<ftl::operators::ArUco>("aruco")->value("enabled", false); }); + bool has_file = false; + // Add sources here if (root->getConfig().contains("sources")) { for (const auto &s : root->getConfig()["sources"]) { ftl::URI uri(s); + if (uri.getScheme() == ftl::URI::scheme_t::SCHEME_FILE) has_file = true; uri.setAttribute("group", group_name); feed->add(uri); } @@ -99,6 +102,7 @@ static void run(ftl::Configurable *root) { for (auto &x : *paths) { if (x != "") { ftl::URI uri(x); + if (uri.getScheme() == ftl::URI::scheme_t::SCHEME_FILE) has_file = true; uri.setAttribute("group", group_name); feed->add(uri); } @@ -123,12 +127,16 @@ static void run(ftl::Configurable *root) { feed->startStreaming(filter); // Just do whatever jobs are available - while (ftl::running) { - auto f = ftl::pool.pop(); - if (f) { - f(-1); - } else { - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + if (has_file) { + ftl::timer::start(true); + } else { + while (ftl::running) { + auto f = ftl::pool.pop(); + if (f) { + f(-1); + } else { + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + } } } -- GitLab