diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-01-27 01:52:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-16 01:20:17 +0100 |
| commit | f015d6b314a6bfc8534e3e2c331d6edd5f817e25 (patch) | |
| tree | 04185cfa94b2a8c5c63be34d33432579f3a603ee /src/lib | |
| parent | 4fb6584369785db4c03d9d0c536b57b25509f2ff (diff) | |
Move _film out of Job into only those Jobs that need it.
This meant some tweaks to the JSON server to only report DCP names for
TranscodeJobs, and a bit of (hopefully) tidying of the disk space check
in the batch converter.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/analyse_audio_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/analyse_audio_job.h | 2 | ||||
| -rw-r--r-- | src/lib/analyse_subtitles_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/analyse_subtitles_job.h | 1 | ||||
| -rw-r--r-- | src/lib/check_content_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/check_content_job.h | 6 | ||||
| -rw-r--r-- | src/lib/combine_dcp_job.cc | 3 | ||||
| -rw-r--r-- | src/lib/copy_to_drive_job.cc | 3 | ||||
| -rw-r--r-- | src/lib/examine_content_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/examine_content_job.h | 1 | ||||
| -rw-r--r-- | src/lib/examine_ffmpeg_subtitles_job.cc | 7 | ||||
| -rw-r--r-- | src/lib/examine_ffmpeg_subtitles_job.h | 2 | ||||
| -rw-r--r-- | src/lib/job.cc | 7 | ||||
| -rw-r--r-- | src/lib/job.h | 11 | ||||
| -rw-r--r-- | src/lib/json_server.cc | 4 | ||||
| -rw-r--r-- | src/lib/send_kdm_email_job.cc | 6 | ||||
| -rw-r--r-- | src/lib/send_notification_email_job.cc | 3 | ||||
| -rw-r--r-- | src/lib/send_problem_report_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/send_problem_report_job.h | 1 | ||||
| -rw-r--r-- | src/lib/transcode_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/transcode_job.h | 7 | ||||
| -rw-r--r-- | src/lib/upload_job.cc | 3 | ||||
| -rw-r--r-- | src/lib/verify_dcp_job.cc | 6 |
23 files changed, 40 insertions, 45 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 1f42c56c6..35da5acdb 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -51,7 +51,7 @@ using namespace boost::placeholders; * use processors). */ AnalyseAudioJob::AnalyseAudioJob(shared_ptr<const Film> film, shared_ptr<const Playlist> playlist, bool whole_film) - : Job(film) + : _film(film) , _analyser(film, playlist, whole_film, boost::bind(&Job::set_progress, this, _1, false)) , _playlist(playlist) , _path(film->audio_analysis_path(playlist)) diff --git a/src/lib/analyse_audio_job.h b/src/lib/analyse_audio_job.h index 1f7224e0b..8f07de8de 100644 --- a/src/lib/analyse_audio_job.h +++ b/src/lib/analyse_audio_job.h @@ -65,8 +65,8 @@ public: } private: + std::shared_ptr<const Film> _film; AudioAnalyser _analyser; - std::shared_ptr<const Playlist> _playlist; /** playlist's audio analysis path when the job was created */ boost::filesystem::path _path; diff --git a/src/lib/analyse_subtitles_job.cc b/src/lib/analyse_subtitles_job.cc index 66db25f04..f24a7d474 100644 --- a/src/lib/analyse_subtitles_job.cc +++ b/src/lib/analyse_subtitles_job.cc @@ -43,7 +43,7 @@ using namespace boost::placeholders; AnalyseSubtitlesJob::AnalyseSubtitlesJob (shared_ptr<const Film> film, shared_ptr<Content> content) - : Job (film) + : _film(film) , _content (content) , _path (_film->subtitle_analysis_path(content)) { diff --git a/src/lib/analyse_subtitles_job.h b/src/lib/analyse_subtitles_job.h index ea425763f..5fa243ceb 100644 --- a/src/lib/analyse_subtitles_job.h +++ b/src/lib/analyse_subtitles_job.h @@ -45,6 +45,7 @@ public: private: void analyse(PlayerText const& text, TextType type); + std::shared_ptr<const Film> _film; std::weak_ptr<Content> _content; boost::filesystem::path _path; boost::optional<dcpomatic::Rect<double>> _bounding_box; diff --git a/src/lib/check_content_job.cc b/src/lib/check_content_job.cc index 98e8c7989..ab6e43d56 100644 --- a/src/lib/check_content_job.cc +++ b/src/lib/check_content_job.cc @@ -40,7 +40,7 @@ using std::string; CheckContentJob::CheckContentJob(shared_ptr<const Film> film) - : Job(film) + : _film(film) { } diff --git a/src/lib/check_content_job.h b/src/lib/check_content_job.h index 1717bdd8d..a8276daba 100644 --- a/src/lib/check_content_job.h +++ b/src/lib/check_content_job.h @@ -22,6 +22,9 @@ #include "job.h" +class Film; + + /** @class CheckContentJob * @brief A job to check content that was just loaded to see if anything needs fixing about it. */ @@ -36,4 +39,7 @@ public: std::string name() const override; std::string json_name() const override; void run() override; + +private: + std::shared_ptr<const Film> _film; }; diff --git a/src/lib/combine_dcp_job.cc b/src/lib/combine_dcp_job.cc index 547abe551..2e5b7087b 100644 --- a/src/lib/combine_dcp_job.cc +++ b/src/lib/combine_dcp_job.cc @@ -33,8 +33,7 @@ using std::shared_ptr; CombineDCPJob::CombineDCPJob (vector<boost::filesystem::path> inputs, boost::filesystem::path output, string annotation_text) - : Job (shared_ptr<Film>()) - , _inputs (inputs) + : _inputs (inputs) , _output (output) , _annotation_text (annotation_text) { diff --git a/src/lib/copy_to_drive_job.cc b/src/lib/copy_to_drive_job.cc index 253f438f6..df385037d 100644 --- a/src/lib/copy_to_drive_job.cc +++ b/src/lib/copy_to_drive_job.cc @@ -42,8 +42,7 @@ using boost::optional; CopyToDriveJob::CopyToDriveJob(std::vector<boost::filesystem::path> const& dcps, Drive drive, Nanomsg& nanomsg) - : Job(shared_ptr<Film>()) - , _dcps(dcps) + : _dcps(dcps) , _drive(drive) , _nanomsg(nanomsg) { diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index d12d736a7..dad5adb3c 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -36,7 +36,7 @@ using std::vector; ExamineContentJob::ExamineContentJob(shared_ptr<const Film> film, vector<shared_ptr<Content>> content, bool tolerant) - : Job(film) + : _film(film) , _content(std::move(content)) , _tolerant(tolerant) { diff --git a/src/lib/examine_content_job.h b/src/lib/examine_content_job.h index ca298c252..cb7012b75 100644 --- a/src/lib/examine_content_job.h +++ b/src/lib/examine_content_job.h @@ -40,6 +40,7 @@ public: } private: + std::shared_ptr<const Film> _film; std::vector<std::shared_ptr<Content>> _content; bool _tolerant; diff --git a/src/lib/examine_ffmpeg_subtitles_job.cc b/src/lib/examine_ffmpeg_subtitles_job.cc index 8c762d893..dfcd11a06 100644 --- a/src/lib/examine_ffmpeg_subtitles_job.cc +++ b/src/lib/examine_ffmpeg_subtitles_job.cc @@ -35,10 +35,9 @@ using std::string; using std::cout; using std::shared_ptr; -ExamineFFmpegSubtitlesJob::ExamineFFmpegSubtitlesJob (shared_ptr<const Film> film, shared_ptr<FFmpegContent> c) - : Job (film) - , FFmpeg (c) - , _content (c) +ExamineFFmpegSubtitlesJob::ExamineFFmpegSubtitlesJob(shared_ptr<FFmpegContent> c) + : FFmpeg(c) + , _content(c) { } diff --git a/src/lib/examine_ffmpeg_subtitles_job.h b/src/lib/examine_ffmpeg_subtitles_job.h index 1a065df57..af3d4302e 100644 --- a/src/lib/examine_ffmpeg_subtitles_job.h +++ b/src/lib/examine_ffmpeg_subtitles_job.h @@ -26,7 +26,7 @@ class FFmpegContent; class ExamineFFmpegSubtitlesJob : public Job, public FFmpeg { public: - ExamineFFmpegSubtitlesJob (std::shared_ptr<const Film>, std::shared_ptr<FFmpegContent>); + ExamineFFmpegSubtitlesJob(std::shared_ptr<FFmpegContent>); ~ExamineFFmpegSubtitlesJob (); std::string name () const override; diff --git a/src/lib/job.cc b/src/lib/job.cc index 6bf7a9da3..8c8e8c1d9 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -28,7 +28,6 @@ #include "cross.h" #include "dcpomatic_log.h" #include "exceptions.h" -#include "film.h" #include "job.h" #include "log.h" #include "util.h" @@ -53,10 +52,8 @@ using boost::optional; using namespace dcpomatic; -/** @param film Associated film, or 0 */ -Job::Job(shared_ptr<const Film> film) - : _film(film) - , _state(NEW) +Job::Job() + : _state(NEW) , _sub_start_time(0) , _progress(0) , _rate_limit_progress(true) diff --git a/src/lib/job.h b/src/lib/job.h index f435d815a..fca178659 100644 --- a/src/lib/job.h +++ b/src/lib/job.h @@ -39,16 +39,13 @@ LIBDCP_ENABLE_WARNINGS #include <string> -class Film; - - /** @class Job * @brief A parent class to represent long-running tasks which are run in their own thread. */ class Job : public std::enable_shared_from_this<Job>, public Signaller { public: - explicit Job(std::shared_ptr<const Film> film); + Job(); virtual ~Job(); Job(Job const&) = delete; @@ -97,10 +94,6 @@ public: boost::optional<float> progress() const; boost::optional<float> seconds_since_last_progress_update() const; - std::shared_ptr<const Film> film() const { - return _film; - } - enum class Result { RESULT_OK, RESULT_ERROR, // we can't have plain ERROR on Windows @@ -140,8 +133,6 @@ protected: void check_for_interruption_or_pause(); void stop_thread(); - std::shared_ptr<const Film> _film; - time_t _start_time = 0; time_t _finish_time = 0; diff --git a/src/lib/json_server.cc b/src/lib/json_server.cc index 921065bb2..a8572758e 100644 --- a/src/lib/json_server.cc +++ b/src/lib/json_server.cc @@ -212,8 +212,8 @@ JSONServer::request (string url, shared_ptr<tcp::socket> socket) for (auto i = jobs.cbegin(); i != jobs.cend(); ++i) { json += "{ "; - if ((*i)->film()) { - json += "\"dcp\": \"" + (*i)->film()->dcp_name() + "\", "; + if (auto transcode = dynamic_pointer_cast<const TranscodeJob>(*i)) { + json += "\"dcp\": \"" + transcode->film()->dcp_name() + "\", "; } json += "\"name\": \"" + (*i)->json_name() + "\", "; diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index edf959cbb..e9ba14bb6 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -41,8 +41,7 @@ SendKDMEmailJob::SendKDMEmailJob( string cpl_name, vector<string> extra_addresses ) - : Job({}) - , _container_name_format(container_name_format) + : _container_name_format(container_name_format) , _filename_format(filename_format) , _cpl_name(cpl_name) , _extra_addresses(extra_addresses) @@ -68,8 +67,7 @@ SendKDMEmailJob::SendKDMEmailJob( string cpl_name, vector<string> extra_addresses ) - : Job({}) - , _container_name_format(container_name_format) + : _container_name_format(container_name_format) , _filename_format(filename_format) , _cpl_name(cpl_name) , _kdms(kdms) diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc index 69a28e297..cc90704f6 100644 --- a/src/lib/send_notification_email_job.cc +++ b/src/lib/send_notification_email_job.cc @@ -33,8 +33,7 @@ using std::shared_ptr; /** @param body Email body */ SendNotificationEmailJob::SendNotificationEmailJob (string body) - : Job (shared_ptr<Film>()) - , _body (body) + : _body(body) { } diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc index 547faab93..4664141d0 100644 --- a/src/lib/send_problem_report_job.cc +++ b/src/lib/send_problem_report_job.cc @@ -47,7 +47,7 @@ SendProblemReportJob::SendProblemReportJob( string from, string summary ) - : Job(film) + : _film(film) , _from(from) , _summary(summary) { diff --git a/src/lib/send_problem_report_job.h b/src/lib/send_problem_report_job.h index ab4bfade4..7a0db052e 100644 --- a/src/lib/send_problem_report_job.h +++ b/src/lib/send_problem_report_job.h @@ -42,6 +42,7 @@ public: private: void add_file(std::string& body, boost::filesystem::path file) const; + std::shared_ptr<const Film> _film; std::string _from; std::string _summary; }; diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index 49cbaf4a3..0748b9679 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -55,7 +55,7 @@ using std::dynamic_pointer_cast; /** @param film Film to use */ TranscodeJob::TranscodeJob(shared_ptr<const Film> film, ChangedBehaviour changed) - : Job(film) + : _film(film) , _changed(changed) { diff --git a/src/lib/transcode_job.h b/src/lib/transcode_job.h index a9bb18712..7223c76a5 100644 --- a/src/lib/transcode_job.h +++ b/src/lib/transcode_job.h @@ -67,6 +67,13 @@ public: void set_encoder(std::shared_ptr<FilmEncoder> encoder); + std::shared_ptr<const Film> film() const { + return _film; + } + +protected: + std::shared_ptr<const Film> _film; + private: friend struct ::frames_not_lost_when_threads_disappear; diff --git a/src/lib/upload_job.cc b/src/lib/upload_job.cc index 4e3580a37..5ba1eafcf 100644 --- a/src/lib/upload_job.cc +++ b/src/lib/upload_job.cc @@ -45,8 +45,7 @@ using namespace boost::placeholders; UploadJob::UploadJob(boost::filesystem::path directory) - : Job({}) - , _directory(std::move(directory)) + : _directory(std::move(directory)) , _status(_("Waiting")) { diff --git a/src/lib/verify_dcp_job.cc b/src/lib/verify_dcp_job.cc index 60ef714d6..798308755 100644 --- a/src/lib/verify_dcp_job.cc +++ b/src/lib/verify_dcp_job.cc @@ -41,8 +41,7 @@ VerifyDCPJob::VerifyDCPJob( vector<boost::filesystem::path> kdms, dcp::VerificationOptions options ) - : Job({}) - , _directories(directories) + : _directories(directories) , _options(options) { vector<dcp::DecryptedKDM> decrypted_kdms; @@ -59,8 +58,7 @@ VerifyDCPJob::VerifyDCPJob( vector<dcp::DecryptedKDM> kdms, dcp::VerificationOptions options ) - : Job({}) - , _directories(directories) + : _directories(directories) , _kdms(kdms) , _options(options) { |
