]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
skip INDX chunks
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 3 Jan 2005 02:52:11 +0000 (02:52 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 3 Jan 2005 02:52:11 +0000 (02:52 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3796 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/rm.c

index f08a65821978403c73c418f101dd45d3f527427e..54ffa028d803603a83f3c7b4d3d976537ee59125 100644 (file)
@@ -731,6 +731,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
     ByteIOContext *pb = &s->pb;
     int len, num, res, i;
     AVStream *st;
+    uint32_t state=0xFFFFFFFF;
 
     while(!url_feof(pb)){
         *pos= url_ftell(pb);
@@ -740,13 +741,20 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
             *timestamp = AV_NOPTS_VALUE;
             *flags= 0;
         }else{
-            if(get_byte(pb))
-                continue;
-            if(get_byte(pb))
-                continue;
-            len = get_be16(pb);
-            if (len < 12)
+            state= (state<<8) + get_byte(pb);
+            
+            if(state == MKBETAG('I', 'N', 'D', 'X')){
+                len = get_be16(pb) - 6;
+                if(len<0)
+                    continue;
+                goto skip;
+            }
+            
+            if(state > (unsigned)0xFFFF || state < 12)
                 continue;
+            len=state;
+            state= 0xFFFFFFFF;
+
             num = get_be16(pb);
             *timestamp = get_be32(pb);
             res= get_byte(pb); /* reserved */
@@ -761,6 +769,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
                 break;
         }
         if (i == s->nb_streams) {
+skip:
             /* skip packet if unknown number */
             url_fskip(pb, len);
             rm->remaining_len -= len;