00001
00002
00003
00004 void preparse_add()
00005 {
00006 #define insn_init { NULL, NULL, 0, { 0 } }
00007 #define det(n,r) { static struct asa_import_detect d = { NULL }; \
00008 d.name = n; \
00009 if (!asa_pcre_compile(&d.re, r)) \
00010 asa_det_last = &(*asa_det_last = &d)->next; }
00011 #define fmt_b(n,t) { static struct asa_import_format f = { NULL }; \
00012 struct asa_import_insn *i, **i0 = NULL; \
00013 f.name = n; f.target = t;
00014 #define fmt_e() \
00015 }
00016 #define insn(n,t) { static struct asa_import_insn ii = insn_init; \
00017 i = ⅈ *n = i; n = &i->next; i->insn = t; }
00018 #define insn_b(n, m, t, r) { struct asa_import_insn **m;\
00019 { static struct asa_import_insn ii = insn_init; \
00020 i = ⅈ ii.insn = t; \
00021 m = &ii.v.child.insns; \
00022 }\
00023 if (!asa_pcre_compile(&i->v.child.regex, r)) { \
00024 *n = i; n = &i->next;
00025 #define insn_e() } }
00026 #define insn_sg(n, t, r) { struct asa_repl **repl;\
00027 { static struct asa_import_insn ii = insn_init; \
00028 i = ⅈ ii.insn = t; \
00029 repl = &ii.v.sg.repl; \
00030 }\
00031 if (!asa_pcre_compile(&i->v.sg.regex, r)) { \
00032 *n = i; n = &i->next;
00033 #define insn_sge() } }
00034 #define repl(g, t) { static struct asa_repl r = { NULL, g, t }; \
00035 *repl = &r; repl = &r.next; }
00036 #define insn_ts(n, t, d) { struct asa_tspec **tsp;\
00037 { static struct asa_import_insn ii = insn_init; \
00038 i = ⅈ ii.insn = t; ii.v.tspec.delta_select = d; \
00039 tsp = &ii.v.tspec.tsp; \
00040 }\
00041 *n = i; n = &i->next;
00042 #define insn_tse() }
00043 #define tsp(g, m, f) { static struct asa_tspec t = { NULL, g, m, f }; \
00044 *tsp = &t; tsp = &t.next; }
00045
00046 det("qttext","^\\{QTtext\\}")
00047 det("rtf","^\\{\\\\rtf")
00048 det("viplay","^\\{\\* VIPLAY")
00049 det("zerog","^% Zero G")
00050 det("sst","^SST ")
00051 det("philips","^# PHILIPS SVCD DESIGNER")
00052 det("ulead","^#Ulead subtitle")
00053 det("sonicscenarist","^st_format\\s*\\d")
00054 det("dvdjunior","^Subtitle File Mark")
00055 det("captionsdat","^\\0\\r#")
00056 det("inscriber","^@@.*\\n@@\\d Created by URUSoft")
00057 det("ssa","(?mi)^(ScriptType:|\\[Script Info)")
00058 det("subrip","^\\d+\\s*\\n\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d\\s+-->\\s+\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d\\s*\\n")
00059 det("microdvd","^\\{\\d+\\}\\{\\d+\\}")
00060 det("sami","(?i)<SAMI")
00061 det("smil","(?i)<SMIL")
00062 det("smil_rt","(?i)<WINDOW")
00063 det("html","(?i)<HTML")
00064 det("jacosub","(?m)^#([DT]\\d+)")
00065 det("sasamis2k","(?m)^;(Env|Set)\\.")
00066 det("phoenix","^[ \\d]+,[ \\d]+, \".*\"")
00067 det("vkt","(?m)^\\{\\d+ .*\\}")
00068 det("e2","^\\[\\d+\\]\\[\\d+\\]")
00069 det("powerdivx","^\\{\\d+:\\d\\d:\\d\\d\\}\\{\\d+:\\d\\d:\\d\\d\\}")
00070 det("sbt","^\\d\\d:\\d\\d:\\d\\d\\s*\\n\\d\\d:\\d\\d:\\d\\d\\s*\\n\\s*\\n")
00071 det("karaokelrc","(?m)^\\[\\d\\d:\\d\\d\\.\\d\\d\\]")
00072 det("dks","^\\[\\d\\d:\\d\\d:\\d\\d\\]")
00073 det("aqtitle","^-->> \\d+\\s*\\n")
00074 det("panimator","^\\/(c|d \\d+ \\d+)\\s*\\n")
00075 det("tmplayer","^\\d\\d:\\d\\d:\\d\\d,\\d=")
00076 det("cap32","^\\d\\d:\\d\\d:\\d\\d:\\d\\d , \\d\\d:\\d\\d:\\d\\d:\\d\\d , ")
00077 det("not_encore","(?m)^\\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d ")
00078 det("encore_ntsc","(?m)^\\d+ \\d+;\\d+;\\d+;\\d+ \\d+;\\d+;\\d+;\\d+ ")
00079 det("encore_pal","(?m)^\\d+ \\d+:\\d+:\\d+:\\d+ \\d+:\\d+:\\d+:\\d+ ")
00080 det("turbotitler","^\\d+:\\d\\d:\\d\\d\\.\\d\\d,\\d+:\\d\\d:\\d\\d\\.\\d\\d,")
00081 det("macdvdpro","^\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t")
00082 det("powerpixel","^\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t\\d\\d:\\d\\d:\\d\\d:\\d\\d\\r?\\n")
00083 det("ovr","^\\d\\d:\\d\\d:\\d\\d:\\d\\d [^[:digit:][:space:][:punct:]]")
00084 det("fab","^\\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d\\s*\\n[^[:digit:][:space:][:punct:]]")
00085 det("sonicdvd","^\\d{4} \\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d ")
00086 det("koalaplayer","(?m)^\\d+:\\d\\d:\\d\\d:[^[:digit:][:space:][:punct:]]")
00087 det("subcreator1","^\\d+:\\d\\d:\\d\\d\\.\\d+:")
00088 fmt_b("subrip", 2)
00089 insn_b(i0, i1, ASAI_CHILD, "^\\d+\\s*\\n(\\d\\d):(\\d\\d):(\\d\\d),(\\d\\d\\d)\\s+-->\\s+(\\d\\d):(\\d\\d):(\\d\\d),(\\d\\d\\d)\\s*\\r?\\n")
00090 insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000)
00091 tsp(2, 60.000000, 0.000000)
00092 tsp(3, 1.000000, 0.000000)
00093 tsp(4, 0.001000, 0.000000)
00094 insn_tse()
00095 insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000)
00096 tsp(6, 60.000000, 0.000000)
00097 tsp(7, 1.000000, 0.000000)
00098 tsp(8, 0.001000, 0.000000)
00099 insn_tse()
00100 insn_b(i1, i2, ASAI_CHILD, "(?s)^(.*?)\\s*\\n\\s*\\n")
00101 insn(i2, ASAI_SELECT); i->v.select = 1;
00102 insn_sg(i2, 4, "\\\\")
00103 repl(-1, "\\\\")
00104 insn_sge()
00105 insn_sg(i2, 4, "\\{")
00106 repl(-1, "\\{")
00107 insn_sge()
00108 insn_sg(i2, 4, "\\}")
00109 repl(-1, "\\}")
00110 insn_sge()
00111 insn_sg(i2, 4, "\\n")
00112 repl(-1, "\\n")
00113 insn_sge()
00114 insn_sg(i2, 4, "<[Bb]>")
00115 repl(-1, "{\\b1}")
00116 insn_sge()
00117 insn_sg(i2, 4, "<\\/[Bb]>")
00118 repl(-1, "{\\b0}")
00119 insn_sge()
00120 insn_sg(i2, 4, "<[Ii]>")
00121 repl(-1, "{\\i1}")
00122 insn_sge()
00123 insn_sg(i2, 4, "<\\/[Ii]>")
00124 repl(-1, "{\\i0}")
00125 insn_sge()
00126 insn_sg(i2, 4, "<\\/(.*?)>")
00127 repl(-1, "{")
00128 repl(12, NULL)
00129 repl(-1, "3}")
00130 insn_sge()
00131 insn_sg(i2, 4, "<")
00132 repl(-1, "<")
00133 insn_sge()
00134 insn_sg(i2, 4, ">")
00135 repl(-1, ">")
00136 insn_sge()
00137 insn_sg(i2, 4, "&")
00138 repl(-1, "&")
00139 insn_sge()
00140 insn_sg(i2, 4, "^")
00141 repl(-1, ",,,0,0,0,,")
00142 insn_sge()
00143 insn(i2, 6);
00144 insn(i2, 0);
00145 insn(i2, ASAI_BREAK); i->v.break_depth = 1;
00146 insn_e()
00147 insn_e()
00148 fmt_e()
00149 fmt_b("encore_pal", 1)
00150 insn(i0, ASAI_FPS); i->v.fps_value = 25.000000;
00151 insn_b(i0, i1, ASAI_CHILD, "^\\d+ (\\d+):(\\d+):(\\d+):(\\d+) (\\d+):(\\d+):(\\d+):(\\d+) (.*(\\n[^\\d].*)*)\\n")
00152 insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000)
00153 tsp(2, 60.000000, 0.000000)
00154 tsp(3, 1.000000, 0.000000)
00155 tsp(4, 0.000000, 1.000000)
00156 insn_tse()
00157 insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000)
00158 tsp(6, 60.000000, 0.000000)
00159 tsp(7, 1.000000, 0.000000)
00160 tsp(8, 0.000000, 1.000000)
00161 insn_tse()
00162 insn(i1, ASAI_SELECT); i->v.select = 9;
00163 insn_sg(i1, 4, "\\/\\/")
00164 repl(-1, "\x0a")
00165 insn_sge()
00166 insn(i1, 6);
00167 insn(i1, 0);
00168 insn_e()
00169 fmt_e()
00170 fmt_b("encore_ntsc", 1)
00171 insn(i0, ASAI_FPS); i->v.fps_value = 29.969999;
00172 insn_b(i0, i1, ASAI_CHILD, "^\\d+ (\\d+);(\\d+);(\\d+);(\\d+) (\\d+);(\\d+);(\\d+);(\\d+) (.*(\\n[^\\d].*)*)\\n")
00173 insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000)
00174 tsp(2, 60.000000, 0.000000)
00175 tsp(3, 1.000000, 0.000000)
00176 tsp(4, 0.000000, 1.000000)
00177 insn_tse()
00178 insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000)
00179 tsp(6, 60.000000, 0.000000)
00180 tsp(7, 1.000000, 0.000000)
00181 tsp(8, 0.000000, 1.000000)
00182 insn_tse()
00183 insn(i1, ASAI_SELECT); i->v.select = 9;
00184 insn_sg(i1, 4, "\\/\\/")
00185 repl(-1, "\x0a")
00186 insn_sge()
00187 insn(i1, 6);
00188 insn(i1, 0);
00189 insn_e()
00190 fmt_e()
00191 fmt_b("microdvd", 1)
00192 insn_b(i0, i1, ASAI_CHILD, "^\\{\\s*(\\d+)\\}\\{\\s*(\\d+)\\}(.*?)\\s*\\n")
00193 insn_ts(i1, 8, -1); tsp(1, 0.000000, 1.000000)
00194 insn_tse()
00195 insn_ts(i1, 9, -1); tsp(2, 0.000000, 1.000000)
00196 insn_tse()
00197 insn(i1, ASAI_SELECT); i->v.select = 3;
00198 insn_sg(i1, 4, "\\|")
00199 repl(-1, "\x0a")
00200 insn_sge()
00201 insn(i1, 6);
00202 insn(i1, 0);
00203 insn_e()
00204 fmt_e()
00205 fmt_b("vkt", 1)
00206 insn_b(i0, i1, ASAI_CHILD, "^#.*\\n")
00207 insn_e()
00208 insn_b(i0, i1, ASAI_CHILD, "^{(\\d+) (.*)}\\s*\\n")
00209 insn_ts(i1, 9, -1); tsp(1, 0.000000, 1.000000)
00210 insn_tse()
00211 insn(i1, 0);
00212 insn_ts(i1, 8, -1); tsp(1, 0.000000, 1.000000)
00213 insn_tse()
00214 insn(i1, ASAI_SELECT); i->v.select = 2;
00215 insn(i1, 6);
00216 insn_e()
00217 fmt_e()
00218
00219 }