diff options
author | Cody <codyschuyler@gmail.com> | 2014-10-25 11:22:33 -0700 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-01-05 21:24:37 +0100 |
commit | d888d0ac2aeb233deeb70aaca196453f8195e433 (patch) | |
tree | 7713383ad82916d2ff2d24de8c8c797ab314abc4 | |
parent | 32151ea899e5b539d3532ddb30333550ffb092b4 (diff) | |
download | pianobar-windows-d888d0ac2aeb233deeb70aaca196453f8195e433.tar.gz pianobar-windows-d888d0ac2aeb233deeb70aaca196453f8195e433.tar.bz2 pianobar-windows-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.c | 7 |
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, |