summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2024-03-29 10:01:59 +0100
committerLars-Dominik Braun <lars@6xq.net>2024-03-29 10:01:59 +0100
commitc76bcb27d7864f33e0d64ca4afbb2453cabfdb79 (patch)
treeec4341c75ea048f849cc289ef8d05b2c7cc5ba3e
parent8bf4c1bbaa6a533f34d74f83d72eecc0beb61d4f (diff)
downloadpianobar-c76bcb27d7864f33e0d64ca4afbb2453cabfdb79.tar.gz
pianobar-c76bcb27d7864f33e0d64ca4afbb2453cabfdb79.tar.bz2
pianobar-c76bcb27d7864f33e0d64ca4afbb2453cabfdb79.zip
player: Translate error code to string in debug messages.
-rw-r--r--src/player.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/player.c b/src/player.c
index 3a9cefe..753d490 100644
--- a/src/player.c
+++ b/src/player.c
@@ -433,8 +433,12 @@ static int play (player_t * const player) {
} else if (ret < 0) {
/* error, abort */
/* mark the EOF, so that BarAoPlayThread can quit*/
- debugPrint (DEBUG_AUDIO, "av_read_frame failed with code %i, sending "
- "NULL frame\n", ret);
+ char error[AV_ERROR_MAX_STRING_SIZE];
+ if (av_strerror(ret, error, sizeof(error)) < 0) {
+ strncpy (error, "(unknown)", sizeof(error)-1);
+ }
+ debugPrint (DEBUG_AUDIO, "av_read_frame failed with code %i (%s), "
+ "sending NULL frame\n", ret, error);
pthread_mutex_lock (&player->aoplayLock);
const int rt = av_buffersrc_add_frame (player->fabuf, NULL);
assert (rt == 0);