summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-17 02:06:08 +0200
committerwm4 <wm4@nowhere>2014-10-17 02:06:08 +0200
commit41b2927f39f08f54039093746e1d1eded826101e (patch)
tree0842aa5ab060a50ae14d95851fe5467a2e1aac54
parentca038d9a228f33bef7420abadce76e9e6f57fbb6 (diff)
downloadmpv-41b2927f39f08f54039093746e1d1eded826101e.tar.bz2
mpv-41b2927f39f08f54039093746e1d1eded826101e.tar.xz
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)
-rw-r--r--DOCS/man/options.rst1
-rw-r--r--options/options.c2
-rw-r--r--sub/ass_mp.c11
3 files changed, 9 insertions, 5 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 59c934a7c3..44cbbaaf57 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -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.
diff --git a/options/options.c b/options/options.c
index 39b562ee80..3daecc125e 100644
--- a/options/options.c
+++ b/options/options.c
@@ -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),
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index f5da319730..3140597fd2 100644
--- a/sub/ass_mp.c
+++ b/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);