mirror of
https://github.com/mpv-player/mpv
synced 2025-03-08 07:08:12 +00:00
sub: adjustments to --ass-style-override option
Now requires newest libass git. Since this feature wasn't part of a libass release yet, I'm not bothering making the mpv code compatible with as how it was previously implemented (it will just be disabled with any older libass). CC: @mpv-player/stable (because mpv-build uses libass git, and this breaks the feature)
This commit is contained in:
parent
ca038d9a22
commit
41b2927f39
@ -1171,6 +1171,7 @@ Subtitles
|
||||
:yes: Apply all the ``--ass-*`` style override options. Changing the default
|
||||
for any of these options can lead to incorrect subtitle rendering
|
||||
(default).
|
||||
:signfs: like ``yes``, but apply ``--sub-scale`` only to signs
|
||||
:no: Render subtitles as forced by subtitle scripts.
|
||||
:force: Try to force the font style as defined by the ``--sub-text-*``
|
||||
options. Requires a modified libass, can break rendering easily.
|
||||
|
@ -334,7 +334,7 @@ const m_option_t mp_opts[] = {
|
||||
OPT_CHOICE("ass-shaper", ass_shaper, 0,
|
||||
({"simple", 0}, {"complex", 1})),
|
||||
OPT_CHOICE("ass-style-override", ass_style_override, 0,
|
||||
({"no", 0}, {"yes", 1}, {"force", 3})),
|
||||
({"no", 0}, {"yes", 1}, {"force", 3}, {"signfs", 4})),
|
||||
OPT_FLAG("sub-scale-with-window", sub_scale_with_window, 0),
|
||||
OPT_FLAG("osd-bar", osd_bar_visible, 0),
|
||||
OPT_FLOATRANGE("osd-bar-align-x", osd_bar_align_x, 0, -1.0, +1.0),
|
||||
|
11
sub/ass_mp.c
11
sub/ass_mp.c
@ -136,13 +136,11 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
|
||||
float set_line_spacing = 0;
|
||||
float set_font_scale = 1;
|
||||
int set_hinting = 0;
|
||||
int set_force_override = 0;
|
||||
if (opts->ass_style_override) {
|
||||
set_use_margins = opts->ass_use_margins;
|
||||
set_sub_pos = 100 - opts->sub_pos;
|
||||
set_line_spacing = opts->ass_line_spacing;
|
||||
set_hinting = opts->ass_hinting;
|
||||
set_force_override = opts->ass_style_override == 3;
|
||||
set_font_scale = opts->sub_scale;
|
||||
if (opts->sub_scale_with_window) {
|
||||
int vidh = dim->h - (dim->mt + dim->mb);
|
||||
@ -157,8 +155,13 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
|
||||
#if LIBASS_VERSION >= 0x01000000
|
||||
ass_set_shaper(priv, opts->ass_shaper);
|
||||
#endif
|
||||
#if LIBASS_VERSION >= 0x01103000
|
||||
ass_set_selective_style_override_enabled(priv, set_force_override);
|
||||
#if LIBASS_VERSION >= 0x01103001
|
||||
int set_force_flags = 0;
|
||||
if (opts->ass_style_override == 3)
|
||||
set_force_flags |= ASS_OVERRIDE_BIT_STYLE | ASS_OVERRIDE_BIT_FONT_SIZE;
|
||||
if (opts->ass_style_override == 4)
|
||||
set_force_flags |= ASS_OVERRIDE_BIT_FONT_SIZE;
|
||||
ass_set_selective_style_override_enabled(priv, set_force_flags);
|
||||
ASS_Style style = {0};
|
||||
mp_ass_set_style(&style, 288, opts->sub_text_style);
|
||||
ass_set_selective_style_override(priv, &style);
|
||||
|
Loading…
Reference in New Issue
Block a user