| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
void preparse_add() |
|---|
| 5 |
{ |
|---|
| 6 |
#define insn_init { NULL, NULL, 0, { 0 } } |
|---|
| 7 |
#define det(n,r) { static struct asa_import_detect d = { NULL }; \ |
|---|
| 8 |
d.name = n; \ |
|---|
| 9 |
if (!asa_pcre_compile(&d.re, r)) \ |
|---|
| 10 |
asa_det_last = &(*asa_det_last = &d)->next; } |
|---|
| 11 |
#define fmt_b(n,t) { static struct asa_import_format f = { NULL }; \ |
|---|
| 12 |
struct asa_import_insn *i, **i0 = NULL; \ |
|---|
| 13 |
f.name = n; f.target = t; |
|---|
| 14 |
#define fmt_e() \ |
|---|
| 15 |
} |
|---|
| 16 |
#define insn(n,t) { static struct asa_import_insn ii = insn_init; \ |
|---|
| 17 |
i = ⅈ *n = i; n = &i->next; i->insn = t; } |
|---|
| 18 |
#define insn_b(n, m, t, r) { struct asa_import_insn **m;\ |
|---|
| 19 |
{ static struct asa_import_insn ii = insn_init; \ |
|---|
| 20 |
i = ⅈ ii.insn = t; \ |
|---|
| 21 |
m = &ii.v.child.insns; \ |
|---|
| 22 |
}\ |
|---|
| 23 |
if (!asa_pcre_compile(&i->v.child.regex, r)) { \ |
|---|
| 24 |
*n = i; n = &i->next; |
|---|
| 25 |
#define insn_e() } } |
|---|
| 26 |
#define insn_sg(n, t, r) { struct asa_repl **repl;\ |
|---|
| 27 |
{ static struct asa_import_insn ii = insn_init; \ |
|---|
| 28 |
i = ⅈ ii.insn = t; \ |
|---|
| 29 |
repl = &ii.v.sg.repl; \ |
|---|
| 30 |
}\ |
|---|
| 31 |
if (!asa_pcre_compile(&i->v.sg.regex, r)) { \ |
|---|
| 32 |
*n = i; n = &i->next; |
|---|
| 33 |
#define insn_sge() } } |
|---|
| 34 |
#define repl(g, t) { static struct asa_repl r = { NULL, g, t }; \ |
|---|
| 35 |
*repl = &r; repl = &r.next; } |
|---|
| 36 |
#define insn_ts(n, t, d) { struct asa_tspec **tsp;\ |
|---|
| 37 |
{ static struct asa_import_insn ii = insn_init; \ |
|---|
| 38 |
i = ⅈ ii.insn = t; ii.v.tspec.delta_select = d; \ |
|---|
| 39 |
tsp = &ii.v.tspec.tsp; \ |
|---|
| 40 |
}\ |
|---|
| 41 |
*n = i; n = &i->next; |
|---|
| 42 |
#define insn_tse() } |
|---|
| 43 |
#define tsp(g, m, f) { static struct asa_tspec t = { NULL, g, m, f }; \ |
|---|
| 44 |
*tsp = &t; tsp = &t.next; } |
|---|
| 45 |
|
|---|
| 46 |
det("qttext","^\\{QTtext\\}") |
|---|
| 47 |
det("rtf","^\\{\\\\rtf") |
|---|
| 48 |
det("viplay","^\\{\\* VIPLAY") |
|---|
| 49 |
det("zerog","^% Zero G") |
|---|
| 50 |
det("sst","^SST ") |
|---|
| 51 |
det("philips","^# PHILIPS SVCD DESIGNER") |
|---|
| 52 |
det("ulead","^#Ulead subtitle") |
|---|
| 53 |
det("sonicscenarist","^st_format\\s*\\d") |
|---|
| 54 |
det("dvdjunior","^Subtitle File Mark") |
|---|
| 55 |
det("captionsdat","^\\0\\r#") |
|---|
| 56 |
det("inscriber","^@@.*\\n@@\\d Created by URUSoft") |
|---|
| 57 |
det("ssa","(?mi)^(ScriptType:|\\[Script Info)") |
|---|
| 58 |
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") |
|---|
| 59 |
det("microdvd","^\\{\\d+\\}\\{\\d+\\}") |
|---|
| 60 |
det("sami","(?i)<SAMI") |
|---|
| 61 |
det("smil","(?i)<SMIL") |
|---|
| 62 |
det("smil_rt","(?i)<WINDOW") |
|---|
| 63 |
det("html","(?i)<HTML") |
|---|
| 64 |
det("jacosub","(?m)^#([DT]\\d+)") |
|---|
| 65 |
det("sasamis2k","(?m)^;(Env|Set)\\.") |
|---|
| 66 |
det("phoenix","^[ \\d]+,[ \\d]+, \".*\"") |
|---|
| 67 |
det("vkt","(?m)^\\{\\d+ .*\\}") |
|---|
| 68 |
det("e2","^\\[\\d+\\]\\[\\d+\\]") |
|---|
| 69 |
det("powerdivx","^\\{\\d+:\\d\\d:\\d\\d\\}\\{\\d+:\\d\\d:\\d\\d\\}") |
|---|
| 70 |
det("sbt","^\\d\\d:\\d\\d:\\d\\d\\s*\\n\\d\\d:\\d\\d:\\d\\d\\s*\\n\\s*\\n") |
|---|
| 71 |
det("karaokelrc","(?m)^\\[\\d\\d:\\d\\d\\.\\d\\d\\]") |
|---|
| 72 |
det("dks","^\\[\\d\\d:\\d\\d:\\d\\d\\]") |
|---|
| 73 |
det("aqtitle","^-->> \\d+\\s*\\n") |
|---|
| 74 |
det("panimator","^\\/(c|d \\d+ \\d+)\\s*\\n") |
|---|
| 75 |
det("tmplayer","^\\d\\d:\\d\\d:\\d\\d,\\d=") |
|---|
| 76 |
det("cap32","^\\d\\d:\\d\\d:\\d\\d:\\d\\d , \\d\\d:\\d\\d:\\d\\d:\\d\\d , ") |
|---|
| 77 |
det("not_encore","(?m)^\\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d ") |
|---|
| 78 |
det("encore_ntsc","(?m)^\\d+ \\d+;\\d+;\\d+;\\d+ \\d+;\\d+;\\d+;\\d+ ") |
|---|
| 79 |
det("encore_pal","(?m)^\\d+ \\d+:\\d+:\\d+:\\d+ \\d+:\\d+:\\d+:\\d+ ") |
|---|
| 80 |
det("turbotitler","^\\d+:\\d\\d:\\d\\d\\.\\d\\d,\\d+:\\d\\d:\\d\\d\\.\\d\\d,") |
|---|
| 81 |
det("macdvdpro","^\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t") |
|---|
| 82 |
det("powerpixel","^\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t\\d\\d:\\d\\d:\\d\\d:\\d\\d\\r?\\n") |
|---|
| 83 |
det("ovr","^\\d\\d:\\d\\d:\\d\\d:\\d\\d [^[:digit:][:space:][:punct:]]") |
|---|
| 84 |
det("fab","^\\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d\\s*\\n[^[:digit:][:space:][:punct:]]") |
|---|
| 85 |
det("sonicdvd","^\\d{4} \\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d ") |
|---|
| 86 |
det("koalaplayer","(?m)^\\d+:\\d\\d:\\d\\d:[^[:digit:][:space:][:punct:]]") |
|---|
| 87 |
det("subcreator1","^\\d+:\\d\\d:\\d\\d\\.\\d+:") |
|---|
| 88 |
fmt_b("subrip", 2) |
|---|
| 89 |
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") |
|---|
| 90 |
insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000) |
|---|
| 91 |
tsp(2, 60.000000, 0.000000) |
|---|
| 92 |
tsp(3, 1.000000, 0.000000) |
|---|
| 93 |
tsp(4, 0.001000, 0.000000) |
|---|
| 94 |
insn_tse() |
|---|
| 95 |
insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000) |
|---|
| 96 |
tsp(6, 60.000000, 0.000000) |
|---|
| 97 |
tsp(7, 1.000000, 0.000000) |
|---|
| 98 |
tsp(8, 0.001000, 0.000000) |
|---|
| 99 |
insn_tse() |
|---|
| 100 |
insn_b(i1, i2, ASAI_CHILD, "(?s)^(.*?)\\s*\\n\\s*\\n") |
|---|
| 101 |
insn(i2, ASAI_SELECT); i->v.select = 1; |
|---|
| 102 |
insn_sg(i2, 4, "\\\\") |
|---|
| 103 |
repl(-1, "\\\\") |
|---|
| 104 |
insn_sge() |
|---|
| 105 |
insn_sg(i2, 4, "\\{") |
|---|
| 106 |
repl(-1, "\\{") |
|---|
| 107 |
insn_sge() |
|---|
| 108 |
insn_sg(i2, 4, "\\}") |
|---|
| 109 |
repl(-1, "\\}") |
|---|
| 110 |
insn_sge() |
|---|
| 111 |
insn_sg(i2, 4, "\\n") |
|---|
| 112 |
repl(-1, "\\n") |
|---|
| 113 |
insn_sge() |
|---|
| 114 |
insn_sg(i2, 4, "<[Bb]>") |
|---|
| 115 |
repl(-1, "{\\b1}") |
|---|
| 116 |
insn_sge() |
|---|
| 117 |
insn_sg(i2, 4, "<\\/[Bb]>") |
|---|
| 118 |
repl(-1, "{\\b0}") |
|---|
| 119 |
insn_sge() |
|---|
| 120 |
insn_sg(i2, 4, "<[Ii]>") |
|---|
| 121 |
repl(-1, "{\\i1}") |
|---|
| 122 |
insn_sge() |
|---|
| 123 |
insn_sg(i2, 4, "<\\/[Ii]>") |
|---|
| 124 |
repl(-1, "{\\i0}") |
|---|
| 125 |
insn_sge() |
|---|
| 126 |
insn_sg(i2, 4, "<\\/(.*?)>") |
|---|
| 127 |
repl(-1, "{") |
|---|
| 128 |
repl(12, NULL) |
|---|
| 129 |
repl(-1, "3}") |
|---|
| 130 |
insn_sge() |
|---|
| 131 |
insn_sg(i2, 4, "<") |
|---|
| 132 |
repl(-1, "<") |
|---|
| 133 |
insn_sge() |
|---|
| 134 |
insn_sg(i2, 4, ">") |
|---|
| 135 |
repl(-1, ">") |
|---|
| 136 |
insn_sge() |
|---|
| 137 |
insn_sg(i2, 4, "&") |
|---|
| 138 |
repl(-1, "&") |
|---|
| 139 |
insn_sge() |
|---|
| 140 |
insn_sg(i2, 4, "^") |
|---|
| 141 |
repl(-1, ",,,0,0,0,,") |
|---|
| 142 |
insn_sge() |
|---|
| 143 |
insn(i2, 6); |
|---|
| 144 |
insn(i2, 0); |
|---|
| 145 |
insn(i2, ASAI_BREAK); i->v.break_depth = 1; |
|---|
| 146 |
insn_e() |
|---|
| 147 |
insn_e() |
|---|
| 148 |
fmt_e() |
|---|
| 149 |
fmt_b("encore_pal", 1) |
|---|
| 150 |
insn(i0, ASAI_FPS); i->v.fps_value = 25.000000; |
|---|
| 151 |
insn_b(i0, i1, ASAI_CHILD, "^\\d+ (\\d+):(\\d+):(\\d+):(\\d+) (\\d+):(\\d+):(\\d+):(\\d+) (.*(\\n[^\\d].*)*)\\n") |
|---|
| 152 |
insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000) |
|---|
| 153 |
tsp(2, 60.000000, 0.000000) |
|---|
| 154 |
tsp(3, 1.000000, 0.000000) |
|---|
| 155 |
tsp(4, 0.000000, 1.000000) |
|---|
| 156 |
insn_tse() |
|---|
| 157 |
insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000) |
|---|
| 158 |
tsp(6, 60.000000, 0.000000) |
|---|
| 159 |
tsp(7, 1.000000, 0.000000) |
|---|
| 160 |
tsp(8, 0.000000, 1.000000) |
|---|
| 161 |
insn_tse() |
|---|
| 162 |
insn(i1, ASAI_SELECT); i->v.select = 9; |
|---|
| 163 |
insn_sg(i1, 4, "\\/\\/") |
|---|
| 164 |
repl(-1, "\x0a") |
|---|
| 165 |
insn_sge() |
|---|
| 166 |
insn(i1, 6); |
|---|
| 167 |
insn(i1, 0); |
|---|
| 168 |
insn_e() |
|---|
| 169 |
fmt_e() |
|---|
| 170 |
fmt_b("encore_ntsc", 1) |
|---|
| 171 |
insn(i0, ASAI_FPS); i->v.fps_value = 29.969999; |
|---|
| 172 |
insn_b(i0, i1, ASAI_CHILD, "^\\d+ (\\d+);(\\d+);(\\d+);(\\d+) (\\d+);(\\d+);(\\d+);(\\d+) (.*(\\n[^\\d].*)*)\\n") |
|---|
| 173 |
insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000) |
|---|
| 174 |
tsp(2, 60.000000, 0.000000) |
|---|
| 175 |
tsp(3, 1.000000, 0.000000) |
|---|
| 176 |
tsp(4, 0.000000, 1.000000) |
|---|
| 177 |
insn_tse() |
|---|
| 178 |
insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000) |
|---|
| 179 |
tsp(6, 60.000000, 0.000000) |
|---|
| 180 |
tsp(7, 1.000000, 0.000000) |
|---|
| 181 |
tsp(8, 0.000000, 1.000000) |
|---|
| 182 |
insn_tse() |
|---|
| 183 |
insn(i1, ASAI_SELECT); i->v.select = 9; |
|---|
| 184 |
insn_sg(i1, 4, "\\/\\/") |
|---|
| 185 |
repl(-1, "\x0a") |
|---|
| 186 |
insn_sge() |
|---|
| 187 |
insn(i1, 6); |
|---|
| 188 |
insn(i1, 0); |
|---|
| 189 |
insn_e() |
|---|
| 190 |
fmt_e() |
|---|
| 191 |
fmt_b("microdvd", 1) |
|---|
| 192 |
insn_b(i0, i1, ASAI_CHILD, "^\\{\\s*(\\d+)\\}\\{\\s*(\\d+)\\}(.*?)\\s*\\n") |
|---|
| 193 |
insn_ts(i1, 8, -1); tsp(1, 0.000000, 1.000000) |
|---|
| 194 |
insn_tse() |
|---|
| 195 |
insn_ts(i1, 9, -1); tsp(2, 0.000000, 1.000000) |
|---|
| 196 |
insn_tse() |
|---|
| 197 |
insn(i1, ASAI_SELECT); i->v.select = 3; |
|---|
| 198 |
insn_sg(i1, 4, "\\|") |
|---|
| 199 |
repl(-1, "\x0a") |
|---|
| 200 |
insn_sge() |
|---|
| 201 |
insn(i1, 6); |
|---|
| 202 |
insn(i1, 0); |
|---|
| 203 |
insn_e() |
|---|
| 204 |
fmt_e() |
|---|
| 205 |
fmt_b("vkt", 1) |
|---|
| 206 |
insn_b(i0, i1, ASAI_CHILD, "^#.*\\n") |
|---|
| 207 |
insn_e() |
|---|
| 208 |
insn_b(i0, i1, ASAI_CHILD, "^{(\\d+) (.*)}\\s*\\n") |
|---|
| 209 |
insn_ts(i1, 9, -1); tsp(1, 0.000000, 1.000000) |
|---|
| 210 |
insn_tse() |
|---|
| 211 |
insn(i1, 0); |
|---|
| 212 |
insn_ts(i1, 8, -1); tsp(1, 0.000000, 1.000000) |
|---|
| 213 |
insn_tse() |
|---|
| 214 |
insn(i1, ASAI_SELECT); i->v.select = 2; |
|---|
| 215 |
insn(i1, 6); |
|---|
| 216 |
insn_e() |
|---|
| 217 |
fmt_e() |
|---|
| 218 |
|
|---|
| 219 |
} |
|---|