summaryrefslogtreecommitdiffstats
path: root/common/playlist.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-21 17:45:30 +0100
committerwm4 <wm4@nowhere>2020-03-21 19:33:03 +0100
commit7e885a3bc3af4df93681b6e760a34e59e2f47ef7 (patch)
treec2687c6b364a2e5aeef0c466fb04988bafc35ab3 /common/playlist.c
parent956a5d9ac61ffe4034abcc81405e8ecdacac8b36 (diff)
downloadmpv-7e885a3bc3af4df93681b6e760a34e59e2f47ef7.tar.bz2
mpv-7e885a3bc3af4df93681b6e760a34e59e2f47ef7.tar.xz
client API: add a playlist entry unique ID
This should make dealing with some async. things easier. It's intentionally not a globally unique ID.
Diffstat (limited to 'common/playlist.c')
-rw-r--r--common/playlist.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/playlist.c b/common/playlist.c
index 89c644dc33..d7c752ad8d 100644
--- a/common/playlist.c
+++ b/common/playlist.c
@@ -66,6 +66,7 @@ void playlist_add(struct playlist *pl, struct playlist_entry *add)
MP_TARRAY_APPEND(pl, pl->entries, pl->num_entries, add);
add->pl = pl;
add->pl_index = pl->num_entries - 1;
+ add->id = ++pl->id_alloc;
talloc_steal(pl, add);
}
@@ -250,6 +251,7 @@ static void playlist_transfer_entries_to(struct playlist *pl, int dst_index,
struct playlist_entry *e = source_pl->entries[n];
e->pl = pl;
e->pl_index = dst_index + n;
+ e->id = ++pl->id_alloc;
pl->entries[e->pl_index] = e;
talloc_steal(pl, e);
}