diff options
author | wm4 <wm4@nowhere> | 2019-05-25 22:47:39 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:04 +0200 |
commit | aebccb880107c6c6db21853446300c9deee718b3 (patch) | |
tree | 4437710a04d76450a352ec6d55af89f62beedf7c | |
parent | 281e9982905d4ca87510bb7e0a44650c537fc610 (diff) | |
download | mpv-aebccb880107c6c6db21853446300c9deee718b3.tar.bz2 mpv-aebccb880107c6c6db21853446300c9deee718b3.tar.xz |
osd: simplify AB-loop rendering on progress bar
This adds the stops using the same logic get_play_end_pts() and
handle_loop_file(). It did that before, it just looks slightly different
now. It also won't try to add MP_NOPTS_VALUE as stop value.
-rw-r--r-- | player/osd.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/player/osd.c b/player/osd.c index 00bef58e6b..365418e573 100644 --- a/player/osd.c +++ b/player/osd.c @@ -359,19 +359,20 @@ void set_osd_bar_chapters(struct MPContext *mpctx, int type) mpctx->osd_progbar.num_stops = 0; double len = get_time_length(mpctx); if (len > 0) { - double ab_loop_start_time = get_ab_loop_start_time(mpctx); if (opts->ab_loop[0] != MP_NOPTS_VALUE || - (ab_loop_start_time != MP_NOPTS_VALUE && - opts->ab_loop[1] != MP_NOPTS_VALUE)) + opts->ab_loop[1] != MP_NOPTS_VALUE) { + double ab_loop_start_time = get_ab_loop_start_time(mpctx); + if (ab_loop_start_time == MP_NOPTS_VALUE) + ab_loop_start_time = 0; MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, mpctx->osd_progbar.num_stops, ab_loop_start_time / len); - } - if (opts->ab_loop[1] != MP_NOPTS_VALUE) { - MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, - mpctx->osd_progbar.num_stops, opts->ab_loop[1] / len); - } - if (mpctx->osd_progbar.num_stops == 0) { + if (opts->ab_loop[1] != MP_NOPTS_VALUE) { + MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, + mpctx->osd_progbar.num_stops, + opts->ab_loop[1] / len); + } + } else { int num = get_chapter_count(mpctx); for (int n = 0; n < num; n++) { double time = chapter_start_time(mpctx, n); |