mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 10:17:31 +00:00
Simplify ad_imaadpcm decode_audio function
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27144 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2293c79521
commit
15a54da104
@ -182,7 +182,7 @@ static void decode_nibbles(unsigned short *output,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int qt_ima_adpcm_decode_block(unsigned short *output,
|
static int qt_ima_adpcm_decode_block(unsigned short *output,
|
||||||
unsigned char *input, int channels)
|
unsigned char *input, int channels, int block_size)
|
||||||
{
|
{
|
||||||
int initial_predictor_l = 0;
|
int initial_predictor_l = 0;
|
||||||
int initial_predictor_r = 0;
|
int initial_predictor_r = 0;
|
||||||
@ -351,26 +351,20 @@ static int dk4_ima_adpcm_decode_block(unsigned short *output,
|
|||||||
|
|
||||||
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
|
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
|
||||||
{
|
{
|
||||||
|
int res = -1;
|
||||||
|
int (*decode_func)(unsigned short *output, unsigned char *input, int channels, int block_size) = qt_ima_adpcm_decode_block;
|
||||||
if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer,
|
if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer,
|
||||||
sh_audio->ds->ss_mul) !=
|
sh_audio->ds->ss_mul) !=
|
||||||
sh_audio->ds->ss_mul)
|
sh_audio->ds->ss_mul)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((sh_audio->format == 0x11) || (sh_audio->format == 0x1100736d))
|
if ((sh_audio->format == 0x11) || (sh_audio->format == 0x1100736d))
|
||||||
{
|
decode_func = ms_ima_adpcm_decode_block;
|
||||||
return 2 * ms_ima_adpcm_decode_block(
|
|
||||||
(unsigned short*)buf, sh_audio->a_in_buffer, sh_audio->wf->nChannels,
|
|
||||||
sh_audio->ds->ss_mul);
|
|
||||||
}
|
|
||||||
else if (sh_audio->format == 0x61)
|
else if (sh_audio->format == 0x61)
|
||||||
{
|
decode_func = dk4_ima_adpcm_decode_block;
|
||||||
return 2 * dk4_ima_adpcm_decode_block(
|
|
||||||
(unsigned short*)buf, sh_audio->a_in_buffer, sh_audio->wf->nChannels,
|
res = decode_func((unsigned short*)buf, sh_audio->a_in_buffer,
|
||||||
sh_audio->ds->ss_mul);
|
sh_audio->wf->nChannels, sh_audio->ds->ss_mul);
|
||||||
}
|
if (res < 0) return res;
|
||||||
else
|
else return 2 * res;
|
||||||
{
|
|
||||||
return 2 * qt_ima_adpcm_decode_block(
|
|
||||||
(unsigned short*)buf, sh_audio->a_in_buffer, sh_audio->wf->nChannels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user