mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
sub: enhance SDH filtering
It is not uncommon with a speaker label with [xxxx] inside. They should also be filtered out.
This commit is contained in:
@@ -83,6 +83,8 @@ static void copy_ass(struct sd *sd, char **rpp, struct buffer *buf)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool skip_bracketed(struct sd *sd, char **rpp, struct buffer *buf);
|
||||||
|
|
||||||
// check for speaker label, like MAN:
|
// check for speaker label, like MAN:
|
||||||
// normal subtitles may include mixed case text with : after so
|
// normal subtitles may include mixed case text with : after so
|
||||||
// only upper case is accepted and lower case l which for some
|
// only upper case is accepted and lower case l which for some
|
||||||
@@ -121,6 +123,12 @@ static void skip_speaker_label(struct sd *sd, char **rpp, struct buffer *buf)
|
|||||||
while (*rp && rp[0] != ':') {
|
while (*rp && rp[0] != ':') {
|
||||||
if (rp[0] == '{') {
|
if (rp[0] == '{') {
|
||||||
copy_ass(sd, &rp, buf);
|
copy_ass(sd, &rp, buf);
|
||||||
|
} else if (rp[0] == '[') {
|
||||||
|
// not uncommon with [xxxx]: which should also be skipped
|
||||||
|
if (!skip_bracketed(sd, &rp, buf)) {
|
||||||
|
buf->pos = old_pos;
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if ((mp_isalpha(rp[0]) &&
|
} else if ((mp_isalpha(rp[0]) &&
|
||||||
(filter_harder || mp_isupper(rp[0]) || rp[0] == 'l')) ||
|
(filter_harder || mp_isupper(rp[0]) || rp[0] == 'l')) ||
|
||||||
mp_isdigit(rp[0]) ||
|
mp_isdigit(rp[0]) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user