From 4bd6c91d9b4c4d35d0d71793933947861e45daad Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 18 Nov 2014 00:09:42 +0100 Subject: command: implement A-B loops Probably needs to be polished a bit more. Also, might require a key binding that can set/clear the loop points in a more intuitive way. For now, something like this can be put into input.conf to use it: ctrl+y set ab-loop-a ${time-pos} # set A ctrl+x set ab-loop-b ${time-pos} # set B ctrl+c set ab-loop-a no # clear (mostly) Fixes #1241. --- player/osd.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'player/osd.c') diff --git a/player/osd.c b/player/osd.c index 7e099e2d0c..b6a0c1b98d 100644 --- a/player/osd.c +++ b/player/osd.c @@ -333,19 +333,29 @@ static void update_osd_bar(struct MPContext *mpctx, int type, static void set_osd_bar_chapters(struct MPContext *mpctx, int type) { + struct MPOpts *opts = mpctx->opts; if (mpctx->osd_progbar.type != type) return; mpctx->osd_progbar.num_stops = 0; double len = get_time_length(mpctx); if (len > 0) { - int num = get_chapter_count(mpctx); - for (int n = 0; n < num; n++) { - double time = chapter_start_time(mpctx, n); - if (time >= 0) { - float pos = time / len; - MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, - mpctx->osd_progbar.num_stops, pos); + if (opts->ab_loop[0] != MP_NOPTS_VALUE && + opts->ab_loop[1] != MP_NOPTS_VALUE) + { + MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, + mpctx->osd_progbar.num_stops, opts->ab_loop[0] / len); + 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); + if (time >= 0) { + float pos = time / len; + MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops, + mpctx->osd_progbar.num_stops, pos); + } } } } -- cgit v1.2.3