42 const unsigned char *ptr = p->
buf;
46 if (sscanf(ptr,
"%*u:%*u:%*u.%*u,%*u:%*u:%*u.%*u%c", &c) == 1)
48 if (!strncmp(ptr,
"[INFORMATION]", 13))
56 int hh1, mm1, ss1, ms1;
57 int hh2, mm2, ss2, ms2;
59 if (sscanf(s,
"%u:%u:%u.%u,%u:%u:%u.%u",
60 &hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) {
61 end = (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2;
62 *start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;
63 *duration = end - *
start;
74 int res = 0, new_event = 1;
95 line[strcspn(line,
"\r\n")] = 0;
97 if (line[0] ==
'[' && strncmp(line,
"[br]", 4)) {
100 if (strstr(line,
"[COLF]") || strstr(line,
"[SIZE]") ||
101 strstr(line,
"[FONT]") || strstr(line,
"[STYLE]"))
106 if (!strncmp(line,
"[END INFORMATION]", 17) || !strncmp(line,
"[SUBTITLE]", 10)) {
111 }
else if (strncmp(line,
"[INFORMATION]", 13)) {
114 char key[32],
value[128];
116 for (i = 1; i <
sizeof(key) - 1 && line[i] && line[i] !=
']'; i++)
122 while (line[i] ==
' ')
124 while (j <
sizeof(value) - 1 && line[i] && line[i] !=
']')
125 value[j++] = line[i++];
131 }
else if (
read_ts(line, &pts_start, &duration) >= 0) {
149 sub->
pts = pts_start;
170 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
174 min_ts, ts, max_ts, flags);