diff options
author | 2007-12-10 16:53:30 +0000 | |
---|---|---|
committer | 2007-12-10 16:53:30 +0000 | |
commit | 1ed6e96cfba3c822d333f58c3181d18e0de95d14 (patch) | |
tree | c6162cae9d8a01ddc7bd22931817cd118beffbad /libmpcodecs/ad_ffmpeg.c | |
parent | 24dafeee09a6e724dadf0bf904df1b911020154c (diff) |
Fix all current known multi-channel wrong order problems by adding
common functions for channel reordering.
This fixes these modules by adding channel reordering code for 5.0/5.1 audio:
ao: pcm
ad: dmo, faad, ffmpeg(ac3, dca, libfaad, liba52), pcm
ae: faac, lavc(ac3, libfaac), pcm
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25343 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/ad_ffmpeg.c')
-rw-r--r-- | libmpcodecs/ad_ffmpeg.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 8061eab410..472323a5de 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -7,6 +7,7 @@ #include "help_mp.h" #include "ad_internal.h" +#include "libaf/reorder_ch.h" #include "mpbswap.h" @@ -166,6 +167,25 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; } if(y<x) sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) if(len2>0){ + if (((AVCodecContext *)sh_audio->context)->channels >= 5) { + int src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; + const char *codec=((AVCodecContext*)sh_audio->context)->codec->name; + if (!strcasecmp(codec, "ac3")) + 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; + else + src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; + reorder_channel_nch(buf, src_ch_layout, + AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, + ((AVCodecContext *)sh_audio->context)->channels, + len2 / 2, 2); + } //len=len2;break; if(len<0) len=len2; else len+=len2; buf+=len2; |