mirror of https://github.com/mpv-player/mpv
playlist: remove unused code to track redirects
It turns out that the code to track redirects (playlists and directories) never worked correctly, only the last redirect is remembered and num_redirects is never greater than 1. You can see this by doing quit-watch-later with the old watch later system, beforedbf244fd2f
, on a m3u playlist of files and a m3u playlist of directories. Only in the first case a redirect entry for the m3u file is created, because in the second case the m3u redirect is replaced by the directory one. If you did mpv --directory-mode=lazy /foo it did create redirect entries for all subdirectories e.g. /foo/bar, /foo/bar/baz, /foo/bar/baz/qux, this made it seem like it worked correctly, but actually /foo/bar/bar/qux was the only redirect entry and thus it was considered as the first redirect, and mpv created redirect entries for each segment of the first redirect only. In the previous commitdbf244fd2f
, rather than figuring out how to fix the code to track redirects, and since creating redirect entries for multiple redirects is overkill, I just used the new playlist-path property which does the same thing but only for the last redirect. By replacing the only other use of the old redirect code with playlist-path, we can remove it.
This commit is contained in:
parent
64959c450d
commit
e1f9444d4d
|
@ -228,19 +228,6 @@ void playlist_add_base_path(struct playlist *pl, bstr base_path)
|
|||
}
|
||||
}
|
||||
|
||||
// Add redirected_from as new redirect entry to each item in pl.
|
||||
void playlist_add_redirect(struct playlist *pl, const char *redirected_from)
|
||||
{
|
||||
for (int n = 0; n < pl->num_entries; n++) {
|
||||
struct playlist_entry *e = pl->entries[n];
|
||||
if (e->num_redirects >= 10) // arbitrary limit for sanity
|
||||
continue;
|
||||
char *s = talloc_strdup(e, redirected_from);
|
||||
if (s)
|
||||
MP_TARRAY_APPEND(e, e->redirects, e->num_redirects, s);
|
||||
}
|
||||
}
|
||||
|
||||
void playlist_set_stream_flags(struct playlist *pl, int flags)
|
||||
{
|
||||
for (int n = 0; n < pl->num_entries; n++)
|
||||
|
|
|
@ -40,11 +40,6 @@ struct playlist_entry {
|
|||
|
||||
char *title;
|
||||
|
||||
// If the user plays a playlist, then the playlist's URL will be appended
|
||||
// as redirect to each entry. (Same for directories etc.)
|
||||
char **redirects;
|
||||
int num_redirects;
|
||||
|
||||
// Used for unshuffling: the pl_index before it was shuffled. -1 => unknown.
|
||||
int original_index;
|
||||
|
||||
|
@ -103,7 +98,6 @@ struct playlist_entry *playlist_get_next(struct playlist *pl, int direction);
|
|||
struct playlist_entry *playlist_entry_get_rel(struct playlist_entry *e,
|
||||
int direction);
|
||||
void playlist_add_base_path(struct playlist *pl, bstr base_path);
|
||||
void playlist_add_redirect(struct playlist *pl, const char *redirected_from);
|
||||
void playlist_set_stream_flags(struct playlist *pl, int flags);
|
||||
int64_t playlist_transfer_entries(struct playlist *pl, struct playlist *source_pl);
|
||||
int64_t playlist_append_entries(struct playlist *pl, struct playlist *source_pl);
|
||||
|
|
|
@ -1086,8 +1086,6 @@ static void transfer_playlist(struct MPContext *mpctx, struct playlist *pl,
|
|||
if (pl->num_entries) {
|
||||
prepare_playlist(mpctx, pl);
|
||||
struct playlist_entry *new = pl->current;
|
||||
if (mpctx->playlist->current)
|
||||
playlist_add_redirect(pl, mpctx->playlist->current->filename);
|
||||
*num_new_entries = pl->num_entries;
|
||||
*start_id = playlist_transfer_entries(mpctx->playlist, pl);
|
||||
// current entry is replaced
|
||||
|
@ -1649,7 +1647,7 @@ static void play_current_file(struct MPContext *mpctx)
|
|||
handle_force_window(mpctx, false);
|
||||
|
||||
if (mpctx->playlist->num_entries > 1 ||
|
||||
mpctx->playing->num_redirects)
|
||||
mpctx->playing->playlist_path)
|
||||
MP_INFO(mpctx, "Playing: %s\n", mpctx->filename);
|
||||
|
||||
assert(mpctx->demuxer == NULL);
|
||||
|
|
Loading…
Reference in New Issue