From 6ca34bc1ef59dd206379f35eb940e607a59c9804 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 9 Sep 2019 00:27:23 +0100 Subject: Handle errors a little better when scanning for closed captions (in hints). --- src/lib/hints.cc | 26 +++++++++++++++----------- src/lib/hints.h | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/lib') diff --git a/src/lib/hints.cc b/src/lib/hints.cc index cf14f0699..a9b9d6f54 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -273,20 +273,24 @@ Hints::thread () 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; + try { + 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(Pulse))); - last_pulse = now; } + } catch (...) { + store_current (); } emit (bind(boost::ref(Finished))); diff --git a/src/lib/hints.h b/src/lib/hints.h index 00c2486e7..e9a75fb14 100644 --- a/src/lib/hints.h +++ b/src/lib/hints.h @@ -30,7 +30,7 @@ class Film; -class Hints : public Signaller +class Hints : public Signaller, public ExceptionStore { public: explicit Hints (boost::weak_ptr film); -- cgit v1.2.3