From d951a7f021cb62371988b14bee61cfa31d26ea6c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 23 Dec 2019 13:23:10 +0100 Subject: [PATCH] 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. --- player/lua/defaults.lua | 2 ++ 1 file changed, 2 insertions(+) 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