From 41f1a727c1b7ebbabf84652bab20361ee7631642 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 22 Apr 2011 16:52:52 +0200 Subject: Configureable format strings Closes #88 --- src/player.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/player.c') diff --git a/src/player.c b/src/player.c index 3e69804..b45b40d 100644 --- a/src/player.c +++ b/src/player.c @@ -33,6 +33,7 @@ THE SOFTWARE. #include "player.h" #include "config.h" #include "ui.h" +#include "ui_types.h" #define bigToHostEndian32(x) ntohl(x) @@ -88,7 +89,7 @@ static inline int BarPlayerBufferFill (struct audioPlayer *player, char *data, size_t dataSize) { /* fill buffer */ if (player->bufferFilled + dataSize > sizeof (player->buffer)) { - BarUiMsg (MSG_ERR, "Buffer overflow!\n"); + BarUiMsg (player->settings, MSG_ERR, "Buffer overflow!\n"); return 0; } memcpy (player->buffer+player->bufferFilled, data, dataSize); @@ -140,7 +141,7 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, size_t size, void *stream) player->buffer + player->bufferRead, player->sampleSize[player->sampleSizeCurr]); if (frameInfo.error != 0) { - BarUiMsg (MSG_ERR, "Decoding error: %s\n", + BarUiMsg (player->settings, MSG_ERR, "Decoding error: %s\n", NeAACDecGetErrorMessage (frameInfo.error)); break; } @@ -189,8 +190,8 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, size_t size, void *stream) &player->channels); player->bufferRead += 5; if (err != 0) { - BarUiMsg (MSG_ERR, "Error while " - "initializing audio decoder" + BarUiMsg (player->settings, MSG_ERR, + "Error while initializing audio decoder " "(%i)\n", err); return WAITRESS_CB_RET_ERR; } @@ -204,7 +205,8 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, size_t size, void *stream) &format, NULL)) == NULL) { /* we're not interested in the errno */ player->aoError = 1; - BarUiMsg (MSG_ERR, "Cannot open audio device\n"); + BarUiMsg (player->settings, MSG_ERR, + "Cannot open audio device\n"); return WAITRESS_CB_RET_ERR; } player->mode = PLAYER_AUDIO_INITIALIZED; @@ -329,7 +331,8 @@ static WaitressCbReturn_t BarPlayerMp3Cb (void *ptr, size_t size, void *stream) if (mad_frame_decode (&player->mp3Frame, &player->mp3Stream) != 0) { if (player->mp3Stream.error != MAD_ERROR_BUFLEN) { - BarUiMsg (MSG_ERR, "mp3 decoding error: %s\n", + BarUiMsg (player->settings, MSG_ERR, + "mp3 decoding error: %s\n", mad_stream_errorstr (&player->mp3Stream)); return WAITRESS_CB_RET_ERR; } else { @@ -362,7 +365,8 @@ static WaitressCbReturn_t BarPlayerMp3Cb (void *ptr, size_t size, void *stream) if ((player->audioOutDevice = ao_open_live (audioOutDriver, &format, NULL)) == NULL) { player->aoError = 1; - BarUiMsg (MSG_ERR, "Cannot open audio device\n"); + BarUiMsg (player->settings, MSG_ERR, + "Cannot open audio device\n"); return WAITRESS_CB_RET_ERR; } @@ -444,7 +448,7 @@ void *BarPlayerThread (void *data) { #endif /* ENABLE_MAD */ default: - BarUiMsg (MSG_ERR, "Unsupported audio format!\n"); + BarUiMsg (player->settings, MSG_ERR, "Unsupported audio format!\n"); return PLAYER_RET_OK; break; } -- cgit v1.2.3