diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-20 00:31:32 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-20 20:36:46 +0100 |
| commit | 385635f00d39822389adbc99a2d5bdd992f16432 (patch) | |
| tree | 284ad0ac65988eb102f0f6334701496213cfd7a7 /src/lib | |
| parent | 0b66748421b751b1863ce86f98ab449c8e8e87fc (diff) | |
Pass tolerant flag into Content::examine() and the ExamineContentJob.
Along the way this helps to fix #2942.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/atmos_mxf_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/atmos_mxf_content.h | 2 | ||||
| -rw-r--r-- | src/lib/check_content_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/content.cc | 2 | ||||
| -rw-r--r-- | src/lib/content.h | 4 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 6 | ||||
| -rw-r--r-- | src/lib/dcp_content.h | 2 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.h | 2 | ||||
| -rw-r--r-- | src/lib/examine_content_job.cc | 9 | ||||
| -rw-r--r-- | src/lib/examine_content_job.h | 4 | ||||
| -rw-r--r-- | src/lib/fcpxml_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/fcpxml_content.h | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 2 | ||||
| -rw-r--r-- | src/lib/film.cc | 2 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/image_content.h | 2 | ||||
| -rw-r--r-- | src/lib/string_text_file_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/string_text_file_content.h | 2 | ||||
| -rw-r--r-- | src/lib/transcode_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/video_mxf_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/video_mxf_content.h | 2 |
23 files changed, 40 insertions, 35 deletions
diff --git a/src/lib/atmos_mxf_content.cc b/src/lib/atmos_mxf_content.cc index 6b2a64d68..df044a5d4 100644 --- a/src/lib/atmos_mxf_content.cc +++ b/src/lib/atmos_mxf_content.cc @@ -75,10 +75,10 @@ AtmosMXFContent::valid_mxf (boost::filesystem::path path) void -AtmosMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +AtmosMXFContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { job->set_progress_unknown (); - Content::examine (film, job); + Content::examine(film, job, tolerant); auto a = make_shared<dcp::AtmosAsset>(path(0)); { diff --git a/src/lib/atmos_mxf_content.h b/src/lib/atmos_mxf_content.h index b0bdeb92f..135371739 100644 --- a/src/lib/atmos_mxf_content.h +++ b/src/lib/atmos_mxf_content.h @@ -37,7 +37,7 @@ public: return std::dynamic_pointer_cast<const AtmosMXFContent> (Content::shared_from_this()); } - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job> job, bool tolerant) override; std::string summary () const override; void as_xml( diff --git a/src/lib/check_content_job.cc b/src/lib/check_content_job.cc index 2028b01ac..bb43158ae 100644 --- a/src/lib/check_content_job.cc +++ b/src/lib/check_content_job.cc @@ -82,7 +82,7 @@ CheckContentJob::run () if (!changed.empty()) { for (auto i: changed) { - JobManager::instance()->add(make_shared<ExamineContentJob>(_film, i)); + JobManager::instance()->add(make_shared<ExamineContentJob>(_film, i, false)); } set_message (_("Some files have been changed since they were added to the project.\n\nThese files will now be re-examined, so you may need to check their settings.")); } diff --git a/src/lib/content.cc b/src/lib/content.cc index 5c44cb47a..5e6dd7e31 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -181,7 +181,7 @@ Content::calculate_digest () const void -Content::examine (shared_ptr<const Film>, shared_ptr<Job> job) +Content::examine(shared_ptr<const Film>, shared_ptr<Job> job, bool) { if (job) { job->sub (_("Computing digest")); diff --git a/src/lib/content.h b/src/lib/content.h index 29dce2c9e..1b4f2b40c 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -86,8 +86,10 @@ public: /** Examine the content to establish digest, frame rates and any other * useful metadata. * @param job Job to use to report progress, or 0. + * @param tolerant true to try to carry on in the presence of problems with the content, + * false to throw exceptions in these cases. */ - virtual void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job); + virtual void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job> job, bool tolerant); virtual void take_settings_from (std::shared_ptr<const Content> c); diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 5b4f163e1..ae2a08c29 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -229,7 +229,7 @@ DCPContent::read_sub_directory (boost::filesystem::path p) /** @param film Film, or 0 */ void -DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +DCPContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { bool const needed_assets = needs_assets (); bool const needed_kdm = needs_kdm (); @@ -248,9 +248,9 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) if (job) { job->set_progress_unknown (); } - Content::examine (film, job); + Content::examine(film, job, tolerant); - auto examiner = make_shared<DCPExaminer>(shared_from_this(), film ? film->tolerant() : true); + auto examiner = make_shared<DCPExaminer>(shared_from_this(), tolerant); if (examiner->has_video()) { { diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index e781633d4..8545adf06 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -73,7 +73,7 @@ public: dcpomatic::DCPTime full_length (std::shared_ptr<const Film> film) const override; dcpomatic::DCPTime approximate_length () const override; - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; std::string summary () const override; std::string technical_summary () const override; diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 21c1b4de9..21159fcac 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -57,9 +57,9 @@ DCPSubtitleContent::DCPSubtitleContent(cxml::ConstNodePtr node, boost::optional< } void -DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +DCPSubtitleContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { - Content::examine (film, job); + Content::examine(film, job, tolerant); auto subtitle_asset = load(path(0)); diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h index 14d36fb69..dde3139a8 100644 --- a/src/lib/dcp_subtitle_content.h +++ b/src/lib/dcp_subtitle_content.h @@ -27,7 +27,7 @@ public: DCPSubtitleContent (boost::filesystem::path); DCPSubtitleContent (cxml::ConstNodePtr, boost::optional<boost::filesystem::path> film_directory, int); - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>) override; + void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; std::string summary () const override; std::string technical_summary () const override; diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index baa11ac93..799cda2ab 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -34,9 +34,10 @@ using std::cout; using std::shared_ptr; -ExamineContentJob::ExamineContentJob (shared_ptr<const Film> film, shared_ptr<Content> c) - : Job (film) - , _content (c) +ExamineContentJob::ExamineContentJob(shared_ptr<const Film> film, shared_ptr<Content> content, bool tolerant) + : Job(film) + , _content(content) + , _tolerant(tolerant) { } @@ -65,7 +66,7 @@ ExamineContentJob::json_name () const void ExamineContentJob::run () { - _content->examine (_film, shared_from_this()); + _content->examine(_film, shared_from_this(), _tolerant); set_progress (1); set_state (FINISHED_OK); } diff --git a/src/lib/examine_content_job.h b/src/lib/examine_content_job.h index 601b28584..cdcba3430 100644 --- a/src/lib/examine_content_job.h +++ b/src/lib/examine_content_job.h @@ -28,7 +28,7 @@ class Content; class ExamineContentJob : public Job { public: - ExamineContentJob (std::shared_ptr<const Film>, std::shared_ptr<Content>); + ExamineContentJob(std::shared_ptr<const Film> film, std::shared_ptr<Content> content, bool tolerant); ~ExamineContentJob (); std::string name () const override; @@ -41,4 +41,6 @@ public: private: std::shared_ptr<Content> _content; + + bool _tolerant; }; diff --git a/src/lib/fcpxml_content.cc b/src/lib/fcpxml_content.cc index cac3305ef..e72ce2d7d 100644 --- a/src/lib/fcpxml_content.cc +++ b/src/lib/fcpxml_content.cc @@ -50,9 +50,9 @@ FCPXMLContent::FCPXMLContent(cxml::ConstNodePtr node, optional<boost::filesystem void -FCPXMLContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job) +FCPXMLContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { - Content::examine(film, job); + Content::examine(film, job, tolerant); auto sequence = dcpomatic::fcpxml::load(path(0)); diff --git a/src/lib/fcpxml_content.h b/src/lib/fcpxml_content.h index 701fd6d02..229ac757d 100644 --- a/src/lib/fcpxml_content.h +++ b/src/lib/fcpxml_content.h @@ -41,7 +41,7 @@ public: return std::dynamic_pointer_cast<const FCPXMLContent>(Content::shared_from_this()); } - void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; std::string summary() const override; std::string technical_summary() const override; void as_xml(xmlpp::Element*, bool with_paths, PathBehaviour path_behaviour, boost::optional<boost::filesystem::path> film_directory) const override; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 49e4933a6..8434197c5 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -257,7 +257,7 @@ FFmpegContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour pa void -FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +FFmpegContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { ContentChangeSignaller cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS); ContentChangeSignaller cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM); @@ -266,7 +266,7 @@ FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) job->set_progress_unknown (); } - Content::examine (film, job); + Content::examine(film, job, tolerant); auto examiner = make_shared<FFmpegExaminer>(shared_from_this (), job); diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index a0fe9a0c0..ca2f56619 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -66,7 +66,7 @@ public: return std::dynamic_pointer_cast<const FFmpegContent> (Content::shared_from_this ()); } - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; void take_settings_from (std::shared_ptr<const Content> c) override; std::string summary () const override; std::string technical_summary () const override; diff --git a/src/lib/film.cc b/src/lib/film.cc index e2df95e32..dd702a3fd 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1422,7 +1422,7 @@ Film::examine_and_add_content (shared_ptr<Content> content, bool disable_audio_a run_ffprobe (content->path(0), file("ffprobe.log")); } - auto j = make_shared<ExamineContentJob>(shared_from_this(), content); + auto j = make_shared<ExamineContentJob>(shared_from_this(), content, false); _job_connections.push_back ( j->Finished.connect (bind (&Film::maybe_add_content, this, weak_ptr<Job>(j), weak_ptr<Content>(content), disable_audio_analysis)) diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index e7ba88194..218c0e80c 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -112,7 +112,7 @@ ImageContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour pat void -ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +ImageContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { if (_path_to_scan) { job->sub (_("Scanning image files")); @@ -136,7 +136,7 @@ ImageContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) set_paths (paths); } - Content::examine (film, job); + Content::examine(film, job, tolerant); auto examiner = make_shared<ImageExaminer>(film, shared_from_this(), job); video->take_from_examiner(film, examiner); diff --git a/src/lib/image_content.h b/src/lib/image_content.h index 73ae696ad..4b3b13380 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -37,7 +37,7 @@ public: return std::dynamic_pointer_cast<const ImageContent> (Content::shared_from_this ()); }; - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; std::string summary () const override; std::string technical_summary () const override; diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc index 6b5492af9..5ecf50a12 100644 --- a/src/lib/string_text_file_content.cc +++ b/src/lib/string_text_file_content.cc @@ -78,9 +78,9 @@ font_names(StringTextFile const& string_text_file) void -StringTextFileContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +StringTextFileContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { - Content::examine (film, job); + Content::examine(film, job, tolerant); StringTextFile file (shared_from_this()); only_text()->clear_fonts(); diff --git a/src/lib/string_text_file_content.h b/src/lib/string_text_file_content.h index abfd72906..f634a14d2 100644 --- a/src/lib/string_text_file_content.h +++ b/src/lib/string_text_file_content.h @@ -42,7 +42,7 @@ public: return std::dynamic_pointer_cast<const StringTextFileContent> (Content::shared_from_this ()); } - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job>) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job>, bool tolerant) override; std::string summary () const override; std::string technical_summary () const override; diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index f1373fb4a..c6da13381 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -102,7 +102,7 @@ TranscodeJob::run () switch (_changed) { case ChangedBehaviour::EXAMINE_THEN_STOP: for (auto i: changed) { - JobManager::instance()->add(make_shared<ExamineContentJob>(_film, i)); + JobManager::instance()->add(make_shared<ExamineContentJob>(_film, i, false)); } set_progress (1); set_message (_("Some files have been changed since they were added to the project.\n\nThese files will now be re-examined, so you may need to check their settings before trying again.")); diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc index ded81e6bf..779344ac1 100644 --- a/src/lib/video_mxf_content.cc +++ b/src/lib/video_mxf_content.cc @@ -87,11 +87,11 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path) void -VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) +VideoMXFContent::examine(shared_ptr<const Film> film, shared_ptr<Job> job, bool tolerant) { job->set_progress_unknown (); - Content::examine (film, job); + Content::examine(film, job, tolerant); video.reset (new VideoContent (this)); auto examiner = make_shared<VideoMXFExaminer>(shared_from_this()); diff --git a/src/lib/video_mxf_content.h b/src/lib/video_mxf_content.h index 0def6008c..4c2d051b0 100644 --- a/src/lib/video_mxf_content.h +++ b/src/lib/video_mxf_content.h @@ -36,7 +36,7 @@ public: return std::dynamic_pointer_cast<const VideoMXFContent>(Content::shared_from_this()); } - void examine (std::shared_ptr<const Film> film, std::shared_ptr<Job> job) override; + void examine(std::shared_ptr<const Film> film, std::shared_ptr<Job> job, bool tolerant) override; std::string summary () const override; std::string technical_summary () const override; std::string identifier () const override; |
