From edb86ad86ac4162bd1b3984d6ab7a75db13ec148 Mon Sep 17 00:00:00 2001 From: Leandro Dorileo Date: Thu, 13 Feb 2014 11:24:44 -0200 Subject: [PATCH] libav: compatibility issues between libav and ffmpeg For compatibility issues we must try to get channels using the codec->channels field if it's 0 we try using the function av_get_channel_layout_cb_channels(). --- src/plugins/generic/generic.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/generic/generic.c b/src/plugins/generic/generic.c index 4be6d60..d3a0069 100644 --- a/src/plugins/generic/generic.c +++ b/src/plugins/generic/generic.c @@ -381,7 +381,11 @@ _parse_audio_stream(AVFormatContext *fmt_ctx, struct lms_audio_info *info, AVStr AVCodecContext *ctx = stream->codec; info->bitrate = ctx->bit_rate; - info->channels = av_get_channel_layout_nb_channels(ctx->channel_layout); + info->channels = ctx->channels; + + if (!info->channels) + info->channels = av_get_channel_layout_nb_channels(ctx->channel_layout); + info->sampling_rate = ctx->sample_rate; info->length = _get_stream_duration(fmt_ctx); -- 2.7.4