Mercurial > mplayer.hg
changeset 15019:bc17fdd4e2ef
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...
author | rfelker |
---|---|
date | Tue, 29 Mar 2005 17:59:08 +0000 |
parents | cf605de4dcf0 |
children | 3f80d5095f3e |
files | libmpcodecs/ad_faad.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_faad.c Mon Mar 28 19:48:14 2005 +0000 +++ b/libmpcodecs/ad_faad.c Tue Mar 29 17:59:08 2005 +0000 @@ -66,6 +66,7 @@ return pos; } +extern int audio_output_channels; static int init(sh_audio_t *sh) { unsigned long faac_samplerate; @@ -90,6 +91,7 @@ /* 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 @@ // 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 @@ 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 @@ 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",