diff options
author | wm4 <wm4@nowhere> | 2018-05-12 18:46:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:34 +0200 |
commit | e4fb23ed7de874bb2d05824d7edb84cfd1b21101 (patch) | |
tree | ff56d6949cdead5795607c86882ce44aca0b7da7 /player/command.h | |
parent | ce1f5e78c2b10e24c78d7ee65d7196093709b8ce (diff) | |
download | mpv-e4fb23ed7de874bb2d05824d7edb84cfd1b21101.tar.bz2 mpv-e4fb23ed7de874bb2d05824d7edb84cfd1b21101.tar.xz |
command: add a way to abort asynchronous commands
Many asynchronous commands are potentially long running operations, such
as loading something from network or running a foreign process.
Obviously it shouldn't just be possible for them to freeze the player if
they don't terminate as expected. Also, there will be situations where
you want to explicitly stop some of those operations explicitly. So add
an infrastructure for this.
Commands have to support this explicitly. The next commit uses this to
actually add support to a command.
Diffstat (limited to 'player/command.h')
-rw-r--r-- | player/command.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/player/command.h b/player/command.h index 9e385dbc16..ae3af82886 100644 --- a/player/command.h +++ b/player/command.h @@ -45,6 +45,8 @@ struct mp_cmd_ctx { bool bar_osd; // OSD bar requested bool seek_msg_osd; // same as above, but for seek commands bool seek_bar_osd; + // If mp_cmd_def.can_abort is set, this will be set. + struct mp_abort_entry *abort; // Return values (to be set by command implementation, read by the // completion callback). bool success; // true by default @@ -64,6 +66,7 @@ struct mp_cmd_ctx { }; void run_command(struct MPContext *mpctx, struct mp_cmd *cmd, + struct mp_abort_entry *abort, void (*on_completion)(struct mp_cmd_ctx *cmd), void *on_completion_priv); void mp_cmd_ctx_complete(struct mp_cmd_ctx *cmd); |