diff --git a/build/Rosetta.luau b/build/Rosetta.luau index 1142090..4bae49f 100644 --- a/build/Rosetta.luau +++ b/build/Rosetta.luau @@ -106,6 +106,56 @@ end local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order: { number }? = nil +local byExt: { [string]: { number } } = {} +local Sniffs: { [string]: (any) -> number }? = nil + +local function sniffOrder(): { number } + local o = order + if o then + return o + end + local list: { number } = {} + for idx, e in Registry do + table.insert(list, idx) + for _, x in e.extensions do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx: number): number + local e = Registry[idx] + return if LATE[e.name] then 3 else e.sniff + end + table.sort(list, function(a: number, b: number): boolean + local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e: Registry.Entry): ((any) -> number)? + if e.sniff < 2 then + local s = Sniffs + if not s then + s = __include("Sniffs") :: any + Sniffs = s + end + local f = (s :: { [string]: (any) -> number })[e.path] + if f then + return f + end + end + local m = module(e) + return if m and type(m.sniff) == "function" then m.sniff else nil +end + local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) if format then local e = find(format, category) @@ -115,52 +165,35 @@ local function detect(buf: buffer, name: string?, category: string?, format: str return e, nil end local ext = Input.extension(name) + local list = sniffOrder() + local hits = if ext then byExt[ext] else nil local best: Registry.Entry? = nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late: { number }? = nil - for idx, e in Registry do - if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late :: { number }, idx) - continue - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score += 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = if pass == 1 then hits else list + if ids then + for _, idx in ids do + if pass == 2 and bestScore > 1 then + break end - end - end - end - if late then - for _, idx in late do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (if extHit then 0.01 else 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score += 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -724,7 +757,7 @@ function F.detect(src: any, opts: Options?): (string?, Err.Err?) return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) + local m = if entry.variant then module(entry) else nil if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then @@ -914,6 +947,8 @@ __FILES["Registry"] = function() -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). type Entry = { name: string, category: string, @@ -922,6 +957,8 @@ type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -934,6 +971,7 @@ local list: { Entry } = { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return __include("image/ani") end, @@ -946,6 +984,7 @@ local list: { Entry } = { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/art") end, @@ -958,6 +997,7 @@ local list: { Entry } = { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return __include("image/blp") end, @@ -970,6 +1010,7 @@ local list: { Entry } = { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return __include("image/bmp") end, @@ -982,6 +1023,7 @@ local list: { Entry } = { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return __include("image/dds") end, @@ -994,6 +1036,7 @@ local list: { Entry } = { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return __include("image/exr") end, @@ -1006,6 +1049,7 @@ local list: { Entry } = { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return __include("image/gif") end, @@ -1018,6 +1062,7 @@ local list: { Entry } = { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return __include("image/hdr") end, @@ -1030,6 +1075,7 @@ local list: { Entry } = { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return __include("image/icns") end, @@ -1042,6 +1088,7 @@ local list: { Entry } = { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/ico") end, @@ -1054,6 +1101,7 @@ local list: { Entry } = { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/ilbm") end, @@ -1066,6 +1114,7 @@ local list: { Entry } = { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return __include("image/jpeg") end, @@ -1078,6 +1127,7 @@ local list: { Entry } = { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return __include("image/ktx") end, @@ -1090,6 +1140,7 @@ local list: { Entry } = { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return __include("image/lmp") end, @@ -1102,6 +1153,7 @@ local list: { Entry } = { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/pcx") end, @@ -1114,6 +1166,7 @@ local list: { Entry } = { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return __include("image/png") end, @@ -1126,6 +1179,7 @@ local list: { Entry } = { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/pnm") end, @@ -1138,6 +1192,7 @@ local list: { Entry } = { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/qoi") end, @@ -1150,6 +1205,7 @@ local list: { Entry } = { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return __include("image/sgi") end, @@ -1162,6 +1218,7 @@ local list: { Entry } = { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return __include("image/spr") end, @@ -1174,6 +1231,7 @@ local list: { Entry } = { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/sunras") end, @@ -1186,6 +1244,7 @@ local list: { Entry } = { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/tga") end, @@ -1198,6 +1257,7 @@ local list: { Entry } = { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/tiff") end, @@ -1210,6 +1270,7 @@ local list: { Entry } = { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return __include("image/tim") end, @@ -1222,6 +1283,7 @@ local list: { Entry } = { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return __include("image/vtf") end, @@ -1234,6 +1296,7 @@ local list: { Entry } = { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/webp") end, @@ -1246,6 +1309,7 @@ local list: { Entry } = { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return __include("image/xbm") end, @@ -1258,6 +1322,7 @@ local list: { Entry } = { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/xpm") end, @@ -1270,6 +1335,7 @@ local list: { Entry } = { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return __include("audio/aac") end, @@ -1282,6 +1348,7 @@ local list: { Entry } = { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/ac3") end, @@ -1294,6 +1361,7 @@ local list: { Entry } = { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return __include("audio/adpcm") end, @@ -1306,6 +1374,7 @@ local list: { Entry } = { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/adx") end, @@ -1318,6 +1387,7 @@ local list: { Entry } = { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/aiff") end, @@ -1330,6 +1400,7 @@ local list: { Entry } = { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("audio/ape") end, @@ -1342,6 +1413,7 @@ local list: { Entry } = { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/au") end, @@ -1354,6 +1426,8 @@ local list: { Entry } = { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return __include("audio/brstm") end, @@ -1366,6 +1440,7 @@ local list: { Entry } = { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return __include("audio/caf") end, @@ -1378,6 +1453,7 @@ local list: { Entry } = { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return __include("audio/flac") end, @@ -1390,6 +1466,7 @@ local list: { Entry } = { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return __include("audio/m4a") end, @@ -1402,6 +1479,7 @@ local list: { Entry } = { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return __include("audio/mp3") end, @@ -1414,6 +1492,7 @@ local list: { Entry } = { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/mpc") end, @@ -1426,6 +1505,7 @@ local list: { Entry } = { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return __include("audio/opus") end, @@ -1438,6 +1518,7 @@ local list: { Entry } = { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/qoa") end, @@ -1450,6 +1531,7 @@ local list: { Entry } = { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return __include("audio/tta") end, @@ -1462,6 +1544,7 @@ local list: { Entry } = { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return __include("audio/vag") end, @@ -1474,6 +1557,7 @@ local list: { Entry } = { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return __include("audio/voc") end, @@ -1486,6 +1570,7 @@ local list: { Entry } = { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return __include("audio/vorbis") end, @@ -1498,6 +1583,7 @@ local list: { Entry } = { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return __include("audio/wav") end, @@ -1510,6 +1596,7 @@ local list: { Entry } = { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return __include("audio/wavpack") end, @@ -1522,6 +1609,7 @@ local list: { Entry } = { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return __include("video/avi") end, @@ -1534,6 +1622,7 @@ local list: { Entry } = { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return __include("video/fli") end, @@ -1546,6 +1635,7 @@ local list: { Entry } = { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return __include("video/flv") end, @@ -1558,6 +1648,7 @@ local list: { Entry } = { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return __include("video/h264") end, @@ -1570,6 +1661,8 @@ local list: { Entry } = { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return __include("video/mkv") end, @@ -1582,6 +1675,7 @@ local list: { Entry } = { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return __include("video/mp4") end, @@ -1594,6 +1688,7 @@ local list: { Entry } = { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegps") end, @@ -1606,6 +1701,7 @@ local list: { Entry } = { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegts") end, @@ -1618,6 +1714,7 @@ local list: { Entry } = { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return __include("video/ogv") end, @@ -1630,6 +1727,7 @@ local list: { Entry } = { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return __include("video/smk") end, @@ -1642,6 +1740,7 @@ local list: { Entry } = { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return __include("video/y4m") end, @@ -1654,6 +1753,7 @@ local list: { Entry } = { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return __include("model/3ds") end, @@ -1666,6 +1766,7 @@ local list: { Entry } = { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return __include("model/3mf") end, @@ -1678,6 +1779,7 @@ local list: { Entry } = { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return __include("model/ase") end, @@ -1690,6 +1792,7 @@ local list: { Entry } = { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return __include("model/b3d") end, @@ -1702,6 +1805,7 @@ local list: { Entry } = { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return __include("model/blend") end, @@ -1714,6 +1818,7 @@ local list: { Entry } = { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return __include("model/bsp") end, @@ -1726,6 +1831,7 @@ local list: { Entry } = { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return __include("model/buildmap") end, @@ -1738,6 +1844,7 @@ local list: { Entry } = { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return __include("model/d3map") end, @@ -1750,6 +1857,7 @@ local list: { Entry } = { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return __include("model/dae") end, @@ -1762,6 +1870,7 @@ local list: { Entry } = { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return __include("model/fbx") end, @@ -1774,6 +1883,7 @@ local list: { Entry } = { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return __include("model/gltf") end, @@ -1786,6 +1896,7 @@ local list: { Entry } = { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return __include("model/godot") end, @@ -1798,6 +1909,7 @@ local list: { Entry } = { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/iqm") end, @@ -1810,6 +1922,7 @@ local list: { Entry } = { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return __include("model/ldraw") end, @@ -1822,6 +1935,7 @@ local list: { Entry } = { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return __include("model/lwo") end, @@ -1834,6 +1948,7 @@ local list: { Entry } = { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return __include("model/map") end, @@ -1846,6 +1961,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return __include("model/mca") end, @@ -1858,6 +1974,7 @@ local list: { Entry } = { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return __include("model/md2") end, @@ -1870,6 +1987,7 @@ local list: { Entry } = { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return __include("model/md3") end, @@ -1882,6 +2000,7 @@ local list: { Entry } = { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/md5") end, @@ -1894,6 +2013,7 @@ local list: { Entry } = { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/mdl") end, @@ -1906,6 +2026,7 @@ local list: { Entry } = { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return __include("model/ms3d") end, @@ -1918,6 +2039,7 @@ local list: { Entry } = { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/obj") end, @@ -1930,6 +2052,7 @@ local list: { Entry } = { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return __include("model/off") end, @@ -1942,6 +2065,7 @@ local list: { Entry } = { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return __include("model/ply") end, @@ -1954,6 +2078,7 @@ local list: { Entry } = { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return __include("model/pmx") end, @@ -1966,6 +2091,7 @@ local list: { Entry } = { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return __include("model/proc") end, @@ -1978,6 +2104,7 @@ local list: { Entry } = { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return __include("model/qb") end, @@ -1990,6 +2117,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return __include("model/rbxm") end, @@ -2002,6 +2131,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return __include("model/rbxmx") end, @@ -2014,6 +2145,7 @@ local list: { Entry } = { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return __include("model/robloxmesh") end, @@ -2026,6 +2158,8 @@ local list: { Entry } = { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return __include("model/schematic") end, @@ -2038,6 +2172,7 @@ local list: { Entry } = { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/smd") end, @@ -2050,6 +2185,7 @@ local list: { Entry } = { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return __include("model/sourcemdl") end, @@ -2062,6 +2198,7 @@ local list: { Entry } = { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return __include("model/stl") end, @@ -2074,6 +2211,7 @@ local list: { Entry } = { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return __include("model/t3d") end, @@ -2086,6 +2224,7 @@ local list: { Entry } = { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return __include("model/udmf") end, @@ -2098,6 +2237,7 @@ local list: { Entry } = { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return __include("model/usda") end, @@ -2110,6 +2250,7 @@ local list: { Entry } = { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return __include("model/vbsp") end, @@ -2122,6 +2263,7 @@ local list: { Entry } = { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return __include("model/vmf") end, @@ -2134,6 +2276,7 @@ local list: { Entry } = { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return __include("model/vox") end, @@ -2146,6 +2289,7 @@ local list: { Entry } = { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return __include("model/vrml") end, @@ -2158,6 +2302,7 @@ local list: { Entry } = { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/x") end, @@ -2170,6 +2315,7 @@ local list: { Entry } = { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return __include("model/x3d") end, @@ -2182,6 +2328,7 @@ local list: { Entry } = { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return __include("cad/step") end, @@ -2194,6 +2341,7 @@ local list: { Entry } = { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return __include("font/bdf") end, @@ -2206,6 +2354,7 @@ local list: { Entry } = { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return __include("font/bmfont") end, @@ -2218,6 +2367,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return __include("font/eot") end, @@ -2230,6 +2380,7 @@ local list: { Entry } = { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return __include("font/fon") end, @@ -2242,6 +2393,7 @@ local list: { Entry } = { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return __include("font/hershey") end, @@ -2254,6 +2406,7 @@ local list: { Entry } = { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return __include("font/pcf") end, @@ -2266,6 +2419,7 @@ local list: { Entry } = { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return __include("font/psf") end, @@ -2278,6 +2432,7 @@ local list: { Entry } = { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return __include("font/ttf") end, @@ -2290,6 +2445,7 @@ local list: { Entry } = { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return __include("font/type1") end, @@ -2302,6 +2458,7 @@ local list: { Entry } = { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return __include("font/woff") end, @@ -2314,6 +2471,7 @@ local list: { Entry } = { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return __include("font/woff2") end, @@ -2326,6 +2484,7 @@ local list: { Entry } = { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return __include("archive/7z") end, @@ -2338,6 +2497,7 @@ local list: { Entry } = { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return __include("archive/adf") end, @@ -2350,6 +2510,7 @@ local list: { Entry } = { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return __include("archive/applesingle") end, @@ -2362,6 +2523,7 @@ local list: { Entry } = { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return __include("archive/ar") end, @@ -2374,6 +2536,7 @@ local list: { Entry } = { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return __include("archive/arj") end, @@ -2386,6 +2549,7 @@ local list: { Entry } = { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return __include("archive/binhex") end, @@ -2398,6 +2562,7 @@ local list: { Entry } = { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/br") end, @@ -2410,6 +2575,7 @@ local list: { Entry } = { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return __include("archive/bz2") end, @@ -2422,6 +2588,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return __include("archive/cab") end, @@ -2434,6 +2601,7 @@ local list: { Entry } = { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return __include("archive/cpio") end, @@ -2446,6 +2614,7 @@ local list: { Entry } = { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return __include("archive/d64") end, @@ -2458,6 +2627,7 @@ local list: { Entry } = { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return __include("archive/fat") end, @@ -2470,6 +2640,7 @@ local list: { Entry } = { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("archive/grp") end, @@ -2482,6 +2653,7 @@ local list: { Entry } = { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return __include("archive/gzip") end, @@ -2494,6 +2666,7 @@ local list: { Entry } = { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return __include("archive/iso") end, @@ -2506,6 +2679,7 @@ local list: { Entry } = { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return __include("archive/lha") end, @@ -2518,6 +2692,7 @@ local list: { Entry } = { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return __include("archive/lz4") end, @@ -2530,6 +2705,7 @@ local list: { Entry } = { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return __include("archive/macbinary") end, @@ -2542,6 +2718,7 @@ local list: { Entry } = { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return __include("archive/mpq") end, @@ -2554,6 +2731,7 @@ local list: { Entry } = { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return __include("archive/pak") end, @@ -2566,6 +2744,7 @@ local list: { Entry } = { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return __include("archive/rpm") end, @@ -2578,6 +2757,7 @@ local list: { Entry } = { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return __include("archive/tar") end, @@ -2590,6 +2770,7 @@ local list: { Entry } = { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("archive/unitypackage") end, @@ -2602,6 +2783,7 @@ local list: { Entry } = { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return __include("archive/uu") end, @@ -2614,6 +2796,7 @@ local list: { Entry } = { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return __include("archive/vpk") end, @@ -2626,6 +2809,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return __include("archive/vswap") end, @@ -2638,6 +2822,7 @@ local list: { Entry } = { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return __include("archive/wad") end, @@ -2650,6 +2835,7 @@ local list: { Entry } = { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return __include("archive/wad2") end, @@ -2662,6 +2848,7 @@ local list: { Entry } = { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return __include("archive/xz") end, @@ -2674,6 +2861,7 @@ local list: { Entry } = { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return __include("archive/yenc") end, @@ -2686,6 +2874,7 @@ local list: { Entry } = { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return __include("archive/z") end, @@ -2698,6 +2887,7 @@ local list: { Entry } = { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return __include("archive/zip") end, @@ -2710,6 +2900,7 @@ local list: { Entry } = { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return __include("archive/zoo") end, @@ -2722,6 +2913,7 @@ local list: { Entry } = { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/zst") end, @@ -2734,6 +2926,7 @@ local list: { Entry } = { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return __include("data/cbor") end, @@ -2746,6 +2939,7 @@ local list: { Entry } = { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return __include("data/csv") end, @@ -2758,6 +2952,7 @@ local list: { Entry } = { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/ini") end, @@ -2770,6 +2965,7 @@ local list: { Entry } = { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return __include("data/json") end, @@ -2782,6 +2978,7 @@ local list: { Entry } = { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return __include("data/msgpack") end, @@ -2794,6 +2991,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return __include("data/nbt") end, @@ -2806,6 +3004,7 @@ local list: { Entry } = { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return __include("data/plist") end, @@ -2818,6 +3017,7 @@ local list: { Entry } = { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3shader") end, @@ -2830,6 +3030,7 @@ local list: { Entry } = { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3skin") end, @@ -2842,6 +3043,7 @@ local list: { Entry } = { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return __include("data/snbt") end, @@ -2854,6 +3056,7 @@ local list: { Entry } = { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return __include("data/toml") end, @@ -2866,6 +3069,7 @@ local list: { Entry } = { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/tres") end, @@ -2878,6 +3082,7 @@ local list: { Entry } = { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return __include("data/vdf") end, @@ -2890,6 +3095,7 @@ local list: { Entry } = { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return __include("data/xml") end, @@ -2902,6 +3108,7 @@ local list: { Entry } = { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return __include("data/yaml") end, @@ -2914,6 +3121,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return __include("vector/gamemaps") end, @@ -2926,6 +3134,7 @@ local list: { Entry } = { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return __include("vector/ldtk") end, @@ -2938,6 +3147,7 @@ local list: { Entry } = { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return __include("vector/ogmo") end, @@ -2950,6 +3160,7 @@ local list: { Entry } = { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return __include("vector/svg") end, @@ -2962,6 +3173,7 @@ local list: { Entry } = { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return __include("vector/tiled") end, @@ -2974,6 +3186,7 @@ local list: { Entry } = { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/aseprite") end, @@ -2986,6 +3199,7 @@ local list: { Entry } = { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return __include("layered/ora") end, @@ -2998,6 +3212,7 @@ local list: { Entry } = { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/psd") end, @@ -3010,6 +3225,7 @@ local list: { Entry } = { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/ass") end, @@ -3022,6 +3238,7 @@ local list: { Entry } = { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return __include("subtitle/srt") end, @@ -3034,6 +3251,7 @@ local list: { Entry } = { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/vtt") end, @@ -3046,6 +3264,7 @@ local list: { Entry } = { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return __include("music/669") end, @@ -3058,6 +3277,7 @@ local list: { Entry } = { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return __include("music/ahx") end, @@ -3070,6 +3290,7 @@ local list: { Entry } = { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return __include("music/far") end, @@ -3082,6 +3303,7 @@ local list: { Entry } = { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return __include("music/hmp") end, @@ -3094,6 +3316,7 @@ local list: { Entry } = { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return __include("music/hvl") end, @@ -3106,6 +3329,7 @@ local list: { Entry } = { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return __include("music/it") end, @@ -3118,6 +3342,7 @@ local list: { Entry } = { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/med") end, @@ -3130,6 +3355,7 @@ local list: { Entry } = { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return __include("music/midi") end, @@ -3142,6 +3368,7 @@ local list: { Entry } = { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mod") end, @@ -3154,6 +3381,7 @@ local list: { Entry } = { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mtm") end, @@ -3166,6 +3394,7 @@ local list: { Entry } = { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return __include("music/mus") end, @@ -3178,6 +3407,7 @@ local list: { Entry } = { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return __include("music/okt") end, @@ -3190,6 +3420,7 @@ local list: { Entry } = { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ptm") end, @@ -3202,6 +3433,7 @@ local list: { Entry } = { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/s3m") end, @@ -3214,6 +3446,7 @@ local list: { Entry } = { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return __include("music/sf2") end, @@ -3226,6 +3459,7 @@ local list: { Entry } = { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return __include("music/stm") end, @@ -3238,6 +3472,7 @@ local list: { Entry } = { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ult") end, @@ -3250,6 +3485,7 @@ local list: { Entry } = { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return __include("music/umx") end, @@ -3262,6 +3498,7 @@ local list: { Entry } = { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/xm") end, @@ -3274,6 +3511,7 @@ local list: { Entry } = { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return __include("music/xmi") end, @@ -3286,6 +3524,7 @@ local list: { Entry } = { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return __include("playlist/m3u") end, @@ -3298,6 +3537,7 @@ local list: { Entry } = { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("playlist/pls") end, @@ -3310,6 +3550,7 @@ local list: { Entry } = { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("playlist/xspf") end, @@ -3318,6 +3559,3392 @@ local list: { Entry } = { return list end +__FILES["Sniffs"] = function() + + +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S: { [string]: (any) -> number } = {} + +local function lazy(load: () -> any): any + local proxy = {} + return setmetatable(proxy, { + __index = function(_, k: any): any + local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = __include("core/Bytes") +S["image/ani"] = function(r: Bytes.Reader): number + return if r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" then 1 else 0 +end +end + +do -- image/art +local Bytes = __include("core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b: buffer, o: number, limit: number): (number?, number?, number?, number?, boolean?) + local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p += 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r: Bytes.Reader): number + local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at :: number + if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total += w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return if size == have then 0.9 elseif size < have and have - size < 4096 then 0.5 else 0 +end +end + +do -- image/blp +local Bytes = __include("core/Bytes") +S["image/blp"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "BLP1" or m == "BLP2" then 1 elseif m == "BLP0" then 0.8 else 0 +end +end + +do -- image/bmp +local Bytes = __include("core/Bytes") +S["image/bmp"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = __include("core/Bytes") +S["image/gif"] = function(r: Bytes.Reader): number + local s = r:peek(6) + return if s == "GIF89a" or s == "GIF87a" then 1 else 0 +end +end + +do -- image/hdr +local Bytes = __include("core/Bytes") +S["image/hdr"] = function(r: Bytes.Reader): number + local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/icns"] = function(r: Bytes.Reader): number + return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = __include("core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r: Bytes.Reader): number + if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = __include("core/Bytes") +S["image/ilbm"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return if t == "ILBM" or t == "PBM " then 1 else 0 +end +end + +do -- image/jpeg +local Bytes = __include("core/Bytes") +S["image/jpeg"] = function(r: Bytes.Reader): number + local s = r:peek(3) + return if s == "\255\216\255" then 1 else 0 +end +end + +do -- image/ktx +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = __include("core/Bytes") +local function kindOf(r: Bytes.Reader): string? + local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r: Bytes.Reader): number + local k = kindOf(r) + return if k == "qpic" then 0.3 elseif k then 0.05 else 0 +end +end + +do -- image/pcx +local Bytes = __include("core/Bytes") +S["image/pcx"] = function(r: Bytes.Reader): number + if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return if bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 then 0.8 else 0 +end +end + +do -- image/png +local Bytes = __include("core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r: Bytes.Reader): number + return if r:peek(8) == SIGNATURE then 1 else 0 +end +end + +do -- image/pnm +local Bytes = __include("core/Bytes") +S["image/pnm"] = function(r: Bytes.Reader): number + if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = __include("core/Bytes") +S["image/qoi"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoif" then 1 else 0 +end +end + +do -- image/sgi +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/sgi"] = function(r: Bytes.Reader): number + if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return if st <= 1 and (bpc == 1 or bpc == 2) then 1 else 0 +end +end + +do -- image/spr +local Bytes = __include("core/Bytes") +S["image/spr"] = function(r: Bytes.Reader): number + if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v == 1 or v == 2 or v == 32 then 1 else 0.3 +end +end + +do -- image/sunras +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = __include("core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 +type Header = { + idLen: number, + cmapType: number, + imageType: number, + cmapFirst: number, + cmapLen: number, + cmapBits: number, + width: number, + height: number, + depth: number, + desc: number, +} +local function header(r: Bytes.Reader): Header? + if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q: number): number + return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h: Header = { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h: Header): string? + local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r: Bytes.Reader): number + local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = __include("core/Bytes") +S["image/tiff"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = __include("core/Bytes") +S["image/tim"] = function(r: Bytes.Reader): number + if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = __include("core/Bytes") +S["image/vtf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VTF\0" and r:peekU8(4) == 7 then 1 else 0 +end +end + +do -- image/webp +local Bytes = __include("core/Bytes") +S["image/webp"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xbm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xpm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = __include("core/Bytes") +local Aac = lazy(function() + return __include("codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = if bit32.band(readu8(b, p + 5), 0x10) ~= 0 then 10 else 0 + return 10 + s + footer +end +S["audio/aac"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return if p + h.frameSize >= limit then 0.7 else 0.4 +end +end + +do -- audio/ac3 +local Bytes = __include("core/Bytes") +local Ac3 = lazy(function() + return __include("codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return if p + h.frameSize >= limit then 0.6 else 0.3 +end +end + +do -- audio/adpcm +local Bytes = __include("core/Bytes") +S["audio/adpcm"] = function(_r: Bytes.Reader): number + return 0 +end +end + +do -- audio/adx +local Bytes = __include("core/Bytes") +S["audio/adx"] = function(r: Bytes.Reader): number + if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return if r:peek(6, off - 2) == "(c)CRI" then 1 else 0 +end +end + +do -- audio/aiff +local Bytes = __include("core/Bytes") +S["audio/aiff"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return if form == "AIFF" or form == "AIFC" then 1 else 0 +end +end + +do -- audio/ape +local Bytes = __include("core/Bytes") +S["audio/ape"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (if footer then 10 else 0)) + return if id == "MAC " or id == "MACF" then 1 else 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = __include("core/Bytes") +S["audio/au"] = function(r: Bytes.Reader): number + return if r:peek(4) == ".snd" then 1 else 0 +end +end + +do -- audio/brstm +local Bytes = __include("core/Bytes") +S["audio/brstm"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return if bom == "\254\255" or bom == "\255\254" then 1 else 0 +end +end + +do -- audio/caf +local Bytes = __include("core/Bytes") +S["audio/caf"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = __include("core/Bytes") +S["audio/flac"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return if r:peek(4, 10 + sz + (if footer then 10 else 0)) == "fLaC" then 1 else 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local AUDIO_BRANDS: { [string]: number } = { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = __include("core/Bytes") +local Header = lazy(function() + return __include("codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return __include("audio/mp3/Tags") +end) +S["audio/mp3"] = function(r: Bytes.Reader): number + local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = if p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" then Tags.id3v2Size(b, p, lim) else 0 + if n <= 0 then + break + end + id3 = true + p += n + end + if p + 4 > lim or not Header.valid(b, p) then + return if id3 then 0.5 else 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb += Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return if id3 then 0.7 else 0.25 +end +end + +do -- audio/mpc +local Bytes = __include("core/Bytes") +local Musepack = lazy(function() + return __include("codecs/audio/Musepack") +end) +local function id3v2(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n += bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (if bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 then 10 else 0) +end +S["audio/mpc"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return if v == 7 then 0.9 else 0 +end +end + +do -- audio/opus +local Bytes = __include("core/Bytes") +S["audio/opus"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return if r:peek(8, 27 + nseg) == "OpusHead" then 1 else 0 +end +end + +do -- audio/qoa +local Bytes = __include("core/Bytes") +S["audio/qoa"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoaf" then 1 else 0 +end +end + +do -- audio/tta +local Bytes = __include("core/Bytes") +local function id3Size(r: Bytes.Reader): number + if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (if footer then 10 else 0) +end +S["audio/tta"] = function(r: Bytes.Reader): number + return if r:peek(4, id3Size(r)) == "TTA1" then 1 else 0 +end +end + +do -- audio/vag +local Bytes = __include("core/Bytes") +S["audio/vag"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "VAGp" or m == "VAGi" or m == "KVAG" then 1 else 0 +end +end + +do -- audio/voc +local Bytes = __include("core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r: Bytes.Reader): number + return if r:peek(20) == MAGIC then 1 else 0 +end +end + +do -- audio/vorbis +local Bytes = __include("core/Bytes") +S["audio/vorbis"] = function(r: Bytes.Reader): number + if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return if buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" then 1 else 0 +end +end + +do -- audio/wav +local Bytes = __include("core/Bytes") +local Riff = lazy(function() + return __include("containers/Riff") +end) +S["audio/wav"] = function(r: Bytes.Reader): number + return if Riff.sniff(r) == "WAVE" then 1 else 0 +end +end + +do -- audio/wavpack +local Bytes = __include("core/Bytes") +S["audio/wavpack"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return if v == 4 then 1 else 0.5 +end +end + +do -- video/avi +local Bytes = __include("core/Bytes") +S["video/avi"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = __include("core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r: Bytes.Reader): number + local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = __include("core/Bytes") +S["video/flv"] = function(r: Bytes.Reader): number + if r:remaining() >= 9 and r:peek(3) == "FLV" then + return if r:peekU8(3) == 1 then 1 else 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = __include("core/Bytes") +S["video/h264"] = function(r: Bytes.Reader): number + local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = __include("core/Bytes") +S["video/mkv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return if brand == "" then 0.6 else 0.8 +end +end + +do -- video/mpegps +local Bytes = __include("core/Bytes") +S["video/mpegps"] = function(r: Bytes.Reader): number + if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = __include("core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r: Bytes.Reader): (number, number) + local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in SIZES do + local hits, need = 0, math.min(3, (n - start - 1) // size + 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits += 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start += 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r: Bytes.Reader): number + local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return if r:remaining() >= 3 * s then 0.9 else 0.5 +end +end + +do -- video/ogv +local Bytes = __include("core/Bytes") +S["video/ogv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size += buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = __include("core/Bytes") +S["video/smk"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = __include("core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r: Bytes.Reader): number + return if r:peek(10) == MAGIC then 1 else 0 +end +end + +do -- model/3ds +local Bytes = __include("core/Bytes") +S["model/3ds"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return if size == r.limit - r.pos then 0.95 else 0.7 +end +end + +do -- model/3mf +local Bytes = __include("core/Bytes") +S["model/3mf"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r: Bytes.Reader): (boolean?, boolean) + local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r: Bytes.Reader, n: number?): string + local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = if r:peek(2) == "\255\254" or r:peek(2) == "\254\255" then 2 else 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r: Bytes.Reader): number + local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = __include("core/Bytes") +S["model/b3d"] = function(r: Bytes.Reader): number + if r:peek(4) == "BB3D" then + return if r:peek(4, 8) ~= "" then 1 else 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["model/blend"] = function(r: Bytes.Reader): number + local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return if inner and buffer.tostring(inner) == "BLENDER" then 1 else 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return if out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" then 1 else 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = __include("core/Bytes") +S["model/bsp"] = function(r: Bytes.Reader): number + if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (if m == "IBSP" then 4 else 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return if v == 38 or v == 46 or v == 47 then 1 else 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = __include("core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b: buffer, o: number, limit: number): (number?, number?, number?, number?) + if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p += 2 + nw * WALL_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p += 2 + nsp * SPRITE_SIZE + return ns, nw, nsp, p +end +S["model/buildmap"] = function(r: Bytes.Reader): number + local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return if stop == limit then 0.9 else 0.5 +end +end + +do -- model/d3map +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/d3map"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return if string.match(head, "^Version%s+[123]%s") then 1 else 0 +end +end + +do -- model/dae +local Bytes = __include("core/Bytes") +S["model/dae"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, " sectors then + return 0 + end + used += 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return if used > 0 then 0.8 else 0.2 +end +end + +do -- model/md2 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md2"] = function(r: Bytes.Reader): number + if r:remaining() < 68 then + return 0 + end + return if Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 then 1 else 0 +end +end + +do -- model/md3 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md3"] = function(r: Bytes.Reader): number + if r:remaining() < 108 then + return 0 + end + return if Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 then 1 else 0 +end +end + +do -- model/md5 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md5"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return if string.match(head, "^MD5Version%s+%d+") then 1 else 0 +end +end + +do -- model/mdl +local Bytes = __include("core/Bytes") +S["model/mdl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = __include("core/Bytes") +local Read = lazy(function() + return __include("model/ms3d/Read") +end) +S["model/ms3d"] = function(r: Bytes.Reader): number + local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return if v == 3 or v == 4 then 1 else 0.6 +end +end + +do -- model/obj +local Bytes = __include("core/Bytes") +S["model/obj"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = __include("core/Bytes") +S["model/off"] = function(r: Bytes.Reader): number + local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = __include("core/Bytes") +S["model/ply"] = function(r: Bytes.Reader): number + local h = r:peek(4) + return if h == "ply\n" or h == "ply\r" then 1 else 0 +end +end + +do -- model/pmx +local Bytes = __include("core/Bytes") +S["model/pmx"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/proc"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = __include("core/Bytes") +S["model/qb"] = function(r: Bytes.Reader): number + if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = __include("core/Bytes") +local MAGIC = "]*%?>", "") + if match(head, "^%s*]") then + return if find(head, "version=", 1, true) then 1 else 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = __include("core/Bytes") +S["model/robloxmesh"] = function(r: Bytes.Reader): number + return if string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") then 1 else 0 +end +end + +do -- model/schematic +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head: string, hints: { string }): boolean + for _, h in hints do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return if hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) then 1 else 0 +end +end + +do -- model/smd +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/smd"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = __include("core/Bytes") +S["model/sourcemdl"] = function(r: Bytes.Reader): number + if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return if v >= 44 and v <= 49 then 1 else 0 +end +end + +do -- model/stl +local Bytes = __include("core/Bytes") +local function lower5(s: string): boolean + return string.lower(s) == "solid" +end +S["model/stl"] = function(r: Bytes.Reader): number + local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return if string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) then 0.9 else 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/t3d"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/udmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = __include("core/Bytes") +local function isUsdz(r: Bytes.Reader): boolean + if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = __include("core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r: Bytes.Reader): number + if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v >= 19 and v <= 21 then 1 else 0.5 +end +end + +do -- model/vmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/vmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = __include("core/Bytes") +S["model/vox"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" then 1 elseif r:peek(4) == "VOX " then 0.8 else 0 +end +end + +do -- model/vrml +local Bytes = __include("core/Bytes") +S["model/vrml"] = function(r: Bytes.Reader): number + local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return if string.sub(head, 1, 10) == "#VRML V2.0" then 1 elseif string.sub(head, 1, 6) == "#VRML " then 0.6 else 0 +end +end + +do -- model/x +local Bytes = __include("core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "xof " then + return 0 + end + return if ENCODINGS[r:peek(4, 8)] then 1 else 0.5 +end +end + +do -- model/x3d +local Bytes = __include("core/Bytes") +S["model/x3d"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "]") or string.find(head, "", 1, true) or (string.find(head, "", 1, true)) then + return if string.find(r:peek(512), "= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return if sig == "NE" then 0.6 elseif sig == "PE" then 0.2 else 0 + end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return if size == r:size() then 0.9 elseif size <= r:size() and size > 118 then 0.3 else 0 + end + return 0 +end +end + +do -- font/hershey +local Bytes = __include("core/Bytes") +local function header(line: string): (number?, number?) + if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r: Bytes.Reader): number + local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line :: string, 9) + if string.find(body, "[^ -~]") then + return 0 + end + return if #body == math.min(2 * n, 64) or #body == 2 * n then 0.7 else 0.3 +end +end + +do -- font/pcf +local Bytes = __include("core/Bytes") +S["font/pcf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "\1fcp" then 1 else 0 +end +end + +do -- font/psf +local Bytes = __include("core/Bytes") +S["font/psf"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = __include("core/Bytes") +S["font/ttf"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = __include("core/Bytes") +S["font/type1"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = __include("core/Bytes") +S["font/woff"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOFF" then 1 else 0 +end +end + +do -- font/woff2 +local Bytes = __include("core/Bytes") +S["font/woff2"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOF2" then 1 else 0 +end +end + +do -- archive/7z +local Bytes = __include("core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r: Bytes.Reader): number + return if r:peek(6) == MAGIC then 1 else 0 +end +end + +do -- archive/adf +local Bytes = __include("core/Bytes") +local BS = 512 +S["archive/adf"] = function(r: Bytes.Reader): number + local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return if n == 901120 or n == 1802240 then 0.95 else 0.6 +end +end + +do -- archive/applesingle +local Bytes = __include("core/Bytes") +S["archive/applesingle"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = __include("core/Bytes") +local MAGIC = "!\n" +S["archive/ar"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return if r:peek(13, 68) == "debian-binary" then 1 else 0.9 + end + return if r:peek(8) == "!\n" then 0.5 else 0 +end +end + +do -- archive/arj +local Bytes = __include("core/Bytes") +S["archive/arj"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return if size > 0 and size <= 2600 then 0.9 else 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = __include("core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return if at == 1 then 1 else 0.8 +end +end + +do -- archive/br +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Brotli = lazy(function() + return __include("codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r: Bytes.Reader): number + local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return if buffer.len(out) > 0 then 0.3 else 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = __include("core/Bytes") +S["archive/bz2"] = function(r: Bytes.Reader): number + local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = __include("core/Bytes") +S["archive/cab"] = function(r: Bytes.Reader): number + if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = __include("core/Bytes") +S["archive/cpio"] = function(r: Bytes.Reader): number + local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = __include("core/Bytes") +type Geometry = { kind: string, tracks: number, offsets: { number }, spt: { number }, dirTrack: number, total: number } +local function geometry(kind: string, tracks: number): Geometry + local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = if kind == "d71" and t > 35 then t - 35 else t + n = if s <= 17 then 21 elseif s <= 24 then 19 elseif s <= 30 then 18 else 17 + end + offsets[t], spt[t] = o, n + o += n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = if kind == "d81" then 40 else 18, total = o } +end +local function detect(len: number): Geometry? + for _, g in { { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } } :: { { any } } do + local geo = geometry(g[1] :: string, g[2] :: number) + local sectors = geo.total // 256 + if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r: Bytes.Reader): number + local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return if t == 40 and s == 3 and v == 0x44 then 0.9 else 0.3 + end + return if t == 18 and s == 1 and (v == 0x41 or v == 0) then 0.9 else 0.3 +end +end + +do -- archive/fat +local Bytes = __include("core/Bytes") +local Fat = lazy(function() + return __include("containers/Fat") +end) +S["archive/fat"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return if v.partition then 0.6 else 0.8 +end +end + +do -- archive/grp +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = __include("core/Bytes") +S["archive/gzip"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\31\139\8" then 1 else 0 +end +end + +do -- archive/iso +local Bytes = __include("core/Bytes") +S["archive/iso"] = function(r: Bytes.Reader): number + return if r:peek(5, 16 * 2048 + 1) == "CD001" then 1 else 0 +end +end + +do -- archive/lha +local Bytes = __include("core/Bytes") +local METHODS: { [string]: boolean } = { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s: string): boolean + if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r: Bytes.Reader): number + if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = __include("core/Bytes") +S["archive/lz4"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = __include("core/Bytes") +local Crc16 = __include("core/Crc16") +local function version(b: buffer, o: number, len: number): string? + if len < 128 then + return nil + end + local u8 = function(i: number): number + return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i: number): number + return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return if buffer.readstring(b, o + 102, 4) == "mBIN" then "III" else "II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return if need <= len + 127 then "I" else nil +end +S["archive/macbinary"] = function(r: Bytes.Reader): number + local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return if v == "III" then 0.95 elseif v == "II" then 0.8 elseif v == "I" then 0.3 else 0 +end +end + +do -- archive/mpq +local Bytes = __include("core/Bytes") +S["archive/mpq"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["archive/pak"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = __include("core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r: Bytes.Reader): number + return if r:peek(4) == LEAD_MAGIC then 1 else 0 +end +end + +do -- archive/tar +local Bytes = __include("core/Bytes") +local Tar = lazy(function() + return __include("containers/Tar") +end) +S["archive/tar"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return if r:peek(5, 257) == "ustar" then 0.95 else 0.6 +end +end + +do -- archive/unitypackage +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Tar = lazy(function() + return __include("containers/Tar") +end) +local function guidOf(name: string): (string?, string?) + local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r: Bytes.Reader): number + if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z += 1 + end + return if guidOf(buffer.readstring(head, 0, z)) then 1 else 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = __include("core/Bytes") +S["archive/uu"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = __include("core/Bytes") +S["archive/vpk"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return if v == 1 or v == 2 then 1 else 0.5 +end +end + +do -- archive/vswap +local Bytes = __include("core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r: Bytes.Reader): (number?, number, number) + if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r: Bytes.Reader): number + local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero += 1 + end + end + return if nonzero > 0 then 0.6 else 0 +end +end + +do -- archive/wad +local Bytes = __include("core/Bytes") +S["archive/wad"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = __include("core/Bytes") +S["archive/wad2"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return if m == "WAD2" or m == "WAD3" then 0.9 else 0 +end +end + +do -- archive/xz +local Bytes = __include("core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r: Bytes.Reader): number + local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return if d == 0x5D then 0.4 else 0.2 +end +S["archive/xz"] = function(r: Bytes.Reader): number + if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = __include("core/Bytes") +S["archive/yenc"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return if string.find(head, "\n=ybegin [^\n]*name=") then 0.6 else 0 +end +end + +do -- archive/z +local Bytes = __include("core/Bytes") +S["archive/z"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return if f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 then 1 else 0.3 +end +end + +do -- archive/zip +local Bytes = __include("core/Bytes") +S["archive/zip"] = function(r: Bytes.Reader): number + local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = __include("core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r: Bytes.Reader): number + local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return if string.sub(h, 1, 4) == "ZOO " then 1 else 0.8 +end +end + +do -- archive/zst +local Bytes = __include("core/Bytes") +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["archive/zst"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = __include("core/Bytes") +S["data/cbor"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\217\217\247" then 1 else 0 +end +end + +do -- data/csv +local Bytes = __include("core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in { ",", "\t", ";" } do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 :: string, d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = __include("core/Bytes") +S["data/ini"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/json"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = __include("core/Bytes") +S["data/msgpack"] = function(_r: Bytes.Reader): number + return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +S["data/nbt"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return if p.firstType then 1 else 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return if p.firstType and p.firstName then 0.6 else 0.2 +end +end + +do -- data/plist +local Bytes = __include("core/Bytes") +S["data/plist"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, " 0 and good == lines and paths > 0 then 0.5 else 0 +end +end + +do -- data/snbt +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/snbt"] = function(r: Bytes.Reader): number + -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = __include("core/Bytes") +S["data/toml"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in string.gmatch(head, "[^\n]+") do + local l = string.match(line, "^[ \t]*(.-)[ \t\r]*$") :: string + if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/tres"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local KeyValues = lazy(function() + return __include("codecs/text/KeyValues") +end) +S["data/vdf"] = function(r: Bytes.Reader): number + local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/xml"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = __include("core/Bytes") +S["data/yaml"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = __include("core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ldtk"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ogmo"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["vector/svg"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, ":]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local function head(r: Bytes.Reader): string + local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r: Bytes.Reader): number + local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "]") or string.find(h, "]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = if n > 1024 then r:peek(1024, n - 1024) else "" + for _, part in { h, tail } do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = __include("core/Bytes") +S["layered/aseprite"] = function(r: Bytes.Reader): number + if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = __include("core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r: Bytes.Reader): number + -- a zip whose first (stored) entry is "mimetype" holding image/openraster + if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = __include("core/Bytes") +S["layered/psd"] = function(r: Bytes.Reader): number + local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/ass"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits: string): number + return (tonumber(digits) :: number) / 10 ^ #digits +end +local function timing(line: string): (number?, number?, string?) + local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = tonumber(h1) :: number * 3600 + tonumber(m1) :: number * 60 + tonumber(s1) :: number + frac(f1 :: string) + local b = tonumber(h2) :: number * 3600 + tonumber(m2) :: number * 60 + tonumber(s2) :: number + frac(f2 :: string) + return a, b, rest +end +S["subtitle/srt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/vtt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad += 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.6 else 0 +end +end + +do -- music/ahx +local Bytes = __include("core/Bytes") +S["music/ahx"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 then 1 else 0 +end +end + +do -- music/far +local Bytes = __include("core/Bytes") +S["music/far"] = function(r: Bytes.Reader): number + if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = __include("core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r: Bytes.Reader): number + return if r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC then 1 else 0 +end +end + +do -- music/hvl +local Bytes = __include("core/Bytes") +S["music/hvl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 then 1 else 0 +end +end + +do -- music/it +local Bytes = __include("core/Bytes") +S["music/it"] = function(r: Bytes.Reader): number + return if r:peek(4) == "IMPM" then 1 else 0 +end +end + +do -- music/med +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/midi +local Bytes = __include("core/Bytes") +S["music/midi"] = function(r: Bytes.Reader): number + if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = __include("core/Bytes") +local FIXED: { [string]: number } = { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig: string): number? + local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = tonumber(d) :: number + return if n >= 1 then n else nil + end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = tonumber(dd) :: number + return if n >= 1 and n <= 32 then n else nil + end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = tonumber(t) :: number + return if n >= 1 then n else nil + end + return nil +end +S["music/mod"] = function(r: Bytes.Reader): number + if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = __include("core/Bytes") +S["music/mtm"] = function(r: Bytes.Reader): number + if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = __include("core/Bytes") +S["music/mus"] = function(r: Bytes.Reader): number + return if r:peek(4) == "MUS\x1a" then 1 else 0 +end +end + +do -- music/okt +local Bytes = __include("core/Bytes") +S["music/okt"] = function(r: Bytes.Reader): number + return if r:peek(8) == "OKTASONG" then 1 else 0 +end +end + +do -- music/ptm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/s3m +local Bytes = __include("core/Bytes") +S["music/s3m"] = function(r: Bytes.Reader): number + if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = __include("core/Bytes") +local SoundFont = lazy(function() + return __include("codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r: Bytes.Reader): number + return if SoundFont.sniff(r) then 1 else 0 +end +end + +do -- music/stm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.7 else 0 +end +end + +do -- music/ult +local Bytes = __include("core/Bytes") +S["music/ult"] = function(r: Bytes.Reader): number + local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = __include("core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" +type Header = { version: number, nameCount: number, nameOffset: number, exportCount: number, exportOffset: number, importCount: number, importOffset: number } +local function header(r: Bytes.Reader): Header? + if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd: Header = { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r: Bytes.Reader): number + local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v += (b % 128) * 2 ^ shift + shift += 7 + until b < 0x80 or shift >= 32 + end + return if neg then -v else v +end +local function names(r: Bytes.Reader, h: Header): { string } + local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r: Bytes.Reader): number + local h = header(r) + if not h then + return 0 + end + return if table.find(names(r, h), "music") then 1 else 0.3 +end +end + +do -- music/xm +local Bytes = __include("core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r: Bytes.Reader): number + return if r:peek(17) == MAGIC then 1 else 0 +end +end + +do -- music/xmi +local Bytes = __include("core/Bytes") +S["music/xmi"] = function(r: Bytes.Reader): number + local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return if id == "CAT " and kind == "XMID" then 0.9 else 0 +end +end + +do -- playlist/m3u +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["playlist/m3u"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 512) + s = (string.match(s, "^%s*(.*)$") :: string) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +S["playlist/pls"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return if first and string.lower(Text.trim(first)) == "[playlist]" then 0.95 else 0 +end +end + +do -- playlist/xspf +local Bytes = __include("core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r: Bytes.Reader): number + local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S +end __FILES["Types"] = function() -- Types: the standard value types each category decodes to and encodes from, plus small constructors. Every diff --git a/build/Rosetta.luau.linemap.json b/build/Rosetta.luau.linemap.json index 12987d8..148176c 100644 --- a/build/Rosetta.luau.linemap.json +++ b/build/Rosetta.luau.linemap.json @@ -1,619 +1,620 @@ [ [29, "src/Rosetta/init.luau"], -[913, "src/Rosetta/Registry.luau"], -[3322, "src/Rosetta/Types.luau"], -[4435, "src/Rosetta/archive/7z/init.luau"], -[4820, "src/Rosetta/archive/7z/Header.luau"], -[5347, "src/Rosetta/archive/adf/init.luau"], -[5629, "src/Rosetta/archive/applesingle/init.luau"], -[5815, "src/Rosetta/archive/ar/init.luau"], -[6218, "src/Rosetta/archive/arj/init.luau"], -[6428, "src/Rosetta/archive/binhex/init.luau"], -[6677, "src/Rosetta/archive/br/init.luau"], -[6752, "src/Rosetta/archive/bz2/init.luau"], -[6816, "src/Rosetta/archive/cab/init.luau"], -[7229, "src/Rosetta/archive/cab/Sum.luau"], -[7270, "src/Rosetta/archive/cpio/init.luau"], -[7438, "src/Rosetta/archive/d64/init.luau"], -[7852, "src/Rosetta/archive/fat/init.luau"], -[7974, "src/Rosetta/archive/grp/init.luau"], -[8088, "src/Rosetta/archive/gzip/init.luau"], -[8273, "src/Rosetta/archive/iso/init.luau"], -[8345, "src/Rosetta/archive/lha/init.luau"], -[8770, "src/Rosetta/archive/lz4/init.luau"], -[9114, "src/Rosetta/archive/macbinary/init.luau"], -[9312, "src/Rosetta/archive/mpq/init.luau"], -[9718, "src/Rosetta/archive/mpq/Crypt.luau"], -[9783, "src/Rosetta/archive/pak/init.luau"], -[9917, "src/Rosetta/archive/rpm/init.luau"], -[10241, "src/Rosetta/archive/tar/init.luau"], -[10359, "src/Rosetta/archive/unitypackage/init.luau"], -[10595, "src/Rosetta/archive/uu/init.luau"], -[10865, "src/Rosetta/archive/vpk/init.luau"], -[11176, "src/Rosetta/archive/vswap/init.luau"], -[11446, "src/Rosetta/archive/wad/init.luau"], -[11900, "src/Rosetta/archive/wad/Picture.luau"], -[12002, "src/Rosetta/archive/wad2/init.luau"], -[12284, "src/Rosetta/archive/xz/init.luau"], -[12384, "src/Rosetta/archive/yenc/init.luau"], -[12656, "src/Rosetta/archive/z/init.luau"], -[12752, "src/Rosetta/archive/zip/init.luau"], -[12971, "src/Rosetta/archive/zoo/init.luau"], -[13167, "src/Rosetta/archive/zst/init.luau"], -[13231, "src/Rosetta/audio/aac/init.luau"], -[13444, "src/Rosetta/audio/ac3/init.luau"], -[13591, "src/Rosetta/audio/adpcm/init.luau"], -[13737, "src/Rosetta/audio/adx/init.luau"], -[13969, "src/Rosetta/audio/aiff/init.luau"], -[14361, "src/Rosetta/audio/ape/init.luau"], -[14490, "src/Rosetta/audio/au/init.luau"], -[14652, "src/Rosetta/audio/brstm/init.luau"], -[14944, "src/Rosetta/audio/caf/init.luau"], -[15611, "src/Rosetta/audio/flac/init.luau"], -[15760, "src/Rosetta/audio/flac/Meta.luau"], -[15982, "src/Rosetta/audio/flac/Stream.luau"], -[16352, "src/Rosetta/audio/m4a/init.luau"], -[16695, "src/Rosetta/audio/mp3/init.luau"], -[16956, "src/Rosetta/audio/mp3/Index.luau"], -[17147, "src/Rosetta/audio/mp3/Stream.luau"], -[17374, "src/Rosetta/audio/mp3/Tags.luau"], -[17686, "src/Rosetta/audio/mpc/init.luau"], -[17781, "src/Rosetta/audio/opus/init.luau"], -[18160, "src/Rosetta/audio/opus/Encode.luau"], -[18272, "src/Rosetta/audio/qoa/init.luau"], -[18453, "src/Rosetta/audio/tta/init.luau"], -[18572, "src/Rosetta/audio/vag/init.luau"], -[18796, "src/Rosetta/audio/voc/init.luau"], -[19072, "src/Rosetta/audio/vorbis/init.luau"], -[19527, "src/Rosetta/audio/vorbis/Encode.luau"], -[20340, "src/Rosetta/audio/wav/init.luau"], -[20961, "src/Rosetta/audio/wav/Codecs.luau"], -[21140, "src/Rosetta/audio/wavpack/init.luau"], -[21348, "src/Rosetta/cad/step/init.luau"], -[21730, "src/Rosetta/cad/step/Brep.luau"], -[21965, "src/Rosetta/cad/step/Parse.luau"], -[22522, "src/Rosetta/cad/step/Write.luau"], -[22770, "src/Rosetta/codecs/audio/Aac/init.luau"], -[23178, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[24154, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[24744, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[25811, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[25930, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[27172, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[27664, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[27781, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[28194, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[28530, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[28690, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[29575, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[29677, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[30431, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[30734, "src/Rosetta/codecs/audio/Alac/init.luau"], -[30969, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[31388, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[31800, "src/Rosetta/codecs/audio/Ape/init.luau"], -[32016, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[32777, "src/Rosetta/codecs/audio/ApeTag.luau"], -[32875, "src/Rosetta/codecs/audio/Flac/init.luau"], -[32887, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[33836, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[34456, "src/Rosetta/codecs/audio/Hively/init.luau"], -[34653, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[34903, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[35862, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[36082, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[36302, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[36556, "src/Rosetta/codecs/audio/MidiRender.luau"], -[36903, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[36918, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[36977, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[38635, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[38928, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[39313, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[39954, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[40095, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[40322, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[40668, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[41562, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[41941, "src/Rosetta/codecs/audio/Opus/init.luau"], -[41956, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[43828, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[44893, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[44954, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[45418, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[45769, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[46002, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[48044, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[48418, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[48682, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[48979, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[49261, "src/Rosetta/codecs/audio/Resample/init.luau"], -[49656, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[49711, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[49855, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[50369, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[51168, "src/Rosetta/codecs/audio/Stream.luau"], -[51330, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[51813, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[52092, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[52339, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[52468, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[54457, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[54574, "src/Rosetta/codecs/audio/Tta/init.luau"], -[54692, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[54944, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[54958, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[55342, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[55915, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[56337, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[56377, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[56430, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[56653, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[58108, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[58171, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[58258, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[59234, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[60102, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[60146, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[60659, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[60985, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[61467, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[61915, "src/Rosetta/codecs/compress/Explode.luau"], -[62111, "src/Rosetta/codecs/compress/Lz4.luau"], -[62380, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[62984, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[63524, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[63591, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[64064, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[64240, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[64508, "src/Rosetta/codecs/compress/Lzx.luau"], -[64942, "src/Rosetta/codecs/compress/PackBits.luau"], -[65032, "src/Rosetta/codecs/compress/Quantum.luau"], -[65269, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[65573, "src/Rosetta/codecs/compress/Xxh32.luau"], -[65642, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[65699, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[66683, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[66835, "src/Rosetta/codecs/entropy/Huffman.luau"], -[67122, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[67133, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[67354, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[67598, "src/Rosetta/codecs/font/Bitmap.luau"], -[67799, "src/Rosetta/codecs/font/Cff/init.luau"], -[68440, "src/Rosetta/codecs/font/GlyphNames.luau"], -[68590, "src/Rosetta/codecs/font/TrueType/init.luau"], -[68904, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[69296, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[69798, "src/Rosetta/codecs/image/Bcn/init.luau"], -[69905, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[70389, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[70818, "src/Rosetta/codecs/image/Blend.luau"], -[71197, "src/Rosetta/codecs/image/Dct/init.luau"], -[71692, "src/Rosetta/codecs/image/Etc.luau"], -[71990, "src/Rosetta/codecs/image/Half.luau"], -[72059, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[72413, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[72821, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[73186, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[73951, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[74832, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[75301, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[75379, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[75446, "src/Rosetta/codecs/image/Miptex.luau"], -[75746, "src/Rosetta/codecs/image/Pixels.luau"], -[76066, "src/Rosetta/codecs/image/Quantize/init.luau"], -[76527, "src/Rosetta/codecs/image/Raster.luau"], -[77224, "src/Rosetta/codecs/image/Texel.luau"], -[77597, "src/Rosetta/codecs/image/Texture.luau"], -[77742, "src/Rosetta/codecs/image/Vp8/init.luau"], -[77873, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[79829, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[80092, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[80342, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[80484, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[80588, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[81528, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[82480, "src/Rosetta/codecs/image/Yuv.luau"], -[82785, "src/Rosetta/codecs/model/Brush.luau"], -[83425, "src/Rosetta/codecs/model/Displacement.luau"], -[83574, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[84019, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[84269, "src/Rosetta/codecs/model/Draco/init.luau"], -[84601, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[85070, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[86259, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[86408, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[86767, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[87729, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[88203, "src/Rosetta/codecs/model/Mat4.luau"], -[88462, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[88990, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[89542, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[89621, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[89728, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[89934, "src/Rosetta/codecs/model/Patch.luau"], -[90058, "src/Rosetta/codecs/model/Polygon.luau"], -[90292, "src/Rosetta/codecs/model/Rbx/init.luau"], -[90529, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[91283, "src/Rosetta/codecs/model/Rig.luau"], -[91526, "src/Rosetta/codecs/model/Sampler.luau"], -[91686, "src/Rosetta/codecs/model/SourceAnim.luau"], -[91907, "src/Rosetta/codecs/model/Vrml/init.luau"], -[92055, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[92629, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[92792, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[93541, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[94063, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[94790, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[95022, "src/Rosetta/codecs/text/GodotVariant.luau"], -[95681, "src/Rosetta/codecs/text/Json/init.luau"], -[95950, "src/Rosetta/codecs/text/Json/Decode.luau"], -[96385, "src/Rosetta/codecs/text/Json/Encode.luau"], -[96730, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[97300, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[97606, "src/Rosetta/codecs/text/Lexer/init.luau"], -[97738, "src/Rosetta/codecs/text/Nbt/init.luau"], -[98091, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[98783, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[99423, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[99661, "src/Rosetta/codecs/text/Text/init.luau"], -[99752, "src/Rosetta/codecs/text/Url/init.luau"], -[99957, "src/Rosetta/codecs/text/Xml/init.luau"], -[100407, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[101211, "src/Rosetta/codecs/video/Dsp.luau"], -[102049, "src/Rosetta/codecs/video/H263/init.luau"], -[102206, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[103064, "src/Rosetta/codecs/video/H263/Tables.luau"], -[103268, "src/Rosetta/codecs/video/H264/init.luau"], -[103642, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[103917, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[105048, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[105816, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[106078, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[107088, "src/Rosetta/codecs/video/H264/Inter.luau"], -[107414, "src/Rosetta/codecs/video/H264/Intra.luau"], -[107821, "src/Rosetta/codecs/video/H264/Mb.luau"], -[108760, "src/Rosetta/codecs/video/H264/Params.luau"], -[109208, "src/Rosetta/codecs/video/H264/Slice.luau"], -[109460, "src/Rosetta/codecs/video/H264/Tables.luau"], -[109502, "src/Rosetta/codecs/video/H264/Transform.luau"], -[109667, "src/Rosetta/codecs/video/Legacy/init.luau"], -[109866, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[110163, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[110530, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[110648, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[110756, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[111029, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[111424, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[111601, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[111614, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[111982, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[113509, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[113649, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[113788, "src/Rosetta/codecs/video/Theora/init.luau"], -[114052, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[115316, "src/Rosetta/codecs/video/Theora/Header.luau"], -[115680, "src/Rosetta/codecs/video/Video/init.luau"], -[116238, "src/Rosetta/codecs/video/Video/Source.luau"], -[116524, "src/Rosetta/containers/Archive.luau"], -[116791, "src/Rosetta/containers/AudioWrap.luau"], -[117301, "src/Rosetta/containers/Avi/init.luau"], -[117854, "src/Rosetta/containers/Blend.luau"], -[118593, "src/Rosetta/containers/Chunks.luau"], -[118728, "src/Rosetta/containers/Cpio.luau"], -[119156, "src/Rosetta/containers/Demux.luau"], -[119431, "src/Rosetta/containers/Ebml/init.luau"], -[119745, "src/Rosetta/containers/Fat.luau"], -[120433, "src/Rosetta/containers/Iso9660.luau"], -[120938, "src/Rosetta/containers/IsoBmff/init.luau"], -[121109, "src/Rosetta/containers/IsoBmff/Box.luau"], -[121298, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[122144, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[122666, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[123183, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[123301, "src/Rosetta/containers/MacFile.luau"], -[123450, "src/Rosetta/containers/MpegEs.luau"], -[123617, "src/Rosetta/containers/MpegPs/init.luau"], -[123838, "src/Rosetta/containers/MpegTs/init.luau"], -[124631, "src/Rosetta/containers/Ogg/init.luau"], -[125056, "src/Rosetta/containers/Ogg/Mux.luau"], -[125245, "src/Rosetta/containers/Ogg/Page.luau"], -[125411, "src/Rosetta/containers/Riff/init.luau"], -[125728, "src/Rosetta/containers/Tar.luau"], -[126142, "src/Rosetta/containers/Zip/init.luau"], -[126774, "src/Rosetta/core/Adler32.luau"], -[126834, "src/Rosetta/core/Base64.luau"], -[127062, "src/Rosetta/core/Bits.luau"], -[127355, "src/Rosetta/core/Bytes.luau"], -[127882, "src/Rosetta/core/Crc16.luau"], -[127934, "src/Rosetta/core/Crc32.luau"], -[128085, "src/Rosetta/core/Err.luau"], -[128167, "src/Rosetta/core/Input.luau"], -[128243, "src/Rosetta/core/Md5.luau"], -[128401, "src/Rosetta/core/Sniff.luau"], -[128430, "src/Rosetta/data/cbor/init.luau"], -[128529, "src/Rosetta/data/cbor/Codec.luau"], -[129098, "src/Rosetta/data/csv/init.luau"], -[129410, "src/Rosetta/data/ini/init.luau"], -[129656, "src/Rosetta/data/json/init.luau"], -[129748, "src/Rosetta/data/msgpack/init.luau"], -[129837, "src/Rosetta/data/msgpack/Codec.luau"], -[130279, "src/Rosetta/data/nbt/init.luau"], -[130338, "src/Rosetta/data/plist/init.luau"], -[130644, "src/Rosetta/data/plist/Binary.luau"], -[130911, "src/Rosetta/data/q3shader/init.luau"], -[131150, "src/Rosetta/data/q3skin/init.luau"], -[131246, "src/Rosetta/data/snbt/init.luau"], -[131309, "src/Rosetta/data/toml/init.luau"], -[131376, "src/Rosetta/data/toml/Decode.luau"], -[132004, "src/Rosetta/data/toml/Encode.luau"], -[132213, "src/Rosetta/data/tres/init.luau"], -[132358, "src/Rosetta/data/vdf/init.luau"], -[132459, "src/Rosetta/data/xml/init.luau"], -[132515, "src/Rosetta/data/yaml/init.luau"], -[132588, "src/Rosetta/data/yaml/Emit.luau"], -[132878, "src/Rosetta/data/yaml/Parse.luau"], -[134171, "src/Rosetta/font/bdf/init.luau"], -[134460, "src/Rosetta/font/bmfont/init.luau"], -[134887, "src/Rosetta/font/bmfont/Parse.luau"], -[135340, "src/Rosetta/font/eot/init.luau"], -[135572, "src/Rosetta/font/fon/init.luau"], -[135855, "src/Rosetta/font/hershey/init.luau"], -[136050, "src/Rosetta/font/pcf/init.luau"], -[136330, "src/Rosetta/font/psf/init.luau"], -[136650, "src/Rosetta/font/ttf/init.luau"], -[136701, "src/Rosetta/font/type1/init.luau"], -[137060, "src/Rosetta/font/type1/Charstring.luau"], -[137338, "src/Rosetta/font/woff/init.luau"], -[137470, "src/Rosetta/font/woff2/init.luau"], -[137527, "src/Rosetta/font/woff2/Rebuild.luau"], -[138067, "src/Rosetta/host/init.luau"], -[138112, "src/Rosetta/host/Love.luau"], -[138255, "src/Rosetta/host/LuaJIT.luau"], -[138305, "src/Rosetta/host/Luau.luau"], -[138328, "src/Rosetta/host/Roblox.luau"], -[138687, "src/Rosetta/image/ani/init.luau"], -[138867, "src/Rosetta/image/art/init.luau"], -[139355, "src/Rosetta/image/blp/init.luau"], -[139613, "src/Rosetta/image/bmp/init.luau"], -[140028, "src/Rosetta/image/dds/init.luau"], -[140511, "src/Rosetta/image/exr/init.luau"], -[141271, "src/Rosetta/image/exr/Codec.luau"], -[141382, "src/Rosetta/image/exr/Piz.luau"], -[141739, "src/Rosetta/image/gif/init.luau"], -[142255, "src/Rosetta/image/gif/Decode.luau"], -[142331, "src/Rosetta/image/hdr/init.luau"], -[142560, "src/Rosetta/image/hdr/Codec.luau"], -[142771, "src/Rosetta/image/icns/init.luau"], -[143102, "src/Rosetta/image/ico/init.luau"], -[143379, "src/Rosetta/image/ico/Dib.luau"], -[143474, "src/Rosetta/image/ilbm/init.luau"], -[143793, "src/Rosetta/image/jpeg/init.luau"], -[143929, "src/Rosetta/image/ktx/init.luau"], -[144589, "src/Rosetta/image/lmp/init.luau"], -[144722, "src/Rosetta/image/pcx/init.luau"], -[144986, "src/Rosetta/image/png/init.luau"], -[145566, "src/Rosetta/image/png/Apng.luau"], -[145646, "src/Rosetta/image/png/Decode.luau"], -[146019, "src/Rosetta/image/png/Encode.luau"], -[146222, "src/Rosetta/image/pnm/init.luau"], -[146600, "src/Rosetta/image/pnm/Codec.luau"], -[146877, "src/Rosetta/image/qoi/init.luau"], -[146999, "src/Rosetta/image/qoi/Codec.luau"], -[147156, "src/Rosetta/image/sgi/init.luau"], -[147441, "src/Rosetta/image/spr/init.luau"], -[147754, "src/Rosetta/image/sunras/init.luau"], -[148000, "src/Rosetta/image/tga/init.luau"], -[148270, "src/Rosetta/image/tga/Codec.luau"], -[148470, "src/Rosetta/image/tiff/init.luau"], -[149297, "src/Rosetta/image/tiff/Pixels.luau"], -[149687, "src/Rosetta/image/tim/init.luau"], -[149929, "src/Rosetta/image/vtf/init.luau"], -[150164, "src/Rosetta/image/webp/init.luau"], -[150774, "src/Rosetta/image/webp/Alpha.luau"], -[150850, "src/Rosetta/image/webp/Anim.luau"], -[151005, "src/Rosetta/image/xbm/init.luau"], -[151166, "src/Rosetta/image/xpm/init.luau"], -[151434, "src/Rosetta/image/xpm/Names.luau"], -[151490, "src/Rosetta/layered/aseprite/init.luau"], -[152228, "src/Rosetta/layered/ora/init.luau"], -[152515, "src/Rosetta/layered/psd/init.luau"], -[153250, "src/Rosetta/layered/psd/Channels.luau"], -[153602, "src/Rosetta/model/3ds/init.luau"], -[153685, "src/Rosetta/model/3ds/Build.luau"], -[154332, "src/Rosetta/model/3ds/Read.luau"], -[154828, "src/Rosetta/model/3ds/Write.luau"], -[155633, "src/Rosetta/model/3mf/init.luau"], -[155715, "src/Rosetta/model/3mf/Read.luau"], -[156303, "src/Rosetta/model/3mf/Write.luau"], -[156708, "src/Rosetta/model/ase/init.luau"], -[156831, "src/Rosetta/model/ase/Build.luau"], -[157405, "src/Rosetta/model/ase/Parse.luau"], -[157474, "src/Rosetta/model/ase/Write.luau"], -[157937, "src/Rosetta/model/b3d/init.luau"], -[157992, "src/Rosetta/model/b3d/Read.luau"], -[158563, "src/Rosetta/model/blend/init.luau"], -[158661, "src/Rosetta/model/blend/Anim.luau"], -[159007, "src/Rosetta/model/blend/Armature.luau"], -[159414, "src/Rosetta/model/blend/Material.luau"], -[159766, "src/Rosetta/model/blend/Mesh.luau"], -[160454, "src/Rosetta/model/blend/Normals.luau"], -[160615, "src/Rosetta/model/blend/Prim.luau"], -[161122, "src/Rosetta/model/blend/Read.luau"], -[162161, "src/Rosetta/model/bsp/init.luau"], -[162352, "src/Rosetta/model/bsp/Lightmap.luau"], -[162418, "src/Rosetta/model/bsp/Quake.luau"], -[162807, "src/Rosetta/model/bsp/Quake3.luau"], -[163036, "src/Rosetta/model/bsp/Tree.luau"], -[163424, "src/Rosetta/model/buildmap/init.luau"], -[163696, "src/Rosetta/model/buildmap/Geometry.luau"], -[164099, "src/Rosetta/model/d3map/init.luau"], -[164381, "src/Rosetta/model/d3map/Parse.luau"], -[164579, "src/Rosetta/model/dae/init.luau"], -[164768, "src/Rosetta/model/dae/Math.luau"], -[164815, "src/Rosetta/model/dae/Read.luau"], -[166665, "src/Rosetta/model/dae/Write.luau"], -[167034, "src/Rosetta/model/fbx/init.luau"], -[167182, "src/Rosetta/model/fbx/Ascii.luau"], -[167452, "src/Rosetta/model/fbx/Binary.luau"], -[167907, "src/Rosetta/model/fbx/Read.luau"], -[169269, "src/Rosetta/model/fbx/Write.luau"], -[170254, "src/Rosetta/model/fbx/Xform.luau"], -[170295, "src/Rosetta/model/gltf/init.luau"], -[170532, "src/Rosetta/model/gltf/Pack.luau"], -[170601, "src/Rosetta/model/gltf/Read.luau"], -[171342, "src/Rosetta/model/gltf/Write.luau"], -[172028, "src/Rosetta/model/godot/init.luau"], -[172119, "src/Rosetta/model/godot/Build.luau"], -[172661, "src/Rosetta/model/godot/Primitives.luau"], -[172936, "src/Rosetta/model/godot/Surface.luau"], -[173421, "src/Rosetta/model/godot/Write.luau"], -[173750, "src/Rosetta/model/iqm/init.luau"], -[173826, "src/Rosetta/model/iqm/Read.luau"], -[174181, "src/Rosetta/model/iqm/Write.luau"], -[174868, "src/Rosetta/model/ldraw/init.luau"], -[174946, "src/Rosetta/model/ldraw/Colors.luau"], -[175264, "src/Rosetta/model/ldraw/Read.luau"], -[175841, "src/Rosetta/model/lwo/init.luau"], -[175917, "src/Rosetta/model/lwo/Build.luau"], -[176379, "src/Rosetta/model/lwo/Parse.luau"], -[176922, "src/Rosetta/model/map/init.luau"], -[177239, "src/Rosetta/model/map/Build.luau"], -[177483, "src/Rosetta/model/map/Parse.luau"], -[177868, "src/Rosetta/model/map/Write.luau"], -[178014, "src/Rosetta/model/mca/init.luau"], -[178356, "src/Rosetta/model/mca/Chunk.luau"], -[178489, "src/Rosetta/model/mca/Lz4Block.luau"], -[178559, "src/Rosetta/model/md2/init.luau"], -[178758, "src/Rosetta/model/md3/init.luau"], -[178986, "src/Rosetta/model/md5/init.luau"], -[179067, "src/Rosetta/model/md5/Read.luau"], -[179500, "src/Rosetta/model/mdl/init.luau"], -[179582, "src/Rosetta/model/mdl/HalfLife.luau"], -[179886, "src/Rosetta/model/mdl/Quake.luau"], -[180104, "src/Rosetta/model/ms3d/init.luau"], -[180176, "src/Rosetta/model/ms3d/Read.luau"], -[180622, "src/Rosetta/model/ms3d/Write.luau"], -[181091, "src/Rosetta/model/obj/init.luau"], -[181909, "src/Rosetta/model/obj/Mtl.luau"], -[182197, "src/Rosetta/model/off/init.luau"], -[182659, "src/Rosetta/model/ply/init.luau"], -[183764, "src/Rosetta/model/ply/Binary.luau"], -[183965, "src/Rosetta/model/pmx/init.luau"], -[184034, "src/Rosetta/model/pmx/Build.luau"], -[184330, "src/Rosetta/model/pmx/Pmd.luau"], -[184665, "src/Rosetta/model/pmx/Read.luau"], -[185069, "src/Rosetta/model/proc/init.luau"], -[185451, "src/Rosetta/model/qb/init.luau"], -[185844, "src/Rosetta/model/rbxm/init.luau"], -[186437, "src/Rosetta/model/rbxmx/init.luau"], -[187113, "src/Rosetta/model/robloxmesh/init.luau"], -[187772, "src/Rosetta/model/robloxmesh/Parse.luau"], -[188229, "src/Rosetta/model/robloxmesh/Write.luau"], -[188338, "src/Rosetta/model/schematic/init.luau"], -[188659, "src/Rosetta/model/schematic/Common.luau"], -[188779, "src/Rosetta/model/schematic/Litematic.luau"], -[188990, "src/Rosetta/model/schematic/Mcedit.luau"], -[189234, "src/Rosetta/model/schematic/Sponge.luau"], -[189363, "src/Rosetta/model/smd/init.luau"], -[189430, "src/Rosetta/model/smd/Read.luau"], -[189699, "src/Rosetta/model/smd/Write.luau"], -[189942, "src/Rosetta/model/sourcemdl/init.luau"], -[190113, "src/Rosetta/model/sourcemdl/Build.luau"], -[190543, "src/Rosetta/model/sourcemdl/Material.luau"], -[190704, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[191231, "src/Rosetta/model/sourcemdl/Phy.luau"], -[191354, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[191536, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[191630, "src/Rosetta/model/stl/init.luau"], -[192080, "src/Rosetta/model/stl/Decode.luau"], -[192154, "src/Rosetta/model/t3d/init.luau"], -[192248, "src/Rosetta/model/t3d/Build.luau"], -[192653, "src/Rosetta/model/t3d/Parse.luau"], -[192821, "src/Rosetta/model/udmf/init.luau"], -[192904, "src/Rosetta/model/usda/init.luau"], -[193113, "src/Rosetta/model/usda/Build.luau"], -[194391, "src/Rosetta/model/usda/Parse.luau"], -[195189, "src/Rosetta/model/usda/Write.luau"], -[196006, "src/Rosetta/model/vbsp/init.luau"], -[196452, "src/Rosetta/model/vbsp/Faces.luau"], -[196676, "src/Rosetta/model/vbsp/Props.luau"], -[196768, "src/Rosetta/model/vmf/init.luau"], -[197093, "src/Rosetta/model/vmf/Build.luau"], -[197517, "src/Rosetta/model/vox/init.luau"], -[198403, "src/Rosetta/model/vox/Grid.luau"], -[198460, "src/Rosetta/model/vrml/init.luau"], -[198526, "src/Rosetta/model/x/init.luau"], -[198656, "src/Rosetta/model/x/Build.luau"], -[199219, "src/Rosetta/model/x/Parse.luau"], -[199516, "src/Rosetta/model/x3d/init.luau"], -[199594, "src/Rosetta/music/669/init.luau"], -[199801, "src/Rosetta/music/ahx/init.luau"], -[199853, "src/Rosetta/music/far/init.luau"], -[200083, "src/Rosetta/music/hmp/init.luau"], -[200348, "src/Rosetta/music/hvl/init.luau"], -[200400, "src/Rosetta/music/it/init.luau"], -[200819, "src/Rosetta/music/it/Itsex.luau"], -[200936, "src/Rosetta/music/med/init.luau"], -[201584, "src/Rosetta/music/midi/init.luau"], -[201728, "src/Rosetta/music/midi/Smf.luau"], -[202140, "src/Rosetta/music/mod/init.luau"], -[202494, "src/Rosetta/music/mtm/init.luau"], -[202717, "src/Rosetta/music/mus/init.luau"], -[202875, "src/Rosetta/music/okt/init.luau"], -[203157, "src/Rosetta/music/ptm/init.luau"], -[203380, "src/Rosetta/music/s3m/init.luau"], -[203617, "src/Rosetta/music/sf2/init.luau"], -[203661, "src/Rosetta/music/stm/init.luau"], -[203893, "src/Rosetta/music/ult/init.luau"], -[204198, "src/Rosetta/music/umx/init.luau"], -[204415, "src/Rosetta/music/xm/init.luau"], -[204977, "src/Rosetta/music/xmi/init.luau"], -[205186, "src/Rosetta/ops/AudioOps.luau"], -[205665, "src/Rosetta/ops/ImageOps/init.luau"], -[206313, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[206953, "src/Rosetta/ops/LayerOps.luau"], -[207046, "src/Rosetta/ops/MeshOps/init.luau"], -[208186, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[208353, "src/Rosetta/ops/MusicOps.luau"], -[208702, "src/Rosetta/playlist/m3u/init.luau"], -[209055, "src/Rosetta/playlist/pls/init.luau"], -[209233, "src/Rosetta/playlist/xspf/init.luau"], -[209436, "src/Rosetta/subtitle/ass/init.luau"], -[209880, "src/Rosetta/subtitle/srt/init.luau"], -[210053, "src/Rosetta/subtitle/vtt/init.luau"], -[210256, "src/Rosetta/vector/gamemaps/init.luau"], -[210443, "src/Rosetta/vector/gamemaps/Expand.luau"], -[210540, "src/Rosetta/vector/ldtk/init.luau"], -[210632, "src/Rosetta/vector/ldtk/Read.luau"], -[210968, "src/Rosetta/vector/ldtk/Write.luau"], -[211616, "src/Rosetta/vector/ogmo/init.luau"], -[211735, "src/Rosetta/vector/ogmo/Read.luau"], -[212140, "src/Rosetta/vector/ogmo/Write.luau"], -[212494, "src/Rosetta/vector/svg/init.luau"], -[212580, "src/Rosetta/vector/svg/Parse.luau"], -[213326, "src/Rosetta/vector/svg/PathData.luau"], -[213694, "src/Rosetta/vector/svg/Render.luau"], -[214111, "src/Rosetta/vector/svg/Style.luau"], -[214483, "src/Rosetta/vector/svg/Write.luau"], -[214683, "src/Rosetta/vector/tiled/init.luau"], -[214863, "src/Rosetta/vector/tiled/Data.luau"], -[215014, "src/Rosetta/vector/tiled/Tmj.luau"], -[215645, "src/Rosetta/vector/tiled/Tmx.luau"], -[216257, "src/Rosetta/video/avi/init.luau"], -[216551, "src/Rosetta/video/fli/init.luau"], -[216702, "src/Rosetta/video/flv/init.luau"], -[217086, "src/Rosetta/video/flv/Amf.luau"], -[217244, "src/Rosetta/video/flv/Mux.luau"], -[217525, "src/Rosetta/video/h264/init.luau"], -[217664, "src/Rosetta/video/mkv/init.luau"], -[217820, "src/Rosetta/video/mkv/Mux.luau"], -[218099, "src/Rosetta/video/mkv/Parse.luau"], -[218820, "src/Rosetta/video/mp4/init.luau"], -[219148, "src/Rosetta/video/mpegps/init.luau"], -[219335, "src/Rosetta/video/mpegts/init.luau"], -[219581, "src/Rosetta/video/ogv/init.luau"], -[219976, "src/Rosetta/video/smk/init.luau"], -[220285, "src/Rosetta/video/smk/Audio.luau"], -[220405, "src/Rosetta/video/y4m/init.luau"] +[946, "src/Rosetta/Registry.luau"], +[3563, "src/Rosetta/Sniffs.luau"], +[6949, "src/Rosetta/Types.luau"], +[8062, "src/Rosetta/archive/7z/init.luau"], +[8447, "src/Rosetta/archive/7z/Header.luau"], +[8974, "src/Rosetta/archive/adf/init.luau"], +[9256, "src/Rosetta/archive/applesingle/init.luau"], +[9442, "src/Rosetta/archive/ar/init.luau"], +[9845, "src/Rosetta/archive/arj/init.luau"], +[10055, "src/Rosetta/archive/binhex/init.luau"], +[10304, "src/Rosetta/archive/br/init.luau"], +[10379, "src/Rosetta/archive/bz2/init.luau"], +[10443, "src/Rosetta/archive/cab/init.luau"], +[10856, "src/Rosetta/archive/cab/Sum.luau"], +[10897, "src/Rosetta/archive/cpio/init.luau"], +[11065, "src/Rosetta/archive/d64/init.luau"], +[11479, "src/Rosetta/archive/fat/init.luau"], +[11601, "src/Rosetta/archive/grp/init.luau"], +[11715, "src/Rosetta/archive/gzip/init.luau"], +[11900, "src/Rosetta/archive/iso/init.luau"], +[11972, "src/Rosetta/archive/lha/init.luau"], +[12397, "src/Rosetta/archive/lz4/init.luau"], +[12741, "src/Rosetta/archive/macbinary/init.luau"], +[12939, "src/Rosetta/archive/mpq/init.luau"], +[13345, "src/Rosetta/archive/mpq/Crypt.luau"], +[13410, "src/Rosetta/archive/pak/init.luau"], +[13544, "src/Rosetta/archive/rpm/init.luau"], +[13868, "src/Rosetta/archive/tar/init.luau"], +[13986, "src/Rosetta/archive/unitypackage/init.luau"], +[14222, "src/Rosetta/archive/uu/init.luau"], +[14492, "src/Rosetta/archive/vpk/init.luau"], +[14803, "src/Rosetta/archive/vswap/init.luau"], +[15073, "src/Rosetta/archive/wad/init.luau"], +[15527, "src/Rosetta/archive/wad/Picture.luau"], +[15629, "src/Rosetta/archive/wad2/init.luau"], +[15911, "src/Rosetta/archive/xz/init.luau"], +[16011, "src/Rosetta/archive/yenc/init.luau"], +[16283, "src/Rosetta/archive/z/init.luau"], +[16379, "src/Rosetta/archive/zip/init.luau"], +[16598, "src/Rosetta/archive/zoo/init.luau"], +[16794, "src/Rosetta/archive/zst/init.luau"], +[16858, "src/Rosetta/audio/aac/init.luau"], +[17071, "src/Rosetta/audio/ac3/init.luau"], +[17218, "src/Rosetta/audio/adpcm/init.luau"], +[17364, "src/Rosetta/audio/adx/init.luau"], +[17596, "src/Rosetta/audio/aiff/init.luau"], +[17988, "src/Rosetta/audio/ape/init.luau"], +[18117, "src/Rosetta/audio/au/init.luau"], +[18279, "src/Rosetta/audio/brstm/init.luau"], +[18571, "src/Rosetta/audio/caf/init.luau"], +[19238, "src/Rosetta/audio/flac/init.luau"], +[19387, "src/Rosetta/audio/flac/Meta.luau"], +[19609, "src/Rosetta/audio/flac/Stream.luau"], +[19979, "src/Rosetta/audio/m4a/init.luau"], +[20322, "src/Rosetta/audio/mp3/init.luau"], +[20583, "src/Rosetta/audio/mp3/Index.luau"], +[20774, "src/Rosetta/audio/mp3/Stream.luau"], +[21001, "src/Rosetta/audio/mp3/Tags.luau"], +[21313, "src/Rosetta/audio/mpc/init.luau"], +[21408, "src/Rosetta/audio/opus/init.luau"], +[21787, "src/Rosetta/audio/opus/Encode.luau"], +[21899, "src/Rosetta/audio/qoa/init.luau"], +[22080, "src/Rosetta/audio/tta/init.luau"], +[22199, "src/Rosetta/audio/vag/init.luau"], +[22423, "src/Rosetta/audio/voc/init.luau"], +[22699, "src/Rosetta/audio/vorbis/init.luau"], +[23154, "src/Rosetta/audio/vorbis/Encode.luau"], +[23967, "src/Rosetta/audio/wav/init.luau"], +[24588, "src/Rosetta/audio/wav/Codecs.luau"], +[24767, "src/Rosetta/audio/wavpack/init.luau"], +[24975, "src/Rosetta/cad/step/init.luau"], +[25357, "src/Rosetta/cad/step/Brep.luau"], +[25592, "src/Rosetta/cad/step/Parse.luau"], +[26149, "src/Rosetta/cad/step/Write.luau"], +[26397, "src/Rosetta/codecs/audio/Aac/init.luau"], +[26805, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[27781, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[28371, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[29438, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[29557, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[30799, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[31291, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[31408, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[31821, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[32157, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[32317, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[33202, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[33304, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34058, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[34361, "src/Rosetta/codecs/audio/Alac/init.luau"], +[34596, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35015, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[35427, "src/Rosetta/codecs/audio/Ape/init.luau"], +[35643, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[36404, "src/Rosetta/codecs/audio/ApeTag.luau"], +[36502, "src/Rosetta/codecs/audio/Flac/init.luau"], +[36514, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[37463, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38083, "src/Rosetta/codecs/audio/Hively/init.luau"], +[38280, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[38530, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[39489, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[39709, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[39929, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[40183, "src/Rosetta/codecs/audio/MidiRender.luau"], +[40530, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[40545, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[40604, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[42262, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[42555, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[42940, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[43581, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[43722, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[43949, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[44295, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[45189, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[45568, "src/Rosetta/codecs/audio/Opus/init.luau"], +[45583, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[47455, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[48520, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[48581, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49045, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[49396, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[49629, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[51671, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52045, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[52309, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[52606, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[52888, "src/Rosetta/codecs/audio/Resample/init.luau"], +[53283, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[53338, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[53482, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[53996, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[54795, "src/Rosetta/codecs/audio/Stream.luau"], +[54957, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[55440, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[55719, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[55966, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56095, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58084, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[58201, "src/Rosetta/codecs/audio/Tta/init.luau"], +[58319, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[58571, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[58585, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[58969, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[59542, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[59964, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60004, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60057, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[60280, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[61735, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[61798, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[61885, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[62861, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[63729, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[63773, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[64286, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[64612, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[65094, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[65542, "src/Rosetta/codecs/compress/Explode.luau"], +[65738, "src/Rosetta/codecs/compress/Lz4.luau"], +[66007, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[66611, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[67151, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[67218, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[67691, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[67867, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[68135, "src/Rosetta/codecs/compress/Lzx.luau"], +[68569, "src/Rosetta/codecs/compress/PackBits.luau"], +[68659, "src/Rosetta/codecs/compress/Quantum.luau"], +[68896, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[69200, "src/Rosetta/codecs/compress/Xxh32.luau"], +[69269, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[69326, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[70310, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[70462, "src/Rosetta/codecs/entropy/Huffman.luau"], +[70749, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[70760, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[70981, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[71225, "src/Rosetta/codecs/font/Bitmap.luau"], +[71426, "src/Rosetta/codecs/font/Cff/init.luau"], +[72067, "src/Rosetta/codecs/font/GlyphNames.luau"], +[72217, "src/Rosetta/codecs/font/TrueType/init.luau"], +[72531, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[72923, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[73425, "src/Rosetta/codecs/image/Bcn/init.luau"], +[73532, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[74016, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[74445, "src/Rosetta/codecs/image/Blend.luau"], +[74824, "src/Rosetta/codecs/image/Dct/init.luau"], +[75319, "src/Rosetta/codecs/image/Etc.luau"], +[75617, "src/Rosetta/codecs/image/Half.luau"], +[75686, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[76040, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[76448, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[76813, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[77578, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[78459, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[78928, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[79006, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[79073, "src/Rosetta/codecs/image/Miptex.luau"], +[79373, "src/Rosetta/codecs/image/Pixels.luau"], +[79693, "src/Rosetta/codecs/image/Quantize/init.luau"], +[80154, "src/Rosetta/codecs/image/Raster.luau"], +[80851, "src/Rosetta/codecs/image/Texel.luau"], +[81224, "src/Rosetta/codecs/image/Texture.luau"], +[81369, "src/Rosetta/codecs/image/Vp8/init.luau"], +[81500, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[83456, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[83719, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[83969, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[84111, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[84215, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[85155, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[86107, "src/Rosetta/codecs/image/Yuv.luau"], +[86412, "src/Rosetta/codecs/model/Brush.luau"], +[87052, "src/Rosetta/codecs/model/Displacement.luau"], +[87201, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[87646, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[87896, "src/Rosetta/codecs/model/Draco/init.luau"], +[88228, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[88697, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[89886, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[90035, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[90394, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[91356, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[91830, "src/Rosetta/codecs/model/Mat4.luau"], +[92089, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[92617, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[93169, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[93248, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[93355, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[93561, "src/Rosetta/codecs/model/Patch.luau"], +[93685, "src/Rosetta/codecs/model/Polygon.luau"], +[93919, "src/Rosetta/codecs/model/Rbx/init.luau"], +[94156, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[94910, "src/Rosetta/codecs/model/Rig.luau"], +[95153, "src/Rosetta/codecs/model/Sampler.luau"], +[95313, "src/Rosetta/codecs/model/SourceAnim.luau"], +[95534, "src/Rosetta/codecs/model/Vrml/init.luau"], +[95682, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[96256, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[96419, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[97168, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[97690, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[98417, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[98649, "src/Rosetta/codecs/text/GodotVariant.luau"], +[99308, "src/Rosetta/codecs/text/Json/init.luau"], +[99577, "src/Rosetta/codecs/text/Json/Decode.luau"], +[100012, "src/Rosetta/codecs/text/Json/Encode.luau"], +[100357, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[100927, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[101233, "src/Rosetta/codecs/text/Lexer/init.luau"], +[101365, "src/Rosetta/codecs/text/Nbt/init.luau"], +[101718, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[102410, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[103050, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[103288, "src/Rosetta/codecs/text/Text/init.luau"], +[103379, "src/Rosetta/codecs/text/Url/init.luau"], +[103584, "src/Rosetta/codecs/text/Xml/init.luau"], +[104034, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[104838, "src/Rosetta/codecs/video/Dsp.luau"], +[105676, "src/Rosetta/codecs/video/H263/init.luau"], +[105833, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[106691, "src/Rosetta/codecs/video/H263/Tables.luau"], +[106895, "src/Rosetta/codecs/video/H264/init.luau"], +[107269, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[107544, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[108675, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[109443, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[109705, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[110715, "src/Rosetta/codecs/video/H264/Inter.luau"], +[111041, "src/Rosetta/codecs/video/H264/Intra.luau"], +[111448, "src/Rosetta/codecs/video/H264/Mb.luau"], +[112387, "src/Rosetta/codecs/video/H264/Params.luau"], +[112835, "src/Rosetta/codecs/video/H264/Slice.luau"], +[113087, "src/Rosetta/codecs/video/H264/Tables.luau"], +[113129, "src/Rosetta/codecs/video/H264/Transform.luau"], +[113294, "src/Rosetta/codecs/video/Legacy/init.luau"], +[113493, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[113790, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[114157, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[114275, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[114383, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[114656, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[115051, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[115228, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[115241, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[115609, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[117136, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[117276, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[117415, "src/Rosetta/codecs/video/Theora/init.luau"], +[117679, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[118943, "src/Rosetta/codecs/video/Theora/Header.luau"], +[119307, "src/Rosetta/codecs/video/Video/init.luau"], +[119865, "src/Rosetta/codecs/video/Video/Source.luau"], +[120151, "src/Rosetta/containers/Archive.luau"], +[120418, "src/Rosetta/containers/AudioWrap.luau"], +[120928, "src/Rosetta/containers/Avi/init.luau"], +[121481, "src/Rosetta/containers/Blend.luau"], +[122220, "src/Rosetta/containers/Chunks.luau"], +[122355, "src/Rosetta/containers/Cpio.luau"], +[122783, "src/Rosetta/containers/Demux.luau"], +[123058, "src/Rosetta/containers/Ebml/init.luau"], +[123372, "src/Rosetta/containers/Fat.luau"], +[124060, "src/Rosetta/containers/Iso9660.luau"], +[124565, "src/Rosetta/containers/IsoBmff/init.luau"], +[124736, "src/Rosetta/containers/IsoBmff/Box.luau"], +[124925, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[125771, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[126293, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[126810, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[126928, "src/Rosetta/containers/MacFile.luau"], +[127077, "src/Rosetta/containers/MpegEs.luau"], +[127244, "src/Rosetta/containers/MpegPs/init.luau"], +[127465, "src/Rosetta/containers/MpegTs/init.luau"], +[128258, "src/Rosetta/containers/Ogg/init.luau"], +[128683, "src/Rosetta/containers/Ogg/Mux.luau"], +[128872, "src/Rosetta/containers/Ogg/Page.luau"], +[129038, "src/Rosetta/containers/Riff/init.luau"], +[129355, "src/Rosetta/containers/Tar.luau"], +[129769, "src/Rosetta/containers/Zip/init.luau"], +[130401, "src/Rosetta/core/Adler32.luau"], +[130461, "src/Rosetta/core/Base64.luau"], +[130689, "src/Rosetta/core/Bits.luau"], +[130982, "src/Rosetta/core/Bytes.luau"], +[131509, "src/Rosetta/core/Crc16.luau"], +[131561, "src/Rosetta/core/Crc32.luau"], +[131712, "src/Rosetta/core/Err.luau"], +[131794, "src/Rosetta/core/Input.luau"], +[131870, "src/Rosetta/core/Md5.luau"], +[132028, "src/Rosetta/core/Sniff.luau"], +[132057, "src/Rosetta/data/cbor/init.luau"], +[132156, "src/Rosetta/data/cbor/Codec.luau"], +[132725, "src/Rosetta/data/csv/init.luau"], +[133037, "src/Rosetta/data/ini/init.luau"], +[133283, "src/Rosetta/data/json/init.luau"], +[133375, "src/Rosetta/data/msgpack/init.luau"], +[133464, "src/Rosetta/data/msgpack/Codec.luau"], +[133906, "src/Rosetta/data/nbt/init.luau"], +[133965, "src/Rosetta/data/plist/init.luau"], +[134271, "src/Rosetta/data/plist/Binary.luau"], +[134538, "src/Rosetta/data/q3shader/init.luau"], +[134777, "src/Rosetta/data/q3skin/init.luau"], +[134873, "src/Rosetta/data/snbt/init.luau"], +[134936, "src/Rosetta/data/toml/init.luau"], +[135003, "src/Rosetta/data/toml/Decode.luau"], +[135631, "src/Rosetta/data/toml/Encode.luau"], +[135840, "src/Rosetta/data/tres/init.luau"], +[135985, "src/Rosetta/data/vdf/init.luau"], +[136086, "src/Rosetta/data/xml/init.luau"], +[136142, "src/Rosetta/data/yaml/init.luau"], +[136215, "src/Rosetta/data/yaml/Emit.luau"], +[136505, "src/Rosetta/data/yaml/Parse.luau"], +[137798, "src/Rosetta/font/bdf/init.luau"], +[138087, "src/Rosetta/font/bmfont/init.luau"], +[138514, "src/Rosetta/font/bmfont/Parse.luau"], +[138967, "src/Rosetta/font/eot/init.luau"], +[139199, "src/Rosetta/font/fon/init.luau"], +[139482, "src/Rosetta/font/hershey/init.luau"], +[139677, "src/Rosetta/font/pcf/init.luau"], +[139957, "src/Rosetta/font/psf/init.luau"], +[140277, "src/Rosetta/font/ttf/init.luau"], +[140328, "src/Rosetta/font/type1/init.luau"], +[140687, "src/Rosetta/font/type1/Charstring.luau"], +[140965, "src/Rosetta/font/woff/init.luau"], +[141097, "src/Rosetta/font/woff2/init.luau"], +[141154, "src/Rosetta/font/woff2/Rebuild.luau"], +[141694, "src/Rosetta/host/init.luau"], +[141739, "src/Rosetta/host/Love.luau"], +[141882, "src/Rosetta/host/LuaJIT.luau"], +[141932, "src/Rosetta/host/Luau.luau"], +[141955, "src/Rosetta/host/Roblox.luau"], +[142314, "src/Rosetta/image/ani/init.luau"], +[142494, "src/Rosetta/image/art/init.luau"], +[142982, "src/Rosetta/image/blp/init.luau"], +[143240, "src/Rosetta/image/bmp/init.luau"], +[143655, "src/Rosetta/image/dds/init.luau"], +[144138, "src/Rosetta/image/exr/init.luau"], +[144898, "src/Rosetta/image/exr/Codec.luau"], +[145009, "src/Rosetta/image/exr/Piz.luau"], +[145366, "src/Rosetta/image/gif/init.luau"], +[145882, "src/Rosetta/image/gif/Decode.luau"], +[145958, "src/Rosetta/image/hdr/init.luau"], +[146187, "src/Rosetta/image/hdr/Codec.luau"], +[146398, "src/Rosetta/image/icns/init.luau"], +[146729, "src/Rosetta/image/ico/init.luau"], +[147006, "src/Rosetta/image/ico/Dib.luau"], +[147101, "src/Rosetta/image/ilbm/init.luau"], +[147420, "src/Rosetta/image/jpeg/init.luau"], +[147556, "src/Rosetta/image/ktx/init.luau"], +[148216, "src/Rosetta/image/lmp/init.luau"], +[148349, "src/Rosetta/image/pcx/init.luau"], +[148613, "src/Rosetta/image/png/init.luau"], +[149193, "src/Rosetta/image/png/Apng.luau"], +[149273, "src/Rosetta/image/png/Decode.luau"], +[149646, "src/Rosetta/image/png/Encode.luau"], +[149849, "src/Rosetta/image/pnm/init.luau"], +[150227, "src/Rosetta/image/pnm/Codec.luau"], +[150504, "src/Rosetta/image/qoi/init.luau"], +[150626, "src/Rosetta/image/qoi/Codec.luau"], +[150783, "src/Rosetta/image/sgi/init.luau"], +[151068, "src/Rosetta/image/spr/init.luau"], +[151381, "src/Rosetta/image/sunras/init.luau"], +[151627, "src/Rosetta/image/tga/init.luau"], +[151897, "src/Rosetta/image/tga/Codec.luau"], +[152097, "src/Rosetta/image/tiff/init.luau"], +[152924, "src/Rosetta/image/tiff/Pixels.luau"], +[153314, "src/Rosetta/image/tim/init.luau"], +[153556, "src/Rosetta/image/vtf/init.luau"], +[153791, "src/Rosetta/image/webp/init.luau"], +[154401, "src/Rosetta/image/webp/Alpha.luau"], +[154477, "src/Rosetta/image/webp/Anim.luau"], +[154632, "src/Rosetta/image/xbm/init.luau"], +[154793, "src/Rosetta/image/xpm/init.luau"], +[155061, "src/Rosetta/image/xpm/Names.luau"], +[155117, "src/Rosetta/layered/aseprite/init.luau"], +[155855, "src/Rosetta/layered/ora/init.luau"], +[156142, "src/Rosetta/layered/psd/init.luau"], +[156877, "src/Rosetta/layered/psd/Channels.luau"], +[157229, "src/Rosetta/model/3ds/init.luau"], +[157312, "src/Rosetta/model/3ds/Build.luau"], +[157959, "src/Rosetta/model/3ds/Read.luau"], +[158455, "src/Rosetta/model/3ds/Write.luau"], +[159260, "src/Rosetta/model/3mf/init.luau"], +[159342, "src/Rosetta/model/3mf/Read.luau"], +[159930, "src/Rosetta/model/3mf/Write.luau"], +[160335, "src/Rosetta/model/ase/init.luau"], +[160458, "src/Rosetta/model/ase/Build.luau"], +[161032, "src/Rosetta/model/ase/Parse.luau"], +[161101, "src/Rosetta/model/ase/Write.luau"], +[161564, "src/Rosetta/model/b3d/init.luau"], +[161619, "src/Rosetta/model/b3d/Read.luau"], +[162190, "src/Rosetta/model/blend/init.luau"], +[162288, "src/Rosetta/model/blend/Anim.luau"], +[162634, "src/Rosetta/model/blend/Armature.luau"], +[163041, "src/Rosetta/model/blend/Material.luau"], +[163393, "src/Rosetta/model/blend/Mesh.luau"], +[164081, "src/Rosetta/model/blend/Normals.luau"], +[164242, "src/Rosetta/model/blend/Prim.luau"], +[164749, "src/Rosetta/model/blend/Read.luau"], +[165788, "src/Rosetta/model/bsp/init.luau"], +[165979, "src/Rosetta/model/bsp/Lightmap.luau"], +[166045, "src/Rosetta/model/bsp/Quake.luau"], +[166434, "src/Rosetta/model/bsp/Quake3.luau"], +[166663, "src/Rosetta/model/bsp/Tree.luau"], +[167051, "src/Rosetta/model/buildmap/init.luau"], +[167323, "src/Rosetta/model/buildmap/Geometry.luau"], +[167726, "src/Rosetta/model/d3map/init.luau"], +[168008, "src/Rosetta/model/d3map/Parse.luau"], +[168206, "src/Rosetta/model/dae/init.luau"], +[168395, "src/Rosetta/model/dae/Math.luau"], +[168442, "src/Rosetta/model/dae/Read.luau"], +[170292, "src/Rosetta/model/dae/Write.luau"], +[170661, "src/Rosetta/model/fbx/init.luau"], +[170809, "src/Rosetta/model/fbx/Ascii.luau"], +[171079, "src/Rosetta/model/fbx/Binary.luau"], +[171534, "src/Rosetta/model/fbx/Read.luau"], +[172896, "src/Rosetta/model/fbx/Write.luau"], +[173881, "src/Rosetta/model/fbx/Xform.luau"], +[173922, "src/Rosetta/model/gltf/init.luau"], +[174159, "src/Rosetta/model/gltf/Pack.luau"], +[174228, "src/Rosetta/model/gltf/Read.luau"], +[174969, "src/Rosetta/model/gltf/Write.luau"], +[175655, "src/Rosetta/model/godot/init.luau"], +[175746, "src/Rosetta/model/godot/Build.luau"], +[176288, "src/Rosetta/model/godot/Primitives.luau"], +[176563, "src/Rosetta/model/godot/Surface.luau"], +[177048, "src/Rosetta/model/godot/Write.luau"], +[177377, "src/Rosetta/model/iqm/init.luau"], +[177453, "src/Rosetta/model/iqm/Read.luau"], +[177808, "src/Rosetta/model/iqm/Write.luau"], +[178495, "src/Rosetta/model/ldraw/init.luau"], +[178573, "src/Rosetta/model/ldraw/Colors.luau"], +[178891, "src/Rosetta/model/ldraw/Read.luau"], +[179468, "src/Rosetta/model/lwo/init.luau"], +[179544, "src/Rosetta/model/lwo/Build.luau"], +[180006, "src/Rosetta/model/lwo/Parse.luau"], +[180549, "src/Rosetta/model/map/init.luau"], +[180866, "src/Rosetta/model/map/Build.luau"], +[181110, "src/Rosetta/model/map/Parse.luau"], +[181495, "src/Rosetta/model/map/Write.luau"], +[181641, "src/Rosetta/model/mca/init.luau"], +[181983, "src/Rosetta/model/mca/Chunk.luau"], +[182116, "src/Rosetta/model/mca/Lz4Block.luau"], +[182186, "src/Rosetta/model/md2/init.luau"], +[182385, "src/Rosetta/model/md3/init.luau"], +[182613, "src/Rosetta/model/md5/init.luau"], +[182694, "src/Rosetta/model/md5/Read.luau"], +[183127, "src/Rosetta/model/mdl/init.luau"], +[183209, "src/Rosetta/model/mdl/HalfLife.luau"], +[183513, "src/Rosetta/model/mdl/Quake.luau"], +[183731, "src/Rosetta/model/ms3d/init.luau"], +[183803, "src/Rosetta/model/ms3d/Read.luau"], +[184249, "src/Rosetta/model/ms3d/Write.luau"], +[184718, "src/Rosetta/model/obj/init.luau"], +[185536, "src/Rosetta/model/obj/Mtl.luau"], +[185824, "src/Rosetta/model/off/init.luau"], +[186286, "src/Rosetta/model/ply/init.luau"], +[187391, "src/Rosetta/model/ply/Binary.luau"], +[187592, "src/Rosetta/model/pmx/init.luau"], +[187661, "src/Rosetta/model/pmx/Build.luau"], +[187957, "src/Rosetta/model/pmx/Pmd.luau"], +[188292, "src/Rosetta/model/pmx/Read.luau"], +[188696, "src/Rosetta/model/proc/init.luau"], +[189078, "src/Rosetta/model/qb/init.luau"], +[189471, "src/Rosetta/model/rbxm/init.luau"], +[190064, "src/Rosetta/model/rbxmx/init.luau"], +[190740, "src/Rosetta/model/robloxmesh/init.luau"], +[191399, "src/Rosetta/model/robloxmesh/Parse.luau"], +[191856, "src/Rosetta/model/robloxmesh/Write.luau"], +[191965, "src/Rosetta/model/schematic/init.luau"], +[192286, "src/Rosetta/model/schematic/Common.luau"], +[192406, "src/Rosetta/model/schematic/Litematic.luau"], +[192617, "src/Rosetta/model/schematic/Mcedit.luau"], +[192861, "src/Rosetta/model/schematic/Sponge.luau"], +[192990, "src/Rosetta/model/smd/init.luau"], +[193057, "src/Rosetta/model/smd/Read.luau"], +[193326, "src/Rosetta/model/smd/Write.luau"], +[193569, "src/Rosetta/model/sourcemdl/init.luau"], +[193740, "src/Rosetta/model/sourcemdl/Build.luau"], +[194170, "src/Rosetta/model/sourcemdl/Material.luau"], +[194331, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[194858, "src/Rosetta/model/sourcemdl/Phy.luau"], +[194981, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[195163, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[195257, "src/Rosetta/model/stl/init.luau"], +[195707, "src/Rosetta/model/stl/Decode.luau"], +[195781, "src/Rosetta/model/t3d/init.luau"], +[195875, "src/Rosetta/model/t3d/Build.luau"], +[196280, "src/Rosetta/model/t3d/Parse.luau"], +[196448, "src/Rosetta/model/udmf/init.luau"], +[196531, "src/Rosetta/model/usda/init.luau"], +[196740, "src/Rosetta/model/usda/Build.luau"], +[198018, "src/Rosetta/model/usda/Parse.luau"], +[198816, "src/Rosetta/model/usda/Write.luau"], +[199633, "src/Rosetta/model/vbsp/init.luau"], +[200079, "src/Rosetta/model/vbsp/Faces.luau"], +[200303, "src/Rosetta/model/vbsp/Props.luau"], +[200395, "src/Rosetta/model/vmf/init.luau"], +[200720, "src/Rosetta/model/vmf/Build.luau"], +[201144, "src/Rosetta/model/vox/init.luau"], +[202030, "src/Rosetta/model/vox/Grid.luau"], +[202087, "src/Rosetta/model/vrml/init.luau"], +[202153, "src/Rosetta/model/x/init.luau"], +[202283, "src/Rosetta/model/x/Build.luau"], +[202846, "src/Rosetta/model/x/Parse.luau"], +[203143, "src/Rosetta/model/x3d/init.luau"], +[203221, "src/Rosetta/music/669/init.luau"], +[203428, "src/Rosetta/music/ahx/init.luau"], +[203480, "src/Rosetta/music/far/init.luau"], +[203710, "src/Rosetta/music/hmp/init.luau"], +[203975, "src/Rosetta/music/hvl/init.luau"], +[204027, "src/Rosetta/music/it/init.luau"], +[204446, "src/Rosetta/music/it/Itsex.luau"], +[204563, "src/Rosetta/music/med/init.luau"], +[205211, "src/Rosetta/music/midi/init.luau"], +[205355, "src/Rosetta/music/midi/Smf.luau"], +[205767, "src/Rosetta/music/mod/init.luau"], +[206121, "src/Rosetta/music/mtm/init.luau"], +[206344, "src/Rosetta/music/mus/init.luau"], +[206502, "src/Rosetta/music/okt/init.luau"], +[206784, "src/Rosetta/music/ptm/init.luau"], +[207007, "src/Rosetta/music/s3m/init.luau"], +[207244, "src/Rosetta/music/sf2/init.luau"], +[207288, "src/Rosetta/music/stm/init.luau"], +[207520, "src/Rosetta/music/ult/init.luau"], +[207825, "src/Rosetta/music/umx/init.luau"], +[208042, "src/Rosetta/music/xm/init.luau"], +[208604, "src/Rosetta/music/xmi/init.luau"], +[208813, "src/Rosetta/ops/AudioOps.luau"], +[209292, "src/Rosetta/ops/ImageOps/init.luau"], +[209940, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[210580, "src/Rosetta/ops/LayerOps.luau"], +[210673, "src/Rosetta/ops/MeshOps/init.luau"], +[211813, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[211980, "src/Rosetta/ops/MusicOps.luau"], +[212329, "src/Rosetta/playlist/m3u/init.luau"], +[212682, "src/Rosetta/playlist/pls/init.luau"], +[212860, "src/Rosetta/playlist/xspf/init.luau"], +[213063, "src/Rosetta/subtitle/ass/init.luau"], +[213507, "src/Rosetta/subtitle/srt/init.luau"], +[213680, "src/Rosetta/subtitle/vtt/init.luau"], +[213883, "src/Rosetta/vector/gamemaps/init.luau"], +[214070, "src/Rosetta/vector/gamemaps/Expand.luau"], +[214167, "src/Rosetta/vector/ldtk/init.luau"], +[214259, "src/Rosetta/vector/ldtk/Read.luau"], +[214595, "src/Rosetta/vector/ldtk/Write.luau"], +[215243, "src/Rosetta/vector/ogmo/init.luau"], +[215362, "src/Rosetta/vector/ogmo/Read.luau"], +[215767, "src/Rosetta/vector/ogmo/Write.luau"], +[216121, "src/Rosetta/vector/svg/init.luau"], +[216207, "src/Rosetta/vector/svg/Parse.luau"], +[216953, "src/Rosetta/vector/svg/PathData.luau"], +[217321, "src/Rosetta/vector/svg/Render.luau"], +[217738, "src/Rosetta/vector/svg/Style.luau"], +[218110, "src/Rosetta/vector/svg/Write.luau"], +[218310, "src/Rosetta/vector/tiled/init.luau"], +[218490, "src/Rosetta/vector/tiled/Data.luau"], +[218641, "src/Rosetta/vector/tiled/Tmj.luau"], +[219272, "src/Rosetta/vector/tiled/Tmx.luau"], +[219884, "src/Rosetta/video/avi/init.luau"], +[220178, "src/Rosetta/video/fli/init.luau"], +[220329, "src/Rosetta/video/flv/init.luau"], +[220713, "src/Rosetta/video/flv/Amf.luau"], +[220871, "src/Rosetta/video/flv/Mux.luau"], +[221152, "src/Rosetta/video/h264/init.luau"], +[221291, "src/Rosetta/video/mkv/init.luau"], +[221447, "src/Rosetta/video/mkv/Mux.luau"], +[221726, "src/Rosetta/video/mkv/Parse.luau"], +[222447, "src/Rosetta/video/mp4/init.luau"], +[222775, "src/Rosetta/video/mpegps/init.luau"], +[222962, "src/Rosetta/video/mpegts/init.luau"], +[223208, "src/Rosetta/video/ogv/init.luau"], +[223603, "src/Rosetta/video/smk/init.luau"], +[223912, "src/Rosetta/video/smk/Audio.luau"], +[224032, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/build/Rosetta.rbxm b/build/Rosetta.rbxm index a222b0b..1e0b22c 100644 Binary files a/build/Rosetta.rbxm and b/build/Rosetta.rbxm differ diff --git a/build/Rosetta.rbxm.linemap.json b/build/Rosetta.rbxm.linemap.json index 7185eef..4ecb438 100644 --- a/build/Rosetta.rbxm.linemap.json +++ b/build/Rosetta.rbxm.linemap.json @@ -1,6 +1,6 @@ { -"Core_1": [[8, "src/Rosetta/init.luau"], [892, "src/Rosetta/Registry.luau"], [3301, "src/Rosetta/Types.luau"], [4414, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5168, "src/Rosetta/codecs/image/Yuv.luau"], [5473, "src/Rosetta/codecs/model/Rbx/init.luau"], [5710, "src/Rosetta/codecs/video/Video/init.luau"], [6268, "src/Rosetta/containers/AudioWrap.luau"], [6778, "src/Rosetta/containers/Ogg/Mux.luau"], [6967, "src/Rosetta/core/Bytes.luau"], [7494, "src/Rosetta/core/Crc32.luau"], [7645, "src/Rosetta/core/Err.luau"], [7727, "src/Rosetta/core/Input.luau"], [7803, "src/Rosetta/host/init.luau"]], -"Core_2": [[8, "src/Rosetta/ops/ImageOps/init.luau"], [656, "src/Rosetta/ops/ImageOps/Kernels.luau"]], +"Core_1": [[8, "src/Rosetta/init.luau"], [925, "src/Rosetta/Registry.luau"], [3542, "src/Rosetta/Types.luau"], [4655, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5409, "src/Rosetta/codecs/image/Yuv.luau"], [5714, "src/Rosetta/codecs/model/Rbx/init.luau"], [5951, "src/Rosetta/codecs/video/Video/init.luau"], [6509, "src/Rosetta/containers/AudioWrap.luau"], [7019, "src/Rosetta/containers/Ogg/Mux.luau"], [7208, "src/Rosetta/core/Bytes.luau"], [7735, "src/Rosetta/core/Crc32.luau"], [7886, "src/Rosetta/core/Err.luau"], [7968, "src/Rosetta/core/Input.luau"]], +"Core_2": [[8, "src/Rosetta/host/init.luau"], [53, "src/Rosetta/ops/ImageOps/init.luau"], [701, "src/Rosetta/ops/ImageOps/Kernels.luau"]], "Mpeg2": [[8, "src/Rosetta/codecs/video/Dsp.luau"], [846, "src/Rosetta/codecs/video/Mpeg1/init.luau"], [859, "src/Rosetta/codecs/video/Mpeg2/init.luau"], [1227, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], [2754, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], [2894, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"]], "H263": [[8, "src/Rosetta/codecs/video/H263/init.luau"], [165, "src/Rosetta/codecs/video/H263/Decoder.luau"], [1023, "src/Rosetta/codecs/video/H263/Tables.luau"]], "H264": [[8, "src/Rosetta/codecs/video/H264/init.luau"], [382, "src/Rosetta/codecs/video/H264/Bitstream.luau"], [657, "src/Rosetta/codecs/video/H264/Cabac.luau"], [1788, "src/Rosetta/codecs/video/H264/Cavlc.luau"], [2556, "src/Rosetta/codecs/video/H264/Deblock.luau"], [2818, "src/Rosetta/codecs/video/H264/Decoder.luau"], [3828, "src/Rosetta/codecs/video/H264/Inter.luau"], [4154, "src/Rosetta/codecs/video/H264/Intra.luau"], [4561, "src/Rosetta/codecs/video/H264/Mb.luau"], [5500, "src/Rosetta/codecs/video/H264/Params.luau"], [5948, "src/Rosetta/codecs/video/H264/Slice.luau"], [6200, "src/Rosetta/codecs/video/H264/Tables.luau"], [6242, "src/Rosetta/codecs/video/H264/Transform.luau"]], @@ -27,6 +27,7 @@ "Hively": [[8, "src/Rosetta/codecs/audio/Hively/init.luau"], [205, "src/Rosetta/codecs/audio/Hively/Load.luau"], [455, "src/Rosetta/codecs/audio/Hively/Player.luau"], [1414, "src/Rosetta/codecs/audio/Hively/Tables.luau"]], "SoundFont": [[8, "src/Rosetta/codecs/audio/SoundFont/init.luau"], [63, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], [207, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], [721, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"]], "Draco": [[8, "src/Rosetta/codecs/model/Draco/init.luau"], [340, "src/Rosetta/codecs/model/Draco/Attributes.luau"], [809, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], [1998, "src/Rosetta/codecs/model/Draco/Int64.luau"], [2147, "src/Rosetta/codecs/model/Draco/KdTree.luau"], [2506, "src/Rosetta/codecs/model/Draco/Predict.luau"], [3468, "src/Rosetta/codecs/model/Draco/Reader.luau"]], +"Root": [[8, "src/Rosetta/Sniffs.luau"]], "archive_1": [[8, "src/Rosetta/archive/7z/init.luau"], [393, "src/Rosetta/archive/7z/Header.luau"], [920, "src/Rosetta/archive/adf/init.luau"], [1202, "src/Rosetta/archive/applesingle/init.luau"], [1388, "src/Rosetta/archive/ar/init.luau"], [1791, "src/Rosetta/archive/arj/init.luau"], [2001, "src/Rosetta/archive/binhex/init.luau"], [2250, "src/Rosetta/archive/br/init.luau"], [2325, "src/Rosetta/archive/bz2/init.luau"], [2389, "src/Rosetta/archive/cab/init.luau"], [2802, "src/Rosetta/archive/cab/Sum.luau"], [2843, "src/Rosetta/archive/cpio/init.luau"], [3011, "src/Rosetta/archive/d64/init.luau"], [3425, "src/Rosetta/archive/fat/init.luau"], [3547, "src/Rosetta/archive/grp/init.luau"], [3661, "src/Rosetta/archive/gzip/init.luau"], [3846, "src/Rosetta/archive/iso/init.luau"], [3918, "src/Rosetta/archive/lha/init.luau"], [4343, "src/Rosetta/archive/lz4/init.luau"], [4687, "src/Rosetta/archive/macbinary/init.luau"], [4885, "src/Rosetta/archive/mpq/init.luau"], [5291, "src/Rosetta/archive/mpq/Crypt.luau"], [5356, "src/Rosetta/archive/pak/init.luau"], [5490, "src/Rosetta/archive/rpm/init.luau"], [5814, "src/Rosetta/archive/tar/init.luau"], [5932, "src/Rosetta/archive/unitypackage/init.luau"], [6168, "src/Rosetta/archive/uu/init.luau"], [6438, "src/Rosetta/archive/vpk/init.luau"], [6749, "src/Rosetta/archive/vswap/init.luau"], [7019, "src/Rosetta/archive/wad/init.luau"], [7473, "src/Rosetta/archive/wad/Picture.luau"], [7575, "src/Rosetta/archive/wad2/init.luau"], [7857, "src/Rosetta/archive/xz/init.luau"]], "archive_2": [[8, "src/Rosetta/archive/yenc/init.luau"], [280, "src/Rosetta/archive/z/init.luau"], [376, "src/Rosetta/archive/zip/init.luau"], [595, "src/Rosetta/archive/zoo/init.luau"], [791, "src/Rosetta/archive/zst/init.luau"]], "audio": [[8, "src/Rosetta/audio/aac/init.luau"], [221, "src/Rosetta/audio/ac3/init.luau"], [368, "src/Rosetta/audio/adpcm/init.luau"], [514, "src/Rosetta/audio/adx/init.luau"], [746, "src/Rosetta/audio/aiff/init.luau"], [1138, "src/Rosetta/audio/ape/init.luau"], [1267, "src/Rosetta/audio/au/init.luau"], [1429, "src/Rosetta/audio/brstm/init.luau"], [1721, "src/Rosetta/audio/caf/init.luau"], [2388, "src/Rosetta/audio/flac/init.luau"], [2537, "src/Rosetta/audio/flac/Meta.luau"], [2759, "src/Rosetta/audio/flac/Stream.luau"], [3129, "src/Rosetta/audio/m4a/init.luau"], [3472, "src/Rosetta/audio/mp3/init.luau"], [3733, "src/Rosetta/audio/mp3/Index.luau"], [3924, "src/Rosetta/audio/mp3/Stream.luau"], [4151, "src/Rosetta/audio/mp3/Tags.luau"], [4463, "src/Rosetta/audio/mpc/init.luau"], [4558, "src/Rosetta/audio/opus/init.luau"], [4937, "src/Rosetta/audio/opus/Encode.luau"], [5049, "src/Rosetta/audio/qoa/init.luau"], [5230, "src/Rosetta/audio/tta/init.luau"], [5349, "src/Rosetta/audio/vag/init.luau"], [5573, "src/Rosetta/audio/voc/init.luau"], [5849, "src/Rosetta/audio/vorbis/init.luau"], [6304, "src/Rosetta/audio/vorbis/Encode.luau"], [7117, "src/Rosetta/audio/wav/init.luau"], [7738, "src/Rosetta/audio/wav/Codecs.luau"], [7917, "src/Rosetta/audio/wavpack/init.luau"]], diff --git a/build/Rosetta.rbxmx b/build/Rosetta.rbxmx index 9707259..a484cf5 100644 --- a/build/Rosetta.rbxmx +++ b/build/Rosetta.rbxmx @@ -22,7 +22,7 @@ local __CHUNK = { ["core/Crc32"] = "Core_1", ["core/Err"] = "Core_1", ["core/Input"] = "Core_1", - ["host"] = "Core_1", + ["host"] = "Core_2", ["ops/ImageOps"] = "Core_2", ["ops/ImageOps/Kernels"] = "Core_2", ["codecs/video/Dsp"] = "Mpeg2", @@ -160,6 +160,7 @@ local __CHUNK = { ["codecs/model/Draco/KdTree"] = "Draco", ["codecs/model/Draco/Predict"] = "Draco", ["codecs/model/Draco/Reader"] = "Draco", + ["Sniffs"] = "Root", ["archive/7z"] = "archive_1", ["archive/7z/Header"] = "archive_1", ["archive/adf"] = "archive_1", @@ -681,7 +682,7 @@ return Rosetta --!optimize 2 --!nocheck -- rosetta chunk Core_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 14 modules (5 native: @native); the Rosetta root requires it when one of them is first included. +-- 13 modules (5 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES[""] = function() @@ -765,6 +766,56 @@ end local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order: { number }? = nil +local byExt: { [string]: { number } } = {} +local Sniffs: { [string]: (any) -> number }? = nil + +local function sniffOrder(): { number } + local o = order + if o then + return o + end + local list: { number } = {} + for idx, e in Registry do + table.insert(list, idx) + for _, x in e.extensions do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx: number): number + local e = Registry[idx] + return if LATE[e.name] then 3 else e.sniff + end + table.sort(list, function(a: number, b: number): boolean + local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e: Registry.Entry): ((any) -> number)? + if e.sniff < 2 then + local s = Sniffs + if not s then + s = __include("Sniffs") :: any + Sniffs = s + end + local f = (s :: { [string]: (any) -> number })[e.path] + if f then + return f + end + end + local m = module(e) + return if m and type(m.sniff) == "function" then m.sniff else nil +end + local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) if format then local e = find(format, category) @@ -774,52 +825,35 @@ local function detect(buf: buffer, name: string?, category: string?, format: str return e, nil end local ext = Input.extension(name) + local list = sniffOrder() + local hits = if ext then byExt[ext] else nil local best: Registry.Entry? = nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late: { number }? = nil - for idx, e in Registry do - if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late :: { number }, idx) - continue - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score += 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = if pass == 1 then hits else list + if ids then + for _, idx in ids do + if pass == 2 and bestScore > 1 then + break end - end - end - end - if late then - for _, idx in late do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (if extHit then 0.01 else 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score += 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -1383,7 +1417,7 @@ function F.detect(src: any, opts: Options?): (string?, Err.Err?) return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) + local m = if entry.variant then module(entry) else nil if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then @@ -1573,6 +1607,8 @@ __FILES["Registry"] = function() -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). type Entry = { name: string, category: string, @@ -1581,6 +1617,8 @@ type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -1593,6 +1631,7 @@ local list: { Entry } = { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return __include("image/ani") end, @@ -1605,6 +1644,7 @@ local list: { Entry } = { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/art") end, @@ -1617,6 +1657,7 @@ local list: { Entry } = { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return __include("image/blp") end, @@ -1629,6 +1670,7 @@ local list: { Entry } = { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return __include("image/bmp") end, @@ -1641,6 +1683,7 @@ local list: { Entry } = { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return __include("image/dds") end, @@ -1653,6 +1696,7 @@ local list: { Entry } = { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return __include("image/exr") end, @@ -1665,6 +1709,7 @@ local list: { Entry } = { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return __include("image/gif") end, @@ -1677,6 +1722,7 @@ local list: { Entry } = { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return __include("image/hdr") end, @@ -1689,6 +1735,7 @@ local list: { Entry } = { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return __include("image/icns") end, @@ -1701,6 +1748,7 @@ local list: { Entry } = { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/ico") end, @@ -1713,6 +1761,7 @@ local list: { Entry } = { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/ilbm") end, @@ -1725,6 +1774,7 @@ local list: { Entry } = { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return __include("image/jpeg") end, @@ -1737,6 +1787,7 @@ local list: { Entry } = { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return __include("image/ktx") end, @@ -1749,6 +1800,7 @@ local list: { Entry } = { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return __include("image/lmp") end, @@ -1761,6 +1813,7 @@ local list: { Entry } = { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/pcx") end, @@ -1773,6 +1826,7 @@ local list: { Entry } = { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return __include("image/png") end, @@ -1785,6 +1839,7 @@ local list: { Entry } = { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/pnm") end, @@ -1797,6 +1852,7 @@ local list: { Entry } = { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/qoi") end, @@ -1809,6 +1865,7 @@ local list: { Entry } = { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return __include("image/sgi") end, @@ -1821,6 +1878,7 @@ local list: { Entry } = { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return __include("image/spr") end, @@ -1833,6 +1891,7 @@ local list: { Entry } = { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/sunras") end, @@ -1845,6 +1904,7 @@ local list: { Entry } = { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/tga") end, @@ -1857,6 +1917,7 @@ local list: { Entry } = { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/tiff") end, @@ -1869,6 +1930,7 @@ local list: { Entry } = { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return __include("image/tim") end, @@ -1881,6 +1943,7 @@ local list: { Entry } = { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return __include("image/vtf") end, @@ -1893,6 +1956,7 @@ local list: { Entry } = { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/webp") end, @@ -1905,6 +1969,7 @@ local list: { Entry } = { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return __include("image/xbm") end, @@ -1917,6 +1982,7 @@ local list: { Entry } = { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/xpm") end, @@ -1929,6 +1995,7 @@ local list: { Entry } = { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return __include("audio/aac") end, @@ -1941,6 +2008,7 @@ local list: { Entry } = { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/ac3") end, @@ -1953,6 +2021,7 @@ local list: { Entry } = { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return __include("audio/adpcm") end, @@ -1965,6 +2034,7 @@ local list: { Entry } = { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/adx") end, @@ -1977,6 +2047,7 @@ local list: { Entry } = { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/aiff") end, @@ -1989,6 +2060,7 @@ local list: { Entry } = { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("audio/ape") end, @@ -2001,6 +2073,7 @@ local list: { Entry } = { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/au") end, @@ -2013,6 +2086,8 @@ local list: { Entry } = { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return __include("audio/brstm") end, @@ -2025,6 +2100,7 @@ local list: { Entry } = { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return __include("audio/caf") end, @@ -2037,6 +2113,7 @@ local list: { Entry } = { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return __include("audio/flac") end, @@ -2049,6 +2126,7 @@ local list: { Entry } = { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return __include("audio/m4a") end, @@ -2061,6 +2139,7 @@ local list: { Entry } = { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return __include("audio/mp3") end, @@ -2073,6 +2152,7 @@ local list: { Entry } = { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/mpc") end, @@ -2085,6 +2165,7 @@ local list: { Entry } = { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return __include("audio/opus") end, @@ -2097,6 +2178,7 @@ local list: { Entry } = { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/qoa") end, @@ -2109,6 +2191,7 @@ local list: { Entry } = { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return __include("audio/tta") end, @@ -2121,6 +2204,7 @@ local list: { Entry } = { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return __include("audio/vag") end, @@ -2133,6 +2217,7 @@ local list: { Entry } = { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return __include("audio/voc") end, @@ -2145,6 +2230,7 @@ local list: { Entry } = { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return __include("audio/vorbis") end, @@ -2157,6 +2243,7 @@ local list: { Entry } = { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return __include("audio/wav") end, @@ -2169,6 +2256,7 @@ local list: { Entry } = { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return __include("audio/wavpack") end, @@ -2181,6 +2269,7 @@ local list: { Entry } = { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return __include("video/avi") end, @@ -2193,6 +2282,7 @@ local list: { Entry } = { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return __include("video/fli") end, @@ -2205,6 +2295,7 @@ local list: { Entry } = { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return __include("video/flv") end, @@ -2217,6 +2308,7 @@ local list: { Entry } = { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return __include("video/h264") end, @@ -2229,6 +2321,8 @@ local list: { Entry } = { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return __include("video/mkv") end, @@ -2241,6 +2335,7 @@ local list: { Entry } = { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return __include("video/mp4") end, @@ -2253,6 +2348,7 @@ local list: { Entry } = { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegps") end, @@ -2265,6 +2361,7 @@ local list: { Entry } = { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegts") end, @@ -2277,6 +2374,7 @@ local list: { Entry } = { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return __include("video/ogv") end, @@ -2289,6 +2387,7 @@ local list: { Entry } = { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return __include("video/smk") end, @@ -2301,6 +2400,7 @@ local list: { Entry } = { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return __include("video/y4m") end, @@ -2313,6 +2413,7 @@ local list: { Entry } = { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return __include("model/3ds") end, @@ -2325,6 +2426,7 @@ local list: { Entry } = { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return __include("model/3mf") end, @@ -2337,6 +2439,7 @@ local list: { Entry } = { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return __include("model/ase") end, @@ -2349,6 +2452,7 @@ local list: { Entry } = { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return __include("model/b3d") end, @@ -2361,6 +2465,7 @@ local list: { Entry } = { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return __include("model/blend") end, @@ -2373,6 +2478,7 @@ local list: { Entry } = { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return __include("model/bsp") end, @@ -2385,6 +2491,7 @@ local list: { Entry } = { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return __include("model/buildmap") end, @@ -2397,6 +2504,7 @@ local list: { Entry } = { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return __include("model/d3map") end, @@ -2409,6 +2517,7 @@ local list: { Entry } = { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return __include("model/dae") end, @@ -2421,6 +2530,7 @@ local list: { Entry } = { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return __include("model/fbx") end, @@ -2433,6 +2543,7 @@ local list: { Entry } = { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return __include("model/gltf") end, @@ -2445,6 +2556,7 @@ local list: { Entry } = { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return __include("model/godot") end, @@ -2457,6 +2569,7 @@ local list: { Entry } = { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/iqm") end, @@ -2469,6 +2582,7 @@ local list: { Entry } = { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return __include("model/ldraw") end, @@ -2481,6 +2595,7 @@ local list: { Entry } = { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return __include("model/lwo") end, @@ -2493,6 +2608,7 @@ local list: { Entry } = { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return __include("model/map") end, @@ -2505,6 +2621,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return __include("model/mca") end, @@ -2517,6 +2634,7 @@ local list: { Entry } = { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return __include("model/md2") end, @@ -2529,6 +2647,7 @@ local list: { Entry } = { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return __include("model/md3") end, @@ -2541,6 +2660,7 @@ local list: { Entry } = { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/md5") end, @@ -2553,6 +2673,7 @@ local list: { Entry } = { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/mdl") end, @@ -2565,6 +2686,7 @@ local list: { Entry } = { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return __include("model/ms3d") end, @@ -2577,6 +2699,7 @@ local list: { Entry } = { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/obj") end, @@ -2589,6 +2712,7 @@ local list: { Entry } = { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return __include("model/off") end, @@ -2601,6 +2725,7 @@ local list: { Entry } = { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return __include("model/ply") end, @@ -2613,6 +2738,7 @@ local list: { Entry } = { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return __include("model/pmx") end, @@ -2625,6 +2751,7 @@ local list: { Entry } = { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return __include("model/proc") end, @@ -2637,6 +2764,7 @@ local list: { Entry } = { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return __include("model/qb") end, @@ -2649,6 +2777,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return __include("model/rbxm") end, @@ -2661,6 +2791,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return __include("model/rbxmx") end, @@ -2673,6 +2805,7 @@ local list: { Entry } = { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return __include("model/robloxmesh") end, @@ -2685,6 +2818,8 @@ local list: { Entry } = { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return __include("model/schematic") end, @@ -2697,6 +2832,7 @@ local list: { Entry } = { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/smd") end, @@ -2709,6 +2845,7 @@ local list: { Entry } = { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return __include("model/sourcemdl") end, @@ -2721,6 +2858,7 @@ local list: { Entry } = { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return __include("model/stl") end, @@ -2733,6 +2871,7 @@ local list: { Entry } = { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return __include("model/t3d") end, @@ -2745,6 +2884,7 @@ local list: { Entry } = { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return __include("model/udmf") end, @@ -2757,6 +2897,7 @@ local list: { Entry } = { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return __include("model/usda") end, @@ -2769,6 +2910,7 @@ local list: { Entry } = { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return __include("model/vbsp") end, @@ -2781,6 +2923,7 @@ local list: { Entry } = { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return __include("model/vmf") end, @@ -2793,6 +2936,7 @@ local list: { Entry } = { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return __include("model/vox") end, @@ -2805,6 +2949,7 @@ local list: { Entry } = { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return __include("model/vrml") end, @@ -2817,6 +2962,7 @@ local list: { Entry } = { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/x") end, @@ -2829,6 +2975,7 @@ local list: { Entry } = { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return __include("model/x3d") end, @@ -2841,6 +2988,7 @@ local list: { Entry } = { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return __include("cad/step") end, @@ -2853,6 +3001,7 @@ local list: { Entry } = { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return __include("font/bdf") end, @@ -2865,6 +3014,7 @@ local list: { Entry } = { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return __include("font/bmfont") end, @@ -2877,6 +3027,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return __include("font/eot") end, @@ -2889,6 +3040,7 @@ local list: { Entry } = { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return __include("font/fon") end, @@ -2901,6 +3053,7 @@ local list: { Entry } = { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return __include("font/hershey") end, @@ -2913,6 +3066,7 @@ local list: { Entry } = { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return __include("font/pcf") end, @@ -2925,6 +3079,7 @@ local list: { Entry } = { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return __include("font/psf") end, @@ -2937,6 +3092,7 @@ local list: { Entry } = { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return __include("font/ttf") end, @@ -2949,6 +3105,7 @@ local list: { Entry } = { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return __include("font/type1") end, @@ -2961,6 +3118,7 @@ local list: { Entry } = { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return __include("font/woff") end, @@ -2973,6 +3131,7 @@ local list: { Entry } = { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return __include("font/woff2") end, @@ -2985,6 +3144,7 @@ local list: { Entry } = { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return __include("archive/7z") end, @@ -2997,6 +3157,7 @@ local list: { Entry } = { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return __include("archive/adf") end, @@ -3009,6 +3170,7 @@ local list: { Entry } = { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return __include("archive/applesingle") end, @@ -3021,6 +3183,7 @@ local list: { Entry } = { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return __include("archive/ar") end, @@ -3033,6 +3196,7 @@ local list: { Entry } = { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return __include("archive/arj") end, @@ -3045,6 +3209,7 @@ local list: { Entry } = { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return __include("archive/binhex") end, @@ -3057,6 +3222,7 @@ local list: { Entry } = { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/br") end, @@ -3069,6 +3235,7 @@ local list: { Entry } = { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return __include("archive/bz2") end, @@ -3081,6 +3248,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return __include("archive/cab") end, @@ -3093,6 +3261,7 @@ local list: { Entry } = { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return __include("archive/cpio") end, @@ -3105,6 +3274,7 @@ local list: { Entry } = { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return __include("archive/d64") end, @@ -3117,6 +3287,7 @@ local list: { Entry } = { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return __include("archive/fat") end, @@ -3129,6 +3300,7 @@ local list: { Entry } = { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("archive/grp") end, @@ -3141,6 +3313,7 @@ local list: { Entry } = { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return __include("archive/gzip") end, @@ -3153,6 +3326,7 @@ local list: { Entry } = { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return __include("archive/iso") end, @@ -3165,6 +3339,7 @@ local list: { Entry } = { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return __include("archive/lha") end, @@ -3177,6 +3352,7 @@ local list: { Entry } = { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return __include("archive/lz4") end, @@ -3189,6 +3365,7 @@ local list: { Entry } = { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return __include("archive/macbinary") end, @@ -3201,6 +3378,7 @@ local list: { Entry } = { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return __include("archive/mpq") end, @@ -3213,6 +3391,7 @@ local list: { Entry } = { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return __include("archive/pak") end, @@ -3225,6 +3404,7 @@ local list: { Entry } = { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return __include("archive/rpm") end, @@ -3237,6 +3417,7 @@ local list: { Entry } = { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return __include("archive/tar") end, @@ -3249,6 +3430,7 @@ local list: { Entry } = { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("archive/unitypackage") end, @@ -3261,6 +3443,7 @@ local list: { Entry } = { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return __include("archive/uu") end, @@ -3273,6 +3456,7 @@ local list: { Entry } = { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return __include("archive/vpk") end, @@ -3285,6 +3469,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return __include("archive/vswap") end, @@ -3297,6 +3482,7 @@ local list: { Entry } = { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return __include("archive/wad") end, @@ -3309,6 +3495,7 @@ local list: { Entry } = { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return __include("archive/wad2") end, @@ -3321,6 +3508,7 @@ local list: { Entry } = { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return __include("archive/xz") end, @@ -3333,6 +3521,7 @@ local list: { Entry } = { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return __include("archive/yenc") end, @@ -3345,6 +3534,7 @@ local list: { Entry } = { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return __include("archive/z") end, @@ -3357,6 +3547,7 @@ local list: { Entry } = { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return __include("archive/zip") end, @@ -3369,6 +3560,7 @@ local list: { Entry } = { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return __include("archive/zoo") end, @@ -3381,6 +3573,7 @@ local list: { Entry } = { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/zst") end, @@ -3393,6 +3586,7 @@ local list: { Entry } = { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return __include("data/cbor") end, @@ -3405,6 +3599,7 @@ local list: { Entry } = { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return __include("data/csv") end, @@ -3417,6 +3612,7 @@ local list: { Entry } = { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/ini") end, @@ -3429,6 +3625,7 @@ local list: { Entry } = { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return __include("data/json") end, @@ -3441,6 +3638,7 @@ local list: { Entry } = { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return __include("data/msgpack") end, @@ -3453,6 +3651,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return __include("data/nbt") end, @@ -3465,6 +3664,7 @@ local list: { Entry } = { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return __include("data/plist") end, @@ -3477,6 +3677,7 @@ local list: { Entry } = { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3shader") end, @@ -3489,6 +3690,7 @@ local list: { Entry } = { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3skin") end, @@ -3501,6 +3703,7 @@ local list: { Entry } = { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return __include("data/snbt") end, @@ -3513,6 +3716,7 @@ local list: { Entry } = { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return __include("data/toml") end, @@ -3525,6 +3729,7 @@ local list: { Entry } = { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/tres") end, @@ -3537,6 +3742,7 @@ local list: { Entry } = { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return __include("data/vdf") end, @@ -3549,6 +3755,7 @@ local list: { Entry } = { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return __include("data/xml") end, @@ -3561,6 +3768,7 @@ local list: { Entry } = { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return __include("data/yaml") end, @@ -3573,6 +3781,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return __include("vector/gamemaps") end, @@ -3585,6 +3794,7 @@ local list: { Entry } = { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return __include("vector/ldtk") end, @@ -3597,6 +3807,7 @@ local list: { Entry } = { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return __include("vector/ogmo") end, @@ -3609,6 +3820,7 @@ local list: { Entry } = { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return __include("vector/svg") end, @@ -3621,6 +3833,7 @@ local list: { Entry } = { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return __include("vector/tiled") end, @@ -3633,6 +3846,7 @@ local list: { Entry } = { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/aseprite") end, @@ -3645,6 +3859,7 @@ local list: { Entry } = { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return __include("layered/ora") end, @@ -3657,6 +3872,7 @@ local list: { Entry } = { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/psd") end, @@ -3669,6 +3885,7 @@ local list: { Entry } = { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/ass") end, @@ -3681,6 +3898,7 @@ local list: { Entry } = { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return __include("subtitle/srt") end, @@ -3693,6 +3911,7 @@ local list: { Entry } = { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/vtt") end, @@ -3705,6 +3924,7 @@ local list: { Entry } = { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return __include("music/669") end, @@ -3717,6 +3937,7 @@ local list: { Entry } = { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return __include("music/ahx") end, @@ -3729,6 +3950,7 @@ local list: { Entry } = { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return __include("music/far") end, @@ -3741,6 +3963,7 @@ local list: { Entry } = { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return __include("music/hmp") end, @@ -3753,6 +3976,7 @@ local list: { Entry } = { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return __include("music/hvl") end, @@ -3765,6 +3989,7 @@ local list: { Entry } = { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return __include("music/it") end, @@ -3777,6 +4002,7 @@ local list: { Entry } = { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/med") end, @@ -3789,6 +4015,7 @@ local list: { Entry } = { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return __include("music/midi") end, @@ -3801,6 +4028,7 @@ local list: { Entry } = { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mod") end, @@ -3813,6 +4041,7 @@ local list: { Entry } = { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mtm") end, @@ -3825,6 +4054,7 @@ local list: { Entry } = { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return __include("music/mus") end, @@ -3837,6 +4067,7 @@ local list: { Entry } = { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return __include("music/okt") end, @@ -3849,6 +4080,7 @@ local list: { Entry } = { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ptm") end, @@ -3861,6 +4093,7 @@ local list: { Entry } = { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/s3m") end, @@ -3873,6 +4106,7 @@ local list: { Entry } = { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return __include("music/sf2") end, @@ -3885,6 +4119,7 @@ local list: { Entry } = { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return __include("music/stm") end, @@ -3897,6 +4132,7 @@ local list: { Entry } = { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ult") end, @@ -3909,6 +4145,7 @@ local list: { Entry } = { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return __include("music/umx") end, @@ -3921,6 +4158,7 @@ local list: { Entry } = { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/xm") end, @@ -3933,6 +4171,7 @@ local list: { Entry } = { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return __include("music/xmi") end, @@ -3945,6 +4184,7 @@ local list: { Entry } = { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return __include("playlist/m3u") end, @@ -3957,6 +4197,7 @@ local list: { Entry } = { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("playlist/pls") end, @@ -3969,6 +4210,7 @@ local list: { Entry } = { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("playlist/xspf") end, @@ -8479,6 +8721,19 @@ end return Input end +end + + + + + + Core_2 + --!optimize 2 +--!nocheck +-- rosetta chunk Core_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["host"] = function() -- host: the runtime adapter, detected once at load time. Roblox (no file system; toEditableImage), LÖVE @@ -8524,19 +8779,6 @@ end local _ = Err return host end -end - - - - - - Core_2 - --!optimize 2 ---!nocheck --- rosetta chunk Core_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["ops/ImageOps"] = function() -- ops/ImageOps: editing on the standard Image: conversion, crop, resize, flips, rotation, compositing, pixel access, @@ -74676,6 +74918,3405 @@ end + + Root + --!optimize 2 +--!nocheck +-- rosetta chunk Root (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) +__FILES["Sniffs"] = function() + + +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S: { [string]: (any) -> number } = {} + +local function lazy(load: () -> any): any + local proxy = {} + return setmetatable(proxy, { + __index = function(_, k: any): any + local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = __include("core/Bytes") +S["image/ani"] = function(r: Bytes.Reader): number + return if r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" then 1 else 0 +end +end + +do -- image/art +local Bytes = __include("core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b: buffer, o: number, limit: number): (number?, number?, number?, number?, boolean?) + local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p += 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r: Bytes.Reader): number + local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at :: number + if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total += w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return if size == have then 0.9 elseif size < have and have - size < 4096 then 0.5 else 0 +end +end + +do -- image/blp +local Bytes = __include("core/Bytes") +S["image/blp"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "BLP1" or m == "BLP2" then 1 elseif m == "BLP0" then 0.8 else 0 +end +end + +do -- image/bmp +local Bytes = __include("core/Bytes") +S["image/bmp"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = __include("core/Bytes") +S["image/gif"] = function(r: Bytes.Reader): number + local s = r:peek(6) + return if s == "GIF89a" or s == "GIF87a" then 1 else 0 +end +end + +do -- image/hdr +local Bytes = __include("core/Bytes") +S["image/hdr"] = function(r: Bytes.Reader): number + local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/icns"] = function(r: Bytes.Reader): number + return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = __include("core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r: Bytes.Reader): number + if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = __include("core/Bytes") +S["image/ilbm"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return if t == "ILBM" or t == "PBM " then 1 else 0 +end +end + +do -- image/jpeg +local Bytes = __include("core/Bytes") +S["image/jpeg"] = function(r: Bytes.Reader): number + local s = r:peek(3) + return if s == "\255\216\255" then 1 else 0 +end +end + +do -- image/ktx +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = __include("core/Bytes") +local function kindOf(r: Bytes.Reader): string? + local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r: Bytes.Reader): number + local k = kindOf(r) + return if k == "qpic" then 0.3 elseif k then 0.05 else 0 +end +end + +do -- image/pcx +local Bytes = __include("core/Bytes") +S["image/pcx"] = function(r: Bytes.Reader): number + if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return if bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 then 0.8 else 0 +end +end + +do -- image/png +local Bytes = __include("core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r: Bytes.Reader): number + return if r:peek(8) == SIGNATURE then 1 else 0 +end +end + +do -- image/pnm +local Bytes = __include("core/Bytes") +S["image/pnm"] = function(r: Bytes.Reader): number + if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = __include("core/Bytes") +S["image/qoi"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoif" then 1 else 0 +end +end + +do -- image/sgi +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/sgi"] = function(r: Bytes.Reader): number + if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return if st <= 1 and (bpc == 1 or bpc == 2) then 1 else 0 +end +end + +do -- image/spr +local Bytes = __include("core/Bytes") +S["image/spr"] = function(r: Bytes.Reader): number + if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v == 1 or v == 2 or v == 32 then 1 else 0.3 +end +end + +do -- image/sunras +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = __include("core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 +type Header = { + idLen: number, + cmapType: number, + imageType: number, + cmapFirst: number, + cmapLen: number, + cmapBits: number, + width: number, + height: number, + depth: number, + desc: number, +} +local function header(r: Bytes.Reader): Header? + if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q: number): number + return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h: Header = { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h: Header): string? + local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r: Bytes.Reader): number + local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = __include("core/Bytes") +S["image/tiff"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = __include("core/Bytes") +S["image/tim"] = function(r: Bytes.Reader): number + if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = __include("core/Bytes") +S["image/vtf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VTF\0" and r:peekU8(4) == 7 then 1 else 0 +end +end + +do -- image/webp +local Bytes = __include("core/Bytes") +S["image/webp"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xbm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xpm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = __include("core/Bytes") +local Aac = lazy(function() + return __include("codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = if bit32.band(readu8(b, p + 5), 0x10) ~= 0 then 10 else 0 + return 10 + s + footer +end +S["audio/aac"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return if p + h.frameSize >= limit then 0.7 else 0.4 +end +end + +do -- audio/ac3 +local Bytes = __include("core/Bytes") +local Ac3 = lazy(function() + return __include("codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return if p + h.frameSize >= limit then 0.6 else 0.3 +end +end + +do -- audio/adpcm +local Bytes = __include("core/Bytes") +S["audio/adpcm"] = function(_r: Bytes.Reader): number + return 0 +end +end + +do -- audio/adx +local Bytes = __include("core/Bytes") +S["audio/adx"] = function(r: Bytes.Reader): number + if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return if r:peek(6, off - 2) == "(c)CRI" then 1 else 0 +end +end + +do -- audio/aiff +local Bytes = __include("core/Bytes") +S["audio/aiff"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return if form == "AIFF" or form == "AIFC" then 1 else 0 +end +end + +do -- audio/ape +local Bytes = __include("core/Bytes") +S["audio/ape"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (if footer then 10 else 0)) + return if id == "MAC " or id == "MACF" then 1 else 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = __include("core/Bytes") +S["audio/au"] = function(r: Bytes.Reader): number + return if r:peek(4) == ".snd" then 1 else 0 +end +end + +do -- audio/brstm +local Bytes = __include("core/Bytes") +S["audio/brstm"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return if bom == "\254\255" or bom == "\255\254" then 1 else 0 +end +end + +do -- audio/caf +local Bytes = __include("core/Bytes") +S["audio/caf"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = __include("core/Bytes") +S["audio/flac"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return if r:peek(4, 10 + sz + (if footer then 10 else 0)) == "fLaC" then 1 else 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local AUDIO_BRANDS: { [string]: number } = { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = __include("core/Bytes") +local Header = lazy(function() + return __include("codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return __include("audio/mp3/Tags") +end) +S["audio/mp3"] = function(r: Bytes.Reader): number + local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = if p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" then Tags.id3v2Size(b, p, lim) else 0 + if n <= 0 then + break + end + id3 = true + p += n + end + if p + 4 > lim or not Header.valid(b, p) then + return if id3 then 0.5 else 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb += Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return if id3 then 0.7 else 0.25 +end +end + +do -- audio/mpc +local Bytes = __include("core/Bytes") +local Musepack = lazy(function() + return __include("codecs/audio/Musepack") +end) +local function id3v2(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n += bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (if bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 then 10 else 0) +end +S["audio/mpc"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return if v == 7 then 0.9 else 0 +end +end + +do -- audio/opus +local Bytes = __include("core/Bytes") +S["audio/opus"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return if r:peek(8, 27 + nseg) == "OpusHead" then 1 else 0 +end +end + +do -- audio/qoa +local Bytes = __include("core/Bytes") +S["audio/qoa"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoaf" then 1 else 0 +end +end + +do -- audio/tta +local Bytes = __include("core/Bytes") +local function id3Size(r: Bytes.Reader): number + if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (if footer then 10 else 0) +end +S["audio/tta"] = function(r: Bytes.Reader): number + return if r:peek(4, id3Size(r)) == "TTA1" then 1 else 0 +end +end + +do -- audio/vag +local Bytes = __include("core/Bytes") +S["audio/vag"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "VAGp" or m == "VAGi" or m == "KVAG" then 1 else 0 +end +end + +do -- audio/voc +local Bytes = __include("core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r: Bytes.Reader): number + return if r:peek(20) == MAGIC then 1 else 0 +end +end + +do -- audio/vorbis +local Bytes = __include("core/Bytes") +S["audio/vorbis"] = function(r: Bytes.Reader): number + if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return if buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" then 1 else 0 +end +end + +do -- audio/wav +local Bytes = __include("core/Bytes") +local Riff = lazy(function() + return __include("containers/Riff") +end) +S["audio/wav"] = function(r: Bytes.Reader): number + return if Riff.sniff(r) == "WAVE" then 1 else 0 +end +end + +do -- audio/wavpack +local Bytes = __include("core/Bytes") +S["audio/wavpack"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return if v == 4 then 1 else 0.5 +end +end + +do -- video/avi +local Bytes = __include("core/Bytes") +S["video/avi"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = __include("core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r: Bytes.Reader): number + local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = __include("core/Bytes") +S["video/flv"] = function(r: Bytes.Reader): number + if r:remaining() >= 9 and r:peek(3) == "FLV" then + return if r:peekU8(3) == 1 then 1 else 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = __include("core/Bytes") +S["video/h264"] = function(r: Bytes.Reader): number + local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = __include("core/Bytes") +S["video/mkv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return if brand == "" then 0.6 else 0.8 +end +end + +do -- video/mpegps +local Bytes = __include("core/Bytes") +S["video/mpegps"] = function(r: Bytes.Reader): number + if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = __include("core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r: Bytes.Reader): (number, number) + local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in SIZES do + local hits, need = 0, math.min(3, (n - start - 1) // size + 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits += 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start += 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r: Bytes.Reader): number + local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return if r:remaining() >= 3 * s then 0.9 else 0.5 +end +end + +do -- video/ogv +local Bytes = __include("core/Bytes") +S["video/ogv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size += buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = __include("core/Bytes") +S["video/smk"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = __include("core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r: Bytes.Reader): number + return if r:peek(10) == MAGIC then 1 else 0 +end +end + +do -- model/3ds +local Bytes = __include("core/Bytes") +S["model/3ds"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return if size == r.limit - r.pos then 0.95 else 0.7 +end +end + +do -- model/3mf +local Bytes = __include("core/Bytes") +S["model/3mf"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r: Bytes.Reader): (boolean?, boolean) + local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r: Bytes.Reader, n: number?): string + local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = if r:peek(2) == "\255\254" or r:peek(2) == "\254\255" then 2 else 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r: Bytes.Reader): number + local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = __include("core/Bytes") +S["model/b3d"] = function(r: Bytes.Reader): number + if r:peek(4) == "BB3D" then + return if r:peek(4, 8) ~= "" then 1 else 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["model/blend"] = function(r: Bytes.Reader): number + local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return if inner and buffer.tostring(inner) == "BLENDER" then 1 else 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return if out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" then 1 else 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = __include("core/Bytes") +S["model/bsp"] = function(r: Bytes.Reader): number + if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (if m == "IBSP" then 4 else 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return if v == 38 or v == 46 or v == 47 then 1 else 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = __include("core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b: buffer, o: number, limit: number): (number?, number?, number?, number?) + if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p += 2 + nw * WALL_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p += 2 + nsp * SPRITE_SIZE + return ns, nw, nsp, p +end +S["model/buildmap"] = function(r: Bytes.Reader): number + local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return if stop == limit then 0.9 else 0.5 +end +end + +do -- model/d3map +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/d3map"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return if string.match(head, "^Version%s+[123]%s") then 1 else 0 +end +end + +do -- model/dae +local Bytes = __include("core/Bytes") +S["model/dae"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, "<COLLADA", 1, true) then + return 1 + end + return 0 +end +end + +do -- model/gltf +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["model/gltf"] = function(r: Bytes.Reader): number + if r:peek(4) == "glTF" then + return 1 + end + local head = r:peek(1024) + local s = Sniff.dropBom(head) + if string.find(s, "^%s*{") and string.find(s, "\"asset\"", 1, true) then + return 0.9 + end + if string.find(s, "^%s*{") and (string.find(s, "\"accessors\"", 1, true) or string.find(s, "\"bufferViews\"", 1, true)) then + return 0.6 + end + return 0 +end +end + +do -- model/godot +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/godot"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_scene[%s%]]") then + return 1 + end + return 0 +end +end + +do -- model/iqm +local Bytes = __include("core/Bytes") +local MAGIC = "INTERQUAKEMODEL\0" +S["model/iqm"] = function(r: Bytes.Reader): number + return if r:peek(16) == MAGIC then 1 else 0 +end +end + +do -- model/ldraw +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/ldraw"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 2048, true) + if string.find(head, "^0%s+FILE%s") then + return 0.9 + end + if string.find(head, "\n%s*1%s+%S+" .. string.rep("%s+[-+%deE.]+", 12) .. "%s+[^\n]+%.[dDlL][aAdD][tTrR]%s*\r?\n") then + return 0.8 + end + if string.find(head, "^0[ \t]+%a") and string.find(head, "\n%s*[1-5]%s+%S+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]+%s+[-+%d.]") then + return 0.4 + end + return 0 +end +end + +do -- model/lwo +local Bytes = __include("core/Bytes") +local VERSIONS = { LWO2 = true, LWOB = true, LXOB = true } +S["model/lwo"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local v = r:peek(4, 8) + return if VERSIONS[v] then 1 elseif v == "LWO3" then 0.8 else 0 +end +end + +do -- model/map +local Bytes = __include("core/Bytes") +S["model/map"] = function(r: Bytes.Reader): number + local head = r:peek(math.min(r:remaining(), 4096)) + if #head < 2 or string.find(head, "[%z\1-\8\14-\31]") then + return 0 + end + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + local s = head + local game = false + while true do + local c = string.match(s, "^%s*//[^\n]*\n?()") + if not c then + break + end + if string.match(s, "^%s*//%s*Game:") then + game = true + end + s = string.sub(s, c :: number) + end + local body = string.match(s, '^%s*{%s*"[^"\n]*"%s*"') or string.match(s, "^%s*{%s*{%s*[%(bp]") + if not body then + return if game and string.match(s, "^%s*{") then 0.6 else 0 + end + return if game or string.find(head, '"classname"', 1, true) then 0.9 else 0.6 +end +end + +do -- model/mca +local Bytes = __include("core/Bytes") +local COMPRESSION = { [1] = "gzip", [2] = "zlib", [3] = "none", [4] = "lz4", [127] = "custom" } +S["model/mca"] = function(r: Bytes.Reader): number + local n = r.limit - r.base + if n < 8192 then + return 0 + end + local sectors = (n + 4095) // 4096 + local used, b = 0, r.buf + for i = 0, 1023 do + local e = bit32.byteswap(buffer.readu32(b, r.base + i * 4)) + if e ~= 0 then + local off, cnt = e // 256, e % 256 + if off < 2 or cnt == 0 or off + cnt > sectors then + return 0 + end + used += 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return if used > 0 then 0.8 else 0.2 +end +end + +do -- model/md2 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md2"] = function(r: Bytes.Reader): number + if r:remaining() < 68 then + return 0 + end + return if Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 then 1 else 0 +end +end + +do -- model/md3 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md3"] = function(r: Bytes.Reader): number + if r:remaining() < 108 then + return 0 + end + return if Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 then 1 else 0 +end +end + +do -- model/md5 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md5"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return if string.match(head, "^MD5Version%s+%d+") then 1 else 0 +end +end + +do -- model/mdl +local Bytes = __include("core/Bytes") +S["model/mdl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = __include("core/Bytes") +local Read = lazy(function() + return __include("model/ms3d/Read") +end) +S["model/ms3d"] = function(r: Bytes.Reader): number + local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return if v == 3 or v == 4 then 1 else 0.6 +end +end + +do -- model/obj +local Bytes = __include("core/Bytes") +S["model/obj"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = __include("core/Bytes") +S["model/off"] = function(r: Bytes.Reader): number + local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = __include("core/Bytes") +S["model/ply"] = function(r: Bytes.Reader): number + local h = r:peek(4) + return if h == "ply\n" or h == "ply\r" then 1 else 0 +end +end + +do -- model/pmx +local Bytes = __include("core/Bytes") +S["model/pmx"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/proc"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = __include("core/Bytes") +S["model/qb"] = function(r: Bytes.Reader): number + if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = __include("core/Bytes") +local MAGIC = "<roblox!\137\255\13\10\26\10" +S["model/rbxm"] = function(r: Bytes.Reader): number + return if r:peek(14) == MAGIC then 1 else 0 +end +end + +do -- model/rbxmx +local Bytes = __include("core/Bytes") +local find, format, match, gmatch = string.find, string.format, string.match, string.gmatch +S["model/rbxmx"] = function(r: Bytes.Reader): number + local head = r:peek(256) + head = string.gsub(head, "^\239\187\191", "") + head = string.gsub(head, "^%s*<%?xml[^>]*%?>", "") + if match(head, "^%s*<roblox[%s>]") then + return if find(head, "version=", 1, true) then 1 else 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = __include("core/Bytes") +S["model/robloxmesh"] = function(r: Bytes.Reader): number + return if string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") then 1 else 0 +end +end + +do -- model/schematic +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head: string, hints: { string }): boolean + for _, h in hints do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return if hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) then 1 else 0 +end +end + +do -- model/smd +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/smd"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = __include("core/Bytes") +S["model/sourcemdl"] = function(r: Bytes.Reader): number + if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return if v >= 44 and v <= 49 then 1 else 0 +end +end + +do -- model/stl +local Bytes = __include("core/Bytes") +local function lower5(s: string): boolean + return string.lower(s) == "solid" +end +S["model/stl"] = function(r: Bytes.Reader): number + local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return if string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) then 0.9 else 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/t3d"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/udmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = __include("core/Bytes") +local function isUsdz(r: Bytes.Reader): boolean + if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = __include("core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r: Bytes.Reader): number + if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v >= 19 and v <= 21 then 1 else 0.5 +end +end + +do -- model/vmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/vmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = __include("core/Bytes") +S["model/vox"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" then 1 elseif r:peek(4) == "VOX " then 0.8 else 0 +end +end + +do -- model/vrml +local Bytes = __include("core/Bytes") +S["model/vrml"] = function(r: Bytes.Reader): number + local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return if string.sub(head, 1, 10) == "#VRML V2.0" then 1 elseif string.sub(head, 1, 6) == "#VRML " then 0.6 else 0 +end +end + +do -- model/x +local Bytes = __include("core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "xof " then + return 0 + end + return if ENCODINGS[r:peek(4, 8)] then 1 else 0.5 +end +end + +do -- model/x3d +local Bytes = __include("core/Bytes") +S["model/x3d"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "<X3D[%s>]") or string.find(head, "<!DOCTYPE X3D", 1, true) then + return 1 + end + return 0 +end +end + +do -- cad/step +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["cad/step"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256) + head = string.gsub(head, "^%s*/%*.-%*/", "") + if string.find(head, "^%s*ISO%-10303%-21%s*;") then + return 1 + end + return 0 +end +end + +do -- font/bdf +local Bytes = __include("core/Bytes") +S["font/bdf"] = function(r: Bytes.Reader): number + local head = r:peek(32) + return if string.match(head, "^STARTFONT%s+2%.%d") then 1 else 0 +end +end + +do -- font/bmfont +local Bytes = __include("core/Bytes") +S["font/bmfont"] = function(r: Bytes.Reader): number + local head = r:peek(64) + if string.sub(head, 1, 4) == "BMF\3" then + return 1 + end + if string.match(head, "^info%s+face=") or string.match(head, "^info%s+") and string.find(head, "size=", 1, true) then + return 0.9 + end + if string.find(head, "<font>", 1, true) or (string.find(head, "<?xml", 1, true) and string.find(r:peek(512), "<font>", 1, true)) then + return if string.find(r:peek(512), "<info", 1, true) then 0.9 else 0.3 + end + return 0 +end +end + +do -- font/eot +local Bytes = __include("core/Bytes") +local MAGIC = 0x504C +S["font/eot"] = function(r: Bytes.Reader): number + local h = r:peek(36) + if #h < 36 then + return 0 + end + local ver = string.sub(h, 9, 12) + local magic = string.byte(h, 35) + string.byte(h, 36) * 256 + if magic == MAGIC and (ver == "\0\0\1\0" or ver == "\1\0\2\0" or ver == "\2\0\2\0") then + return 1 + end + return 0 +end +end + +do -- font/fon +local Bytes = __include("core/Bytes") +local function isFnt(h: string): boolean + if #h < 4 then + return false + end + local ver = string.byte(h, 1) + string.byte(h, 2) * 256 + return ver == 0x200 or ver == 0x300 +end +S["font/fon"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "MZ" and #h >= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return if sig == "NE" then 0.6 elseif sig == "PE" then 0.2 else 0 + end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return if size == r:size() then 0.9 elseif size <= r:size() and size > 118 then 0.3 else 0 + end + return 0 +end +end + +do -- font/hershey +local Bytes = __include("core/Bytes") +local function header(line: string): (number?, number?) + if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r: Bytes.Reader): number + local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line :: string, 9) + if string.find(body, "[^ -~]") then + return 0 + end + return if #body == math.min(2 * n, 64) or #body == 2 * n then 0.7 else 0.3 +end +end + +do -- font/pcf +local Bytes = __include("core/Bytes") +S["font/pcf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "\1fcp" then 1 else 0 +end +end + +do -- font/psf +local Bytes = __include("core/Bytes") +S["font/psf"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = __include("core/Bytes") +S["font/ttf"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = __include("core/Bytes") +S["font/type1"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = __include("core/Bytes") +S["font/woff"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOFF" then 1 else 0 +end +end + +do -- font/woff2 +local Bytes = __include("core/Bytes") +S["font/woff2"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOF2" then 1 else 0 +end +end + +do -- archive/7z +local Bytes = __include("core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r: Bytes.Reader): number + return if r:peek(6) == MAGIC then 1 else 0 +end +end + +do -- archive/adf +local Bytes = __include("core/Bytes") +local BS = 512 +S["archive/adf"] = function(r: Bytes.Reader): number + local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return if n == 901120 or n == 1802240 then 0.95 else 0.6 +end +end + +do -- archive/applesingle +local Bytes = __include("core/Bytes") +S["archive/applesingle"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = __include("core/Bytes") +local MAGIC = "!<arch>\n" +S["archive/ar"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return if r:peek(13, 68) == "debian-binary" then 1 else 0.9 + end + return if r:peek(8) == "!<thin>\n" then 0.5 else 0 +end +end + +do -- archive/arj +local Bytes = __include("core/Bytes") +S["archive/arj"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return if size > 0 and size <= 2600 then 0.9 else 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = __include("core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return if at == 1 then 1 else 0.8 +end +end + +do -- archive/br +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Brotli = lazy(function() + return __include("codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r: Bytes.Reader): number + local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return if buffer.len(out) > 0 then 0.3 else 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = __include("core/Bytes") +S["archive/bz2"] = function(r: Bytes.Reader): number + local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = __include("core/Bytes") +S["archive/cab"] = function(r: Bytes.Reader): number + if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = __include("core/Bytes") +S["archive/cpio"] = function(r: Bytes.Reader): number + local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = __include("core/Bytes") +type Geometry = { kind: string, tracks: number, offsets: { number }, spt: { number }, dirTrack: number, total: number } +local function geometry(kind: string, tracks: number): Geometry + local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = if kind == "d71" and t > 35 then t - 35 else t + n = if s <= 17 then 21 elseif s <= 24 then 19 elseif s <= 30 then 18 else 17 + end + offsets[t], spt[t] = o, n + o += n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = if kind == "d81" then 40 else 18, total = o } +end +local function detect(len: number): Geometry? + for _, g in { { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } } :: { { any } } do + local geo = geometry(g[1] :: string, g[2] :: number) + local sectors = geo.total // 256 + if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r: Bytes.Reader): number + local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return if t == 40 and s == 3 and v == 0x44 then 0.9 else 0.3 + end + return if t == 18 and s == 1 and (v == 0x41 or v == 0) then 0.9 else 0.3 +end +end + +do -- archive/fat +local Bytes = __include("core/Bytes") +local Fat = lazy(function() + return __include("containers/Fat") +end) +S["archive/fat"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return if v.partition then 0.6 else 0.8 +end +end + +do -- archive/grp +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = __include("core/Bytes") +S["archive/gzip"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\31\139\8" then 1 else 0 +end +end + +do -- archive/iso +local Bytes = __include("core/Bytes") +S["archive/iso"] = function(r: Bytes.Reader): number + return if r:peek(5, 16 * 2048 + 1) == "CD001" then 1 else 0 +end +end + +do -- archive/lha +local Bytes = __include("core/Bytes") +local METHODS: { [string]: boolean } = { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s: string): boolean + if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r: Bytes.Reader): number + if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = __include("core/Bytes") +S["archive/lz4"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = __include("core/Bytes") +local Crc16 = __include("core/Crc16") +local function version(b: buffer, o: number, len: number): string? + if len < 128 then + return nil + end + local u8 = function(i: number): number + return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i: number): number + return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return if buffer.readstring(b, o + 102, 4) == "mBIN" then "III" else "II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return if need <= len + 127 then "I" else nil +end +S["archive/macbinary"] = function(r: Bytes.Reader): number + local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return if v == "III" then 0.95 elseif v == "II" then 0.8 elseif v == "I" then 0.3 else 0 +end +end + +do -- archive/mpq +local Bytes = __include("core/Bytes") +S["archive/mpq"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["archive/pak"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = __include("core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r: Bytes.Reader): number + return if r:peek(4) == LEAD_MAGIC then 1 else 0 +end +end + +do -- archive/tar +local Bytes = __include("core/Bytes") +local Tar = lazy(function() + return __include("containers/Tar") +end) +S["archive/tar"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return if r:peek(5, 257) == "ustar" then 0.95 else 0.6 +end +end + +do -- archive/unitypackage +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Tar = lazy(function() + return __include("containers/Tar") +end) +local function guidOf(name: string): (string?, string?) + local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r: Bytes.Reader): number + if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z += 1 + end + return if guidOf(buffer.readstring(head, 0, z)) then 1 else 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = __include("core/Bytes") +S["archive/uu"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = __include("core/Bytes") +S["archive/vpk"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return if v == 1 or v == 2 then 1 else 0.5 +end +end + +do -- archive/vswap +local Bytes = __include("core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r: Bytes.Reader): (number?, number, number) + if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r: Bytes.Reader): number + local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero += 1 + end + end + return if nonzero > 0 then 0.6 else 0 +end +end + +do -- archive/wad +local Bytes = __include("core/Bytes") +S["archive/wad"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = __include("core/Bytes") +S["archive/wad2"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return if m == "WAD2" or m == "WAD3" then 0.9 else 0 +end +end + +do -- archive/xz +local Bytes = __include("core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r: Bytes.Reader): number + local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return if d == 0x5D then 0.4 else 0.2 +end +S["archive/xz"] = function(r: Bytes.Reader): number + if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = __include("core/Bytes") +S["archive/yenc"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return if string.find(head, "\n=ybegin [^\n]*name=") then 0.6 else 0 +end +end + +do -- archive/z +local Bytes = __include("core/Bytes") +S["archive/z"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return if f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 then 1 else 0.3 +end +end + +do -- archive/zip +local Bytes = __include("core/Bytes") +S["archive/zip"] = function(r: Bytes.Reader): number + local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = __include("core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r: Bytes.Reader): number + local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return if string.sub(h, 1, 4) == "ZOO " then 1 else 0.8 +end +end + +do -- archive/zst +local Bytes = __include("core/Bytes") +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["archive/zst"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = __include("core/Bytes") +S["data/cbor"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\217\217\247" then 1 else 0 +end +end + +do -- data/csv +local Bytes = __include("core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in { ",", "\t", ";" } do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 :: string, d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = __include("core/Bytes") +S["data/ini"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/json"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = __include("core/Bytes") +S["data/msgpack"] = function(_r: Bytes.Reader): number + return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +S["data/nbt"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return if p.firstType then 1 else 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return if p.firstType and p.firstName then 0.6 else 0.2 +end +end + +do -- data/plist +local Bytes = __include("core/Bytes") +S["data/plist"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, "<!DOCTYPE plist", 1, true) or string.find(head, "<plist", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- data/q3shader +local Bytes = __include("core/Bytes") +local KEYWORDS = { "surfaceparm", "map", "clampmap", "animmap", "blendfunc", "rgbgen", "alphagen", "tcgen", "tcmod", + "cull", "deformvertexes", "qer_editorimage", "nopicmip", "nomipmaps", "skyparms", "q3map_", "depthwrite", "alphafunc" } +S["data/q3shader"] = function(r: Bytes.Reader): number + local head = r:peek(math.min(r:remaining(), 2048)) + if #head < 4 or string.find(head, "[%z\1-\8\14-\31]") then + return 0 + end + local s = string.gsub(string.gsub(head, "/%*.-%*/", " "), "//[^\n]*", "") + if not string.match(s, "^%s*[^%s{}\"]+%s*{") then + return 0 + end + local lower = string.lower(s) + for _, k in KEYWORDS do + if string.find(lower, "%f[%w_]" .. k) then + return 0.7 + end + end + return 0.2 +end +end + +do -- data/q3skin +local Bytes = __include("core/Bytes") +S["data/q3skin"] = function(r: Bytes.Reader): number + local head = r:peek(math.min(r:remaining(), 1024)) + if #head < 3 or string.find(head, "[%z\1-\8\14-\31]") then + return 0 + end + local lines, good, paths = 0, 0, 0 + for line in string.gmatch(head, "[^\r\n]+") do + if not string.match(line, "^%s*$") then + lines += 1 + local surface, shader = string.match(line, "^%s*([%w_%-]+)%s*,%s*([^,%s]*)%s*$") + if surface and shader == "" and string.sub(string.lower(surface), 1, 4) == "tag_" then + good += 1 + elseif shader and string.find(shader, "/", 1, true) then + good += 1 + paths += 1 + end + end + end + return if lines > 0 and good == lines and paths > 0 then 0.5 else 0 +end +end + +do -- data/snbt +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/snbt"] = function(r: Bytes.Reader): number + -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = __include("core/Bytes") +S["data/toml"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in string.gmatch(head, "[^\n]+") do + local l = string.match(line, "^[ \t]*(.-)[ \t\r]*$") :: string + if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/tres"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local KeyValues = lazy(function() + return __include("codecs/text/KeyValues") +end) +S["data/vdf"] = function(r: Bytes.Reader): number + local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/xml"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = __include("core/Bytes") +S["data/yaml"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = __include("core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ldtk"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ogmo"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["vector/svg"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, "<svg[%s>:]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local function head(r: Bytes.Reader): string + local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r: Bytes.Reader): number + local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "<map[%s>]") or string.find(h, "<tileset[%s>]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = if n > 1024 then r:peek(1024, n - 1024) else "" + for _, part in { h, tail } do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = __include("core/Bytes") +S["layered/aseprite"] = function(r: Bytes.Reader): number + if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = __include("core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r: Bytes.Reader): number + -- a zip whose first (stored) entry is "mimetype" holding image/openraster + if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = __include("core/Bytes") +S["layered/psd"] = function(r: Bytes.Reader): number + local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/ass"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits: string): number + return (tonumber(digits) :: number) / 10 ^ #digits +end +local function timing(line: string): (number?, number?, string?) + local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = tonumber(h1) :: number * 3600 + tonumber(m1) :: number * 60 + tonumber(s1) :: number + frac(f1 :: string) + local b = tonumber(h2) :: number * 3600 + tonumber(m2) :: number * 60 + tonumber(s2) :: number + frac(f2 :: string) + return a, b, rest +end +S["subtitle/srt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/vtt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad += 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.6 else 0 +end +end + +do -- music/ahx +local Bytes = __include("core/Bytes") +S["music/ahx"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 then 1 else 0 +end +end + +do -- music/far +local Bytes = __include("core/Bytes") +S["music/far"] = function(r: Bytes.Reader): number + if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = __include("core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r: Bytes.Reader): number + return if r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC then 1 else 0 +end +end + +do -- music/hvl +local Bytes = __include("core/Bytes") +S["music/hvl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 then 1 else 0 +end +end + +do -- music/it +local Bytes = __include("core/Bytes") +S["music/it"] = function(r: Bytes.Reader): number + return if r:peek(4) == "IMPM" then 1 else 0 +end +end + +do -- music/med +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/midi +local Bytes = __include("core/Bytes") +S["music/midi"] = function(r: Bytes.Reader): number + if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = __include("core/Bytes") +local FIXED: { [string]: number } = { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig: string): number? + local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = tonumber(d) :: number + return if n >= 1 then n else nil + end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = tonumber(dd) :: number + return if n >= 1 and n <= 32 then n else nil + end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = tonumber(t) :: number + return if n >= 1 then n else nil + end + return nil +end +S["music/mod"] = function(r: Bytes.Reader): number + if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = __include("core/Bytes") +S["music/mtm"] = function(r: Bytes.Reader): number + if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = __include("core/Bytes") +S["music/mus"] = function(r: Bytes.Reader): number + return if r:peek(4) == "MUS\x1a" then 1 else 0 +end +end + +do -- music/okt +local Bytes = __include("core/Bytes") +S["music/okt"] = function(r: Bytes.Reader): number + return if r:peek(8) == "OKTASONG" then 1 else 0 +end +end + +do -- music/ptm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/s3m +local Bytes = __include("core/Bytes") +S["music/s3m"] = function(r: Bytes.Reader): number + if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = __include("core/Bytes") +local SoundFont = lazy(function() + return __include("codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r: Bytes.Reader): number + return if SoundFont.sniff(r) then 1 else 0 +end +end + +do -- music/stm +local Bytes = __include("core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.7 else 0 +end +end + +do -- music/ult +local Bytes = __include("core/Bytes") +S["music/ult"] = function(r: Bytes.Reader): number + local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = __include("core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" +type Header = { version: number, nameCount: number, nameOffset: number, exportCount: number, exportOffset: number, importCount: number, importOffset: number } +local function header(r: Bytes.Reader): Header? + if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd: Header = { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r: Bytes.Reader): number + local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v += (b % 128) * 2 ^ shift + shift += 7 + until b < 0x80 or shift >= 32 + end + return if neg then -v else v +end +local function names(r: Bytes.Reader, h: Header): { string } + local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r: Bytes.Reader): number + local h = header(r) + if not h then + return 0 + end + return if table.find(names(r, h), "music") then 1 else 0.3 +end +end + +do -- music/xm +local Bytes = __include("core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r: Bytes.Reader): number + return if r:peek(17) == MAGIC then 1 else 0 +end +end + +do -- music/xmi +local Bytes = __include("core/Bytes") +S["music/xmi"] = function(r: Bytes.Reader): number + local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return if id == "CAT " and kind == "XMID" then 0.9 else 0 +end +end + +do -- playlist/m3u +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["playlist/m3u"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 512) + s = (string.match(s, "^%s*(.*)$") :: string) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +S["playlist/pls"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return if first and string.lower(Text.trim(first)) == "[playlist]" then 0.95 else 0 +end +end + +do -- playlist/xspf +local Bytes = __include("core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r: Bytes.Reader): number + local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S +end +end + + + + archive_1 --!optimize 2 @@ -82637,7 +86278,7 @@ end - + archive_2 --!optimize 2 @@ -83497,7 +87138,7 @@ end - + audio --!optimize 2 @@ -91627,7 +95268,7 @@ end - + cad --!optimize 2 @@ -93062,7 +96703,7 @@ end - + codecs_audio --!optimize 2 @@ -99310,7 +102951,7 @@ end - + codecs_compress --!optimize 2 @@ -102351,7 +105992,7 @@ end - + codecs_entropy --!optimize 2 @@ -103127,7 +106768,7 @@ end - + codecs_font --!optimize 2 @@ -105340,7 +108981,7 @@ end - + codecs_image --!optimize 2 @@ -108395,7 +112036,7 @@ end - + codecs_model --!optimize 2 @@ -116474,7 +120115,7 @@ end - + codecs_text --!optimize 2 @@ -122676,7 +126317,7 @@ end - + codecs_video --!optimize 2 @@ -122975,7 +126616,7 @@ end - + containers --!optimize 2 @@ -131358,7 +134999,7 @@ end - + core --!optimize 2 @@ -132191,7 +135832,7 @@ end - + data --!optimize 2 @@ -137945,7 +141586,7 @@ end - + font --!optimize 2 @@ -141854,7 +145495,7 @@ end - + host --!optimize 2 @@ -142442,7 +146083,7 @@ end - + image_1 --!optimize 2 @@ -150286,7 +153927,7 @@ end - + image_2 --!optimize 2 @@ -154035,7 +157676,7 @@ end - + layered --!optimize 2 @@ -156160,7 +159801,7 @@ end - + model_1 --!optimize 2 @@ -163693,7 +167334,7 @@ end - + model_2 --!optimize 2 @@ -170491,7 +174132,7 @@ end - + model_3 --!optimize 2 @@ -177861,7 +181502,7 @@ end - + model_4 --!optimize 2 @@ -185269,7 +188910,7 @@ end - + model_5 --!optimize 2 @@ -193327,7 +196968,7 @@ end - + model_6 --!optimize 2 @@ -201292,7 +204933,7 @@ end - + model_7 --!optimize 2 @@ -202243,7 +205884,7 @@ end - + music --!optimize 2 @@ -207848,7 +211489,7 @@ end - + ops --!optimize 2 @@ -210089,7 +213730,7 @@ end - + playlist --!optimize 2 @@ -210836,7 +214477,7 @@ end - + subtitle --!optimize 2 @@ -211669,7 +215310,7 @@ end - + vector --!optimize 2 @@ -217683,7 +221324,7 @@ end - + video --!optimize 2 diff --git a/build/rosetta.lua b/build/rosetta.lua index 1a4d2b6..84cb697 100644 --- a/build/rosetta.lua +++ b/build/rosetta.lua @@ -748,6 +748,56 @@ end local LATE= { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order= nil +local byExt= {} +local Sniffs= nil + +local function sniffOrder() +local o = order + if o then + return o + end + local list= {} + for idx, e in __iter(Registry) do + table.insert(list, idx) + for _, x in __iter(e.extensions) do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx) +local e = Registry[idx] + return LATE[e.name] and 3 or e.sniff + end + table.sort(list, function(a, b) +local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e) +if e.sniff < 2 then + local s = Sniffs + if not s then + s = (__include("Sniffs") ) +Sniffs = s + end + local f = (s )[e.path] + if f then + return f + end + end + local m = module(e) + return (m and type(m.sniff) == "function" and{m.sniff }or{nil +})[1]end + local function detect(buf, name, category, format) if format then local e = find(format, category) @@ -757,52 +807,35 @@ if format then return e, nil end local ext = Input.extension(name) - local best= nil + local list = sniffOrder() + local hits = (ext and{byExt[ext] }or{nil +})[1] local best= nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late= nil - for idx, e in __iter(Registry) do -local __DARKLUA_CONTINUE_3=false repeat if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late , idx) -__DARKLUA_CONTINUE_3=true break - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score =score+ 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = (pass == 1 and{hits }or{list +})[1] if ids then + for _, idx in __iter(ids) do + if pass == 2 and bestScore > 1 then + break end - end - end -__DARKLUA_CONTINUE_3=true until true if not __DARKLUA_CONTINUE_3 then break end end - if late then - for _, idx in __iter(late) do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (extHit and 0.01 or 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score =score+ 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (extHit and 0.01 or 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score =score+ 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -1366,8 +1399,8 @@ local o= opts or {} return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) - if m and type(m.variant) == "function" then + local m = (entry.variant and{(module(entry) )}or{nil +})[1] if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then return v, nil @@ -1556,6 +1589,10 @@ __FILES["Registry"] = function() -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). + + @@ -1576,6 +1613,7 @@ local list= { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return __include("image/ani") end, @@ -1588,6 +1626,7 @@ local list= { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/art") end, @@ -1600,6 +1639,7 @@ local list= { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return __include("image/blp") end, @@ -1612,6 +1652,7 @@ local list= { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return __include("image/bmp") end, @@ -1624,6 +1665,7 @@ local list= { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return __include("image/dds") end, @@ -1636,6 +1678,7 @@ local list= { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return __include("image/exr") end, @@ -1648,6 +1691,7 @@ local list= { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return __include("image/gif") end, @@ -1660,6 +1704,7 @@ local list= { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return __include("image/hdr") end, @@ -1672,6 +1717,7 @@ local list= { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return __include("image/icns") end, @@ -1684,6 +1730,7 @@ local list= { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/ico") end, @@ -1696,6 +1743,7 @@ local list= { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/ilbm") end, @@ -1708,6 +1756,7 @@ local list= { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return __include("image/jpeg") end, @@ -1720,6 +1769,7 @@ local list= { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return __include("image/ktx") end, @@ -1732,6 +1782,7 @@ local list= { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return __include("image/lmp") end, @@ -1744,6 +1795,7 @@ local list= { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/pcx") end, @@ -1756,6 +1808,7 @@ local list= { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return __include("image/png") end, @@ -1768,6 +1821,7 @@ local list= { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/pnm") end, @@ -1780,6 +1834,7 @@ local list= { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/qoi") end, @@ -1792,6 +1847,7 @@ local list= { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return __include("image/sgi") end, @@ -1804,6 +1860,7 @@ local list= { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return __include("image/spr") end, @@ -1816,6 +1873,7 @@ local list= { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return __include("image/sunras") end, @@ -1828,6 +1886,7 @@ local list= { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return __include("image/tga") end, @@ -1840,6 +1899,7 @@ local list= { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return __include("image/tiff") end, @@ -1852,6 +1912,7 @@ local list= { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return __include("image/tim") end, @@ -1864,6 +1925,7 @@ local list= { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return __include("image/vtf") end, @@ -1876,6 +1938,7 @@ local list= { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/webp") end, @@ -1888,6 +1951,7 @@ local list= { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return __include("image/xbm") end, @@ -1900,6 +1964,7 @@ local list= { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return __include("image/xpm") end, @@ -1912,6 +1977,7 @@ local list= { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return __include("audio/aac") end, @@ -1924,6 +1990,7 @@ local list= { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/ac3") end, @@ -1936,6 +2003,7 @@ local list= { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return __include("audio/adpcm") end, @@ -1948,6 +2016,7 @@ local list= { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/adx") end, @@ -1960,6 +2029,7 @@ local list= { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/aiff") end, @@ -1972,6 +2042,7 @@ local list= { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return __include("audio/ape") end, @@ -1984,6 +2055,7 @@ local list= { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return __include("audio/au") end, @@ -1996,6 +2068,8 @@ local list= { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return __include("audio/brstm") end, @@ -2008,6 +2082,7 @@ local list= { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return __include("audio/caf") end, @@ -2020,6 +2095,7 @@ local list= { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return __include("audio/flac") end, @@ -2032,6 +2108,7 @@ local list= { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return __include("audio/m4a") end, @@ -2044,6 +2121,7 @@ local list= { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return __include("audio/mp3") end, @@ -2056,6 +2134,7 @@ local list= { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return __include("audio/mpc") end, @@ -2068,6 +2147,7 @@ local list= { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return __include("audio/opus") end, @@ -2080,6 +2160,7 @@ local list= { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return __include("audio/qoa") end, @@ -2092,6 +2173,7 @@ local list= { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return __include("audio/tta") end, @@ -2104,6 +2186,7 @@ local list= { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return __include("audio/vag") end, @@ -2116,6 +2199,7 @@ local list= { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return __include("audio/voc") end, @@ -2128,6 +2212,7 @@ local list= { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return __include("audio/vorbis") end, @@ -2140,6 +2225,7 @@ local list= { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return __include("audio/wav") end, @@ -2152,6 +2238,7 @@ local list= { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return __include("audio/wavpack") end, @@ -2164,6 +2251,7 @@ local list= { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return __include("video/avi") end, @@ -2176,6 +2264,7 @@ local list= { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return __include("video/fli") end, @@ -2188,6 +2277,7 @@ local list= { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return __include("video/flv") end, @@ -2200,6 +2290,7 @@ local list= { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return __include("video/h264") end, @@ -2212,6 +2303,8 @@ local list= { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return __include("video/mkv") end, @@ -2224,6 +2317,7 @@ local list= { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return __include("video/mp4") end, @@ -2236,6 +2330,7 @@ local list= { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegps") end, @@ -2248,6 +2343,7 @@ local list= { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return __include("video/mpegts") end, @@ -2260,6 +2356,7 @@ local list= { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return __include("video/ogv") end, @@ -2272,6 +2369,7 @@ local list= { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return __include("video/smk") end, @@ -2284,6 +2382,7 @@ local list= { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return __include("video/y4m") end, @@ -2296,6 +2395,7 @@ local list= { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return __include("model/3ds") end, @@ -2308,6 +2408,7 @@ local list= { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return __include("model/3mf") end, @@ -2320,6 +2421,7 @@ local list= { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return __include("model/ase") end, @@ -2332,6 +2434,7 @@ local list= { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return __include("model/b3d") end, @@ -2344,6 +2447,7 @@ local list= { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return __include("model/blend") end, @@ -2356,6 +2460,7 @@ local list= { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return __include("model/bsp") end, @@ -2368,6 +2473,7 @@ local list= { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return __include("model/buildmap") end, @@ -2380,6 +2486,7 @@ local list= { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return __include("model/d3map") end, @@ -2392,6 +2499,7 @@ local list= { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return __include("model/dae") end, @@ -2404,6 +2512,7 @@ local list= { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return __include("model/fbx") end, @@ -2416,6 +2525,7 @@ local list= { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return __include("model/gltf") end, @@ -2428,6 +2538,7 @@ local list= { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return __include("model/godot") end, @@ -2440,6 +2551,7 @@ local list= { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/iqm") end, @@ -2452,6 +2564,7 @@ local list= { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return __include("model/ldraw") end, @@ -2464,6 +2577,7 @@ local list= { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return __include("model/lwo") end, @@ -2476,6 +2590,7 @@ local list= { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return __include("model/map") end, @@ -2488,6 +2603,7 @@ local list= { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return __include("model/mca") end, @@ -2500,6 +2616,7 @@ local list= { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return __include("model/md2") end, @@ -2512,6 +2629,7 @@ local list= { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return __include("model/md3") end, @@ -2524,6 +2642,7 @@ local list= { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/md5") end, @@ -2536,6 +2655,7 @@ local list= { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/mdl") end, @@ -2548,6 +2668,7 @@ local list= { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return __include("model/ms3d") end, @@ -2560,6 +2681,7 @@ local list= { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/obj") end, @@ -2572,6 +2694,7 @@ local list= { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return __include("model/off") end, @@ -2584,6 +2707,7 @@ local list= { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return __include("model/ply") end, @@ -2596,6 +2720,7 @@ local list= { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return __include("model/pmx") end, @@ -2608,6 +2733,7 @@ local list= { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return __include("model/proc") end, @@ -2620,6 +2746,7 @@ local list= { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return __include("model/qb") end, @@ -2632,6 +2759,8 @@ local list= { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return __include("model/rbxm") end, @@ -2644,6 +2773,8 @@ local list= { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return __include("model/rbxmx") end, @@ -2656,6 +2787,7 @@ local list= { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return __include("model/robloxmesh") end, @@ -2668,6 +2800,8 @@ local list= { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return __include("model/schematic") end, @@ -2680,6 +2814,7 @@ local list= { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return __include("model/smd") end, @@ -2692,6 +2827,7 @@ local list= { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return __include("model/sourcemdl") end, @@ -2704,6 +2840,7 @@ local list= { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return __include("model/stl") end, @@ -2716,6 +2853,7 @@ local list= { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return __include("model/t3d") end, @@ -2728,6 +2866,7 @@ local list= { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return __include("model/udmf") end, @@ -2740,6 +2879,7 @@ local list= { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return __include("model/usda") end, @@ -2752,6 +2892,7 @@ local list= { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return __include("model/vbsp") end, @@ -2764,6 +2905,7 @@ local list= { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return __include("model/vmf") end, @@ -2776,6 +2918,7 @@ local list= { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return __include("model/vox") end, @@ -2788,6 +2931,7 @@ local list= { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return __include("model/vrml") end, @@ -2800,6 +2944,7 @@ local list= { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return __include("model/x") end, @@ -2812,6 +2957,7 @@ local list= { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return __include("model/x3d") end, @@ -2824,6 +2970,7 @@ local list= { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return __include("cad/step") end, @@ -2836,6 +2983,7 @@ local list= { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return __include("font/bdf") end, @@ -2848,6 +2996,7 @@ local list= { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return __include("font/bmfont") end, @@ -2860,6 +3009,7 @@ local list= { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return __include("font/eot") end, @@ -2872,6 +3022,7 @@ local list= { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return __include("font/fon") end, @@ -2884,6 +3035,7 @@ local list= { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return __include("font/hershey") end, @@ -2896,6 +3048,7 @@ local list= { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return __include("font/pcf") end, @@ -2908,6 +3061,7 @@ local list= { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return __include("font/psf") end, @@ -2920,6 +3074,7 @@ local list= { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return __include("font/ttf") end, @@ -2932,6 +3087,7 @@ local list= { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return __include("font/type1") end, @@ -2944,6 +3100,7 @@ local list= { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return __include("font/woff") end, @@ -2956,6 +3113,7 @@ local list= { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return __include("font/woff2") end, @@ -2968,6 +3126,7 @@ local list= { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return __include("archive/7z") end, @@ -2980,6 +3139,7 @@ local list= { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return __include("archive/adf") end, @@ -2992,6 +3152,7 @@ local list= { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return __include("archive/applesingle") end, @@ -3004,6 +3165,7 @@ local list= { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return __include("archive/ar") end, @@ -3016,6 +3178,7 @@ local list= { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return __include("archive/arj") end, @@ -3028,6 +3191,7 @@ local list= { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return __include("archive/binhex") end, @@ -3040,6 +3204,7 @@ local list= { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/br") end, @@ -3052,6 +3217,7 @@ local list= { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return __include("archive/bz2") end, @@ -3064,6 +3230,7 @@ local list= { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return __include("archive/cab") end, @@ -3076,6 +3243,7 @@ local list= { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return __include("archive/cpio") end, @@ -3088,6 +3256,7 @@ local list= { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return __include("archive/d64") end, @@ -3100,6 +3269,7 @@ local list= { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return __include("archive/fat") end, @@ -3112,6 +3282,7 @@ local list= { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("archive/grp") end, @@ -3124,6 +3295,7 @@ local list= { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return __include("archive/gzip") end, @@ -3136,6 +3308,7 @@ local list= { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return __include("archive/iso") end, @@ -3148,6 +3321,7 @@ local list= { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return __include("archive/lha") end, @@ -3160,6 +3334,7 @@ local list= { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return __include("archive/lz4") end, @@ -3172,6 +3347,7 @@ local list= { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return __include("archive/macbinary") end, @@ -3184,6 +3360,7 @@ local list= { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return __include("archive/mpq") end, @@ -3196,6 +3373,7 @@ local list= { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return __include("archive/pak") end, @@ -3208,6 +3386,7 @@ local list= { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return __include("archive/rpm") end, @@ -3220,6 +3399,7 @@ local list= { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return __include("archive/tar") end, @@ -3232,6 +3412,7 @@ local list= { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("archive/unitypackage") end, @@ -3244,6 +3425,7 @@ local list= { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return __include("archive/uu") end, @@ -3256,6 +3438,7 @@ local list= { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return __include("archive/vpk") end, @@ -3268,6 +3451,7 @@ local list= { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return __include("archive/vswap") end, @@ -3280,6 +3464,7 @@ local list= { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return __include("archive/wad") end, @@ -3292,6 +3477,7 @@ local list= { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return __include("archive/wad2") end, @@ -3304,6 +3490,7 @@ local list= { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return __include("archive/xz") end, @@ -3316,6 +3503,7 @@ local list= { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return __include("archive/yenc") end, @@ -3328,6 +3516,7 @@ local list= { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return __include("archive/z") end, @@ -3340,6 +3529,7 @@ local list= { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return __include("archive/zip") end, @@ -3352,6 +3542,7 @@ local list= { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return __include("archive/zoo") end, @@ -3364,6 +3555,7 @@ local list= { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return __include("archive/zst") end, @@ -3376,6 +3568,7 @@ local list= { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return __include("data/cbor") end, @@ -3388,6 +3581,7 @@ local list= { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return __include("data/csv") end, @@ -3400,6 +3594,7 @@ local list= { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/ini") end, @@ -3412,6 +3607,7 @@ local list= { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return __include("data/json") end, @@ -3424,6 +3620,7 @@ local list= { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return __include("data/msgpack") end, @@ -3436,6 +3633,7 @@ local list= { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return __include("data/nbt") end, @@ -3448,6 +3646,7 @@ local list= { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return __include("data/plist") end, @@ -3460,6 +3659,7 @@ local list= { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3shader") end, @@ -3472,6 +3672,7 @@ local list= { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("data/q3skin") end, @@ -3484,6 +3685,7 @@ local list= { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return __include("data/snbt") end, @@ -3496,6 +3698,7 @@ local list= { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return __include("data/toml") end, @@ -3508,6 +3711,7 @@ local list= { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return __include("data/tres") end, @@ -3520,6 +3724,7 @@ local list= { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return __include("data/vdf") end, @@ -3532,6 +3737,7 @@ local list= { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return __include("data/xml") end, @@ -3544,6 +3750,7 @@ local list= { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return __include("data/yaml") end, @@ -3556,6 +3763,7 @@ local list= { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return __include("vector/gamemaps") end, @@ -3568,6 +3776,7 @@ local list= { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return __include("vector/ldtk") end, @@ -3580,6 +3789,7 @@ local list= { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return __include("vector/ogmo") end, @@ -3592,6 +3802,7 @@ local list= { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return __include("vector/svg") end, @@ -3604,6 +3815,7 @@ local list= { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return __include("vector/tiled") end, @@ -3616,6 +3828,7 @@ local list= { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/aseprite") end, @@ -3628,6 +3841,7 @@ local list= { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return __include("layered/ora") end, @@ -3640,6 +3854,7 @@ local list= { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return __include("layered/psd") end, @@ -3652,6 +3867,7 @@ local list= { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/ass") end, @@ -3664,6 +3880,7 @@ local list= { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return __include("subtitle/srt") end, @@ -3676,6 +3893,7 @@ local list= { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return __include("subtitle/vtt") end, @@ -3688,6 +3906,7 @@ local list= { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return __include("music/669") end, @@ -3700,6 +3919,7 @@ local list= { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return __include("music/ahx") end, @@ -3712,6 +3932,7 @@ local list= { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return __include("music/far") end, @@ -3724,6 +3945,7 @@ local list= { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return __include("music/hmp") end, @@ -3736,6 +3958,7 @@ local list= { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return __include("music/hvl") end, @@ -3748,6 +3971,7 @@ local list= { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return __include("music/it") end, @@ -3760,6 +3984,7 @@ local list= { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/med") end, @@ -3772,6 +3997,7 @@ local list= { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return __include("music/midi") end, @@ -3784,6 +4010,7 @@ local list= { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mod") end, @@ -3796,6 +4023,7 @@ local list= { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/mtm") end, @@ -3808,6 +4036,7 @@ local list= { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return __include("music/mus") end, @@ -3820,6 +4049,7 @@ local list= { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return __include("music/okt") end, @@ -3832,6 +4062,7 @@ local list= { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ptm") end, @@ -3844,6 +4075,7 @@ local list= { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/s3m") end, @@ -3856,6 +4088,7 @@ local list= { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return __include("music/sf2") end, @@ -3868,6 +4101,7 @@ local list= { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return __include("music/stm") end, @@ -3880,6 +4114,7 @@ local list= { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return __include("music/ult") end, @@ -3892,6 +4127,7 @@ local list= { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return __include("music/umx") end, @@ -3904,6 +4140,7 @@ local list= { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return __include("music/xm") end, @@ -3916,6 +4153,7 @@ local list= { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return __include("music/xmi") end, @@ -3928,6 +4166,7 @@ local list= { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return __include("playlist/m3u") end, @@ -3940,6 +4179,7 @@ local list= { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return __include("playlist/pls") end, @@ -3952,6 +4192,7 @@ local list= { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return __include("playlist/xspf") end, @@ -3960,6 +4201,3392 @@ local list= { return list end +__FILES["Sniffs"] = function() +local __compat = __compat local buffer, bit32, __iter = __compat.buffer, __compat.bit32, __compat.__iter --!strict +--!optimize 2 +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S= {} + +local function lazy(load) +local proxy = {} + return setmetatable(proxy, { + __index = function(_, k) +local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = __include("core/Bytes") +S["image/ani"] = function(r) +return r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" and 1 or 0 +end +end + +do -- image/art +local Bytes = __include("core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b, o, limit) +local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p =p+ 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r) +local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at +if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total =total+ w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return size == have and 0.9 or(size < have and have - size < 4096 and 0.5 or 0 +)end +end + +do -- image/blp +local Bytes = __include("core/Bytes") +S["image/blp"] = function(r) +local m = r:peek(4) + return (m == "BLP1" or m == "BLP2" )and 1 or(m == "BLP0" and 0.8 or 0 +)end +end + +do -- image/bmp +local Bytes = __include("core/Bytes") +S["image/bmp"] = function(r) +if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r) +return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r) +return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = __include("core/Bytes") +S["image/gif"] = function(r) +local s = r:peek(6) + return (s == "GIF89a" or s == "GIF87a" )and 1 or 0 +end +end + +do -- image/hdr +local Bytes = __include("core/Bytes") +S["image/hdr"] = function(r) +local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/icns"] = function(r) +return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = __include("core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r) +if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = __include("core/Bytes") +S["image/ilbm"] = function(r) +if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return (t == "ILBM" or t == "PBM " )and 1 or 0 +end +end + +do -- image/jpeg +local Bytes = __include("core/Bytes") +S["image/jpeg"] = function(r) +local s = r:peek(3) + return s == "\255\216\255" and 1 or 0 +end +end + +do -- image/ktx +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r) +return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = __include("core/Bytes") +local function kindOf(r) +local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r) +local k = kindOf(r) + return k == "qpic" and 0.3 or(k and 0.05 or 0 +)end +end + +do -- image/pcx +local Bytes = __include("core/Bytes") +S["image/pcx"] = function(r) +if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return (bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 )and 0.8 or 0 +end +end + +do -- image/png +local Bytes = __include("core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r) +return r:peek(8) == SIGNATURE and 1 or 0 +end +end + +do -- image/pnm +local Bytes = __include("core/Bytes") +S["image/pnm"] = function(r) +if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = __include("core/Bytes") +S["image/qoi"] = function(r) +return r:peek(4) == "qoif" and 1 or 0 +end +end + +do -- image/sgi +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/sgi"] = function(r) +if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return st <= 1 and (bpc == 1 or bpc == 2) and 1 or 0 +end +end + +do -- image/spr +local Bytes = __include("core/Bytes") +S["image/spr"] = function(r) +if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return (v == 1 or v == 2 or v == 32 )and 1 or 0.3 +end +end + +do -- image/sunras +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r) +return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = __include("core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 + + + + + + + + + + + + +local function header(r) +if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q) +return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h= { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h) +local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r) +local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = __include("core/Bytes") +S["image/tiff"] = function(r) +local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = __include("core/Bytes") +S["image/tim"] = function(r) +if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = __include("core/Bytes") +S["image/vtf"] = function(r) +return r:peek(4) == "VTF\0" and r:peekU8(4) == 7 and 1 or 0 +end +end + +do -- image/webp +local Bytes = __include("core/Bytes") +S["image/webp"] = function(r) +if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xbm"] = function(r) +local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["image/xpm"] = function(r) +local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = __include("core/Bytes") +local Aac = lazy(function() + return __include("codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b, p, limit) +if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = bit32.band(readu8(b, p + 5), 0x10) ~= 0 and 10 or 0 + return 10 + s + footer +end +S["audio/aac"] = function(r) +local b, p, limit = r.buf, r.pos, r.limit + p =p+ id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return p + h.frameSize >= limit and 0.7 or 0.4 +end +end + +do -- audio/ac3 +local Bytes = __include("core/Bytes") +local Ac3 = lazy(function() + return __include("codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r) +local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return p + h.frameSize >= limit and 0.6 or 0.3 +end +end + +do -- audio/adpcm +local Bytes = __include("core/Bytes") +S["audio/adpcm"] = function(_r) +return 0 +end +end + +do -- audio/adx +local Bytes = __include("core/Bytes") +S["audio/adx"] = function(r) +if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return r:peek(6, off - 2) == "(c)CRI" and 1 or 0 +end +end + +do -- audio/aiff +local Bytes = __include("core/Bytes") +S["audio/aiff"] = function(r) +if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return (form == "AIFF" or form == "AIFC" )and 1 or 0 +end +end + +do -- audio/ape +local Bytes = __include("core/Bytes") +S["audio/ape"] = function(r) +local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (footer and 10 or 0)) + return (id == "MAC " or id == "MACF" )and 1 or 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = __include("core/Bytes") +S["audio/au"] = function(r) +return r:peek(4) == ".snd" and 1 or 0 +end +end + +do -- audio/brstm +local Bytes = __include("core/Bytes") +S["audio/brstm"] = function(r) +local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return (bom == "\254\255" or bom == "\255\254" )and 1 or 0 +end +end + +do -- audio/caf +local Bytes = __include("core/Bytes") +S["audio/caf"] = function(r) +local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = __include("core/Bytes") +S["audio/flac"] = function(r) +local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return r:peek(4, 10 + sz + (footer and 10 or 0)) == "fLaC" and 1 or 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local AUDIO_BRANDS= { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r) +local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = __include("core/Bytes") +local Header = lazy(function() + return __include("codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return __include("audio/mp3/Tags") +end) +S["audio/mp3"] = function(r) +local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = (p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" and{(Tags.id3v2Size(b, p, lim) )}or{0 +})[1] if n <= 0 then + break + end + id3 = true + p =p+ n + end + if p + 4 > lim or not Header.valid(b, p) then + return id3 and 0.5 or 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb =fb+ Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return id3 and 0.7 or 0.25 +end +end + +do -- audio/mpc +local Bytes = __include("core/Bytes") +local Musepack = lazy(function() + return __include("codecs/audio/Musepack") +end) +local function id3v2(b, p, limit) +if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n =n+ bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 and 10 or 0) +end +S["audio/mpc"] = function(r) +local b, p, limit = r.buf, r.pos, r.limit + p =p+ id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return v == 7 and 0.9 or 0 +end +end + +do -- audio/opus +local Bytes = __include("core/Bytes") +S["audio/opus"] = function(r) +if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return r:peek(8, 27 + nseg) == "OpusHead" and 1 or 0 +end +end + +do -- audio/qoa +local Bytes = __include("core/Bytes") +S["audio/qoa"] = function(r) +return r:peek(4) == "qoaf" and 1 or 0 +end +end + +do -- audio/tta +local Bytes = __include("core/Bytes") +local function id3Size(r) +if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (footer and 10 or 0) +end +S["audio/tta"] = function(r) +return r:peek(4, id3Size(r)) == "TTA1" and 1 or 0 +end +end + +do -- audio/vag +local Bytes = __include("core/Bytes") +S["audio/vag"] = function(r) +local m = r:peek(4) + return (m == "VAGp" or m == "VAGi" or m == "KVAG" )and 1 or 0 +end +end + +do -- audio/voc +local Bytes = __include("core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r) +return r:peek(20) == MAGIC and 1 or 0 +end +end + +do -- audio/vorbis +local Bytes = __include("core/Bytes") +S["audio/vorbis"] = function(r) +if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" and 1 or 0 +end +end + +do -- audio/wav +local Bytes = __include("core/Bytes") +local Riff = lazy(function() + return __include("containers/Riff") +end) +S["audio/wav"] = function(r) +return Riff.sniff(r) == "WAVE" and 1 or 0 +end +end + +do -- audio/wavpack +local Bytes = __include("core/Bytes") +S["audio/wavpack"] = function(r) +if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return v == 4 and 1 or 0.5 +end +end + +do -- video/avi +local Bytes = __include("core/Bytes") +S["video/avi"] = function(r) +if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = __include("core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r) +local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = __include("core/Bytes") +S["video/flv"] = function(r) +if r:remaining() >= 9 and r:peek(3) == "FLV" then + return r:peekU8(3) == 1 and 1 or 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = __include("core/Bytes") +S["video/h264"] = function(r) +local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = __include("core/Bytes") +S["video/mkv"] = function(r) +if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = __include("core/Bytes") +local IsoBmff = lazy(function() + return __include("containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r) +local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return brand == "" and 0.6 or 0.8 +end +end + +do -- video/mpegps +local Bytes = __include("core/Bytes") +S["video/mpegps"] = function(r) +if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = __include("core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r) +local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in __iter(SIZES) do + local hits, need = 0, math.min(3, math.floor((n - start - 1) / size )+ 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits =hits+ 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start =start+ 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r) +local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return r:remaining() >= 3 * s and 0.9 or 0.5 +end +end + +do -- video/ogv +local Bytes = __include("core/Bytes") +S["video/ogv"] = function(r) +if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size =size+ buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = __include("core/Bytes") +S["video/smk"] = function(r) +local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = __include("core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r) +return r:peek(10) == MAGIC and 1 or 0 +end +end + +do -- model/3ds +local Bytes = __include("core/Bytes") +S["model/3ds"] = function(r) +local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return size == r.limit - r.pos and 0.95 or 0.7 +end +end + +do -- model/3mf +local Bytes = __include("core/Bytes") +S["model/3mf"] = function(r) +if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r) +local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r, n) +local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = (r:peek(2) == "\255\254" or r:peek(2) == "\254\255" )and 2 or 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r) +local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = __include("core/Bytes") +S["model/b3d"] = function(r) +if r:peek(4) == "BB3D" then + return r:peek(4, 8) ~= "" and 1 or 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["model/blend"] = function(r) +local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return inner and buffer.tostring(inner) == "BLENDER" and 1 or 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" and 1 or 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = __include("core/Bytes") +S["model/bsp"] = function(r) +if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (m == "IBSP" and 4 or 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return (v == 38 or v == 46 or v == 47 )and 1 or 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = __include("core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b, o, limit) +if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p =p+ (2 + nw * WALL_SIZE +) if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p =p+ (2 + nsp * SPRITE_SIZE +) return ns, nw, nsp, p +end +S["model/buildmap"] = function(r) +local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return stop == limit and 0.9 or 0.5 +end +end + +do -- model/d3map +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/d3map"] = function(r) +local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return string.match(head, "^Version%s+[123]%s") and 1 or 0 +end +end + +do -- model/dae +local Bytes = __include("core/Bytes") +S["model/dae"] = function(r) +local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, " sectors then + return 0 + end + used =used+ 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return used > 0 and 0.8 or 0.2 +end +end + +do -- model/md2 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md2"] = function(r) +if r:remaining() < 68 then + return 0 + end + return Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 and 1 or 0 +end +end + +do -- model/md3 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md3"] = function(r) +if r:remaining() < 108 then + return 0 + end + return Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 and 1 or 0 +end +end + +do -- model/md5 +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/md5"] = function(r) +local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return string.match(head, "^MD5Version%s+%d+") and 1 or 0 +end +end + +do -- model/mdl +local Bytes = __include("core/Bytes") +S["model/mdl"] = function(r) +local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = __include("core/Bytes") +local Read = lazy(function() + return __include("model/ms3d/Read") +end) +S["model/ms3d"] = function(r) +local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return (v == 3 or v == 4 )and 1 or 0.6 +end +end + +do -- model/obj +local Bytes = __include("core/Bytes") +S["model/obj"] = function(r) +local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = __include("core/Bytes") +S["model/off"] = function(r) +local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = __include("core/Bytes") +S["model/ply"] = function(r) +local h = r:peek(4) + return (h == "ply\n" or h == "ply\r" )and 1 or 0 +end +end + +do -- model/pmx +local Bytes = __include("core/Bytes") +S["model/pmx"] = function(r) +local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/proc"] = function(r) +local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = __include("core/Bytes") +S["model/qb"] = function(r) +if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = __include("core/Bytes") +local MAGIC = "]*%?>", "") + if match(head, "^%s*]") then + return find(head, "version=", 1, true) and 1 or 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = __include("core/Bytes") +S["model/robloxmesh"] = function(r) +return string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") and 1 or 0 +end +end + +do -- model/schematic +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head, hints) +for _, h in __iter(hints) do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r) +local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return (hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) )and 1 or 0 +end +end + +do -- model/smd +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/smd"] = function(r) +local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = __include("core/Bytes") +S["model/sourcemdl"] = function(r) +if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return v >= 44 and v <= 49 and 1 or 0 +end +end + +do -- model/stl +local Bytes = __include("core/Bytes") +local function lower5(s) +return string.lower(s) == "solid" +end +S["model/stl"] = function(r) +local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return (string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) )and 0.9 or 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/t3d"] = function(r) +local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/udmf"] = function(r) +local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = __include("core/Bytes") +local function isUsdz(r) +if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r) +local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = __include("core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r) +if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return v >= 19 and v <= 21 and 1 or 0.5 +end +end + +do -- model/vmf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["model/vmf"] = function(r) +local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = __include("core/Bytes") +S["model/vox"] = function(r) +return r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" and 1 or(r:peek(4) == "VOX " and 0.8 or 0 +)end +end + +do -- model/vrml +local Bytes = __include("core/Bytes") +S["model/vrml"] = function(r) +local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return string.sub(head, 1, 10) == "#VRML V2.0" and 1 or(string.sub(head, 1, 6) == "#VRML " and 0.6 or 0 +)end +end + +do -- model/x +local Bytes = __include("core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r) +if r:peek(4) ~= "xof " then + return 0 + end + return ENCODINGS[r:peek(4, 8)] and 1 or 0.5 +end +end + +do -- model/x3d +local Bytes = __include("core/Bytes") +S["model/x3d"] = function(r) +local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "]") or string.find(head, "", 1, true) or (string.find(head, "", 1, true)) then + return string.find(r:peek(512), "= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return sig == "NE" and 0.6 or(sig == "PE" and 0.2 or 0 +) end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return size == r:size() and 0.9 or(size <= r:size() and size > 118 and 0.3 or 0 +) end + return 0 +end +end + +do -- font/hershey +local Bytes = __include("core/Bytes") +local function header(line) +if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r) +local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line , 9) + if string.find(body, "[^ -~]") then + return 0 + end + return (#body == math.min(2 * n, 64) or #body == 2 * n )and 0.7 or 0.3 +end +end + +do -- font/pcf +local Bytes = __include("core/Bytes") +S["font/pcf"] = function(r) +return r:peek(4) == "\1fcp" and 1 or 0 +end +end + +do -- font/psf +local Bytes = __include("core/Bytes") +S["font/psf"] = function(r) +local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = __include("core/Bytes") +S["font/ttf"] = function(r) +local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = __include("core/Bytes") +S["font/type1"] = function(r) +local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = __include("core/Bytes") +S["font/woff"] = function(r) +return r:peek(4) == "wOFF" and 1 or 0 +end +end + +do -- font/woff2 +local Bytes = __include("core/Bytes") +S["font/woff2"] = function(r) +return r:peek(4) == "wOF2" and 1 or 0 +end +end + +do -- archive/7z +local Bytes = __include("core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r) +return r:peek(6) == MAGIC and 1 or 0 +end +end + +do -- archive/adf +local Bytes = __include("core/Bytes") +local BS = 512 +S["archive/adf"] = function(r) +local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return (n == 901120 or n == 1802240 )and 0.95 or 0.6 +end +end + +do -- archive/applesingle +local Bytes = __include("core/Bytes") +S["archive/applesingle"] = function(r) +local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = __include("core/Bytes") +local MAGIC = "!\n" +S["archive/ar"] = function(r) +if r:peek(8) == MAGIC then + return r:peek(13, 68) == "debian-binary" and 1 or 0.9 + end + return r:peek(8) == "!\n" and 0.5 or 0 +end +end + +do -- archive/arj +local Bytes = __include("core/Bytes") +S["archive/arj"] = function(r) +local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return size > 0 and size <= 2600 and 0.9 or 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = __include("core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r) +local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return at == 1 and 1 or 0.8 +end +end + +do -- archive/br +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Brotli = lazy(function() + return __include("codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r) +local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return buffer.len(out) > 0 and 0.3 or 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = __include("core/Bytes") +S["archive/bz2"] = function(r) +local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = __include("core/Bytes") +S["archive/cab"] = function(r) +if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = __include("core/Bytes") +S["archive/cpio"] = function(r) +local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = __include("core/Bytes") + +local function geometry(kind, tracks) +local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = (kind == "d71" and t > 35 and((t - 35 ))or(t +)) n = s <= 17 and 21 or(s <= 24 and 19 or(s <= 30 and 18 or 17 +)) end + offsets[t], spt[t] = o, n + o =o+ n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = kind == "d81" and 40 or 18, total = o } +end +local function detect(len) +for _, g in __iter({ { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } }) do + local geo = geometry(g[1] , g[2] ) + local sectors = math.floor(geo.total / 256 +) if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r) +local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return t == 40 and s == 3 and v == 0x44 and 0.9 or 0.3 + end + return t == 18 and s == 1 and (v == 0x41 or v == 0) and 0.9 or 0.3 +end +end + +do -- archive/fat +local Bytes = __include("core/Bytes") +local Fat = lazy(function() + return __include("containers/Fat") +end) +S["archive/fat"] = function(r) +if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return v.partition and 0.6 or 0.8 +end +end + +do -- archive/grp +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r) +return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = __include("core/Bytes") +S["archive/gzip"] = function(r) +return r:peek(3) == "\31\139\8" and 1 or 0 +end +end + +do -- archive/iso +local Bytes = __include("core/Bytes") +S["archive/iso"] = function(r) +return r:peek(5, 16 * 2048 + 1) == "CD001" and 1 or 0 +end +end + +do -- archive/lha +local Bytes = __include("core/Bytes") +local METHODS= { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s) +if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r) +if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = __include("core/Bytes") +S["archive/lz4"] = function(r) +local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = __include("core/Bytes") +local Crc16 = __include("core/Crc16") +local function version(b, o, len) +if len < 128 then + return nil + end + local u8 = function(i) +return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i) +return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return buffer.readstring(b, o + 102, 4) == "mBIN" and"III" or"II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return need <= len + 127 and"I" or nil +end +S["archive/macbinary"] = function(r) +local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return v == "III" and 0.95 or(v == "II" and 0.8 or(v == "I" and 0.3 or 0 +))end +end + +do -- archive/mpq +local Bytes = __include("core/Bytes") +S["archive/mpq"] = function(r) +local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["archive/pak"] = function(r) +if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = __include("core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r) +return r:peek(4) == LEAD_MAGIC and 1 or 0 +end +end + +do -- archive/tar +local Bytes = __include("core/Bytes") +local Tar = lazy(function() + return __include("containers/Tar") +end) +S["archive/tar"] = function(r) +if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return r:peek(5, 257) == "ustar" and 0.95 or 0.6 +end +end + +do -- archive/unitypackage +local Bytes = __include("core/Bytes") +local Deflate = lazy(function() + return __include("codecs/compress/Deflate") +end) +local Tar = lazy(function() + return __include("containers/Tar") +end) +local function guidOf(name) +local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r) +if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z =z+ 1 + end + return guidOf(buffer.readstring(head, 0, z)) and 1 or 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = __include("core/Bytes") +S["archive/uu"] = function(r) +local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = __include("core/Bytes") +S["archive/vpk"] = function(r) +if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return (v == 1 or v == 2 )and 1 or 0.5 +end +end + +do -- archive/vswap +local Bytes = __include("core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r) +if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r) +local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero =nonzero+ 1 + end + end + return nonzero > 0 and 0.6 or 0 +end +end + +do -- archive/wad +local Bytes = __include("core/Bytes") +S["archive/wad"] = function(r) +if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = __include("core/Bytes") +S["archive/wad2"] = function(r) +if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return (m == "WAD2" or m == "WAD3" )and 0.9 or 0 +end +end + +do -- archive/xz +local Bytes = __include("core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r) +local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return d == 0x5D and 0.4 or 0.2 +end +S["archive/xz"] = function(r) +if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = __include("core/Bytes") +S["archive/yenc"] = function(r) +local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return string.find(head, "\n=ybegin [^\n]*name=") and 0.6 or 0 +end +end + +do -- archive/z +local Bytes = __include("core/Bytes") +S["archive/z"] = function(r) +if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 and 1 or 0.3 +end +end + +do -- archive/zip +local Bytes = __include("core/Bytes") +S["archive/zip"] = function(r) +local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = __include("core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r) +local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return string.sub(h, 1, 4) == "ZOO " and 1 or 0.8 +end +end + +do -- archive/zst +local Bytes = __include("core/Bytes") +local Zstd = lazy(function() + return __include("codecs/compress/Zstd") +end) +S["archive/zst"] = function(r) +local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = __include("core/Bytes") +S["data/cbor"] = function(r) +return r:peek(3) == "\217\217\247" and 1 or 0 +end +end + +do -- data/csv +local Bytes = __include("core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r) +local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in __iter({ ",", "\t", ";" }) do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 , d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = __include("core/Bytes") +S["data/ini"] = function(r) +local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/json"] = function(r) +local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return (nxt == nil or nxt == '"' or nxt == "}" )and 0.6 or 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = __include("core/Bytes") +S["data/msgpack"] = function(_r) +return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = __include("core/Bytes") +local Nbt = lazy(function() + return __include("codecs/text/Nbt") +end) +S["data/nbt"] = function(r) +local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return p.firstType and 1 or 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return p.firstType and p.firstName and 0.6 or 0.2 +end +end + +do -- data/plist +local Bytes = __include("core/Bytes") +S["data/plist"] = function(r) +local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, " 0 and good == lines and paths > 0 and 0.5 or 0 +end +end + +do -- data/snbt +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/snbt"] = function(r) -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + +local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = __include("core/Bytes") +S["data/toml"] = function(r) +local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in __iter(string.gmatch(head, "[^\n]+")) do + local l = (string.match(line, "^[ \t]*(.-)[ \t\r]*$") ) +if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["data/tres"] = function(r) +local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +local KeyValues = lazy(function() + return __include("codecs/text/KeyValues") +end) +S["data/vdf"] = function(r) +local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["data/xml"] = function(r) +local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = __include("core/Bytes") +S["data/yaml"] = function(r) +local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = __include("core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r) +if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ldtk"] = function(r) +local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = __include("core/Bytes") +local Sniff = __include("core/Sniff") +S["vector/ogmo"] = function(r) +local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["vector/svg"] = function(r) +local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, ":]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local function head(r) +local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r) +local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "]") or string.find(h, "]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = (n > 1024 and{(r:peek(1024, n - 1024) )}or{"" +})[1] for _, part in __iter({ h, tail }) do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = __include("core/Bytes") +S["layered/aseprite"] = function(r) +if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = __include("core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r) -- a zip whose first (stored) entry is "mimetype" holding image/openraster + +if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = __include("core/Bytes") +S["layered/psd"] = function(r) +local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/ass"] = function(r) +local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits) +return ((tonumber(digits) )) / 10 ^ #digits +end +local function timing(line) +local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = (tonumber(h1) )* 3600 + (tonumber(m1) )* 60 + (tonumber(s1) )+ frac(f1 ) + local b = (tonumber(h2) )* 3600 + (tonumber(m2) )* 60 + (tonumber(s2) )+ frac(f2 ) + return a, b, rest +end +S["subtitle/srt"] = function(r) +local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["subtitle/vtt"] = function(r) +local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad =bad+ 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r) +return validHeader(r) and 0.6 or 0 +end +end + +do -- music/ahx +local Bytes = __include("core/Bytes") +S["music/ahx"] = function(r) +local m = r:peek(4) + return m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 and 1 or 0 +end +end + +do -- music/far +local Bytes = __include("core/Bytes") +S["music/far"] = function(r) +if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = __include("core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r) +return (r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC )and 1 or 0 +end +end + +do -- music/hvl +local Bytes = __include("core/Bytes") +S["music/hvl"] = function(r) +local m = r:peek(4) + return m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 and 1 or 0 +end +end + +do -- music/it +local Bytes = __include("core/Bytes") +S["music/it"] = function(r) +return r:peek(4) == "IMPM" and 1 or 0 +end +end + +do -- music/med +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r) +return validHeader(r) and 1 or 0 +end +end + +do -- music/midi +local Bytes = __include("core/Bytes") +S["music/midi"] = function(r) +if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = __include("core/Bytes") +local FIXED= { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig) +local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = (tonumber(d) ) +return (n >= 1 and{n }or{nil +})[1] end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = (tonumber(dd) ) +return (n >= 1 and n <= 32 and{n }or{nil +})[1] end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = (tonumber(t) ) +return (n >= 1 and{n }or{nil +})[1] end + return nil +end +S["music/mod"] = function(r) +if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = __include("core/Bytes") +S["music/mtm"] = function(r) +if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = __include("core/Bytes") +S["music/mus"] = function(r) +return r:peek(4) == "MUS\x1a" and 1 or 0 +end +end + +do -- music/okt +local Bytes = __include("core/Bytes") +S["music/okt"] = function(r) +return r:peek(8) == "OKTASONG" and 1 or 0 +end +end + +do -- music/ptm +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r) +return validHeader(r) and 1 or 0 +end +end + +do -- music/s3m +local Bytes = __include("core/Bytes") +S["music/s3m"] = function(r) +if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = __include("core/Bytes") +local SoundFont = lazy(function() + return __include("codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r) +return SoundFont.sniff(r) and 1 or 0 +end +end + +do -- music/stm +local Bytes = __include("core/Bytes") +local function validHeader(r) +if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r) +return validHeader(r) and 0.7 or 0 +end +end + +do -- music/ult +local Bytes = __include("core/Bytes") +S["music/ult"] = function(r) +local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = __include("core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" + +local function header(r) +if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd= { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r) +local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v =v+ (b % 128) * 2 ^ shift + shift =shift+ 7 + until b < 0x80 or shift >= 32 + end + return (neg and{(-v )}or{v +})[1]end +local function names(r, h) +local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r) +local h = header(r) + if not h then + return 0 + end + return table.find(names(r, h), "music") and 1 or 0.3 +end +end + +do -- music/xm +local Bytes = __include("core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r) +return r:peek(17) == MAGIC and 1 or 0 +end +end + +do -- music/xmi +local Bytes = __include("core/Bytes") +S["music/xmi"] = function(r) +local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return id == "CAT " and kind == "XMID" and 0.9 or 0 +end +end + +do -- playlist/m3u +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +S["playlist/m3u"] = function(r) +local s = Sniff.text(r, 512) + s = ((string.match(s, "^%s*(.*)$") )) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = __include("core/Sniff") +local Bytes = __include("core/Bytes") +local Text = lazy(function() + return __include("codecs/text/Text") +end) +S["playlist/pls"] = function(r) +local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return first and string.lower(Text.trim(first)) == "[playlist]" and 0.95 or 0 +end +end + +do -- playlist/xspf +local Bytes = __include("core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r) +local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S +end __FILES["Types"] = function() local __compat = __compat local buffer, type, __iter = __compat.buffer, __compat.type, __compat.__iter --!strict -- Types: the standard value types each category decodes to and encodes from, plus small constructors. Every diff --git a/build/rosetta.lua.linemap.json b/build/rosetta.lua.linemap.json index b0a0b9a..ec62632 100644 --- a/build/rosetta.lua.linemap.json +++ b/build/rosetta.lua.linemap.json @@ -1,619 +1,620 @@ [ [671, "src/Rosetta/init.luau"], -[1555, "src/Rosetta/Registry.luau"], -[3964, "src/Rosetta/Types.luau"], -[5077, "src/Rosetta/archive/7z/init.luau"], -[5462, "src/Rosetta/archive/7z/Header.luau"], -[5989, "src/Rosetta/archive/adf/init.luau"], -[6271, "src/Rosetta/archive/applesingle/init.luau"], -[6457, "src/Rosetta/archive/ar/init.luau"], -[6860, "src/Rosetta/archive/arj/init.luau"], -[7070, "src/Rosetta/archive/binhex/init.luau"], -[7319, "src/Rosetta/archive/br/init.luau"], -[7394, "src/Rosetta/archive/bz2/init.luau"], -[7458, "src/Rosetta/archive/cab/init.luau"], -[7871, "src/Rosetta/archive/cab/Sum.luau"], -[7912, "src/Rosetta/archive/cpio/init.luau"], -[8080, "src/Rosetta/archive/d64/init.luau"], -[8494, "src/Rosetta/archive/fat/init.luau"], -[8616, "src/Rosetta/archive/grp/init.luau"], -[8730, "src/Rosetta/archive/gzip/init.luau"], -[8915, "src/Rosetta/archive/iso/init.luau"], -[8987, "src/Rosetta/archive/lha/init.luau"], -[9412, "src/Rosetta/archive/lz4/init.luau"], -[9756, "src/Rosetta/archive/macbinary/init.luau"], -[9954, "src/Rosetta/archive/mpq/init.luau"], -[10360, "src/Rosetta/archive/mpq/Crypt.luau"], -[10425, "src/Rosetta/archive/pak/init.luau"], -[10559, "src/Rosetta/archive/rpm/init.luau"], -[10883, "src/Rosetta/archive/tar/init.luau"], -[11001, "src/Rosetta/archive/unitypackage/init.luau"], -[11237, "src/Rosetta/archive/uu/init.luau"], -[11507, "src/Rosetta/archive/vpk/init.luau"], -[11818, "src/Rosetta/archive/vswap/init.luau"], -[12088, "src/Rosetta/archive/wad/init.luau"], -[12542, "src/Rosetta/archive/wad/Picture.luau"], -[12644, "src/Rosetta/archive/wad2/init.luau"], -[12926, "src/Rosetta/archive/xz/init.luau"], -[13026, "src/Rosetta/archive/yenc/init.luau"], -[13298, "src/Rosetta/archive/z/init.luau"], -[13394, "src/Rosetta/archive/zip/init.luau"], -[13613, "src/Rosetta/archive/zoo/init.luau"], -[13809, "src/Rosetta/archive/zst/init.luau"], -[13873, "src/Rosetta/audio/aac/init.luau"], -[14086, "src/Rosetta/audio/ac3/init.luau"], -[14233, "src/Rosetta/audio/adpcm/init.luau"], -[14379, "src/Rosetta/audio/adx/init.luau"], -[14611, "src/Rosetta/audio/aiff/init.luau"], -[15003, "src/Rosetta/audio/ape/init.luau"], -[15132, "src/Rosetta/audio/au/init.luau"], -[15294, "src/Rosetta/audio/brstm/init.luau"], -[15586, "src/Rosetta/audio/caf/init.luau"], -[16253, "src/Rosetta/audio/flac/init.luau"], -[16402, "src/Rosetta/audio/flac/Meta.luau"], -[16624, "src/Rosetta/audio/flac/Stream.luau"], -[16994, "src/Rosetta/audio/m4a/init.luau"], -[17337, "src/Rosetta/audio/mp3/init.luau"], -[17598, "src/Rosetta/audio/mp3/Index.luau"], -[17789, "src/Rosetta/audio/mp3/Stream.luau"], -[18016, "src/Rosetta/audio/mp3/Tags.luau"], -[18328, "src/Rosetta/audio/mpc/init.luau"], -[18423, "src/Rosetta/audio/opus/init.luau"], -[18802, "src/Rosetta/audio/opus/Encode.luau"], -[18914, "src/Rosetta/audio/qoa/init.luau"], -[19095, "src/Rosetta/audio/tta/init.luau"], -[19214, "src/Rosetta/audio/vag/init.luau"], -[19438, "src/Rosetta/audio/voc/init.luau"], -[19714, "src/Rosetta/audio/vorbis/init.luau"], -[20169, "src/Rosetta/audio/vorbis/Encode.luau"], -[20982, "src/Rosetta/audio/wav/init.luau"], -[21603, "src/Rosetta/audio/wav/Codecs.luau"], -[21782, "src/Rosetta/audio/wavpack/init.luau"], -[21990, "src/Rosetta/cad/step/init.luau"], -[22372, "src/Rosetta/cad/step/Brep.luau"], -[22607, "src/Rosetta/cad/step/Parse.luau"], -[23164, "src/Rosetta/cad/step/Write.luau"], -[23412, "src/Rosetta/codecs/audio/Aac/init.luau"], -[23820, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[24796, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[25386, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[26453, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[26572, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[27814, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[28306, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[28423, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[28836, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[29172, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[29332, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[30217, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[30319, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[31073, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[31376, "src/Rosetta/codecs/audio/Alac/init.luau"], -[31611, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[32030, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[32442, "src/Rosetta/codecs/audio/Ape/init.luau"], -[32658, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[33419, "src/Rosetta/codecs/audio/ApeTag.luau"], -[33517, "src/Rosetta/codecs/audio/Flac/init.luau"], -[33529, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[34478, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[35098, "src/Rosetta/codecs/audio/Hively/init.luau"], -[35295, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[35545, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[36504, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[36724, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[36944, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[37198, "src/Rosetta/codecs/audio/MidiRender.luau"], -[37545, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[37560, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[37619, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[39277, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[39570, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[39955, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[40596, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[40737, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[40964, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[41310, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[42204, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[42583, "src/Rosetta/codecs/audio/Opus/init.luau"], -[42598, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[44470, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[45535, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[45596, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[46060, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[46411, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[46644, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[48686, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[49060, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[49324, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[49621, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[49903, "src/Rosetta/codecs/audio/Resample/init.luau"], -[50298, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[50353, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[50497, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[51011, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[51810, "src/Rosetta/codecs/audio/Stream.luau"], -[51972, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[52455, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[52734, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[52981, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[53110, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[55099, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[55216, "src/Rosetta/codecs/audio/Tta/init.luau"], -[55334, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[55586, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[55600, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[55984, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[56557, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[56979, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[57019, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[57072, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[57295, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[58750, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[58813, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[58900, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[59876, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[60744, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[60788, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[61301, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[61627, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[62109, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[62557, "src/Rosetta/codecs/compress/Explode.luau"], -[62753, "src/Rosetta/codecs/compress/Lz4.luau"], -[63022, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[63626, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[64166, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[64233, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[64706, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[64882, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[65150, "src/Rosetta/codecs/compress/Lzx.luau"], -[65584, "src/Rosetta/codecs/compress/PackBits.luau"], -[65674, "src/Rosetta/codecs/compress/Quantum.luau"], -[65911, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[66215, "src/Rosetta/codecs/compress/Xxh32.luau"], -[66284, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[66341, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[67325, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[67477, "src/Rosetta/codecs/entropy/Huffman.luau"], -[67764, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[67775, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[67996, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[68240, "src/Rosetta/codecs/font/Bitmap.luau"], -[68441, "src/Rosetta/codecs/font/Cff/init.luau"], -[69082, "src/Rosetta/codecs/font/GlyphNames.luau"], -[69232, "src/Rosetta/codecs/font/TrueType/init.luau"], -[69546, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[69938, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[70440, "src/Rosetta/codecs/image/Bcn/init.luau"], -[70547, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[71031, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[71460, "src/Rosetta/codecs/image/Blend.luau"], -[71839, "src/Rosetta/codecs/image/Dct/init.luau"], -[72334, "src/Rosetta/codecs/image/Etc.luau"], -[72632, "src/Rosetta/codecs/image/Half.luau"], -[72701, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[73055, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[73463, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[73828, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[74593, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[75474, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[75943, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[76021, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[76088, "src/Rosetta/codecs/image/Miptex.luau"], -[76388, "src/Rosetta/codecs/image/Pixels.luau"], -[76708, "src/Rosetta/codecs/image/Quantize/init.luau"], -[77169, "src/Rosetta/codecs/image/Raster.luau"], -[77866, "src/Rosetta/codecs/image/Texel.luau"], -[78239, "src/Rosetta/codecs/image/Texture.luau"], -[78384, "src/Rosetta/codecs/image/Vp8/init.luau"], -[78515, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[80471, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[80734, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[80984, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[81126, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[81230, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[82170, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[83122, "src/Rosetta/codecs/image/Yuv.luau"], -[83427, "src/Rosetta/codecs/model/Brush.luau"], -[84067, "src/Rosetta/codecs/model/Displacement.luau"], -[84216, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[84661, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[84911, "src/Rosetta/codecs/model/Draco/init.luau"], -[85243, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[85712, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[86901, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[87050, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[87409, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[88371, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[88845, "src/Rosetta/codecs/model/Mat4.luau"], -[89104, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[89632, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[90184, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[90263, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[90370, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[90576, "src/Rosetta/codecs/model/Patch.luau"], -[90700, "src/Rosetta/codecs/model/Polygon.luau"], -[90934, "src/Rosetta/codecs/model/Rbx/init.luau"], -[91171, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[91925, "src/Rosetta/codecs/model/Rig.luau"], -[92168, "src/Rosetta/codecs/model/Sampler.luau"], -[92328, "src/Rosetta/codecs/model/SourceAnim.luau"], -[92549, "src/Rosetta/codecs/model/Vrml/init.luau"], -[92697, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[93271, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[93434, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[94183, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[94705, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[95432, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[95664, "src/Rosetta/codecs/text/GodotVariant.luau"], -[96323, "src/Rosetta/codecs/text/Json/init.luau"], -[96592, "src/Rosetta/codecs/text/Json/Decode.luau"], -[97027, "src/Rosetta/codecs/text/Json/Encode.luau"], -[97372, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[97942, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[98248, "src/Rosetta/codecs/text/Lexer/init.luau"], -[98380, "src/Rosetta/codecs/text/Nbt/init.luau"], -[98733, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[99425, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[100065, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[100303, "src/Rosetta/codecs/text/Text/init.luau"], -[100394, "src/Rosetta/codecs/text/Url/init.luau"], -[100599, "src/Rosetta/codecs/text/Xml/init.luau"], -[101049, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[101853, "src/Rosetta/codecs/video/Dsp.luau"], -[102691, "src/Rosetta/codecs/video/H263/init.luau"], -[102848, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[103706, "src/Rosetta/codecs/video/H263/Tables.luau"], -[103910, "src/Rosetta/codecs/video/H264/init.luau"], -[104284, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[104559, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[105690, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[106458, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[106720, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[107730, "src/Rosetta/codecs/video/H264/Inter.luau"], -[108056, "src/Rosetta/codecs/video/H264/Intra.luau"], -[108463, "src/Rosetta/codecs/video/H264/Mb.luau"], -[109402, "src/Rosetta/codecs/video/H264/Params.luau"], -[109850, "src/Rosetta/codecs/video/H264/Slice.luau"], -[110102, "src/Rosetta/codecs/video/H264/Tables.luau"], -[110144, "src/Rosetta/codecs/video/H264/Transform.luau"], -[110309, "src/Rosetta/codecs/video/Legacy/init.luau"], -[110508, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[110805, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[111172, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[111290, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[111398, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[111671, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[112066, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[112243, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[112256, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[112624, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[114151, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[114291, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[114430, "src/Rosetta/codecs/video/Theora/init.luau"], -[114694, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[115958, "src/Rosetta/codecs/video/Theora/Header.luau"], -[116322, "src/Rosetta/codecs/video/Video/init.luau"], -[116880, "src/Rosetta/codecs/video/Video/Source.luau"], -[117166, "src/Rosetta/containers/Archive.luau"], -[117433, "src/Rosetta/containers/AudioWrap.luau"], -[117943, "src/Rosetta/containers/Avi/init.luau"], -[118496, "src/Rosetta/containers/Blend.luau"], -[119235, "src/Rosetta/containers/Chunks.luau"], -[119370, "src/Rosetta/containers/Cpio.luau"], -[119798, "src/Rosetta/containers/Demux.luau"], -[120073, "src/Rosetta/containers/Ebml/init.luau"], -[120387, "src/Rosetta/containers/Fat.luau"], -[121075, "src/Rosetta/containers/Iso9660.luau"], -[121580, "src/Rosetta/containers/IsoBmff/init.luau"], -[121751, "src/Rosetta/containers/IsoBmff/Box.luau"], -[121940, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[122786, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[123308, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[123825, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[123943, "src/Rosetta/containers/MacFile.luau"], -[124092, "src/Rosetta/containers/MpegEs.luau"], -[124259, "src/Rosetta/containers/MpegPs/init.luau"], -[124480, "src/Rosetta/containers/MpegTs/init.luau"], -[125273, "src/Rosetta/containers/Ogg/init.luau"], -[125698, "src/Rosetta/containers/Ogg/Mux.luau"], -[125887, "src/Rosetta/containers/Ogg/Page.luau"], -[126053, "src/Rosetta/containers/Riff/init.luau"], -[126370, "src/Rosetta/containers/Tar.luau"], -[126784, "src/Rosetta/containers/Zip/init.luau"], -[127416, "src/Rosetta/core/Adler32.luau"], -[127476, "src/Rosetta/core/Base64.luau"], -[127704, "src/Rosetta/core/Bits.luau"], -[127997, "src/Rosetta/core/Bytes.luau"], -[128524, "src/Rosetta/core/Crc16.luau"], -[128576, "src/Rosetta/core/Crc32.luau"], -[128727, "src/Rosetta/core/Err.luau"], -[128809, "src/Rosetta/core/Input.luau"], -[128885, "src/Rosetta/core/Md5.luau"], -[129043, "src/Rosetta/core/Sniff.luau"], -[129072, "src/Rosetta/data/cbor/init.luau"], -[129171, "src/Rosetta/data/cbor/Codec.luau"], -[129740, "src/Rosetta/data/csv/init.luau"], -[130052, "src/Rosetta/data/ini/init.luau"], -[130298, "src/Rosetta/data/json/init.luau"], -[130390, "src/Rosetta/data/msgpack/init.luau"], -[130479, "src/Rosetta/data/msgpack/Codec.luau"], -[130921, "src/Rosetta/data/nbt/init.luau"], -[130980, "src/Rosetta/data/plist/init.luau"], -[131286, "src/Rosetta/data/plist/Binary.luau"], -[131553, "src/Rosetta/data/q3shader/init.luau"], -[131792, "src/Rosetta/data/q3skin/init.luau"], -[131888, "src/Rosetta/data/snbt/init.luau"], -[131951, "src/Rosetta/data/toml/init.luau"], -[132018, "src/Rosetta/data/toml/Decode.luau"], -[132646, "src/Rosetta/data/toml/Encode.luau"], -[132855, "src/Rosetta/data/tres/init.luau"], -[133000, "src/Rosetta/data/vdf/init.luau"], -[133101, "src/Rosetta/data/xml/init.luau"], -[133157, "src/Rosetta/data/yaml/init.luau"], -[133230, "src/Rosetta/data/yaml/Emit.luau"], -[133520, "src/Rosetta/data/yaml/Parse.luau"], -[134813, "src/Rosetta/font/bdf/init.luau"], -[135102, "src/Rosetta/font/bmfont/init.luau"], -[135529, "src/Rosetta/font/bmfont/Parse.luau"], -[135982, "src/Rosetta/font/eot/init.luau"], -[136214, "src/Rosetta/font/fon/init.luau"], -[136497, "src/Rosetta/font/hershey/init.luau"], -[136692, "src/Rosetta/font/pcf/init.luau"], -[136972, "src/Rosetta/font/psf/init.luau"], -[137292, "src/Rosetta/font/ttf/init.luau"], -[137343, "src/Rosetta/font/type1/init.luau"], -[137702, "src/Rosetta/font/type1/Charstring.luau"], -[137980, "src/Rosetta/font/woff/init.luau"], -[138112, "src/Rosetta/font/woff2/init.luau"], -[138169, "src/Rosetta/font/woff2/Rebuild.luau"], -[138709, "src/Rosetta/host/init.luau"], -[138754, "src/Rosetta/host/Love.luau"], -[138897, "src/Rosetta/host/LuaJIT.luau"], -[138947, "src/Rosetta/host/Luau.luau"], -[138970, "src/Rosetta/host/Roblox.luau"], -[139329, "src/Rosetta/image/ani/init.luau"], -[139509, "src/Rosetta/image/art/init.luau"], -[139997, "src/Rosetta/image/blp/init.luau"], -[140255, "src/Rosetta/image/bmp/init.luau"], -[140670, "src/Rosetta/image/dds/init.luau"], -[141153, "src/Rosetta/image/exr/init.luau"], -[141913, "src/Rosetta/image/exr/Codec.luau"], -[142024, "src/Rosetta/image/exr/Piz.luau"], -[142381, "src/Rosetta/image/gif/init.luau"], -[142897, "src/Rosetta/image/gif/Decode.luau"], -[142973, "src/Rosetta/image/hdr/init.luau"], -[143202, "src/Rosetta/image/hdr/Codec.luau"], -[143413, "src/Rosetta/image/icns/init.luau"], -[143744, "src/Rosetta/image/ico/init.luau"], -[144021, "src/Rosetta/image/ico/Dib.luau"], -[144116, "src/Rosetta/image/ilbm/init.luau"], -[144435, "src/Rosetta/image/jpeg/init.luau"], -[144571, "src/Rosetta/image/ktx/init.luau"], -[145231, "src/Rosetta/image/lmp/init.luau"], -[145364, "src/Rosetta/image/pcx/init.luau"], -[145628, "src/Rosetta/image/png/init.luau"], -[146208, "src/Rosetta/image/png/Apng.luau"], -[146288, "src/Rosetta/image/png/Decode.luau"], -[146661, "src/Rosetta/image/png/Encode.luau"], -[146864, "src/Rosetta/image/pnm/init.luau"], -[147242, "src/Rosetta/image/pnm/Codec.luau"], -[147519, "src/Rosetta/image/qoi/init.luau"], -[147641, "src/Rosetta/image/qoi/Codec.luau"], -[147798, "src/Rosetta/image/sgi/init.luau"], -[148083, "src/Rosetta/image/spr/init.luau"], -[148396, "src/Rosetta/image/sunras/init.luau"], -[148642, "src/Rosetta/image/tga/init.luau"], -[148912, "src/Rosetta/image/tga/Codec.luau"], -[149112, "src/Rosetta/image/tiff/init.luau"], -[149939, "src/Rosetta/image/tiff/Pixels.luau"], -[150329, "src/Rosetta/image/tim/init.luau"], -[150571, "src/Rosetta/image/vtf/init.luau"], -[150806, "src/Rosetta/image/webp/init.luau"], -[151416, "src/Rosetta/image/webp/Alpha.luau"], -[151492, "src/Rosetta/image/webp/Anim.luau"], -[151647, "src/Rosetta/image/xbm/init.luau"], -[151808, "src/Rosetta/image/xpm/init.luau"], -[152076, "src/Rosetta/image/xpm/Names.luau"], -[152132, "src/Rosetta/layered/aseprite/init.luau"], -[152870, "src/Rosetta/layered/ora/init.luau"], -[153157, "src/Rosetta/layered/psd/init.luau"], -[153892, "src/Rosetta/layered/psd/Channels.luau"], -[154244, "src/Rosetta/model/3ds/init.luau"], -[154327, "src/Rosetta/model/3ds/Build.luau"], -[154974, "src/Rosetta/model/3ds/Read.luau"], -[155470, "src/Rosetta/model/3ds/Write.luau"], -[156275, "src/Rosetta/model/3mf/init.luau"], -[156357, "src/Rosetta/model/3mf/Read.luau"], -[156945, "src/Rosetta/model/3mf/Write.luau"], -[157350, "src/Rosetta/model/ase/init.luau"], -[157473, "src/Rosetta/model/ase/Build.luau"], -[158047, "src/Rosetta/model/ase/Parse.luau"], -[158116, "src/Rosetta/model/ase/Write.luau"], -[158579, "src/Rosetta/model/b3d/init.luau"], -[158634, "src/Rosetta/model/b3d/Read.luau"], -[159205, "src/Rosetta/model/blend/init.luau"], -[159303, "src/Rosetta/model/blend/Anim.luau"], -[159649, "src/Rosetta/model/blend/Armature.luau"], -[160056, "src/Rosetta/model/blend/Material.luau"], -[160408, "src/Rosetta/model/blend/Mesh.luau"], -[161096, "src/Rosetta/model/blend/Normals.luau"], -[161257, "src/Rosetta/model/blend/Prim.luau"], -[161764, "src/Rosetta/model/blend/Read.luau"], -[162803, "src/Rosetta/model/bsp/init.luau"], -[162994, "src/Rosetta/model/bsp/Lightmap.luau"], -[163060, "src/Rosetta/model/bsp/Quake.luau"], -[163449, "src/Rosetta/model/bsp/Quake3.luau"], -[163678, "src/Rosetta/model/bsp/Tree.luau"], -[164066, "src/Rosetta/model/buildmap/init.luau"], -[164338, "src/Rosetta/model/buildmap/Geometry.luau"], -[164741, "src/Rosetta/model/d3map/init.luau"], -[165023, "src/Rosetta/model/d3map/Parse.luau"], -[165221, "src/Rosetta/model/dae/init.luau"], -[165410, "src/Rosetta/model/dae/Math.luau"], -[165457, "src/Rosetta/model/dae/Read.luau"], -[167307, "src/Rosetta/model/dae/Write.luau"], -[167676, "src/Rosetta/model/fbx/init.luau"], -[167824, "src/Rosetta/model/fbx/Ascii.luau"], -[168094, "src/Rosetta/model/fbx/Binary.luau"], -[168549, "src/Rosetta/model/fbx/Read.luau"], -[169911, "src/Rosetta/model/fbx/Write.luau"], -[170896, "src/Rosetta/model/fbx/Xform.luau"], -[170937, "src/Rosetta/model/gltf/init.luau"], -[171174, "src/Rosetta/model/gltf/Pack.luau"], -[171243, "src/Rosetta/model/gltf/Read.luau"], -[171984, "src/Rosetta/model/gltf/Write.luau"], -[172670, "src/Rosetta/model/godot/init.luau"], -[172761, "src/Rosetta/model/godot/Build.luau"], -[173303, "src/Rosetta/model/godot/Primitives.luau"], -[173578, "src/Rosetta/model/godot/Surface.luau"], -[174063, "src/Rosetta/model/godot/Write.luau"], -[174392, "src/Rosetta/model/iqm/init.luau"], -[174468, "src/Rosetta/model/iqm/Read.luau"], -[174823, "src/Rosetta/model/iqm/Write.luau"], -[175510, "src/Rosetta/model/ldraw/init.luau"], -[175588, "src/Rosetta/model/ldraw/Colors.luau"], -[175906, "src/Rosetta/model/ldraw/Read.luau"], -[176483, "src/Rosetta/model/lwo/init.luau"], -[176559, "src/Rosetta/model/lwo/Build.luau"], -[177021, "src/Rosetta/model/lwo/Parse.luau"], -[177564, "src/Rosetta/model/map/init.luau"], -[177881, "src/Rosetta/model/map/Build.luau"], -[178125, "src/Rosetta/model/map/Parse.luau"], -[178510, "src/Rosetta/model/map/Write.luau"], -[178656, "src/Rosetta/model/mca/init.luau"], -[178998, "src/Rosetta/model/mca/Chunk.luau"], -[179131, "src/Rosetta/model/mca/Lz4Block.luau"], -[179201, "src/Rosetta/model/md2/init.luau"], -[179400, "src/Rosetta/model/md3/init.luau"], -[179628, "src/Rosetta/model/md5/init.luau"], -[179709, "src/Rosetta/model/md5/Read.luau"], -[180142, "src/Rosetta/model/mdl/init.luau"], -[180224, "src/Rosetta/model/mdl/HalfLife.luau"], -[180528, "src/Rosetta/model/mdl/Quake.luau"], -[180746, "src/Rosetta/model/ms3d/init.luau"], -[180818, "src/Rosetta/model/ms3d/Read.luau"], -[181264, "src/Rosetta/model/ms3d/Write.luau"], -[181733, "src/Rosetta/model/obj/init.luau"], -[182551, "src/Rosetta/model/obj/Mtl.luau"], -[182839, "src/Rosetta/model/off/init.luau"], -[183301, "src/Rosetta/model/ply/init.luau"], -[184406, "src/Rosetta/model/ply/Binary.luau"], -[184607, "src/Rosetta/model/pmx/init.luau"], -[184676, "src/Rosetta/model/pmx/Build.luau"], -[184972, "src/Rosetta/model/pmx/Pmd.luau"], -[185307, "src/Rosetta/model/pmx/Read.luau"], -[185711, "src/Rosetta/model/proc/init.luau"], -[186093, "src/Rosetta/model/qb/init.luau"], -[186486, "src/Rosetta/model/rbxm/init.luau"], -[187079, "src/Rosetta/model/rbxmx/init.luau"], -[187755, "src/Rosetta/model/robloxmesh/init.luau"], -[188414, "src/Rosetta/model/robloxmesh/Parse.luau"], -[188871, "src/Rosetta/model/robloxmesh/Write.luau"], -[188980, "src/Rosetta/model/schematic/init.luau"], -[189301, "src/Rosetta/model/schematic/Common.luau"], -[189421, "src/Rosetta/model/schematic/Litematic.luau"], -[189632, "src/Rosetta/model/schematic/Mcedit.luau"], -[189876, "src/Rosetta/model/schematic/Sponge.luau"], -[190005, "src/Rosetta/model/smd/init.luau"], -[190072, "src/Rosetta/model/smd/Read.luau"], -[190341, "src/Rosetta/model/smd/Write.luau"], -[190584, "src/Rosetta/model/sourcemdl/init.luau"], -[190755, "src/Rosetta/model/sourcemdl/Build.luau"], -[191185, "src/Rosetta/model/sourcemdl/Material.luau"], -[191346, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[191873, "src/Rosetta/model/sourcemdl/Phy.luau"], -[191996, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[192178, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[192272, "src/Rosetta/model/stl/init.luau"], -[192722, "src/Rosetta/model/stl/Decode.luau"], -[192796, "src/Rosetta/model/t3d/init.luau"], -[192890, "src/Rosetta/model/t3d/Build.luau"], -[193295, "src/Rosetta/model/t3d/Parse.luau"], -[193463, "src/Rosetta/model/udmf/init.luau"], -[193546, "src/Rosetta/model/usda/init.luau"], -[193755, "src/Rosetta/model/usda/Build.luau"], -[195033, "src/Rosetta/model/usda/Parse.luau"], -[195831, "src/Rosetta/model/usda/Write.luau"], -[196648, "src/Rosetta/model/vbsp/init.luau"], -[197094, "src/Rosetta/model/vbsp/Faces.luau"], -[197318, "src/Rosetta/model/vbsp/Props.luau"], -[197410, "src/Rosetta/model/vmf/init.luau"], -[197735, "src/Rosetta/model/vmf/Build.luau"], -[198159, "src/Rosetta/model/vox/init.luau"], -[199045, "src/Rosetta/model/vox/Grid.luau"], -[199102, "src/Rosetta/model/vrml/init.luau"], -[199168, "src/Rosetta/model/x/init.luau"], -[199298, "src/Rosetta/model/x/Build.luau"], -[199861, "src/Rosetta/model/x/Parse.luau"], -[200158, "src/Rosetta/model/x3d/init.luau"], -[200236, "src/Rosetta/music/669/init.luau"], -[200443, "src/Rosetta/music/ahx/init.luau"], -[200495, "src/Rosetta/music/far/init.luau"], -[200725, "src/Rosetta/music/hmp/init.luau"], -[200990, "src/Rosetta/music/hvl/init.luau"], -[201042, "src/Rosetta/music/it/init.luau"], -[201461, "src/Rosetta/music/it/Itsex.luau"], -[201578, "src/Rosetta/music/med/init.luau"], -[202226, "src/Rosetta/music/midi/init.luau"], -[202370, "src/Rosetta/music/midi/Smf.luau"], -[202782, "src/Rosetta/music/mod/init.luau"], -[203136, "src/Rosetta/music/mtm/init.luau"], -[203359, "src/Rosetta/music/mus/init.luau"], -[203517, "src/Rosetta/music/okt/init.luau"], -[203799, "src/Rosetta/music/ptm/init.luau"], -[204022, "src/Rosetta/music/s3m/init.luau"], -[204259, "src/Rosetta/music/sf2/init.luau"], -[204303, "src/Rosetta/music/stm/init.luau"], -[204535, "src/Rosetta/music/ult/init.luau"], -[204840, "src/Rosetta/music/umx/init.luau"], -[205057, "src/Rosetta/music/xm/init.luau"], -[205619, "src/Rosetta/music/xmi/init.luau"], -[205828, "src/Rosetta/ops/AudioOps.luau"], -[206307, "src/Rosetta/ops/ImageOps/init.luau"], -[206955, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[207595, "src/Rosetta/ops/LayerOps.luau"], -[207688, "src/Rosetta/ops/MeshOps/init.luau"], -[208828, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[208995, "src/Rosetta/ops/MusicOps.luau"], -[209344, "src/Rosetta/playlist/m3u/init.luau"], -[209697, "src/Rosetta/playlist/pls/init.luau"], -[209875, "src/Rosetta/playlist/xspf/init.luau"], -[210078, "src/Rosetta/subtitle/ass/init.luau"], -[210522, "src/Rosetta/subtitle/srt/init.luau"], -[210695, "src/Rosetta/subtitle/vtt/init.luau"], -[210898, "src/Rosetta/vector/gamemaps/init.luau"], -[211085, "src/Rosetta/vector/gamemaps/Expand.luau"], -[211182, "src/Rosetta/vector/ldtk/init.luau"], -[211274, "src/Rosetta/vector/ldtk/Read.luau"], -[211610, "src/Rosetta/vector/ldtk/Write.luau"], -[212258, "src/Rosetta/vector/ogmo/init.luau"], -[212377, "src/Rosetta/vector/ogmo/Read.luau"], -[212782, "src/Rosetta/vector/ogmo/Write.luau"], -[213136, "src/Rosetta/vector/svg/init.luau"], -[213222, "src/Rosetta/vector/svg/Parse.luau"], -[213968, "src/Rosetta/vector/svg/PathData.luau"], -[214336, "src/Rosetta/vector/svg/Render.luau"], -[214753, "src/Rosetta/vector/svg/Style.luau"], -[215125, "src/Rosetta/vector/svg/Write.luau"], -[215325, "src/Rosetta/vector/tiled/init.luau"], -[215505, "src/Rosetta/vector/tiled/Data.luau"], -[215656, "src/Rosetta/vector/tiled/Tmj.luau"], -[216287, "src/Rosetta/vector/tiled/Tmx.luau"], -[216899, "src/Rosetta/video/avi/init.luau"], -[217193, "src/Rosetta/video/fli/init.luau"], -[217344, "src/Rosetta/video/flv/init.luau"], -[217728, "src/Rosetta/video/flv/Amf.luau"], -[217886, "src/Rosetta/video/flv/Mux.luau"], -[218167, "src/Rosetta/video/h264/init.luau"], -[218306, "src/Rosetta/video/mkv/init.luau"], -[218462, "src/Rosetta/video/mkv/Mux.luau"], -[218741, "src/Rosetta/video/mkv/Parse.luau"], -[219462, "src/Rosetta/video/mp4/init.luau"], -[219790, "src/Rosetta/video/mpegps/init.luau"], -[219977, "src/Rosetta/video/mpegts/init.luau"], -[220223, "src/Rosetta/video/ogv/init.luau"], -[220618, "src/Rosetta/video/smk/init.luau"], -[220927, "src/Rosetta/video/smk/Audio.luau"], -[221047, "src/Rosetta/video/y4m/init.luau"] +[1588, "src/Rosetta/Registry.luau"], +[4205, "src/Rosetta/Sniffs.luau"], +[7591, "src/Rosetta/Types.luau"], +[8704, "src/Rosetta/archive/7z/init.luau"], +[9089, "src/Rosetta/archive/7z/Header.luau"], +[9616, "src/Rosetta/archive/adf/init.luau"], +[9898, "src/Rosetta/archive/applesingle/init.luau"], +[10084, "src/Rosetta/archive/ar/init.luau"], +[10487, "src/Rosetta/archive/arj/init.luau"], +[10697, "src/Rosetta/archive/binhex/init.luau"], +[10946, "src/Rosetta/archive/br/init.luau"], +[11021, "src/Rosetta/archive/bz2/init.luau"], +[11085, "src/Rosetta/archive/cab/init.luau"], +[11498, "src/Rosetta/archive/cab/Sum.luau"], +[11539, "src/Rosetta/archive/cpio/init.luau"], +[11707, "src/Rosetta/archive/d64/init.luau"], +[12121, "src/Rosetta/archive/fat/init.luau"], +[12243, "src/Rosetta/archive/grp/init.luau"], +[12357, "src/Rosetta/archive/gzip/init.luau"], +[12542, "src/Rosetta/archive/iso/init.luau"], +[12614, "src/Rosetta/archive/lha/init.luau"], +[13039, "src/Rosetta/archive/lz4/init.luau"], +[13383, "src/Rosetta/archive/macbinary/init.luau"], +[13581, "src/Rosetta/archive/mpq/init.luau"], +[13987, "src/Rosetta/archive/mpq/Crypt.luau"], +[14052, "src/Rosetta/archive/pak/init.luau"], +[14186, "src/Rosetta/archive/rpm/init.luau"], +[14510, "src/Rosetta/archive/tar/init.luau"], +[14628, "src/Rosetta/archive/unitypackage/init.luau"], +[14864, "src/Rosetta/archive/uu/init.luau"], +[15134, "src/Rosetta/archive/vpk/init.luau"], +[15445, "src/Rosetta/archive/vswap/init.luau"], +[15715, "src/Rosetta/archive/wad/init.luau"], +[16169, "src/Rosetta/archive/wad/Picture.luau"], +[16271, "src/Rosetta/archive/wad2/init.luau"], +[16553, "src/Rosetta/archive/xz/init.luau"], +[16653, "src/Rosetta/archive/yenc/init.luau"], +[16925, "src/Rosetta/archive/z/init.luau"], +[17021, "src/Rosetta/archive/zip/init.luau"], +[17240, "src/Rosetta/archive/zoo/init.luau"], +[17436, "src/Rosetta/archive/zst/init.luau"], +[17500, "src/Rosetta/audio/aac/init.luau"], +[17713, "src/Rosetta/audio/ac3/init.luau"], +[17860, "src/Rosetta/audio/adpcm/init.luau"], +[18006, "src/Rosetta/audio/adx/init.luau"], +[18238, "src/Rosetta/audio/aiff/init.luau"], +[18630, "src/Rosetta/audio/ape/init.luau"], +[18759, "src/Rosetta/audio/au/init.luau"], +[18921, "src/Rosetta/audio/brstm/init.luau"], +[19213, "src/Rosetta/audio/caf/init.luau"], +[19880, "src/Rosetta/audio/flac/init.luau"], +[20029, "src/Rosetta/audio/flac/Meta.luau"], +[20251, "src/Rosetta/audio/flac/Stream.luau"], +[20621, "src/Rosetta/audio/m4a/init.luau"], +[20964, "src/Rosetta/audio/mp3/init.luau"], +[21225, "src/Rosetta/audio/mp3/Index.luau"], +[21416, "src/Rosetta/audio/mp3/Stream.luau"], +[21643, "src/Rosetta/audio/mp3/Tags.luau"], +[21955, "src/Rosetta/audio/mpc/init.luau"], +[22050, "src/Rosetta/audio/opus/init.luau"], +[22429, "src/Rosetta/audio/opus/Encode.luau"], +[22541, "src/Rosetta/audio/qoa/init.luau"], +[22722, "src/Rosetta/audio/tta/init.luau"], +[22841, "src/Rosetta/audio/vag/init.luau"], +[23065, "src/Rosetta/audio/voc/init.luau"], +[23341, "src/Rosetta/audio/vorbis/init.luau"], +[23796, "src/Rosetta/audio/vorbis/Encode.luau"], +[24609, "src/Rosetta/audio/wav/init.luau"], +[25230, "src/Rosetta/audio/wav/Codecs.luau"], +[25409, "src/Rosetta/audio/wavpack/init.luau"], +[25617, "src/Rosetta/cad/step/init.luau"], +[25999, "src/Rosetta/cad/step/Brep.luau"], +[26234, "src/Rosetta/cad/step/Parse.luau"], +[26791, "src/Rosetta/cad/step/Write.luau"], +[27039, "src/Rosetta/codecs/audio/Aac/init.luau"], +[27447, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[28423, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[29013, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[30080, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[30199, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[31441, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[31933, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[32050, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[32463, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[32799, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[32959, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[33844, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[33946, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34700, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[35003, "src/Rosetta/codecs/audio/Alac/init.luau"], +[35238, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35657, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[36069, "src/Rosetta/codecs/audio/Ape/init.luau"], +[36285, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[37046, "src/Rosetta/codecs/audio/ApeTag.luau"], +[37144, "src/Rosetta/codecs/audio/Flac/init.luau"], +[37156, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[38105, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38725, "src/Rosetta/codecs/audio/Hively/init.luau"], +[38922, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[39172, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[40131, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[40351, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[40571, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[40825, "src/Rosetta/codecs/audio/MidiRender.luau"], +[41172, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[41187, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[41246, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[42904, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[43197, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[43582, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[44223, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[44364, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[44591, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[44937, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[45831, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[46210, "src/Rosetta/codecs/audio/Opus/init.luau"], +[46225, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[48097, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[49162, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[49223, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49687, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[50038, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[50271, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[52313, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52687, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[52951, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[53248, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[53530, "src/Rosetta/codecs/audio/Resample/init.luau"], +[53925, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[53980, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[54124, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[54638, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[55437, "src/Rosetta/codecs/audio/Stream.luau"], +[55599, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[56082, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[56361, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[56608, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56737, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58726, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[58843, "src/Rosetta/codecs/audio/Tta/init.luau"], +[58961, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[59213, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[59227, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[59611, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[60184, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[60606, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60646, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60699, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[60922, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[62377, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[62440, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[62527, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[63503, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[64371, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[64415, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[64928, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[65254, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[65736, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[66184, "src/Rosetta/codecs/compress/Explode.luau"], +[66380, "src/Rosetta/codecs/compress/Lz4.luau"], +[66649, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[67253, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[67793, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[67860, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[68333, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[68509, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[68777, "src/Rosetta/codecs/compress/Lzx.luau"], +[69211, "src/Rosetta/codecs/compress/PackBits.luau"], +[69301, "src/Rosetta/codecs/compress/Quantum.luau"], +[69538, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[69842, "src/Rosetta/codecs/compress/Xxh32.luau"], +[69911, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[69968, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[70952, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[71104, "src/Rosetta/codecs/entropy/Huffman.luau"], +[71391, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[71402, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[71623, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[71867, "src/Rosetta/codecs/font/Bitmap.luau"], +[72068, "src/Rosetta/codecs/font/Cff/init.luau"], +[72709, "src/Rosetta/codecs/font/GlyphNames.luau"], +[72859, "src/Rosetta/codecs/font/TrueType/init.luau"], +[73173, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[73565, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[74067, "src/Rosetta/codecs/image/Bcn/init.luau"], +[74174, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[74658, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[75087, "src/Rosetta/codecs/image/Blend.luau"], +[75466, "src/Rosetta/codecs/image/Dct/init.luau"], +[75961, "src/Rosetta/codecs/image/Etc.luau"], +[76259, "src/Rosetta/codecs/image/Half.luau"], +[76328, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[76682, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[77090, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[77455, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[78220, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[79101, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[79570, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[79648, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[79715, "src/Rosetta/codecs/image/Miptex.luau"], +[80015, "src/Rosetta/codecs/image/Pixels.luau"], +[80335, "src/Rosetta/codecs/image/Quantize/init.luau"], +[80796, "src/Rosetta/codecs/image/Raster.luau"], +[81493, "src/Rosetta/codecs/image/Texel.luau"], +[81866, "src/Rosetta/codecs/image/Texture.luau"], +[82011, "src/Rosetta/codecs/image/Vp8/init.luau"], +[82142, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[84098, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[84361, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[84611, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[84753, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[84857, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[85797, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[86749, "src/Rosetta/codecs/image/Yuv.luau"], +[87054, "src/Rosetta/codecs/model/Brush.luau"], +[87694, "src/Rosetta/codecs/model/Displacement.luau"], +[87843, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[88288, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[88538, "src/Rosetta/codecs/model/Draco/init.luau"], +[88870, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[89339, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[90528, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[90677, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[91036, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[91998, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[92472, "src/Rosetta/codecs/model/Mat4.luau"], +[92731, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[93259, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[93811, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[93890, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[93997, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[94203, "src/Rosetta/codecs/model/Patch.luau"], +[94327, "src/Rosetta/codecs/model/Polygon.luau"], +[94561, "src/Rosetta/codecs/model/Rbx/init.luau"], +[94798, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[95552, "src/Rosetta/codecs/model/Rig.luau"], +[95795, "src/Rosetta/codecs/model/Sampler.luau"], +[95955, "src/Rosetta/codecs/model/SourceAnim.luau"], +[96176, "src/Rosetta/codecs/model/Vrml/init.luau"], +[96324, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[96898, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[97061, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[97810, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[98332, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[99059, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[99291, "src/Rosetta/codecs/text/GodotVariant.luau"], +[99950, "src/Rosetta/codecs/text/Json/init.luau"], +[100219, "src/Rosetta/codecs/text/Json/Decode.luau"], +[100654, "src/Rosetta/codecs/text/Json/Encode.luau"], +[100999, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[101569, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[101875, "src/Rosetta/codecs/text/Lexer/init.luau"], +[102007, "src/Rosetta/codecs/text/Nbt/init.luau"], +[102360, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[103052, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[103692, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[103930, "src/Rosetta/codecs/text/Text/init.luau"], +[104021, "src/Rosetta/codecs/text/Url/init.luau"], +[104226, "src/Rosetta/codecs/text/Xml/init.luau"], +[104676, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[105480, "src/Rosetta/codecs/video/Dsp.luau"], +[106318, "src/Rosetta/codecs/video/H263/init.luau"], +[106475, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[107333, "src/Rosetta/codecs/video/H263/Tables.luau"], +[107537, "src/Rosetta/codecs/video/H264/init.luau"], +[107911, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[108186, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[109317, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[110085, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[110347, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[111357, "src/Rosetta/codecs/video/H264/Inter.luau"], +[111683, "src/Rosetta/codecs/video/H264/Intra.luau"], +[112090, "src/Rosetta/codecs/video/H264/Mb.luau"], +[113029, "src/Rosetta/codecs/video/H264/Params.luau"], +[113477, "src/Rosetta/codecs/video/H264/Slice.luau"], +[113729, "src/Rosetta/codecs/video/H264/Tables.luau"], +[113771, "src/Rosetta/codecs/video/H264/Transform.luau"], +[113936, "src/Rosetta/codecs/video/Legacy/init.luau"], +[114135, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[114432, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[114799, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[114917, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[115025, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[115298, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[115693, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[115870, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[115883, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[116251, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[117778, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[117918, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[118057, "src/Rosetta/codecs/video/Theora/init.luau"], +[118321, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[119585, "src/Rosetta/codecs/video/Theora/Header.luau"], +[119949, "src/Rosetta/codecs/video/Video/init.luau"], +[120507, "src/Rosetta/codecs/video/Video/Source.luau"], +[120793, "src/Rosetta/containers/Archive.luau"], +[121060, "src/Rosetta/containers/AudioWrap.luau"], +[121570, "src/Rosetta/containers/Avi/init.luau"], +[122123, "src/Rosetta/containers/Blend.luau"], +[122862, "src/Rosetta/containers/Chunks.luau"], +[122997, "src/Rosetta/containers/Cpio.luau"], +[123425, "src/Rosetta/containers/Demux.luau"], +[123700, "src/Rosetta/containers/Ebml/init.luau"], +[124014, "src/Rosetta/containers/Fat.luau"], +[124702, "src/Rosetta/containers/Iso9660.luau"], +[125207, "src/Rosetta/containers/IsoBmff/init.luau"], +[125378, "src/Rosetta/containers/IsoBmff/Box.luau"], +[125567, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[126413, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[126935, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[127452, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[127570, "src/Rosetta/containers/MacFile.luau"], +[127719, "src/Rosetta/containers/MpegEs.luau"], +[127886, "src/Rosetta/containers/MpegPs/init.luau"], +[128107, "src/Rosetta/containers/MpegTs/init.luau"], +[128900, "src/Rosetta/containers/Ogg/init.luau"], +[129325, "src/Rosetta/containers/Ogg/Mux.luau"], +[129514, "src/Rosetta/containers/Ogg/Page.luau"], +[129680, "src/Rosetta/containers/Riff/init.luau"], +[129997, "src/Rosetta/containers/Tar.luau"], +[130411, "src/Rosetta/containers/Zip/init.luau"], +[131043, "src/Rosetta/core/Adler32.luau"], +[131103, "src/Rosetta/core/Base64.luau"], +[131331, "src/Rosetta/core/Bits.luau"], +[131624, "src/Rosetta/core/Bytes.luau"], +[132151, "src/Rosetta/core/Crc16.luau"], +[132203, "src/Rosetta/core/Crc32.luau"], +[132354, "src/Rosetta/core/Err.luau"], +[132436, "src/Rosetta/core/Input.luau"], +[132512, "src/Rosetta/core/Md5.luau"], +[132670, "src/Rosetta/core/Sniff.luau"], +[132699, "src/Rosetta/data/cbor/init.luau"], +[132798, "src/Rosetta/data/cbor/Codec.luau"], +[133367, "src/Rosetta/data/csv/init.luau"], +[133679, "src/Rosetta/data/ini/init.luau"], +[133925, "src/Rosetta/data/json/init.luau"], +[134017, "src/Rosetta/data/msgpack/init.luau"], +[134106, "src/Rosetta/data/msgpack/Codec.luau"], +[134548, "src/Rosetta/data/nbt/init.luau"], +[134607, "src/Rosetta/data/plist/init.luau"], +[134913, "src/Rosetta/data/plist/Binary.luau"], +[135180, "src/Rosetta/data/q3shader/init.luau"], +[135419, "src/Rosetta/data/q3skin/init.luau"], +[135515, "src/Rosetta/data/snbt/init.luau"], +[135578, "src/Rosetta/data/toml/init.luau"], +[135645, "src/Rosetta/data/toml/Decode.luau"], +[136273, "src/Rosetta/data/toml/Encode.luau"], +[136482, "src/Rosetta/data/tres/init.luau"], +[136627, "src/Rosetta/data/vdf/init.luau"], +[136728, "src/Rosetta/data/xml/init.luau"], +[136784, "src/Rosetta/data/yaml/init.luau"], +[136857, "src/Rosetta/data/yaml/Emit.luau"], +[137147, "src/Rosetta/data/yaml/Parse.luau"], +[138440, "src/Rosetta/font/bdf/init.luau"], +[138729, "src/Rosetta/font/bmfont/init.luau"], +[139156, "src/Rosetta/font/bmfont/Parse.luau"], +[139609, "src/Rosetta/font/eot/init.luau"], +[139841, "src/Rosetta/font/fon/init.luau"], +[140124, "src/Rosetta/font/hershey/init.luau"], +[140319, "src/Rosetta/font/pcf/init.luau"], +[140599, "src/Rosetta/font/psf/init.luau"], +[140919, "src/Rosetta/font/ttf/init.luau"], +[140970, "src/Rosetta/font/type1/init.luau"], +[141329, "src/Rosetta/font/type1/Charstring.luau"], +[141607, "src/Rosetta/font/woff/init.luau"], +[141739, "src/Rosetta/font/woff2/init.luau"], +[141796, "src/Rosetta/font/woff2/Rebuild.luau"], +[142336, "src/Rosetta/host/init.luau"], +[142381, "src/Rosetta/host/Love.luau"], +[142524, "src/Rosetta/host/LuaJIT.luau"], +[142574, "src/Rosetta/host/Luau.luau"], +[142597, "src/Rosetta/host/Roblox.luau"], +[142956, "src/Rosetta/image/ani/init.luau"], +[143136, "src/Rosetta/image/art/init.luau"], +[143624, "src/Rosetta/image/blp/init.luau"], +[143882, "src/Rosetta/image/bmp/init.luau"], +[144297, "src/Rosetta/image/dds/init.luau"], +[144780, "src/Rosetta/image/exr/init.luau"], +[145540, "src/Rosetta/image/exr/Codec.luau"], +[145651, "src/Rosetta/image/exr/Piz.luau"], +[146008, "src/Rosetta/image/gif/init.luau"], +[146524, "src/Rosetta/image/gif/Decode.luau"], +[146600, "src/Rosetta/image/hdr/init.luau"], +[146829, "src/Rosetta/image/hdr/Codec.luau"], +[147040, "src/Rosetta/image/icns/init.luau"], +[147371, "src/Rosetta/image/ico/init.luau"], +[147648, "src/Rosetta/image/ico/Dib.luau"], +[147743, "src/Rosetta/image/ilbm/init.luau"], +[148062, "src/Rosetta/image/jpeg/init.luau"], +[148198, "src/Rosetta/image/ktx/init.luau"], +[148858, "src/Rosetta/image/lmp/init.luau"], +[148991, "src/Rosetta/image/pcx/init.luau"], +[149255, "src/Rosetta/image/png/init.luau"], +[149835, "src/Rosetta/image/png/Apng.luau"], +[149915, "src/Rosetta/image/png/Decode.luau"], +[150288, "src/Rosetta/image/png/Encode.luau"], +[150491, "src/Rosetta/image/pnm/init.luau"], +[150869, "src/Rosetta/image/pnm/Codec.luau"], +[151146, "src/Rosetta/image/qoi/init.luau"], +[151268, "src/Rosetta/image/qoi/Codec.luau"], +[151425, "src/Rosetta/image/sgi/init.luau"], +[151710, "src/Rosetta/image/spr/init.luau"], +[152023, "src/Rosetta/image/sunras/init.luau"], +[152269, "src/Rosetta/image/tga/init.luau"], +[152539, "src/Rosetta/image/tga/Codec.luau"], +[152739, "src/Rosetta/image/tiff/init.luau"], +[153566, "src/Rosetta/image/tiff/Pixels.luau"], +[153956, "src/Rosetta/image/tim/init.luau"], +[154198, "src/Rosetta/image/vtf/init.luau"], +[154433, "src/Rosetta/image/webp/init.luau"], +[155043, "src/Rosetta/image/webp/Alpha.luau"], +[155119, "src/Rosetta/image/webp/Anim.luau"], +[155274, "src/Rosetta/image/xbm/init.luau"], +[155435, "src/Rosetta/image/xpm/init.luau"], +[155703, "src/Rosetta/image/xpm/Names.luau"], +[155759, "src/Rosetta/layered/aseprite/init.luau"], +[156497, "src/Rosetta/layered/ora/init.luau"], +[156784, "src/Rosetta/layered/psd/init.luau"], +[157519, "src/Rosetta/layered/psd/Channels.luau"], +[157871, "src/Rosetta/model/3ds/init.luau"], +[157954, "src/Rosetta/model/3ds/Build.luau"], +[158601, "src/Rosetta/model/3ds/Read.luau"], +[159097, "src/Rosetta/model/3ds/Write.luau"], +[159902, "src/Rosetta/model/3mf/init.luau"], +[159984, "src/Rosetta/model/3mf/Read.luau"], +[160572, "src/Rosetta/model/3mf/Write.luau"], +[160977, "src/Rosetta/model/ase/init.luau"], +[161100, "src/Rosetta/model/ase/Build.luau"], +[161674, "src/Rosetta/model/ase/Parse.luau"], +[161743, "src/Rosetta/model/ase/Write.luau"], +[162206, "src/Rosetta/model/b3d/init.luau"], +[162261, "src/Rosetta/model/b3d/Read.luau"], +[162832, "src/Rosetta/model/blend/init.luau"], +[162930, "src/Rosetta/model/blend/Anim.luau"], +[163276, "src/Rosetta/model/blend/Armature.luau"], +[163683, "src/Rosetta/model/blend/Material.luau"], +[164035, "src/Rosetta/model/blend/Mesh.luau"], +[164723, "src/Rosetta/model/blend/Normals.luau"], +[164884, "src/Rosetta/model/blend/Prim.luau"], +[165391, "src/Rosetta/model/blend/Read.luau"], +[166430, "src/Rosetta/model/bsp/init.luau"], +[166621, "src/Rosetta/model/bsp/Lightmap.luau"], +[166687, "src/Rosetta/model/bsp/Quake.luau"], +[167076, "src/Rosetta/model/bsp/Quake3.luau"], +[167305, "src/Rosetta/model/bsp/Tree.luau"], +[167693, "src/Rosetta/model/buildmap/init.luau"], +[167965, "src/Rosetta/model/buildmap/Geometry.luau"], +[168368, "src/Rosetta/model/d3map/init.luau"], +[168650, "src/Rosetta/model/d3map/Parse.luau"], +[168848, "src/Rosetta/model/dae/init.luau"], +[169037, "src/Rosetta/model/dae/Math.luau"], +[169084, "src/Rosetta/model/dae/Read.luau"], +[170934, "src/Rosetta/model/dae/Write.luau"], +[171303, "src/Rosetta/model/fbx/init.luau"], +[171451, "src/Rosetta/model/fbx/Ascii.luau"], +[171721, "src/Rosetta/model/fbx/Binary.luau"], +[172176, "src/Rosetta/model/fbx/Read.luau"], +[173538, "src/Rosetta/model/fbx/Write.luau"], +[174523, "src/Rosetta/model/fbx/Xform.luau"], +[174564, "src/Rosetta/model/gltf/init.luau"], +[174801, "src/Rosetta/model/gltf/Pack.luau"], +[174870, "src/Rosetta/model/gltf/Read.luau"], +[175611, "src/Rosetta/model/gltf/Write.luau"], +[176297, "src/Rosetta/model/godot/init.luau"], +[176388, "src/Rosetta/model/godot/Build.luau"], +[176930, "src/Rosetta/model/godot/Primitives.luau"], +[177205, "src/Rosetta/model/godot/Surface.luau"], +[177690, "src/Rosetta/model/godot/Write.luau"], +[178019, "src/Rosetta/model/iqm/init.luau"], +[178095, "src/Rosetta/model/iqm/Read.luau"], +[178450, "src/Rosetta/model/iqm/Write.luau"], +[179137, "src/Rosetta/model/ldraw/init.luau"], +[179215, "src/Rosetta/model/ldraw/Colors.luau"], +[179533, "src/Rosetta/model/ldraw/Read.luau"], +[180110, "src/Rosetta/model/lwo/init.luau"], +[180186, "src/Rosetta/model/lwo/Build.luau"], +[180648, "src/Rosetta/model/lwo/Parse.luau"], +[181191, "src/Rosetta/model/map/init.luau"], +[181508, "src/Rosetta/model/map/Build.luau"], +[181752, "src/Rosetta/model/map/Parse.luau"], +[182137, "src/Rosetta/model/map/Write.luau"], +[182283, "src/Rosetta/model/mca/init.luau"], +[182625, "src/Rosetta/model/mca/Chunk.luau"], +[182758, "src/Rosetta/model/mca/Lz4Block.luau"], +[182828, "src/Rosetta/model/md2/init.luau"], +[183027, "src/Rosetta/model/md3/init.luau"], +[183255, "src/Rosetta/model/md5/init.luau"], +[183336, "src/Rosetta/model/md5/Read.luau"], +[183769, "src/Rosetta/model/mdl/init.luau"], +[183851, "src/Rosetta/model/mdl/HalfLife.luau"], +[184155, "src/Rosetta/model/mdl/Quake.luau"], +[184373, "src/Rosetta/model/ms3d/init.luau"], +[184445, "src/Rosetta/model/ms3d/Read.luau"], +[184891, "src/Rosetta/model/ms3d/Write.luau"], +[185360, "src/Rosetta/model/obj/init.luau"], +[186178, "src/Rosetta/model/obj/Mtl.luau"], +[186466, "src/Rosetta/model/off/init.luau"], +[186928, "src/Rosetta/model/ply/init.luau"], +[188033, "src/Rosetta/model/ply/Binary.luau"], +[188234, "src/Rosetta/model/pmx/init.luau"], +[188303, "src/Rosetta/model/pmx/Build.luau"], +[188599, "src/Rosetta/model/pmx/Pmd.luau"], +[188934, "src/Rosetta/model/pmx/Read.luau"], +[189338, "src/Rosetta/model/proc/init.luau"], +[189720, "src/Rosetta/model/qb/init.luau"], +[190113, "src/Rosetta/model/rbxm/init.luau"], +[190706, "src/Rosetta/model/rbxmx/init.luau"], +[191382, "src/Rosetta/model/robloxmesh/init.luau"], +[192041, "src/Rosetta/model/robloxmesh/Parse.luau"], +[192498, "src/Rosetta/model/robloxmesh/Write.luau"], +[192607, "src/Rosetta/model/schematic/init.luau"], +[192928, "src/Rosetta/model/schematic/Common.luau"], +[193048, "src/Rosetta/model/schematic/Litematic.luau"], +[193259, "src/Rosetta/model/schematic/Mcedit.luau"], +[193503, "src/Rosetta/model/schematic/Sponge.luau"], +[193632, "src/Rosetta/model/smd/init.luau"], +[193699, "src/Rosetta/model/smd/Read.luau"], +[193968, "src/Rosetta/model/smd/Write.luau"], +[194211, "src/Rosetta/model/sourcemdl/init.luau"], +[194382, "src/Rosetta/model/sourcemdl/Build.luau"], +[194812, "src/Rosetta/model/sourcemdl/Material.luau"], +[194973, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[195500, "src/Rosetta/model/sourcemdl/Phy.luau"], +[195623, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[195805, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[195899, "src/Rosetta/model/stl/init.luau"], +[196349, "src/Rosetta/model/stl/Decode.luau"], +[196423, "src/Rosetta/model/t3d/init.luau"], +[196517, "src/Rosetta/model/t3d/Build.luau"], +[196922, "src/Rosetta/model/t3d/Parse.luau"], +[197090, "src/Rosetta/model/udmf/init.luau"], +[197173, "src/Rosetta/model/usda/init.luau"], +[197382, "src/Rosetta/model/usda/Build.luau"], +[198660, "src/Rosetta/model/usda/Parse.luau"], +[199458, "src/Rosetta/model/usda/Write.luau"], +[200275, "src/Rosetta/model/vbsp/init.luau"], +[200721, "src/Rosetta/model/vbsp/Faces.luau"], +[200945, "src/Rosetta/model/vbsp/Props.luau"], +[201037, "src/Rosetta/model/vmf/init.luau"], +[201362, "src/Rosetta/model/vmf/Build.luau"], +[201786, "src/Rosetta/model/vox/init.luau"], +[202672, "src/Rosetta/model/vox/Grid.luau"], +[202729, "src/Rosetta/model/vrml/init.luau"], +[202795, "src/Rosetta/model/x/init.luau"], +[202925, "src/Rosetta/model/x/Build.luau"], +[203488, "src/Rosetta/model/x/Parse.luau"], +[203785, "src/Rosetta/model/x3d/init.luau"], +[203863, "src/Rosetta/music/669/init.luau"], +[204070, "src/Rosetta/music/ahx/init.luau"], +[204122, "src/Rosetta/music/far/init.luau"], +[204352, "src/Rosetta/music/hmp/init.luau"], +[204617, "src/Rosetta/music/hvl/init.luau"], +[204669, "src/Rosetta/music/it/init.luau"], +[205088, "src/Rosetta/music/it/Itsex.luau"], +[205205, "src/Rosetta/music/med/init.luau"], +[205853, "src/Rosetta/music/midi/init.luau"], +[205997, "src/Rosetta/music/midi/Smf.luau"], +[206409, "src/Rosetta/music/mod/init.luau"], +[206763, "src/Rosetta/music/mtm/init.luau"], +[206986, "src/Rosetta/music/mus/init.luau"], +[207144, "src/Rosetta/music/okt/init.luau"], +[207426, "src/Rosetta/music/ptm/init.luau"], +[207649, "src/Rosetta/music/s3m/init.luau"], +[207886, "src/Rosetta/music/sf2/init.luau"], +[207930, "src/Rosetta/music/stm/init.luau"], +[208162, "src/Rosetta/music/ult/init.luau"], +[208467, "src/Rosetta/music/umx/init.luau"], +[208684, "src/Rosetta/music/xm/init.luau"], +[209246, "src/Rosetta/music/xmi/init.luau"], +[209455, "src/Rosetta/ops/AudioOps.luau"], +[209934, "src/Rosetta/ops/ImageOps/init.luau"], +[210582, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[211222, "src/Rosetta/ops/LayerOps.luau"], +[211315, "src/Rosetta/ops/MeshOps/init.luau"], +[212455, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[212622, "src/Rosetta/ops/MusicOps.luau"], +[212971, "src/Rosetta/playlist/m3u/init.luau"], +[213324, "src/Rosetta/playlist/pls/init.luau"], +[213502, "src/Rosetta/playlist/xspf/init.luau"], +[213705, "src/Rosetta/subtitle/ass/init.luau"], +[214149, "src/Rosetta/subtitle/srt/init.luau"], +[214322, "src/Rosetta/subtitle/vtt/init.luau"], +[214525, "src/Rosetta/vector/gamemaps/init.luau"], +[214712, "src/Rosetta/vector/gamemaps/Expand.luau"], +[214809, "src/Rosetta/vector/ldtk/init.luau"], +[214901, "src/Rosetta/vector/ldtk/Read.luau"], +[215237, "src/Rosetta/vector/ldtk/Write.luau"], +[215885, "src/Rosetta/vector/ogmo/init.luau"], +[216004, "src/Rosetta/vector/ogmo/Read.luau"], +[216409, "src/Rosetta/vector/ogmo/Write.luau"], +[216763, "src/Rosetta/vector/svg/init.luau"], +[216849, "src/Rosetta/vector/svg/Parse.luau"], +[217595, "src/Rosetta/vector/svg/PathData.luau"], +[217963, "src/Rosetta/vector/svg/Render.luau"], +[218380, "src/Rosetta/vector/svg/Style.luau"], +[218752, "src/Rosetta/vector/svg/Write.luau"], +[218952, "src/Rosetta/vector/tiled/init.luau"], +[219132, "src/Rosetta/vector/tiled/Data.luau"], +[219283, "src/Rosetta/vector/tiled/Tmj.luau"], +[219914, "src/Rosetta/vector/tiled/Tmx.luau"], +[220526, "src/Rosetta/video/avi/init.luau"], +[220820, "src/Rosetta/video/fli/init.luau"], +[220971, "src/Rosetta/video/flv/init.luau"], +[221355, "src/Rosetta/video/flv/Amf.luau"], +[221513, "src/Rosetta/video/flv/Mux.luau"], +[221794, "src/Rosetta/video/h264/init.luau"], +[221933, "src/Rosetta/video/mkv/init.luau"], +[222089, "src/Rosetta/video/mkv/Mux.luau"], +[222368, "src/Rosetta/video/mkv/Parse.luau"], +[223089, "src/Rosetta/video/mp4/init.luau"], +[223417, "src/Rosetta/video/mpegps/init.luau"], +[223604, "src/Rosetta/video/mpegts/init.luau"], +[223850, "src/Rosetta/video/ogv/init.luau"], +[224245, "src/Rosetta/video/smk/init.luau"], +[224554, "src/Rosetta/video/smk/Audio.luau"], +[224674, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/docs/API.md b/docs/API.md index f6c8d08..d724f43 100644 --- a/docs/API.md +++ b/docs/API.md @@ -24,7 +24,7 @@ come back as a third value `{ [file name] = buffer }` (or in the caller's `opts. | `F.save(value, dest?, opts?)` | `buffer` / `true` (+ the extra files, see above) | | `F.saveString(value, opts?)` | the encoded bytes as a string | | `F.convert(src, format, opts?)` | load + save (`opts` go to both; `opts.out = path` writes a file) | -| `F.detect(src, opts?)` | the format name (content sniffing first, then the extension); a format's optional `variant(r)` can name the flavour (`"webm"` for a WebM file read by mkv) | +| `F.detect(src, opts?)` | the format name (content sniffing first, then the extension); a format's optional `variant(r)` can name the flavour (`"webm"` for a WebM file read by mkv). Sniffing loads no format module (the generated `Sniffs.luau`); `load` / `open` / `save` load only the format they use | | `F.formats(category?)` | `{ { name, category, extensions, mime, caps } }` without loading any format (also [FORMATS.md](FORMATS.md)) | | `F.format(name)` | the format module itself (`sniff` / `decode` / `encode` / `open` and extras such as `png.info`) | diff --git a/docs/STYLE.md b/docs/STYLE.md index 16e2caf..01d4ef2 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -18,7 +18,7 @@ The reference implementation to copy is **PNG**: ``` src/Rosetta/ - init.luau Registry.luau (generated) api (layer 6) + init.luau Registry.luau Sniffs.luau (gen.) api (layer 6) ops/ ops (layer 5.5) editing on the standard types (F.ops.image / mesh / layers / audio / music; ImageOps, ...) // formats (layer 5) image audio video model cad font archive data @@ -156,6 +156,11 @@ Rules: inside a bigger buffer; never assume offset 0). It returns the category's standard type from `Types.luau` (`Types.Image.new(w, h)`, `Types.Scene.new()`, ...), `rgba8` for images unless `opts.native` asks for the source layout. Fill `meta.source = { format = "", ... }` with the source facts (bit depth, colour type, codec, ...). +- `sniff(r)` scores 0..1 and is copied, with the top-level locals, types and loops it reaches, into the generated + `Sniffs.luau`, so detection requires no format module (requires outside `core/` become proxies loaded at sniff time). + A sniff that reaches its module table (`Png.info(r)`), a forward-declared local or a load-time read of a non-core + module is not copied: its module then loads on every detection that gets that far. `tests/detect.luau` checks the + copies against the modules. - `encode(value, opts)` returns a buffer. Validate the value first and return `Err.ARG` for anything wrong. - `open(r, opts)` (audio / video) returns the streaming Decoder / VideoDecoder / Demuxer from `Types.luau`. If a format has `open` but no `decode`, `F.load` decodes the whole stream through it. @@ -312,8 +317,8 @@ t:done() 2. Shared code (a codec two formats need, a container) goes to `codecs//` or `containers/` instead, with its own test in `tests/codecs/` / `tests/containers/`. 3. `deps = { ... }` = the requires outside the folder. -4. `python3 -I tools/gen_registry.py` (regenerates `src/Rosetta/Registry.luau` and `docs/FORMATS.md`; never edit those - by hand; after a merge, just rerun it). +4. `python3 -I tools/gen_registry.py` (regenerates `src/Rosetta/Registry.luau`, `Sniffs.luau` and `docs/FORMATS.md`; + never edit those by hand; after a merge, just rerun it). 5. `tools/fixtures/.py` + `tests//.luau`. 6. `bash tools/test.sh ` while working (both runtimes), then `bash tools/test.sh` (everything + lint). 7. The docs line comes from the contract (`docs/FORMATS.md`); put format notes (limits, spec deviations, bench numbers) diff --git a/src/Rosetta/Registry.luau b/src/Rosetta/Registry.luau index fd33c7f..afbe9c8 100644 --- a/src/Rosetta/Registry.luau +++ b/src/Rosetta/Registry.luau @@ -2,6 +2,8 @@ -- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit. -- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format -- module on first use (a static require, as Roblox needs). Order: category, then name. +-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a +-- codec / container on first call, 2 the format module. variant: the module has variant(r). export type Entry = { name: string, category: string, @@ -10,6 +12,8 @@ export type Entry = { mime: { string }, deps: { string }, caps: { [string]: any }, + sniff: number, + variant: boolean?, load: () -> any, } @@ -22,6 +26,7 @@ local list: { Entry } = { mime = { "application/x-navi-animation" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff" }, caps = { decode = true, encode = true, alpha = true, animation = true, frames = true }, + sniff = 0, load = function() return require("@rosetta/image/ani") end, @@ -34,6 +39,7 @@ local list: { Entry } = { mime = { "image/x-build-art" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels", "codecs/image/Quantize" }, caps = { decode = true, encode = true, alpha = true, palette = true, frames = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/art") end, @@ -46,6 +52,7 @@ local list: { Entry } = { mime = { "image/x-blp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg", "codecs/image/Bcn" }, caps = { decode = true, encode = true, alpha = true, variants = { "blp1", "blp2" }, compressions = { "jpeg", "palette", "dxt1", "dxt3", "dxt5", "bgra" } }, + sniff = 0, load = function() return require("@rosetta/image/blp") end, @@ -58,6 +65,7 @@ local list: { Entry } = { mime = { "image/bmp", "image/x-bmp", "image/x-ms-bmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 2, 4, 8, 16, 24, 32 }, rle = true }, + sniff = 0, load = function() return require("@rosetta/image/bmp") end, @@ -70,6 +78,7 @@ local list: { Entry } = { mime = { "image/vnd-ms.dds", "image/x-dds" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Bcn", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7" } }, + sniff = 0, load = function() return require("@rosetta/image/dds") end, @@ -82,6 +91,7 @@ local list: { Entry } = { mime = { "image/x-exr", "image/aces" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Half", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, alpha = true, float = true, hdr = true, depths = { 16, 32 }, multipart = true, tiled = true }, + sniff = 0, load = function() return require("@rosetta/image/exr") end, @@ -94,6 +104,7 @@ local list: { Entry } = { mime = { "image/gif" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lzw", "codecs/image/Quantize", "Types" }, caps = { decode = true, encode = true, animation = true, alpha = true, palette = true, depths = { 1, 2, 4, 8 } }, + sniff = 0, load = function() return require("@rosetta/image/gif") end, @@ -106,6 +117,7 @@ local list: { Entry } = { mime = { "image/vnd.radiance", "image/x-hdr" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = false, float = true, depths = { 32 } }, + sniff = 0, load = function() return require("@rosetta/image/hdr") end, @@ -118,6 +130,7 @@ local list: { Entry } = { mime = { "image/icns", "image/x-icns" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/icns") end, @@ -130,6 +143,7 @@ local list: { Entry } = { mime = { "image/vnd.microsoft.icon", "image/x-icon" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, frames = true, depths = { 1, 4, 8, 16, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/ico") end, @@ -142,6 +156,7 @@ local list: { Entry } = { mime = { "image/x-ilbm", "image/x-iff" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/compress/PackBits", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 3, 4, 5, 6, 7, 8, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/ilbm") end, @@ -154,6 +169,7 @@ local list: { Entry } = { mime = { "image/jpeg" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Jpeg" }, caps = { decode = true, encode = true, lossy = true, alpha = false, depths = { 8, 12 }, progressive = true, arithmetic = true }, + sniff = 0, load = function() return require("@rosetta/image/jpeg") end, @@ -166,6 +182,7 @@ local list: { Entry } = { mime = { "image/ktx2", "image/ktx" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/image/Texel", "codecs/image/Texture" }, caps = { decode = true, encode = true, alpha = true, float = true, mipmaps = true, cubemap = true, compressed = { "bc1", "bc2", "bc3", "bc4", "bc5", "bc6h", "bc7", "etc1", "etc2", "eac" } }, + sniff = 0, load = function() return require("@rosetta/image/ktx") end, @@ -178,6 +195,7 @@ local list: { Entry } = { mime = { "image/x-quake-lmp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 }, variants = { "qpic", "palette", "colormap" } }, + sniff = 0, load = function() return require("@rosetta/image/lmp") end, @@ -190,6 +208,7 @@ local list: { Entry } = { mime = { "image/vnd.zbrush.pcx", "image/x-pcx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 2, 4, 8, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/pcx") end, @@ -202,6 +221,7 @@ local list: { Entry } = { mime = { "image/png", "image/apng" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "Types", "containers/Chunks" }, caps = { decode = true, encode = true, animation = true, alpha = true, depths = { 1, 2, 4, 8, 16 } }, + sniff = 0, load = function() return require("@rosetta/image/png") end, @@ -214,6 +234,7 @@ local list: { Entry } = { mime = { "image/x-portable-anymap", "image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-pixmap", "image/x-portable-arbitrarymap", "image/x-portable-floatmap" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 1, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return require("@rosetta/image/pnm") end, @@ -226,6 +247,7 @@ local list: { Entry } = { mime = { "image/qoi", "image/x-qoi" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/qoi") end, @@ -238,6 +260,7 @@ local list: { Entry } = { mime = { "image/sgi", "image/x-rgb" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, depths = { 8, 16 } }, + sniff = 0, load = function() return require("@rosetta/image/sgi") end, @@ -250,6 +273,7 @@ local list: { Entry } = { mime = { "image/x-quake-sprite" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, alpha = true, animation = true, variants = { "quake", "halflife", "spr32" } }, + sniff = 0, load = function() return require("@rosetta/image/spr") end, @@ -262,6 +286,7 @@ local list: { Entry } = { mime = { "image/x-sun-raster", "image/x-cmu-raster" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/image/Pixels" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 1, 8, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/sunras") end, @@ -274,6 +299,7 @@ local list: { Entry } = { mime = { "image/x-tga", "image/x-targa" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8, 15, 16, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/image/tga") end, @@ -286,6 +312,7 @@ local list: { Entry } = { mime = { "image/tiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/compress/Lzw", "codecs/compress/PackBits" }, caps = { decode = true, encode = true, alpha = true, pages = true, depths = { 1, 2, 4, 8, 16, 32 }, float = true }, + sniff = 0, load = function() return require("@rosetta/image/tiff") end, @@ -298,6 +325,7 @@ local list: { Entry } = { mime = { "image/x-tim" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 4, 8, 16, 24 } }, + sniff = 0, load = function() return require("@rosetta/image/tim") end, @@ -310,6 +338,7 @@ local list: { Entry } = { mime = { "image/x-vtf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Bcn", "codecs/image/Texel" }, caps = { decode = true, encode = false, alpha = true, animation = true, versions = { "7.0", "7.1", "7.2", "7.3", "7.4", "7.5" } }, + sniff = 0, load = function() return require("@rosetta/image/vtf") end, @@ -322,6 +351,7 @@ local list: { Entry } = { mime = { "image/webp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Vp8", "codecs/image/Vp8L", "containers/Riff" }, caps = { decode = true, encode = true, animation = true, alpha = true, lossy = true, lossless = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/webp") end, @@ -334,6 +364,7 @@ local list: { Entry } = { mime = { "image/x-xbitmap", "image/x-xbm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, depths = { 1 } }, + sniff = 0, load = function() return require("@rosetta/image/xbm") end, @@ -346,6 +377,7 @@ local list: { Entry } = { mime = { "image/x-xpixmap", "image/x-xpm" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = true, alpha = true, palette = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/image/xpm") end, @@ -358,6 +390,7 @@ local list: { Entry } = { mime = { "audio/aac", "audio/aacp", "audio/x-aac" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = false, codecs = { "aac" }, streaming = true }, + sniff = 1, load = function() return require("@rosetta/audio/aac") end, @@ -370,6 +403,7 @@ local list: { Entry } = { mime = { "audio/ac3", "audio/x-ac3" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Ac3" }, caps = { decode = true, encode = false, codecs = { "ac3" }, channels = 6, streaming = true, lossy = true }, + sniff = 1, load = function() return require("@rosetta/audio/ac3") end, @@ -382,6 +416,7 @@ local list: { Entry } = { mime = { "audio/x-adpcm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, headerless = true, codecs = { "ima", "ima_wav", "ms", "ima_qt", "psx" } }, + sniff = 0, load = function() return require("@rosetta/audio/adpcm") end, @@ -394,6 +429,7 @@ local list: { Entry } = { mime = { "audio/x-adx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 8 }, + sniff = 0, load = function() return require("@rosetta/audio/adx") end, @@ -406,6 +442,7 @@ local list: { Entry } = { mime = { "audio/aiff", "audio/x-aiff" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder", "containers/Chunks" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return require("@rosetta/audio/aiff") end, @@ -418,6 +455,7 @@ local list: { Entry } = { mime = { "audio/ape", "audio/x-ape", "audio/x-monkeys-audio" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Ape" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, float = true, depths = { 8, 16, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/audio/ape") end, @@ -430,6 +468,7 @@ local list: { Entry } = { mime = { "audio/basic", "audio/x-au" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, lossy = false }, + sniff = 0, load = function() return require("@rosetta/audio/au") end, @@ -442,6 +481,8 @@ local list: { Entry } = { mime = { "audio/x-brstm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = false, streaming = true, lossy = true, loops = true, containers = { "RSTM", "CSTM", "FSTM" } }, + sniff = 0, + variant = true, load = function() return require("@rosetta/audio/brstm") end, @@ -454,6 +495,7 @@ local list: { Entry } = { mime = { "audio/x-caf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Aac", "codecs/audio/Adpcm/Decoder", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream", "containers/Chunks" }, caps = { decode = true, encode = true, codecs = { "pcm", "alac", "aac", "ulaw", "alaw" }, encodeCodecs = { "pcm", "alac" }, tags = true, streaming = true }, + sniff = 0, load = function() return require("@rosetta/audio/caf") end, @@ -466,6 +508,7 @@ local list: { Entry } = { mime = { "audio/flac", "audio/x-flac" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Flac/Frame", "codecs/audio/Flac/Encode" }, caps = { decode = true, encode = true, streaming = true, depths = { 4, 8, 12, 16, 20, 24, 32 }, ogg = true, seek = true }, + sniff = 0, load = function() return require("@rosetta/audio/flac") end, @@ -478,6 +521,7 @@ local list: { Entry } = { mime = { "audio/mp4", "audio/x-m4a", "audio/m4a" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "codecs/audio/Aac", "codecs/audio/Alac", "codecs/audio/Pcm", "codecs/audio/Stream" }, caps = { decode = true, encode = true, codecs = { "aac", "alac" }, encodeCodecs = { "alac" }, tags = true, streaming = true }, + sniff = 1, load = function() return require("@rosetta/audio/m4a") end, @@ -490,6 +534,7 @@ local list: { Entry } = { mime = { "audio/mpeg", "audio/mp3", "audio/mpa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/Mpa/Header", "codecs/audio/Mpa/Core", "codecs/audio/Mpa/Encode3", "codecs/audio/Mpa/Encode2" }, caps = { decode = true, encode = true, streaming = true, seek = true, layers = { 1, 2, 3 }, encodeLayers = { 2, 3 }, channels = 2 }, + sniff = 1, load = function() return require("@rosetta/audio/mp3") end, @@ -502,6 +547,7 @@ local list: { Entry } = { mime = { "audio/x-musepack", "audio/musepack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Musepack" }, caps = { decode = true, encode = false, codecs = { "musepack" }, versions = { 7, 8 }, streaming = true, lossy = true }, + sniff = 1, load = function() return require("@rosetta/audio/mpc") end, @@ -514,6 +560,7 @@ local list: { Entry } = { mime = { "audio/opus", "audio/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/entropy/RangeCoder/Decoder", "codecs/audio/Pcm", "codecs/audio/Resample", "codecs/audio/VorbisComment", "codecs/audio/Opus/CeltEncoder", "codecs/audio/Opus/Decoder", "codecs/audio/Opus/Packet", "codecs/audio/Opus/Celt", "codecs/audio/Opus/Silk" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255, rates = { 48000 }, encodeModes = { "celt" }, encodeChannels = 2 }, + sniff = 0, load = function() return require("@rosetta/audio/opus") end, @@ -526,6 +573,7 @@ local list: { Entry } = { mime = { "audio/qoa" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/Qoa" }, caps = { decode = true, encode = true, streaming = true, lossy = true, seek = true, channels = 8 }, + sniff = 0, load = function() return require("@rosetta/audio/qoa") end, @@ -538,6 +586,7 @@ local list: { Entry } = { mime = { "audio/x-tta", "audio/tta" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/Tta" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, depths = { 8, 16, 24 } }, + sniff = 0, load = function() return require("@rosetta/audio/tta") end, @@ -550,6 +599,7 @@ local list: { Entry } = { mime = { "audio/x-vag" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Adpcm", "codecs/audio/Adpcm/Decoder" }, caps = { decode = true, encode = true, streaming = true, lossy = true, loops = true, channels = 2 }, + sniff = 0, load = function() return require("@rosetta/audio/vag") end, @@ -562,6 +612,7 @@ local list: { Entry } = { mime = { "audio/x-voc" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16 }, lossy = false }, + sniff = 0, load = function() return require("@rosetta/audio/voc") end, @@ -574,6 +625,7 @@ local list: { Entry } = { mime = { "audio/ogg", "audio/vorbis" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "codecs/audio/Mdct", "codecs/audio/Pcm", "codecs/audio/VorbisComment", "codecs/audio/Vorbis/Tables", "codecs/audio/Vorbis/Setup", "codecs/audio/Vorbis/Packet" }, caps = { decode = true, encode = true, streaming = true, seek = true, lossy = true, channels = 255 }, + sniff = 0, load = function() return require("@rosetta/audio/vorbis") end, @@ -586,6 +638,7 @@ local list: { Entry } = { mime = { "audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Riff", "codecs/audio/Pcm", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, streaming = true, depths = { 8, 16, 24, 32 }, float = true, rf64 = true }, + sniff = 1, load = function() return require("@rosetta/audio/wav") end, @@ -598,6 +651,7 @@ local list: { Entry } = { mime = { "audio/x-wavpack", "audio/wavpack" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Pcm", "codecs/audio/Stream", "codecs/audio/ApeTag", "codecs/audio/WavPack" }, caps = { decode = true, encode = false, streaming = true, seek = true, lossless = true, hybrid = true, float = true, depths = { 8, 12, 16, 20, 24, 32 } }, + sniff = 0, load = function() return require("@rosetta/audio/wavpack") end, @@ -610,6 +664,7 @@ local list: { Entry } = { mime = { "video/x-msvideo", "video/avi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Avi", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "mjpeg", "mpeg1", "mpeg2", "rawvideo" }, audio = true, odml = true }, + sniff = 0, load = function() return require("@rosetta/video/avi") end, @@ -622,6 +677,7 @@ local list: { Entry } = { mime = { "video/x-fli", "video/fli", "video/x-flc" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "flic" }, depths = { 8, 15, 16, 24 } }, + sniff = 0, load = function() return require("@rosetta/video/fli") end, @@ -634,6 +690,7 @@ local list: { Entry } = { mime = { "video/x-flv", "video/flv" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H263", "codecs/video/H264", "codecs/audio/Aac" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "flv1", "h264" }, audio = true, metadata = true }, + sniff = 0, load = function() return require("@rosetta/video/flv") end, @@ -646,6 +703,7 @@ local list: { Entry } = { mime = { "video/h264" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source", "codecs/video/H264" }, caps = { decode = true, encode = true, streaming = true, video = { "h264" }, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/video/h264") end, @@ -658,6 +716,8 @@ local list: { Entry } = { mime = { "video/x-matroska", "video/webm", "audio/x-matroska", "audio/webm" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ebml", "containers/Demux", "containers/Avi", "containers/IsoBmff/QtPalette", "codecs/compress/Deflate", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "vp8", "mjpeg", "mpeg1", "mpeg2", "theora", "rawvideo" }, audio = true, subtitles = true }, + sniff = 0, + variant = true, load = function() return require("@rosetta/video/mkv") end, @@ -670,6 +730,7 @@ local list: { Entry } = { mime = { "video/mp4", "video/quicktime", "video/3gpp" }, deps = { "core/Err", "core/Bytes", "Types", "containers/IsoBmff", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "mjpeg", "mpeg1", "mpeg2", "h264" }, audio = true, fragments = true }, + sniff = 1, load = function() return require("@rosetta/video/mp4") end, @@ -682,6 +743,7 @@ local list: { Entry } = { mime = { "video/mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegPs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2" }, audio = true }, + sniff = 0, load = function() return require("@rosetta/video/mpegps") end, @@ -694,6 +756,7 @@ local list: { Entry } = { mime = { "video/mp2t" }, deps = { "core/Err", "core/Bytes", "Types", "containers/MpegTs", "containers/MpegEs", "containers/Demux", "codecs/video/Video" }, caps = { decode = true, encode = false, streaming = true, video = { "mpeg1", "mpeg2", "h264" }, audio = true }, + sniff = 0, load = function() return require("@rosetta/video/mpegts") end, @@ -706,6 +769,7 @@ local list: { Entry } = { mime = { "video/ogg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Ogg", "containers/Demux", "containers/AudioWrap", "codecs/video/Theora", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, remux = true, video = { "theora" }, audio = true }, + sniff = 0, load = function() return require("@rosetta/video/ogv") end, @@ -718,6 +782,7 @@ local list: { Entry } = { mime = { "video/vnd.radgamettools.smacker" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/audio/Stream", "codecs/video/Legacy/Smacker" }, caps = { decode = true, encode = false, streaming = true, video = { "smackvid" }, audio = { "smackaudio", "pcm_u8", "pcm_s16le" } }, + sniff = 0, load = function() return require("@rosetta/video/smk") end, @@ -730,6 +795,7 @@ local list: { Entry } = { mime = { "video/x-yuv4mpeg" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Demux", "codecs/video/Video", "codecs/video/Video/Source" }, caps = { decode = true, encode = true, streaming = true, video = { "rawvideo" }, depths = { 8, 10, 12, 16 } }, + sniff = 0, load = function() return require("@rosetta/video/y4m") end, @@ -742,6 +808,7 @@ local list: { Entry } = { mime = { "application/x-3ds", "image/x-3ds" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, textures = true, animation = true, cameras = true, lights = true, instancing = true }, + sniff = 0, load = function() return require("@rosetta/model/3ds") end, @@ -754,6 +821,7 @@ local list: { Entry } = { mime = { "model/3mf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "containers/Zip" }, caps = { decode = true, encode = true, materials = true, vertexColors = true, textures = true, units = true }, + sniff = 0, load = function() return require("@rosetta/model/3mf") end, @@ -766,6 +834,7 @@ local list: { Entry } = { mime = { "model/x-ase", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, vertexColors = true }, + sniff = 1, load = function() return require("@rosetta/model/ase") end, @@ -778,6 +847,7 @@ local list: { Entry } = { mime = { "model/x-b3d" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/model/Mat4" }, caps = { decode = true, encode = false, materials = true, textures = true, skins = true, animation = true, colors = true }, + sniff = 0, load = function() return require("@rosetta/model/b3d") end, @@ -790,6 +860,7 @@ local list: { Entry } = { mime = { "application/x-blender" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Blend", "codecs/compress/Deflate", "codecs/compress/Zstd", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Polygon" }, caps = { decode = true, encode = false, materials = true, textures = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true, compressed = true }, + sniff = 1, load = function() return require("@rosetta/model/blend") end, @@ -802,6 +873,7 @@ local list: { Entry } = { mime = { "model/x-bsp" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/image/Miptex", "codecs/model/Patch" }, caps = { decode = true, encode = false, variants = { "quake", "bsp2", "2psb", "halflife", "quake2", "quake3" }, lightmaps = true, collision = true, visibility = true }, + sniff = 0, load = function() return require("@rosetta/model/bsp") end, @@ -814,6 +886,7 @@ local list: { Entry } = { mime = { "application/x-build-map" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Polygon" }, caps = { decode = true, encode = true, sprites = true, slopes = true }, + sniff = 0, load = function() return require("@rosetta/model/buildmap") end, @@ -826,6 +899,7 @@ local list: { Entry } = { mime = { "text/x-doom3-map" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Brush", "codecs/model/Patch", "codecs/model/Mat4", "codecs/text/Lexer" }, caps = { decode = true, encode = false, patches = true, variants = { "doom3", "quake4" } }, + sniff = 0, load = function() return require("@rosetta/model/d3map") end, @@ -838,6 +912,7 @@ local list: { Entry } = { mime = { "model/vnd.collada+xml", "model/vnd.collada+zip" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Base64", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, polygons = true, skins = true, morphTargets = true, animation = true, cameras = true, lights = true, zae = true }, + sniff = 0, load = function() return require("@rosetta/model/dae") end, @@ -850,6 +925,7 @@ local list: { Entry } = { mime = { "application/vnd.autodesk.fbx", "model/fbx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "core/Base64", "codecs/model/Mat4" }, caps = { decode = true, encode = true, binary = true, ascii = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, polygons = true }, + sniff = 2, load = function() return require("@rosetta/model/fbx") end, @@ -862,6 +938,7 @@ local list: { Entry } = { mime = { "model/gltf+json", "model/gltf-binary" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Base64", "core/Sniff", "codecs/model/Draco" }, caps = { decode = true, encode = true, binary = true, materials = true, animation = true, skins = true, morphTargets = true, cameras = true, lights = true, draco = true }, + sniff = 0, load = function() return require("@rosetta/model/gltf") end, @@ -874,6 +951,7 @@ local list: { Entry } = { mime = { "application/x-godot-scene" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant", "codecs/model/Mat4" }, caps = { decode = true, encode = true, text = true, materials = true, cameras = true, lights = true, instances = true }, + sniff = 0, load = function() return require("@rosetta/model/godot") end, @@ -886,6 +964,7 @@ local list: { Entry } = { mime = { "model/x-iqm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/Sampler" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true, vertexColors = true }, + sniff = 0, load = function() return require("@rosetta/model/iqm") end, @@ -898,6 +977,7 @@ local list: { Entry } = { mime = { "application/x-ldraw", "application/x-multi-part-ldraw" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types" }, caps = { decode = true, encode = false, materials = true, lines = true, instancing = true }, + sniff = 0, load = function() return require("@rosetta/model/ldraw") end, @@ -910,6 +990,7 @@ local list: { Entry } = { mime = { "image/x-lwo", "model/x-lwo" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks" }, caps = { decode = true, encode = false, materials = true, polygons = true, vertexColors = true, morphTargets = true }, + sniff = 0, load = function() return require("@rosetta/model/lwo") end, @@ -922,6 +1003,7 @@ local list: { Entry } = { mime = { "text/x-quake-map" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Miptex", "codecs/model/Brush", "codecs/model/Patch" }, caps = { decode = true, encode = true, variants = { "quake", "valve220", "quake2", "quake3" }, patches = true }, + sniff = 0, load = function() return require("@rosetta/model/map") end, @@ -934,6 +1016,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-region" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/text/Nbt", "codecs/model/Minecraft", "codecs/compress/Lz4" }, caps = { decode = true, encode = false, voxels = true, blocks = true }, + sniff = 0, load = function() return require("@rosetta/model/mca") end, @@ -946,6 +1029,7 @@ local list: { Entry } = { mime = { "model/x-md2" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/md2") end, @@ -958,6 +1042,7 @@ local list: { Entry } = { mime = { "model/x-md3" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, morph = true, animation = true, tags = true }, + sniff = 0, load = function() return require("@rosetta/model/md3") end, @@ -970,6 +1055,7 @@ local list: { Entry } = { mime = { "model/x-md5mesh", "model/x-md5anim" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/model/Rig" }, caps = { decode = true, encode = false, skins = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/md5") end, @@ -982,6 +1068,7 @@ local list: { Entry } = { mime = { "model/x-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Pixels", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim" }, caps = { decode = true, encode = false, variants = { "quake", "halflife" }, morph = true, skins = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/mdl") end, @@ -994,6 +1081,7 @@ local list: { Entry } = { mime = { "application/x-ms3d" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, materials = true, skins = true, animation = true }, + sniff = 1, load = function() return require("@rosetta/model/ms3d") end, @@ -1006,6 +1094,7 @@ local list: { Entry } = { mime = { "model/obj" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, materials = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return require("@rosetta/model/obj") end, @@ -1018,6 +1107,7 @@ local list: { Entry } = { mime = { "model/off", "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, polygons = true, points = true, colors = true, binary = false }, + sniff = 0, load = function() return require("@rosetta/model/off") end, @@ -1030,6 +1120,7 @@ local list: { Entry } = { mime = { "model/ply", "application/ply" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, polygons = true, points = true, colors = true }, + sniff = 0, load = function() return require("@rosetta/model/ply") end, @@ -1042,6 +1133,7 @@ local list: { Entry } = { mime = { "model/x-pmx", "model/x-pmd" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text" }, caps = { decode = true, encode = false, materials = true, skins = true, morphTargets = true, pmd = true }, + sniff = 0, load = function() return require("@rosetta/model/pmx") end, @@ -1054,6 +1146,7 @@ local list: { Entry } = { mime = { "model/x-doom3-proc" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Lexer" }, caps = { decode = true, encode = false, portals = true }, + sniff = 0, load = function() return require("@rosetta/model/proc") end, @@ -1066,6 +1159,7 @@ local list: { Entry } = { mime = { "model/x-qubicle" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, truecolor = true }, + sniff = 0, load = function() return require("@rosetta/model/qb") end, @@ -1078,6 +1172,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxm", "application/x-roblox-rbxl" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Lz4", "codecs/compress/Zstd", "codecs/model/Rbx", "codecs/model/Rbx/Binary" }, caps = { decode = true, encode = true, tree = true, compression = { "none", "lz4", "zstd" } }, + sniff = 0, + variant = true, load = function() return require("@rosetta/model/rbxm") end, @@ -1090,6 +1186,8 @@ local list: { Entry } = { mime = { "application/x-roblox-rbxmx", "application/x-roblox-rbxlx" }, deps = { "core/Err", "core/Bytes", "core/Base64", "core/Md5", "codecs/text/Xml", "codecs/model/Rbx" }, caps = { decode = true, encode = true, tree = true }, + sniff = 0, + variant = true, load = function() return require("@rosetta/model/rbxmx") end, @@ -1102,6 +1200,7 @@ local list: { Entry } = { mime = { "application/x-roblox-mesh" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Draco" }, caps = { decode = true, encode = true, skinning = true, lods = true, versions = { "1.00", "1.01", "2.00", "3.00", "3.01", "4.00", "4.01", "5.00", "6.00", "7.00" } }, + sniff = 0, load = function() return require("@rosetta/model/robloxmesh") end, @@ -1114,6 +1213,8 @@ local list: { Entry } = { mime = { "application/x-minecraft-schematic" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Nbt", "codecs/model/Minecraft" }, caps = { decode = true, encode = true, voxels = true, blocks = true, variants = { "schem", "schematic", "litematic" } }, + sniff = 1, + variant = true, load = function() return require("@rosetta/model/schematic") end, @@ -1126,6 +1227,7 @@ local list: { Entry } = { mime = { "model/x-smd", "text/plain" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/Mat4", "codecs/model/MeshFlatten", "codecs/model/Rig" }, caps = { decode = true, encode = true, skins = true, animation = true }, + sniff = 0, load = function() return require("@rosetta/model/smd") end, @@ -1138,6 +1240,7 @@ local list: { Entry } = { mime = { "model/x-source-mdl" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "codecs/image/Half", "codecs/model/Mat4", "codecs/model/Rig", "codecs/model/SourceAnim", "codecs/text/KeyValues" }, caps = { decode = true, encode = false, skins = true, morph = true, animation = true, lods = true }, + sniff = 0, load = function() return require("@rosetta/model/sourcemdl") end, @@ -1150,6 +1253,7 @@ local list: { Entry } = { mime = { "model/stl", "application/sla" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/MeshFlatten" }, caps = { decode = true, encode = true, ascii = true, binary = true, colors = true, indexed = false }, + sniff = 0, load = function() return require("@rosetta/model/stl") end, @@ -1162,6 +1266,7 @@ local list: { Entry } = { mime = { "text/x-unreal-t3d" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Text", "codecs/model/Brush" }, caps = { decode = true, encode = false, text = true, brushes = true, actors = true }, + sniff = 0, load = function() return require("@rosetta/model/t3d") end, @@ -1174,6 +1279,7 @@ local list: { Entry } = { mime = { "text/x-udmf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/model/DoomMap" }, caps = { decode = true, encode = false, maps = true }, + sniff = 0, load = function() return require("@rosetta/model/udmf") end, @@ -1186,6 +1292,7 @@ local list: { Entry } = { mime = { "model/vnd.usda", "model/vnd.usdz+zip" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/model/Mat4" }, caps = { decode = true, encode = true, materials = true, animation = true, cameras = true, lights = true, polygons = true, vertexColors = true, usdz = "read", usdc = false }, + sniff = 0, load = function() return require("@rosetta/model/usda") end, @@ -1198,6 +1305,7 @@ local list: { Entry } = { mime = { "model/x-vbsp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "codecs/text/KeyValues", "codecs/model/Mat4", "codecs/model/Displacement", "containers/Zip", "containers/Archive" }, caps = { decode = true, encode = false, versions = { 19, 20, 21 }, displacements = true, staticProps = true, pak = true }, + sniff = 0, load = function() return require("@rosetta/model/vbsp") end, @@ -1210,6 +1318,7 @@ local list: { Entry } = { mime = { "model/x-vmf" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Sniff", "Types", "codecs/text/KeyValues", "codecs/model/Brush", "codecs/model/Displacement", "codecs/model/Mat4" }, caps = { decode = true, encode = true, displacements = true, roundTrip = true }, + sniff = 0, load = function() return require("@rosetta/model/vmf") end, @@ -1222,6 +1331,7 @@ local list: { Entry } = { mime = { "model/x-vox" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, voxels = true, sceneGraph = true, materials = true }, + sniff = 0, load = function() return require("@rosetta/model/vox") end, @@ -1234,6 +1344,7 @@ local list: { Entry } = { mime = { "model/vrml", "x-world/x-vrml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true }, + sniff = 0, load = function() return require("@rosetta/model/vrml") end, @@ -1246,6 +1357,7 @@ local list: { Entry } = { mime = { "model/x-directx", "text/x-directx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate", "codecs/model/Mat4", "codecs/model/Rig" }, caps = { decode = true, encode = false, text = true, binary = true, compressed = true, materials = true, skins = true, animation = true, polygons = true, vertexColors = true }, + sniff = 0, load = function() return require("@rosetta/model/x") end, @@ -1258,6 +1370,7 @@ local list: { Entry } = { mime = { "model/x3d+xml", "model/x3d-vrml", "model/x3d+fastinfoset" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/model/Vrml" }, caps = { decode = true, encode = true, materials = true, polygons = true, animation = true, cameras = true, lights = true, lines = true, points = true, xml = true, classic = true }, + sniff = 0, load = function() return require("@rosetta/model/x3d") end, @@ -1270,6 +1383,7 @@ local list: { Entry } = { mime = { "model/step", "application/step", "application/p21" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, complexEntities = true, sections = true, brep = "plugin", tessellate = "plugin" }, + sniff = 0, load = function() return require("@rosetta/cad/step") end, @@ -1282,6 +1396,7 @@ local list: { Entry } = { mime = { "application/x-font-bdf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true }, + sniff = 0, load = function() return require("@rosetta/font/bdf") end, @@ -1294,6 +1409,7 @@ local list: { Entry } = { mime = { "application/x-bmfont" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, bitmap = true, variants = { "text", "xml", "binary" }, extraFiles = true }, + sniff = 0, load = function() return require("@rosetta/font/bmfont") end, @@ -1306,6 +1422,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-fontobject" }, deps = { "core/Err", "core/Bytes", "codecs/text/Text", "codecs/font/TrueType" }, caps = { decode = true, encode = true, variants = { "1.0", "2.1", "2.2" } }, + sniff = 0, load = function() return require("@rosetta/font/eot") end, @@ -1318,6 +1435,7 @@ local list: { Entry } = { mime = { "application/x-font-fnt" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Text", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true, variants = { "fnt2", "fnt3", "ne", "pe" } }, + sniff = 0, load = function() return require("@rosetta/font/fon") end, @@ -1330,6 +1448,7 @@ local list: { Entry } = { mime = { "application/x-hershey-font" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster" }, caps = { decode = true, encode = false, strokes = true }, + sniff = 0, load = function() return require("@rosetta/font/hershey") end, @@ -1342,6 +1461,7 @@ local list: { Entry } = { mime = { "application/x-font-pcf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = false, bitmap = true }, + sniff = 0, load = function() return require("@rosetta/font/pcf") end, @@ -1354,6 +1474,7 @@ local list: { Entry } = { mime = { "application/x-font-linux-psf" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/font/Bitmap" }, caps = { decode = true, encode = true, bitmap = true, variants = { "psf1", "psf2" } }, + sniff = 0, load = function() return require("@rosetta/font/psf") end, @@ -1366,6 +1487,7 @@ local list: { Entry } = { mime = { "font/ttf", "font/otf", "font/collection" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, collection = true, kerning = true }, + sniff = 0, load = function() return require("@rosetta/font/ttf") end, @@ -1378,6 +1500,7 @@ local list: { Entry } = { mime = { "application/x-font-type1" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Raster", "codecs/font/GlyphNames" }, caps = { decode = true, encode = false, outlines = { "type1" }, variants = { "pfb", "pfa" } }, + sniff = 0, load = function() return require("@rosetta/font/type1") end, @@ -1390,6 +1513,7 @@ local list: { Entry } = { mime = { "font/woff" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/font/TrueType" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" } }, + sniff = 0, load = function() return require("@rosetta/font/woff") end, @@ -1402,6 +1526,7 @@ local list: { Entry } = { mime = { "font/woff2" }, deps = { "core/Err", "core/Bytes", "codecs/font/TrueType", "codecs/compress/Brotli" }, caps = { decode = true, encode = false, outlines = { "truetype", "cff" }, transforms = { "glyf", "loca", "hmtx" } }, + sniff = 0, load = function() return require("@rosetta/font/woff2") end, @@ -1414,6 +1539,7 @@ local list: { Entry } = { mime = { "application/x-7z-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "Types", "codecs/compress/Lzma", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Zstd", "containers/Archive", "codecs/text/Text" }, caps = { decode = true, encode = false, methods = { "copy", "lzma", "lzma2", "deflate", "bcj", "delta" }, encrypted = false }, + sniff = 0, load = function() return require("@rosetta/archive/7z") end, @@ -1426,6 +1552,7 @@ local list: { Entry } = { mime = { "application/x-amiga-disk-format" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = false, variants = { "ofs", "ffs" } }, + sniff = 0, load = function() return require("@rosetta/archive/adf") end, @@ -1438,6 +1565,7 @@ local list: { Entry } = { mime = { "application/applefile", "multipart/appledouble" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "applesingle", "appledouble" } }, + sniff = 0, load = function() return require("@rosetta/archive/applesingle") end, @@ -1450,6 +1578,7 @@ local list: { Entry } = { mime = { "application/x-archive", "application/vnd.debian.binary-package" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "gnu", "bsd" }, deb = true }, + sniff = 0, load = function() return require("@rosetta/archive/ar") end, @@ -1462,6 +1591,7 @@ local list: { Entry } = { mime = { "application/x-arj" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "arj1", "arj2", "arj3", "arj4" } }, + sniff = 0, load = function() return require("@rosetta/archive/arj") end, @@ -1474,6 +1604,7 @@ local list: { Entry } = { mime = { "application/mac-binhex40" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true }, + sniff = 0, load = function() return require("@rosetta/archive/binhex") end, @@ -1486,6 +1617,7 @@ local list: { Entry } = { mime = { "application/x-brotli" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Brotli", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return require("@rosetta/archive/br") end, @@ -1498,6 +1630,7 @@ local list: { Entry } = { mime = { "application/x-bzip2" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Bzip2" }, caps = { decode = true, encode = false, stream = true }, + sniff = 0, load = function() return require("@rosetta/archive/bz2") end, @@ -1510,6 +1643,7 @@ local list: { Entry } = { mime = { "application/vnd.ms-cab-compressed" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzx", "codecs/compress/Quantum", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "store", "mszip", "lzx", "quantum" } }, + sniff = 0, load = function() return require("@rosetta/archive/cab") end, @@ -1522,6 +1656,7 @@ local list: { Entry } = { mime = { "application/x-cpio" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = true, variants = { "newc", "crc", "odc", "bin" } }, + sniff = 0, load = function() return require("@rosetta/archive/cpio") end, @@ -1534,6 +1669,7 @@ local list: { Entry } = { mime = { "application/x-d64" }, deps = { "core/Err", "core/Bytes", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "d64", "d71", "d81" } }, + sniff = 0, load = function() return require("@rosetta/archive/d64") end, @@ -1546,6 +1682,7 @@ local list: { Entry } = { mime = { "application/x-fat-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Fat" }, caps = { decode = true, encode = true, variants = { "fat12", "fat16", "fat32" } }, + sniff = 1, load = function() return require("@rosetta/archive/fat") end, @@ -1558,6 +1695,7 @@ local list: { Entry } = { mime = { "application/x-build-grp" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/archive/grp") end, @@ -1570,6 +1708,7 @@ local list: { Entry } = { mime = { "application/gzip" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, stream = true }, + sniff = 0, load = function() return require("@rosetta/archive/gzip") end, @@ -1582,6 +1721,7 @@ local list: { Entry } = { mime = { "application/x-iso9660-image" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Iso9660" }, caps = { decode = true, encode = false, extensions = { "joliet", "rockridge", "eltorito" } }, + sniff = 0, load = function() return require("@rosetta/archive/iso") end, @@ -1594,6 +1734,7 @@ local list: { Entry } = { mime = { "application/x-lzh-compressed" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = true, methods = { "lh0", "lh1", "lh4", "lh5", "lh6", "lh7", "lhx", "lzs", "lz5", "lz4", "lhd" } }, + sniff = 0, load = function() return require("@rosetta/archive/lha") end, @@ -1606,6 +1747,7 @@ local list: { Entry } = { mime = { "application/x-lz4" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Lz4", "codecs/compress/Xxh32", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, legacy = true }, + sniff = 0, load = function() return require("@rosetta/archive/lz4") end, @@ -1618,6 +1760,7 @@ local list: { Entry } = { mime = { "application/x-macbinary" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "containers/Archive", "containers/MacFile" }, caps = { decode = true, encode = true, forks = true, variants = { "I", "II", "III" } }, + sniff = 0, load = function() return require("@rosetta/archive/macbinary") end, @@ -1630,6 +1773,7 @@ local list: { Entry } = { mime = { "application/x-mpq" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "codecs/compress/Deflate", "codecs/compress/Bzip2", "codecs/compress/Lzma", "codecs/compress/Explode" }, caps = { decode = true, encode = false, versions = { 1, 2, 3, 4 }, methods = { "zlib", "implode", "bzip2", "lzma", "sparse" }, encryption = true }, + sniff = 0, load = function() return require("@rosetta/archive/mpq") end, @@ -1642,6 +1786,7 @@ local list: { Entry } = { mime = { "application/x-pak" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "quake", "sin" } }, + sniff = 0, load = function() return require("@rosetta/archive/pak") end, @@ -1654,6 +1799,7 @@ local list: { Entry } = { mime = { "application/x-rpm" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Deflate", "codecs/compress/Lzma", "codecs/compress/Zstd", "codecs/compress/Bzip2", "containers/Archive", "containers/Cpio" }, caps = { decode = true, encode = false, compressors = { "gzip", "bzip2", "xz", "lzma", "zstd" } }, + sniff = 0, load = function() return require("@rosetta/archive/rpm") end, @@ -1666,6 +1812,7 @@ local list: { Entry } = { mime = { "application/x-tar" }, deps = { "core/Err", "core/Bytes", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true, variants = { "ustar", "pax", "gnu" } }, + sniff = 1, load = function() return require("@rosetta/archive/tar") end, @@ -1678,6 +1825,7 @@ local list: { Entry } = { mime = { "application/x-unitypackage" }, deps = { "core/Err", "core/Bytes", "core/Md5", "codecs/compress/Deflate", "containers/Archive", "containers/Tar" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return require("@rosetta/archive/unitypackage") end, @@ -1690,6 +1838,7 @@ local list: { Entry } = { mime = { "text/x-uuencode" }, deps = { "core/Err", "core/Bytes", "core/Base64", "containers/Archive" }, caps = { decode = true, encode = true, variants = { "uu", "xx", "base64" } }, + sniff = 0, load = function() return require("@rosetta/archive/uu") end, @@ -1702,6 +1851,7 @@ local list: { Entry } = { mime = { "application/x-vpk" }, deps = { "core/Err", "core/Bytes", "core/Input", "core/Crc32", "core/Md5", "containers/Archive" }, caps = { decode = true, encode = true, versions = { 1, 2 }, multipart = true }, + sniff = 0, load = function() return require("@rosetta/archive/vpk") end, @@ -1714,6 +1864,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-vswap" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels" }, caps = { decode = true, encode = false, images = true, sounds = true }, + sniff = 0, load = function() return require("@rosetta/archive/vswap") end, @@ -1726,6 +1877,7 @@ local list: { Entry } = { mime = { "application/x-doom" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/model/DoomMap" }, caps = { decode = true, encode = true, images = true, maps = true, variants = { "iwad", "pwad" } }, + sniff = 0, load = function() return require("@rosetta/archive/wad") end, @@ -1738,6 +1890,7 @@ local list: { Entry } = { mime = { "application/x-quake-wad" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types", "containers/Archive", "codecs/image/Pixels", "codecs/image/Miptex" }, caps = { decode = true, encode = true, images = true, variants = { "wad2", "wad3" } }, + sniff = 0, load = function() return require("@rosetta/archive/wad2") end, @@ -1750,6 +1903,7 @@ local list: { Entry } = { mime = { "application/x-xz", "application/x-lzma" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Lzma", "containers/Archive" }, caps = { decode = true, encode = false, stream = true, filters = { "lzma2", "lzma", "delta", "x86", "powerpc", "arm", "armthumb", "sparc", "arm64" } }, + sniff = 0, load = function() return require("@rosetta/archive/xz") end, @@ -1762,6 +1916,7 @@ local list: { Entry } = { mime = { "application/x-yenc" }, deps = { "core/Err", "core/Bytes", "core/Crc32", "containers/Archive" }, caps = { decode = true, encode = true, multipart = true }, + sniff = 0, load = function() return require("@rosetta/archive/yenc") end, @@ -1774,6 +1929,7 @@ local list: { Entry } = { mime = { "application/x-compress" }, deps = { "core/Err", "core/Bytes", "codecs/compress/UnixCompress", "containers/Archive" }, caps = { decode = true, encode = true, stream = true, bits = { 9, 16 } }, + sniff = 0, load = function() return require("@rosetta/archive/z") end, @@ -1786,6 +1942,7 @@ local list: { Entry } = { mime = { "application/zip", "application/x-zip-compressed" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip" }, caps = { decode = true, encode = true, methods = { "store", "deflate" }, zip64 = true }, + sniff = 0, load = function() return require("@rosetta/archive/zip") end, @@ -1798,6 +1955,7 @@ local list: { Entry } = { mime = { "application/x-zoo" }, deps = { "core/Err", "core/Bytes", "core/Crc16", "codecs/compress/Lzw", "codecs/compress/Lzh", "containers/Archive" }, caps = { decode = true, encode = false, methods = { "store", "lzw", "lzh" } }, + sniff = 0, load = function() return require("@rosetta/archive/zoo") end, @@ -1810,6 +1968,7 @@ local list: { Entry } = { mime = { "application/zstd" }, deps = { "core/Err", "core/Bytes", "codecs/compress/Zstd", "containers/Archive" }, caps = { decode = true, encode = false, stream = true }, + sniff = 1, load = function() return require("@rosetta/archive/zst") end, @@ -1822,6 +1981,7 @@ local list: { Entry } = { mime = { "application/cbor", "application/cbor-seq" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true, tags = true }, + sniff = 0, load = function() return require("@rosetta/data/cbor") end, @@ -1834,6 +1994,7 @@ local list: { Entry } = { mime = { "text/csv", "text/tab-separated-values" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, header = true }, + sniff = 0, load = function() return require("@rosetta/data/csv") end, @@ -1846,6 +2007,7 @@ local list: { Entry } = { mime = { "text/plain" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/ini") end, @@ -1858,6 +2020,7 @@ local list: { Entry } = { mime = { "application/json", "application/x-ndjson" }, deps = { "core/Err", "core/Bytes", "codecs/text/Json", "core/Sniff" }, caps = { decode = true, encode = true, ordered = true, streaming = true }, + sniff = 0, load = function() return require("@rosetta/data/json") end, @@ -1870,6 +2033,7 @@ local list: { Entry } = { mime = { "application/msgpack", "application/x-msgpack" }, deps = { "core/Err", "core/Bytes", "Types" }, caps = { decode = true, encode = true, binary = true, ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/msgpack") end, @@ -1882,6 +2046,7 @@ local list: { Entry } = { mime = { "application/x-minecraft-nbt" }, deps = { "core/Err", "core/Bytes", "codecs/text/Nbt" }, caps = { decode = true, encode = true, binary = true, ordered = true, typed = true }, + sniff = 1, load = function() return require("@rosetta/data/nbt") end, @@ -1894,6 +2059,7 @@ local list: { Entry } = { mime = { "application/x-plist", "application/x-bplist" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Xml", "codecs/text/Json" }, caps = { decode = true, encode = true, binary = "read", ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/plist") end, @@ -1906,6 +2072,7 @@ local list: { Entry } = { mime = { "text/x-quake3-shader" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/data/q3shader") end, @@ -1918,6 +2085,7 @@ local list: { Entry } = { mime = { "text/x-quake3-skin" }, deps = { "core/Err", "core/Bytes" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/data/q3skin") end, @@ -1930,6 +2098,7 @@ local list: { Entry } = { mime = { "text/x-minecraft-snbt" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/Nbt" }, caps = { decode = true, encode = true, ordered = true, typed = true }, + sniff = 0, load = function() return require("@rosetta/data/snbt") end, @@ -1942,6 +2111,7 @@ local list: { Entry } = { mime = { "application/toml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Json", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, dates = true }, + sniff = 0, load = function() return require("@rosetta/data/toml") end, @@ -1954,6 +2124,7 @@ local list: { Entry } = { mime = { "application/x-godot-resource" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/GodotVariant" }, caps = { decode = true, encode = true, ordered = true }, + sniff = 0, load = function() return require("@rosetta/data/tres") end, @@ -1966,6 +2137,7 @@ local list: { Entry } = { mime = { "text/x-vdf" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "codecs/text/KeyValues" }, caps = { decode = true, encode = true, ordered = true, binary = true }, + sniff = 1, load = function() return require("@rosetta/data/vdf") end, @@ -1978,6 +2150,7 @@ local list: { Entry } = { mime = { "application/xml", "text/xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "core/Sniff" }, caps = { decode = true, encode = true, namespaces = true, streaming = true }, + sniff = 0, load = function() return require("@rosetta/data/xml") end, @@ -1990,6 +2163,7 @@ local list: { Entry } = { mime = { "application/yaml", "application/x-yaml", "text/yaml" }, deps = { "core/Err", "core/Bytes", "Types", "core/Base64", "codecs/text/Text" }, caps = { decode = true, encode = true, ordered = true, multiDocument = true, anchors = true }, + sniff = 0, load = function() return require("@rosetta/data/yaml") end, @@ -2002,6 +2176,7 @@ local list: { Entry } = { mime = { "application/x-wolf3d-gamemaps" }, deps = { "core/Err", "core/Bytes", "core/Input", "Types" }, caps = { decode = true, encode = false, tilemap = true }, + sniff = 0, load = function() return require("@rosetta/vector/gamemaps") end, @@ -2014,6 +2189,7 @@ local list: { Entry } = { mime = { "application/x-ldtk+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, levels = true, worlds = true, intGrid = true, entities = true }, + sniff = 0, load = function() return require("@rosetta/vector/ldtk") end, @@ -2026,6 +2202,7 @@ local list: { Entry } = { mime = { "application/x-ogmo+json" }, deps = { "core/Err", "core/Bytes", "core/Sniff", "core/Base64", "Types", "codecs/text/Json" }, caps = { decode = true, encode = true, projects = true, entities = true, decals = true }, + sniff = 0, load = function() return require("@rosetta/vector/ogmo") end, @@ -2038,6 +2215,7 @@ local list: { Entry } = { mime = { "image/svg+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Xml", "codecs/image/Raster", "codecs/image/Blend", "core/Sniff" }, caps = { decode = true, encode = true, rasterize = true, text = false }, + sniff = 0, load = function() return require("@rosetta/vector/svg") end, @@ -2050,6 +2228,7 @@ local list: { Entry } = { mime = { "application/x-tiled-tmx", "application/x-tiled-tmj" }, deps = { "core/Err", "core/Bytes", "core/Base64", "Types", "codecs/text/Xml", "codecs/text/Json", "codecs/compress/Deflate", "core/Sniff" }, caps = { decode = true, encode = true, tilesets = true, infinite = true }, + sniff = 0, load = function() return require("@rosetta/vector/tiled") end, @@ -2062,6 +2241,7 @@ local list: { Entry } = { mime = { "image/x-aseprite" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/compress/Deflate" }, caps = { decode = true, encode = true, layers = true, groups = true, animation = true, depths = { 8, 16, 32 } }, + sniff = 0, load = function() return require("@rosetta/layered/aseprite") end, @@ -2074,6 +2254,7 @@ local list: { Entry } = { mime = { "image/openraster" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Zip", "codecs/text/Xml", "codecs/image/Blend" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 8 } }, + sniff = 0, load = function() return require("@rosetta/layered/ora") end, @@ -2086,6 +2267,7 @@ local list: { Entry } = { mime = { "image/vnd.adobe.photoshop" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/image/Blend", "codecs/compress/Deflate", "codecs/compress/PackBits", "codecs/text/Text" }, caps = { decode = true, encode = true, layers = true, groups = true, depths = { 1, 8, 16, 32 } }, + sniff = 0, load = function() return require("@rosetta/layered/psd") end, @@ -2098,6 +2280,7 @@ local list: { Entry } = { mime = { "text/x-ssa", "text/x-ass" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return require("@rosetta/subtitle/ass") end, @@ -2110,6 +2293,7 @@ local list: { Entry } = { mime = { "application/x-subrip", "text/srt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = false }, + sniff = 0, load = function() return require("@rosetta/subtitle/srt") end, @@ -2122,6 +2306,7 @@ local list: { Entry } = { mime = { "text/vtt" }, deps = { "core/Err", "core/Bytes", "Types", "core/Sniff" }, caps = { decode = true, encode = true, styles = true }, + sniff = 0, load = function() return require("@rosetta/subtitle/vtt") end, @@ -2134,6 +2319,7 @@ local list: { Entry } = { mime = { "audio/x-669" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 8, 8 } }, + sniff = 0, load = function() return require("@rosetta/music/669") end, @@ -2146,6 +2332,7 @@ local list: { Entry } = { mime = { "audio/x-ahx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 }, subsongs = true }, + sniff = 0, load = function() return require("@rosetta/music/ahx") end, @@ -2158,6 +2345,7 @@ local list: { Entry } = { mime = { "audio/x-far" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 16, 16 } }, + sniff = 0, load = function() return require("@rosetta/music/far") end, @@ -2170,6 +2358,7 @@ local list: { Entry } = { mime = { "audio/x-hmp" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, hmi = true }, + sniff = 0, load = function() return require("@rosetta/music/hmp") end, @@ -2182,6 +2371,7 @@ local list: { Entry } = { mime = { "audio/x-hvl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Hively" }, caps = { decode = true, encode = false, render = true, channels = { 4, 16 }, subsongs = true }, + sniff = 0, load = function() return require("@rosetta/music/hvl") end, @@ -2194,6 +2384,7 @@ local list: { Entry } = { mime = { "audio/it", "audio/x-it" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 }, compressedSamples = true }, + sniff = 0, load = function() return require("@rosetta/music/it") end, @@ -2206,6 +2397,7 @@ local list: { Entry } = { mime = { "audio/x-med" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return require("@rosetta/music/med") end, @@ -2218,6 +2410,7 @@ local list: { Entry } = { mime = { "audio/midi", "audio/x-midi" }, deps = { "core/Err", "core/Bytes", "codecs/audio/MidiRender", "Types" }, caps = { decode = true, encode = true, formats = { 0, 1, 2 }, render = true, streaming = true, rmid = true }, + sniff = 0, load = function() return require("@rosetta/music/midi") end, @@ -2230,6 +2423,7 @@ local list: { Entry } = { mime = { "audio/x-mod", "audio/mod" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = true, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/mod") end, @@ -2242,6 +2436,7 @@ local list: { Entry } = { mime = { "audio/x-mtm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/mtm") end, @@ -2254,6 +2449,7 @@ local list: { Entry } = { mime = { "audio/x-mus" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true }, + sniff = 0, load = function() return require("@rosetta/music/mus") end, @@ -2266,6 +2462,7 @@ local list: { Entry } = { mime = { "audio/x-okt" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 8 } }, + sniff = 0, load = function() return require("@rosetta/music/okt") end, @@ -2278,6 +2475,7 @@ local list: { Entry } = { mime = { "audio/x-ptm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/ptm") end, @@ -2290,6 +2488,7 @@ local list: { Entry } = { mime = { "audio/s3m", "audio/x-s3m" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/s3m") end, @@ -2302,6 +2501,7 @@ local list: { Entry } = { mime = { "audio/x-soundfont" }, deps = { "core/Err", "core/Bytes", "codecs/audio/SoundFont" }, caps = { decode = true, encode = false, sm24 = true, sf3 = false }, + sniff = 1, load = function() return require("@rosetta/music/sf2") end, @@ -2314,6 +2514,7 @@ local list: { Entry } = { mime = { "audio/x-stm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 4, 4 } }, + sniff = 0, load = function() return require("@rosetta/music/stm") end, @@ -2326,6 +2527,7 @@ local list: { Entry } = { mime = { "audio/x-ult" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Tracker/Load" }, caps = { decode = true, encode = false, render = true, channels = { 1, 32 } }, + sniff = 0, load = function() return require("@rosetta/music/ult") end, @@ -2338,6 +2540,7 @@ local list: { Entry } = { mime = { "audio/x-umx" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker" }, caps = { decode = true, encode = false, render = true, container = true }, + sniff = 0, load = function() return require("@rosetta/music/umx") end, @@ -2350,6 +2553,7 @@ local list: { Entry } = { mime = { "audio/xm", "audio/x-xm" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/audio/Tracker", "codecs/audio/Adpcm" }, caps = { decode = true, encode = true, render = true, channels = { 1, 64 } }, + sniff = 0, load = function() return require("@rosetta/music/xm") end, @@ -2362,6 +2566,7 @@ local list: { Entry } = { mime = { "audio/x-xmidi" }, deps = { "core/Err", "core/Bytes", "Types", "containers/Chunks", "codecs/audio/MidiRender" }, caps = { decode = true, encode = false, render = true, songs = true }, + sniff = 0, load = function() return require("@rosetta/music/xmi") end, @@ -2374,6 +2579,7 @@ local list: { Entry } = { mime = { "audio/x-mpegurl", "audio/mpegurl", "application/vnd.apple.mpegurl", "application/x-mpegurl" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true, hls = true }, + sniff = 0, load = function() return require("@rosetta/playlist/m3u") end, @@ -2386,6 +2592,7 @@ local list: { Entry } = { mime = { "audio/x-scpls", "audio/scpls" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Text", "core/Sniff" }, caps = { decode = true, encode = true }, + sniff = 1, load = function() return require("@rosetta/playlist/pls") end, @@ -2398,6 +2605,7 @@ local list: { Entry } = { mime = { "application/xspf+xml" }, deps = { "core/Err", "core/Bytes", "Types", "codecs/text/Url", "codecs/text/Xml" }, caps = { decode = true, encode = true }, + sniff = 0, load = function() return require("@rosetta/playlist/xspf") end, diff --git a/src/Rosetta/Sniffs.luau b/src/Rosetta/Sniffs.luau new file mode 100644 index 0000000..9df7fe1 --- /dev/null +++ b/src/Rosetta/Sniffs.luau @@ -0,0 +1,3384 @@ +--!strict +--!optimize 2 +-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit. +-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it +-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that +-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here. +local S: { [string]: (any) -> number } = {} + +local function lazy(load: () -> any): any + local proxy = {} + return setmetatable(proxy, { + __index = function(_, k: any): any + local m = load() + setmetatable(proxy, { __index = m }) + return m[k] + end, + }) +end + +do -- image/ani +local Bytes = require("@rosetta/core/Bytes") +S["image/ani"] = function(r: Bytes.Reader): number + return if r:peek(4) == "RIFF" and r:peek(4, 8) == "ACON" then 1 else 0 +end +end + +do -- image/art +local Bytes = require("@rosetta/core/Bytes") +local readu8, readu16, readu32, readi16 = buffer.readu8, buffer.readu16, buffer.readu32, buffer.readi16 +local function header(b: buffer, o: number, limit: number): (number?, number?, number?, number?, boolean?) + local p = o + local prefixed = false + if limit - p >= 8 and buffer.readstring(b, p, 8) == "BUILDART" then + p += 8 + prefixed = true + end + if limit - p < 16 or readu32(b, p) ~= 1 then + return nil, nil, nil, nil, nil + end + local first, last = readu32(b, p + 8), readu32(b, p + 12) + if last < first or last - first >= 65536 then + return nil, nil, nil, nil, nil + end + return p + 16, first, last, readu32(b, p + 4), prefixed +end +S["image/art"] = function(r: Bytes.Reader): number + local at, first, last = header(r.buf, r.base, r.limit) + if not at or not first or not last then + return 0 + end + local n = last - first + 1 + local p = at :: number + if r.limit - p < n * 8 then + return 0 + end + local total = 0 + for i = 0, n - 1 do + local w, h = readi16(r.buf, p + i * 2), readi16(r.buf, p + n * 2 + i * 2) + if w < 0 or h < 0 then + return 0 + end + total += w * h + end + local size = p + n * 8 + total - r.base + local have = r.limit - r.base + return if size == have then 0.9 elseif size < have and have - size < 4096 then 0.5 else 0 +end +end + +do -- image/blp +local Bytes = require("@rosetta/core/Bytes") +S["image/blp"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "BLP1" or m == "BLP2" then 1 elseif m == "BLP0" then 0.8 else 0 +end +end + +do -- image/bmp +local Bytes = require("@rosetta/core/Bytes") +S["image/bmp"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "BM" then + return 0 + end + local n = r:peekU8(14) + math.max(r:peekU8(15), 0) * 256 + if r:peekU8(16) == 0 and r:peekU8(17) == 0 and (n == 12 or n == 16 or n == 40 or n == 52 or n == 56 or n == 64 or n == 108 or n == 124) then + return 0.9 + end + return 0.2 +end +end + +do -- image/dds +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "DDS " +S["image/dds"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, MAGIC .. "\124\0\0\0"), Sniff.magic(r, MAGIC, 0, 0.6)) +end +end + +do -- image/exr +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "\118\47\49\1" +S["image/exr"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/gif +local Bytes = require("@rosetta/core/Bytes") +S["image/gif"] = function(r: Bytes.Reader): number + local s = r:peek(6) + return if s == "GIF89a" or s == "GIF87a" then 1 else 0 +end +end + +do -- image/hdr +local Bytes = require("@rosetta/core/Bytes") +S["image/hdr"] = function(r: Bytes.Reader): number + local s = r:peek(10) + if s == "#?RADIANCE" then + return 1 + end + if string.sub(s, 1, 6) == "#?RGBE" then + return 1 + end + if string.sub(s, 1, 2) == "#?" and string.match(s, "^#%?%u") then + return 0.5 + end + return 0 +end +end + +do -- image/icns +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/icns"] = function(r: Bytes.Reader): number + return Sniff.magic(r, "icns") +end +end + +do -- image/ico +local Bytes = require("@rosetta/core/Bytes") +local readu8 = buffer.readu8 +S["image/ico"] = function(r: Bytes.Reader): number + if r:remaining() < 22 then + return 0 + end + local b, o = r.buf, r.pos + local typ = buffer.readu16(b, o + 2) + local count = buffer.readu16(b, o + 4) + if buffer.readu16(b, o) ~= 0 or (typ ~= 1 and typ ~= 2) or count == 0 then + return 0 + end + -- the first entry: reserved byte 0, a size and offset inside the file + local size, off = buffer.readu32(b, o + 14), buffer.readu32(b, o + 18) + if readu8(b, o + 9) ~= 0 or size == 0 or off < 6 + count * 16 then + return 0 + end + return 0.8 +end +end + +do -- image/ilbm +local Bytes = require("@rosetta/core/Bytes") +S["image/ilbm"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "FORM" then + return 0 + end + local t = r:peek(4, 8) + return if t == "ILBM" or t == "PBM " then 1 else 0 +end +end + +do -- image/jpeg +local Bytes = require("@rosetta/core/Bytes") +S["image/jpeg"] = function(r: Bytes.Reader): number + local s = r:peek(3) + return if s == "\255\216\255" then 1 else 0 +end +end + +do -- image/ktx +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local ID1 = "\171KTX 11\187\r\n\26\n" +local ID2 = "\171KTX 20\187\r\n\26\n" +S["image/ktx"] = function(r: Bytes.Reader): number + return math.max(Sniff.magic(r, ID2), Sniff.magic(r, ID1)) +end +end + +do -- image/lmp +local Bytes = require("@rosetta/core/Bytes") +local function kindOf(r: Bytes.Reader): string? + local n = r:remaining() + if n == 768 then + return "palette" + elseif n == 16385 or n == 16384 then + return "colormap" + end + if n < 9 then + return nil + end + local w, h = buffer.readu32(r.buf, r.pos), buffer.readu32(r.buf, r.pos + 4) + if w > 0 and h > 0 and w <= 4096 and h <= 4096 and 8 + w * h == n then + return "qpic" + end + return nil +end +S["image/lmp"] = function(r: Bytes.Reader): number + local k = kindOf(r) + return if k == "qpic" then 0.3 elseif k then 0.05 else 0 +end +end + +do -- image/pcx +local Bytes = require("@rosetta/core/Bytes") +S["image/pcx"] = function(r: Bytes.Reader): number + if r:size() < 128 then + return 0 + end + local m, v, e, bpp = r:peekU8(0), r:peekU8(1), r:peekU8(2), r:peekU8(3) + if m ~= 10 or (v ~= 0 and v ~= 2 and v ~= 3 and v ~= 4 and v ~= 5) or e > 1 then + return 0 + end + return if bpp == 1 or bpp == 2 or bpp == 4 or bpp == 8 then 0.8 else 0 +end +end + +do -- image/png +local Bytes = require("@rosetta/core/Bytes") +local SIGNATURE = "\137PNG\r\n\26\n" +S["image/png"] = function(r: Bytes.Reader): number + return if r:peek(8) == SIGNATURE then 1 else 0 +end +end + +do -- image/pnm +local Bytes = require("@rosetta/core/Bytes") +S["image/pnm"] = function(r: Bytes.Reader): number + if r:remaining() < 3 then + return 0 + end + local a, b, c = r:peekU8(0), r:peekU8(1), r:peekU8(2) + if a ~= 80 then -- 'P' + return 0 + end + local ws = c == 32 or (c >= 9 and c <= 13) + if b >= 49 and b <= 55 and ws then -- P1..P7 + return 0.9 + end + if (b == 70 or b == 102) and ws then -- PF / Pf + return 0.9 + end + return 0 +end +end + +do -- image/qoi +local Bytes = require("@rosetta/core/Bytes") +S["image/qoi"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoif" then 1 else 0 +end +end + +do -- image/sgi +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/sgi"] = function(r: Bytes.Reader): number + if Sniff.magic(r, "\1\218") == 0 or r:size() < 512 then + return 0 + end + local st, bpc = r:peekU8(2), r:peekU8(3) + return if st <= 1 and (bpc == 1 or bpc == 2) then 1 else 0 +end +end + +do -- image/spr +local Bytes = require("@rosetta/core/Bytes") +S["image/spr"] = function(r: Bytes.Reader): number + if r:remaining() < 36 or r:peek(4) ~= "IDSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v == 1 or v == 2 or v == 32 then 1 else 0.3 +end +end + +do -- image/sunras +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "\89\166\106\149" +S["image/sunras"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- image/tga +local Bytes = require("@rosetta/core/Bytes") +local TYPES = { [1] = true, [2] = true, [3] = true, [9] = true, [10] = true, [11] = true } +local FOOTER = "TRUEVISION-XFILE.\0" +local readu8 = buffer.readu8 +type Header = { + idLen: number, + cmapType: number, + imageType: number, + cmapFirst: number, + cmapLen: number, + cmapBits: number, + width: number, + height: number, + depth: number, + desc: number, +} +local function header(r: Bytes.Reader): Header? + if r.limit - r.base < 18 then + return nil + end + local b, o = r.buf, r.base + local function u16(q: number): number + return readu8(b, o + q) + readu8(b, o + q + 1) * 256 + end + local h: Header = { + idLen = readu8(b, o), + cmapType = readu8(b, o + 1), + imageType = readu8(b, o + 2), + cmapFirst = u16(3), + cmapLen = u16(5), + cmapBits = readu8(b, o + 7), + width = u16(12), + height = u16(14), + depth = readu8(b, o + 16), + desc = readu8(b, o + 17), + } + return h +end +local function implausible(h: Header): string? + local t = h.imageType + if not TYPES[t] then + return "image type " .. t + end + if h.cmapType > 1 then + return "colour map type " .. h.cmapType + end + local mapped = t == 1 or t == 9 + if mapped and (h.cmapType ~= 1 or (h.depth ~= 8 and h.depth ~= 16)) then + return "colour-mapped image without a colour map" + end + if h.cmapType == 1 and h.cmapLen > 0 and h.cmapBits ~= 15 and h.cmapBits ~= 16 and h.cmapBits ~= 24 and h.cmapBits ~= 32 then + return "colour map entry size " .. h.cmapBits + end + if (t == 2 or t == 10) and h.depth ~= 15 and h.depth ~= 16 and h.depth ~= 24 and h.depth ~= 32 then + return "pixel depth " .. h.depth + end + if (t == 3 or t == 11) and h.depth ~= 8 and h.depth ~= 16 then + return "grey pixel depth " .. h.depth + end + if h.width == 0 or h.height == 0 then + return "zero size" + end + if h.desc >= 64 then + return "interleaving / reserved descriptor bits" + end + return nil +end +S["image/tga"] = function(r: Bytes.Reader): number + local h = header(r) + if not h or implausible(h) then + return 0 + end + local n = r.limit - r.base + if n >= 44 and buffer.readstring(r.buf, r.limit - 18, 18) == FOOTER then + return 0.9 + end + return 0.2 +end +end + +do -- image/tiff +local Bytes = require("@rosetta/core/Bytes") +S["image/tiff"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s == "II*\0" or s == "MM\0*" or s == "II+\0" or s == "MM\0+" then + return 1 + end + return 0 +end +end + +do -- image/tim +local Bytes = require("@rosetta/core/Bytes") +S["image/tim"] = function(r: Bytes.Reader): number + if r:remaining() < 20 or r:peek(4) ~= "\16\0\0\0" then + return 0 + end + local flags = r:peekU8(4) + if flags > 0x0F or (flags % 8) > 3 or r:peek(3, 5) ~= "\0\0\0" then + return 0 + end + return 0.8 +end +end + +do -- image/vtf +local Bytes = require("@rosetta/core/Bytes") +S["image/vtf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VTF\0" and r:peekU8(4) == 7 then 1 else 0 +end +end + +do -- image/webp +local Bytes = require("@rosetta/core/Bytes") +S["image/webp"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "WEBP" then + return 1 + end + return 0 +end +end + +do -- image/xbm +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/xbm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 256, true) + if string.match(s, "^#define%s+[%w_]*_?width%s+%d+") or string.match(s, "^/%*.-%*/%s*#define%s+[%w_]*width%s+%d+") then + return 0.9 + end + return 0 +end +end + +do -- image/xpm +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["image/xpm"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64, true) + if string.sub(s, 1, 9) == "/* XPM */" or string.sub(s, 1, 6) == "! XPM2" then + return 1 + end + return 0 +end +end + +do -- audio/aac +local Bytes = require("@rosetta/core/Bytes") +local Aac = lazy(function() + return require("@rosetta/codecs/audio/Aac") +end) +local readu8 = buffer.readu8 +local function id3Size(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local s = 0 + for i = 6, 9 do + s = s * 128 + bit32.band(readu8(b, p + i), 127) + end + local footer = if bit32.band(readu8(b, p + 5), 0x10) ~= 0 then 10 else 0 + return 10 + s + footer +end +S["audio/aac"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3Size(b, p, limit) + local h = Aac.adts(b, p, limit) + if not h then + return 0 + end + local h2 = Aac.adts(b, p + h.frameSize, limit) + if h2 and h2.sfIndex == h.sfIndex and h2.channelConfig == h.channelConfig then + return 0.9 + end + return if p + h.frameSize >= limit then 0.7 else 0.4 +end +end + +do -- audio/ac3 +local Bytes = require("@rosetta/core/Bytes") +local Ac3 = lazy(function() + return require("@rosetta/codecs/audio/Ac3") +end) +S["audio/ac3"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + local h = Ac3.header(b, p, limit) + if not h then + return 0 + end + local h2 = Ac3.header(b, p + h.frameSize, limit) + if h2 and h2.sampleRate == h.sampleRate then + return 0.9 + end + return if p + h.frameSize >= limit then 0.6 else 0.3 +end +end + +do -- audio/adpcm +local Bytes = require("@rosetta/core/Bytes") +S["audio/adpcm"] = function(_r: Bytes.Reader): number + return 0 +end +end + +do -- audio/adx +local Bytes = require("@rosetta/core/Bytes") +S["audio/adx"] = function(r: Bytes.Reader): number + if r:peekU8(0) ~= 0x80 or r:peekU8(1) ~= 0 then + return 0 + end + local off = r:peekU8(2) * 256 + r:peekU8(3) + return if r:peek(6, off - 2) == "(c)CRI" then 1 else 0 +end +end + +do -- audio/aiff +local Bytes = require("@rosetta/core/Bytes") +S["audio/aiff"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "FORM" then + return 0 + end + local form = buffer.readstring(r.buf, r.pos + 8, 4) + return if form == "AIFF" or form == "AIFC" then 1 else 0 +end +end + +do -- audio/ape +local Bytes = require("@rosetta/core/Bytes") +S["audio/ape"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "MAC " or head == "MACF" then -- MACF: float samples + return 1 + end + if string.sub(head, 1, 3) == "ID3" then + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + local id = r:peek(4, 10 + sz + (if footer then 10 else 0)) + return if id == "MAC " or id == "MACF" then 1 else 0 + end + return 0 +end +end + +do -- audio/au +local Bytes = require("@rosetta/core/Bytes") +S["audio/au"] = function(r: Bytes.Reader): number + return if r:peek(4) == ".snd" then 1 else 0 +end +end + +do -- audio/brstm +local Bytes = require("@rosetta/core/Bytes") +S["audio/brstm"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m ~= "RSTM" and m ~= "CSTM" and m ~= "FSTM" then + return 0 + end + local bom = r:peek(2, 4) + return if bom == "\254\255" or bom == "\255\254" then 1 else 0 +end +end + +do -- audio/caf +local Bytes = require("@rosetta/core/Bytes") +S["audio/caf"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h == 8 and string.sub(h, 1, 4) == "caff" and string.byte(h, 5) == 0 and string.byte(h, 6) == 1 then + return 1 + end + return 0 +end +end + +do -- audio/flac +local Bytes = require("@rosetta/core/Bytes") +S["audio/flac"] = function(r: Bytes.Reader): number + local head = r:peek(4) + if head == "fLaC" then + return 1 + end + if head == "OggS" then + -- the first page's packet: 0x7F "FLAC" (the Ogg FLAC mapping) + local nseg = r:peekU8(26) + if nseg > 0 and r:peek(5, 27 + nseg) == "\127FLAC" then + return 1 + end + return 0 + end + if string.sub(head, 1, 3) == "ID3" then + -- an ID3v2 tag, then fLaC (mp3 files start with ID3 too) + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return if r:peek(4, 10 + sz + (if footer then 10 else 0)) == "fLaC" then 1 else 0 + end + return 0 +end +end + +do -- audio/m4a +local Bytes = require("@rosetta/core/Bytes") +local IsoBmff = lazy(function() + return require("@rosetta/containers/IsoBmff") +end) +local AUDIO_BRANDS: { [string]: number } = { ["M4A "] = 1, ["M4B "] = 1, ["M4P "] = 1, ["M4V "] = 0.3 } +S["audio/m4a"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil then + return 0 + end + if AUDIO_BRANDS[brand] then + return AUDIO_BRANDS[brand] + end + if brand == "avif" or brand == "avis" or brand == "heic" or brand == "heix" or brand == "mif1" or brand == "msf1" or brand == "crx " then + return 0 + end + return 0.4 -- an MP4 / MOV that may hold audio; a video format claims it more strongly +end +end + +do -- audio/mp3 +local Bytes = require("@rosetta/core/Bytes") +local Header = lazy(function() + return require("@rosetta/codecs/audio/Mpa/Header") +end) +local Tags = lazy(function() + return require("@rosetta/audio/mp3/Tags") +end) +S["audio/mp3"] = function(r: Bytes.Reader): number + local b, p, lim = r.buf, r.pos, r.limit + local id3 = false + for _ = 1, 4 do -- (ffmpeg writes a tag even when the input had one: tags can follow each other) + local n = if p + 3 <= lim and buffer.readstring(b, p, 3) == "ID3" then Tags.id3v2Size(b, p, lim) else 0 + if n <= 0 then + break + end + id3 = true + p += n + end + if p + 4 > lim or not Header.valid(b, p) then + return if id3 then 0.5 else 0 + end + local fb = Header.frameBytes(b, p, 0) + if fb > 0 then + fb += Header.padding(b, p) + if p + fb + 4 <= lim and Header.compare(b, p, p + fb) then + return 0.9 + end + if p + fb == lim then + return 0.6 + end + end + return if id3 then 0.7 else 0.25 +end +end + +do -- audio/mpc +local Bytes = require("@rosetta/core/Bytes") +local Musepack = lazy(function() + return require("@rosetta/codecs/audio/Musepack") +end) +local function id3v2(b: buffer, p: number, limit: number): number + if p + 10 > limit or buffer.readstring(b, p, 3) ~= "ID3" then + return 0 + end + local n = 10 + for i = 6, 9 do + n += bit32.band(buffer.readu8(b, p + i), 127) * 128 ^ (9 - i) + end + return n + (if bit32.band(buffer.readu8(b, p + 5), 0x10) ~= 0 then 10 else 0) +end +S["audio/mpc"] = function(r: Bytes.Reader): number + local b, p, limit = r.buf, r.pos, r.limit + p += id3v2(b, p, limit) + local v = Musepack.magic(b, p, limit) + if v == 8 then + return 1 + end + return if v == 7 then 0.9 else 0 +end +end + +do -- audio/opus +local Bytes = require("@rosetta/core/Bytes") +S["audio/opus"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local nseg = r:peekU8(26) + if nseg < 1 then + return 0 + end + return if r:peek(8, 27 + nseg) == "OpusHead" then 1 else 0 +end +end + +do -- audio/qoa +local Bytes = require("@rosetta/core/Bytes") +S["audio/qoa"] = function(r: Bytes.Reader): number + return if r:peek(4) == "qoaf" then 1 else 0 +end +end + +do -- audio/tta +local Bytes = require("@rosetta/core/Bytes") +local function id3Size(r: Bytes.Reader): number + if r:peek(3) ~= "ID3" then + return 0 + end + local sz = 0 + for i = 6, 9 do + local v = r:peekU8(i) + if v < 0 then + return 0 + end + sz = sz * 128 + bit32.band(v, 127) + end + local footer = bit32.band(math.max(r:peekU8(5), 0), 0x10) ~= 0 + return 10 + sz + (if footer then 10 else 0) +end +S["audio/tta"] = function(r: Bytes.Reader): number + return if r:peek(4, id3Size(r)) == "TTA1" then 1 else 0 +end +end + +do -- audio/vag +local Bytes = require("@rosetta/core/Bytes") +S["audio/vag"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m == "VAGp" or m == "VAGi" or m == "KVAG" then 1 else 0 +end +end + +do -- audio/voc +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "Creative Voice File\26" +S["audio/voc"] = function(r: Bytes.Reader): number + return if r:peek(20) == MAGIC then 1 else 0 +end +end + +do -- audio/vorbis +local Bytes = require("@rosetta/core/Bytes") +S["audio/vorbis"] = function(r: Bytes.Reader): number + if r:remaining() < 35 or r:peek(4) ~= "OggS" then + return 0 + end + local b, p = r.buf, r.pos + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 > r.limit then + return 0 + end + return if buffer.readu8(b, d) == 1 and buffer.readstring(b, d + 1, 6) == "vorbis" then 1 else 0 +end +end + +do -- audio/wav +local Bytes = require("@rosetta/core/Bytes") +local Riff = lazy(function() + return require("@rosetta/containers/Riff") +end) +S["audio/wav"] = function(r: Bytes.Reader): number + return if Riff.sniff(r) == "WAVE" then 1 else 0 +end +end + +do -- audio/wavpack +local Bytes = require("@rosetta/core/Bytes") +S["audio/wavpack"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "wvpk" then + return 0 + end + local v = r:peekU8(9) + return if v == 4 then 1 else 0.5 +end +end + +do -- video/avi +local Bytes = require("@rosetta/core/Bytes") +S["video/avi"] = function(r: Bytes.Reader): number + if r:peek(4) == "RIFF" and r:peek(4, 8) == "AVI " then + return 1 + end + return 0 +end +end + +do -- video/fli +local Bytes = require("@rosetta/core/Bytes") +local FLI, FLC, DTA = 0xAF11, 0xAF12, 0xAF44 +S["video/fli"] = function(r: Bytes.Reader): number + local s = r:peek(18) + if #s < 18 then + return 0 + end + local magic = string.byte(s, 5) + string.byte(s, 6) * 256 + if magic ~= FLI and magic ~= FLC and magic ~= DTA then + return 0 + end + local w = string.byte(s, 9) + string.byte(s, 10) * 256 + local h = string.byte(s, 11) + string.byte(s, 12) * 256 + if w > 4096 or h > 4096 then + return 0 + end + return 0.9 +end +end + +do -- video/flv +local Bytes = require("@rosetta/core/Bytes") +S["video/flv"] = function(r: Bytes.Reader): number + if r:remaining() >= 9 and r:peek(3) == "FLV" then + return if r:peekU8(3) == 1 then 1 else 0.6 + end + return 0 +end +end + +do -- video/h264 +local Bytes = require("@rosetta/core/Bytes") +S["video/h264"] = function(r: Bytes.Reader): number + local s = r:peek(5) + if not s or #s < 4 then + return 0 + end + local hdr + if string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 1 then + hdr = string.byte(s, 4) + elseif #s >= 5 and string.byte(s, 1) == 0 and string.byte(s, 2) == 0 and string.byte(s, 3) == 0 and string.byte(s, 4) == 1 then + hdr = string.byte(s, 5) + else + return 0 + end + if hdr >= 128 then + return 0 + end + local t = hdr % 32 + if t == 7 then + return 0.8 + elseif t == 9 or t == 6 or t == 8 then + return 0.5 + elseif t == 5 then + return 0.4 + end + return 0 +end +end + +do -- video/mkv +local Bytes = require("@rosetta/core/Bytes") +S["video/mkv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "\26\69\223\163" then + return 0 + end + local head = r:peek(math.min(64, r:remaining())) + if string.find(head, "webm", 1, true) or string.find(head, "matroska", 1, true) then + return 1 + end + return 0.5 +end +end + +do -- video/mp4 +local Bytes = require("@rosetta/core/Bytes") +local IsoBmff = lazy(function() + return require("@rosetta/containers/IsoBmff") +end) +local IMAGE_BRANDS = { avif = true, avis = true, heic = true, heix = true, mif1 = true, msf1 = true, ["crx "] = true } +local AUDIO_BRANDS = { ["M4A "] = true, ["M4B "] = true, ["M4P "] = true } +S["video/mp4"] = function(r: Bytes.Reader): number + local brand = IsoBmff.sniff(r) + if brand == nil or IMAGE_BRANDS[brand] then + return 0 + end + if AUDIO_BRANDS[brand] then + return 0.2 + end + if brand == "M4V " then + return 0.9 + end + return if brand == "" then 0.6 else 0.8 +end +end + +do -- video/mpegps +local Bytes = require("@rosetta/core/Bytes") +S["video/mpegps"] = function(r: Bytes.Reader): number + if r:peek(4) == "\0\0\1\186" then + return 0.9 + end + if r:peek(4) == "\0\0\1\179" then + return 0.5 -- an MPEG-1 / 2 video elementary stream (sequence header) + end + return 0 +end +end + +do -- video/mpegts +local Bytes = require("@rosetta/core/Bytes") +local SIZES = { 188, 192 } +local function packetSize(r: Bytes.Reader): (number, number) + local n = r:remaining() + local head = r:peek(2048 + 2 * 192) + local lim = math.min(n, 2048) + local start = 0 + while start < lim do + local f = string.find(head, "G", start + 1, true) -- 0x47 + if not f or f > lim then + break + end + start = f - 1 + for _, size in SIZES do + local hits, need = 0, math.min(3, (n - start - 1) // size + 1) + for k = 0, 2 do + local at = start + k * size + if at < n and string.byte(head, at + 1) == 0x47 then + hits += 1 + end + end + if hits >= need and (need >= 2 or start == 0) then + if size == 192 and start >= 4 then + return 192, start - 4 + elseif size == 188 then + return 188, start + end + end + end + start += 1 + end + return 0, 0 +end +S["video/mpegts"] = function(r: Bytes.Reader): number + local s, off = packetSize(r) + if s == 0 then + return 0 + end + if off > 0 then + return 0.6 + end + return if r:remaining() >= 3 * s then 0.9 else 0.5 +end +end + +do -- video/ogv +local Bytes = require("@rosetta/core/Bytes") +S["video/ogv"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "OggS" then + return 0 + end + local b, p, lim = r.buf, r.pos, r.limit + for _ = 1, 8 do + if p + 27 > lim or buffer.readstring(b, p, 4) ~= "OggS" or buffer.readu8(b, p + 5) % 4 < 2 then + return 0 + end + local nseg = buffer.readu8(b, p + 26) + local d = p + 27 + nseg + if d + 7 <= lim and buffer.readu8(b, d) == 0x80 and buffer.readstring(b, d + 1, 6) == "theora" then + return 1 + end + if d > lim then + return 0 + end + local size = 0 + for i = 0, nseg - 1 do + size += buffer.readu8(b, p + 27 + i) + end + p = d + size + end + return 0 +end +end + +do -- video/smk +local Bytes = require("@rosetta/core/Bytes") +S["video/smk"] = function(r: Bytes.Reader): number + local s = r:peek(4) + if s ~= "SMK2" and s ~= "SMK4" then + return 0 + end + return 1 +end +end + +do -- video/y4m +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "YUV4MPEG2 " +S["video/y4m"] = function(r: Bytes.Reader): number + return if r:peek(10) == MAGIC then 1 else 0 +end +end + +do -- model/3ds +local Bytes = require("@rosetta/core/Bytes") +S["model/3ds"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 or string.byte(h, 1) ~= 0x4D or string.byte(h, 2) ~= 0x4D then + return 0 + end + local b1, b2, b3, b4, c1, c2 = string.byte(h, 3, 8) + local size = b1 + b2 * 256 + b3 * 65536 + b4 * 16777216 + local child = c1 + c2 * 256 + if size < 16 or not (child == 0x0002 or child == 0x3D3D or child == 0xB000) then + return 0 + end + return if size == r.limit - r.pos then 0.95 else 0.7 +end +end + +do -- model/3mf +local Bytes = require("@rosetta/core/Bytes") +S["model/3mf"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "PK\3\4" then + return 0 + end + local n = r:size() + local tail = buffer.readstring(r.buf, r.base + math.max(0, n - 65536), math.min(n, 65536)) + if string.find(tail, "3D/[^/]*%.model") or string.find(tail, "3dmodel.model", 1, true) then + return 0.95 + end + local head = r:peek(256) + if string.find(head, "3D/", 1, true) then + return 0.7 + end + return 0 +end +end + +do -- model/ase +local Bytes = require("@rosetta/core/Bytes") +local Text = lazy(function() + return require("@rosetta/codecs/text/Text") +end) +local MAGIC = "*3DSMAX_ASCIIEXPORT" +local function utf16(r: Bytes.Reader): (boolean?, boolean) + local h = r:peek(2) + if h == "\255\254" then + return true, false + elseif h == "\254\255" then + return true, true + elseif #h == 2 and string.byte(h, 2) == 0 and string.byte(h, 1) == 42 then + return true, false + elseif #h == 2 and string.byte(h, 1) == 0 and string.byte(h, 2) == 42 then + return true, true + end + return nil, false +end +local function text(r: Bytes.Reader, n: number?): string + local wide, be = utf16(r) + local len = r.limit - r.pos + if n then + len = math.min(len, n) + end + if wide then + local skip = if r:peek(2) == "\255\254" or r:peek(2) == "\254\255" then 2 else 0 + return Text.utf16(r.buf, r.pos + skip, len - skip, be) + end + return Text.toUtf8(buffer.readstring(r.buf, r.pos, len)) +end +S["model/ase"] = function(r: Bytes.Reader): number + local h = string.match(text(r, 256), "^%s*(%*[%w_]+)") + if h == MAGIC then + return 1 + end + return 0 +end +end + +do -- model/b3d +local Bytes = require("@rosetta/core/Bytes") +S["model/b3d"] = function(r: Bytes.Reader): number + if r:peek(4) == "BB3D" then + return if r:peek(4, 8) ~= "" then 1 else 0.8 + end + return 0 +end +end + +do -- model/blend +local Bytes = require("@rosetta/core/Bytes") +local Deflate = lazy(function() + return require("@rosetta/codecs/compress/Deflate") +end) +local Zstd = lazy(function() + return require("@rosetta/codecs/compress/Zstd") +end) +S["model/blend"] = function(r: Bytes.Reader): number + local head = r:peek(7) + if head == "BLENDER" then + return 1 + end + local n = r.limit - r.base + if string.sub(head, 1, 3) == "\31\139\8" then + local inner = Deflate.peek(r.buf, r.base, n, 7) + return if inner and buffer.tostring(inner) == "BLENDER" then 1 else 0 + end + if string.sub(head, 1, 4) == Zstd.MAGIC then + if n > 4 * 2 ^ 20 then + return 0.5 + end + local out = Zstd.decompress(r.buf, r.base, n, { verify = false }) + return if out and buffer.len(out) >= 7 and buffer.readstring(out, 0, 7) == "BLENDER" then 1 else 0 + end + return 0 +end +end + +do -- model/bsp +local Bytes = require("@rosetta/core/Bytes") +S["model/bsp"] = function(r: Bytes.Reader): number + if r:remaining() < 64 then + return 0 + end + local m = r:peek(4) + local v = buffer.readi32(r.buf, r.pos + (if m == "IBSP" then 4 else 0)) + if m == "BSP2" or m == "2PSB" then + v = 29 + end + if m == "IBSP" then + return if v == 38 or v == 46 or v == 47 then 1 else 0.3 + end + if v == 29 or v == 30 then + local size = r:remaining() + for i = 0, 14 do + local o, n = buffer.readi32(r.buf, r.pos + 4 + i * 8), buffer.readi32(r.buf, r.pos + 8 + i * 8) + if o < 0 or n < 0 or o + n > size then + return 0 + end + end + return 0.6 + end + return 0 +end +end + +do -- model/buildmap +local Bytes = require("@rosetta/core/Bytes") +local SECTOR_SIZE, WALL_SIZE, SPRITE_SIZE = 40, 32, 44 +local HEADER = 22 -- version, posx, posy, posz, ang, cursectnum, then u16 numsectors at 20 +local readu16 = buffer.readu16 +local function layout(b: buffer, o: number, limit: number): (number?, number?, number?, number?) + if limit - o < HEADER then + return nil, nil, nil, nil + end + local ns = readu16(b, o + 20) + local p = o + HEADER + ns * SECTOR_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nw = readu16(b, p) + p += 2 + nw * WALL_SIZE + if p + 2 > limit then + return nil, nil, nil, nil + end + local nsp = readu16(b, p) + p += 2 + nsp * SPRITE_SIZE + return ns, nw, nsp, p +end +S["model/buildmap"] = function(r: Bytes.Reader): number + local b, o, limit = r.buf, r.base, r.limit + if limit - o < HEADER then + return 0 + end + local v = buffer.readu32(b, o) + if v ~= 7 and v ~= 8 and v ~= 9 then + return 0 + end + local ns, _, _, stop = layout(b, o, limit) + if not ns or not stop or stop > limit then + return 0 + end + return if stop == limit then 0.9 else 0.5 +end +end + +do -- model/d3map +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/d3map"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + for _ = 1, 16 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") + if not rest then + break + end + head = rest + end + return if string.match(head, "^Version%s+[123]%s") then 1 else 0 +end +end + +do -- model/dae +local Bytes = require("@rosetta/core/Bytes") +S["model/dae"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + if string.sub(head, 1, 4) == "PK\3\4" then + local nlen = string.byte(head, 27) or 0 + local name = string.lower(string.sub(head, 31, 30 + nlen)) + if string.find(name, "%.dae$") or name == "manifest.xml" then + return 0.95 + end + return 0 + end + -- UTF-16 files: drop the zero bytes + if string.find(string.sub(head, 1, 4), "\0", 1, true) then + head = string.gsub(head, "%z", "") + end + if string.find(head, " sectors then + return 0 + end + used += 1 + if used == 1 then + local p = r.base + off * 4096 + if p + 5 > r.limit then + return 0 + end + local c = buffer.readu8(b, p + 4) % 128 + if COMPRESSION[c] == nil then + return 0 + end + end + end + end + return if used > 0 then 0.8 else 0.2 +end +end + +do -- model/md2 +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/md2"] = function(r: Bytes.Reader): number + if r:remaining() < 68 then + return 0 + end + return if Sniff.magic(r, "IDP2") == 1 and r:peekU8(4) == 8 then 1 else 0 +end +end + +do -- model/md3 +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/md3"] = function(r: Bytes.Reader): number + if r:remaining() < 108 then + return 0 + end + return if Sniff.magic(r, "IDP3") == 1 and r:peekU8(4) == 15 then 1 else 0 +end +end + +do -- model/md5 +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/md5"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + return if string.match(head, "^MD5Version%s+%d+") then 1 else 0 +end +end + +do -- model/mdl +local Bytes = require("@rosetta/core/Bytes") +S["model/mdl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + local v = r:peekU8(4) + if (m == "IDPO" and v == 6) or (m == "IDST" and v == 10) then + return 1 + end + return 0 +end +end + +do -- model/ms3d +local Bytes = require("@rosetta/core/Bytes") +local Read = lazy(function() + return require("@rosetta/model/ms3d/Read") +end) +S["model/ms3d"] = function(r: Bytes.Reader): number + local h = r:peek(14) + if string.sub(h, 1, 10) ~= Read.MAGIC then + return 0 + end + local v = string.byte(h, 11) + return if v == 3 or v == 4 then 1 else 0.6 +end +end + +do -- model/obj +local Bytes = require("@rosetta/core/Bytes") +S["model/obj"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "\0", 1, true) then + return 0 + end + if string.find(head, "^%s*v%s+[%-%d%.]") or string.find(head, "\n%s*v%s+[%-%d%.]") then + return 0.6 + end + if string.find(head, "^#") and (string.find(head, "\nmtllib ") or string.find(head, "\no ") or string.find(head, "\ng ")) then + return 0.4 + end + return 0 +end +end + +do -- model/off +local Bytes = require("@rosetta/core/Bytes") +S["model/off"] = function(r: Bytes.Reader): number + local head = r:peek(512) + for _ = 1, 16 do + local rest = string.match(head, "^%s*#[^\n]*\n(.*)$") + if not rest then + break + end + head = rest + end + local kw = string.match(head, "^%s*(%w+)") + if kw and string.match(kw, "^S?T?C?N?4?n?OFF$") then + return 0.9 + end + return 0 +end +end + +do -- model/ply +local Bytes = require("@rosetta/core/Bytes") +S["model/ply"] = function(r: Bytes.Reader): number + local h = r:peek(4) + return if h == "ply\n" or h == "ply\r" then 1 else 0 +end +end + +do -- model/pmx +local Bytes = require("@rosetta/core/Bytes") +S["model/pmx"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 4) == "PMX " then + return 1 + end + if string.sub(head, 1, 7) == "Pmd\0\0\128\63" then + return 1 + end + return 0 +end +end + +do -- model/proc +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/proc"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64, true) + if string.match(head, "^mapProcFile%d%d%d") then + return 1 + end + if string.match(head, '^"?PROC"?%s+"?%d') then + return 0.9 + end + return 0 +end +end + +do -- model/qb +local Bytes = require("@rosetta/core/Bytes") +S["model/qb"] = function(r: Bytes.Reader): number + if r:remaining() < 24 or r:peek(4) ~= "\1\1\0\0" then + return 0 + end + local b, p = r.buf, r.pos + local fmt, z, comp, mask = buffer.readu32(b, p + 4), buffer.readu32(b, p + 8), buffer.readu32(b, p + 12), buffer.readu32(b, p + 16) + if fmt > 1 or z > 1 or comp > 1 or mask > 1 then + return 0 + end + return 0.9 +end +end + +do -- model/rbxm +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "]*%?>", "") + if match(head, "^%s*]") then + return if find(head, "version=", 1, true) then 1 else 0.8 + end + return 0 +end +end + +do -- model/robloxmesh +local Bytes = require("@rosetta/core/Bytes") +S["model/robloxmesh"] = function(r: Bytes.Reader): number + return if string.match(r:peek(13), "^version [1-7]%.%d%d[\r\n]") then 1 else 0 +end +end + +do -- model/schematic +local Bytes = require("@rosetta/core/Bytes") +local Nbt = lazy(function() + return require("@rosetta/codecs/text/Nbt") +end) +local LITEMATIC_HINTS = { "Regions", "EnclosingSize", "RegionCount", "TotalVolume", "MinecraftDataVersion" } +local SPONGE_HINTS = { "BlockData", "PaletteMax" } -- v1 / v2 fields (some writers leave the root unnamed) +local function hinted(head: string, hints: { string }): boolean + for _, h in hints do + if string.find(head, string.char(0, #h) .. h, 1, true) then + return true + end + end + return false +end +S["model/schematic"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" or p.endian ~= "big" then + return 0 + end + if p.name == "Schematic" or (p.firstName == "Schematic" and p.firstType == "compound") then + return 1 + end + local head = buffer.tostring(p.head) + return if hinted(head, LITEMATIC_HINTS) or hinted(head, SPONGE_HINTS) then 1 else 0 +end +end + +do -- model/smd +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/smd"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 256, true) + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, "^version%s+1%s") and string.find(head, "nodes", 1, true) then + return 0.9 + end + return 0 +end +end + +do -- model/sourcemdl +local Bytes = require("@rosetta/core/Bytes") +S["model/sourcemdl"] = function(r: Bytes.Reader): number + if r.limit - r.base < 8 or r:peek(4) ~= "IDST" then + return 0 + end + local v = buffer.readi32(r.buf, r.base + 4) + return if v >= 44 and v <= 49 then 1 else 0 +end +end + +do -- model/stl +local Bytes = require("@rosetta/core/Bytes") +local function lower5(s: string): boolean + return string.lower(s) == "solid" +end +S["model/stl"] = function(r: Bytes.Reader): number + local size = r:remaining() + if size >= 84 then + local c = r:peek(4, 80) + local n = string.byte(c, 1) + string.byte(c, 2) * 256 + string.byte(c, 3) * 65536 + string.byte(c, 4) * 16777216 + if 84 + 50 * n == size then + return 0.9 + end + end + local head = r:peek(512) + local s = string.match(head, "^%s*(%a+)") + if s and lower5(s) then + local l = string.lower(head) + return if string.find(l, "facet", 1, true) or string.find(l, "endsolid", 1, true) then 0.9 else 0.5 + end + return 0 +end +end + +do -- model/t3d +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/t3d"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 512) + local first = string.match(h, "^%s*(Begin%s+%a+)") + if first == nil then + return 0 + end + local kind = string.lower(string.match(first, "%a+$") or "") + if kind == "map" or kind == "actor" or kind == "level" or kind == "brush" or kind == "polylist" then + return 0.9 + end + return 0.3 +end +end + +do -- model/udmf +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/udmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 1024, true) + for _ = 1, 32 do + local rest = string.match(head, "^//[^\n]*\n%s*(.*)$") or string.match(head, "^/%*.-%*/%s*(.*)$") + if not rest then + break + end + head = rest + end + if string.match(head, "^[Nn][Aa][Mm][Ee][Ss][Pp][Aa][Cc][Ee]%s*=%s*\"") then + return 0.9 + end + return 0 +end +end + +do -- model/usda +local Bytes = require("@rosetta/core/Bytes") +local function isUsdz(r: Bytes.Reader): boolean + if r:peek(4) ~= "PK\3\4" then + return false + end + local lo, hi = r:peekU8(26), r:peekU8(27) + if lo < 0 or hi < 0 then + return false + end + local nameLen = lo + hi * 256 + local name = string.lower(r:peek(30 + nameLen)) + name = string.sub(name, 31) + return string.find(name, "%.usd[ac]?$") ~= nil +end +S["model/usda"] = function(r: Bytes.Reader): number + local head = r:peek(8) + if string.sub(head, 1, 5) == "#usda" or string.sub(head, 1, 8) == "\239\187\191#usda" then + return 1 + end + if head == "PXR-USDC" then + return 0.9 -- USDC magic, so the error says it is unsupported + end + if isUsdz(r) then + return 0.95 + end + return 0 +end +end + +do -- model/vbsp +local Bytes = require("@rosetta/core/Bytes") +local HEADER = 8 + 64 * 16 + 4 +S["model/vbsp"] = function(r: Bytes.Reader): number + if r:remaining() < HEADER or r:peek(4) ~= "VBSP" then + return 0 + end + local v = buffer.readi32(r.buf, r.pos + 4) + return if v >= 19 and v <= 21 then 1 else 0.5 +end +end + +do -- model/vmf +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["model/vmf"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512, true) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^versioninfo%s*{") or string.match(head, '^"versioninfo"%s*{') then + return 0.9 + end + if string.match(head, "^world%s*{") or string.match(head, "^visgroups%s*{") then + return 0.6 + end + return 0 +end +end + +do -- model/vox +local Bytes = require("@rosetta/core/Bytes") +S["model/vox"] = function(r: Bytes.Reader): number + return if r:peek(4) == "VOX " and r:peek(4, 8) == "MAIN" then 1 elseif r:peek(4) == "VOX " then 0.8 else 0 +end +end + +do -- model/vrml +local Bytes = require("@rosetta/core/Bytes") +S["model/vrml"] = function(r: Bytes.Reader): number + local head = r:peek(16) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + return if string.sub(head, 1, 10) == "#VRML V2.0" then 1 elseif string.sub(head, 1, 6) == "#VRML " then 0.6 else 0 +end +end + +do -- model/x +local Bytes = require("@rosetta/core/Bytes") +local ENCODINGS = { ["txt "] = "text", ["bin "] = "binary", tzip = "text", bzip = "binary" } +S["model/x"] = function(r: Bytes.Reader): number + if r:peek(4) ~= "xof " then + return 0 + end + return if ENCODINGS[r:peek(4, 8)] then 1 else 0.5 +end +end + +do -- model/x3d +local Bytes = require("@rosetta/core/Bytes") +S["model/x3d"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if string.sub(head, 1, 3) == "\239\187\191" then + head = string.sub(head, 4) + end + if string.sub(head, 1, 5) == "#X3D " then + return 1 + end + if string.sub(head, 1, 4) == "\224\0\0\1" and string.find(head, "x3d", 1, true) then + return 0.9 + end + if string.find(head, "]") or string.find(head, "", 1, true) or (string.find(head, "", 1, true)) then + return if string.find(r:peek(512), "= 64 then + local lfanew = string.byte(h, 61) + string.byte(h, 62) * 256 + string.byte(h, 63) * 65536 + local sig = r:peek(2, lfanew) + return if sig == "NE" then 0.6 elseif sig == "PE" then 0.2 else 0 + end + if isFnt(h) and #h >= 6 then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + string.byte(h, 5) * 65536 + string.byte(h, 6) * 16777216 + return if size == r:size() then 0.9 elseif size <= r:size() and size > 118 then 0.3 else 0 + end + return 0 +end +end + +do -- font/hershey +local Bytes = require("@rosetta/core/Bytes") +local function header(line: string): (number?, number?) + if #line < 10 then + return nil, nil + end + local id = tonumber((string.gsub(string.sub(line, 1, 5), "^%s+", ""))) + local n = tonumber((string.gsub(string.sub(line, 6, 8), "^%s+", ""))) + if not id or not n or n < 1 or string.find(string.sub(line, 1, 8), "[^%d ]") then + return nil, nil + end + return id, n +end +S["font/hershey"] = function(r: Bytes.Reader): number + local head = r:peek(256) + local line = string.match(head, "^([^\r\n]*)") + local id, n = header(line or "") + if not id or not n then + return 0 + end + local body = string.sub(line :: string, 9) + if string.find(body, "[^ -~]") then + return 0 + end + return if #body == math.min(2 * n, 64) or #body == 2 * n then 0.7 else 0.3 +end +end + +do -- font/pcf +local Bytes = require("@rosetta/core/Bytes") +S["font/pcf"] = function(r: Bytes.Reader): number + return if r:peek(4) == "\1fcp" then 1 else 0 +end +end + +do -- font/psf +local Bytes = require("@rosetta/core/Bytes") +S["font/psf"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if h == "\114\181\74\134" then + return 1 + end + if string.sub(h, 1, 2) == "\54\4" and #h >= 4 and string.byte(h, 3) <= 7 and string.byte(h, 4) > 0 then + return 0.9 + end + return 0 +end +end + +do -- font/ttf +local Bytes = require("@rosetta/core/Bytes") +S["font/ttf"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\0\1\0\0" or m == "OTTO" or m == "ttcf" or m == "true" then + return 0.9 + end + return 0 +end +end + +do -- font/type1 +local Bytes = require("@rosetta/core/Bytes") +S["font/type1"] = function(r: Bytes.Reader): number + local h = r:peek(64) + if string.sub(h, 1, 2) == "\128\1" then + h = string.sub(h, 7) + end + if string.sub(h, 1, 14) == "%!PS-AdobeFont" or string.sub(h, 1, 10) == "%!FontType" then + return 1 + end + return 0 +end +end + +do -- font/woff +local Bytes = require("@rosetta/core/Bytes") +S["font/woff"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOFF" then 1 else 0 +end +end + +do -- font/woff2 +local Bytes = require("@rosetta/core/Bytes") +S["font/woff2"] = function(r: Bytes.Reader): number + return if r:peek(4) == "wOF2" then 1 else 0 +end +end + +do -- archive/7z +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "7z\188\175\39\28" +S["archive/7z"] = function(r: Bytes.Reader): number + return if r:peek(6) == MAGIC then 1 else 0 +end +end + +do -- archive/adf +local Bytes = require("@rosetta/core/Bytes") +local BS = 512 +S["archive/adf"] = function(r: Bytes.Reader): number + local n = r:size() + if n < 4 * BS or n % BS ~= 0 then + return 0 + end + local h = r:peek(4) + if string.sub(h, 1, 3) ~= "DOS" or string.byte(h, 4) > 5 then + return 0 + end + return if n == 901120 or n == 1802240 then 0.95 else 0.6 +end +end + +do -- archive/applesingle +local Bytes = require("@rosetta/core/Bytes") +S["archive/applesingle"] = function(r: Bytes.Reader): number + local h = r:peek(8) + if #h < 8 then + return 0 + end + local magic = string.sub(h, 1, 4) + local ver = string.sub(h, 5, 8) + if (magic == "\0\5\22\0" or magic == "\0\5\22\7") and (ver == "\0\1\0\0" or ver == "\0\2\0\0") then + return 1 + end + return 0 +end +end + +do -- archive/ar +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "!\n" +S["archive/ar"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return if r:peek(13, 68) == "debian-binary" then 1 else 0.9 + end + return if r:peek(8) == "!\n" then 0.5 else 0 +end +end + +do -- archive/arj +local Bytes = require("@rosetta/core/Bytes") +S["archive/arj"] = function(r: Bytes.Reader): number + local h = r:peek(4) + if #h == 4 and string.byte(h, 1) == 0x60 and string.byte(h, 2) == 0xEA then + local size = string.byte(h, 3) + string.byte(h, 4) * 256 + return if size > 0 and size <= 2600 then 0.9 else 0 + end + return 0 +end +end + +do -- archive/binhex +local Bytes = require("@rosetta/core/Bytes") +local BANNER = "(This file must be converted with BinHex" +S["archive/binhex"] = function(r: Bytes.Reader): number + local head = r:peek(2048) + local at = string.find(head, BANNER, 1, true) + if not at then + return 0 + end + return if at == 1 then 1 else 0.8 +end +end + +do -- archive/br +local Err = require("@rosetta/core/Err") +local Bytes = require("@rosetta/core/Bytes") +local Brotli = lazy(function() + return require("@rosetta/codecs/compress/Brotli") +end) +local SNIFF_WHOLE = 262144 -- streams up to this size are decoded whole by sniff +local SNIFF_PREFIX = 65536 +S["archive/br"] = function(r: Bytes.Reader): number + local n = r:remaining() + if n == 0 then + return 0 + end + if n <= SNIFF_WHOLE then + local out, consumed = Brotli.decompress(r.buf, r.pos, n, { maxBytes = 2 ^ 26 }) + if out and consumed == r.limit then + return if buffer.len(out) > 0 then 0.3 else 0.05 + end + return 0 + end + local _, err = Brotli.decompress(r.buf, r.pos, SNIFF_PREFIX, { maxBytes = 2 ^ 22 }) + if err and (err.code == Err.TRUNCATED or err.code == Err.LIMIT) then + return 0.05 + end + return 0 +end +end + +do -- archive/bz2 +local Bytes = require("@rosetta/core/Bytes") +S["archive/bz2"] = function(r: Bytes.Reader): number + local h = r:peek(10) + if #h < 10 or string.sub(h, 1, 3) ~= "BZh" then + return 0 + end + local lv = string.byte(h, 4) + if lv < 0x31 or lv > 0x39 then + return 0 + end + local magic = string.sub(h, 5, 10) + if magic == "\x31\x41\x59\x26\x53\x59" or magic == "\x17\x72\x45\x38\x50\x90" then + return 1 + end + return 0 +end +end + +do -- archive/cab +local Bytes = require("@rosetta/core/Bytes") +S["archive/cab"] = function(r: Bytes.Reader): number + if r:peek(8) == "MSCF\0\0\0\0" then + return 1 + end + return 0 +end +end + +do -- archive/cpio +local Bytes = require("@rosetta/core/Bytes") +S["archive/cpio"] = function(r: Bytes.Reader): number + local m = r:peek(6) + if m == "070701" or m == "070702" or m == "070707" then + return 1 + end + local b2 = r:peek(2) + if (b2 == "\199\113" or b2 == "\113\199") and r:remaining() >= 26 then + return 0.5 + end + return 0 +end +end + +do -- archive/d64 +local Bytes = require("@rosetta/core/Bytes") +type Geometry = { kind: string, tracks: number, offsets: { number }, spt: { number }, dirTrack: number, total: number } +local function geometry(kind: string, tracks: number): Geometry + local offsets, spt = {}, {} + local o = 0 + for t = 1, tracks do + local n + if kind == "d81" then + n = 40 + else + local s = if kind == "d71" and t > 35 then t - 35 else t + n = if s <= 17 then 21 elseif s <= 24 then 19 elseif s <= 30 then 18 else 17 + end + offsets[t], spt[t] = o, n + o += n * 256 + end + return { kind = kind, tracks = tracks, offsets = offsets, spt = spt, dirTrack = if kind == "d81" then 40 else 18, total = o } +end +local function detect(len: number): Geometry? + for _, g in { { "d64", 35 }, { "d64", 40 }, { "d64", 42 }, { "d71", 70 }, { "d81", 80 } } :: { { any } } do + local geo = geometry(g[1] :: string, g[2] :: number) + local sectors = geo.total // 256 + if len == geo.total or (g[1] ~= "d81" and len == geo.total + sectors) then + return geo + end + end + return nil +end +S["archive/d64"] = function(r: Bytes.Reader): number + local geo = detect(r:size()) + if not geo then + return 0 + end + -- the BAM / header sector: dir track link and DOS version byte + local h = r:sub(geo.offsets[geo.dirTrack], 256) + local t, s, v = h:u8(), h:u8(), h:u8() + if geo.kind == "d81" then + return if t == 40 and s == 3 and v == 0x44 then 0.9 else 0.3 + end + return if t == 18 and s == 1 and (v == 0x41 or v == 0) then 0.9 else 0.3 +end +end + +do -- archive/fat +local Bytes = require("@rosetta/core/Bytes") +local Fat = lazy(function() + return require("@rosetta/containers/Fat") +end) +S["archive/fat"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + local v = Fat.open(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + if not v then + return 0 + end + return if v.partition then 0.6 else 0.8 +end +end + +do -- archive/grp +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local MAGIC = "KenSilverman" +S["archive/grp"] = function(r: Bytes.Reader): number + return Sniff.magic(r, MAGIC) +end +end + +do -- archive/gzip +local Bytes = require("@rosetta/core/Bytes") +S["archive/gzip"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\31\139\8" then 1 else 0 +end +end + +do -- archive/iso +local Bytes = require("@rosetta/core/Bytes") +S["archive/iso"] = function(r: Bytes.Reader): number + return if r:peek(5, 16 * 2048 + 1) == "CD001" then 1 else 0 +end +end + +do -- archive/lha +local Bytes = require("@rosetta/core/Bytes") +local METHODS: { [string]: boolean } = { + ["-lh0-"] = true, ["-lz4-"] = true, ["-lhd-"] = true, ["-lh1-"] = true, ["-lh4-"] = true, ["-lh5-"] = true, + ["-lh6-"] = true, ["-lh7-"] = true, ["-lhx-"] = true, ["-lzs-"] = true, ["-lz5-"] = true, ["-lh2-"] = true, + ["-lh3-"] = true, ["-pm0-"] = true, ["-pm1-"] = true, ["-pm2-"] = true, ["-lk7-"] = true, +} +local function isHeader(s: string): boolean + if #s < 22 then + return false + end + local m = string.sub(s, 3, 7) + local level = string.byte(s, 21) + return METHODS[m] == true and level <= 3 +end +S["archive/lha"] = function(r: Bytes.Reader): number + if isHeader(r:peek(22)) then + return 0.95 + end + return 0 +end +end + +do -- archive/lz4 +local Bytes = require("@rosetta/core/Bytes") +S["archive/lz4"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "\4\34\77\24" then + return 1 + elseif m == "\2\33\76\24" then + return 0.9 + elseif #m == 4 and string.byte(m, 1) >= 0x50 and string.byte(m, 1) <= 0x5F and string.sub(m, 2) == "\42\77\24" then + -- a skippable frame (zstd shares the magic): an LZ4 frame after it + local h = r:peek(4, 4) + if #h == 4 then + local n = string.byte(h, 1) + string.byte(h, 2) * 256 + string.byte(h, 3) * 65536 + string.byte(h, 4) * 16777216 + if r:peek(4, 8 + n) == "\4\34\77\24" then + return 1 + end + end + end + return 0 +end +end + +do -- archive/macbinary +local Bytes = require("@rosetta/core/Bytes") +local Crc16 = require("@rosetta/core/Crc16") +local function version(b: buffer, o: number, len: number): string? + if len < 128 then + return nil + end + local u8 = function(i: number): number + return buffer.readu8(b, o + i) + end + if u8(0) ~= 0 or u8(74) ~= 0 then + return nil + end + local nameLen = u8(1) + if nameLen < 1 or nameLen > 63 then + return nil + end + local function be32(i: number): number + return u8(i) * 16777216 + u8(i + 1) * 65536 + u8(i + 2) * 256 + u8(i + 3) + end + local dlen, rlen = be32(83), be32(87) + if dlen > 0x7FFFFFFF or rlen > 0x7FFFFFFF then + return nil + end + local crc = u8(124) * 256 + u8(125) + if crc == Crc16.ccitt(b, o, 124) and (crc ~= 0 or u8(122) >= 129) then + return if buffer.readstring(b, o + 102, 4) == "mBIN" then "III" else "II" + end + if buffer.readstring(b, o + 102, 4) == "mBIN" then + return nil -- III with a bad CRC + end + -- MacBinary I: byte 82 zero, bytes 99..125 zero, the forks within the file + if u8(82) ~= 0 then + return nil + end + for i = 99, 125 do + if u8(i) ~= 0 then + return nil + end + end + local need = 128 + math.ceil(dlen / 128) * 128 + rlen + return if need <= len + 127 then "I" else nil +end +S["archive/macbinary"] = function(r: Bytes.Reader): number + local n = math.min(r:remaining(), 128) + if n < 128 then + return 0 + end + local v = version(r.buf, r.base + r.pos, r.limit - r.base - r.pos) + return if v == "III" then 0.95 elseif v == "II" then 0.8 elseif v == "I" then 0.3 else 0 +end +end + +do -- archive/mpq +local Bytes = require("@rosetta/core/Bytes") +S["archive/mpq"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == "MPQ\x1A" or m == "MPQ\x1B" then + return 1 + end + -- a prefixed archive (an installer stub): the header on a 512-byte boundary in the first 64 KB + for at = 512, math.min(65536, r:remaining() - 32), 512 do + if r:peek(4, at) == "MPQ\x1A" then + return 0.6 + end + end + return 0 +end +end + +do -- archive/pak +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["archive/pak"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + return math.max(Sniff.magic(r, "PACK", 0, 0.9), Sniff.magic(r, "SPAK", 0, 0.9)) +end +end + +do -- archive/rpm +local Bytes = require("@rosetta/core/Bytes") +local LEAD_MAGIC = "\237\171\238\219" +S["archive/rpm"] = function(r: Bytes.Reader): number + return if r:peek(4) == LEAD_MAGIC then 1 else 0 +end +end + +do -- archive/tar +local Bytes = require("@rosetta/core/Bytes") +local Tar = lazy(function() + return require("@rosetta/containers/Tar") +end) +S["archive/tar"] = function(r: Bytes.Reader): number + if r:remaining() < 512 then + return 0 + end + if not Tar.valid(r.buf, r.pos) then + return 0 + end + return if r:peek(5, 257) == "ustar" then 0.95 else 0.6 +end +end + +do -- archive/unitypackage +local Bytes = require("@rosetta/core/Bytes") +local Deflate = lazy(function() + return require("@rosetta/codecs/compress/Deflate") +end) +local Tar = lazy(function() + return require("@rosetta/containers/Tar") +end) +local function guidOf(name: string): (string?, string?) + local n = string.gsub(name, "^%./", "") + local guid, rest = string.match(n, "^(%x+)/?(.*)$") + if guid and #guid == 32 then + return string.lower(guid), rest + end + return nil, nil +end +S["archive/unitypackage"] = function(r: Bytes.Reader): number + if r:peek(3) ~= "\31\139\8" then + return 0 + end + local head = Deflate.peek(r.buf, r.pos, r.limit - r.pos, 512) + if not head or buffer.len(head) < 512 or not Tar.valid(head, 0) then + return 0 + end + local z = 0 + while z < 100 and buffer.readu8(head, z) ~= 0 do + z += 1 + end + return if guidOf(buffer.readstring(head, 0, z)) then 1 else 0 -- ties with archive/gzip go to the extension +end +end + +do -- archive/uu +local Bytes = require("@rosetta/core/Bytes") +S["archive/uu"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^begin%-base64 [0-7]+ [^\r\n]") or string.match(head, "^begin [0-7]+ [^\r\n]") then + return 0.9 + end + if string.match(head, "\nbegin%-base64 [0-7]+ [^\r\n]") or string.match(head, "\nbegin [0-7][0-7][0-7]+ [^\r\n]") then + return 0.5 + end + return 0 +end +end + +do -- archive/vpk +local Bytes = require("@rosetta/core/Bytes") +S["archive/vpk"] = function(r: Bytes.Reader): number + if r:remaining() < 12 or r:peek(4) ~= "\x34\x12\xAA\x55" then + return 0 + end + local v = r:peekU8(4) + return if v == 1 or v == 2 then 1 else 0.5 +end +end + +do -- archive/vswap +local Bytes = require("@rosetta/core/Bytes") +local readu8, readu16, readi16, writeu32 = buffer.readu8, buffer.readu16, buffer.readi16, buffer.writeu32 +local function header(r: Bytes.Reader): (number?, number, number) + if r:remaining() < 6 then + return nil, 0, 0 + end + local n, ss, so = readu16(r.buf, r.base), readu16(r.buf, r.base + 2), readu16(r.buf, r.base + 4) + if n == 0 or ss > so or so > n or 6 + n * 6 > r:remaining() then + return nil, 0, 0 + end + return n, ss, so +end +S["archive/vswap"] = function(r: Bytes.Reader): number + local n = header(r) + if not n then + return 0 + end + local size = r.limit - r.base + local b = r.buf + local last = 6 + n * 6 + local nonzero = 0 + for i = 0, n - 1 do + local o = buffer.readu32(b, r.base + 6 + i * 4) + local l = readu16(b, r.base + 6 + n * 4 + i * 2) + if o ~= 0 then + if o < last or o + l > size then + return 0 + end + last = o + nonzero += 1 + end + end + return if nonzero > 0 then 0.6 else 0 +end +end + +do -- archive/wad +local Bytes = require("@rosetta/core/Bytes") +S["archive/wad"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + if m ~= "IWAD" and m ~= "PWAD" then + return 0 + end + return 0.9 +end +end + +do -- archive/wad2 +local Bytes = require("@rosetta/core/Bytes") +S["archive/wad2"] = function(r: Bytes.Reader): number + if r:remaining() < 12 then + return 0 + end + local m = r:peek(4) + return if m == "WAD2" or m == "WAD3" then 0.9 else 0 +end +end + +do -- archive/xz +local Bytes = require("@rosetta/core/Bytes") +local XZ_MAGIC = "\253" .. "7zXZ\0" +local function aloneScore(r: Bytes.Reader): number + local h = r:peek(14) + if #h < 14 then + return 0 + end + local d = string.byte(h, 1) + if d >= 225 or string.byte(h, 14) ~= 0 then + return 0 + end + local dict = string.byte(h, 2) + string.byte(h, 3) * 256 + string.byte(h, 4) * 65536 + string.byte(h, 5) * 16777216 + local okDict = false + for n = 12, 31 do + if dict == 2 ^ n or (n < 31 and dict == 2 ^ n + 2 ^ (n - 1)) then + okDict = true + break + end + end + if not okDict then + return 0 + end + local s = string.sub(h, 6, 13) + if s ~= string.rep("\255", 8) and (string.byte(h, 11) ~= 0 or string.byte(h, 12) ~= 0 or string.byte(h, 13) ~= 0) then + return 0 + end + return if d == 0x5D then 0.4 else 0.2 +end +S["archive/xz"] = function(r: Bytes.Reader): number + if r:peek(6) == XZ_MAGIC then + return 1 + end + return aloneScore(r) +end +end + +do -- archive/yenc +local Bytes = require("@rosetta/core/Bytes") +S["archive/yenc"] = function(r: Bytes.Reader): number + local head = r:peek(4096) + if string.match(head, "^=ybegin ") then + return 0.95 + end + return if string.find(head, "\n=ybegin [^\n]*name=") then 0.6 else 0 +end +end + +do -- archive/z +local Bytes = require("@rosetta/core/Bytes") +S["archive/z"] = function(r: Bytes.Reader): number + if r:peek(2) ~= "\31\157" then + return 0 + end + local f = r:peekU8(2) + return if f >= 0 and bit32.band(f, 0x60) == 0 and bit32.band(f, 0x1F) >= 9 and bit32.band(f, 0x1F) <= 16 then 1 else 0.3 +end +end + +do -- archive/zip +local Bytes = require("@rosetta/core/Bytes") +S["archive/zip"] = function(r: Bytes.Reader): number + local s = r:peek(4) + -- ZIP-based formats (docx, jar, 3mf, ...) score higher in their own sniff + if s == "PK\3\4" or s == "PK\5\6" then + return 0.6 + end + if string.sub(s, 1, 2) == "MZ" then + return 0 -- a self-extractor opens with Zip.decode / opts.format = "zip" + end + return 0 +end +end + +do -- archive/zoo +local Bytes = require("@rosetta/core/Bytes") +local TAG = 0xFDC4A7DC +S["archive/zoo"] = function(r: Bytes.Reader): number + local h = r:peek(24) + if #h < 24 then + return 0 + end + local tag = string.byte(h, 21) + string.byte(h, 22) * 256 + string.byte(h, 23) * 65536 + string.byte(h, 24) * 16777216 + if tag ~= TAG then + return 0 + end + return if string.sub(h, 1, 4) == "ZOO " then 1 else 0.8 +end +end + +do -- archive/zst +local Bytes = require("@rosetta/core/Bytes") +local Zstd = lazy(function() + return require("@rosetta/codecs/compress/Zstd") +end) +S["archive/zst"] = function(r: Bytes.Reader): number + local m = r:peek(4) + if m == Zstd.MAGIC then + return 1 + end + -- a skippable frame (0x184D2A50 .. 0x184D2A5F) is usually followed by a zstd frame + if #m == 4 and string.sub(m, 2, 4) == "\42\77\24" and bit32.band(string.byte(m, 1), 0xF0) == 0x50 then + return 0.5 + end + return 0 +end +end + +do -- data/cbor +local Bytes = require("@rosetta/core/Bytes") +S["data/cbor"] = function(r: Bytes.Reader): number + return if r:peek(3) == "\217\217\247" then 1 else 0 +end +end + +do -- data/csv +local Bytes = require("@rosetta/core/Bytes") +local find, sub, byte, gsub = string.find, string.sub, string.byte, string.gsub +S["data/csv"] = function(r: Bytes.Reader): number + local head = r:peek(1024) + if find(head, "%z") then + return 0 + end + local l1, l2 = string.match(head, "^([^\r\n]*)\r?\n([^\r\n]*)") + if not l1 or l1 == "" then + return 0 + end + for _, d in { ",", "\t", ";" } do + local _, c1 = gsub(l1, d, "") + local _, c2 = gsub(l2 :: string, d, "") + if c1 > 0 and c1 == c2 then + return 0.15 + end + end + return 0 +end +end + +do -- data/ini +local Bytes = require("@rosetta/core/Bytes") +S["data/ini"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + local first = string.match(head, "^[%s]*([^\r\n]*)") + while first and string.match(first, "^[;#]") do + head = string.match(head, "^[^\n]*\n(.*)$") or "" + first = string.match(head, "^[%s]*([^\r\n]*)") + end + if first and string.match(first, "^%[[^%]]+%]%s*$") then + return 0.2 + end + return 0 +end +end + +do -- data/json +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["data/json"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + local first = string.match(head, "^[ \t\r\n]*(.)") + if first == "{" then + local nxt = string.match(head, "^[^{]*{[ \t\r\n]*(.)") + return if nxt == nil or nxt == '"' or nxt == "}" then 0.6 else 0.1 + elseif first == "[" then + -- past any nested '[': a JSON value must start (TOML / INI "[section]" and "[[table]]" do not) + local nxt = string.match(head, "^[ \t\r\n]*[%[ \t\r\n]*(.)") + if nxt == nil or string.find('{"-0123456789tfn]', nxt, 1, true) then + return 0.3 + end + return 0 + end + return 0 +end +end + +do -- data/msgpack +local Bytes = require("@rosetta/core/Bytes") +S["data/msgpack"] = function(_r: Bytes.Reader): number + return 0 -- no magic: by extension or opts.format only +end +end + +do -- data/nbt +local Bytes = require("@rosetta/core/Bytes") +local Nbt = lazy(function() + return require("@rosetta/codecs/text/Nbt") +end) +S["data/nbt"] = function(r: Bytes.Reader): number + local p = Nbt.peek(r.buf, r.base, r.limit - r.base) + if not p or p.rootType ~= "compound" then + return 0 + end + if p.compression ~= "none" then + return if p.firstType then 1 else 0.5 -- gzip wrapped NBT: ties with archive/gzip go to the extension + end + return if p.firstType and p.firstName then 0.6 else 0.2 +end +end + +do -- data/plist +local Bytes = require("@rosetta/core/Bytes") +S["data/plist"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.sub(head, 1, 6) == "bplist" then + return 1 + end + if string.find(head, " 0 and good == lines and paths > 0 then 0.5 else 0 +end +end + +do -- data/snbt +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["data/snbt"] = function(r: Bytes.Reader): number + -- SNBT has what JSON never has: unquoted keys, typed numbers (1b, 2.5f), [I; arrays, single-quoted strings + local head = Sniff.text(r, 512, true) + local first = string.sub(head, 1, 1) + if first ~= "{" and first ~= "[" then + return 0 + end + if string.find(head, "[{,]%s*[%a_][%w_%-%.%+]*%s*:") or string.find(head, "%d[bBsSlLfFdD]%s*[,}%]]") + or string.find(head, "%[[BIL]%s*;") or string.find(head, "[:,%[]%s*'") + then + return 0.7 + end + return 0 +end +end + +do -- data/toml +local Bytes = require("@rosetta/core/Bytes") +S["data/toml"] = function(r: Bytes.Reader): number + local head = r:peek(512) + if string.find(head, "%z") then + return 0 + end + for line in string.gmatch(head, "[^\n]+") do + local l = string.match(line, "^[ \t]*(.-)[ \t\r]*$") :: string + if l ~= "" and string.sub(l, 1, 1) ~= "#" then + if string.match(l, "^%[%[?[%w_%-%.\"' ]+%]%]?$") or string.match(l, "^[%w_%-%.\"']+[ \t]*=[ \t]*[\"'%[{%dtf%+%-in]") then + return 0.2 + end + return 0 + end + end + return 0 +end +end + +do -- data/tres +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["data/tres"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 256) + if string.match(h, "^%s*%[gd_resource[%s%]]") then + return 1 + end + return 0 +end +end + +do -- data/vdf +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +local KeyValues = lazy(function() + return require("@rosetta/codecs/text/KeyValues") +end) +S["data/vdf"] = function(r: Bytes.Reader): number + local n = r:remaining() + if KeyValues.isBinary(r.buf, r.pos, n) then + return 0.3 + end + local head = Sniff.text(r, 256, true) + if string.find(head, "%z") then + return 0 + end + head = string.gsub(head, "^//[^\n]*\n%s*", "") + if string.match(head, '^"[^"\n]+"%s*{') or string.match(head, '^"[^"\n]+"%s*%[[^%]\n]*%]%s*{') then + return 0.6 + end + if string.match(head, "^#base%s") or string.match(head, "^#include%s") then + return 0.5 + end + if string.match(head, '^[%w_]+%s*\n%s*{%s*\n%s*"') then + return 0.3 + end + return 0 +end +end + +do -- data/xml +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["data/xml"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^<%?xml[ \t\r\n]") or string.sub(head, 1, 4) == "\255\254<\0" or string.sub(head, 1, 4) == "\254\255\0<" then + return 0.5 + end + if string.match(head, "^[ \t\r\n]*<[%a!]") then + return 0.3 + end + return 0 +end +end + +do -- data/yaml +local Bytes = require("@rosetta/core/Bytes") +S["data/yaml"] = function(r: Bytes.Reader): number + local head = r:peek(256) + if string.find(head, "%z") then + return 0 + end + if string.match(head, "^%%YAML ") then + return 0.9 + end + if string.match(head, "^%-%-%-[ \r\n]") then + return 0.5 + end + local line = string.match(head, "^[ \t\r\n]*([^\r\n]*)") + if line and (string.match(line, "^[%w_%-\"']+[%w_%- \"']*:[ ]") or string.match(line, "^[%w_%-]+:$") or string.match(line, "^%- ")) then + return 0.2 + end + return 0 +end +end + +do -- vector/gamemaps +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "TED5v1.0" +S["vector/gamemaps"] = function(r: Bytes.Reader): number + if r:peek(8) == MAGIC then + return 1 + end + -- MAPHEAD: the RLEW tag 0xABCD, then 100 offsets (0 / -1 when absent) + if r:remaining() >= 402 and r:remaining() <= 1024 and buffer.readu16(r.buf, r.base) == 0xABCD then + local first = buffer.readi32(r.buf, r.base + 2) + if first > 0 then + return 0.7 + end + end + return 0 +end +end + +do -- vector/ldtk +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["vector/ldtk"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 1024) + if not string.match(h, "^%s*{") then + return 0 + end + if string.find(h, "\"fileType\"%s*:%s*\"LDtk Project JSON\"") then + return 1 + end + if string.find(h, "\"jsonVersion\"", 1, true) and string.find(h, "\"worldLayout\"", 1, true) then + return 0.8 + end + return 0 +end +end + +do -- vector/ogmo +local Bytes = require("@rosetta/core/Bytes") +local Sniff = require("@rosetta/core/Sniff") +S["vector/ogmo"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 2048) + if not string.match(h, "^%s*{") or not string.find(h, "\"ogmoVersion\"", 1, true) then + return 0 + end + if string.find(h, "\"layerGridDefaultSize\"", 1, true) or string.find(h, "\"levelPaths\"", 1, true) then + return 1 + end + return 0.9 +end +end + +do -- vector/svg +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["vector/svg"] = function(r: Bytes.Reader): number + local h = Sniff.text(r, 4096) + if not string.match(h, "^%s*<") then + return 0 + end + if string.find(h, ":]") or string.find(h, "<%w+:svg[%s>]") then + return 0.95 + end + return 0 +end +end + +do -- vector/tiled +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +local function head(r: Bytes.Reader): string + local h = Sniff.text(r, 1024) + return h +end +S["vector/tiled"] = function(r: Bytes.Reader): number + local h = head(r) + if string.match(h, "^%s*<") then + if string.find(h, "]") or string.find(h, "]") then + return 0.9 + end + return 0 + end + if string.match(h, "^%s*{") then + -- Tiled writes its keys sorted: "type" comes last, so look at the tail too + local n = r:remaining() + local tail = if n > 1024 then r:peek(1024, n - 1024) else "" + for _, part in { h, tail } do + if string.find(part, "\"type\"%s*:%s*\"map\"") or string.find(part, "\"type\"%s*:%s*\"tileset\"") then + return 0.8 + end + end + if string.find(h, "\"tilewidth\"", 1, true) and (string.find(h, "\"orientation\"", 1, true) or string.find(h, "\"tilesets\"", 1, true)) then + return 0.6 + end + end + return 0 +end +end + +do -- layered/aseprite +local Bytes = require("@rosetta/core/Bytes") +S["layered/aseprite"] = function(r: Bytes.Reader): number + if r:peekU8(4) == 0xE0 and r:peekU8(5) == 0xA5 then + local d = r:peekU8(12) + if (d == 32 or d == 16 or d == 8) and r:peekU8(13) == 0 then + return 1 + end + return 0.5 + end + return 0 +end +end + +do -- layered/ora +local Bytes = require("@rosetta/core/Bytes") +local MIME = "image/openraster" +S["layered/ora"] = function(r: Bytes.Reader): number + -- a zip whose first (stored) entry is "mimetype" holding image/openraster + if r:peek(4) == "PK\3\4" and r:peek(8, 30) == "mimetype" and r:peek(#MIME, 38) == MIME then + return 1 + end + return 0 +end +end + +do -- layered/psd +local Bytes = require("@rosetta/core/Bytes") +S["layered/psd"] = function(r: Bytes.Reader): number + local h = r:peek(6) + if string.sub(h, 1, 4) == "8BPS" and (string.sub(h, 5, 6) == "\0\1" or string.sub(h, 5, 6) == "\0\2") then + return 1 + end + return 0 +end +end + +do -- subtitle/ass +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["subtitle/ass"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 64) + if string.match(head, "^%s*%[[Ss]cript [Ii]nfo%]") then + return 1 + end + return 0 +end +end + +do -- subtitle/srt +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +local TIMING = "^%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*%-%->%s*(%d+):(%d%d?):(%d%d?)[,.](%d+)%s*(.-)%s*$" +local function frac(digits: string): number + return (tonumber(digits) :: number) / 10 ^ #digits +end +local function timing(line: string): (number?, number?, string?) + local h1, m1, s1, f1, h2, m2, s2, f2, rest = string.match(line, TIMING) + if not h1 then + return nil, nil, nil + end + local a = tonumber(h1) :: number * 3600 + tonumber(m1) :: number * 60 + tonumber(s1) :: number + frac(f1 :: string) + local b = tonumber(h2) :: number * 3600 + tonumber(m2) :: number * 60 + tonumber(s2) :: number + frac(f2 :: string) + return a, b, rest +end +S["subtitle/srt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 512) + head = string.gsub(head, "\r", "\n") + local first, second = string.match(head, "^%s*([^\n]*)\n([^\n]*)") + if first and string.match(first, "^%d+%s*$") and second and timing(second) then + return 0.9 + end + if first and timing(first) then + return 0.6 + end + return 0 +end +end + +do -- subtitle/vtt +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["subtitle/vtt"] = function(r: Bytes.Reader): number + local head = Sniff.text(r, 10) + if string.sub(head, 1, 6) == "WEBVTT" then + local c = string.sub(head, 7, 7) + if c == "" or c == " " or c == "\t" or c == "\n" or c == "\r" then + return 1 + end + end + return 0 +end +end + +do -- music/669 +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 497 then + return false + end + local magic = r:peek(2) + if magic ~= "if" and magic ~= "JN" then + return false + end + local nsmp, npat, restart = r:peekU8(110), r:peekU8(111), r:peekU8(112) + if nsmp > 64 or restart >= 128 or npat > 128 then + return false + end + local bad = 0 + for i = 2, 109 do + local c = r:peekU8(i) + if c > 0 and c <= 31 then + bad += 1 + if bad > 40 then + return false + end + end + end + for i = 0, 127 do + local o, t, b = r:peekU8(113 + i), r:peekU8(241 + i), r:peekU8(369 + i) + if (o >= 128 and o < 0xFE) or (o < 128 and t == 0) or t > 15 or b >= 64 then + return false + end + end + return true +end +S["music/669"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.6 else 0 +end +end + +do -- music/ahx +local Bytes = require("@rosetta/core/Bytes") +S["music/ahx"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "THX" and string.byte(m, 4) < 3 then 1 else 0 +end +end + +do -- music/far +local Bytes = require("@rosetta/core/Bytes") +S["music/far"] = function(r: Bytes.Reader): number + if r:size() >= 98 and r:peek(4) == "FAR\xFE" and r:peek(3, 44) == "\r\n\x1A" and r:peekU8(47) + r:peekU8(48) * 256 >= 98 then + return 1 + end + return 0 +end +end + +do -- music/hmp +local Bytes = require("@rosetta/core/Bytes") +local HMI_MAGIC = "HMI-MIDISONG061595" +S["music/hmp"] = function(r: Bytes.Reader): number + return if r:peek(8) == "HMIMIDIP" or r:peek(18) == HMI_MAGIC then 1 else 0 +end +end + +do -- music/hvl +local Bytes = require("@rosetta/core/Bytes") +S["music/hvl"] = function(r: Bytes.Reader): number + local m = r:peek(4) + return if m and #m == 4 and string.sub(m, 1, 3) == "HVL" and string.byte(m, 4) <= 1 then 1 else 0 +end +end + +do -- music/it +local Bytes = require("@rosetta/core/Bytes") +S["music/it"] = function(r: Bytes.Reader): number + return if r:peek(4) == "IMPM" then 1 else 0 +end +end + +do -- music/med +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 52 or r:peek(3) ~= "MMD" then + return false + end + local v = r:peekU8(3) + if v < 0x30 or v > 0x33 then + return false + end + local h = r:sub(8, 44) + local songOff = h:u32be() + h:skip(4) + local blockOff = h:u32be() + h:skip(4) + local smpOff = h:u32be() + return songOff >= 52 and songOff + 63 * 8 + 284 <= r:size() and blockOff >= 52 and (smpOff == 0 or smpOff >= 52) +end +S["music/med"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/midi +local Bytes = require("@rosetta/core/Bytes") +S["music/midi"] = function(r: Bytes.Reader): number + if r:peek(4) == "MThd" then + return 1 + end + if r:peek(4) == "RIFF" and r:peek(4, 8) == "RMID" then + return 1 + end + return 0 +end +end + +do -- music/mod +local Bytes = require("@rosetta/core/Bytes") +local FIXED: { [string]: number } = { + ["M.K."] = 4, + ["M!K!"] = 4, + ["M&K!"] = 4, + ["N.T."] = 4, + ["FLT4"] = 4, + ["FLT8"] = 8, + ["CD81"] = 8, + ["OKTA"] = 8, + ["OCTA"] = 8, + ["EXO4"] = 4, + ["EXO8"] = 8, +} +local function signatureChannels(sig: string): number? + local fixed = FIXED[sig] + if fixed then + return fixed + end + local d = string.match(sig, "^(%d)CHN$") + if d then + local n = tonumber(d) :: number + return if n >= 1 then n else nil + end + local dd = string.match(sig, "^(%d%d)C[HN]$") + if dd then + local n = tonumber(dd) :: number + return if n >= 1 and n <= 32 then n else nil + end + local t = string.match(sig, "^TDZ(%d)$") + if t then + local n = tonumber(t) :: number + return if n >= 1 then n else nil + end + return nil +end +S["music/mod"] = function(r: Bytes.Reader): number + if r:size() < 1084 then + return 0 + end + local sig = r:peek(4, 1080) + if signatureChannels(sig) then + return 0.8 + end + return 0 +end +end + +do -- music/mtm +local Bytes = require("@rosetta/core/Bytes") +S["music/mtm"] = function(r: Bytes.Reader): number + if r:size() >= 66 and r:peek(3) == "MTM" and r:peekU8(3) < 0x20 and r:peekU8(33) >= 1 and r:peekU8(33) <= 32 then + return 1 + end + return 0 +end +end + +do -- music/mus +local Bytes = require("@rosetta/core/Bytes") +S["music/mus"] = function(r: Bytes.Reader): number + return if r:peek(4) == "MUS\x1a" then 1 else 0 +end +end + +do -- music/okt +local Bytes = require("@rosetta/core/Bytes") +S["music/okt"] = function(r: Bytes.Reader): number + return if r:peek(8) == "OKTASONG" then 1 else 0 +end +end + +do -- music/ptm +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 608 or r:peek(4, 44) ~= "PTMF" or r:peekU8(28) ~= 26 or r:peekU8(30) > 2 then + return false + end + local h = r:sub(32, 10) + local nord, nsmp, npat, nch, flags = h:u16le(), h:u16le(), h:u16le(), h:u16le(), h:u16le() + return flags == 0 and nch >= 1 and nch <= 32 and nord >= 1 and nord <= 256 and nsmp >= 1 and nsmp <= 255 and npat >= 1 and npat <= 128 +end +S["music/ptm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 1 else 0 +end +end + +do -- music/s3m +local Bytes = require("@rosetta/core/Bytes") +S["music/s3m"] = function(r: Bytes.Reader): number + if r:size() >= 48 and r:peek(4, 44) == "SCRM" then + return 1 + end + return 0 +end +end + +do -- music/sf2 +local Bytes = require("@rosetta/core/Bytes") +local SoundFont = lazy(function() + return require("@rosetta/codecs/audio/SoundFont") +end) +S["music/sf2"] = function(r: Bytes.Reader): number + return if SoundFont.sniff(r) then 1 else 0 +end +end + +do -- music/stm +local Bytes = require("@rosetta/core/Bytes") +local function validHeader(r: Bytes.Reader): boolean + if r:size() < 48 then + return false + end + local eof, ftype, major, minor = r:peekU8(28), r:peekU8(29), r:peekU8(30), r:peekU8(31) + local npat, gv = r:peekU8(33), r:peekU8(34) + if ftype ~= 2 or (eof ~= 0x1A and eof ~= 2) or major ~= 2 or (minor ~= 0 and minor ~= 10 and minor ~= 20 and minor ~= 21) then + return false + end + if npat > 64 or (gv > 64 and gv ~= 0x58) then + return false + end + for i = 20, 27 do + local c = r:peekU8(i) + if c < 0x20 or c >= 0x7F then + return false + end + end + return true +end +S["music/stm"] = function(r: Bytes.Reader): number + return if validHeader(r) then 0.7 else 0 +end +end + +do -- music/ult +local Bytes = require("@rosetta/core/Bytes") +S["music/ult"] = function(r: Bytes.Reader): number + local v = r:peekU8(14) + if r:size() >= 48 and r:peek(14) == "MAS_UTrack_V00" and v >= 0x31 and v <= 0x34 then + return 1 + end + return 0 +end +end + +do -- music/umx +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "\xC1\x83\x2A\x9E" +type Header = { version: number, nameCount: number, nameOffset: number, exportCount: number, exportOffset: number, importCount: number, importOffset: number } +local function header(r: Bytes.Reader): Header? + if r:size() < 36 or r:peek(4) ~= MAGIC then + return nil + end + local h = r:sub(4, 32) + local version = h:u16le() + h:skip(6) + local hd: Header = { + version = version, + nameCount = h:u32le(), + nameOffset = h:u32le(), + exportCount = h:u32le(), + exportOffset = h:u32le(), + importCount = h:u32le(), + importOffset = h:u32le(), + } + if h.err or hd.nameOffset < 36 or hd.exportOffset < 36 or hd.importOffset < 36 then + return nil + end + if hd.nameCount == 0 or hd.exportCount == 0 or hd.importCount == 0 or hd.nameCount > 2 ^ 20 or hd.exportCount > 2 ^ 20 or hd.importCount > 2 ^ 20 then + return nil + end + return hd +end +local function index(r: Bytes.Reader): number + local b = r:u8() + local neg = b >= 0x80 + local v = b % 64 + if bit32.band(b, 0x40) ~= 0 then + local shift = 6 + repeat + b = r:u8() + v += (b % 128) * 2 ^ shift + shift += 7 + until b < 0x80 or shift >= 32 + end + return if neg then -v else v +end +local function names(r: Bytes.Reader, h: Header): { string } + local list = {} + local nr = r:sub(h.nameOffset) + for _ = 1, math.min(h.nameCount, 65536) do + if nr:remaining() < 5 then + break + end + if h.version >= 64 then + index(nr) + end + table.insert(list, string.lower(nr:cstring(1024))) + nr:skip(4) + end + return list +end +S["music/umx"] = function(r: Bytes.Reader): number + local h = header(r) + if not h then + return 0 + end + return if table.find(names(r, h), "music") then 1 else 0.3 +end +end + +do -- music/xm +local Bytes = require("@rosetta/core/Bytes") +local MAGIC = "Extended Module: " +S["music/xm"] = function(r: Bytes.Reader): number + return if r:peek(17) == MAGIC then 1 else 0 +end +end + +do -- music/xmi +local Bytes = require("@rosetta/core/Bytes") +S["music/xmi"] = function(r: Bytes.Reader): number + local id, kind = r:peek(4), r:peek(4, 8) + if id == "FORM" and (kind == "XDIR" or kind == "XMID") then + return 1 + end + return if id == "CAT " and kind == "XMID" then 0.9 else 0 +end +end + +do -- playlist/m3u +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +S["playlist/m3u"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 512) + s = (string.match(s, "^%s*(.*)$") :: string) + if string.sub(s, 1, 7) == "#EXTM3U" then + return 0.95 + end + if string.find(s, "^#EXTINF:") or string.find(s, "^#EXT%-X%-") then + return 0.8 + end + return 0 +end +end + +do -- playlist/pls +local Sniff = require("@rosetta/core/Sniff") +local Bytes = require("@rosetta/core/Bytes") +local Text = lazy(function() + return require("@rosetta/codecs/text/Text") +end) +S["playlist/pls"] = function(r: Bytes.Reader): number + local s = Sniff.text(r, 64) + local first = string.match(s, "^%s*([^\r\n]*)") + return if first and string.lower(Text.trim(first)) == "[playlist]" then 0.95 else 0 +end +end + +do -- playlist/xspf +local Bytes = require("@rosetta/core/Bytes") +local NS = "http://xspf.org/ns/0/" +S["playlist/xspf"] = function(r: Bytes.Reader): number + local s = r:peek(1024) + local i = string.find(s, "<%w*:?playlist[%s>]") + if i and string.find(s, NS, 1, true) then + return 0.95 + end + return 0 +end +end + +return S diff --git a/src/Rosetta/init.luau b/src/Rosetta/init.luau index a0db2dd..b4eb96a 100644 --- a/src/Rosetta/init.luau +++ b/src/Rosetta/init.luau @@ -78,6 +78,56 @@ end local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB +-- detection order: by the cost of a sniff (Registry.sniff: Sniffs.luau, Sniffs.luau reaching a codec, the format +-- module), then registry order; the costly LATE sniffs last +local order: { number }? = nil +local byExt: { [string]: { number } } = {} +local Sniffs: { [string]: (any) -> number }? = nil + +local function sniffOrder(): { number } + local o = order + if o then + return o + end + local list: { number } = {} + for idx, e in Registry do + table.insert(list, idx) + for _, x in e.extensions do + byExt[x] = byExt[x] or {} + table.insert(byExt[x], idx) + end + end + local function rank(idx: number): number + local e = Registry[idx] + return if LATE[e.name] then 3 else e.sniff + end + table.sort(list, function(a: number, b: number): boolean + local ra, rb = rank(a), rank(b) + if ra ~= rb then + return ra < rb + end + return a < b + end) + order = list + return list +end + +local function sniffer(e: Registry.Entry): ((any) -> number)? + if e.sniff < 2 then + local s = Sniffs + if not s then + s = require("@rosetta/Sniffs") :: any + Sniffs = s + end + local f = (s :: { [string]: (any) -> number })[e.path] + if f then + return f + end + end + local m = module(e) + return if m and type(m.sniff) == "function" then m.sniff else nil +end + local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) if format then local e = find(format, category) @@ -87,52 +137,35 @@ local function detect(buf: buffer, name: string?, category: string?, format: str return e, nil end local ext = Input.extension(name) + local list = sniffOrder() + local hits = if ext then byExt[ext] else nil local best: Registry.Entry? = nil local bestScore, bestIdx = 0, 0 - -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff - -- (LATE: the most they score) run last, and only when they could still win; ties go to registry order. - local late: { number }? = nil - for idx, e in Registry do - if inCategory(e, category) and (e.caps.decode or e.caps.open) then - local cap = LATE[e.name] - if cap then - late = late or {} - table.insert(late :: { number }, idx) - continue - end - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - local extHit = ext and table.find(e.extensions, ext) - if extHit then - score += 0.01 -- ties go to the extension - end - if score > bestScore then - best, bestScore, bestIdx = e, score, idx - if extHit and score >= 1.01 then - return e, nil - end - end + -- sniffs score 0..1 (core/Sniff), +0.01 for the extension's formats; the best wins, ties go to registry order. The + -- extension's formats run first, and a sniff runs only while its cap (1, or LATE) could still win. + for pass = 1, 2 do + local ids = if pass == 1 then hits else list + if ids then + for _, idx in ids do + if pass == 2 and bestScore > 1 then + break end - end - end - end - if late then - for _, idx in late do - local e = Registry[idx] - local extHit = ext and table.find(e.extensions, ext) - local cap = LATE[e.name] + (if extHit then 0.01 else 0) - if cap > bestScore or (cap == bestScore and idx < bestIdx) then - local m = module(e) - if m and m.sniff then - local ok, score = pcall(m.sniff, Bytes.reader(buf)) - if ok and type(score) == "number" and score > 0 then - if extHit then - score += 0.01 - end - if score > bestScore or (score == bestScore and idx < bestIdx) then - best, bestScore, bestIdx = e, score, idx + local e = Registry[idx] + local extHit = pass == 1 or (hits ~= nil and table.find(hits, idx) ~= nil) + if (pass == 1 or not extHit) and inCategory(e, category) and (e.caps.decode or e.caps.open) then + local cap = (LATE[e.name] or 1) + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local sniff = sniffer(e) + if sniff then + local ok, score = pcall(sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end end end end @@ -696,7 +729,7 @@ function F.detect(src: any, opts: Options?): (string?, Err.Err?) return nil, err end -- a format may name the file's flavour more precisely (video/mkv: "webm" for DocType webm) - local m = module(entry) + local m = if entry.variant then module(entry) else nil if m and type(m.variant) == "function" then local ok, v = pcall(m.variant, Bytes.reader(buf)) if ok and type(v) == "string" then diff --git a/tests/detect.luau b/tests/detect.luau new file mode 100644 index 0000000..c6054f6 --- /dev/null +++ b/tests/detect.luau @@ -0,0 +1,210 @@ +-- detect tests: lazy detection (Sniffs.luau, cost order, extension first) against the eager reference (every format +-- module's own sniff, registry order) on samples of every fixture module, with and without names and categories; +-- which modules a first detect loads. Fixtures: tools/fixtures/detect.py. +local T = require("@tests/T") +local Registry = require("@rosetta/Registry") + +local loads: { string } = {} +for _, e in Registry do + local load = e.load + e.load = function(): any + table.insert(loads, e.path) + return load() + end +end + +local F = require("@rosetta") +local Bytes = require("@rosetta/core/Bytes") +local Input = require("@rosetta/core/Input") +local Sniffs = require("@rosetta/Sniffs") +local Blobs1 = require("@tests/gen/detect_blobs_1") +local Blobs2 = require("@tests/gen/detect_blobs_2") +local Blobs3 = require("@tests/gen/detect_blobs_3") +local Blobs4 = require("@tests/gen/detect_blobs_4") + +local t = T.suite("detect") + +-- 1. a first detect of a PNG loads no format module, with or without its name +local PNG = buffer.fromstring("\137PNG\r\n\26\n\0\0\0\rIHDR\0\0\0\1\0\0\0\1\8\6\0\0\0\31\21\196\137\0\0\0\rIDATx\218c\248\255\255?\0\5\254\2\254\167\53\129\132\0\0\0\0IEND\174B`\130") +t:eq(F.detect(PNG, { name = "a.png" }), "png", "png with name") +t:eq(F.detect(PNG), "png", "png without name") +t:eq(F.detect(PNG, { name = "a.jpg" }), "png", "png named .jpg") +t:eq(#loads, 0, "no format module loaded (" .. table.concat(loads, " ") .. ")") +local junk = buffer.create(4096) +for i = 0, 4095 do + buffer.writeu8(junk, i, (i * 7919) % 251) +end +F.detect(junk) +local need = 0 +for _, e in Registry do + if e.sniff == 2 then + need += 1 + end +end +t:check(#loads <= need + 1, "unknown data loads only the modules that sniff themselves: " .. table.concat(loads, " ")) +t:note("unknown data: %d format modules loaded (%s)", #loads, table.concat(loads, " ")) + +-- 2. the eager reference: each module's own sniff in registry order, the extension's format at 1 returns at once, +-- archive/br (a trial decode, at most 0.3) last +local modules: { [string]: any } = {} +for _, e in Registry do + modules[e.path] = e.load() +end + +local function refDetect(buf: buffer, name: string?, category: string?): any + local ext = Input.extension(name) + local best, bestScore, bestIdx = nil, 0, 0 + local late: { number } = {} + for idx, e in Registry do + if (category == nil or e.category == category) and (e.caps.decode or e.caps.open) then + if e.name == "br" then + table.insert(late, idx) + continue + end + local ok, score = pcall(modules[e.path].sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + local extHit = ext and table.find(e.extensions, ext) + if extHit then + score += 0.01 + end + if score > bestScore then + best, bestScore, bestIdx = e, score, idx + if extHit and score >= 1.01 then + return e + end + end + end + end + end + for _, idx in late do + local e = Registry[idx] + local extHit = ext and table.find(e.extensions, ext) + local cap = 0.3 + (if extHit then 0.01 else 0) + if cap > bestScore or (cap == bestScore and idx < bestIdx) then + local ok, score = pcall(modules[e.path].sniff, Bytes.reader(buf)) + if ok and type(score) == "number" and score > 0 then + if extHit then + score += 0.01 + end + if score > bestScore or (score == bestScore and idx < bestIdx) then + best, bestScore, bestIdx = e, score, idx + end + end + end + end + if best then + return best + end + if ext then + for _, e in Registry do + if (category == nil or e.category == category) and e.name == ext then + return e + end + end + for _, e in Registry do + if (category == nil or e.category == category) and table.find(e.extensions, ext) then + return e + end + end + end + return nil +end + +local function refName(buf: buffer, name: string?, category: string?): string? + local e = refDetect(buf, name, category) + if not e then + return nil + end + local m = modules[e.path] + if type(m.variant) == "function" then + local ok, v = pcall(m.variant, Bytes.reader(buf)) + if ok and type(v) == "string" then + return v + end + end + return e.name +end + +local blobs: { { from: string, data: string } } = {} +for _, part in { Blobs1, Blobs2, Blobs3, Blobs4 } do + for _, b in part :: any do + table.insert(blobs, b) + end +end +local rng = T.rng(7) +for n = 0, 40 do + local b = buffer.create(n * 7) + for i = 0, n * 7 - 1 do + buffer.writeu8(b, i, rng(256) - 1) + end + table.insert(blobs, { from = "random", data = buffer.tostring(b) }) +end +table.insert(blobs, { from = "junk", data = buffer.tostring(junk) }) +table.insert(blobs, { from = "png", data = buffer.tostring(PNG) }) +t:check(#blobs > 1000, "samples from the fixture modules (" .. #blobs .. ")") + +-- 3. every copied sniff scores as the module's own, and every score is in 0..1 (the cost order relies on it) +local copied, diff, over = 0, 0, 0 +for _, e in Registry do + local s = (Sniffs :: any)[e.path] + t:eq(s ~= nil, e.sniff < 2, e.path .. ": in Sniffs.luau as Registry.sniff says") + if s then + copied += 1 + end +end +for _, b in blobs do + local buf = buffer.fromstring(b.data) + for _, e in Registry do + local own = modules[e.path].sniff + local ok1, s1 = pcall(own, Bytes.reader(buf)) + if ok1 and type(s1) == "number" and s1 > 1 then + over += 1 + t:note("%s scores %s on a sample of %s", e.path, tostring(s1), b.from) + end + local s = (Sniffs :: any)[e.path] + if s then + local ok2, s2 = pcall(s, Bytes.reader(buf)) + if ok1 ~= ok2 or (ok1 and s1 ~= s2) then + diff += 1 + if diff <= 10 then + t:note("%s on a sample of %s: module %s, copy %s", e.path, b.from, tostring(s1), tostring(s2)) + end + end + end + end +end +t:eq(diff, 0, "copied sniffs score as the modules do") +t:eq(over, 0, "no sniff scores over 1") + +-- 4. F.detect = the reference: no name, the reference's own extension, a wrong one, an unknown one; and per category +local runs, mismatch = 0, 0 +local function same(buf: buffer, from: string, name: string?, category: string?) + local want = refName(buf, name, category) + local got = F.detect(buf, { name = name, category = category }) + runs += 1 + if got ~= want then + mismatch += 1 + if mismatch <= 10 then + t:note("sample of %s, name %s, category %s: got %s, want %s", from, tostring(name), tostring(category), tostring(got), tostring(want)) + end + end +end +for _, b in blobs do + local buf = buffer.fromstring(b.data) + same(buf, b.from, nil, nil) + local e = refDetect(buf, nil, nil) + if e then + same(buf, b.from, "x." .. e.extensions[1], nil) + same(buf, b.from, nil, e.category) + end + same(buf, b.from, "x.png", nil) + same(buf, b.from, "x.txt", nil) + same(buf, b.from, "x.bin", "audio") +end +t:eq(mismatch, 0, "F.detect matches the eager reference (" .. runs .. " detects)") +t:note("%d samples, %d detects, %d of %d sniffs copied into Sniffs.luau", #blobs, runs, copied, #Registry) + +t:fuzz("detect", function(b: buffer): any + return F.detect(b) +end, { PNG, junk }) +t:done() diff --git a/tools/fixtures.py b/tools/fixtures.py index 08dce50..db102cf 100644 --- a/tools/fixtures.py +++ b/tools/fixtures.py @@ -8,6 +8,7 @@ # INPUTS = ["tests/fixtures/pngsuite", ...] # optional: files / dirs whose change triggers a rebuild # def generate(ctx): ... # ctx.emit("png_suite", value), ctx.nix("imagemagick", [...]), ... # A generator is skipped while all its outputs are newer than itself and its INPUTS (--force reruns it). +# LAST = True runs it after the others; it also reruns when any other generator's output changed (it reads them) # # ctx.emit(name, value): writes tests/gen/.luau returning value. Python values map to Luau: bytes -> string # literal (any bytes), str -> string literal, int / float / bool, list / tuple -> array, dict -> table (string keys @@ -123,12 +124,16 @@ def main(): if "--list" in sys.argv: print("\n".join(names)) return + mods = {name: load(os.path.join(GENERATORS, name + ".py")) for name in names} + names.sort(key=lambda n: bool(getattr(mods[n], "LAST", False))) for name in names: if args and not any(a in name for a in args): continue path = os.path.join(GENERATORS, name + ".py") - mod = load(path) + mod = mods[name] inputs = [path, os.path.abspath(__file__)] + [os.path.join(ROOT, p) for p in getattr(mod, "INPUTS", [])] + if getattr(mod, "LAST", False): + inputs += [os.path.join(stamps, n) for n in names if n != name and not getattr(mods[n], "LAST", False)] stamp = os.path.join(stamps, name) if not force and os.path.exists(stamp): outs = open(stamp).read().split("\n") diff --git a/tools/fixtures/detect.py b/tools/fixtures/detect.py new file mode 100644 index 0000000..a273701 --- /dev/null +++ b/tools/fixtures/detect.py @@ -0,0 +1,56 @@ +# Detection fixtures (tools/fixtures.py): samples of every other fixture module, for tests/detect.luau (lazy detection +# against the eager reference). Runs after the other generators (LAST) and reads their tests/gen output. +# tests/gen/detect_blobs_<1..4>.luau { { from = "", data = } }: up to PER_MODULE string literals of +# 16 bytes or more per module, evenly spaced, cut to CUT bytes, without repeats +import hashlib, os, re + +LAST = True +PER_MODULE = 6 +CUT = 16384 +PARTS = 4 +PART_BYTES = 5_000_000 +HEADER = "-- generated by tools/fixtures.py" +LITERAL = re.compile(rb'"([^"]*)"') +ESCAPE = re.compile(rb"\\x([0-9a-f]{2})") + + +def decode(raw): + return ESCAPE.sub(lambda m: bytes([int(m.group(1), 16)]), raw) + + +def generate(ctx): + names = sorted(f[:-5] for f in os.listdir(ctx.gen) if f.endswith(".luau") and not f.startswith("detect_")) + seen, blobs = set(), [] + for name in names: + with open(os.path.join(ctx.gen, name + ".luau"), "rb") as f: + text = f.read() + if not text.startswith(HEADER.encode()): + continue + lits = [m.span(1) for m in LITERAL.finditer(text) if m.end(1) - m.start(1) >= 16] + lits = [(a, b) for a, b in lits if len(decode(text[a:min(b, a + 64)])) >= 16] + if not lits: + continue + step = max(1, len(lits) / PER_MODULE) + picks = sorted({int(i * step) for i in range(PER_MODULE)} & set(range(len(lits)))) + for i in picks: + a, b = lits[i] + data = decode(text[a:min(b, a + CUT * 4)])[:CUT] + h = hashlib.sha1(data).digest() + if h in seen: + continue + seen.add(h) + blobs.append({"from": name, "data": data}) + parts, cur, size = [], [], 0 + for b in blobs: + if size + len(b["data"]) > PART_BYTES and cur: + parts.append(cur) + cur, size = [], 0 + cur.append(b) + size += len(b["data"]) + parts.append(cur) + if len(parts) > PARTS: + raise SystemExit("fixtures/detect: %d parts, raise PARTS (and the requires in tests/detect.luau)" % len(parts)) + while len(parts) < PARTS: + parts.append([]) + for i, p in enumerate(parts, 1): + ctx.emit("detect_blobs_%d" % i, p) diff --git a/tools/gen_registry.py b/tools/gen_registry.py index e7ec47e..6c1024b 100644 --- a/tools/gen_registry.py +++ b/tools/gen_registry.py @@ -3,6 +3,8 @@ # src/Rosetta///init.luau and writes # src/Rosetta/Registry.luau a static list (Roblox has no dynamic require): each format's contract metadata, copied # from its init.luau, and a load() that requires the module on first use +# src/Rosetta/Sniffs.luau each format's sniff, copied with what it reaches (tools/sniff_extract.py), so detection +# runs without requiring the format modules # docs/FORMATS.md the capability matrix, from each contract's caps # README.md the format table (read / write) and the codec + container list, between the markers # / and / @@ -11,6 +13,9 @@ # --check: exit 1 when any of them is out of date (tools/lint.sh runs this). import os, re, sys +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import sniff_extract + ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SRC = os.path.join(ROOT, "src", "Rosetta") CATEGORIES = ["image", "audio", "video", "model", "cad", "font", "archive", "data", "vector", "layered", "subtitle", @@ -50,6 +55,9 @@ def scan(): sys.exit("gen_registry: %s/%s/init.luau: missing contract fields %s" % (cat, fmt, ", ".join(missing))) c["path"] = cat + "/" + fmt c["folder_category"] = cat + text = open(init).read() + c["sniff_cost"], c["sniff_block"], self_name = sniff_extract.extract(text, c["path"]) + c["variant"] = sniff_extract.has_variant(text, self_name) formats.append(c) return formats @@ -60,6 +68,8 @@ def registry(formats): "-- Registry: GENERATED by tools/gen_registry.py from the format folders - do not edit.", "-- One entry per format: the contract metadata (copied from its init.luau) and load(), which requires the format", "-- module on first use (a static require, as Roblox needs). Order: category, then name.", + "-- sniff: where detection finds the format's sniff (tools/sniff_extract.py): 0 Sniffs.luau, 1 Sniffs.luau reaching a", + "-- codec / container on first call, 2 the format module. variant: the module has variant(r).", "export type Entry = {", "\tname: string,", "\tcategory: string,", @@ -68,6 +78,8 @@ def registry(formats): "\tmime: { string },", "\tdeps: { string },", "\tcaps: { [string]: any },", + "\tsniff: number,", + "\tvariant: boolean?,", "\tload: () -> any,", "}", "", @@ -83,6 +95,8 @@ def registry(formats): "\t\tmime = %s," % c["mime"], "\t\tdeps = %s," % c["deps"], "\t\tcaps = %s," % c["caps"], + "\t\tsniff = %d," % c["sniff_cost"], + ] + (["\t\tvariant = true,"] if c["variant"] else []) + [ "\t\tload = function()", '\t\t\treturn require("@rosetta/%s")' % c["path"], "\t\tend,", @@ -92,6 +106,38 @@ def registry(formats): return "\n".join(out) +def sniffs(formats): + out = [ + "--!strict", + "--!optimize 2", + "-- Sniffs: GENERATED by tools/gen_registry.py from the format folders - do not edit.", + "-- Each format's sniff (format path -> sniff(r)), copied from its init.luau with the top-level locals and types it", + "-- reaches (tools/sniff_extract.py), so detection requires no format module. Requires outside core/ are proxies that", + "-- require on first use. Formats whose sniff needs their module (Registry sniff = 2) are not here.", + "local S: { [string]: (any) -> number } = {}", + "", + "local function lazy(load: () -> any): any", + "\tlocal proxy = {}", + "\treturn setmetatable(proxy, {", + "\t\t__index = function(_, k: any): any", + "\t\t\tlocal m = load()", + "\t\t\tsetmetatable(proxy, { __index = m })", + "\t\t\treturn m[k]", + "\t\tend,", + "\t})", + "end", + "", + ] + for c in formats: + if c["sniff_block"] is None: + continue + out.append("do -- %s" % c["path"]) + out += c["sniff_block"] + out += ["end", ""] + out += ["return S", ""] + return "\n".join(out) + + def caps_dict(lit): """{ decode = true, depths = { 8 } } -> ordered [(key, text)] at the top level.""" body = lit.strip()[1:-1] @@ -220,6 +266,7 @@ def main(): readme_path = os.path.join(ROOT, "README.md") outputs = { os.path.join(SRC, "Registry.luau"): registry(formats), + os.path.join(SRC, "Sniffs.luau"): sniffs(formats), os.path.join(ROOT, "docs", "FORMATS.md"): formats_md(formats), readme_path: readme(formats, readme_path), } @@ -239,7 +286,7 @@ def main(): sys.exit(1) print("gen_registry: up to date (%d formats)" % len(formats)) else: - print("gen_registry: %d formats -> src/Rosetta/Registry.luau, docs/FORMATS.md, README.md%s" % ( + print("gen_registry: %d formats -> src/Rosetta/Registry.luau, Sniffs.luau, docs/FORMATS.md, README.md%s" % ( len(formats), "" if stale else " (unchanged)")) diff --git a/tools/lint_rules.py b/tools/lint_rules.py index 7027f61..fd998f5 100644 --- a/tools/lint_rules.py +++ b/tools/lint_rules.py @@ -9,7 +9,7 @@ # NATIVE native code never throws: a --!native module has no error( / assert( and requires no module that has # one; an @native function body has no error( / assert(. A format's init.luau is never --!native. # LAYERS requires go downward: core < Types < host; core, Types < codecs < containers < formats (/) -# < ops < api (init, Registry). core / codecs / containers / ops may require their own layer; a format +# < ops < api (init, Registry, Sniffs). core / codecs / containers / ops may require their own layer; a format # may require its own folder but never another format; only the api requires host. # codecs live in a domain folder: codecs// (CODEC_DOMAINS). # DEPS a format folder's requires outside itself are exactly the contract's deps = { ... }. @@ -19,7 +19,8 @@ # tests//.luau with a fuzz pass (:fuzz(). # DUP no copy-pasted code: a function body of DUP_LINES (12) or more code lines whose tokens (comments and # whitespace dropped, identifiers kept) equal another module's function body fails; move it down to a -# shared module (core / codecs / containers) and call it from both. +# shared module (core / codecs / containers) and call it from both. Sniffs.luau (generated copies of the +# formats' sniffs) is not compared. # DOCS docs/STYLE.md's layer block names every codec (codecs//), container and core module in the # tree; README.md's generated format table and codec list ( ... ) # match tools/gen_registry.py's output; README.md links every docs/guide page, docs/API.md and @@ -69,7 +70,7 @@ def resolve(target): def layer(mod): """(rank, group) of a module path""" top = mod.split("/")[0] if mod else "" - if mod in ("", "Registry"): + if mod in ("", "Registry", "Sniffs"): return 6, "api" if top == "core": return 0, "core" @@ -296,6 +297,8 @@ TOKEN = re.compile(r'"(?:[^"\\]|\\.)*"|\'(?:[^\'\\]|\\.)*\'|\[=*\[.*?\]=*\]|[A-Z FUNC = re.compile(r"^(\s*)(?:local\s+)?function\b") bodies = {} for f, lines in text.items(): + if mods[f] == "Sniffs": + continue for i, line in enumerate(lines): m = FUNC.match(line) if not m: diff --git a/tools/sniff_extract.py b/tools/sniff_extract.py new file mode 100644 index 0000000..414ff58 --- /dev/null +++ b/tools/sniff_extract.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 +# Sniff extraction for tools/gen_registry.py: copies each format's sniff function out of its init.luau, with the +# top-level locals, types and statements it reaches, so src/Rosetta/Sniffs.luau can sniff without requiring the +# format module. A format whose sniff reaches its own module table (or a forward-declared local) is not copied: the api +# loads the module to sniff it. Requires the copy reaches: core/* as they are; any other module through a proxy that +# requires it on first field access (sniff time). +# cost 0: the copy needs only core/*; 1: it reaches a proxied module; 2: not copied (the module sniffs). +import re + +KEYWORDS = set("and break continue do else elseif end false for function if in local nil not or repeat return then " + "true until while type export typeof".split()) +NAME = r"[A-Za-z_]\w*" + + +def clean(text): + """text with string, comment and long-bracket contents blanked (newlines kept), same length""" + out, i, n = [], 0, len(text) + while i < n: + c = text[i] + if c == "-" and text.startswith("--", i): + m = re.match(r"--\[(=*)\[", text[i:]) + if m: + j = text.find("]" + m.group(1) + "]", i + len(m.group(0))) + j = n if j < 0 else j + len(m.group(1)) + 2 + else: + j = text.find("\n", i) + j = n if j < 0 else j + out.append(re.sub(r"[^\n]", " ", text[i:j])) + i = j + elif c == "[" and re.match(r"\[(=*)\[", text[i:]): + m = re.match(r"\[(=*)\[", text[i:]) + j = text.find("]" + m.group(1) + "]", i + len(m.group(0))) + j = n if j < 0 else j + len(m.group(1)) + 2 + out.append('"' + re.sub(r"[^\n]", " ", text[i + 1:j - 1]) + '"') + i = j + elif c in "\"'": + j = i + 1 + while j < n and text[j] != c and text[j] != "\n": + j += 2 if text[j] == "\\" else 1 + j = min(j + 1, n) + out.append(c + " " * (j - i - 2) + c if j - i >= 2 else text[i:j]) + i = j + else: + out.append(c) + i += 1 + return "".join(out) + + +def split_top(s): + """split s on commas outside brackets""" + parts, depth, cur = [], 0, "" + for ch in s: + if ch in "({[<": + depth += 1 + elif ch in ")}]>": + depth -= 1 + if ch == "," and depth == 0: + parts.append(cur) + cur = "" + else: + cur += ch + parts.append(cur) + return parts + + +def statements(text): + """[(first line, last line, cleaned text)] of the top-level statements (0-based inclusive line numbers)""" + lines = text.split("\n") + cl = clean(text).split("\n") + starts = [i for i, l in enumerate(cl) if l[:1] not in ("", " ", "\t") and not re.match(r"(end|until)\b|[}\])]", l)] + out = [] + for k, s in enumerate(starts): + e = (starts[k + 1] if k + 1 < len(starts) else len(lines)) - 1 + while e > s and cl[e].strip() == "": + e -= 1 + out.append((s, e, "\n".join(cl[s:e + 1]))) + return out + + +def free_names(code): + """identifiers read by code that are not field / method names (an over-approximation: locals are included)""" + return {m.group(1) for m in re.finditer(r"(?"): + cut = i + break + head = rest if cut is None else rest[:cut] + names = [p.split(":")[0].strip() for p in split_top(head.split("\n")[0] if cut is None else head)] + return [n for n in names if re.fullmatch(NAME, n)], ("forward" if cut is None else "local") + return [], None + + +REQUIRE = re.compile(r'^local\s+(' + NAME + r')\s*=\s*require\("@rosetta/([\w/]+)"\)\s*$') + + +def extract(text, path): + """(cost, block lines or None, module table name) for one format's init.luau""" + lines = text.split("\n") + sts = statements(text) + sniff_i, self_name = None, None + for i, (s, e, st) in enumerate(sts): + m = re.match(r"function\s+(" + NAME + r")\.sniff\s*\(", st) + if m: + sniff_i, self_name = i, m.group(1) + if sniff_i is None: + return 2, None, None + defs = [] # (statement index, name, kind) + for i, (s, e, st) in enumerate(sts): + names, kind = defines(st) + for n in names: + defs.append((i, n, kind)) + def_names = {n for _, n, _ in defs} + # top-level statements that are not declarations: assignments, loops (a table filled at load time) + others = [i for i, (s, e, st) in enumerate(sts) if defines(st)[1] is None and i != sniff_i] + + def resolve(name, before): + best = None + for i, n, kind in defs: + if n == name and i < before: + best = (i, kind) + return best + + include, lazy, todo, bad = set(), {}, [sniff_i], False + reached = set() + while todo: + i = todo.pop() + if i in include: + continue + include.add(i) + st = sts[i][2] + body = st + if i == sniff_i: + body = st[st.index("("):] + for n in free_names(body): + if n == self_name: + bad = True + continue + r = resolve(n, i) + if r is None: + continue + j, kind = r + if kind == "forward": + bad = True + continue + reached.add(n) + req = REQUIRE.match(lines[sts[j][0]]) if sts[j][0] == sts[j][1] else None + if req and not req.group(2).startswith("core/"): + lazy[j] = (req.group(1), req.group(2)) + continue + todo.append(j) + # load-time statements that touch a reached local (a lookup table filled by a loop) + for k in others: + if k not in include and re.match(r"(function\s+)?" + re.escape(self_name) + r"\b|return\b", sts[k][2]) is None: + if free_names(sts[k][2]) & reached: + todo.append(k) + if bad: + return 2, None, self_name + # a non-function statement that reads a proxied module runs at load time: the proxy would load it at once + for i in include: + if i != sniff_i and defines(sts[i][2])[1] not in ("func", "type"): + if free_names(sts[i][2]) & {a for a, _ in lazy.values()}: + return 2, None, self_name + block = [] + for i in sorted(set(include) | set(lazy)): + s, e, st = sts[i] + if i in lazy: + alias, mod = lazy[i] + block.append('local %s = lazy(function()\n\treturn require("@rosetta/%s")\nend)' % (alias, mod)) + elif i == sniff_i: + src = "\n".join(lines[s:e + 1]) + src = re.sub(r"^function\s+" + re.escape(self_name) + r"\.sniff\s*\(", 'S["%s"] = function(' % path, src) + block.append(src) + else: + src = "\n".join(lines[s:e + 1]) + block.append(re.sub(r"^export\s+type\b", "type", src)) + return (1 if lazy else 0), block, self_name + + +def has_variant(text, self_name): + return self_name is not None and re.search(r"^function\s+" + re.escape(self_name) + r"\.variant\s*\(", text, re.M) is not None