+ if (c->audio) {
+ cout << "\t" << c->audio->delay() << " delay\n"
+ << "\t" << c->audio->gain() << " gain\n";
+ }
+ }
+}
+
+
+static void
+list_servers ()
+{
+ while (true) {
+ int N = 0;
+ auto servers = EncodeServerFinder::instance()->servers();
+
+ /* This is a bit fiddly because we want to list configured servers that are down as well
+ as all those (configured and found by broadcast) that are up.
+ */
+
+ if (servers.empty() && Config::instance()->servers().empty()) {
+ cout << "No encoding servers found or configured.\n";
+ ++N;
+ } else {
+ cout << std::left << setw(24) << "Host" << " Status Threads\n";
+ ++N;
+
+ /* Report the state of configured servers */
+ for (auto i: Config::instance()->servers()) {
+ cout << std::left << setw(24) << i << " ";
+
+ /* See if this server is on the active list; if so, remove it and note
+ the number of threads it is offering.
+ */
+ optional<int> threads;
+ auto j = servers.begin ();
+ while (j != servers.end ()) {
+ if (i == j->host_name() && j->current_link_version()) {
+ threads = j->threads();
+ auto tmp = j;
+ ++tmp;
+ servers.erase (j);
+ j = tmp;
+ } else {
+ ++j;
+ }
+ }
+ if (static_cast<bool>(threads)) {
+ cout << "UP " << threads.get() << "\n";
+ } else {
+ cout << "DOWN\n";
+ }
+ ++N;
+ }
+
+ /* Now report any left that have been found by broadcast */
+ for (auto const& i: servers) {
+ if (i.current_link_version()) {
+ cout << std::left << setw(24) << i.host_name() << " UP " << i.threads() << "\n";
+ } else {
+ cout << std::left << setw(24) << i.host_name() << " bad version\n";
+ }
+ ++N;
+ }
+ }
+
+ dcpomatic_sleep_seconds (1);
+
+ for (int i = 0; i < N; ++i) {
+ cout << "\033[1A\033[2K";