mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
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.
This commit is contained in:
parent
db9048f21a
commit
11b9315b3f
12
player/lua.c
12
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),
|
||||
|
@ -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"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user