summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody <codyschuyler@gmail.com>2014-10-25 11:22:33 -0700
committerLars-Dominik Braun <lars@6xq.net>2015-01-05 21:24:37 +0100
commitd888d0ac2aeb233deeb70aaca196453f8195e433 (patch)
tree7713383ad82916d2ff2d24de8c8c797ab314abc4
parent32151ea899e5b539d3532ddb30333550ffb092b4 (diff)
downloadpianobar-d888d0ac2aeb233deeb70aaca196453f8195e433.tar.gz
pianobar-d888d0ac2aeb233deeb70aaca196453f8195e433.tar.bz2
pianobar-d888d0ac2aeb233deeb70aaca196453f8195e433.zip
Use default channel layout if zero
libav 11 reports an invalid channel layout for mp3 files. This is a work-around. The problem is fixed with libav 11.1.
-rw-r--r--src/player.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/player.c b/src/player.c
index 8d325ea..78a5562 100644
--- a/src/player.c
+++ b/src/player.c
@@ -216,6 +216,13 @@ static bool openFilter (player_t * const player) {
/* abuffer */
AVRational time_base = player->st->time_base;
+
+ /* Workaround for a bug in libav-11, which reports an invalid channel
+ * layout mp3 files */
+ if (cctx->channel_layout == 0) {
+ cctx->channel_layout = av_get_default_channel_layout (cctx->channels);
+ }
+
snprintf (strbuf, sizeof (strbuf),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
time_base.num, time_base.den, cctx->sample_rate,