diff options
author | wm4 <wm4@nowhere> | 2019-07-10 21:38:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:05 +0200 |
commit | 82f2613adee9d18ad9baba6da42ba94c5dbbccbb (patch) | |
tree | cfef428ed4b040c85a0ff99d53964112bcd1ec69 /player/command.c | |
parent | 1dd0b2fe3468f690d23049343aa03c15abb8672f (diff) | |
download | mpv-82f2613adee9d18ad9baba6da42ba94c5dbbccbb.tar.bz2 mpv-82f2613adee9d18ad9baba6da42ba94c5dbbccbb.tar.xz |
command, demux: add AB-loop keyframe cache align command
Helper for the ab-loop-dump-cache command, see manpage additions.
This is kind of shit. Not only is this a very "special" feature, but it
also vomits more messy code into the big and already bloated demux.c,
and the implementation is sort of duplicated with the dump-cache code.
(Except it's different.) In addition, the results sort of depend what a
video player would do with the dump-cache output, or what the user wants
(for example, a user might be more interested in the range of output
audio, instead of the video).
But hey, I don't actually need to justify it. I'm only justifying it for
fun.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 22 |
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} }; |