summaryrefslogtreecommitdiffstats
path: root/libmpv/client.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-21 14:01:38 +0100
committerwm4 <wm4@nowhere>2020-03-21 19:32:50 +0100
commit26ac6ead911bedf01b20d52e0696f70459ff0be2 (patch)
treebf5d797785610e8cfbc468a38807dd387a2c3ff5 /libmpv/client.h
parent2a85e8a1864ebe1d7749dfd2748931d1f320e337 (diff)
downloadmpv-26ac6ead911bedf01b20d52e0696f70459ff0be2.tar.bz2
mpv-26ac6ead911bedf01b20d52e0696f70459ff0be2.tar.xz
player: fix subtle idle mode differences on early program start
If the user manages to run a "loadfile x append" command before the loop in mp_play_files() is entered, then the player could start playing these. This isn't expected, because appending files to the playlist in idle mode does not normally start playback. It could happen because there is a short time window where commands are processed before the loop is entered (such as running the command when a script is loaded). The idle mode semantics are pretty weird: if files were provided in advance (on the command line), then these should be played immediately. But if idle mode was already entered, and something is appended to the playlist using "append", i.e. without explicitly triggering playback, then it should remain in idle mode. Try to follow this by redefining PT_STOP to strictly mean idle mode. Remove the playlist->current check from idle_loop(), since only the stop_play field counts now (cf. what mp_set_playlist_entry() does). This actually introduces the possibility that playlist->current, and with it playlist-pos, are set to something, even though playback is not active or being started. Previously, this was only possible during state transitions, such as when changing playlist entries. Very annoyingly, this means the current way MPV_EVENT_IDLE was sent doesn't work anymore. Logically, idle mode can be "active" even if idle_loop() was not entered yet (between the time after mp_initialize() and before the loop in mp_play_files()). Instead of worrying about this, redo the "idle-active" property, and deprecate the event. See: #7543
Diffstat (limited to 'libmpv/client.h')
-rw-r--r--libmpv/client.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/libmpv/client.h b/libmpv/client.h
index ce880e1012..8d3af89249 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -232,7 +232,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 107)
+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 108)
/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
@@ -1328,15 +1328,19 @@ typedef enum mpv_event_id {
* and might be removed in the far future.
*/
MPV_EVENT_TRACK_SWITCHED = 10,
-#endif
/**
* Idle mode was entered. In this mode, no file is played, and the playback
* core waits for new commands. (The command line player normally quits
* instead of entering idle mode, unless --idle was specified. If mpv
* was started with mpv_create(), idle mode is enabled by default.)
+ *
+ * @deprecated This is equivalent to using mpv_observe_property() on the
+ * "idle-active" property. The event is redundant, and might be
+ * removed in the far future. As a further warning, this event
+ * is not necessarily sent at the right point anymore (at the
+ * start of the program), while the property behaves correctly.
*/
MPV_EVENT_IDLE = 11,
-#if MPV_ENABLE_DEPRECATED
/**
* Playback was paused. This indicates the user pause state.
*