summaryrefslogtreecommitdiff
path: root/libavformat/wav.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-01-15 17:13:32 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-01-15 17:13:32 +0000
commitf9329946d0024eaef5515d7d0aa39de3d140d604 (patch)
tree61c0a10e8789fbcb73b62653980c70b712b44f39 /libavformat/wav.c
parent724b1f6a05dbbc75df70990469fe521b93a098de (diff)
Parse fact chunks from wav files to find duration.
Originally committed as revision 26370 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/wav.c')
-rw-r--r--libavformat/wav.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 7cb242982a..894c0c0f96 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -232,7 +232,18 @@ static int wav_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
- size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
+ for (;;) {
+ if (url_feof(pb))
+ return -1;
+ size = next_tag(pb, &tag);
+ if (tag == MKTAG('d', 'a', 't', 'a')){
+ break;
+ }else if (tag == MKTAG('f','a','c','t') && !sample_count){
+ sample_count = get_le32(pb);
+ size -= 4;
+ }
+ url_fseek(pb, size, SEEK_CUR);
+ }
if (rf64)
size = data_size;
if (size < 0)