Obviously, this has no effect on commands which do not support this explicitly. A later commit will enable this for screenshots. Also add some wording on mpv_command_async(), which has nothing to do with this. Having a more elegant, unified behavior would be nice. But the API function was not created for this - it's merely for running commands _synchronously_ on the core, but without blocking the client API caller (if the API user consistently uses only async functions).
Unified · Split
| @@ -826,6 +826,12 @@ prefixes can be specified. They are separated by whitespace. · 825 unmodified lines | |||
| 826 | ``repeatable`` | 826 | ``repeatable`` |
| 827 | For some commands, keeping a key pressed doesn't run the command repeatedly. | 827 | For some commands, keeping a key pressed doesn't run the command repeatedly. |
| 828 | This prefix forces enabling key repeat in any case. | 828 | This prefix forces enabling key repeat in any case. |
| 829 | ``async`` | ||
| 830 | Allow asynchronous execution (if possible). Note that only a few commands | ||
| 831 | will support this (usually this is explicitly documented). Some commands | ||
| 832 | are asynchronous by default (or rather, their effects might manifest | ||
| 833 | after completion of the command). The semantics of this flag might change | ||
| 834 | in the future. Set it only | ||
| 829 | 835 | ||
| 830 | All of the osd prefixes are still overridden by the global ``--osd-level`` | 836 | All of the osd prefixes are still overridden by the global ``--osd-level`` |
| 831 | settings. | 837 | settings. |
| @@ -49,6 +49,7 @@ static const struct flag cmd_flags[] = { · 48 unmodified lines | |||
| 49 | {"expand-properties", 0, MP_EXPAND_PROPERTIES}, | 49 | {"expand-properties", 0, MP_EXPAND_PROPERTIES}, |
| 50 | {"raw", MP_EXPAND_PROPERTIES, 0}, | 50 | {"raw", MP_EXPAND_PROPERTIES, 0}, |
| 51 | {"repeatable", 0, MP_ALLOW_REPEAT}, | 51 | {"repeatable", 0, MP_ALLOW_REPEAT}, |
| 52 | {"async", 0, MP_ASYNC_CMD}, | ||
| 52 | {0} | 53 | {0} |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| @@ -34,6 +34,7 @@ enum mp_cmd_flags { · 33 unmodified lines | |||
| 34 | MP_ON_OSD_MSG = 4, // force a message, if applicable | 34 | MP_ON_OSD_MSG = 4, // force a message, if applicable |
| 35 | MP_EXPAND_PROPERTIES = 8, // expand strings as properties | 35 | MP_EXPAND_PROPERTIES = 8, // expand strings as properties |
| 36 | MP_ALLOW_REPEAT = 16, // if used as keybinding, allow key repeat | 36 | MP_ALLOW_REPEAT = 16, // if used as keybinding, allow key repeat |
| 37 | MP_ASYNC_CMD = 32, | ||
| 37 | 38 | ||
| 38 | MP_ON_OSD_FLAGS = MP_ON_OSD_NO | MP_ON_OSD_AUTO | | 39 | MP_ON_OSD_FLAGS = MP_ON_OSD_NO | MP_ON_OSD_AUTO | |
| 39 | MP_ON_OSD_BAR | MP_ON_OSD_MSG, | 40 | MP_ON_OSD_BAR | MP_ON_OSD_MSG, |
| @@ -879,6 +879,10 @@ int mpv_command_string(mpv_handle *ctx, const char *args); · 878 unmodified lines | |||
| 879 | * MPV_EVENT_COMMAND_REPLY event. (This event will also have an | 879 | * MPV_EVENT_COMMAND_REPLY event. (This event will also have an |
| 880 | * error code set if running the command failed.) | 880 | * error code set if running the command failed.) |
| 881 | * | 881 | * |
| 882 | * This has nothing to do with the "async" command prefix, although they might | ||
| 883 | * be unified in the future. For now, calling this API means that the command | ||
| 884 | * will be synchronously executed on the core, without blocking the API user. | ||
| 885 | * | ||
| 882 | * @param reply_userdata the value mpv_event.reply_userdata of the reply will | 886 | * @param reply_userdata the value mpv_event.reply_userdata of the reply will |
| 883 | * be set to (see section about asynchronous calls) | 887 | * be set to (see section about asynchronous calls) |
| 884 | * @param args NULL-terminated list of strings (see mpv_command()) | 888 | * @param args NULL-terminated list of strings (see mpv_command()) |