From d888d0ac2aeb233deeb70aaca196453f8195e433 Mon Sep 17 00:00:00 2001
From: Cody <codyschuyler@gmail.com>
Date: Sat, 25 Oct 2014 11:22:33 -0700
Subject: 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.
---
 src/player.c | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src')

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,
-- 
cgit v1.2.3