summaryrefslogtreecommitdiffstats
path: root/libmpv/client.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-11 01:23:32 +0200
committerwm4 <wm4@nowhere>2014-04-11 01:23:32 +0200
commit86094c2c5ae634b9ff02a85e51c33955b31babfa (patch)
treed7e99e5394d917f031e56d6a8e91c827f41d8475 /libmpv/client.h
parentd3e9f51c71a1691b76ee0918d228c5fe987e4ffa (diff)
downloadmpv-86094c2c5ae634b9ff02a85e51c33955b31babfa.tar.bz2
mpv-86094c2c5ae634b9ff02a85e51c33955b31babfa.tar.xz
client API: include the reason in MPV_EVENT_END_FILE
Otherwise, the client API user could not know why playback was stopped. Regarding the fact that 0 is used both for normal EOF and EOF on error: this is because mplayer traditionally did not distinguish these, and in general it's hard to tell the real reason. (There are various weird corner cases which make it hard.)
Diffstat (limited to 'libmpv/client.h')
-rw-r--r--libmpv/client.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libmpv/client.h b/libmpv/client.h
index d417d8bbdb..375b440dce 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -817,6 +817,7 @@ typedef enum mpv_event_id {
MPV_EVENT_START_FILE = 6,
/**
* Notification after playback end (after the file was unloaded).
+ * See also mpv_event and mpv_event_end_file.
*/
MPV_EVENT_END_FILE = 7,
/**
@@ -1000,6 +1001,18 @@ typedef struct mpv_event_pause_reason {
int by_keep_open;
} mpv_event_pause_reason;
+typedef struct mpv_event_end_file {
+ /**
+ * Identifies the reason why playback was stopped:
+ * 0: the end of the file was reached or initialization failed
+ * 1: the file is restarted (e.g. edition switching)
+ * 2: playback was aborted by an external action (e.g. playlist controls)
+ * 3: the player received the quit command
+ * Other values should be treated as unknown.
+ */
+ int reason;
+} mpv_event_end_file;
+
typedef struct mpv_event_script_input_dispatch {
/**
* Arbitrary integer value that was provided as argument to the
@@ -1054,6 +1067,7 @@ typedef struct mpv_event {
* MPV_EVENT_UNPAUSE: mpv_event_pause_reason*
* MPV_EVENT_SCRIPT_INPUT_DISPATCH: mpv_event_script_input_dispatch*
* MPV_EVENT_CLIENT_MESSAGE: mpv_event_client_message*
+ * MPV_EVENT_END_FILE: mpv_event_end_file*
* other: NULL
*
* Note: future enhancements might add new event structs for existing or new