X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhints.cc;h=185626983ac171538f24cfcbb4f87edcdc7f0e41;hb=60dc924934e08bf9cba0365fd97b998016a88aba;hp=77b10da15af85655c667f178e12d701a2f1fde2a;hpb=c8b10d5eac6006b62d2a7add9da0c6206b72899b;p=dcpomatic.git diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 77b10da15..185626983 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -54,6 +54,8 @@ Hints::Hints (weak_ptr film) : _film (film) , _thread (0) , _long_ccap (false) + , _overlap_ccap (false) + , _too_many_ccap_lines (false) { } @@ -84,6 +86,8 @@ Hints::start () { stop_thread (); _long_ccap = false; + _overlap_ccap = false; + _too_many_ccap_lines = false; _thread = new boost::thread (bind(&Hints::thread, this)); } @@ -262,7 +266,7 @@ Hints::thread () shared_ptr player (new Player (film, film->playlist ())); player->set_ignore_video (); player->set_ignore_audio (); - player->Text.connect (bind(&Hints::text, this, _1, _2, _3)); + player->Text.connect (bind(&Hints::text, this, _1, _2, _4)); while (!player->pass ()) { bind (boost::ref(Pulse)); } @@ -283,10 +287,26 @@ Hints::text (PlayerText text, TextType type, DCPTimePeriod period) return; } - BOOST_FOREACH (StringText i, text.text) { - if (!_long_ccap && i.text().length() > 30) { - _long_ccap = true; - hint (_("Some of your closed captions have lines longer than 30 characters, so they will probably be word-wrapped.")); + int lines = text.string.size(); + BOOST_FOREACH (StringText i, text.string) { + if (i.text().length() > 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; + } + + if (!_overlap_ccap && _last && _last->overlap(period)) { + _overlap_ccap = true; + hint (_("You have overlapping closed captions, which are not allowed.")); + } + + _last = period; }