summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-19 22:18:15 +0100
committerwm4 <wm4@nowhere>2020-02-19 22:18:15 +0100
commite2ab6b7f3567542a2a1b5aab053d513737e72878 (patch)
tree36f3f24792e4974cf1e6c5601a61e799b098e69a /DOCS
parentd06ebe2251b2ac75ebc6b63b1580ed15adecd3cc (diff)
downloadmpv-e2ab6b7f3567542a2a1b5aab053d513737e72878.tar.bz2
mpv-e2ab6b7f3567542a2a1b5aab053d513737e72878.tar.xz
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.
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/man/ipc.rst27
1 files changed, 27 insertions, 0 deletions
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.