37 char *f = strchr(s, c);
38 return f ? (f -
s) : -1;
50 #define MICRODVD_PERSISTENT_OFF 0
51 #define MICRODVD_PERSISTENT_ON 1
52 #define MICRODVD_PERSISTENT_OPENED 2
55 #define MICRODVD_TAGS "cfshyYpo"
63 memcpy(&tags[tag_index], &tag,
sizeof(tag));
67 #define MICRODVD_STYLES "ibus"
89 char tag_char = *(s + 1);
92 if (!tag_char || *(s + 2) !=
':')
102 while (*s && *s !=
'}') {
105 if (style_index >= 0)
106 tag.
data1 |= (1 << style_index);
120 while (*s ==
'$' || *s ==
'#')
122 tag.
data1 = strtol(s, &s, 16) & 0x00ffffff;
146 tag.
data1 = strtol(s, &s, 10);
168 tag.
data1 = (*s++ ==
'1');
177 tag.
data1 = strtol(s, &s, 10);
181 tag.
data2 = strtol(s, &s, 10);
206 switch (tags[i].
key) {
210 if (tags[i].
data1 & (1 << sidx))
224 av_bprintf(new_line,
"{\\fs%d}", tags[i].data1);
228 if (tags[i].data1 == 0)
234 tags[i].data1, tags[i].
data2);
250 switch (tags[i].
key) {
254 if (tags[i].
data1 & (1 << sidx))
281 struct microdvd_tag tags[sizeof(MICRODVD_TAGS) - 1] = {{0}};
283 if (avpkt->
size <= 0)
289 while (line < end && *line) {
296 while (line < end && *line && *line !=
'|') {
302 if (line < end && *line ==
'|') {
322 *got_sub_ptr = sub->num_rects > 0;
336 struct microdvd_tag tags[sizeof(MICRODVD_TAGS) - 1] = {{0}};
347 if (tags[i].
data1 & (1 << sidx)) {
349 case 'i': italic = 1;
break;
350 case 'b': bold = 1;
break;
351 case 'u': underline = 1;
break;
357 case 'c': color = tags[i].
data1;
break;
358 case 's': font_size = tags[i].
data1;
break;
359 case 'p': alignment = 8;
break;
371 underline, alignment);