summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-04-18 21:32:58 +0200
committerwm4 <wm4@nowhere>2016-04-18 21:33:19 +0200
commit382bafcb1349855c2871bbe0a813f8493e1bd9f7 (patch)
treeec030defef7859e8bfcea89f8d347daa3fea716b
parentce153bdb428a47d5e26b84d7a1b757fd5f315c59 (diff)
downloadmpv-382bafcb1349855c2871bbe0a813f8493e1bd9f7.tar.bz2
mpv-382bafcb1349855c2871bbe0a813f8493e1bd9f7.tar.xz
player: loop on end of file if ab-loop-b is unset
Possibly slightly more useful/intuitive.
-rw-r--r--DOCS/interface-changes.rst3
-rw-r--r--DOCS/man/input.rst5
-rw-r--r--player/command.c11
-rw-r--r--player/playloop.c3
4 files changed, 15 insertions, 7 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index ee6e135808..1a175d798e 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -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)
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 241f6740fb..52ace4aada 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -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.
diff --git a/player/command.c b/player/command.c
index e3a3313f79..cdadafa892 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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],
diff --git a/player/playloop.c b/player/playloop.c
index fcbb86ac04..d6509f8c98 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -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;