summaryrefslogtreecommitdiffstats
path: root/dec_audio.c
diff options
context:
space:
mode:
authormelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-29 04:20:29 +0000
committermelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-29 04:20:29 +0000
commit52668414f9adef6cac8301a85bca172a77f78228 (patch)
treef5d33426a9d6950c8fe6af4487a66a3a4a10b0b7 /dec_audio.c
parentfa669fa2ee90acaf38fc2febef9ffeb19c4f48f0 (diff)
downloadmpv-52668414f9adef6cac8301a85bca172a77f78228.tar.bz2
mpv-52668414f9adef6cac8301a85bca172a77f78228.tar.xz
fixed stereo MS ADPCM decoder and reinstated opensource decoder as the
default handler for MS ADPCM data git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3876 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'dec_audio.c')
-rw-r--r--dec_audio.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/dec_audio.c b/dec_audio.c
index 336d6df954..b24790f7ad 100644
--- a/dec_audio.c
+++ b/dec_audio.c
@@ -369,9 +369,9 @@ case AFM_IMAADPCM:
sh_audio->ds->ss_mul=IMA_ADPCM_BLOCK_SIZE;
break;
case AFM_MSADPCM:
- sh_audio->audio_out_minsize=4096;
- sh_audio->ds->ss_div=MS_ADPCM_SAMPLES_PER_BLOCK;
- sh_audio->ds->ss_mul=MS_ADPCM_BLOCK_SIZE;
+ sh_audio->audio_out_minsize=sh_audio->wf->nBlockAlign * 8;
+ sh_audio->ds->ss_div = MS_ADPCM_SAMPLES_PER_BLOCK;
+ sh_audio->ds->ss_mul = sh_audio->wf->nBlockAlign;
break;
case AFM_FOX62ADPCM:
sh_audio->audio_out_minsize=FOX62_ADPCM_SAMPLES_PER_BLOCK * 4;
@@ -615,7 +615,7 @@ case AFM_IMAADPCM:
case AFM_MSADPCM:
sh_audio->channels=sh_audio->wf->nChannels;
sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
- sh_audio->i_bps=MS_ADPCM_BLOCK_SIZE*
+ sh_audio->i_bps = sh_audio->wf->nBlockAlign *
(sh_audio->channels*sh_audio->samplerate) / MS_ADPCM_SAMPLES_PER_BLOCK;
break;
case AFM_FOX62ADPCM:
@@ -1034,12 +1034,17 @@ int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen){
break;
}
case AFM_MSADPCM:
- { unsigned char ibuf[MS_ADPCM_BLOCK_SIZE * 2]; // bytes / stereo frame
+ { static unsigned char *ibuf = NULL;
+ if (!ibuf)
+ ibuf = (unsigned char *)malloc
+ (sh_audio->wf->nBlockAlign * sh_audio->wf->nChannels);
if (demux_read_data(sh_audio->ds, ibuf,
- MS_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) !=
- MS_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels)
+ sh_audio->wf->nBlockAlign) !=
+ sh_audio->wf->nBlockAlign)
break; // EOF
- len=2*ms_adpcm_decode_block((unsigned short*)buf,ibuf, sh_audio->wf->nChannels);
+ len= 2 * ms_adpcm_decode_block(
+ (unsigned short*)buf,ibuf, sh_audio->wf->nChannels,
+ sh_audio->wf->nBlockAlign);
break;
}
case AFM_FOX62ADPCM: