[FFmpeg-cvslog] r26370 - trunk/libavformat/wav.c

michael subversion
Sat Jan 15 18:13:33 CET 2011


Author: michael
Date: Sat Jan 15 18:13:32 2011
New Revision: 26370

Log:
Parse fact chunks from wav files to find duration.

Modified:
   trunk/libavformat/wav.c

Modified: trunk/libavformat/wav.c
==============================================================================
--- trunk/libavformat/wav.c	Sat Jan 15 18:13:30 2011	(r26369)
+++ trunk/libavformat/wav.c	Sat Jan 15 18:13:32 2011	(r26370)
@@ -232,7 +232,18 @@ static int wav_read_header(AVFormatConte
 
     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)



More information about the ffmpeg-cvslog mailing list