Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local _global = {
- utils = require 'mp.utils',
- msg = require 'mp.msg',
- currentFps = "",
- isFs = false
- }
- function revertFPS()
- if (_global.isFs == false) then
- return
- end
- setFPS("60")
- end
- function setFPS(value)
- if (value == _global.current_fps) then
- _global.msg.info("FPS is already " .. value)
- return
- end
- _global.current_fps = value
- _global.msg.info("Set FPS to " .. value)
- _global.utils.subprocess({
- ["cancellable"] = false,
- ["args"] = {
- [1] = "nircmdc",
- [2] = "setdisplay",
- [3] = "3840",
- [4] = "2160",
- [5] = "32",
- [6] = value
- }
- })
- end
- function start(name, value)
- _global.msg.verbose("Got fullscreen " .. tostring(value))
- _global.isFs = value
- if (value == true) then
- fps = mp.get_property_native("container-fps")
- _global.msg.verbose("Got FPS " .. tostring(fps))
- if ((24.0 - fps) < 2.0) then
- setFPS("47")
- else
- setFPS("60")
- end
- else
- setFPS("60")
- end
- end
- mp.observe_property("fullscreen", "bool", start)
- mp.register_event("shutdown", revertFPS)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement