, _long_ccap (false)
, _overlap_ccap (false)
, _too_many_ccap_lines (false)
+ , _stop (false)
{
}
{
if (_thread) {
try {
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _stop = true;
+ }
_thread->interrupt ();
_thread->join ();
} catch (...) {
_long_ccap = false;
_overlap_ccap = false;
_too_many_ccap_lines = false;
+ _stop = false;
_thread = new boost::thread (bind(&Hints::thread, this));
}
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, _3));
- while (!player->pass ()) {
- bind (boost::ref(Pulse));
+ player->Text.connect (bind(&Hints::text, this, _1, _2, _4));
+
+ struct timeval last_pulse;
+ gettimeofday (&last_pulse, 0);
+
+ while (!player->pass()) {
+
+ struct timeval now;
+ gettimeofday (&now, 0);
+ if ((seconds(now) - seconds(last_pulse)) > 1) {
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_stop) {
+ break;
+ }
+ }
+ emit (bind (boost::ref(Pulse)));
+ last_pulse = now;
+ }
}
emit (bind(boost::ref(Finished)));
return;
}
- int lines = text.text.size();
- BOOST_FOREACH (StringText i, text.text) {
- if (i.text().length() > CLOSED_CAPTION_LENGTH) {
+ 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;