History

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.

wm4 committed 6 years ago

Commit d951a7f1 parent 86d24b01 file · +2 −0Browse files

Showing the changes to player/lua/defaults.lua (1 of 1 file). Show all

Unified · Split

player/lua/defaults.lua+2−0
@@ -612,6 +612,8 @@ function overlay_mt.update(ov) · 611 unmodified lines
612612 cmd[k] = v
613613 end
614614 cmd.name = "osd-overlay"
615+ cmd.res_x = math.floor(cmd.res_x)
616+ cmd.res_y = math.floor(cmd.res_y)
615617 mp.command_native(cmd)
616618 end
617619

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t