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"
73 char tag_char = *(s + 1);
76 if (!tag_char || *(s + 2) !=
':')
86 while (*s && *s !=
'}') {
90 tag.
data1 |= (1 << style_index);
106 tag.
data1 = strtol(s, &s, 16) & 0x00ffffff;
130 tag.
data1 = strtol(s, &s, 10);
152 tag.
data1 = (*s++ ==
'1');
161 tag.
data1 = strtol(s, &s, 10);
165 tag.
data2 = strtol(s, &s, 10);
190 switch (tags[i].
key) {
194 if (tags[i].
data1 & (1 << sidx))
208 av_bprintf(new_line,
"{\\fs%d}", tags[i].data1);
212 if (tags[i].data1 == 0)
218 tags[i].data1, tags[i].
data2);
234 switch (tags[i].
key) {
238 if (tags[i].
data1 & (1 << sidx))
267 struct microdvd_tag tags[sizeof(MICRODVD_TAGS) - 1] = {{0}};
269 if (avpkt->
size <= 0)
273 if (sscanf(line,
"{%*d}{%*[0123456789]}%c", &c) == 1 &&
274 line[avpkt->
size - 1] ==
'\n') {
276 "information and a trailing line break). You need to upgrade "
277 "your libavformat or sanitize your packet.\n");
284 while (line < end && *line) {
291 while (line < end && *line && *line !=
'|') {
297 if (line < end && *line ==
'|') {
318 *got_sub_ptr = sub->num_rects > 0;
332 struct microdvd_tag tags[sizeof(MICRODVD_TAGS) - 1] = {{0}};
343 if (tags[i].
data1 & (1 << sidx)) {
345 case 'i': italic = 1;
break;
346 case 'b': bold = 1;
break;
347 case 'u': underline = 1;
break;
353 case 'c': color = tags[i].
data1;
break;
354 case 's': font_size = tags[i].
data1;
break;
355 case 'p': alignment = 8;
break;
367 underline, alignment);