+static
+bool
+subtitle_mxf_too_big (shared_ptr<dcp::SubtitleAsset> asset)
+{
+ return asset && asset->file() && dcp::filesystem::file_size(*asset->file()) >= (MAX_TEXT_MXF_SIZE - SIZE_SLACK);
+}
+
+
+void
+Hints::check_out_of_range_markers ()
+{
+ auto const length = film()->length();
+ for (auto const& i: film()->markers()) {
+ if (i.second >= length) {
+ hint (_("At least one marker comes after the end of the project and will be ignored."));
+ }
+ }
+}
+
+
+void
+Hints::scan_content(shared_ptr<const Film> film)
+{
+ auto const check_loudness_done = check_loudness();
+
+ auto content = film->playlist()->content();
+ auto iter = std::find_if(content.begin(), content.end(), [](shared_ptr<const Content> content) {
+ auto text_iter = std::find_if(content->text.begin(), content->text.end(), [](shared_ptr<const TextContent> text) {
+ return text->use();
+ });
+ return text_iter != content->text.end();
+ });
+
+ auto const have_text = iter != content.end();
+
+ if (check_loudness_done && !have_text) {
+ /* We don't need to check loudness, and we don't have any active text to check,
+ * so a scan of the content is pointless.
+ */
+ return;
+ }
+
+ if (check_loudness_done && have_text) {
+ emit (bind(boost::ref(Progress), _("Examining subtitles and closed captions")));
+ } else if (!check_loudness_done && !have_text) {
+ emit (bind(boost::ref(Progress), _("Examining audio")));
+ } else {
+ emit (bind(boost::ref(Progress), _("Examining audio, subtitles and closed captions")));
+ }
+
+ auto player = make_shared<Player>(film, Image::Alignment::COMPACT);
+ 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();
+ } else {
+ /* Send auto to the analyser to check loudness */
+ player->Audio.connect(bind(&Hints::audio, this, _1, _2));
+ }
+ player->Text.connect(bind(&Hints::text, this, _1, _2, _3, _4));
+
+ struct timeval last_pulse;
+ gettimeofday(&last_pulse, 0);
+
+ _writer->write(player->get_subtitle_fonts());
+
+ while (!player->pass()) {
+
+ struct timeval now;
+ gettimeofday(&now, 0);
+ if ((seconds(now) - seconds(last_pulse)) > 1) {
+ if (_stop) {
+ return;