Skip to content

Commit 462fde5

Browse files
committed
Only clear state when a new file is loaded
Previously, changing the filter chain may have pinged the video-dec-params. Fixes #11
1 parent ffca859 commit 462fde5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/thumbnailer_shared.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ function Thumbnailer:on_thumb_progress(index)
5858
self.state.thumbnails[index] = math.max(self.state.thumbnails[index], 0)
5959
end
6060

61-
function Thumbnailer:on_video_change(params)
61+
function Thumbnailer:on_start_file()
62+
-- Clear state when a new file is being loaded
6263
self:clear_state()
64+
end
65+
66+
function Thumbnailer:on_video_change(params)
67+
-- Gather a new state when we get proper video-dec-params and our state is empty
6368
if params ~= nil then
6469
if not self.state.ready then
6570
self:update_state()
@@ -391,4 +396,5 @@ function Thumbnailer:start_worker_jobs()
391396
end
392397
end
393398

399+
mp.register_event("start-file", function() Thumbnailer:on_start_file() end)
394400
mp.observe_property("video-dec-params", "native", function(name, params) Thumbnailer:on_video_change(params) end)

0 commit comments

Comments
 (0)