diff options
author | wm4 <wm4@nowhere> | 2014-11-18 00:09:42 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-18 01:36:35 +0100 |
commit | 4bd6c91d9b4c4d35d0d71793933947861e45daad (patch) | |
tree | 1c22de1369e8ec8028e20560a653d9ba7deba371 /player/osd.c | |
parent | ed5923437848bb4c1afa7104c29f21c7a44743f0 (diff) | |
download | mpv-4bd6c91d9b4c4d35d0d71793933947861e45daad.tar.bz2 mpv-4bd6c91d9b4c4d35d0d71793933947861e45daad.tar.xz |
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.
Diffstat (limited to 'player/osd.c')
-rw-r--r-- | player/osd.c | 24 |
1 files changed, 17 insertions, 7 deletions
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); + } } } } |