diff --git a/DOCS/interface-changes/osd-bar-marker.txt b/DOCS/interface-changes/osd-bar-marker.txt index 949e61a03f..027d1e3e7a 100644 --- a/DOCS/interface-changes/osd-bar-marker.txt +++ b/DOCS/interface-changes/osd-bar-marker.txt @@ -1 +1,2 @@ add `--osd-bar-marker-scale` and `--osd-bar-marker-min-size` options +add `--osd-bar-marker-style` option diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e8638b6d25..f2aa576eca 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4522,6 +4522,13 @@ OSD Default: 1.6. +``--osd-bar-marker-style=<none|triangle|line>`` + Set the OSD bar marker style. + + :none: Don't draw markers. + :triangle: Draw markers as triangles (default). + :line: Draw markers as lines. + ``--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 4b6d18ae86..dab194d6c5 100644 --- a/options/options.c +++ b/options/options.c @@ -417,6 +417,8 @@ const struct m_sub_options mp_osd_render_sub_opts = { {"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-bar-marker-style", OPT_CHOICE(osd_bar_marker_style, + {"none", 0}, {"triangle", 1}, {"line", 2})}, {"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)}, @@ -431,6 +433,7 @@ const struct m_sub_options mp_osd_render_sub_opts = { .osd_bar_outline_size = 0.5, .osd_bar_marker_scale = 1.3, .osd_bar_marker_min_size = 1.6, + .osd_bar_marker_style = 1, .osd_scale = 1, .osd_scale_by_window = true, }, diff --git a/options/options.h b/options/options.h index 42dd6d484a..8e9eee7de6 100644 --- a/options/options.h +++ b/options/options.h @@ -152,6 +152,7 @@ struct mp_osd_render_opts { float osd_bar_outline_size; float osd_bar_marker_scale; float osd_bar_marker_min_size; + int osd_bar_marker_style; 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 95955ecd57..39a8867344 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -469,19 +469,25 @@ static void update_progbar(struct osd_state *osd, struct osd_object *obj) ass_draw_rect_ccw(d, 0, 0, width, height); // 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 * osd->opts->osd_bar_marker_scale, - osd->opts->osd_bar_marker_min_size); + if (osd->opts->osd_bar_marker_style) { + for (int n = 0; n < obj->progbar_state.num_stops; n++) { + float s = obj->progbar_state.stops[n] * width; + 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); - ass_draw_line_to(d, s, size); - ass_draw_line_to(d, s - size, 0); + if (osd->opts->osd_bar_marker_style == 2 && + s > size / 2 && s < width - size / 2) + { // line + ass_draw_rect_cw(d, s - size / 2, 0, s + size / 2, height); + } else if (s > size && s < width - size) { //triangle + ass_draw_move_to(d, s + size, 0); + ass_draw_line_to(d, s, size); + ass_draw_line_to(d, s - size, 0); - ass_draw_move_to(d, s - size, height); - ass_draw_line_to(d, s, height - size); - ass_draw_line_to(d, s + size, height); + ass_draw_move_to(d, s - size, height); + ass_draw_line_to(d, s, height - size); + ass_draw_line_to(d, s + size, height); + } } }