summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-26 15:58:43 +0100
committerwm4 <wm4@nowhere>2020-03-26 15:58:43 +0100
commit8d5abb16f52a68ed12f4463f88848b0114ee701b (patch)
tree4cf9be039cb209ae38927cede8b71777f9075f2d
parent537f011c6d07eb56116f44e6bd4f841b392d97f6 (diff)
downloadmpv-ass_shit.tar.bz2
mpv-ass_shit.tar.xz
-rw-r--r--sub/sd_ass.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 40e5093d8e..d201f10bd5 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -38,6 +38,9 @@
#include "ass_mp.h"
#include "sd.h"
+// Presence of ASS_OVERRIDE_BIT_SANE_MARGINS.
+#define HAVE_LIBASS_SANE_MARGINS 1
+
struct sd_ass_priv {
struct ass_library *ass_library;
struct ass_renderer *ass_renderer;
@@ -368,6 +371,7 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
bool set_scale_with_window = false;
bool set_scale_by_window = true;
bool total_override = false;
+ int set_force_flags = 0;
// With forced overrides, apply the --sub-* specific options
if (converted || opts->ass_style_override == 3) { // 'force'
set_scale_with_window = opts->sub_scale_with_window;
@@ -384,10 +388,14 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
set_hinting = opts->ass_hinting;
set_font_scale = opts->sub_scale;
}
+#if HAVE_LIBASS_SANE_MARGINS
+ set_force_flags |= ASS_OVERRIDE_BIT_SANE_MARGINS;
+#else
if (set_scale_with_window) {
int vidh = dim->h - (dim->mt + dim->mb);
set_font_scale *= dim->h / (float)MPMAX(vidh, 1);
}
+#endif
if (!set_scale_by_window) {
double factor = dim->h / 720.0;
if (factor != 0.0)
@@ -396,7 +404,6 @@ static void configure_ass(struct sd *sd, struct mp_osd_res *dim,
ass_set_use_margins(priv, set_use_margins);
ass_set_line_position(priv, set_sub_pos);
ass_set_shaper(priv, opts->ass_shaper);
- int set_force_flags = 0;
if (total_override)
set_force_flags |= ASS_OVERRIDE_BIT_STYLE | ASS_OVERRIDE_BIT_FONT_SIZE;
if (opts->ass_style_override == 4) // 'scale'