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.
This commit is contained in:
wm4 2019-12-23 13:23:10 +01:00
parent 86d24b069b
commit d951a7f021
1 changed files with 2 additions and 0 deletions

View File

@ -612,6 +612,8 @@ function overlay_mt.update(ov)
cmd[k] = v cmd[k] = v
end end
cmd.name = "osd-overlay" cmd.name = "osd-overlay"
cmd.res_x = math.floor(cmd.res_x)
cmd.res_y = math.floor(cmd.res_y)
mp.command_native(cmd) mp.command_native(cmd)
end end