From e2ab6b7f3567542a2a1b5aab053d513737e72878 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 19 Feb 2020 22:18:15 +0100 Subject: scripting: add a way to run sub processes as "scripts" This is just a more convenient way to start IPC client scripts per mpv instance. Does not work on Windows, although it could if the subprocess and IPC parts are implemented (and I guess .exe/.bat suffixes are required). Also untested whether it builds on Windows. A lot of other things are untested too, so don't complain. --- input/input.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'input/input.h') diff --git a/input/input.h b/input/input.h index df51cb7ed4..1a90a47d42 100644 --- a/input/input.h +++ b/input/input.h @@ -213,10 +213,20 @@ void mp_input_sdl_gamepad_add(struct input_ctx *ictx); struct mp_ipc_ctx; struct mp_client_api; +struct mpv_handle; // Platform specific implementation, provided by ipc-*.c. struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, struct mpv_global *global); +// Start a thread for the given handle and return a socket in out_fd[0] that +// is served by this thread. If the FD is not full-duplex, then out_fd[0] is +// the user's read-end, and out_fd[1] the write-end, otherwise out_fd[1] is set +// to -1. +// returns: +// true: out_fd[0] and out_fd[1] are set, ownership of h is transferred +// false: out_fd are not touched, caller retains ownership of h +bool mp_ipc_start_anon_client(struct mp_ipc_ctx *ctx, struct mpv_handle *h, + int out_fd[2]); void mp_uninit_ipc(struct mp_ipc_ctx *ctx); // Serialize the given mpv_event structure to JSON. Returns an allocated string. -- cgit v1.2.3