comparison flic.c @ 864:00a3ba030166 libavformat

support for FLX and DTA extensions in the FLIC format, courtesy of Steven Johnson (mplayer -at- sakuraindustries.com)
author melanson
date Thu, 13 Oct 2005 04:35:31 +0000
parents feca73904e67
children da1d5db0ce5c
comparison
equal deleted inserted replaced
863:227caa55d8ea 864:00a3ba030166
31 31
32 #include "avformat.h" 32 #include "avformat.h"
33 33
34 #define FLIC_FILE_MAGIC_1 0xAF11 34 #define FLIC_FILE_MAGIC_1 0xAF11
35 #define FLIC_FILE_MAGIC_2 0xAF12 35 #define FLIC_FILE_MAGIC_2 0xAF12
36 #define FLIC_FILE_MAGIC_3 0xAF44 /* Flic Type for Extended FLX Format which
37 originated in Dave's Targa Animator (DTA) */
36 #define FLIC_CHUNK_MAGIC_1 0xF1FA 38 #define FLIC_CHUNK_MAGIC_1 0xF1FA
37 #define FLIC_CHUNK_MAGIC_2 0xF5FA 39 #define FLIC_CHUNK_MAGIC_2 0xF5FA
38 #define FLIC_MC_PTS_INC 6000 /* pts increment for Magic Carpet game FLIs */ 40 #define FLIC_MC_PTS_INC 6000 /* pts increment for Magic Carpet game FLIs */
39 #define FLIC_DEFAULT_PTS_INC 6000 /* for FLIs that have 0 speed */ 41 #define FLIC_DEFAULT_PTS_INC 6000 /* for FLIs that have 0 speed */
40 42
54 if (p->buf_size < 6) 56 if (p->buf_size < 6)
55 return 0; 57 return 0;
56 58
57 magic_number = LE_16(&p->buf[4]); 59 magic_number = LE_16(&p->buf[4]);
58 if ((magic_number != FLIC_FILE_MAGIC_1) && 60 if ((magic_number != FLIC_FILE_MAGIC_1) &&
59 (magic_number != FLIC_FILE_MAGIC_2)) 61 (magic_number != FLIC_FILE_MAGIC_2) &&
62 (magic_number != FLIC_FILE_MAGIC_3))
60 return 0; 63 return 0;
61 64
62 return AVPROBE_SCORE_MAX; 65 return AVPROBE_SCORE_MAX;
63 } 66 }
64 67
127 * 90000 70 130 * 90000 70
128 * 131 *
129 * therefore, the frame pts increment = n * 1285.7 132 * therefore, the frame pts increment = n * 1285.7
130 */ 133 */
131 flic->frame_pts_inc = speed * 1285.7; 134 flic->frame_pts_inc = speed * 1285.7;
132 } else if (magic_number == FLIC_FILE_MAGIC_2) { 135 } else if ((magic_number == FLIC_FILE_MAGIC_2) ||
136 (magic_number == FLIC_FILE_MAGIC_3)) {
133 /* 137 /*
134 * in this case, the speed (n) is number of milliseconds between frames: 138 * in this case, the speed (n) is number of milliseconds between frames:
135 * 139 *
136 * pts n * frame # 140 * pts n * frame #
137 * -------- = ----------- => pts = n * 90 * frame # 141 * -------- = ----------- => pts = n * 90 * frame #
204 return 0; 208 return 0;
205 } 209 }
206 210
207 static AVInputFormat flic_iformat = { 211 static AVInputFormat flic_iformat = {
208 "flic", 212 "flic",
209 "FLI/FLC animation format", 213 "FLI/FLC/FLX animation format",
210 sizeof(FlicDemuxContext), 214 sizeof(FlicDemuxContext),
211 flic_probe, 215 flic_probe,
212 flic_read_header, 216 flic_read_header,
213 flic_read_packet, 217 flic_read_packet,
214 flic_read_close, 218 flic_read_close,