Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
mpv (0.40.0-3+deb13u1deepin3) unstable; urgency=medium

* Link against libdisplay-info3 (libdisplay-info 0.3.0) instead of the
old libdisplay-info1 soname.
* Switch Lua scripting engine from lua5.2 to lua5.4.

-- zhanghongyuan <zhanghongyuan@uniontech.com> Thu, 05 Nov 2026 14:23:53 +0800

mpv (0.40.0-3+deb13u1deepin2) unstable; urgency=medium

* Rebuild with LTO enabled (dpkg vendor feature optimize/lto).
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Build-Depends:
libjack-dev,
libjpeg-dev,
liblcms2-dev (>= 2.6~),
liblua5.2-dev,
liblua5.4-dev,
libmujs-dev,
libpipewire-0.3-dev [linux-any],
libplacebo-dev (>= 6.338),
Expand Down Expand Up @@ -127,7 +127,7 @@ Depends:
libjack-dev,
libjpeg-dev,
liblcms2-dev (>= 2.6~),
liblua5.2-dev,
liblua5.4-dev,
libmujs-dev,
libpipewire-0.3-dev [linux-any],
libplacebo-dev (>= 6.338),
Expand Down
87 changes: 87 additions & 0 deletions debian/patches/0006-add-lua5.4-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
From: zhanghongyuan <zhanghongyuan@uniontech.com>
Date: Thu, 5 Nov 2026 14:23:53 +0800
Subject: add Lua 5.4 support

Probe lua54/lua5.4/lua-5.4 in meson.build/meson.options, relax the
runtime version check in player/lua.c to accept 5.3 and 5.4, and keep
Lua 5.1/5.2's permissive luaL_checkinteger behavior (truncate
non-integral floats instead of raising "number has no integer
representation") so scripts like osc.lua keep working on 5.4.
---
meson.build | 5 ++++-
meson.options | 5 +++--
player/lua.c | 22 ++++++++++++++++++++--
3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 7572769..d01bf47 100644
--- a/meson.build
+++ b/meson.build
@@ -700,7 +700,10 @@ if lua_opt != 'disabled'
['luajit', '>= 2.0.0'],
['lua51', '>= 5.1.0'],
['lua5.1', '>= 5.1.0'],
- ['lua-5.1', '>= 5.1.0']]
+ ['lua-5.1', '>= 5.1.0'],
+ ['lua54', '>= 5.4.0'],
+ ['lua5.4', '>= 5.4.0'],
+ ['lua-5.4', '>= 5.4.0']]
foreach version : lua_version
if lua_opt == 'auto' or lua_opt == 'enabled'
lua = dependency(version[0], version: version[1], required: false)
diff --git a/meson.options b/meson.options
index dae0a33..55c3c19 100644
--- a/meson.options
+++ b/meson.options
@@ -21,8 +21,9 @@ option('libavdevice', type: 'feature', value: 'auto', description: 'libavdevice'
option('libbluray', type: 'feature', value: 'auto', description: 'Bluray support')
option('lua',
type: 'combo',
- choices: ['lua', 'lua52', 'lua5.2', 'lua-5.2', 'luajit', 'lua51',
- 'lua5.1', 'lua-5.1', 'auto', 'enabled', 'disabled'],
+ choices: ['lua', 'lua54', 'lua5.4', 'lua-5.4', 'lua52', 'lua5.2',
+ 'lua-5.2', 'luajit', 'lua51', 'lua5.1', 'lua-5.1',
+ 'auto', 'enabled', 'disabled'],
value: 'auto',
description: 'Lua'
)
diff --git a/player/lua.c b/player/lua.c
index 4786419..9335309 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -122,6 +122,24 @@ static int mp_cpcall (lua_State *L, lua_CFunction func, void *ud)
}
#endif

+#if LUA_VERSION_NUM >= 503
+// Lua 5.3+ luaL_checkinteger() raises "number has no integer representation"
+// for non-integral floats, while Lua 5.1/5.2 silently truncated them. Keep
+// the old permissive behavior so scripts behave the same on newer Lua.
+static lua_Integer mp_lua_checkinteger(lua_State *L, int arg)
+{
+ if (lua_type(L, arg) == LUA_TNUMBER) {
+ double d = lua_tonumber(L, arg);
+ if (d >= (double)LUA_MININTEGER && d < -(double)LUA_MININTEGER)
+ return (lua_Integer)d;
+ // +-inf, NaN or out of range: Lua 5.1/5.2 never errored on numbers
+ return 0;
+ }
+ return luaL_checkinteger(L, arg);
+}
+#define luaL_checkinteger mp_lua_checkinteger
+#endif
+
// Ensure that the given argument exists, even if it's nil. Can be used to
// avoid confusing the last missing optional arg with the first temporary value
// pushed to the stack.
@@ -462,8 +480,8 @@ static int load_lua(struct mp_script_args *args)

stats_register_thread_cputime(ctx->stats, "cpu");

- if (LUA_VERSION_NUM != 501 && LUA_VERSION_NUM != 502) {
- MP_FATAL(ctx, "Only Lua 5.1 and 5.2 are supported.\n");
+ if (LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 504) {
+ MP_FATAL(ctx, "Only Lua 5.1, 5.2, 5.3 and 5.4 are supported.\n");
goto error_out;
}

1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
0003-vdpau-add-VDPAU-rendering-support-with-field-deinter.patch
0004-vo_vaapi-rewrite-OSD-rendering-to-support-multiple-s.patch
0005-video-out-clear-depth-buffer-along-with-color-buffer.patch
0006-add-lua5.4-support.patch
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ override_dh_auto_configure:
-Dcdda=enabled \
-Ddvdnav=enabled \
-Dsdl2=enabled \
-Dlua=lua5.4 \
$(ARCH_CONFIGURE)

execute_after_dh_auto_install:
Expand Down
Loading