revert 更新 play.lua
This commit is contained in:
2026-01-26 18:33:10 +08:00
parent 011433bb5b
commit 8a6b377597

View File

@@ -133,7 +133,7 @@ local get_task = {}
local function readU32(s, pos)
if pos + 3 > #s then return nil end
local b1, b2, b3, b4 = s:byte(pos, pos + 3)
-- 使用网络字节序(大端序)
-- 使用 bit32.lshift 和 bit32.bor
return bit32.bor(
bit32.lshift(b1, 24),
bit32.lshift(b2, 16),
@@ -142,45 +142,27 @@ local function readU32(s, pos)
)
end
-- 修复后的 FramePack 解析函数
-- 解析 FramePack 二进制数据
local function unpackFramePack(data)
local frames = {}
local pos = 1
-- 读取总帧数
local frameCount = readU32(data, pos)
if not frameCount then
error("Invalid framepack header - no frame count found")
end
print("Parsing " .. frameCount .. " frames")
if not frameCount then error("Invalid framepack header") end
pos = pos + 4
for i = 1, frameCount do
-- 读取当前帧的大小
local size = readU32(data, pos)
if not size then
error("Truncated framepack at frame " .. i .. ", position " .. pos)
end
print("Frame " .. i .. " size: " .. size .. " bytes")
if not size then error("Truncated framepack at frame " .. i) end
pos = pos + 4
-- 检查是否有足够的数据来读取这个帧
if pos + size - 1 > #data then
error("Frame " .. i .. " size (" .. size .. ") extends beyond data boundary")
end
-- 提取帧数据这应该是完整的PNG图像数据
if pos + size - 1 > #data then error("Frame " .. i .. " out of bounds") end
local frameData = data:sub(pos, pos + size - 1)
frames[i] = frameData
pos = pos + size
end
return frames
end
-- 分批下载(每批 50 帧)
local BATCH_SIZE = 20
-- local totalFrames = #videoInfo.frame_urls