aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/wavdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-06 10:47:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-06 10:47:49 +0200
commit5cb9093aa8488b9ab5146184e8483f11dd739863 (patch)
tree2e60ceb811e2043917f28404a6eb808fef454c3d /libavformat/wavdec.c
parent77c85cbd9d4dd17c8b8966cec252f89351634d27 (diff)
parentac87eaf856e0fb51917266b899bb15d19b907baf (diff)
downloadffmpeg-5cb9093aa8488b9ab5146184e8483f11dd739863.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: wav: Always seek to an even offset Conflicts: libavformat/wavdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wavdec.c')
-rw-r--r--libavformat/wavdec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index bd39ffee7f..2c98d89394 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -61,6 +61,12 @@ static int64_t next_tag(AVIOContext *pb, uint32_t *tag)
return avio_rl32(pb);
}
+/* RIFF chunks are always on a even offset. */
+static int64_t wav_seek_tag(AVIOContext *s, int64_t offset, int whence)
+{
+ return avio_seek(s, offset + (offset & 1), whence);
+}
+
/* return the size of the found tag */
static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
{
@@ -73,7 +79,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
size = next_tag(pb, &tag);
if (tag == tag1)
break;
- avio_skip(pb, size + (size & 1));
+ wav_seek_tag(pb, size, SEEK_CUR);
}
return size;
}
@@ -365,7 +371,7 @@ static int wav_read_header(AVFormatContext *s)
/* seek to next tag unless we know that we'll run into EOF */
if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
- avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) {
+ wav_seek_tag(pb, next_tag_ofs, SEEK_SET) < 0) {
break;
}
}