diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-12-08 16:00:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-12-09 16:40:56 +0100 |
| commit | d7cb4dacab2337cced184f212bfe5bdcb5049d58 (patch) | |
| tree | 82d12d0b81839a7478bb67ce3a5c82a5c4f27cac /src/lib | |
| parent | 81dc813cda9ace9951e0aabb835bdfff098da2de (diff) | |
Extract scan_content().
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/hints.cc | 89 | ||||
| -rw-r--r-- | src/lib/hints.h | 2 |
2 files changed, 51 insertions, 40 deletions
diff --git a/src/lib/hints.cc b/src/lib/hints.cc index b4d94dbcc..55342a8d0 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -370,37 +370,9 @@ Hints::check_out_of_range_markers () void -Hints::thread () -try +Hints::scan_content(shared_ptr<const Film> film) { - start_of_thread ("Hints"); - - auto film = _film.lock (); - if (!film) { - return; - } - - auto content = film->content (); - - check_certificates (); - check_interop (); - check_big_font_files (); - check_few_audio_channels (); - check_upmixers (); - check_incorrect_container (); - check_unusual_container (); - check_high_j2k_bandwidth (); - check_frame_rate (); - check_4k_3d (); - check_speed_up (); - check_vob (); - check_3d_in_2d (); - auto const check_loudness_done = check_loudness (); - check_ffec_and_ffmc_in_smpte_feature (); - check_out_of_range_markers (); - check_subtitle_languages(); - check_audio_language (); - check_8_or_16_audio_channels(); + auto const check_loudness_done = check_loudness(); if (check_loudness_done) { emit (bind(boost::ref(Progress), _("Examining subtitles and closed captions"))); @@ -409,38 +381,75 @@ try } auto player = make_shared<Player>(film, Image::Alignment::COMPACT); - player->set_ignore_video (); + player->set_ignore_video(); if (check_loudness_done || _disable_audio_analysis) { /* We don't need to analyse audio because we already loaded a suitable analysis */ - player->set_ignore_audio (); + player->set_ignore_audio(); + } else { + /* Send auto to the analyser to check loudness */ + player->Audio.connect(bind(&Hints::audio, this, _1, _2)); } - player->Audio.connect (bind(&Hints::audio, this, _1, _2)); - player->Text.connect (bind(&Hints::text, this, _1, _2, _3, _4)); + player->Text.connect(bind(&Hints::text, this, _1, _2, _3, _4)); struct timeval last_pulse; - gettimeofday (&last_pulse, 0); + gettimeofday(&last_pulse, 0); - _writer->write (player->get_subtitle_fonts()); + _writer->write(player->get_subtitle_fonts()); while (!player->pass()) { struct timeval now; - gettimeofday (&now, 0); + gettimeofday(&now, 0); if ((seconds(now) - seconds(last_pulse)) > 1) { if (_stop) { return; } - emit (bind (boost::ref(Pulse))); + emit(bind(boost::ref(Pulse))); last_pulse = now; } } if (!check_loudness_done) { - _analyser.finish (); + _analyser.finish(); _analyser.get().write(film->audio_analysis_path(film->playlist())); - check_loudness (); + check_loudness(); + } +} + + +void +Hints::thread () +try +{ + start_of_thread ("Hints"); + + auto film = _film.lock (); + if (!film) { + return; } + auto content = film->content (); + + check_certificates (); + check_interop (); + check_big_font_files (); + check_few_audio_channels (); + check_upmixers (); + check_incorrect_container (); + check_unusual_container (); + check_high_j2k_bandwidth (); + check_frame_rate (); + check_4k_3d (); + check_speed_up (); + check_vob (); + check_3d_in_2d (); + check_ffec_and_ffmc_in_smpte_feature (); + check_out_of_range_markers (); + check_subtitle_languages(); + check_audio_language (); + check_8_or_16_audio_channels(); + + scan_content(film); if (_long_subtitle && !_very_long_subtitle) { hint (_("At least one of your subtitle lines has more than 52 characters. It is recommended to make each line 52 characters at most in length.")); diff --git a/src/lib/hints.h b/src/lib/hints.h index 55703a10b..0d65edc21 100644 --- a/src/lib/hints.h +++ b/src/lib/hints.h @@ -58,12 +58,14 @@ private: friend struct hint_subtitle_too_early; void thread (); + void scan_content(std::shared_ptr<const Film> film); void hint (std::string h); void audio (std::shared_ptr<AudioBuffers> audio, dcpomatic::DCPTime time); void text (PlayerText text, TextType type, boost::optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period); void closed_caption (PlayerText text, dcpomatic::DCPTimePeriod period); void open_subtitle (PlayerText text, dcpomatic::DCPTimePeriod period); + void check_certificates (); void check_interop (); void check_big_font_files (); |
