osc.lua: observe playlist-count instead of playlist property

Observing playlist property with "native" type is too expensive for
larger playlists, and we only observe this property to
activate/deactivate next/prev buttons on the osc. We actually only need
to know if the playlist-count has changed, nothing else.

Fixes: https://github.com/mpv-player/mpv/issues/15264
This commit is contained in:
llyyr 2024-11-05 18:26:30 +05:30 committed by sfan5
parent 91d4e6f937
commit 168fb56fe8
1 changed files with 1 additions and 1 deletions

View File

@ -2562,7 +2562,7 @@ end
mp.register_event("shutdown", shutdown) mp.register_event("shutdown", shutdown)
mp.register_event("start-file", request_init) mp.register_event("start-file", request_init)
mp.observe_property("track-list", "native", request_init) mp.observe_property("track-list", "native", request_init)
mp.observe_property("playlist", "native", request_init) mp.observe_property("playlist-count", "native", request_init)
mp.observe_property("chapter-list", "native", function(_, list) mp.observe_property("chapter-list", "native", function(_, list)
list = list or {} -- safety, shouldn't return nil list = list or {} -- safety, shouldn't return nil
table.sort(list, function(a, b) return a.time < b.time end) table.sort(list, function(a, b) return a.time < b.time end)