ws-cleanup-types: archive, audio, data, font, image, layered, music, playlist, subtitle, vector, video: annotations, casts, one value per re-assignment where the solver loses the type
This commit is contained in:
1 parent
dc98aec2ec
commit
f459b2dcdf
44 files changed
+172
-119
No files matched your search
@@ -279,7 +279,7 @@ function AviFormat.encode(value: any, opts: EncodeOptions?): (buffer?, Err.Err?)
|
||||
for _, item in Source.interleave(streams) do
|
||||
table.insert(chunks, { item[1], item[2].data, true })
|
||||
end
|
||||
local ok, buf = pcall(Avi.write, { streams = wstreams, microSecPerFrame = usPerFrame, width = width, height = height }, chunks)
|
||||
local ok, buf = pcall(Avi.write, { streams = wstreams, microSecPerFrame = usPerFrame, width = width, height = height } :: Avi.WOptions, chunks)
|
||||
if not ok then
|
||||
return nil, Err.new(Err.ARG, "internal error: " .. tostring(buf))
|
||||
end
|
||||
@@ -293,7 +293,7 @@ function AviFormat.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecode
|
||||
if not dmx then
|
||||
return nil, err
|
||||
end
|
||||
return Video.open(dmx, opts)
|
||||
return Video.open(dmx, opts :: Video.OpenOptions?)
|
||||
end
|
||||
|
||||
return AviFormat
|
||||
@@ -127,7 +127,7 @@ function Mkv.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecoder?, Er
|
||||
if not dmx then
|
||||
return nil, err
|
||||
end
|
||||
return Video.open(dmx, opts)
|
||||
return Video.open(dmx, opts :: Video.OpenOptions?)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ extras
|
||||
@@ -151,7 +151,7 @@ function Mkv.subtitles(dmx: any, trackId: number?): Types.Subtitles?
|
||||
if p then
|
||||
local start = p.pts / track.timescale
|
||||
local stop = start + (p.duration or 0) / track.timescale
|
||||
table.insert(subs.cues, { start = start, stop = stop, text = buffer.tostring(p.data) })
|
||||
table.insert(subs.cues, { start = start, stop = stop, text = buffer.tostring(p.data) } :: Types.Cue)
|
||||
end
|
||||
end
|
||||
return subs
|
||||
|
||||
@@ -318,7 +318,7 @@ function Mp4.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecoder?, Er
|
||||
if not dmx then
|
||||
return nil, err
|
||||
end
|
||||
return Video.open(dmx, opts)
|
||||
return Video.open(dmx, opts :: Video.OpenOptions?)
|
||||
end
|
||||
|
||||
return Mp4
|
||||
@@ -145,7 +145,7 @@ function Ps.demux(r: Bytes.Reader, _opts: OpenOptions?): (any, Err.Err?)
|
||||
codecTag = string.format("0x%02x", id % 256),
|
||||
timescale = 90000,
|
||||
streamId = id,
|
||||
})
|
||||
} :: Types.Track)
|
||||
end
|
||||
local dmx = Demux.new("mpegps", tracks, r.buf, { mpeg2 = file.mpeg2, errors = file.errors })
|
||||
for i, id in file.order do
|
||||
@@ -186,7 +186,7 @@ function Ps.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecoder?, Err
|
||||
if not dmx then
|
||||
return nil, err
|
||||
end
|
||||
return Video.open(dmx, opts)
|
||||
return Video.open(dmx, opts :: Video.OpenOptions?)
|
||||
end
|
||||
|
||||
return Ps
|
||||
@@ -154,7 +154,7 @@ function Ts.demux(r: Bytes.Reader, _opts: OpenOptions?): (any, Err.Err?)
|
||||
streamType = st,
|
||||
}
|
||||
byPid[pid] = t
|
||||
table.insert(tracks, t)
|
||||
table.insert(tracks, t :: Types.Track)
|
||||
return t
|
||||
end
|
||||
for _, s in d.streams do
|
||||
@@ -239,7 +239,7 @@ function Ts.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecoder?, Err
|
||||
if not dmx then
|
||||
return nil, err
|
||||
end
|
||||
return Video.open(dmx, opts)
|
||||
return Video.open(dmx, opts :: Video.OpenOptions?)
|
||||
end
|
||||
|
||||
return Ts
|
||||
@@ -105,7 +105,7 @@ function Y4m.demux(r: Bytes.Reader, opts: OpenOptions?): (any, Err.Err?)
|
||||
h = tonumber(v) or 0
|
||||
elseif k == "F" then
|
||||
local a, b = string.match(v, "^(%d+):(%d+)$")
|
||||
if a and b and tonumber(a) > 0 and tonumber(b) > 0 then
|
||||
if a and b and (tonumber(a) :: number) > 0 and (tonumber(b) :: number) > 0 then
|
||||
fn, fd = tonumber(a) :: number, tonumber(b) :: number
|
||||
end
|
||||
elseif k == "C" then
|
||||
@@ -203,7 +203,7 @@ function Y4m.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecoder?, Er
|
||||
if not dmx then
|
||||
return nil, err
|
||||
end
|
||||
return Video.open(dmx, opts)
|
||||
return Video.open(dmx, opts :: Video.OpenOptions?)
|
||||
end
|
||||
|
||||
return Y4m
|
||||
Reference in new issue
Block a user