+ emit (bind(boost::ref(Progress), _("Examining closed captions")));
+
+ shared_ptr<Player> player (new Player (film, film->playlist ()));
+ player->set_ignore_video ();
+ player->set_ignore_audio ();
+ player->Text.connect (bind(&Hints::text, this, _1, _2, _4));
+
+ struct timeval last_pulse;
+ gettimeofday (&last_pulse, 0);
+
+ try {
+ while (!player->pass()) {
+
+ struct timeval now;
+ gettimeofday (&now, 0);
+ if ((seconds(now) - seconds(last_pulse)) > 1) {
+ if (_stop) {
+ break;
+ }
+ emit (bind (boost::ref(Pulse)));
+ last_pulse = now;
+ }
+ }
+ } catch (...) {
+ store_current ();
+ }
+
+ emit (bind(boost::ref(Finished)));
+}
+
+void
+Hints::hint (string h)
+{
+ emit(bind(boost::ref(Hint), h));
+}
+
+void
+Hints::text (PlayerText text, TextType type, DCPTimePeriod period)
+{
+ if (type != TEXT_CLOSED_CAPTION) {
+ return;
+ }
+
+ int lines = text.string.size();
+ BOOST_FOREACH (StringText i, text.string) {
+ if (utf8_strlen(i.text()) > CLOSED_CAPTION_LENGTH) {
+ ++lines;
+ if (!_long_ccap) {
+ _long_ccap = true;
+ hint (String::compose(_("Some of your closed captions have lines longer than %1 characters, so they will probably be word-wrapped."), CLOSED_CAPTION_LENGTH));
+ }
+ }
+ }
+
+ if (!_too_many_ccap_lines && lines > CLOSED_CAPTION_LINES) {
+ hint (String::compose(_("Some of your closed captions span more than %1 lines, so they will be truncated."), CLOSED_CAPTION_LINES));
+ _too_many_ccap_lines = true;
+ }
+
+ shared_ptr<const Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
+
+ /* XXX: maybe overlapping closed captions (i.e. different languages) are OK with Interop? */
+ if (film->interop() && !_overlap_ccap && _last && _last->overlap(period)) {
+ _overlap_ccap = true;
+ hint (_("You have overlapping closed captions, which are not allowed in Interop DCPs. Change your DCP standard to SMPTE."));
+ }
+
+ _last = period;