ipc: add a command to retrieve API version

This commit is contained in:
wm4 2014-11-01 14:13:05 +01:00
parent a1e7daf942
commit de59b87609
2 changed files with 8 additions and 0 deletions

View File

@ -156,6 +156,10 @@ extra commands can also be used as part of the protocol:
Undo one ``suspend`` call. ``suspend`` increments an internal counter, and
``resume`` decrements it. When 0 is reached, the player is actually resumed.
``get_version``
Returns the client API version the C API of the remote mpv instance
provides. (Also see ``DOCS/client-api-changes.rst``.)
UTF-8
-----

View File

@ -287,6 +287,10 @@ static char *json_execute_command(struct client_arg *arg, void *ta_parent,
int64_t time_us = mpv_get_time_us(arg->client);
mpv_node_map_add_int64(ta_parent, &reply_node, "data", time_us);
rc = MPV_ERROR_SUCCESS;
} else if (!strcmp("get_version", cmd)) {
int64_t ver = mpv_client_api_version();
mpv_node_map_add_int64(ta_parent, &reply_node, "data", ver);
rc = MPV_ERROR_SUCCESS;
} else if (!strcmp("get_property", cmd)) {
mpv_node result_node;