ws-cleanup: merge ws/cleanup-types (type annotations)

This commit is contained in:
4DBug committed 2026-10-31 11:27:42 -05:00
commit 5d7c223ab8
115 files changed
+583 -515

No files matched your search

+6 -6
View File
@@ -324,13 +324,13 @@ local function track(b: buffer, trak: Box.Box, movieTimescale: number, trex: { [
r:skip(3)
local n = r:u32be()
if n <= (elst.stop - elst.data) // 12 then
local edits = {}
local edits: { Edit } = {}
for _ = 1, n do
local dur, mt
local dur: number, mt: number
if v == 1 then
dur, mt = r:u64be(), r:i64be()
dur, mt = r:u64be(), r:i64be() :: number
else
dur, mt = r:u32be(), r:i32be()
dur, mt = r:u32be(), r:i32be() :: number
end
local rate = r:i32be() / 65536
if r.err then
@@ -522,7 +522,7 @@ local function track(b: buffer, trak: Box.Box, movieTimescale: number, trex: { [
if n * 12 > r:remaining() then
return nil, Err.new(Err.TRUNCATED, "stsc table runs past its box", stsc.start)
end
local first, per, desc = {}, {}, {}
local first: { number }, per: { number }, desc: { number } = {}, {}, {}
for k = 1, n do
first[k], per[k], desc[k] = r:u32be(), r:u32be(), r:u32be()
end
@@ -739,7 +739,7 @@ export type Movie = {
-- parse(r, opts) -> Movie | nil, Err: the box tree, ftyp, mvhd and every track (fragments included)
function Demux.parse(r: Bytes.Reader, opts: Options?): (Movie?, Err.Err?)
local o = opts or {}
local o: Options = opts or {}
local b = r.buf
local top, terr = Box.list(b, r.base, r.limit)
if #top == 0 then
+2 -2
View File
@@ -187,7 +187,7 @@ function Meta.items(b: buffer, meta: Box.Box): (Items?, Err.Err?)
it = {
id = id, type = "", name = "", hidden = false, construction = 0, baseOffset = 0, extents = {},
properties = {}, essential = {}, refs = {},
}
} :: Item
out.items[id] = it
table.insert(out.order, id)
end
@@ -498,7 +498,7 @@ function Meta.writeIlst(w: Bytes.Writer, tags: { [string]: string }, pictures: {
end
if pictures and #pictures > 0 then
box(w, "covr", function()
for _, p in pictures do
for _, p in pictures :: { Picture } do
dataBox(w, if p.mime == "image/png" then 14 elseif p.mime == "image/bmp" then 27 else 13, p.data)
end
end)