summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-29 17:59:08 +0000
committerrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-29 17:59:08 +0000
commit9a873224f674d879546eae9febf5c4292b8de61f (patch)
tree18c4257c648710b6acd8f84f0a778423b26a423b /libmpcodecs
parentd8c4e2dbe8b2677e3f2d0c6671927d2c044d389e (diff)
downloadmpv-9a873224f674d879546eae9febf5c4292b8de61f.tar.bz2
mpv-9a873224f674d879546eae9febf5c4292b8de61f.tar.xz
step 1 of fixing ad_faad:
use internal downmixing just like liba52 does if the output is <= 2 channels actually this is broken since it makes it impossible to manually use af_pan; however liba52 already has that limitation, and without this patch, aac audio comes out TOTALLY wrong on 2-channel systems. hopefully someone will find a better solution later. next up: making ad_faad reorder the channels according to what mplayer expects, so they won't all come out the wrong speakers... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15020 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_faad.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c
index 91253aba6c..efc91ea7e3 100644
--- a/libmpcodecs/ad_faad.c
+++ b/libmpcodecs/ad_faad.c
@@ -66,6 +66,7 @@ static int aac_probe(unsigned char *buffer, int len)
return pos;
}
+extern int audio_output_channels;
static int init(sh_audio_t *sh)
{
unsigned long faac_samplerate;
@@ -90,6 +91,7 @@ static int init(sh_audio_t *sh)
/* XXX: FAAD support FLOAT output, how do we handle
* that (FAAD_FMT_FLOAT)? ::atmos
*/
+ if (audio_output_channels <= 2) faac_conf->downMatrix = 1;
switch(sh->samplesize){
case 1: // 8Bit
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: 8Bit samplesize not supported by FAAD, assuming 16Bit!\n");
@@ -129,6 +131,12 @@ static int init(sh_audio_t *sh)
// XXX FIXME: shouldn't we memcpy() here in a_in_buffer ?? --A'rpi
} else { // We have ES DS in codecdata
+ faacDecConfigurationPtr faac_conf = faacDecGetCurrentConfiguration(faac_hdec);
+ if (audio_output_channels <= 2) {
+ faac_conf->downMatrix = 1;
+ faacDecSetConfiguration(faac_hdec, faac_conf);
+ }
+
/*int i;
for(i = 0; i < sh_audio->codecdata_len; i++)
printf("codecdata_dump %d: 0x%02X\n", i, sh_audio->codecdata[i]);*/
@@ -145,6 +153,7 @@ static int init(sh_audio_t *sh)
mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: Decoder init done (%dBytes)!\n", sh->a_in_buffer_len); // XXX: remove or move to debug!
mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: Negotiated samplerate: %dHz channels: %d\n", faac_samplerate, faac_channels);
sh->channels = faac_channels;
+ if (audio_output_channels <= 2) sh->channels = faac_channels > 1 ? 2 : 1;
sh->samplerate = faac_samplerate;
sh->samplesize=2;
//sh->o_bps = sh->samplesize*faac_channels*faac_samplerate;
@@ -245,8 +254,8 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
int buflen=ds_get_packet(sh->ds, &bufptr);
if(buflen<=0) break;
faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, bufptr, buflen);
-// printf("FAAC decoded %d of %d (err: %d) \n",faac_finfo.bytesconsumed,buflen,faac_finfo.error);
}
+ //for (j=0;j<faac_finfo.channels;j++) printf("%d:%d\n", j, faac_finfo.channel_position[j]);
if(faac_finfo.error > 0) {
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: Failed to decode frame: %s \n",