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. --- DOCS/man/ipc.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'DOCS/man') diff --git a/DOCS/man/ipc.rst b/DOCS/man/ipc.rst index 2aa406b190..42e67f6e4a 100644 --- a/DOCS/man/ipc.rst +++ b/DOCS/man/ipc.rst @@ -297,3 +297,30 @@ Is equivalent to: :: { "objkey": "value\n" } + +Alternative ways of starting clients +------------------------------------ + +You can create an anonymous IPC connection without having to set +``--input-ipc-server``. This is achieved through a mpv pseudo scripting backend +that starts processes. + +You can put ``.run`` file extension in the mpv scripts directory in its config +directory (see the `FILES`_ section for details), or load them through other +means (see `Script location`_). These scripts are simply executed with the OS +native mechanism (as if you ran them in the shell). They must have a proper +shebang and have the executable bit set. + +When executed, a socket (the IPC connection) is passed to them through file +descriptor inheritance. The file descriptor is indicated as the special command +line argument ``--mpv-ipc-fd=N``, where ``N`` is the numeric file descriptor. +Currently, this is hardcoded as ``--mpv-ipc-fd=3``, and the intention is that +it will always be ``3``. (This was a promise between keeping it as simple as +possible, and not doing too much implicitly. Also, since there is a chance that +this will change anyway, you should at least validate that you got the expected +argument.) + +The rest is the same as with a normal ``--input-ipc-server`` IPC connection. mpv +does not attempt to observe or other interact with the started script process. + +This does not work in Windows yet. -- cgit v1.2.3