mirror of https://github.com/mpv-player/mpv
sd_ass: add `sub-vsfilter-bidi-compat` to enable vsfilter bidi compat
Enable ASS_FEATURE_{WHOLE_TEXT_LAYOUT, BIDI_BRACKETS} and auto base detection by default, and add an option to disable this if needed. This is strictly an improvement for webvtt files as they always use auto base detection. This _fixes_ right-to-left text rendering for webvtt files which correctly mark rtl/ltr. Webvtt files obtained from sources which sideload the RTL information through css also see an improvement due to the auto detection. Generally SRT files also want this, but some are also written to workaround VSFilter quirks. See also: https://github.com/mpv-player/mpv/pull/12985#issuecomment-1839565138
This commit is contained in:
parent
f862d3b6cd
commit
805577c792
|
@ -2560,6 +2560,15 @@ Subtitles
|
|||
offset scale factor, not what the video filter chain or the video output
|
||||
use.
|
||||
|
||||
``--sub-vsfilter-bidi-compat=<yes|no>``
|
||||
Set implicit bidi detection to ``ltr`` instead of ``auto`` to match ASS'
|
||||
default. This also disables libass' incompatible extensions. This currently
|
||||
includes bracket pair matching according to the revised Unicode
|
||||
Bidirectional Algorithm introduced in Unicode 6.3, and also affects how BiDi
|
||||
runs are split and processed, as well as soft linewrapping of unicode text.
|
||||
|
||||
This affects plaintext (non-ASS) subtitles only. Default: no.
|
||||
|
||||
``--sub-ass-vsfilter-color-compat=<basic|full|force-601|no>``
|
||||
Mangle colors like (xy-)vsfilter do (default: basic). Historically, VSFilter
|
||||
was not color space aware. This was no problem as long as the color space
|
||||
|
|
|
@ -309,6 +309,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
|
|||
{"sub-ass-vsfilter-color-compat", OPT_CHOICE(ass_vsfilter_color_compat,
|
||||
{"no", 0}, {"basic", 1}, {"full", 2}, {"force-601", 3})},
|
||||
{"sub-ass-vsfilter-blur-compat", OPT_BOOL(ass_vsfilter_blur_compat)},
|
||||
{"sub-vsfilter-bidi-compat", OPT_BOOL(sub_vsfilter_bidi_compat)},
|
||||
{"embeddedfonts", OPT_BOOL(use_embedded_fonts), .flags = UPDATE_SUB_HARD},
|
||||
{"sub-ass-style-overrides", OPT_STRINGLIST(ass_style_override_list),
|
||||
.flags = UPDATE_SUB_HARD},
|
||||
|
|
|
@ -105,6 +105,7 @@ struct mp_subtitle_opts {
|
|||
bool ass_vsfilter_aspect_compat;
|
||||
int ass_vsfilter_color_compat;
|
||||
bool ass_vsfilter_blur_compat;
|
||||
bool sub_vsfilter_bidi_compat;
|
||||
bool use_embedded_fonts;
|
||||
char **ass_style_override_list;
|
||||
char *ass_styles_file;
|
||||
|
|
10
sub/sd_ass.c
10
sub/sd_ass.c
|
@ -527,8 +527,16 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
|
|||
ass_set_hinting(priv, set_hinting);
|
||||
ass_set_line_spacing(priv, set_line_spacing);
|
||||
#if LIBASS_VERSION >= 0x01600010
|
||||
if (converted)
|
||||
if (converted) {
|
||||
ass_track_set_feature(track, ASS_FEATURE_WRAP_UNICODE, 1);
|
||||
if (!opts->sub_vsfilter_bidi_compat) {
|
||||
for (int n = 0; n < track->n_styles; n++) {
|
||||
track->styles[n].Encoding = -1;
|
||||
}
|
||||
ass_track_set_feature(track, ASS_FEATURE_BIDI_BRACKETS, 1);
|
||||
ass_track_set_feature(track, ASS_FEATURE_WHOLE_TEXT_LAYOUT, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (converted) {
|
||||
bool override_playres = true;
|
||||
|
|
Loading…
Reference in New Issue