Mercurial > mplayer.hg
diff libmpcodecs/ad_ffmpeg.c @ 29491:99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
ffdca, ffflac, ffaac, fftruehd). In the process, adds support for 32-bit
samples.
author | tack |
---|---|
date | Tue, 18 Aug 2009 22:24:36 +0000 |
parents | 0f1b5b68af32 |
children | 2c47c6dd92b5 |
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c Mon Aug 17 08:02:37 2009 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Tue Aug 18 22:24:36 2009 +0000 @@ -174,27 +174,19 @@ if(len2>0){ if (((AVCodecContext *)sh_audio->context)->channels >= 5) { int src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; + int samplesize = av_get_bits_per_sample_format(((AVCodecContext *) + sh_audio->context)->sample_fmt) / 8; const char *codec=((AVCodecContext*)sh_audio->context)->codec->name; - if (!strcasecmp(codec, "ac3") - || !strcasecmp(codec, "eac3")) - src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT; - else if (!strcasecmp(codec, "dca")) - src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_DCA_DEFAULT; - else if (!strcasecmp(codec, "libfaad") - || !strcasecmp(codec, "mpeg4aac")) - src_ch_layout = AF_CHANNEL_LAYOUT_AAC_DEFAULT; - else if (!strcasecmp(codec, "liba52")) - src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_LIBA52_DEFAULT; + if (!strcasecmp(codec, "aac")) + src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_DEFAULT; else if (!strcasecmp(codec, "vorbis")) src_ch_layout = AF_CHANNEL_LAYOUT_VORBIS_DEFAULT; - else if (!strcasecmp(codec, "flac")) - src_ch_layout = AF_CHANNEL_LAYOUT_FLAC_DEFAULT; else - src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; + src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_DEFAULT; reorder_channel_nch(buf, src_ch_layout, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, ((AVCodecContext *)sh_audio->context)->channels, - len2 / 2, 2); + len2 / samplesize, samplesize); } //len=len2;break; if(len<0) len=len2; else len+=len2;