summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/client-api-changes.rst4
-rw-r--r--DOCS/interface-changes.rst21
-rw-r--r--DOCS/man/input.rst406
-rw-r--r--DOCS/man/ipc.rst42
-rw-r--r--DOCS/man/lua.rst92
-rw-r--r--DOCS/man/options.rst113
-rw-r--r--TOOLS/lua/command-test.lua95
-rw-r--r--audio/decode/ad_lavc.c6
-rw-r--r--audio/out/ao.c25
-rw-r--r--audio/out/ao.h7
-rw-r--r--common/global.h5
-rw-r--r--common/msg.c11
-rw-r--r--common/msg_control.h3
-rw-r--r--common/playlist.c7
-rw-r--r--common/playlist.h4
-rw-r--r--demux/demux.c235
-rw-r--r--demux/demux.h17
-rw-r--r--demux/demux_disc.c16
-rw-r--r--demux/demux_lavf.c4
-rw-r--r--demux/demux_mkv_timeline.c18
-rw-r--r--demux/demux_playlist.c1
-rw-r--r--demux/demux_timeline.c6
-rw-r--r--demux/demux_tv.c2
-rw-r--r--demux/timeline.c6
-rw-r--r--etc/input.conf6
-rw-r--r--filters/f_decoder_wrapper.c21
-rw-r--r--input/cmd.c242
-rw-r--r--input/cmd.h34
-rw-r--r--input/input.c40
-rw-r--r--input/input.h4
-rw-r--r--input/ipc-unix.c7
-rw-r--r--input/ipc-win.c5
-rw-r--r--input/ipc.c23
-rw-r--r--libmpv/client.h105
-rw-r--r--libmpv/mpv.def1
-rw-r--r--libmpv/render_gl.h18
-rw-r--r--libmpv/stream_cb.h2
-rw-r--r--misc/json.c59
-rw-r--r--misc/linked_list.h107
-rw-r--r--misc/node.c65
-rw-r--r--misc/node.h3
-rw-r--r--misc/thread_pool.c200
-rw-r--r--misc/thread_pool.h28
-rw-r--r--misc/thread_tools.c269
-rw-r--r--misc/thread_tools.h82
-rw-r--r--options/m_config.c647
-rw-r--r--options/m_config.h40
-rw-r--r--options/m_option.h1
-rw-r--r--options/options.c28
-rw-r--r--options/options.h25
-rw-r--r--options/parse_commandline.c8
-rw-r--r--options/parse_commandline.h2
-rw-r--r--options/path.c22
-rw-r--r--options/path.h3
-rw-r--r--osdep/compiler.h5
-rw-r--r--osdep/subprocess-posix.c3
-rw-r--r--osdep/subprocess-win.c1
-rw-r--r--osdep/timer.c10
-rw-r--r--osdep/timer.h6
-rw-r--r--player/client.c262
-rw-r--r--player/client.h1
-rw-r--r--player/command.c949
-rw-r--r--player/command.h27
-rw-r--r--player/core.h45
-rw-r--r--player/external_files.c27
-rw-r--r--player/external_files.h4
-rw-r--r--player/loadfile.c355
-rw-r--r--player/lua.c136
-rw-r--r--player/lua/defaults.lua62
-rw-r--r--player/main.c34
-rw-r--r--player/misc.c18
-rw-r--r--player/osd.c40
-rw-r--r--player/playloop.c27
-rw-r--r--player/screenshot.c185
-rw-r--r--player/screenshot.h22
-rw-r--r--player/sub.c6
-rw-r--r--player/video.c3
-rw-r--r--stream/cache.c808
-rw-r--r--stream/cache_file.c158
-rw-r--r--stream/stream.c233
-rw-r--r--stream/stream.h36
-rw-r--r--stream/stream_avdevice.c1
-rw-r--r--stream/stream_dvb.c2
-rw-r--r--stream/stream_dvdnav.c1
-rw-r--r--stream/stream_edl.c1
-rw-r--r--stream/stream_file.c12
-rw-r--r--stream/stream_lavf.c1
-rw-r--r--stream/stream_libarchive.c1
-rw-r--r--stream/stream_memory.c1
-rw-r--r--stream/stream_mf.c1
-rw-r--r--stream/stream_tv.c1
-rw-r--r--test/json.c97
-rw-r--r--test/linked_list.c162
-rw-r--r--video/decode/vd_lavc.c62
-rw-r--r--video/out/gpu/video.c4
-rw-r--r--video/out/vo.c20
-rw-r--r--waftools/detections/compiler.py7
-rw-r--r--wscript_build.py3
98 files changed, 3936 insertions, 3147 deletions
diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst
index 6197e48a39..b9b264d220 100644
--- a/DOCS/client-api-changes.rst
+++ b/DOCS/client-api-changes.rst
@@ -32,6 +32,10 @@ API changes
::
--- mpv 0.30.0 ---
+ 1.103 - redo handling of async commands
+ - add mpv_event_command and make it possible to return values from
+ commands issued with mpv_command_async() or mpv_command_node_async()
+ - add mpv_abort_async_command()
1.102 - rename struct mpv_opengl_drm_osd_size to mpv_opengl_drm_draw_surface_size
- rename MPV_RENDER_PARAM_DRM_OSD_SIZE to MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index cbc9af18f8..82a5d1a875 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -47,6 +47,25 @@ Interface changes
- support for `--spirv-compiler=nvidia` has been removed, leaving `shaderc`
as the only option. The `--spirv-compiler` option itself has been marked
as deprecated, and may be removed in the future.
+ - ipc: require that "request_id" fields are integers. Other types are still
+ accepted for compatibility, but this will stop in the future. Also, if no
+ request_id is provided, 0 will be assumed.
+ - mpv_command_node() and mp.command_native() now support named arguments
+ (see manpage). If you want to use them, use a new version of the manpage
+ as reference, which lists the definitive names.
+ - edition and disc title switching will now fully reload playback (may have
+ consequences for scripts, client API, or when using file-local options)
+ - remove async playback abort hack. This breaks aborting playback in the
+ following cases, iff the current stream is a network stream that
+ completely stopped responding:
+ - setting "program" property
+ - setting "cache-size" property
+ In earlier versions of mpv, the player core froze as well in these cases,
+ but could still be aborted with the quit, stop, playlist-prev,
+ playlist-next commands. If these properties are not accessed, frozen
+ network streams should not freeze the player core (only playback in
+ uncached regions), and differing behavior should be reported as a bug.
+ If --demuxer-thread=no is used, there are no guarantees.
--- mpv 0.29.0 ---
- drop --opensles-sample-rate, as --audio-samplerate should be used if desired
- drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid,
@@ -131,8 +150,6 @@ Interface changes
of 3D content doesn't justify such an option anyway.
- change cycle-values command to use the current value, instead of an
internal counter that remembered the current position.
- - edition and disc title switching will now fully reload playback (may have
- consequences for scripts, client API, or when using file-local options)
- remove deprecated ao/vo auto profiles. Consider using scripts like
auto-profiles.lua instead.
--- mpv 0.28.0 ---
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 2fcf6857e7..7c95965773 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -41,10 +41,10 @@ commands they're bound to on the OSD, instead of executing the commands::
(Only closing the window will make **mpv** exit, pressing normal keys will
merely display the binding, even if mapped to quit.)
-General Input Command Syntax
-----------------------------
+input.conf syntax
+-----------------
-``[Shift+][Ctrl+][Alt+][Meta+]<key> [{<section>}] [<prefixes>] <command> (<argument>)* [; <command>]``
+``[Shift+][Ctrl+][Alt+][Meta+]<key> [{<section>}] <command> ( ; <command> )*``
Note that by default, the right Alt key can be used to create special
characters, and thus does not register as a modifier. The option
@@ -59,9 +59,9 @@ character), or a symbolic name (as printed by ``--input-keylist``).
``<section>`` (braced with ``{`` and ``}``) is the input section for this
command.
-Arguments are separated by whitespace. This applies even to string arguments.
-For this reason, string arguments should be quoted with ``"``. Inside quotes,
-C-style escaping can be used.
+``<command>`` is the command itself. It consists of the command name and
+multiple (or none) commands, all separated by whitespace. String arguments
+need to be quoted with ``"``. Details see ``Flat command syntax``.
You can bind multiple commands to one key. For example:
@@ -78,15 +78,89 @@ that matches, and the multi-key command will never be called. Intermediate keys
can be remapped to ``ignore`` in order to avoid this issue. The maximum number
of (non-modifier) keys for combinations is currently 4.
+Flat command syntax
+-------------------
+
+This is the syntax used in input.conf, and referred to "input.conf syntax" in
+a number of other places.
+
+``<command> ::= [<prefixes>] <command_name> (<argument>)*``
+``<argument> ::= (<string> | " <quoted_string> " )``
+
+``command_name`` is an unquoted string with the command name itself. See
+`List of Input Commands`_ for a list.
+
+Arguments are separated by whitespace. This applies even to string arguments.
+For this reason, string arguments should be quoted with ``"``. If a string
+argument contains spaces or certain special characters, quoting and possibly
+escaping is mandatory, or the command cannot be parsed correctly.
+
+Inside quotes, C-style escaping can be used. JSON escapes according to RFC 8259,
+minus surrogate pair escapes, should be a safe subset that can be used.
+
+Commands specified as arrays
+----------------------------
+
+This applies to certain APIs, such as ``mp.commandv()`` or
+``mp.command_native()`` (with array parameters) in Lua scripting, or
+``mpv_command()`` or ``mpv_command_node()`` (with MPV_FORMAT_NODE_ARRAY) in the
+C libmpv client API.
+
+The command as well as all arguments are passed as a single array. Similar to
+the `Flat command syntax`_, you can first pass prefixes as strings (each as
+separate array item), then the command name as string, and then each argument
+as string or a native value.
+
+Since these APIs pass arguments as separate strings or native values, they do
+not expect quotes, and do support escaping. Technically, there is the input.conf
+parser, which first splits the command string into arguments, and then invokes
+argument parsers for each argument. The input.conf parser normally handles
+quotes and escaping. The array command APIs mentioned above pass strings
+directly to the argument parsers, or can sidestep them by the ability to pass
+non-string values.
+
+Sometimes commands have string arguments, that in turn are actually parsed by
+other components (e.g. filter strings with ``vf add``) - in these cases, you
+you would have to double-escape in input.conf, but not with the array APIs.
+
+For complex commands, consider using `Named arguments`_ instead, which should
+give slightly more compatibility. Some commands do not support named arguments
+and inherently take an array, though.
+
+Named arguments
+---------------
+
+This applies to certain APIs, such as ``mp.command_native()`` (with tables that
+have string keys) in Lua scripting, or ``mpv_command_node()`` (with
+MPV_FORMAT_NODE_MAP) in the C libmpv client API.
+
+Like with array commands, quoting and escaping is inherently not needed in the
+normal case.
+
+The name of each command is defined in each command description in the
+`List of Input Commands`_. ``--input-cmdlist`` also lists them.
+
+Some commands do not support named arguments (e.g. ``run`` command). You need
+to use APIs that pass arguments as arrays.
+
+Named arguments are not supported in the "flat" input.conf syntax, which means
+you cannot use them for key bindings in input.conf at all.
+
List of Input Commands
----------------------
+Commands with parameters have the parameter name enclosed in ``<`` / ``>``.
+Don't add those to the actual command. Optional arguments are enclosed in
+``[`` / ``]``. If you don't pass them, they will be set to a default value.
+
+Remember to quote string arguments in input.conf (see `Flat command syntax`_).
+
``ignore``
Use this to "block" keys that should be unbound, and do nothing. Useful for
disabling default bindings, without disabling all bindings with
``--no-input-default-bindings``.
-``seek <seconds> [relative|absolute|absolute-percent|relative-percent|exact|keyframes]``
+``seek <target> [<flags>]``
Change the playback position. By default, seeks by a relative amount of
seconds.
@@ -114,7 +188,7 @@ List of Input Commands
3rd parameter (essentially using a space instead of ``+``). The 3rd
parameter is still parsed, but is considered deprecated.
-``revert-seek [mode]``
+``revert-seek [<flags>]``
Undoes the ``seek`` command, and some other commands that seek (but not
necessarily all of them). Calling this command once will jump to the
playback position before the seek. Calling it a second time undoes the
@@ -144,22 +218,24 @@ List of Input Commands
This does not work with audio-only playback.
-``set <property> "<value>"``
- Set the given property to the given value.
+``set <name> <value>``
+ Set the given property or option to the given value.
-``add <property> [<value>]``
- Add the given value to the property. On overflow or underflow, clamp the
- property to the maximum. If ``<value>`` is omitted, assume ``1``.
+``add <name> [<value>]``
+ Add the given value to the property or option. On overflow or underflow,
+ clamp the property to the maximum. If ``<value>`` is omitted, assume ``1``.
-``cycle <property> [up|down]``
- Cycle the given property. ``up`` and ``down`` set the cycle direction. On
- overflow, set the property back to the minimum, on underflow set it to the
- maximum. If ``up`` or ``down`` is omitted, assume ``up``.
+``cycle <name> [<value>]``
+ Cycle the given property or option. The second argument can be ``up`` or
+ ``down`` to set the cycle direction. On overflow, set the property back to
+ the minimum, on underflow set it to the maximum. If ``up`` or ``down`` is
+ omitted, assume ``up``.
-``multiply <property> <factor>``
- Multiplies the value of a property with the numeric factor.
+``multiply <name> <value>``
+ Similar to ``add``, but multiplies the property or option with the numeric
+ value.
-``screenshot [subtitles|video|window|single|each-frame]``
+``screenshot <flags>``