diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-02-23 13:10:59 -0500 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-02-26 03:16:02 +0100 |
commit | 2ac19b75c0d25f15d33a4f7905be50c7ebbd67fe (patch) | |
tree | 8a447b3c3bcd0e43d223f2da5dc8c0946d2768e7 | |
parent | 994e445a17303abcc87b487e4abea54e505fe618 (diff) | |
download | ffmpeg-2ac19b75c0d25f15d33a4f7905be50c7ebbd67fe.tar.gz |
vmdaudio: remove duplicated code by merging mono and stereo decoding.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 1328d433137c055df06f99772b243ceec2bbf36e)
-rw-r--r-- | libavcodec/vmdav.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index c7f99dbcb5..cbe530dbb4 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -475,19 +475,16 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int silence, int data_size) { - int bytes_decoded = 0; int i; // if (silence) // av_log(s->avctx, AV_LOG_INFO, "silent block!\n"); - if (s->channels == 2) { - /* stereo handling */ if (silence) { memset(data, 0, data_size * 2); } else { if (s->bits == 16) - vmdaudio_decode_audio(s, data, buf, data_size, 1); + vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); else { /* copy the data but convert it to signed */ for (i = 0; i < data_size; i++){ @@ -496,24 +493,6 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, } } } - } else { - bytes_decoded = data_size * 2; - - /* mono handling */ - if (silence) { - memset(data, 0, data_size * 2); - } else { - if (s->bits == 16) { - vmdaudio_decode_audio(s, data, buf, data_size, 0); - } else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } - } - } - } return data_size * 2; } |