summaryrefslogtreecommitdiffstats
path: root/dec_audio.c
diff options
context:
space:
mode:
authoratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-19 21:48:55 +0000
committeratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-19 21:48:55 +0000
commit9ed76eba4bd653bbd8c198787a44893c69881875 (patch)
tree334c7507a22e223e9b249137d2e8155075094285 /dec_audio.c
parent682288117ea901749ebdff0deb1c98abb4825e98 (diff)
downloadmpv-9ed76eba4bd653bbd8c198787a44893c69881875.tar.bz2
mpv-9ed76eba4bd653bbd8c198787a44893c69881875.tar.xz
allow sh_audio struct to be initialized by demuxer, add parsing of mp4 esds header to mov demuxer, init faad from info from mov header
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5207 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'dec_audio.c')
-rw-r--r--dec_audio.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/dec_audio.c b/dec_audio.c
index c92579c364..327f7b5ed8 100644
--- a/dec_audio.c
+++ b/dec_audio.c
@@ -328,15 +328,17 @@ int mplayer_audio_read(char *buf,int size){
int init_audio(sh_audio_t *sh_audio){
int driver=sh_audio->codec->driver;
-sh_audio->samplesize=2;
+if(!sh_audio->samplesize)
+ sh_audio->samplesize=2;
+if(!sh_audio->sample_format)
#ifdef WORDS_BIGENDIAN
-sh_audio->sample_format=AFMT_S16_BE;
+ sh_audio->sample_format=AFMT_S16_BE;
#else
-sh_audio->sample_format=AFMT_S16_LE;
+ sh_audio->sample_format=AFMT_S16_LE;
#endif
-sh_audio->samplerate=0;
+//sh_audio->samplerate=0;
//sh_audio->pcm_bswap=0;
-sh_audio->o_bps=0;
+//sh_audio->o_bps=0;
sh_audio->a_buffer_size=0;
sh_audio->a_buffer=NULL;
@@ -840,16 +842,15 @@ case AFM_AAC: {
faacDecConfigurationPtr faac_conf;
faac_hdec = faacDecOpen();
-#if 0
+#if 1
/* Set the default object type and samplerate */
/* This is useful for RAW AAC files */
faac_conf = faacDecGetCurrentConfiguration(faac_hdec);
if(sh_audio->samplerate)
faac_conf->defSampleRate = sh_audio->samplerate;
- /* XXX: is outputFormat samplesize of compressed data or samplesize of
- * decoded data, maybe upsampled? Also, FAAD support FLOAT output,
- * how do we handle that (FAAD_FMT_FLOAT)? ::atmos
- */
+ /* XXX: FAAD support FLOAT output, how do we handle
+ * that (FAAD_FMT_FLOAT)? ::atmos
+ */
if(sh_audio->samplesize)
switch(sh_audio->samplesize){
case 1: // 8Bit
@@ -865,7 +866,7 @@ case AFM_AAC: {
faac_conf->outputFormat = FAAD_FMT_32BIT;
break;
}
- faac_conf->defObjectType = LTP; // => MAIN, LC, SSR, LTP available.
+ //faac_conf->defObjectType = LTP; // => MAIN, LC, SSR, LTP available.
faacDecSetConfiguration(faac_hdec, faac_conf);
#endif
@@ -887,7 +888,11 @@ case AFM_AAC: {
mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: Negotiated samplerate: %dHz channels: %d\n", faac_samplerate, faac_channels);
sh_audio->channels = faac_channels;
sh_audio->samplerate = faac_samplerate;
- sh_audio->i_bps = 128*1000/8; // XXX: HACK!!! There's currently no way to get bitrate from libfaad2! ::atmos
+ if(!sh_audio->i_bps) {
+ mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: compressed input bitrate missing, assuming 128kbit/s!\n");
+ sh_audio->i_bps = 128*1000/8; // XXX: HACK!!! There's currently no way to get bitrate from libfaad2! ::atmos
+ } else
+ mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: got %dkbit/s rate from MP4 header!\n",sh_audio->i_bps*8/1000);
}
} break;