player/Control: add method LockSetOutputError()

This commit is contained in:
Max Kellermann
2016-12-14 13:01:17 +01:00
parent 7e1b53480e
commit baa2bc0c38
2 changed files with 18 additions and 10 deletions

View File

@@ -369,6 +369,22 @@ public:
*/
void SetError(PlayerError type, std::exception_ptr &&_error);
/**
* Set the error and set state to PlayerState::PAUSE.
*/
void SetOutputError(std::exception_ptr &&_error) {
SetError(PlayerError::OUTPUT, std::move(_error));
/* pause: the user may resume playback as soon as an
audio output becomes available */
state = PlayerState::PAUSE;
}
void LockSetOutputError(std::exception_ptr &&_error) {
const ScopeLock lock(mutex);
SetOutputError(std::move(_error));
}
/**
* Checks whether an error has occurred, and if so, rethrows
* it.