Skip to content

Commit

Permalink
options: add --osd-bar-border-size
Browse files Browse the repository at this point in the history
Closes #1484. The default size is smaller than the previous
--osd-border-size default value of 3 with the default --osd-bar-h.
  • Loading branch information
guidocella authored and Dudemanguy committed Nov 27, 2023
1 parent 65b5543 commit 0c4812a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions DOCS/interface-changes.rst
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions DOCS/man/options.rst
Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions options/options.c
Expand Up @@ -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)},
Expand All @@ -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,
},
Expand Down
1 change: 1 addition & 0 deletions options/options.h
Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions sub/osd_libass.c
Expand Up @@ -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;

Expand Down

0 comments on commit 0c4812a

Please sign in to comment.