Skip to content

v0.0.9

Choose a tag to compare

@fluxin fluxin released this 20 Oct 22:15
· 42 commits to main since this release

Breaking: import paths. The codecs and containers now sit under their family, as Odin's core:image/png does. Package names are unchanged, so only the import paths change:

Before Now
odecs/aac, alac, flac, mp3, opus, vorbis, wav odecs/audio/aac, audio/alac, audio/flac, audio/mp3, audio/opus, audio/vorbis, audio/wav
odecs/bmp, gif, jpeg, webp, png/encoder odecs/image/bmp, image/gif, image/jpeg, image/webp, image/png/encoder
odecs/h264, h265, vp9, av1, prores odecs/video/h264, video/h265, video/vp9, video/av1, video/prores
odecs/mp4, webm, ogg odecs/container/mp4, container/webm, container/ogg

Subpackages move with them: for example, odecs/h264/decoder is now odecs/video/h264/decoder and odecs/aac/encoder is now odecs/audio/aac/encoder. These stay where they were: audio, image, video, media (and media/native, media/vulkan, media/videotoolbox), common, shaders, tools, viewer and demo.

Audio no longer links video (reported by ottis). audio decodes through its own audio.Decoder, which is the one implementation of AAC, FLAC, MP3, Opus, ALAC and Vorbis packet decoding. media's native provider delegates to it. An audio-only program decoding Vorbis now has 863 KB of text, down from 3.31 MB on v0.0.8. It contains no video symbols and needs no video codec's licence notice. CI has a new layers gate: audio reaches no media, video or image package, and image reaches no audio, video, media or container package.

Audio additions (asked for by odawg):

  • i16 as well as f32.
    • audio.read(&r, out) takes []f32 or []i16.
    • audio.decode_into(data, out, channels) fills a caller's buffer of either type, sized from info.
    • WAV and FLAC reads are bit-identical to wav.read and flac.interleave in both types.
    • The lossy codecs round their f32 with common.to_i16.
  • A channel limit. open, open_stream, decode and decode_into take channels = N, which keeps the first N channels in WAVE order. Reader.kept gives the count that reads return.
  • Info.loop is a Maybe(audio.Loop). Loop holds {start, end} in frames, with end exclusive. It comes from:
    • WAV's first smpl loop, which is end-inclusive, so end here is one past it;
    • a FLAC file's APPLICATION "riff" smpl chunk;
    • LOOPSTART/LOOPLENGTH Vorbis comments, in Ogg Vorbis, Ogg Opus and FLAC.
  • WAV writing: wav.header_into(dst, frames, rate, channels, format) and wav.HEADER_SIZE give the 44-byte header alone, for writers that stream their own samples. wav.smpl_loop parses a smpl chunk body.

f32 output is unchanged: it is byte-identical on 100 fixture files. The wav, flac, mp3, opus, mkv, alpha, mp4 and vorbis gates pass, and so do the image and WebP gates after the move. Every package checks under vet, and every package's tests pass.