tests/containers: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:49:47 -05:00
1 parent 53aa9a6ebf
commit 70f50917fa
5 files changed
+8 -46

No files matched your search

+2 -13
View File
@@ -1,8 +1,5 @@
-- containers/IsoBmff tests: ffmpeg / MP4Box files (H.264 + AAC with B-frames, fast start, QuickTime MJPEG + PCM, HEVC,
-- fragmented by ffmpeg and MP4Box, stz2 + co64, ALAC) demuxed packet for packet against ffprobe (-ignore_editlist);
-- track facts and codec configurations; iTunes tags and cover art; AVIF items (libavif, plain and with alpha); the
-- muxer round-trips through the demuxer (sizes, times, cts, sync, tags, 64-bit sizes); a sub-range reader; the fuzz
-- no-throw pass. Fixtures: tools/fixtures/isobmff.py.
-- containers/IsoBmff tests: ffmpeg / MP4Box files against ffprobe (-ignore_editlist), AVIF items, the muxer.
-- Fixtures: tools/fixtures/isobmff.py.
local T = require("@tests/T")
local IsoBmff = require("@rosetta/containers/IsoBmff")
local Bytes = require("@rosetta/core/Bytes")
@@ -22,7 +19,6 @@ local function reader(s: string, pad: number?): Bytes.Reader
return Bytes.reader(buffer.fromstring(s))
end
-- every fixture against ffprobe
for _, c in Fx.cases do
for _, pad in { 0, 5 } do
local r = reader(c.data, if pad > 0 then pad else nil)
@@ -46,7 +42,6 @@ for _, c in Fx.cases do
t:eq(if tr.config then buffer.len(tr.config) else 0, s.extradata, label .. ": codec config size")
end
end
-- packets in file order
local n, bad = 0, nil
local base = r.base
for p in dmx:packets() do
@@ -73,7 +68,6 @@ for _, c in Fx.cases do
end
end
-- per-track packets, seek
do
local c = Fx.cases[1]
local dmx = IsoBmff.demux(reader(c.data))
@@ -90,7 +84,6 @@ do
t:check(v.skip >= 0 and v.edits ~= nil, "edit list parsed")
end
-- tags and cover
do
local r = reader(Fx.tagged.data)
local movie = IsoBmff.parse(r) :: IsoBmff.Movie
@@ -104,7 +97,6 @@ do
t:eq(pics[1] and pics[1].mime, "image/png", "cover mime")
end
-- AVIF items
for _, c in Fx.avif do
local r = reader(c.data)
t:check(IsoBmff.sniff(r) == "avif", c.name .. ": brand")
@@ -139,7 +131,6 @@ for _, c in Fx.avif do
t:eq(auxl ~= nil, c.alpha, c.name .. ": alpha auxiliary item")
end
-- the muxer: round trip through the demuxer
do
local rand = T.rng(5)
local function sample(n: number): buffer
@@ -199,7 +190,6 @@ do
t:check(tags.title == "Mux Test" and tags.artist == "Me" and tags.track == "2" and tags.tracktotal == "9" and tags.custom == "free form" and tags.bpm == "120", "mux: tags round trip")
t:check(#pics == 1 and buffer.len(pics[1].data) == 4, "mux: cover round trip")
t:note("mux: %d bytes, crc %08x", buffer.len(file :: buffer), Crc32.of(file :: buffer))
-- data + sizes form, bad specs
local f2 = IsoBmff.mux({ tracks = { { kind = "audio", entry = "alac", timescale = 8000, data = buffer.create(30), sizes = { 10, 10, 10 }, durations = { 4096, 4096, 100 }, config = buffer.create(24) } } })
local d2 = IsoBmff.demux(Bytes.reader(f2 :: buffer))
t:check(d2 and d2.tracks[1].codec == "alac" and d2.tracks[1].sampleCount == 3 and d2.tracks[1].durations[3] == 100 and buffer.len(d2.tracks[1].config) == 24, "mux: data + sizes, alac cookie")
@@ -209,7 +199,6 @@ do
end
end
-- fuzz
do
local samples = {}
for _, c in Fx.cases do