summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-04-21 22:15:17 +0200
committerwm4 <wm4@nowhere>2016-04-21 22:15:36 +0200
commit1944a34c230b6afb7707fe4fb5eb0c613b96db9b (patch)
tree4450c51dc39341055ffbd50a084ec26e26d6a804 /player
parent78346e9c9a8a70fa581989b2cc8b4e0933765330 (diff)
downloadmpv-1944a34c230b6afb7707fe4fb5eb0c613b96db9b.tar.bz2
mpv-1944a34c230b6afb7707fe4fb5eb0c613b96db9b.tar.xz
command: if only ab-loop-b is set, loop from start of file
Commit 382bafcb changed the behavior for ab-loop-a. This commit changes ab-loop-b so that the behavior is symmetric. Adjust the OSD rendering accordingly to the two changes. Also fix mentions of the "ab_loop" command to the now preferred "ab-loop".
Diffstat (limited to 'player')
-rw-r--r--player/command.c12
-rw-r--r--player/osd.c9
2 files changed, 13 insertions, 8 deletions
diff --git a/player/command.c b/player/command.c
index bfdcb820d3..7f65534d84 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5245,16 +5245,20 @@ void handle_ab_loop(struct MPContext *mpctx)
struct MPOpts *opts = mpctx->opts;
double now = mpctx->restart_complete ? mpctx->playback_pts : MP_NOPTS_VALUE;
- if (now != MP_NOPTS_VALUE && opts->ab_loop[0] != MP_NOPTS_VALUE) {
+ if (now != MP_NOPTS_VALUE && (opts->ab_loop[0] != MP_NOPTS_VALUE ||
+ opts->ab_loop[1] != MP_NOPTS_VALUE))
+ {
+ double start = opts->ab_loop[0];
+ if (start == MP_NOPTS_VALUE)
+ start = 0;
double end = opts->ab_loop[1];
if (end == MP_NOPTS_VALUE)
end = INFINITY;
- if (ctx->prev_pts >= opts->ab_loop[0] &&
- ctx->prev_pts < end &&
+ if (ctx->prev_pts >= start && ctx->prev_pts < end &&
(now >= end || mpctx->stop_play == AT_END_OF_FILE))
{
mark_seek(mpctx);
- queue_seek(mpctx, MPSEEK_ABSOLUTE, opts->ab_loop[0],
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, start,
MPSEEK_EXACT, false);
}
}
diff --git a/player/osd.c b/player/osd.c
index 7da4a038bf..810df73719 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -362,14 +362,15 @@ 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) {
- if (opts->ab_loop[0] != MP_NOPTS_VALUE &&
- opts->ab_loop[1] != MP_NOPTS_VALUE)
- {
+ if (opts->ab_loop[0] != MP_NOPTS_VALUE) {
MP_TARRAY_APPEND(mpctx, mpctx->osd_progbar.stops,
mpctx->osd_progbar.num_stops, opts->ab_loop[0] / 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);
- } else {
+ }
+ if (mpctx->osd_progbar.stops == 0) {
int num = get_chapter_count(mpctx);
for (int n = 0; n < num; n++) {
double time = chapter_start_time(mpctx, n);