mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Update MPV headers
This commit is contained in:
118
Vendor/mpv/include/client.h
vendored
118
Vendor/mpv/include/client.h
vendored
@@ -141,7 +141,15 @@ extern "C" {
|
||||
* - In certain cases, mpv may start sub processes (such as with the ytdl
|
||||
* wrapper script).
|
||||
* - Using UNIX IPC (off by default) will override the SIGPIPE signal handler,
|
||||
* and set it to SIG_IGN.
|
||||
* and set it to SIG_IGN. Some invocations of the "subprocess" command will
|
||||
* also do that.
|
||||
* - mpv will reseed the legacy C random number generator by calling srand() at
|
||||
* some random point once.
|
||||
* - mpv may start sub processes, so overriding SIGCHLD, or waiting on all PIDs
|
||||
* (such as calling wait()) by the parent process or any other library within
|
||||
* the process must be avoided. libmpv itself only waits for its own PIDs.
|
||||
* - If anything in the process registers signal handlers, they must set the
|
||||
* SA_RESTART flag. Otherwise you WILL get random failures on signals.
|
||||
*
|
||||
* Encoding of filenames
|
||||
* ---------------------
|
||||
@@ -227,7 +235,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, 109)
|
||||
|
||||
/**
|
||||
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
|
||||
@@ -386,6 +394,23 @@ void mpv_free(void *data);
|
||||
*/
|
||||
const char *mpv_client_name(mpv_handle *ctx);
|
||||
|
||||
/**
|
||||
* Return the ID of this client handle. Every client has its own unique ID. This
|
||||
* ID is never reused by the core, even if the mpv_handle at hand gets destroyed
|
||||
* and new handles get allocated.
|
||||
*
|
||||
* IDs are never 0 or negative.
|
||||
*
|
||||
* Some mpv APIs (not necessarily all) accept a name in the form "@<id>" in
|
||||
* addition of the proper mpv_client_name(), where "<id>" is the ID in decimal
|
||||
* form (e.g. "@123"). For example, the "script-message-to" command takes the
|
||||
* client name as first argument, but also accepts the client ID formatted in
|
||||
* this manner.
|
||||
*
|
||||
* @return The client ID.
|
||||
*/
|
||||
int64_t mpv_client_id(mpv_handle *ctx);
|
||||
|
||||
/**
|
||||
* Create a new mpv instance and an associated client API handle to control
|
||||
* the mpv instance. This instance is in a pre-initialized state,
|
||||
@@ -643,7 +668,9 @@ int64_t mpv_get_time_us(mpv_handle *ctx);
|
||||
*/
|
||||
typedef enum mpv_format {
|
||||
/**
|
||||
* Invalid. Sometimes used for empty values.
|
||||
* Invalid. Sometimes used for empty values. This is always defined to 0,
|
||||
* so a normal 0-init of mpv_format (or e.g. mpv_node) is guaranteed to set
|
||||
* this it to MPV_FORMAT_NONE (which makes some things saner as consequence).
|
||||
*/
|
||||
MPV_FORMAT_NONE = 0,
|
||||
/**
|
||||
@@ -760,8 +787,7 @@ typedef enum mpv_format {
|
||||
MPV_FORMAT_NODE_MAP = 8,
|
||||
/**
|
||||
* A raw, untyped byte array. Only used only with mpv_node, and only in
|
||||
* some very special situations. (Currently, only for the screenshot-raw
|
||||
* command.)
|
||||
* some very specific situations. (Some commands use it.)
|
||||
*/
|
||||
MPV_FORMAT_BYTE_ARRAY = 9
|
||||
} mpv_format;
|
||||
@@ -1006,6 +1032,11 @@ int mpv_command_string(mpv_handle *ctx, const char *args);
|
||||
* error code set if running the command failed. For commands that
|
||||
* return data, the data is put into mpv_event_command.result.
|
||||
*
|
||||
* The only case when you do not receive an event is when the function call
|
||||
* itself fails. This happens only if parsing the command itself (or otherwise
|
||||
* validating it) fails, i.e. the return code of the API call is not 0 or
|
||||
* positive.
|
||||
*
|
||||
* Safe to be called from mpv render API threads.
|
||||
*
|
||||
* @param reply_userdata the value mpv_event.reply_userdata of the reply will
|
||||
@@ -1287,6 +1318,7 @@ typedef enum mpv_event_id {
|
||||
MPV_EVENT_COMMAND_REPLY = 5,
|
||||
/**
|
||||
* Notification before playback start of a file (before the file is loaded).
|
||||
* See also mpv_event and mpv_event_start_file.
|
||||
*/
|
||||
MPV_EVENT_START_FILE = 6,
|
||||
/**
|
||||
@@ -1318,15 +1350,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.
|
||||
*
|
||||
@@ -1419,9 +1455,9 @@ typedef enum mpv_event_id {
|
||||
MPV_EVENT_SEEK = 20,
|
||||
/**
|
||||
* There was a discontinuity of some sort (like a seek), and playback
|
||||
* was reinitialized. Usually happens after seeking, or ordered chapter
|
||||
* segment switches. The main purpose is allowing the client to detect
|
||||
* when a seek request is finished.
|
||||
* was reinitialized. Usually happens on start of playback and after
|
||||
* seeking. The main purpose is allowing the client to detect when a seek
|
||||
* request is finished.
|
||||
*/
|
||||
MPV_EVENT_PLAYBACK_RESTART = 21,
|
||||
/**
|
||||
@@ -1581,6 +1617,14 @@ typedef enum mpv_end_file_reason {
|
||||
MPV_END_FILE_REASON_REDIRECT = 5,
|
||||
} mpv_end_file_reason;
|
||||
|
||||
/// Since API version 1.108.
|
||||
typedef struct mpv_event_start_file {
|
||||
/**
|
||||
* Playlist entry ID of the file being loaded now.
|
||||
*/
|
||||
int64_t playlist_entry_id;
|
||||
} mpv_event_start_file;
|
||||
|
||||
typedef struct mpv_event_end_file {
|
||||
/**
|
||||
* Corresponds to the values in enum mpv_end_file_reason (the "int" type
|
||||
@@ -1596,6 +1640,34 @@ typedef struct mpv_event_end_file {
|
||||
* Since API version 1.9.
|
||||
*/
|
||||
int error;
|
||||
/**
|
||||
* Playlist entry ID of the file that was being played or attempted to be
|
||||
* played. This has the same value as the playlist_entry_id field in the
|
||||
* corresponding mpv_event_start_file event.
|
||||
* Since API version 1.108.
|
||||
*/
|
||||
int64_t playlist_entry_id;
|
||||
/**
|
||||
* If loading ended, because the playlist entry to be played was for example
|
||||
* a playlist, and the current playlist entry is replaced with a number of
|
||||
* other entries. This may happen at least with MPV_END_FILE_REASON_REDIRECT
|
||||
* (other event types may use this for similar but different purposes in the
|
||||
* future). In this case, playlist_insert_id will be set to the playlist
|
||||
* entry ID of the first inserted entry, and playlist_insert_num_entries to
|
||||
* the total number of inserted playlist entries. Note this in this specific
|
||||
* case, the ID of the last inserted entry is playlist_insert_id+num-1.
|
||||
* Beware that depending on circumstances, you may observe the new playlist
|
||||
* entries before seeing the event (e.g. reading the "playlist" property or
|
||||
* getting a property change notification before receiving the event).
|
||||
* Since API version 1.108.
|
||||
*/
|
||||
int64_t playlist_insert_id;
|
||||
/**
|
||||
* See playlist_insert_id. Only non-0 if playlist_insert_id is valid. Never
|
||||
* negative.
|
||||
* Since API version 1.108.
|
||||
*/
|
||||
int playlist_insert_num_entries;
|
||||
} mpv_event_end_file;
|
||||
|
||||
#if MPV_ENABLE_DEPRECATED
|
||||
@@ -1675,6 +1747,7 @@ typedef struct mpv_event {
|
||||
* MPV_EVENT_PROPERTY_CHANGE: mpv_event_property*
|
||||
* MPV_EVENT_LOG_MESSAGE: mpv_event_log_message*
|
||||
* MPV_EVENT_CLIENT_MESSAGE: mpv_event_client_message*
|
||||
* MPV_EVENT_START_FILE: mpv_event_start_file* (since v1.108)
|
||||
* MPV_EVENT_END_FILE: mpv_event_end_file*
|
||||
* MPV_EVENT_HOOK: mpv_event_hook*
|
||||
* MPV_EVENT_COMMAND_REPLY* mpv_event_command*
|
||||
@@ -1686,6 +1759,31 @@ typedef struct mpv_event {
|
||||
void *data;
|
||||
} mpv_event;
|
||||
|
||||
/**
|
||||
* Convert the given src event to a mpv_node, and set *dst to the result. *dst
|
||||
* is set to a MPV_FORMAT_NODE_MAP, with fields for corresponding mpv_event and
|
||||
* mpv_event.data/mpv_event_* fields.
|
||||
*
|
||||
* The exact details are not completely documented out of laziness. A start
|
||||
* is located in the "Events" section of the manpage.
|
||||
*
|
||||
* *dst may point to newly allocated memory, or pointers in mpv_event. You must
|
||||
* copy the entire mpv_node if you want to reference it after mpv_event becomes
|
||||
* invalid (such as making a new mpv_wait_event() call, or destroying the
|
||||
* mpv_handle from which it was returned). Call mpv_free_node_contents() to free
|
||||
* any memory allocations made by this API function.
|
||||
*
|
||||
* Safe to be called from mpv render API threads.
|
||||
*
|
||||
* @param dst Target. This is not read and fully overwritten. Must be released
|
||||
* with mpv_free_node_contents(). Do not write to pointers returned
|
||||
* by it. (On error, this may be left as an empty node.)
|
||||
* @param src The source event. Not modified (it's not const due to the author's
|
||||
* prejudice of the C version of const).
|
||||
* @return error code (MPV_ERROR_NOMEM only, if at all)
|
||||
*/
|
||||
int mpv_event_to_node(mpv_node *dst, mpv_event *src);
|
||||
|
||||
/**
|
||||
* Enable or disable the given event.
|
||||
*
|
||||
|
Reference in New Issue
Block a user