diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-09-11 01:07:46 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-09-20 01:30:41 +0200 |
| commit | 5a3e836da9480bca0c3ef3384fa2010f358ccc7e (patch) | |
| tree | 2a15662a32dc00c86740641db6eedaf99daacb42 /src/lib/combine_dcp_job.cc | |
| parent | 44dde2ee811eb35535633d760e6c0671cdf45cae (diff) | |
Add dcpomatic_combine tool (#1245).
Diffstat (limited to 'src/lib/combine_dcp_job.cc')
| -rw-r--r-- | src/lib/combine_dcp_job.cc | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/lib/combine_dcp_job.cc b/src/lib/combine_dcp_job.cc new file mode 100644 index 000000000..b3c29b205 --- /dev/null +++ b/src/lib/combine_dcp_job.cc @@ -0,0 +1,74 @@ +/* + Copyright (C) 2020 Carl Hetherington <cth@carlh.net> + + 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. + + 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "combine_dcp_job.h" +#include <dcp/combine.h> +#include <dcp/exceptions.h> + +#include "i18n.h" + + +using std::string; +using std::vector; +using boost::shared_ptr; + + +CombineDCPJob::CombineDCPJob (vector<boost::filesystem::path> inputs, boost::filesystem::path output) + : Job (shared_ptr<Film>()) + , _inputs (inputs) + , _output (output) +{ + +} + + +string +CombineDCPJob::name () const +{ + return _("Combine DCPs"); +} + + +string +CombineDCPJob::json_name () const +{ + return N_("combine_dcps"); +} + + +void +CombineDCPJob::run () +{ + try { + dcp::combine (_inputs, _output); + } catch (dcp::CombineError& e) { + set_state (FINISHED_ERROR); + set_error (e.what(), ""); + return; + } catch (dcp::ReadError& e) { + set_state (FINISHED_ERROR); + set_error (e.what(), e.detail().get_value_or("")); + return; + } + + set_progress (1); + set_state (FINISHED_OK); +} |
