ws-m4a: codecs/Aac (AAC-LC decoder: ASC / PCE / ADTS, all tools, SBR/PS extension hook), codecs/Alac (decoder + encoder), audio/m4a (AAC + ALAC read, ALAC write, tags, gapless, seek), audio/aac (ADTS), audio/caf (lpcm/alac/aac/ulaw/alaw read, lpcm/alac write); fixtures checked by ffmpeg / fdkaac / MP4Box
This commit is contained in:
1 parent
064af84d63
commit
83d43f6c6d
22 files changed
+5380
No files matched your search
@@ -0,0 +1,31 @@
|
||||
-- tools/fixtures/_m4a_encode: run by tools/fixtures/m4a.py (luau, from the repo root) so the reference tools can check
|
||||
-- our writers: encodes the test signal (tests/audio/_signal) to ALAC M4A (audio/m4a) and ALAC / PCM CAF (audio/caf)
|
||||
-- and prints "<name> <hex>" lines. The tests re-encode and compare the CRC with the file ffmpeg validated.
|
||||
local Signal = require("@tests/audio/_signal")
|
||||
local M4a = require("@formats/audio/m4a")
|
||||
local Caf = require("@formats/audio/caf")
|
||||
|
||||
local function hex(b: buffer): string
|
||||
local t = table.create(buffer.len(b))
|
||||
for i = 0, buffer.len(b) - 1 do
|
||||
t[i + 1] = string.format("%02x", buffer.readu8(b, i))
|
||||
end
|
||||
return table.concat(t)
|
||||
end
|
||||
|
||||
local Cases = require("@tests/audio/_encode_cases")
|
||||
for _, c in Cases do
|
||||
local a = Signal.audio(c.rate, c.frames, c.channels, c.bits, c.seed)
|
||||
a.tags = c.tags or {}
|
||||
local out, err
|
||||
if c.container == "caf" then
|
||||
out, err = Caf.encode(a, { codec = c.codec, bitDepth = c.bits })
|
||||
else
|
||||
out, err = M4a.encode(a, { bitDepth = c.bits })
|
||||
end
|
||||
if not out then
|
||||
print(c.name .. " ERROR " .. tostring(err))
|
||||
else
|
||||
print(c.name .. " " .. hex(out))
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user