boost::mutex::scoped_lock lm (_mutex);
_finished = true;
_arrived.notify_all ();
+} catch (std::exception& e) {
+ store_current ();
+ boost::mutex::scoped_lock lm (_mutex);
+ _died = true;
+ _died_message = e.what ();
+ _arrived.notify_all ();
} catch (...) {
store_current ();
boost::mutex::scoped_lock lm (_mutex);
if (_suspended || (_video.empty() && !blocking)) {
if (e) {
- *e = AGAIN;
+ e->code = Error::AGAIN;
}
return make_pair(shared_ptr<PlayerVideo>(), DCPTime());
}
if (_video.empty()) {
if (e) {
if (_died) {
- *e = DIED;
+ e->code = Error::DIED;
+ e->message = _died_message;
} else if (_finished) {
- *e = FINISHED;
+ e->code = Error::FINISHED;
} else {
- *e = NONE;
+ e->code = Error::NONE;
}
}
return make_pair(shared_ptr<PlayerVideo>(), DCPTime());
LOG_TIMING("finish-prepare in %1", thread_id());
}
}
+catch (std::exception& e)
+{
+ store_current ();
+ boost::mutex::scoped_lock lm (_mutex);
+ _died = true;
+ _died_message = e.what ();
+}
catch (...)
{
store_current ();
_closed_caption.put (pt, *track, period);
}
+
+string
+Butler::Error::summary () const
+{
+ switch (code)
+ {
+ case Error::NONE:
+ return "No error registered";
+ case Error::AGAIN:
+ return "Butler not ready";
+ case Error::DIED:
+ return String::compose("Butler died (%1)", message);
+ case Error::FINISHED:
+ return "Butler finished";
+ }
+
+ return "";
+}
+