<< " -f, --flags show flags passed to C++ compiler on build\n"
<< " -n, --no-progress do not print progress to stdout\n"
<< " -r, --no-remote do not use any remote servers\n"
+ << " -t, --threads specify number of local encoding threads (overriding configuration)\n"
<< " -j, --json <port> run a JSON server on the specified port\n"
<< " -k, --keep-going keep running even when the job is complete\n"
<< " -s, --servers just display a list of encoding servers that DCP-o-matic is configured to use; don't encode\n"
print_dump (shared_ptr<Film> film)
{
cout << film->dcp_name (true) << "\n"
- << film->container()->nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n"
+ << film->container()->container_nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n"
<< (film->j2k_bandwidth() / 1000000) << "Mbit/s" << "\n"
<< "Output " << film->video_frame_rate() << "fps " << (film->three_d() ? "3D" : "2D") << " " << (film->audio_frame_rate() / 1000) << "kHz\n"
<< (film->interop() ? "Inter-Op" : "SMPTE") << " " << (film->encrypted() ? "encrypted" : "unencrypted") << "\n";
int N = 0;
list<EncodeServerDescription> servers = EncodeServerFinder::instance()->servers ();
- if (Config::instance()->use_any_servers ()) {
- if (servers.empty ()) {
- cout << "No encoding servers found.\n";
- ++N;
- } else {
- cout << std::left << setw(24) << "Host" << " Threads\n";
- ++N;
- BOOST_FOREACH (EncodeServerDescription const & i, servers) {
- cout << std::left << setw(24) << i.host_name() << " " << i.threads() << "\n";
- ++N;
- }
- }
+ /* 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 {
- vector<string> configured_servers = Config::instance()->servers();
- if (configured_servers.empty()) {
- cout << "No configured servers, and DCP-o-matic is not set to search for any server.\n";
- ++N;
- } else {
- cout << std::left << setw(24) << "Host" << " Status Threads\n";
- ++N;
- BOOST_FOREACH (string const & i, Config::instance()->servers()) {
- cout << std::left << setw(24) << i << " ";
- optional<int> threads;
- BOOST_FOREACH (EncodeServerDescription const & j, servers) {
- if (i == j.host_name()) {
- threads = j.threads();
- }
- }
- if (static_cast<bool>(threads)) {
- cout << "UP " << threads.get() << "\n";
+ cout << std::left << setw(24) << "Host" << " Status Threads\n";
+ ++N;
+
+ /* Report the state of configured servers */
+ BOOST_FOREACH (string 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;
+ list<EncodeServerDescription>::iterator j = servers.begin ();
+ while (j != servers.end ()) {
+ if (i == j->host_name()) {
+ threads = j->threads();
+ list<EncodeServerDescription>::iterator tmp = j;
+ ++tmp;
+ servers.erase (j);
+ j = tmp;
} else {
- cout << "DOWN\n";
+ ++j;
}
- ++N;
}
+ 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 */
+ BOOST_FOREACH (EncodeServerDescription const & i, servers) {
+ cout << std::left << setw(24) << i.host_name() << " UP " << i.threads() << "\n";
+ ++N;
+ }
+ }
dcpomatic_sleep (1);
int
main (int argc, char* argv[])
{
- string film_dir;
+ boost::filesystem::path film_dir;
bool progress = true;
bool no_remote = false;
+ optional<int> threads;
optional<int> json_port;
bool keep_going = false;
bool dump = false;
{ "flags", no_argument, 0, 'f'},
{ "no-progress", no_argument, 0, 'n'},
{ "no-remote", no_argument, 0, 'r'},
+ { "threads", required_argument, 0, 't'},
{ "json", required_argument, 0, 'j'},
{ "keep-going", no_argument, 0, 'k' },
{ "servers", no_argument, 0, 's' },
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "vhfnrj:kAsd", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhfnrt:j:kAsd", long_options, &option_index);
if (c == -1) {
break;
case 'r':
no_remote = true;
break;
+ case 't':
+ threads = atoi (optarg);
+ break;
case 'j':
json_port = atoi (optarg);
break;
signal_manager = new SignalManager ();
if (no_remote) {
- EncodeServerFinder::instance()->disable ();
+ EncodeServerFinder::instance()->stop ();
}
if (json_port) {
new JSONServer (json_port.get ());
}
+ if (threads) {
+ Config::instance()->set_master_encoding_threads (threads.get ());
+ }
+
shared_ptr<Film> film;
try {
film.reset (new Film (film_dir));
film->read_metadata ();
} catch (std::exception& e) {
- cerr << argv[0] << ": error reading film `" << film_dir << "' (" << e.what() << ")\n";
+ cerr << argv[0] << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n";
exit (EXIT_FAILURE);
}
BOOST_FOREACH (shared_ptr<Job> i, jobs) {
if (progress) {
- cout << i->name() << "; " << i->sub_name() << ": ";
+ cout << i->name();
+ if (!i->sub_name().empty()) {
+ cout << "; " << i->sub_name();
+ }
+ cout << ": ";
if (i->progress ()) {
cout << i->status() << " \n";