taglib-wasm
Version:
TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps
28 lines • 1.6 kB
TypeScript
/**
* @fileoverview EBU Tech 3285 BWF `bext` chunk codec. Pure functions — no Wasm
* or TagLib dependency. The fixed prefix is 602 bytes for all versions; the
* `version` field selects which optional fields are meaningful (0 = none,
* 1 = UMID, 2 = UMID + loudness). Fixed-width string fields are NUL-padded
* ASCII; `codingHistory` is exposed verbatim (the spec uses CR/LF lines) and
* is not promised to preserve embedded NUL bytes. Loudness fields use the EBU
* "value not set" sentinel `0x7FFF`: a sentinel decodes to `undefined`, and an
* `undefined` loudness field on a v2 encode is written as the sentinel.
*/
import type { BroadcastAudioExtension } from "../types/bwf.js";
/**
* Parse a raw `bext` chunk. Returns `undefined` only if `bytes` is shorter than
* 348 (cannot even read the `Version` field). Optional fields are populated per
* the chunk's declared version and the available length, so compact/legacy v0
* chunks parse into a partial struct.
*/
export declare function decodeBext(bytes: Uint8Array): BroadcastAudioExtension | undefined;
/**
* Serialize a `bext` chunk. The result is always `602 + codingHistory.length`
* bytes. `version` defaults to 2 when any loudness field is present (else 1 if
* `umid` is set, else 0). Over-long string fields are truncated to their widths;
* loudness values are clamped to the Int16 range after ×100, with `undefined`
* written as the EBU `0x7FFF` "not set" sentinel; UMID is written only for
* version ≥ 1.
*/
export declare function encodeBext(b: BroadcastAudioExtension): Uint8Array;
//# sourceMappingURL=bext.d.ts.map