X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_server_cli.cc;h=336d578eef2c881a49c50ccff7cddbf0be1e2304;hb=88bb39c23e73041cdd7178414473a2223be277fa;hp=f43dd10bc4e09a2c8689de4c11aa24f6e78c88ec;hpb=b7a78dd103fd2f556600bc4510d66a6878cdf59e;p=dcpomatic.git diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index f43dd10bc..336d578ee 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,30 +17,29 @@ */ -#include "lib/server.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "lib/config.h" -#include "lib/dcp_video_frame.h" +#include "lib/dcp_video.h" #include "lib/exceptions.h" #include "lib/util.h" #include "lib/config.h" -#include "lib/scaler.h" #include "lib/image.h" -#include "lib/log.h" +#include "lib/file_log.h" +#include "lib/null_log.h" #include "lib/version.h" +#include "lib/encode_server.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using std::cerr; using std::string; @@ -52,7 +51,7 @@ help (string n) { cerr << "Syntax: " << n << " [OPTION]\n" << " -v, --version show DCP-o-matic version\n" - << " -h, --help show this help\n" + << " -h, --help show this help\n" << " -t, --threads number of parallel encoding threads to use\n" << " --verbose be verbose to stdout\n" << " --log write a log file of activity\n"; @@ -61,12 +60,15 @@ help (string n) int main (int argc, char* argv[]) { + dcpomatic_setup_path_encoding (); + dcpomatic_setup (); + int num_threads = Config::instance()->num_local_encoding_threads (); bool verbose = false; bool write_log = false; int option_index = 0; - while (1) { + while (true) { static struct option long_options[] = { { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, @@ -101,19 +103,18 @@ main (int argc, char* argv[]) } } - Scaler::setup_scalers (); shared_ptr log; if (write_log) { log.reset (new FileLog ("dcpomatic_server_cli.log")); } else { log.reset (new NullLog); } - - Server server (log, verbose); - + + EncodeServer server (log, verbose, num_threads); + try { - server.run (num_threads); - } catch (boost::system::system_error e) { + server.run (); + } catch (boost::system::system_error& e) { if (e.code() == boost::system::errc::address_in_use) { cerr << argv[0] << ": address already in use. Is another DCP-o-matic server instance already running?\n"; exit (EXIT_FAILURE);