player: loop on end of file if ab-loop-b is unset

Possibly slightly more useful/intuitive.
This commit is contained in:
wm4
2016-04-18 21:33:19 +02:00
parent ce153bdb42
commit 382bafcb13
4 changed files with 15 additions and 7 deletions
+3
View File
@@ -19,6 +19,9 @@ Interface changes
::
--- mpv 0.17.1 ---
- now ab-loops are active even if the "ab-loop-b" property is unset ("no"),
in which case the end of the file is used as B loop point
--- mpv 0.17.0 ---
- deprecate "track-list/N/audio-channels" property (use
"track-list/N/demux-channel-count" instead)
+3 -2
View File
@@ -1081,8 +1081,9 @@ Property list
"default" MPV_FORMAT_FLAG
``ab-loop-a``, ``ab-loop-b`` (RW)
Set/get A-B loop points. See corresponding options and ``ab_loop`` command.
The special value ``no`` on either of these properties disables looping.
Set/get A-B loop points. See corresponding options and ``ab-loop`` command.
The special value ``no`` on ``ab-loop-a`` disables looping, while setting
``ab-loop-b`` to ``no`` loops when the end of the file is reached.
``angle`` (RW)
Current DVD angle.
+6 -5
View File
@@ -5245,12 +5245,13 @@ 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 &&
opts->ab_loop[1] != MP_NOPTS_VALUE)
{
if (now != MP_NOPTS_VALUE && opts->ab_loop[0] != MP_NOPTS_VALUE) {
double end = opts->ab_loop[1];
if (end == MP_NOPTS_VALUE)
end = INFINITY;
if (ctx->prev_pts >= opts->ab_loop[0] &&
ctx->prev_pts < opts->ab_loop[1] &&
(now >= opts->ab_loop[1] || mpctx->stop_play == AT_END_OF_FILE))
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],
+3
View File
@@ -978,6 +978,9 @@ void run_playloop(struct MPContext *mpctx)
handle_sstep(mpctx);
if (mpctx->stop_play == AT_END_OF_FILE && mpctx->seek.type)
mpctx->stop_play = KEEP_PLAYING;
if (mpctx->stop_play)
return;