summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-17 02:33:47 +0100
committerwm4 <wm4@nowhere>2014-02-17 02:52:58 +0100
commit75d3267b43093161f94db5199bd36f14c06b7457 (patch)
tree868d2b2c23da83921c6c1546b9d66de71e3d3a35 /player/command.c
parentfe586dbbdb129e00be6c2b5e6739341dc019ab1c (diff)
downloadmpv-75d3267b43093161f94db5199bd36f14c06b7457.tar.bz2
mpv-75d3267b43093161f94db5199bd36f14c06b7457.tar.xz
client API: add a client message event
This comes with a "script_message" input command, which sends these messages. Used by the following commits.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 71b0fa1e60..2831f710c1 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3200,6 +3200,22 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
}
+ case MP_CMD_SCRIPT_MESSAGE: {
+ mpv_event_client_message *event = talloc_ptrtype(NULL, event);
+ *event = (mpv_event_client_message){0};
+ for (int n = 1; n < cmd->nargs; n++) {
+ MP_TARRAY_APPEND(event, event->args, event->num_args,
+ cmd->args[n].v.s);
+ }
+ if (mp_client_send_event(mpctx, cmd->args[0].v.s,
+ MPV_EVENT_CLIENT_MESSAGE, event) < 0)
+ {
+ MP_VERBOSE(mpctx, "Can't find script '%s' for %s.\n",
+ cmd->args[0].v.s, cmd->name);
+ }
+ break;
+ }
+
#if HAVE_SYS_MMAN_H
case MP_CMD_OVERLAY_ADD:
overlay_add(mpctx,