From ea8ac49f11b159d1997a25e861e56712d3a84bd1 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sat, 26 Oct 2024 10:08:55 -0400 Subject: [PATCH] options: add options to control OSD bar marker size This adds --osd-bar-marker-scale and --osd-bar-marker-min-size options which can be used to customize OSD bar marker size. --- DOCS/interface-changes/osd-bar-marker.txt | 1 + DOCS/man/options.rst | 10 ++++++++++ options/options.c | 4 ++++ options/options.h | 2 ++ sub/osd_libass.c | 3 ++- 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 DOCS/interface-changes/osd-bar-marker.txt diff --git a/DOCS/interface-changes/osd-bar-marker.txt b/DOCS/interface-changes/osd-bar-marker.txt new file mode 100644 index 0000000000..949e61a03f --- /dev/null +++ b/DOCS/interface-changes/osd-bar-marker.txt @@ -0,0 +1 @@ +add `--osd-bar-marker-scale` and `--osd-bar-marker-min-size` options diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index add7073517..e8638b6d25 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4512,6 +4512,16 @@ OSD Default: 0.5. +``--osd-bar-marker-scale=<0-100>`` + Factor for the OSD bar marker size relative to the OSD bar outline size. + + Default: 1.3. + +``--osd-bar-marker-min-size=`` + Minimum OSD bar marker size. + + Default: 1.6. + ``--osd-blur=<0..20.0>`` Gaussian blur factor applied to the OSD font border. 0 means no blur applied (default). diff --git a/options/options.c b/options/options.c index 3b10a45327..4b6d18ae86 100644 --- a/options/options.c +++ b/options/options.c @@ -415,6 +415,8 @@ const struct m_sub_options mp_osd_render_sub_opts = { {"osd-bar-h", OPT_FLOAT(osd_bar_h), M_RANGE(0.1, 50)}, {"osd-bar-outline-size", OPT_FLOAT(osd_bar_outline_size), M_RANGE(0, 1000.0)}, {"osd-bar-border-size", OPT_ALIAS("osd-bar-outline-size")}, + {"osd-bar-marker-scale", OPT_FLOAT(osd_bar_marker_scale), M_RANGE(0, 100.0)}, + {"osd-bar-marker-min-size", OPT_FLOAT(osd_bar_marker_min_size), M_RANGE(0, 1000.0)}, {"osd", OPT_SUBSTRUCT(osd_style, osd_style_conf)}, {"osd-scale", OPT_FLOAT(osd_scale), M_RANGE(0, 100)}, {"osd-scale-by-window", OPT_BOOL(osd_scale_by_window)}, @@ -427,6 +429,8 @@ const struct m_sub_options mp_osd_render_sub_opts = { .osd_bar_w = 75.0, .osd_bar_h = 3.125, .osd_bar_outline_size = 0.5, + .osd_bar_marker_scale = 1.3, + .osd_bar_marker_min_size = 1.6, .osd_scale = 1, .osd_scale_by_window = true, }, diff --git a/options/options.h b/options/options.h index 9bed9ca291..42dd6d484a 100644 --- a/options/options.h +++ b/options/options.h @@ -150,6 +150,8 @@ struct mp_osd_render_opts { float osd_bar_w; float osd_bar_h; float osd_bar_outline_size; + float osd_bar_marker_scale; + float osd_bar_marker_min_size; float osd_scale; bool osd_scale_by_window; struct osd_style_opts *osd_style; diff --git a/sub/osd_libass.c b/sub/osd_libass.c index 9914fe743d..95955ecd57 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -471,7 +471,8 @@ static void update_progbar(struct osd_state *osd, struct osd_object *obj) // chapter marks for (int n = 0; n < obj->progbar_state.num_stops; n++) { float s = obj->progbar_state.stops[n] * width; - float size = MPMAX(border * 1.3, 1.6); + float size = MPMAX(border * osd->opts->osd_bar_marker_scale, + osd->opts->osd_bar_marker_min_size); if (s > size && s < width - size) { ass_draw_move_to(d, s + size, 0);