]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/flic.c
matroskadec: demux relevant subtitle packets after a seek
[ffmpeg] / libavformat / flic.c
index ed7004faf1c0c8f36b3c65df5309042869de009f..62ea94ef637cc4e0e76a4ba67bb0f6e942655ebf 100644 (file)
@@ -54,12 +54,25 @@ static int flic_probe(AVProbeData *p)
 {
     int magic_number;
 
+    if(p->buf_size < FLIC_HEADER_SIZE)
+        return 0;
+
     magic_number = AV_RL16(&p->buf[4]);
     if ((magic_number != FLIC_FILE_MAGIC_1) &&
         (magic_number != FLIC_FILE_MAGIC_2) &&
         (magic_number != FLIC_FILE_MAGIC_3))
         return 0;
 
+    if(AV_RL16(&p->buf[0x10]) != FLIC_CHUNK_MAGIC_1){
+        if(AV_RL32(&p->buf[0x10]) > 2000)
+            return 0;
+    }
+
+    if(   AV_RL16(&p->buf[0x08]) > 4096
+       || AV_RL16(&p->buf[0x0A]) > 4096)
+        return 0;
+
+
     return AVPROBE_SCORE_MAX;
 }
 
@@ -67,7 +80,7 @@ static int flic_read_header(AVFormatContext *s,
                             AVFormatParameters *ap)
 {
     FlicDemuxContext *flic = s->priv_data;
-    ByteIOContext *pb = &s->pb;
+    ByteIOContext *pb = s->pb;
     unsigned char header[FLIC_HEADER_SIZE];
     AVStream *st;
     int speed;
@@ -142,7 +155,7 @@ static int flic_read_packet(AVFormatContext *s,
                             AVPacket *pkt)
 {
     FlicDemuxContext *flic = s->priv_data;
-    ByteIOContext *pb = &s->pb;
+    ByteIOContext *pb = s->pb;
     int packet_read = 0;
     unsigned int size;
     int magic;
@@ -185,19 +198,11 @@ static int flic_read_packet(AVFormatContext *s,
     return ret;
 }
 
-static int flic_read_close(AVFormatContext *s)
-{
-//    FlicDemuxContext *flic = s->priv_data;
-
-    return 0;
-}
-
 AVInputFormat flic_demuxer = {
     "flic",
-    "FLI/FLC/FLX animation format",
+    NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
     sizeof(FlicDemuxContext),
     flic_probe,
     flic_read_header,
     flic_read_packet,
-    flic_read_close,
 };