From de59b87609f99da7c6f5deea688829d5398fc64d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Nov 2014 14:13:05 +0100 Subject: ipc: add a command to retrieve API version --- DOCS/man/ipc.rst | 4 ++++ input/ipc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/DOCS/man/ipc.rst b/DOCS/man/ipc.rst index 3d0be74423..2b5b3d2156 100644 --- a/DOCS/man/ipc.rst +++ b/DOCS/man/ipc.rst @@ -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 ----- diff --git a/input/ipc.c b/input/ipc.c index 1fb096842b..548bb3fe39 100644 --- a/input/ipc.c +++ b/input/ipc.c @@ -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; -- cgit v1.2.3