summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index b4c2ad1201..8c4f8de5ea 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5336,6 +5336,26 @@ static void cmd_ab_loop(void *p)
}
}
+static void cmd_align_cache_ab(void *p)
+{
+ struct mp_cmd_ctx *cmd = p;
+ struct MPContext *mpctx = cmd->mpctx;
+
+ if (!mpctx->demuxer)
+ return;
+
+ double a = demux_probe_cache_dump_target(mpctx->demuxer,
+ mpctx->opts->ab_loop[0], false);
+ double b = demux_probe_cache_dump_target(mpctx->demuxer,
+ mpctx->opts->ab_loop[1], true);
+
+ mp_property_do("ab-loop-a", M_PROPERTY_SET, &a, mpctx);
+ mp_property_do("ab-loop-b", M_PROPERTY_SET, &b, mpctx);
+
+ // Happens to cover both properties.
+ show_property_osd(mpctx, "ab-loop-b", cmd->on_osd);
+}
+
static void cmd_drop_buffers(void *p)
{
struct mp_cmd_ctx *cmd = p;
@@ -5986,6 +6006,8 @@ const struct mp_cmd_def mp_cmds[] = {
.can_abort = true,
},
+ { "ab-loop-align-cache", cmd_align_cache_ab },
+
{0}
};