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:
1 parent
8158acf3d5
commit
fb2dd98db2
27 files changed
+164
-170
No files matched your search
@@ -312,6 +312,8 @@ for atom, name in TAG do
|
||||
end
|
||||
Meta.TAG = TAG
|
||||
Meta.TAG_ATOM = TAG_ATOM
|
||||
-- freeform (----) names: tags keys are lower case; these keep their usual spelling when written back
|
||||
local FREEFORM: { [string]: string } = { itunsmpb = "iTunSMPB", itunnorm = "iTunNORM", itunes_cddb_ids = "iTunes_CDDB_IDs" }
|
||||
|
||||
-- the ID3v1 genres gnre indexes (1-based in gnre)
|
||||
local GENRES = {
|
||||
@@ -384,7 +386,7 @@ function Meta.tags(b: buffer, ilst: Box.Box?): ({ [string]: string }, { Picture
|
||||
table.insert(pics, { mime = mime, data = data })
|
||||
elseif kind == 1 or kind == 0 then
|
||||
local s = readstring(b, p, n)
|
||||
local key = freeName or TAG[typ] or typ
|
||||
local key = if freeName then string.lower(freeName) else TAG[typ] or string.lower(typ)
|
||||
if typ == "\169gen" or not tags[key] then
|
||||
tags[key] = s
|
||||
end
|
||||
@@ -487,7 +489,7 @@ function Meta.writeIlst(w: Bytes.Writer, tags: { [string]: string }, pictures: {
|
||||
end)
|
||||
box(w, "name", function()
|
||||
w:u32be(0)
|
||||
w:string(k)
|
||||
w:string(FREEFORM[k] or k)
|
||||
end)
|
||||
dataBox(w, 1, v)
|
||||
end)
|
||||
|
||||
Reference in new issue
Block a user