]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/flic.c
Prefer cbp over cbp_table.
[ffmpeg] / libavformat / flic.c
index adfa637f443098b4281e662a38fd2cb38b8ce03c..b382a25f96de6ca14a5ab1118c6e58350334742a 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file flic.c
+ * @file libavformat/flic.c
  * FLI/FLC file demuxer
  * by Mike Melanson (melanson@pcisys.net)
  * for more information on the .fli/.flc file format and all of its many
@@ -31,6 +31,7 @@
  * handles special FLIs from the PC game "Magic Carpet".
  */
 
+#include "libavutil/intreadwrite.h"
 #include "avformat.h"
 
 #define FLIC_FILE_MAGIC_1 0xAF11
@@ -54,12 +55,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;
 }
 
@@ -185,13 +199,6 @@ 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",
     NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
@@ -199,5 +206,4 @@ AVInputFormat flic_demuxer = {
     flic_probe,
     flic_read_header,
     flic_read_packet,
-    flic_read_close,
 };