summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-06 22:07:35 +0200
committerwm4 <wm4@nowhere>2014-10-06 22:07:35 +0200
commit45c8b97efbaff7a5031b008223eeed56f7b0607a (patch)
treea5afc251735aca2c2a6d356688b4feda5b3f6c61
parent332808bc0df1385633556332c276ab860c971f5c (diff)
downloadmpv-45c8b97efbaff7a5031b008223eeed56f7b0607a.tar.bz2
mpv-45c8b97efbaff7a5031b008223eeed56f7b0607a.tar.xz
player: --save-position-on-quit should always work
Now any action that stops playback of a file (even playlist navigation) will save the position. Normal EOF is of course excluded from this, as well as commands that just reload the current file. The option name is now slightly off, although you could argue what the word "quit" means. Fixes #1148 (or at least this is how I understood it).
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--player/core.h4
-rw-r--r--player/loadfile.c2
3 files changed, 8 insertions, 5 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index a2e096f907..86632436dd 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -290,10 +290,9 @@ Program Behavior
``--save-position-on-quit``
Always save the current playback position on quit. When this file is
played again later, the player will seek to the old playback position on
- start. This does not happen if playback of a file is stopped in any other
- way than quitting. For example, going to the next file in the playlist
- will not save the position, and start playback at beginning the next time
- the file is played.
+ start. This happens when playback is stopped in any way by the user.
+ For example, going to the next file in the playlist will save the position,
+ and resume playback at thr same position the next time the file is played.
This behavior is disabled by default, but is always available when quitting
the player with Shift+Q.
diff --git a/player/core.h b/player/core.h
index a0c9db2cc5..3b4a9f1fa1 100644
--- a/player/core.h
+++ b/player/core.h
@@ -41,6 +41,10 @@ enum stop_play_reason {
PT_QUIT, // stop playback, quit player
};
+// stop_play_reason that is an explicit user abort.
+#define PT_IS_QUIT(x) ((x) == PT_NEXT_ENTRY || (x) == PT_CURRENT_ENTRY || \
+ (x) == PT_STOP || (x) == PT_QUIT)
+
enum exit_reason {
EXIT_NONE,
EXIT_QUIT,
diff --git a/player/loadfile.c b/player/loadfile.c
index 23ffa80684..b07bdc6e3c 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1196,7 +1196,7 @@ terminate_playback:
if (mpctx->stop_play != AT_END_OF_FILE)
clear_audio_output_buffers(mpctx);
- if (opts->position_save_on_quit && mpctx->stop_play == PT_QUIT)
+ if (opts->position_save_on_quit && PT_IS_QUIT(mpctx->stop_play))
mp_write_watch_later_conf(mpctx);
if (mpctx->step_frames)