diff options
author | melanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-12-26 06:13:17 +0000 |
---|---|---|
committer | melanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-12-26 06:13:17 +0000 |
commit | 24774d66c73f6f1b6d62b2a715e369b002823f02 (patch) | |
tree | deed88d8245f0d84f4772bb7f11c68d8014743c1 /dec_audio.c | |
parent | d9f209002d87d7d85eee2855ba01d7a6cadc98d9 (diff) | |
download | mpv-24774d66c73f6f1b6d62b2a715e369b002823f02.tar.bz2 mpv-24774d66c73f6f1b6d62b2a715e369b002823f02.tar.xz |
Initial support for unified ADPCM decoder
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3757 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'dec_audio.c')
-rw-r--r-- | dec_audio.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/dec_audio.c b/dec_audio.c index d69086f864..c2f0a8b5d6 100644 --- a/dec_audio.c +++ b/dec_audio.c @@ -39,7 +39,7 @@ static G72x_DATA g72x_data; #include "ac3-iec958.h" -#include "ima4.h" +#include "adpcm.h" #include "cpudetect.h" @@ -279,10 +279,11 @@ case AFM_GSM: sh_audio->audio_out_minsize=4*320; break; case AFM_IMA4: +case AFM_ADPCM: // IMA-ADPCM 4:1 audio codec: - sh_audio->audio_out_minsize=4096; //4*IMA4_SAMPLES_PER_BLOCK; - sh_audio->ds->ss_div=IMA4_SAMPLES_PER_BLOCK; - sh_audio->ds->ss_mul=IMA4_BLOCK_SIZE; + sh_audio->audio_out_minsize=4096; + sh_audio->ds->ss_div=IMA_ADPCM_SAMPLES_PER_BLOCK; + sh_audio->ds->ss_mul=IMA_ADPCM_BLOCK_SIZE; break; case AFM_MPEG: // MPEG Audio: @@ -502,12 +503,13 @@ case AFM_GSM: { sh_audio->i_bps=65*(sh_audio->channels*sh_audio->samplerate)/320; // 1:10 break; } +case AFM_ADPCM: case AFM_IMA4: { // IMA-ADPCM 4:1 audio codec: sh_audio->channels=sh_audio->wf->nChannels; sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; // decodes 34 byte -> 64 short - sh_audio->i_bps=IMA4_BLOCK_SIZE*(sh_audio->channels*sh_audio->samplerate)/IMA4_SAMPLES_PER_BLOCK; // 1:4 + sh_audio->i_bps=IMA_ADPCM_BLOCK_SIZE*(sh_audio->channels*sh_audio->samplerate)/IMA_ADPCM_SAMPLES_PER_BLOCK; // 1:4 break; } case AFM_MPEG: { @@ -904,10 +906,15 @@ int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen){ memcpy(buf,g72x_data.samples,len); break; } + case AFM_ADPCM: case AFM_IMA4: // IMA-ADPCM 4:1 audio codec: - { unsigned char ibuf[IMA4_BLOCK_SIZE]; // bytes / frame - if(demux_read_data(sh_audio->ds,ibuf,IMA4_BLOCK_SIZE)!=IMA4_BLOCK_SIZE) break; // EOF - len=2*ima4_decode_block((unsigned short*)buf,ibuf,2*IMA4_SAMPLES_PER_BLOCK); + { unsigned char ibuf[IMA_ADPCM_BLOCK_SIZE * 2]; // bytes / stereo frame + if (demux_read_data(sh_audio->ds, ibuf, + IMA_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) != + IMA_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) + break; // EOF + len=2*ima_adpcm_decode_block((unsigned short*)buf,ibuf, sh_audio->wf->nChannels); +// len=2*ima4_decode_block((unsigned short*)buf,ibuf,2*IMA_ADPCM_SAMPLES_PER_BLOCK); break; } case AFM_AC3: // AC3 decoder |