diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2016-03-17 19:27:30 +1100 |
---|---|---|
committer | James Ross-Gowan <rossymiles@gmail.com> | 2016-03-23 23:15:20 +1100 |
commit | 5bf473d5ca3b1a8f0902d08799b28512eb81070b (patch) | |
tree | 8cf46e3867d1998fae059b31306df5a05e474a86 /input/input.h | |
parent | ba4569cf702c72fd85e11abeb52ba06e860ed2ea (diff) | |
download | mpv-5bf473d5ca3b1a8f0902d08799b28512eb81070b.tar.bz2 mpv-5bf473d5ca3b1a8f0902d08799b28512eb81070b.tar.xz |
ipc: add Windows implementation with named pipes
This implements the JSON IPC protocol with named pipes, which are
probably the closest Windows equivalent to Unix domain sockets in terms
of functionality. Like with Unix sockets, this will allow mpv to listen
for IPC connections and handle multiple IPC clients at once. A few cross
platform libraries and frameworks (Qt, node.js) use named pipes for IPC
on Windows and Unix sockets on Linux and Unix, so hopefully this will
ease the creation of portable JSON IPC clients.
Unlike the Unix implementation, this doesn't share code with
--input-file, meaning --input-file on Windows won't understand JSON
commands (yet.) Sharing code and removing the separate implementation in
pipe-win32.c is definitely a possible future improvement.
Diffstat (limited to 'input/input.h')
-rw-r--r-- | input/input.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/input/input.h b/input/input.h index 41432eb54d..a5710b6065 100644 --- a/input/input.h +++ b/input/input.h @@ -257,4 +257,13 @@ struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, struct mpv_global *global); void mp_uninit_ipc(struct mp_ipc_ctx *ctx); +// Serialize the given mpv_event structure to JSON. Returns an allocated string. +struct mpv_event; +char *mp_json_encode_event(struct mpv_event *event); + +// Given the raw IPC input buffer "buf", remove the first newline-separated +// command, execute it and return the result (if any) as an allocated string. +struct mpv_handle; +char *mp_ipc_consume_next_command(struct mpv_handle *client, void *ctx, bstr *buf); + #endif /* MPLAYER_INPUT_H */ |