summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-11-05 15:31:47 -0600
committerDudemanguy <random342@airmail.cc>2023-12-08 18:14:06 +0000
commit443c2487d7dd1039e297abad6398135b3c463018 (patch)
tree96faabcc0a3bd8c8ace303f4a5bc4e51e533be14 /sub
parentce958b77424327a30a3026c226a1db72f26e3543 (diff)
downloadmpv-443c2487d7dd1039e297abad6398135b3c463018.tar.bz2
mpv-443c2487d7dd1039e297abad6398135b3c463018.tar.xz
filter_sdh: add full width parentheses to the enclosures string
Since these are technically parentheses, we'll treat them the same way as normal parenthesis. Fixes #11155.
Diffstat (limited to 'sub')
-rw-r--r--sub/filter_sdh.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sub/filter_sdh.c b/sub/filter_sdh.c
index f2342bd87e..da5337d850 100644
--- a/sub/filter_sdh.c
+++ b/sub/filter_sdh.c
@@ -34,8 +34,9 @@
// It is for filtering ASS encoded subtitles
static const char *const enclosure_pair[][2] = {
- {"(", ")"},
- {"[", "]"},
+ {"(", ")"},
+ {"[", "]"},
+ {"\uFF08", "\uFF09"},
{0},
};
@@ -249,15 +250,16 @@ static bool skip_enclosed(struct sd_filter *sd, char **rpp, struct buffer *buf,
bool filter_harder = sd->opts->sub_filter_SDH_harder;
char *rp = *rpp;
int old_pos = buf->pos;
+ bool parenthesis = strcmp(left, "(") == 0 || strcmp(left, "\uFF08") == 0;
// skip past the left character
rp += get_char_bytes(rp);
// skip past valid data searching for the right character
- bool only_digits = strcmp(left, "(") == 0;
+ bool only_digits = parenthesis;
while (*rp && rp[0] != right[0]) {
if (rp[0] == '{') {
copy_ass(sd, &rp, buf);
- } else if (strcmp(left, "(") == 0 && ((mp_isalpha(rp[0]) &&
+ } else if (parenthesis && ((mp_isalpha(rp[0]) &&
(filter_harder || mp_isupper(rp[0]) || rp[0] == 'l')) ||
mp_isdigit(rp[0]) ||
rp[0] == ' ' || rp[0] == '\'' || rp[0] == '#' ||
@@ -266,7 +268,7 @@ static bool skip_enclosed(struct sd_filter *sd, char **rpp, struct buffer *buf,
if (!mp_isdigit(rp[0]))
only_digits = false;
rp++;
- } else if (strcmp(left, "(") == 0) {
+ } else if (parenthesis) {
buf->pos = old_pos;
return false;
} else {