summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2023-08-27 21:48:59 +0200
committerDudemanguy <random342@airmail.cc>2023-08-28 18:31:17 +0000
commite1f9444d4da5eacb30359ae210b1f1d3831ca05c (patch)
tree768a669947e443bd9b83720ef70919716268be2c /common
parent64959c450ddb05641e860c844e505380980104b7 (diff)
downloadmpv-e1f9444d4da5eacb30359ae210b1f1d3831ca05c.tar.bz2
mpv-e1f9444d4da5eacb30359ae210b1f1d3831ca05c.tar.xz
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, before dbf244fd2f, 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 commit dbf244fd2f, 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.
Diffstat (limited to 'common')
-rw-r--r--common/playlist.c13
-rw-r--r--common/playlist.h6
2 files changed, 0 insertions, 19 deletions
diff --git a/common/playlist.c b/common/playlist.c
index 1ba8a58f32..78a7713462 100644
--- a/common/playlist.c
+++ b/common/playlist.c
@@ -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++)
diff --git a/common/playlist.h b/common/playlist.h
index 64d1cd45f0..f6111604f3 100644
--- a/common/playlist.h
+++ b/common/playlist.h
@@ -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);