History

input: add "async" flag

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).

wm4 committed 9 years ago

Commit a071d5f1 parent ec3dd714 files · +12 −0Browse files

Unified · Split

4 files
  1. DOCS/man/input.rst +6 −0
  2. input/cmd_parse.c +1 −0
  3. input/input.h +1 −0
  4. libmpv/client.h +4 −0
DOCS/man/input.rst+6−0
@@ -826,6 +826,12 @@ prefixes can be specified. They are separated by whitespace. · 825 unmodified lines
826826 ``repeatable``
827827 For some commands, keeping a key pressed doesn't run the command repeatedly.
828828 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
829835
830836 All of the osd prefixes are still overridden by the global ``--osd-level``
831837 settings.
input/cmd_parse.c+1−0
@@ -49,6 +49,7 @@ static const struct flag cmd_flags[] = { · 48 unmodified lines
4949 {"expand-properties", 0, MP_EXPAND_PROPERTIES},
5050 {"raw", MP_EXPAND_PROPERTIES, 0},
5151 {"repeatable", 0, MP_ALLOW_REPEAT},
52+ {"async", 0, MP_ASYNC_CMD},
5253 {0}
5354 };
5455
input/input.h+1−0
@@ -34,6 +34,7 @@ enum mp_cmd_flags { · 33 unmodified lines
3434 MP_ON_OSD_MSG = 4, // force a message, if applicable
3535 MP_EXPAND_PROPERTIES = 8, // expand strings as properties
3636 MP_ALLOW_REPEAT = 16, // if used as keybinding, allow key repeat
37+ MP_ASYNC_CMD = 32,
3738
3839 MP_ON_OSD_FLAGS = MP_ON_OSD_NO | MP_ON_OSD_AUTO |
3940 MP_ON_OSD_BAR | MP_ON_OSD_MSG,
libmpv/client.h+4−0
@@ -879,6 +879,10 @@ int mpv_command_string(mpv_handle *ctx, const char *args); · 878 unmodified lines
879879 * MPV_EVENT_COMMAND_REPLY event. (This event will also have an
880880 * error code set if running the command failed.)
881881 *
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+ *
882886 * @param reply_userdata the value mpv_event.reply_userdata of the reply will
883887 * be set to (see section about asynchronous calls)
884888 * @param args NULL-terminated list of strings (see mpv_command())

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t