summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-05 19:18:08 +0100
committerwm4 <wm4@nowhere>2015-01-05 19:18:08 +0100
commit067bb9605c6333bf9d552d1c12f65ccadbb2fc2f (patch)
treef2c1ab202d0f517f195addbdd7e43116bcb8e5b0
parent2ab259e6832dff38f13cdaa2a8c83b273efa8ec7 (diff)
downloadmpv-067bb9605c6333bf9d552d1c12f65ccadbb2fc2f.tar.bz2
mpv-067bb9605c6333bf9d552d1c12f65ccadbb2fc2f.tar.xz
sub: add option to not scale subtitles with window
--sub-scale-by-window=no attempts to keep subs always at the same pixel size. The implementation is a bit all over the place, because it compensates already done scaling by an inverse scale factor, but it will probably do its job. Fixes #1424. (The semantics and name of --sub-scale-with-window are kept, and this adds a new option - the name is confusingly similar, but it's actually analogue to --osd-scale-by-window.)
-rw-r--r--DOCS/man/options.rst11
-rw-r--r--options/options.c2
-rw-r--r--options/options.h3
-rw-r--r--sub/ass_mp.c5
4 files changed, 20 insertions, 1 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 44ef87b137..ffe4cb1b08 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1123,12 +1123,23 @@ Subtitles
This affects ASS subtitles as well, and may lead to incorrect subtitle
rendering. Use with care, or use ``--sub-text-font-size`` instead.
+``--sub-scale-by-window=<yes|no>``
+ Whether to scale subtitles with the window size (default: yes). If this is
+ disabled, changing the window size won't change the subtitle font size.
+
+ Like ``--sub-scale``, this can break ASS subtitles.
+
``--sub-scale-with-window=<yes|no>``
Make the subtitle font size relative to the window, instead of the video.
This is useful if you always want the same font size, even if the video
doesn't covert the window fully, e.g. because screen aspect and window
aspect mismatch (and the player adds black bars).
+ This option is misnamed. The difference to the confusingly similar sounding
+ option ``--sub-scale-by-window`` is that ``--sub-scale-with-window`` still
+ scales with the approximate window size, while the other option disables
+ this scaling.
+
Like ``--sub-scale``, this can break ASS subtitles.
``--embeddedfonts``, ``--no-embeddedfonts``
diff --git a/options/options.c b/options/options.c
index 19dca2ad1b..0875e6ded5 100644
--- a/options/options.c
+++ b/options/options.c
@@ -347,6 +347,7 @@ const m_option_t mp_opts[] = {
({"simple", 0}, {"complex", 1})),
OPT_CHOICE("ass-style-override", ass_style_override, 0,
({"no", 0}, {"yes", 1}, {"force", 3}, {"signfs", 4})),
+ OPT_FLAG("sub-scale-by-window", sub_scale_by_window, 0),
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),
@@ -699,6 +700,7 @@ const struct MPOpts mp_default_opts = {
.osd_bar_h = 3.125,
.osd_scale = 1,
.osd_scale_by_window = 1,
+ .sub_scale_by_window = 1,
.use_text_osd = 1,
#if HAVE_LUA
.lua_load_osc = 1,
diff --git a/options/options.h b/options/options.h
index 5e24a20d1d..1664c3a443 100644
--- a/options/options.h
+++ b/options/options.h
@@ -235,6 +235,8 @@ typedef struct MPOpts {
float osd_bar_h;
float osd_scale;
int osd_scale_by_window;
+ int sub_scale_by_window;
+ int sub_scale_with_window;
struct osd_style_opts *osd_style;
struct osd_style_opts *sub_text_style;
float sub_scale;
@@ -252,7 +254,6 @@ typedef struct MPOpts {
int ass_style_override;
int ass_hinting;
int ass_shaper;
- int sub_scale_with_window;
int sub_clear_on_seek;
int hwdec_api;
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 3140597fd2..cfec8ac91d 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -146,6 +146,11 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
int vidh = dim->h - (dim->mt + dim->mb);
set_font_scale *= dim->h / (float)MPMAX(vidh, 1);
}
+ if (!opts->sub_scale_by_window) {
+ double factor = dim->h / 720.0;
+ if (factor != 0.0)
+ set_font_scale /= factor;
+ }
}
ass_set_use_margins(priv, set_use_margins);