aboutsummaryrefslogtreecommitdiffhomepage
path: root/TOOLS/lua
diff options
context:
space:
mode:
authorGravatar Rostislav Pehlivanov <atomnuker@gmail.com>2017-08-04 09:07:37 +0100
committerGravatar Rostislav Pehlivanov <atomnuker@gmail.com>2017-08-04 09:07:37 +0100
commit5ea390c07f166ad1186b409176dd4e27d93b6f92 (patch)
tree6b5838892d90382f24d8bdfe0c9bcb7b00764a4a /TOOLS/lua
parent779031ad8f3b74035b8e64a2353a52557d7b8ece (diff)
TOOLS/lua/status-line: improve and update
Updates the line once per second rather than once per frame, saving quite a bit of CPU. Also completely stops the script while paused. That aside, fixes the swapped checks for video and audio-only files and adds bitrate printing.
Diffstat (limited to 'TOOLS/lua')
-rw-r--r--TOOLS/lua/status-line.lua33
1 files changed, 27 insertions, 6 deletions
diff --git a/TOOLS/lua/status-line.lua b/TOOLS/lua/status-line.lua
index 26ae8afb22..e40dce234f 100644
--- a/TOOLS/lua/status-line.lua
+++ b/TOOLS/lua/status-line.lua
@@ -18,10 +18,10 @@ function update_status_line()
atsl("(Buffering) ")
end
- if mp.get_property("vid") ~= "no" then
+ if mp.get_property("aid") ~= "no" then
atsl("A")
end
- if mp.get_property("aid") ~= "no" then
+ if mp.get_property("vid") ~= "no" then
atsl("V")
end
@@ -43,7 +43,7 @@ function update_status_line()
r = mp.get_property_number("avsync", nil)
if r ~= nil then
- atsl(string.format(" A-V: %7.3f", r))
+ atsl(string.format(" A-V: %f", r))
end
r = mp.get_property("total-avsync-change", 0)
@@ -51,12 +51,24 @@ function update_status_line()
atsl(string.format(" ct:%7.3f", r))
end
- r = mp.get_property_number("drop-frame-count", -1)
+ r = mp.get_property_number("decoder-drop-frame-count", -1)
if r > 0 then
atsl(" Late: ")
atsl(r)
end
+ r = mp.get_property_osd("video-bitrate")
+ if r ~= nil and r ~= "" then
+ atsl(" Vb: ")
+ atsl(r)
+ end
+
+ r = mp.get_property_osd("audio-bitrate")
+ if r ~= nil and r ~= "" then
+ atsl(" Ab: ")
+ atsl(r)
+ end
+
r = mp.get_property_number("cache", 0)
if r > 0 then
atsl(string.format(" Cache: %d%% ", r))
@@ -66,6 +78,15 @@ function update_status_line()
mp.set_property("options/term-status-msg", newStatus)
end
--- Register the event
-mp.register_event("tick", update_status_line)
+timer = mp.add_periodic_timer(1, update_status_line)
+function on_pause_change(name, value)
+ if value == false then
+ timer:resume()
+ else
+ timer:stop()
+ end
+ mp.add_timeout(0.1, update_status_line)
+end
+mp.observe_property("pause", "bool", on_pause_change)
+mp.register_event("seek", update_status_line)