codecs/audio: comments to specs only
This commit is contained in:
1 parent
0bd7b87d2b
commit
6dcce481bb
69 files changed
+523
-1604
No files matched your search
@@ -1,15 +1,7 @@
|
||||
--!strict
|
||||
-- codecs/audio/Tta: the TTA1 (True Audio) lossless codec. A codec (layer 3). Written from the TTA1 format description
|
||||
-- (the 22-byte header with its CRC-32, the seek table of frame sizes with its CRC-32, frames of 256 / 245 seconds);
|
||||
-- no libtta / ffmpeg code (those are LGPL). The frame decoder is codecs/audio/Tta/Decode. Supports format 1 (plain
|
||||
-- PCM), 8 / 16 / 24 bits, any channel count, the header / seek table / frame CRCs. Not supported: format 2
|
||||
-- (password-protected: UNSUPPORTED), TTA2.
|
||||
--
|
||||
-- local info, err = Tta.info(buf, at, limit) -- the header at `at` (after any ID3v2 tag) + the frame table
|
||||
-- local dec = Tta.decoder(info)
|
||||
-- local n, err = dec:frame(buf, i) -- frame i (1-based) -> dec.pcm (interleaved integers)
|
||||
--
|
||||
-- Never throws: bad data returns nil, Err.
|
||||
-- codecs/audio/Tta: the TTA1 (True Audio) lossless codec.
|
||||
-- From the TTA1 format description (22-byte header and seek table with CRC-32s, frames of 256 / 245 seconds); no libtta /
|
||||
-- ffmpeg code (LGPL). Format 2 (password) is UNSUPPORTED.
|
||||
local Err = require("@rosetta/core/Err")
|
||||
local Crc32 = require("@rosetta/core/Crc32")
|
||||
local Decode = require("@rosetta/codecs/audio/Tta/Decode")
|
||||
@@ -21,14 +13,13 @@ export type Info = {
|
||||
channels: number,
|
||||
bitsPerSample: number,
|
||||
sampleRate: number,
|
||||
samples: number, -- per channel
|
||||
samples: number,
|
||||
frameLength: number, -- samples per frame (256 * rate / 245)
|
||||
frames: number,
|
||||
offsets: { number }, -- each frame's byte offset
|
||||
offsets: { number },
|
||||
sizes: { number },
|
||||
}
|
||||
|
||||
-- info(buf, at, limit) -> Info | nil, Err: the TTA1 header at byte `at`
|
||||
function Tta.info(buf: buffer, at: number, limit: number): (Info?, Err.Err?)
|
||||
if at + 22 > limit then
|
||||
return nil, Err.new(Err.TRUNCATED, "truncated header")
|
||||
@@ -86,7 +77,6 @@ function Tta.info(buf: buffer, at: number, limit: number): (Info?, Err.Err?)
|
||||
return info, nil
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ decoder
|
||||
export type Decoder = {
|
||||
info: Info,
|
||||
pcm: { number },
|
||||
@@ -112,7 +102,6 @@ local function frame(self: Decoder, buf: buffer, i: number): (number?, Err.Err?)
|
||||
return got, nil
|
||||
end
|
||||
|
||||
-- decoder(info, limit) -> Decoder (limit: the end of the file data)
|
||||
function Tta.decoder(info: Info, limit: number): Decoder
|
||||
return {
|
||||
info = info,
|
||||
|
||||
Reference in new issue
Block a user