summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorDavid Vaughan <david@davidv.xyz>2024-02-04 10:58:09 -0800
committerDudemanguy <random342@airmail.cc>2024-02-26 02:03:21 +0000
commitda753196af6593b2d6e94f691c9d1287b3ea093b (patch)
tree9960a897291bd8cf3f812031db9e45295fe14c72 /player/command.c
parenta8a314b829498c55aed393d4bc7f4f7bf9e92362 (diff)
downloadmpv-da753196af6593b2d6e94f691c9d1287b3ea093b.tar.bz2
mpv-da753196af6593b2d6e94f691c9d1287b3ea093b.tar.xz
player: change insert_next to insert_at
Change the `playlist_insert_next` function to `playlist_insert_at` (ie, insert at the location of an entry, rather than after it, and rename to be clearer that it doesn't have anything to do with the currently-playing entry). Also, replace calls to `playlist_add` with calls to `playlist_insert_at`, since the former has become redundant.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/player/command.c b/player/command.c
index cbb5d787fe..2c5c67e78a 100644
--- a/player/command.c
+++ b/player/command.c
@@ -5543,11 +5543,10 @@ static void cmd_loadfile(void *p)
playlist_entry_add_param(entry, bstr0(pairs[i]), bstr0(pairs[i + 1]));
}
- if (insert_next) {
- playlist_insert_next(mpctx->playlist, entry, mpctx->playlist->current);
- } else {
- playlist_add(mpctx->playlist, entry);
- }
+ struct playlist_entry *at = insert_next ?
+ playlist_get_next(mpctx->playlist, +1) : NULL;
+
+ playlist_insert_at(mpctx->playlist, entry, at);
struct mpv_node *res = &cmd->result;
node_init(res, MPV_FORMAT_NODE_MAP, NULL);