mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
demux: add --autocreate-playlist
This commit is contained in:
@@ -1041,6 +1041,17 @@ 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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts->shuffle)
|
||||
playlist_shuffle(pl);
|
||||
|
||||
@@ -1144,6 +1155,7 @@ 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,
|
||||
};
|
||||
struct demuxer *demux =
|
||||
demux_open_url(mpctx->open_url, &p, mpctx->open_cancel, mpctx->global);
|
||||
|
||||
Reference in New Issue
Block a user