mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 15:52:25 +00:00
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
This commit is contained in:
parent
d8c4e2dbe8
commit
9a873224f6
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user