player/Listener: add virtual method OnPlayerError()
Replaces two global idle_add() calls.
This commit is contained in:
parent
a542a0804a
commit
047561dc22
@ -183,6 +183,12 @@ Partition::OnQueueSongStarted() noexcept
|
|||||||
EmitIdle(IDLE_PLAYER);
|
EmitIdle(IDLE_PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Partition::OnPlayerError() noexcept
|
||||||
|
{
|
||||||
|
EmitIdle(IDLE_PLAYER);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Partition::OnPlayerSync() noexcept
|
Partition::OnPlayerSync() noexcept
|
||||||
{
|
{
|
||||||
|
@ -277,6 +277,7 @@ private:
|
|||||||
void OnQueueSongStarted() noexcept override;
|
void OnQueueSongStarted() noexcept override;
|
||||||
|
|
||||||
/* virtual methods from class PlayerListener */
|
/* virtual methods from class PlayerListener */
|
||||||
|
void OnPlayerError() noexcept override;
|
||||||
void OnPlayerSync() noexcept override;
|
void OnPlayerSync() noexcept override;
|
||||||
void OnPlayerTagModified() noexcept override;
|
void OnPlayerTagModified() noexcept override;
|
||||||
void OnBorderPause() noexcept override;
|
void OnBorderPause() noexcept override;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "Control.hxx"
|
#include "Control.hxx"
|
||||||
#include "Outputs.hxx"
|
#include "Outputs.hxx"
|
||||||
|
#include "Listener.hxx"
|
||||||
#include "Idle.hxx"
|
#include "Idle.hxx"
|
||||||
#include "song/DetachedSong.hxx"
|
#include "song/DetachedSong.hxx"
|
||||||
|
|
||||||
@ -190,6 +191,9 @@ PlayerControl::SetError(PlayerError type, std::exception_ptr &&_error) noexcept
|
|||||||
|
|
||||||
error_type = type;
|
error_type = type;
|
||||||
error = std::move(_error);
|
error = std::move(_error);
|
||||||
|
|
||||||
|
// TODO: is it ok to call this while holding mutex lock?
|
||||||
|
listener.OnPlayerError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -22,6 +22,12 @@
|
|||||||
|
|
||||||
class PlayerListener {
|
class PlayerListener {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A playback error has occurred and
|
||||||
|
* PlayerControl::CheckRethrowError() will provide details.
|
||||||
|
*/
|
||||||
|
virtual void OnPlayerError() noexcept = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must call playlist_sync().
|
* Must call playlist_sync().
|
||||||
*/
|
*/
|
||||||
|
@ -575,8 +575,6 @@ Player::OpenOutput() noexcept
|
|||||||
|
|
||||||
pc.SetOutputError(std::current_exception());
|
pc.SetOutputError(std::current_exception());
|
||||||
|
|
||||||
idle_add(IDLE_PLAYER);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,8 +1063,6 @@ Player::PlayNextChunk() noexcept
|
|||||||
|
|
||||||
pc.LockSetOutputError(std::current_exception());
|
pc.LockSetOutputError(std::current_exception());
|
||||||
|
|
||||||
idle_add(IDLE_PLAYER);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user