summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/options.rst6
-rw-r--r--mpvcore/options.c2
-rw-r--r--mpvcore/options.h1
-rw-r--r--sub/ass_mp.c2
-rw-r--r--sub/ass_mp.h2
-rw-r--r--sub/osd_libass.c7
6 files changed, 17 insertions, 3 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 252cb4c5fe..9739a54d5b 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1558,6 +1558,12 @@ OPTIONS
``--osd-scale=<factor>``
OSD font size multiplicator, multiplied with ``--osd-font-size`` value.
+``--osd-scale-by-window=yes|no``
+ Whether to scale the OSD with the window size (default: yes). If this is
+ disabled, ``--osd-font-size`` and other OSD options that use scaled pixels
+ are always in actual pixels. The effect is that changing the window size
+ won't change the OSD font size.
+
``--osd-shadow-color=<#RRGGBB>, --sub-text-shadow-color=<#RRGGBB>``
See ``--osd-color``. Color used for OSD/sub text shadow.
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 5ddf38612c..97a5a5e6dc 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -658,6 +658,7 @@ const m_option_t mp_opts[] = {
OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000),
OPT_FLAG("osd-fractions", osd_fractions, 0),
OPT_FLOATRANGE("osd-scale", osd_scale, 0, 0, 100),
+ OPT_FLAG("osd-scale-by-window", osd_scale_by_window, 0),
OPT_DOUBLE("sstep", step_sec, CONF_MIN, 0),
@@ -797,6 +798,7 @@ const struct MPOpts mp_default_opts = {
.osd_bar_w = 75.0,
.osd_bar_h = 3.125,
.osd_scale = 1,
+ .osd_scale_by_window = 1,
.lua_load_osc = 1,
.loop_times = -1,
.ordered_chapters = 1,
diff --git a/mpvcore/options.h b/mpvcore/options.h
index 4057ea882c..f421fcccb5 100644
--- a/mpvcore/options.h
+++ b/mpvcore/options.h
@@ -189,6 +189,7 @@ typedef struct MPOpts {
float osd_bar_w;
float osd_bar_h;
float osd_scale;
+ int osd_scale_by_window;
struct osd_style_opts *osd_style;
struct osd_style_opts *sub_text_style;
float sub_scale;
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 33cd1559fc..72c22d54e6 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -39,7 +39,7 @@
// res_y should be track->PlayResY
// It determines scaling of font sizes and more.
-void mp_ass_set_style(ASS_Style *style, int res_y,
+void mp_ass_set_style(ASS_Style *style, double res_y,
const struct osd_style_opts *opts)
{
if (opts->font) {
diff --git a/sub/ass_mp.h b/sub/ass_mp.h
index 27d09d8acd..987efdfe28 100644
--- a/sub/ass_mp.h
+++ b/sub/ass_mp.h
@@ -44,7 +44,7 @@ struct MPOpts;
struct mp_osd_res;
struct osd_style_opts;
-void mp_ass_set_style(ASS_Style *style, int res_y,
+void mp_ass_set_style(ASS_Style *style, double res_y,
const struct osd_style_opts *opts);
void mp_ass_add_default_styles(ASS_Track *track, struct MPOpts *opts);
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 0564fbb4d3..71255256a9 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -163,8 +163,13 @@ static void update_osd(struct osd_state *osd, struct osd_object *obj)
struct osd_style_opts font = *opts->osd_style;
font.font_size *= opts->osd_scale;
+ double playresy = obj->osd_track->PlayResY;
+ // Compensate for libass and mp_ass_set_style scaling the font etc.
+ if (!opts->osd_scale_by_window)
+ playresy *= 720.0 / obj->vo_res.h;
+
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
- mp_ass_set_style(style, obj->osd_track->PlayResY, &font);
+ mp_ass_set_style(style, playresy, &font);
char *text = mangle_ass(osd->osd_text);
add_osd_ass_event(obj->osd_track, text);