*/
/**
- * @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
* handles special FLIs from the PC game "Magic Carpet".
*/
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
#define FLIC_FILE_MAGIC_1 0xAF11
{
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;
}
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"),
flic_probe,
flic_read_header,
flic_read_packet,
- flic_read_close,
};