mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
demux_playlist: add --autocreate-playlist-{video,audio,image}-exts
This commit is contained in:
@@ -881,6 +881,7 @@ int mp_add_external_file(struct MPContext *mpctx, char *filename,
|
||||
struct demuxer_params params = {
|
||||
.is_top_level = true,
|
||||
.stream_flags = STREAM_ORIGIN_DIRECT,
|
||||
.allow_playlist_create = false,
|
||||
};
|
||||
|
||||
switch (filter) {
|
||||
@@ -1041,11 +1042,9 @@ void prepare_playlist(struct MPContext *mpctx, struct playlist *pl)
|
||||
if (opts->playlist_pos >= 0)
|
||||
pl->current = playlist_entry_from_index(pl, opts->playlist_pos);
|
||||
|
||||
for (int i = 0; i < pl->num_entries; ++i) {
|
||||
for (int i = 0; i < pl->num_entries && pl->autocreated; ++i) {
|
||||
if (!pl->entries[i]->playlist_path)
|
||||
continue;
|
||||
// If playlist_path exists as an element in the playlist itself, it means
|
||||
// playlist was autogenerated.
|
||||
if (!strcmp(pl->entries[i]->filename, pl->entries[i]->playlist_path)) {
|
||||
pl->current = pl->entries[i];
|
||||
break;
|
||||
@@ -1080,6 +1079,7 @@ static void transfer_playlist(struct MPContext *mpctx, struct playlist *pl,
|
||||
playlist_remove(mpctx->playlist, mpctx->playlist->current);
|
||||
if (new)
|
||||
mpctx->playlist->current = new;
|
||||
mpctx->playlist->autocreated = pl->autocreated;
|
||||
} else {
|
||||
MP_WARN(mpctx, "Empty playlist!\n");
|
||||
}
|
||||
@@ -1155,7 +1155,8 @@ static MP_THREAD_VOID open_demux_thread(void *ctx)
|
||||
.stream_flags = mpctx->open_url_flags,
|
||||
.stream_record = true,
|
||||
.is_top_level = true,
|
||||
.has_playlist = mpctx->playlist->num_entries > 1,
|
||||
.allow_playlist_create = mpctx->playlist->num_entries <= 1 &&
|
||||
!mpctx->playlist->autocreated,
|
||||
};
|
||||
struct demuxer *demux =
|
||||
demux_open_url(mpctx->open_url, &p, mpctx->open_cancel, mpctx->global);
|
||||
|
||||
Reference in New Issue
Block a user