summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-18 20:28:54 +0100
committerwm4 <wm4@nowhere>2014-11-18 20:28:54 +0100
commit5d1a3fb406b1d356155c64b64c9c020e7c245887 (patch)
treea81782846e666ea33ee73f366e9f010ccfda9472 /player/command.c
parent71095be5b0ed574c35016301c3b94fc7ec149f04 (diff)
downloadmpv-5d1a3fb406b1d356155c64b64c9c020e7c245887.tar.bz2
mpv-5d1a3fb406b1d356155c64b64c9c020e7c245887.tar.xz
command: improve A-B loop behavior
If the B point is set, then loop back to A. Also, update the OSD bar if necessary.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index 803558f7d9..0041364c8d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2935,7 +2935,8 @@ static int mp_property_af(void *ctx, struct m_property *prop,
static int mp_property_ab_loop(void *ctx, struct m_property *prop,
int action, void *arg)
{
- MPContext *mpctx = ctx;
+ struct MPContext *mpctx = ctx;
+ struct MPOpts *opts = mpctx->opts;
if (action == M_PROPERTY_KEY_ACTION) {
double val;
if (mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &val) < 1)
@@ -2943,7 +2944,18 @@ static int mp_property_ab_loop(void *ctx, struct m_property *prop,
return property_time(action, arg, val);
}
- return mp_property_generic_option(mpctx, prop, action, arg);
+ 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], 1, false);
+ }
+ // Update if visible
+ set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);
+ }
+ return r;
}
static int mp_property_version(void *ctx, struct m_property *prop,