summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-09-11 01:07:46 +0200
committerCarl Hetherington <cth@carlh.net>2020-09-20 01:30:41 +0200
commit5a3e836da9480bca0c3ef3384fa2010f358ccc7e (patch)
tree2a15662a32dc00c86740641db6eedaf99daacb42 /src/lib
parent44dde2ee811eb35535633d760e6c0671cdf45cae (diff)
Add dcpomatic_combine tool (#1245).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/combine_dcp_job.cc74
-rw-r--r--src/lib/combine_dcp_job.h39
-rw-r--r--src/lib/wscript1
3 files changed, 114 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);
+}
diff --git a/src/lib/combine_dcp_job.h b/src/lib/combine_dcp_job.h
new file mode 100644
index 000000000..97bf20110
--- /dev/null
+++ b/src/lib/combine_dcp_job.h
@@ -0,0 +1,39 @@
+/*
+ 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 "job.h"
+#include <boost/filesystem.hpp>
+
+
+class CombineDCPJob : public Job
+{
+public:
+ CombineDCPJob (std::vector<boost::filesystem::path> inputs, boost::filesystem::path output);
+
+ std::string name () const;
+ std::string json_name () const;
+ void run ();
+
+private:
+ std::vector<boost::filesystem::path> _inputs;
+ boost::filesystem::path _output;
+};
+
diff --git a/src/lib/wscript b/src/lib/wscript
index 0c9cddfa4..04044a8c3 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -55,6 +55,7 @@ sources = """
config.cc
content.cc
content_factory.cc
+ combine_dcp_job.cc
copy_dcp_details_to_film.cc
create_cli.cc
cross_common.cc