diff options
-rw-r--r-- | common/playlist.c | 5 | ||||
-rw-r--r-- | common/playlist.h | 4 | ||||
-rw-r--r-- | demux/demux_mkv_timeline.c | 3 | ||||
-rw-r--r-- | options/parse_commandline.c | 2 | ||||
-rw-r--r-- | player/command.c | 8 |
5 files changed, 15 insertions, 7 deletions
diff --git a/common/playlist.c b/common/playlist.c index b2b297d671..5504b185bc 100644 --- a/common/playlist.c +++ b/common/playlist.c @@ -275,13 +275,14 @@ struct playlist_entry *playlist_entry_from_index(struct playlist *pl, int index) } } -struct playlist *playlist_parse_file(const char *file, struct mpv_global *global) +struct playlist *playlist_parse_file(const char *file, struct mp_cancel *cancel, + struct mpv_global *global) { struct mp_log *log = mp_log_new(NULL, global->log, "!playlist_parser"); mp_verbose(log, "Parsing playlist file %s...\n", file); struct demuxer_params p = {.force_format = "playlist"}; - struct demuxer *d = demux_open_url(file, &p, NULL, global); + struct demuxer *d = demux_open_url(file, &p, cancel, global); if (!d) { talloc_free(log); return NULL; diff --git a/common/playlist.h b/common/playlist.h index d35fff6df3..a37c516519 100644 --- a/common/playlist.h +++ b/common/playlist.h @@ -101,8 +101,10 @@ int playlist_entry_to_index(struct playlist *pl, struct playlist_entry *e); int playlist_entry_count(struct playlist *pl); struct playlist_entry *playlist_entry_from_index(struct playlist *pl, int index); +struct mp_cancel; struct mpv_global; -struct playlist *playlist_parse_file(const char *file, struct mpv_global *global); +struct playlist *playlist_parse_file(const char *file, struct mp_cancel *cancel, + struct mpv_global *global); void playlist_entry_unref(struct playlist_entry *e); diff --git a/demux/demux_mkv_timeline.c b/demux/demux_mkv_timeline.c index 277ff9c1ee..48d8c444b3 100644 --- a/demux/demux_mkv_timeline.c +++ b/demux/demux_mkv_timeline.c @@ -264,7 +264,8 @@ static void find_ordered_chapter_sources(struct tl_ctx *ctx) MP_INFO(ctx, "Loading references from '%s'.\n", opts->ordered_chapters_files); struct playlist *pl = - playlist_parse_file(opts->ordered_chapters_files, ctx->global); + playlist_parse_file(opts->ordered_chapters_files, + ctx->tl->cancel, ctx->global); talloc_steal(tmp, pl); for (struct playlist_entry *e = pl ? pl->first : NULL; e; e = e->next) MP_TARRAY_APPEND(tmp, filenames, num_filenames, e->filename); diff --git a/options/parse_commandline.c b/options/parse_commandline.c index b1392ba4e1..68d36c6500 100644 --- a/options/parse_commandline.c +++ b/options/parse_commandline.c @@ -199,7 +199,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, if (bstrcmp0(p.arg, "playlist") == 0) { // append the playlist to the local args char *param0 = bstrdup0(NULL, p.param); - struct playlist *pl = playlist_parse_file(param0, global); + struct playlist *pl = playlist_parse_file(param0, NULL, global); talloc_free(param0); if (!pl) { MP_FATAL(config, "Error reading playlist '%.*s'\n", 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, |