Since API version 1.9.
List of error codes than can be returned by API functions. 0 and positive return values always mean success, negative values are always errors.
Data format for options and properties. The API functions to get/set properties and options support multiple formats, and this enum describes them.
Numeric log levels. The lower the number, the more important the message is. MPV_LOG_LEVEL_NONE is never used when receiving messages. The string in the comment after the value is the name of the log level as used for the mpv_request_log_messages() function. Unused numeric values are unused, but reserved for future use.
@deprecated use render.h
The version is incremented on each API change. The 16 lower bits form the minor version number, and the 16 higher bits the major version number. If the API becomes incompatible to previous versions, the major version number is incremented. This affects only C part, and not properties and options.
Signal to all async requests with the matching ID to abort. This affects the following API calls:
Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with.
Return the name of this client handle. Every client has its own unique name, which is mostly used for user interface purposes.
Send a command to the player. Commands are the same as those used in input.conf, except that this function takes parameters in a pre-split form.
Same as mpv_command, but run the command asynchronously.
Same as mpv_command(), but allows passing structured data in any format. In particular, calling mpv_command() is exactly like calling mpv_command_node() with the format set to MPV_FORMAT_NODE_ARRAY, and every arg passed in order as MPV_FORMAT_STRING.
Same as mpv_command_node(), but run it asynchronously. Basically, this function is to mpv_command_node() what mpv_command_async() is to mpv_command().
This is essentially identical to mpv_command() but it also returns a result.
Same as mpv_command, but use input.conf parsing for splitting arguments. This is slightly simpler, but also more error prone, since arguments may need quoting/escaping.
Create a new mpv instance and an associated client API handle to control the mpv instance. This instance is in a pre-initialized state, and needs to be initialized to be actually used with most other API functions.
Create a new client handle connected to the same player core as ctx. This context has its own event queue, its own mpv_request_event() state, its own mpv_request_log_messages() state, its own set of observed properties, and its own state for asynchronous operations. Otherwise, everything is shared.
This is the same as mpv_create_client(), but the created mpv_handle is treated as a weak reference. If all mpv_handles referencing a core are weak references, the core is automatically destroyed. (This still goes through normal uninit of course. Effectively, if the last non-weak mpv_handle is destroyed, then the weak mpv_handles receive MPV_EVENT_SHUTDOWN and are asked to terminate as well.)
Disconnect and destroy the mpv_handle. ctx will be deallocated with this API call.
@deprecated use mpv_destroy(), which has exactly the same semantics (the deprecation is a mere rename)
Return a string describing the error. For unknown errors, the string "unknown error" is returned.
Return a string describing the event. For unknown events, NULL is returned.
General function to deallocate memory returned by some of the API functions. Call this only if it's explicitly documented as allowed. Calling this on mpv memory not owned by the caller will lead to undefined behavior.
Frees any data referenced by the node. It doesn't free the node itself. Call this only if the mpv client API set the node. If you constructed the node yourself (manually), you have to free it yourself.
Read the value of the given property.
Get a property asynchronously. You will receive the result of the operation as well as the property data with the MPV_EVENT_GET_PROPERTY_REPLY event. You should check the mpv_event.error field on the reply event.
Return the property as "OSD" formatted string. This is the same as mpv_get_property_string, but using MPV_FORMAT_OSD_STRING.
Return the value of the property with the given name as string. This is equivalent to mpv_get_property() with MPV_FORMAT_STRING.
This is used for additional APIs that are not strictly part of the core API. See the individual mpv_sub_api member values.
Return the internal time in microseconds. This has an arbitrary start offset, but will never wrap or go backwards.
Return a UNIX file descriptor referring to the read end of a pipe. This pipe can be used to wake up a poll() based processing loop. The purpose of this function is very similar to mpv_set_wakeup_callback(), and provides a primitive mechanism to handle coordinating a foreign event loop and the libmpv event loop. The pipe is non-blocking. It's closed when the mpv_handle is destroyed. This function always returns the same value (on success).
A hook is like a synchronous event that blocks the player. You register a hook handler with this function. You will get an event, which you need to handle, and once things are ready, you can let the player continue with mpv_hook_continue().
Respond to a MPV_EVENT_HOOK event. You must call this after you have handled the event. There is no way to "cancel" or "stop" the hook.
Initialize an uninitialized mpv instance. If the mpv instance is already running, an error is returned.
Load a config file. This loads and parses the file, and sets every entry in the config file's default section as if mpv_set_option_string() is called.
Get a notification whenever the given property changes. You will receive updates as MPV_EVENT_PROPERTY_CHANGE. Note that this is not very precise: for some properties, it may not send updates even if the property changed. This depends on the property, and it's a valid feature request to ask for better update handling of a specific property. (For some properties, like `clock`, which shows the wall clock, this mechanism doesn't make too much sense anyway.)
Enable or disable the given event.
Enable or disable receiving of log messages. These are the messages the command line player prints to the terminal. This call sets the minimum required log level for a message to be received with MPV_EVENT_LOG_MESSAGE.
See mpv_suspend().
Set an option. Note that you can't normally set options during runtime. It works in uninitialized state (see mpv_create()), and in some cases in at runtime.
Convenience function to set an option to a string value. This is like calling mpv_set_option() with MPV_FORMAT_STRING.
Set a property to a given value. Properties are essentially variables which can be queried or set at runtime. For example, writing to the pause property will actually pause or unpause playback.
Set a property asynchronously. You will receive the result of the operation as MPV_EVENT_SET_PROPERTY_REPLY event. The mpv_event.error field will contain the result status of the operation. Otherwise, this function is similar to mpv_set_property().
Convenience function to set a property to a string value.
Set a custom function that should be called when there are new events. Use this if blocking in mpv_wait_event() to wait for new events is not feasible.
This does nothing since mpv 0.23.0 (API version 1.24). Below is the description of the old behavior.
Similar to mpv_destroy(), but brings the player and all clients down as well, and waits until all of them are destroyed. This function blocks. The advantage over mpv_destroy() is that while mpv_destroy() merely detaches the client handle from the player, this function quits the player, waits until all other clients are destroyed (i.e. all mpv_handles are detached), and also waits for the final termination of the player.
Undo mpv_observe_property(). This will remove all observed properties for which the given number was passed as reply_userdata to mpv_observe_property.
Block until all asynchronous requests are done. This affects functions like mpv_command_async(), which return immediately and return their result as events.
Wait for the next event, or until the timeout expires, or if another thread makes a call to mpv_wakeup(). Passing 0 as timeout will never wait, and is suitable for polling.
Interrupt the current mpv_wait_event() call. This will wake up the thread currently waiting in mpv_wait_event(). If no thread is waiting, the next mpv_wait_event() call will return immediately (this is to avoid lost wakeups).
The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before including any libmpv headers. Then deprecated symbols will be excluded from the headers. (Of course, deprecated properties and commands and other functionality will still work.)
(see mpv_node)
@deprecated see MPV_EVENT_SCRIPT_INPUT_DISPATCH for remarks
Client context used by the client API. Every client has its own private handle.
Generic data storage.
(see mpv_node)