diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-01-30 10:59:41 +0100 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-01-30 10:59:41 +0100 |
commit | 8799be1f775d7e71cf6d9463cac8079186ef6481 (patch) | |
tree | 8435d21a195c4a2854ff2a7f2164a35da7a3dda7 /src | |
parent | d38167c27597a8a114fde0f1fef2a73b3277ba36 (diff) | |
download | pianobar-windows-8799be1f775d7e71cf6d9463cac8079186ef6481.tar.gz pianobar-windows-8799be1f775d7e71cf6d9463cac8079186ef6481.tar.bz2 pianobar-windows-8799be1f775d7e71cf6d9463cac8079186ef6481.zip |
Fix libao error detection
Under certain circumstances (fast station switching e.g.) a new playlist
was not fetched, because the player thread returned 0x1 (== libao error)
and the main thread NULLed curStation.
Diffstat (limited to 'src')
-rw-r--r-- | src/player.c | 5 | ||||
-rw-r--r-- | src/player.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/player.c b/src/player.c index 179b8e4..3a21e74 100644 --- a/src/player.c +++ b/src/player.c @@ -200,6 +200,8 @@ static char BarPlayerAACCb (void *ptr, size_t size, void *stream) { format.byte_format = AO_FMT_LITTLE; if ((player->audioOutDevice = ao_open_live (audioOutDriver, &format, NULL)) == NULL) { + /* we're not interested in the errno */ + player->aoError = 1; BarUiMsg (MSG_ERR, "Cannot open audio device\n"); return 0; } @@ -356,6 +358,7 @@ static char BarPlayerMp3Cb (void *ptr, size_t size, void *stream) { format.byte_format = AO_FMT_LITTLE; if ((player->audioOutDevice = ao_open_live (audioOutDriver, &format, NULL)) == NULL) { + player->aoError = 1; BarUiMsg (MSG_ERR, "Cannot open audio device\n"); return 0; } @@ -475,7 +478,7 @@ void *BarPlayerThread (void *data) { /* this should never happen: thread is aborted above */ break; } - if (player->audioOutDevice == NULL && wRet == WAITRESS_RET_CB_ABORT) { + if (player->aoError) { ret = (void *) 0x1; } ao_close(player->audioOutDevice); diff --git a/src/player.h b/src/player.h index dfa9c09..82a6cd5 100644 --- a/src/player.h +++ b/src/player.h @@ -84,6 +84,7 @@ struct audioPlayer { /* audio out */ ao_device *audioOutDevice; + unsigned char aoError; WaitressHandle_t waith; |