summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-12-29 00:54:19 +0100
committerCarl Hetherington <cth@carlh.net>2022-04-20 19:36:09 +0200
commit8d998d5e325e06fdb0075483048cd56dca03273f (patch)
treed9ccc969bc3f8f2fd8d7084f0a819c17cb614ef6 /src/lib
parentdf5228d00d70d68218e7f606131a0c5fa2caba9f (diff)
Clean up a hack by adding DCPTranscodeJob.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_transcode_job.cc46
-rw-r--r--src/lib/dcp_transcode_job.h32
-rw-r--r--src/lib/make_dcp.cc4
-rw-r--r--src/lib/transcode_job.cc5
-rw-r--r--src/lib/transcode_job.h2
-rw-r--r--src/lib/wscript1
6 files changed, 84 insertions, 6 deletions
diff --git a/src/lib/dcp_transcode_job.cc b/src/lib/dcp_transcode_job.cc
new file mode 100644
index 000000000..e9ff4f4e0
--- /dev/null
+++ b/src/lib/dcp_transcode_job.cc
@@ -0,0 +1,46 @@
+/*
+ Copyright (C) 2021 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 "config.h"
+#include "dcp_transcode_job.h"
+#include "film.h"
+#include "job_manager.h"
+#include "upload_job.h"
+
+
+using std::make_shared;
+using std::shared_ptr;
+
+
+DCPTranscodeJob::DCPTranscodeJob (shared_ptr<const Film> film, ChangedBehaviour changed)
+ : TranscodeJob (film, changed)
+{
+
+}
+
+
+void
+DCPTranscodeJob::post_transcode ()
+{
+ if (Config::instance()->upload_after_make_dcp()) {
+ JobManager::instance()->add(make_shared<UploadJob>(_film));
+ }
+}
diff --git a/src/lib/dcp_transcode_job.h b/src/lib/dcp_transcode_job.h
new file mode 100644
index 000000000..4699884ed
--- /dev/null
+++ b/src/lib/dcp_transcode_job.h
@@ -0,0 +1,32 @@
+/*
+ Copyright (C) 2021 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 "transcode_job.h"
+
+
+class DCPTranscodeJob : public TranscodeJob
+{
+public:
+ DCPTranscodeJob (std::shared_ptr<const Film> film, ChangedBehaviour changed);
+
+private:
+ void post_transcode () override;
+};
diff --git a/src/lib/make_dcp.cc b/src/lib/make_dcp.cc
index 934387fcd..17d45be46 100644
--- a/src/lib/make_dcp.cc
+++ b/src/lib/make_dcp.cc
@@ -22,12 +22,12 @@
#include "config.h"
#include "dcp_content.h"
#include "dcp_encoder.h"
+#include "dcp_transcode_job.h"
#include "dcpomatic_log.h"
#include "environment_info.h"
#include "film.h"
#include "job_manager.h"
#include "make_dcp.h"
-#include "transcode_job.h"
#include <stdexcept>
#include "i18n.h"
@@ -98,7 +98,7 @@ make_dcp (shared_ptr<Film> film, TranscodeJob::ChangedBehaviour behaviour)
}
LOG_GENERAL ("J2K bandwidth %1", film->j2k_bandwidth());
- auto tj = make_shared<TranscodeJob>(film, behaviour);
+ auto tj = make_shared<DCPTranscodeJob>(film, behaviour);
tj->set_encoder (make_shared<DCPEncoder>(film, tj));
JobManager::instance()->add (tj);
}
diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc
index 481a4d2f2..6b1563b9b 100644
--- a/src/lib/transcode_job.cc
+++ b/src/lib/transcode_job.cc
@@ -144,10 +144,7 @@ TranscodeJob::run ()
}
}
- /* XXX: this shouldn't be here */
- if (Config::instance()->upload_after_make_dcp() && dynamic_pointer_cast<DCPEncoder>(_encoder)) {
- JobManager::instance()->add(make_shared<UploadJob>(_film));
- }
+ post_transcode ();
_encoder.reset ();
diff --git a/src/lib/transcode_job.h b/src/lib/transcode_job.h
index 6b2e8f923..8b145e362 100644
--- a/src/lib/transcode_job.h
+++ b/src/lib/transcode_job.h
@@ -64,6 +64,8 @@ public:
void set_encoder (std::shared_ptr<Encoder> t);
private:
+ virtual void post_transcode () {}
+
int remaining_time () const override;
std::shared_ptr<Encoder> _encoder;
diff --git a/src/lib/wscript b/src/lib/wscript
index 44a4da2dd..6515ebf9f 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -72,6 +72,7 @@ sources = """
dcp_subtitle_content.cc
dcp_subtitle_decoder.cc
dcp_text_track.cc
+ dcp_transcode_job.cc
dcp_video.cc
dcpomatic_log.cc
dcpomatic_socket.cc