From c418aa38077e28a4e2303b9fbbe693d4830c8542 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 24 Feb 2020 00:31:46 +0100 Subject: ipc: allow sending commands with named arguments This has been part of the libmpv for a while, so the implementation in the IPC code is quite simple: just pass the mpv_node representing the value of the "command" field without further checks to mpv_command_node(). The only problem are the IPC-specific commands, which essentially have their own dispatch mechanism. They expect an array. I'm not going to rewrite the dispatch mechanism, so these still work only with an array. I decided make the other case explicit with cmd==NULL. (I could also have set cmd=="", which would have avoided changing each if condition since "" matches no existing command, but that felt dirty.) --- DOCS/man/ipc.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'DOCS') diff --git a/DOCS/man/ipc.rst b/DOCS/man/ipc.rst index 40e0730089..fdf5daf9b6 100644 --- a/DOCS/man/ipc.rst +++ b/DOCS/man/ipc.rst @@ -202,6 +202,17 @@ commands that finished execution immediately. Cancellation of asynchronous commands is available in the libmpv API, but has not yet been implemented in the IPC protocol. +Commands with named arguments +----------------------------- + +If the ``command`` field is a JSON object, named arguments are expected. This +is described in the C API ``mpv_command_node()`` documentation (the +``MPV_FORMAT_NODE_MAP`` case). In some cases, this may make commands more +readable, while some obscure commands basically require using named arguments. + +Currently, only "proper" commands (as listed by `List of Input Commands`_) +support named arguments. + Commands -------- -- cgit v1.2.3