Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DOCS/interface-changes.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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