ws-cleanup: consistency (lower-case tags, WAVE channel order, loops = play count, Err messages, caps)

- Audio tags keys are lower case everywhere (Types.Tags): FLAC no longer returns TITLE / ARTIST (the raw fields stay
  in meta.source.comments; also for Vorbis and Opus); Vorbis / Opus / FLAC read and write tags through
  codecs/VorbisComment (TRACKNUMBER -> track, DISCNUMBER -> disc, DESCRIPTION -> comment); MP3 albumArtist ->
  albumartist and year -> date (ID3 TYER / TDRC, ID3v1); RIFF INFO / CAF / MP4 freeform names are lower-cased (MP4
  writes iTunSMPB / iTunNORM back in their usual spelling; m4a reads tags.itunsmpb).
- Channel order: Vorbis (and Opus mapping family 1) decode to WAVE order like FLAC / WAV / AAC (both used to return
  the Vorbis order); the Vorbis encoder takes WAVE order and writes Vorbis order. Pcm.WAVE_FROM_VORBIS / Pcm.reorder;
  Vorbis.packetDecoder gives pd.order. Tests reorder oggdec's / opusdec's raw (Vorbis-order) references.
- img.loops is the play count in GIF, APNG and WebP (they already agreed; Types / WebP docs said "loop count");
  tests/api round-trips loops 0 / 1 / 3 through all three.
- Err: messages without the format name (png / midi encoders said "png encode: ..."); codecs/Bzip2 and codecs/Zstd
  check arguments through Bytes.span.
- caps: mp3 encodeLayers = { 2, 3 }, opus encodeChannels = 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
4DBugandClaude Opus 5.5 committed 2026-10-31 11:01:22 -05:00
1 parent 8158acf3d5
commit fb2dd98db2
27 files changed
+164 -170

No files matched your search

+24
View File
@@ -129,4 +129,28 @@ do
t:check(F.data.null == F.null, "F.data.null")
end
-- img.loops is a play count in every animated format (GIF stores repeats; APNG / WebP store plays)
do
local function anim(loops: number): any
local img = image(8, 8)
img.frames = {}
for k = 1, 2 do
local fr = image(8, 8)
buffer.writeu8(fr.pixels, 0, k)
table.insert(img.frames, { image = fr, delay = 0.1, x = 0, y = 0, dispose = "none", blend = "source" })
end
img.loops = loops
return img
end
for _, fmt in { "gif", "png", "webp" } do
for _, loops in { 0, 1, 3 } do
local saved, err = F.save(anim(loops), nil, { format = fmt, lossless = true })
t:check(saved, fmt .. " loops " .. loops .. ": " .. tostring(err))
local back = saved and F.load(saved)
t:check(back and back.frames and #back.frames == 2, fmt .. " loops " .. loops .. ": animated")
t:eq(back and back.loops, loops, fmt .. ": loops " .. loops .. " round trip")
end
end
end
t:done()