From e9e93b4dbe748cd341a6fbea355e6ba013ada81b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Mar 2020 17:08:43 +0100 Subject: player: add a number of new playlist contol commands/properties Should give a good deal more explicit control and insight over the player state. Some feel a bit pointless, and/or expose internal weirdness. However, it's not like the existing weirdness didn't exist before, or can be made go away. (In part, the weirdness is because certain in-between states are visible. Hiding them would make things simpler, but less flexible.) Maybe this actually gives users a better idea how the API _should_ look like, too. On a side note, this tries to really guarantee that mpctx->playing is set between playback start/end. For that, the loadfile.c changes assume that mpctx->playing is set (guaranteed by code above the change), and that playing->filename is set (probably could never be false; was broken before and actually would have crashed if that could ever happen; in any case, also add an assert to playlist.c for this). playlist_entry_to_index() now tolerates playlist_entrys that are not part of the playlist. This is also needed for mpctx->playing. --- DOCS/interface-changes.rst | 6 ++++ DOCS/man/input.rst | 89 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 83 insertions(+), 12 deletions(-) (limited to 'DOCS') diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index c63669ad7c..15be443190 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -48,6 +48,12 @@ Interface changes - the playlist-pos and playlist-pos-1 properties now can return and accept -1, and are never unavailable. Out of range indexes are now accepted, but behave like writing -1. + - the playlist-pos and playlist-pos-1 properties deprecate the current + behavior when writing back the current value to the property: currently, + this restarts playback, but in the future, it will do nothing. + Using the "playlist-play-index" command is recommended instead. + - add "playlist-play-index" command + - add playlist-current-pos, playlist-playing-pos properties --- mpv 0.32.0 --- - change behavior when using legacy option syntax with options that start with two dashes (``--`` instead of a ``-``). Now, using the recommended diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 8f81b63f9f..e58bd2c507 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -377,6 +377,29 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). force Terminate playback if the first file is being played. +``playlist-play-index `` + Start (or restart) playback of the given playlist index. In addition to the + 0-based playlist entry index, it supports the following values: + + + The current playlist entry (as in ``playlist-current-pos``) will be + played again (unload and reload). If none is set, playback is stopped. + (In corner cases, ``playlist-current-pos`` can point to a playlist entry + even if playback is currently inactive, + + + Playback is stopped. If idle mode (``--idle``) is enabled, the player + will enter idle mode, otherwise it will exit. + + This comm and is similar to ``loadfile`` in that it only manipulates the + state of what to play next, without waiting until the current file is + unloaded, and the next one is loaded. + + Setting ``playlist-pos`` or similar properties can have a similar effect to + this command. However, it's more explicit, and guarantees that playback is + restarted if for example the new playlist entry is the same as the previous + one. + ``loadfile [ []]`` Load the given file or URL and play it. Technically, this is just a playlist manipulation command (which either replaces the playlist or appends an entry @@ -649,11 +672,17 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). Write the resume config file that the ``quit-watch-later`` command writes, but continue playback normally. -``stop`` +``stop []`` Stop playback and clear playlist. With default settings, this is essentially like ``quit``. Useful for the client API: playback can be stopped without terminating the player. + The first argument is optional, and supports the following flags: + + keep-playlist + Do not clear the playlist. + + ``mouse [