1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00

stats: update stats when file changes

Only in toggled mode and actually only when the video output is
reconfigured. This should cover the relevant cases.

Fixes #22
This commit is contained in:
Julian 2016-06-26 01:41:53 +09:00 committed by wm4
parent fcacf82865
commit 2de778f699

View File

@ -305,8 +305,14 @@ end
mp.add_key_binding(o.key_oneshot, "display_stats", print_stats, {repeatable=true})
if pcall(function() timer:is_enabled() end) then
mp.add_key_binding(o.key_toggle, "display_stats_toggle", toggle_stats, {repeatable=false})
mp.register_event("video-reconfig",
function()
if timer:is_enabled() then
print_stats(o.redraw_delay + 1)
end
end)
else
local txt = "Please upgrade mpv to toggle stats"
mp.add_key_binding(o.key_toggle, "display_stats_toggle",
function() print(txt) ; mp.osd_message(txt) end, {repeatable=false})
function() print(txt) ; mp.osd_message(txt) end, {repeatable=false})
end