options: add --osd-bar-border-size

Closes #1484. The default size is smaller than the previous
--osd-border-size default value of 3 with the default --osd-bar-h.
This commit is contained in:
Guido Cella 2023-11-24 15:28:02 +01:00 committed by Dudemanguy
parent 65b5543332
commit 0c4812aa72
5 changed files with 11 additions and 6 deletions

View File

@ -30,6 +30,7 @@ Interface changes
- remove shared-script-properties (user-data is a replacement)
- add `--secondary-sub-delay`, decouple secondary subtitles from
`--sub-delay`
- add the `--osd-bar-border-size` option
--- mpv 0.37.0 ---
- `--save-position-on-quit` and its associated commands now store state files
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.

View File

@ -4265,6 +4265,12 @@ OSD
``--osd-bar-h=<0.1-50>``
Height of the OSD bar, in percentage of the screen height (default: 3.125).
``--osd-bar-border-size=<size>``
Size of the border of the OSD bar in scaled pixels (see ``--sub-font-size``
for details).
Default: 1.2.
``--osd-back-color=<color>``
See ``--sub-color``. Color used for OSD text background.

View File

@ -360,6 +360,7 @@ const struct m_sub_options mp_osd_render_sub_opts = {
{"osd-bar-align-y", OPT_FLOAT(osd_bar_align_y), M_RANGE(-1.0, +1.0)},
{"osd-bar-w", OPT_FLOAT(osd_bar_w), M_RANGE(1, 100)},
{"osd-bar-h", OPT_FLOAT(osd_bar_h), M_RANGE(0.1, 50)},
{"osd-bar-border-size", OPT_FLOAT(osd_bar_border_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)},
@ -371,6 +372,7 @@ const struct m_sub_options mp_osd_render_sub_opts = {
.osd_bar_align_y = 0.5,
.osd_bar_w = 75.0,
.osd_bar_h = 3.125,
.osd_bar_border_size = 1.2,
.osd_scale = 1,
.osd_scale_by_window = true,
},

View File

@ -135,6 +135,7 @@ struct mp_osd_render_opts {
float osd_bar_align_y;
float osd_bar_w;
float osd_bar_h;
float osd_bar_border_size;
float osd_scale;
bool osd_scale_by_window;
struct osd_style_opts *osd_style;

View File

@ -378,12 +378,7 @@ static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj,
*o_w = track->PlayResX * (opts->osd_bar_w / 100.0);
*o_h = track->PlayResY * (opts->osd_bar_h / 100.0);
float base_size = 0.03125;
style->Outline *= *o_h / track->PlayResY / base_size;
// So that the chapter marks have space between them
style->Outline = MPMIN(style->Outline, *o_h / 5.2);
// So that the border is not 0
style->Outline = MPMAX(style->Outline, *o_h / 32.0);
style->Outline = opts->osd_bar_border_size;
// Rendering with shadow is broken (because there's more than one shape)
style->Shadow = 0;