summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-23 13:23:10 +0100
committerwm4 <wm4@nowhere>2019-12-23 13:23:10 +0100
commitd951a7f021cb62371988b14bee61cfa31d26ea6c (patch)
tree1bb498d8b9b35a02a9b6a5fd6f0d111cb63b739c
parent86d24b069bac540ada60a063bf62c46e045261f8 (diff)
downloadmpv-d951a7f021cb62371988b14bee61cfa31d26ea6c.tar.bz2
mpv-d951a7f021cb62371988b14bee61cfa31d26ea6c.tar.xz
lua: fix passing non-integers to mp.set_osd_ass()
libass uses integers for PlayResX/Y, so the osd-overlay command also does. Lua (pre-5.3) does not have an integer type, but the command interface makes a difference anyway. If you pass a Lua number with a fractional part to an integer parameter (using mp.command_native()), it will result in an error and complain about incompatible types. I think that's fine, but since this behavior extends to mp.set_osd_ass(), this is a compatibility problem. Fix this by explicitly coercing the resolution parameters to integer numbers.
-rw-r--r--player/lua/defaults.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 22ffa086d1..c7ff46660b 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -612,6 +612,8 @@ function overlay_mt.update(ov)
cmd[k] = v
end
cmd.name = "osd-overlay"
+ cmd.res_x = math.floor(cmd.res_x)
+ cmd.res_y = math.floor(cmd.res_y)
mp.command_native(cmd)
end