summaryrefslogtreecommitdiffstats
path: root/input/ipc.c
diff options
context:
space:
mode:
authorAnton Kindestam <antonki@kth.se>2018-12-05 19:02:03 +0100
committerAnton Kindestam <antonki@kth.se>2018-12-05 19:19:24 +0100
commit8b83c8996686072bc743b112ae5cb3bf93aa33ed (patch)
treeb09ce6a7ff470b05006622f19914b3d39d2f7d9f /input/ipc.c
parent5bcac8580df6fc62323136f756a3a6d1e754fe9c (diff)
parent559a400ac36e75a8d73ba263fd7fa6736df1c2da (diff)
downloadmpv-8b83c8996686072bc743b112ae5cb3bf93aa33ed.tar.bz2
mpv-8b83c8996686072bc743b112ae5cb3bf93aa33ed.tar.xz
Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into wm4-commits--merge-edition
This bumps libmpv version to 1.103
Diffstat (limited to 'input/ipc.c')
-rw-r--r--input/ipc.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/input/ipc.c b/input/ipc.c
index 3a735dab14..6568feacfa 100644
--- a/input/ipc.c
+++ b/input/ipc.c
@@ -20,23 +20,12 @@
#include "common/msg.h"
#include "input/input.h"
#include "misc/json.h"
+#include "misc/node.h"
#include "options/m_option.h"
#include "options/options.h"
#include "options/path.h"
#include "player/client.h"
-static mpv_node *mpv_node_map_get(mpv_node *src, const char *key)
-{
- if (src->format != MPV_FORMAT_NODE_MAP)
- return NULL;
-
- for (int i = 0; i < src->u.list->num; i++)
- if (!strcmp(key, src->u.list->keys[i]))
- return &src->u.list->values[i];
-
- return NULL;
-}
-
static mpv_node *mpv_node_array_get(mpv_node *src, int index)
{
if (src->format != MPV_FORMAT_NODE_ARRAY)
@@ -217,9 +206,13 @@ static char *json_execute_command(struct mpv_handle *client, void *ta_parent,
goto error;
}
- reqid_node = mpv_node_map_get(&msg_node, "request_id");
+ reqid_node = node_map_get(&msg_node, "request_id");
+ if (reqid_node && reqid_node->format != MPV_FORMAT_INT64) {
+ mp_warn(log, "'request_id' must be an integer. Using other types is "
+ "deprecated and will trigger an error in the future!\n");
+ }
- mpv_node *cmd_node = mpv_node_map_get(&msg_node, "command");
+ mpv_node *cmd_node = node_map_get(&msg_node, "command");
if (!cmd_node ||
(cmd_node->format != MPV_FORMAT_NODE_ARRAY) ||
!cmd_node->u.list->num)
@@ -415,6 +408,8 @@ error:
*/
if (reqid_node) {
mpv_node_map_add(ta_parent, &reply_node, "request_id", reqid_node);
+ } else {
+ mpv_node_map_add_int64(ta_parent, &reply_node, "request_id", 0);
}
mpv_node_map_add_string(ta_parent, &reply_node, "error", mpv_error_string(rc));