diff options
author | wm4 <wm4@nowhere> | 2018-05-18 22:19:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:35 +0200 |
commit | 76dc5d9aa92f5c91c728004214f7b08c3a85a5f6 (patch) | |
tree | 5e7514e6376067c98645b921eb698381aa496b0b /player | |
parent | 12d1404b04e90f5357882e5c1048d92305248cb9 (diff) | |
download | mpv-76dc5d9aa92f5c91c728004214f7b08c3a85a5f6.tar.bz2 mpv-76dc5d9aa92f5c91c728004214f7b08c3a85a5f6.tar.xz |
command: make loadlist command async and abortable
Don't allow it to freeze everything when loading a playlist from network
(although you definitely shouldn't do that, but whatever).
This also affects the really obscure --ordered-chapters-files option.
The --playlist option on the other hand has no choice but to freeze the
shit, because there's no concept of aborting the player during command
line parsing.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c index fb8f6f14c5..55ad018c8c 100644 --- a/player/command.c +++ b/player/command.c @@ -5387,7 +5387,8 @@ static void cmd_loadlist(void *p) char *filename = cmd->args[0].v.s; bool append = cmd->args[1].v.i; - struct playlist *pl = playlist_parse_file(filename, mpctx->global); + struct playlist *pl = playlist_parse_file(filename, cmd->abort->cancel, + mpctx->global); if (pl) { prepare_playlist(mpctx, pl); struct playlist_entry *new = pl->current; @@ -6196,7 +6197,10 @@ const struct mp_cmd_def mp_cmds[] = { }, { "loadlist", cmd_loadlist, { OPT_STRING("url", v.s, 0), OPT_CHOICE("flags", v.i, MP_CMD_OPT_ARG, - ({"replace", 0}, {"append", 1})), }}, + ({"replace", 0}, {"append", 1})), }, + .spawn_thread = true, + .can_abort = true, + }, { "playlist-clear", cmd_playlist_clear }, { "playlist-remove", cmd_playlist_remove, {OPT_CHOICE_OR_INT("index", v.i, MP_CMD_OPT_ARG, 0, INT_MAX, |