command: don't seek immediately when setting a-b loop when paused

Because it's annoying and feels unnatural.

If the B point is set while paused, don't seek. If not paused, it should
properly loop immediately.

In theory there's a chance that it will show at least 1 frame after the
loop point when setting the B point. But let's not care about that.
This commit is contained in:
wm4 2016-04-28 22:46:49 +02:00
parent d30634b104
commit 0ed206abd9
1 changed files with 5 additions and 5 deletions

View File

@ -3220,11 +3220,8 @@ static int mp_property_ab_loop(void *ctx, struct m_property *prop,
int r = mp_property_generic_option(mpctx, prop, action, arg);
if (r > 0 && action == M_PROPERTY_SET) {
if (strcmp(prop->name, "ab-loop-b") == 0) {
double now = mpctx->playback_pts;
if (now != MP_NOPTS_VALUE && opts->ab_loop[0] != MP_NOPTS_VALUE &&
opts->ab_loop[1] != MP_NOPTS_VALUE && now >= opts->ab_loop[1])
queue_seek(mpctx, MPSEEK_ABSOLUTE, opts->ab_loop[0],
MPSEEK_EXACT, false);
struct command_ctx *cctx = mpctx->command_ctx;
cctx->prev_pts = opts->ab_loop[0];
}
// Update if visible
set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);
@ -5245,6 +5242,9 @@ void handle_ab_loop(struct MPContext *mpctx)
struct command_ctx *ctx = mpctx->command_ctx;
struct MPOpts *opts = mpctx->opts;
if (opts->pause)
return;
double now = mpctx->restart_complete ? mpctx->playback_pts : MP_NOPTS_VALUE;
if (now != MP_NOPTS_VALUE && (opts->ab_loop[0] != MP_NOPTS_VALUE ||
opts->ab_loop[1] != MP_NOPTS_VALUE))