summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/vmdav.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libffmpeg/libavcodec/vmdav.c')
-rw-r--r--src/libffmpeg/libavcodec/vmdav.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/libffmpeg/libavcodec/vmdav.c b/src/libffmpeg/libavcodec/vmdav.c
index b850a09f9..a9937144e 100644
--- a/src/libffmpeg/libavcodec/vmdav.c
+++ b/src/libffmpeg/libavcodec/vmdav.c
@@ -2,18 +2,20 @@
* Sierra VMD Audio & Video Decoders
* Copyright (C) 2004 the ffmpeg project
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
@@ -92,7 +94,7 @@ static void lz_unpack(unsigned char *src, unsigned char *dest, int dest_len)
d_end = d + dest_len;
dataleft = LE_32(s);
s += 4;
- memset(queue, QUEUE_SIZE, 0x20);
+ memset(queue, 0x20, QUEUE_SIZE);
if (LE_32(s) == 0x56781234) {
s += 4;
qpos = 0x111;
@@ -482,10 +484,13 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
} else {
if (s->bits == 16)
vmdaudio_decode_audio(s, data, buf, 1);
- else
+ else {
/* copy the data but convert it to signed */
- for (i = 0; i < s->block_align; i++)
- data[i * 2 + 1] = buf[i] + 0x80;
+ for (i = 0; i < s->block_align; i++){
+ *data++ = buf[i] + 0x80;
+ *data++ = buf[i] + 0x80;
+ }
+ }
}
} else {
bytes_decoded = s->block_align * 2;
@@ -498,8 +503,10 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
vmdaudio_decode_audio(s, data, buf, 0);
} else {
/* copy the data but convert it to signed */
- for (i = 0; i < s->block_align; i++)
- data[i * 2 + 1] = buf[i] + 0x80;
+ for (i = 0; i < s->block_align; i++){
+ *data++ = buf[i] + 0x80;
+ *data++ = buf[i] + 0x80;
+ }
}
}
}
@@ -512,12 +519,10 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
uint8_t *buf, int buf_size)
{
VmdAudioContext *s = (VmdAudioContext *)avctx->priv_data;
- unsigned int sound_flags;
unsigned char *output_samples = (unsigned char *)data;
/* point to the start of the encoded data */
unsigned char *p = buf + 16;
- unsigned char *p_end = buf + buf_size;
if (buf_size < 16)
return buf_size;
@@ -526,24 +531,10 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
/* the chunk contains audio */
*data_size = vmdaudio_loadsound(s, output_samples, p, 0);
} else if (buf[6] == 2) {
- /* the chunk contains audio and silence mixed together */
- sound_flags = LE_32(p);
+ /* the chunk may contain audio */
p += 4;
-
- /* do something with extrabufs here? */
-
- while (p < p_end) {
- if (sound_flags & 0x01)
- /* silence */
- *data_size += vmdaudio_loadsound(s, output_samples, p, 1);
- else {
- /* audio */
- *data_size += vmdaudio_loadsound(s, output_samples, p, 0);
- p += s->block_align;
- }
- output_samples += (s->block_align * s->bits / 8);
- sound_flags >>= 1;
- }
+ *data_size = vmdaudio_loadsound(s, output_samples, p, (buf_size == 16));
+ output_samples += (s->block_align * s->bits / 8);
} else if (buf[6] == 3) {
/* silent chunk */
*data_size = vmdaudio_loadsound(s, output_samples, p, 1);