X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_server_cli.cc;h=d1bee2dcc8cd3d64bb9b431528a627e4e8a4a7b8;hp=efcfdc40e340a251fdd22f9aa1cf6d2a236f797e;hb=8f12e84009d7c2685bb2eeb32665876463d4e6e5;hpb=e60bb3e51bd1508b149e6b8f6608f09b5196ae26 diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index efcfdc40e..d1bee2dcc 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -1,44 +1,47 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + DCP-o-matic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with DCP-o-matic. If not, see . */ -#include "lib/server.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "lib/config.h" #include "lib/dcp_video.h" #include "lib/exceptions.h" #include "lib/util.h" #include "lib/config.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 "lib/dcpomatic_log.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using std::cerr; using std::string; @@ -59,7 +62,10 @@ help (string n) int main (int argc, char* argv[]) { - int num_threads = Config::instance()->num_local_encoding_threads (); + dcpomatic_setup_path_encoding (); + dcpomatic_setup (); + + int num_threads = Config::instance()->server_encoding_threads (); bool verbose = false; bool write_log = false; @@ -99,23 +105,22 @@ main (int argc, char* argv[]) } } - shared_ptr log; if (write_log) { - log.reset (new FileLog ("dcpomatic_server_cli.log")); - } else { - log.reset (new NullLog); + dcpomatic_log.reset (new FileLog("dcpomatic_server_cli.log")); } - Server server (log, verbose); + EncodeServer server (verbose, num_threads); try { - server.run (num_threads); + 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); } cerr << argv[0] << ": " << e.what() << "\n"; + } catch (std::exception& e) { + cerr << argv[0] << ": failed to start server; " << e.what() << "\n"; } return 0; }