diff options
author | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-03-26 16:37:42 +0000 |
---|---|---|
committer | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-03-26 16:37:42 +0000 |
commit | e62a51110c62319c23221c05c6a82ae2ca7a4983 (patch) | |
tree | 9b7fb38b992a2fead5aab3732df9895ed491b41a | |
parent | 96b58cfa58648a4aa6ae0881332652cb99f7cee8 (diff) |
Don't kill me, pure indent change as I forgot to reindent when copy and pasting from dec_audio.c, as this is the first revision it doesn't break changelog!
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5358 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/ad_faad.c | 93 |
1 files changed, 46 insertions, 47 deletions
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c index 227543f3c4..f841fda481 100644 --- a/libmpcodecs/ad_faad.c +++ b/libmpcodecs/ad_faad.c @@ -148,56 +148,55 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...) static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) { - int j = 0, len = 0; - void *faac_sample_buffer; - //memset(sh->a_buffer,0,sh->a_buffer_size); // XXX: check if needed. - - while(len < minlen) { - /* update buffer */ - if(sh->a_in_buffer_len < sh->a_in_buffer_size){ - sh->a_in_buffer_len += - demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], - sh->a_in_buffer_size - sh->a_in_buffer_len); - } + int j = 0, len = 0; + void *faac_sample_buffer; + + while(len < minlen) { + /* update buffer */ + if(sh->a_in_buffer_len < sh->a_in_buffer_size){ + sh->a_in_buffer_len += + demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], + sh->a_in_buffer_size - sh->a_in_buffer_len); + } #ifdef DUMP_AAC_COMPRESSED - {int i; - for (i = 0; i < 16; i++) - printf ("%02X ", sh->a_in_buffer[i]); - printf ("\n");} + {int i; + for (i = 0; i < 16; i++) + printf ("%02X ", sh->a_in_buffer[i]); + printf ("\n");} #endif - do { - faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer+j); - /* update buffer index after faacDecDecode */ - if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len){ - sh->a_in_buffer_len=0; - } else { - sh->a_in_buffer_len-=faac_finfo.bytesconsumed; - memcpy(sh->a_in_buffer,&sh->a_in_buffer[faac_finfo.bytesconsumed],sh->a_in_buffer_len); - } - - if(faac_finfo.error > 0) { - mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: Trying to resync!\n"); - j++; - } else - break; - } while(j < FAAD_BUFFLEN); - - if(faac_finfo.error > 0) { - mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: Failed to decode frame: %s \n", - faacDecGetErrorMessage(faac_finfo.error)); - } else if (faac_finfo.samples == 0) - mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FAAD: Decoded zero samples!\n"); - else { - /* XXX: samples already multiplied by channels! */ - mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FAAD: Successfully decoded frame (%d Bytes)!\n", - sh->samplesize*faac_finfo.samples); - memcpy(buf+len,faac_sample_buffer, sh->samplesize*faac_finfo.samples); - len += sh->samplesize*faac_finfo.samples; - //printf("FAAD: buffer: %d bytes consumed: %d \n", k, faac_finfo.bytesconsumed); - } - } - return len; + do { + faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer+j); + /* update buffer index after faacDecDecode */ + if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len) { + sh->a_in_buffer_len=0; + } else { + sh->a_in_buffer_len-=faac_finfo.bytesconsumed; + memcpy(sh->a_in_buffer,&sh->a_in_buffer[faac_finfo.bytesconsumed],sh->a_in_buffer_len); + } + + if(faac_finfo.error > 0) { + mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: Trying to resync!\n"); + j++; + } else + break; + } while(j < FAAD_BUFFLEN); + + if(faac_finfo.error > 0) { + mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: Failed to decode frame: %s \n", + faacDecGetErrorMessage(faac_finfo.error)); + } else if (faac_finfo.samples == 0) { + mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FAAD: Decoded zero samples!\n"); + } else { + /* XXX: samples already multiplied by channels! */ + mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FAAD: Successfully decoded frame (%d Bytes)!\n", + sh->samplesize*faac_finfo.samples); + memcpy(buf+len,faac_sample_buffer, sh->samplesize*faac_finfo.samples); + len += sh->samplesize*faac_finfo.samples; + //printf("FAAD: buffer: %d bytes consumed: %d \n", k, faac_finfo.bytesconsumed); + } + } + return len; } #endif /* !HAVE_FAAD */ |