summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-08 00:16:58 +0100
committerwm4 <wm4@nowhere>2020-01-08 00:16:58 +0100
commit11b9315b3fce4de1fae799d4609c66029d8cc914 (patch)
treedd91767bdabd7498ecc1a5665fa9c8b9f68942dd
parentdb9048f21aa955dbd7176d4e8d7245297e97177b (diff)
downloadmpv-11b9315b3fce4de1fae799d4609c66029d8cc914.tar.bz2
mpv-11b9315b3fce4de1fae799d4609c66029d8cc914.tar.xz
lua: use new OSD property
See previous commit. A nice side-effect is that mp.get_osd_margins() is not a special Lua-only thing anymore. I didn't test whether this function still works as expected, though.
-rw-r--r--player/lua.c12
-rw-r--r--player/lua/defaults.lua15
2 files changed, 6 insertions, 21 deletions
diff --git a/player/lua.c b/player/lua.c
index cee4c118ad..2e5b0dec5a 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -998,17 +998,6 @@ static int script_raw_abort_async_command(lua_State *L)
return 0;
}
-static int script_get_osd_margins(lua_State *L)
-{
- struct MPContext *mpctx = get_mpctx(L);
- struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd);
- lua_pushnumber(L, vo_res.ml);
- lua_pushnumber(L, vo_res.mt);
- lua_pushnumber(L, vo_res.mr);
- lua_pushnumber(L, vo_res.mb);
- return 4;
-}
-
static int script_get_mouse_pos(lua_State *L)
{
struct MPContext *mpctx = get_mpctx(L);
@@ -1250,7 +1239,6 @@ static const struct fn_entry main_fns[] = {
FN_ENTRY(set_property_native),
FN_ENTRY(raw_observe_property),
FN_ENTRY(raw_unobserve_property),
- FN_ENTRY(get_osd_margins),
FN_ENTRY(get_mouse_pos),
FN_ENTRY(get_time),
FN_ENTRY(input_set_section_mouse_area),
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index f44d004a99..7681ca173e 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -638,17 +638,14 @@ function mp.set_osd_ass(res_x, res_y, data)
end
function mp.get_osd_size()
- local w = mp.get_property_number("osd-width", 0)
- local h = mp.get_property_number("osd-height", 0)
- local par = mp.get_property_number("osd-par", 0)
- if par == 0 then
- par = 1
- end
-
- local aspect = 1.0 * w / math.max(h, 1.0) / par
- return w, h, aspect
+ local prop = mp.get_property_native("osd-dimensions")
+ return prop.w, prop.h, prop.aspect
end
+function mp.get_osd_margins()
+ local prop = mp.get_property_native("osd-dimensions")
+ return prop.ml, prop.mt, prop.mr, prop.mb
+end
local mp_utils = package.loaded["mp.utils"]