]> git.sesse.net Git - ffmpeg/commitdiff
ape: Allow demuxing of files with metadata tags.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 21 Mar 2011 11:04:10 +0000 (12:04 +0100)
committerAnton Khirnov <anton@khirnov.net>
Tue, 24 May 2011 17:07:33 +0000 (19:07 +0200)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavformat/ape.c

index 956036d5a810e3a0877f21932bc9a08a4a98f56a..0bc7737fdec7cd819688c39d6aaa1ca8695f02a8 100644 (file)
@@ -159,8 +159,8 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
     int total_blocks;
     int64_t pts;
 
-    /* TODO: Skip any leading junk such as id3v2 tags */
-    ape->junklength = 0;
+    /* Skip any leading junk such as id3v2 tags */
+    ape->junklength = avio_tell(pb);
 
     tag = avio_rl32(pb);
     if (tag != MKTAG('M', 'A', 'C', ' '))
@@ -276,7 +276,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
     ape->frames[0].nblocks = ape->blocksperframe;
     ape->frames[0].skip    = 0;
     for (i = 1; i < ape->totalframes; i++) {
-        ape->frames[i].pos      = ape->seektable[i]; //ape->frames[i-1].pos + ape->blocksperframe;
+        ape->frames[i].pos      = ape->seektable[i] + ape->junklength;
         ape->frames[i].nblocks  = ape->blocksperframe;
         ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos;
         ape->frames[i].skip     = (ape->frames[i].pos - ape->frames[0].pos) & 3;