| 1160 | } |
| 1161 | |
| 1162 | static void fixSubtitleOverlap( sync_stream_t * stream ) |
| 1163 | { |
| 1164 | hb_buffer_t * buf; |
| 1165 | |
| 1166 | buf = hb_list_item(stream->in_queue, 0); |
| 1167 | if (buf == NULL || (buf->s.flags & HB_BUF_FLAG_EOS) || |
| 1168 | (buf->s.flags & HB_BUF_FLAG_EOF)) |
| 1169 | { |
| 1170 | // marker to indicate the end of a subtitle |
| 1171 | return; |
| 1172 | } |
| 1173 | // Theoretically only SSA subs can overlap, |
| 1174 | // but there are some SRT subs out there with |
| 1175 | // overlapping samples, so let's try to preserve them too |
| 1176 | if (stream->subtitle.subtitle->source != SSASUB && |
| 1177 | stream->subtitle.subtitle->source != IMPORTSSA && |
| 1178 | stream->subtitle.subtitle->source != IMPORTSRT && |
| 1179 | stream->subtitle.subtitle->config.dest == PASSTHRUSUB && |
| 1180 | buf->s.start <= stream->last_pts) |
| 1181 | { |
| 1182 | int64_t overlap; |
| 1183 | overlap = stream->last_pts - buf->s.start; |
| 1184 | hb_log("sync: subtitle 0x%x time went backwards %d ms, PTS %"PRId64"", |
| 1185 | stream->subtitle.subtitle->id, (int)overlap / 90, |
| 1186 | buf->s.start); |
| 1187 | hb_list_rem(stream->in_queue, buf); |
| 1188 | hb_buffer_close(&buf); |
| 1189 | } |
| 1190 | } |
| 1191 | |
| 1192 | static void fixStreamTimestamps( sync_stream_t * stream ) |
| 1193 | { |
no test coverage detected