@svta/cml-iso-bmff 1.0.0-alpha.3 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +300 -183
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +165 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CONTAINERS: string[]","size","type","view: ArrayBufferView | null","value: number","s1: number","s2: number","result: any","result: T[]","queue: [Iterable<ParsedBox>, number][]","readUint","readTemplate","readUint","readTemplate","readInt","readUint","readString","readData","readUint","readTemplate","kidCount: number","kid: number[]","readUint","readUint","dataOffset: number | undefined","firstSampleFlags: number | undefined","sample: TrackRunSample","contentSize: number"],"sources":["../src/utils/createWriterConfig.ts","../src/utils/CONTAINERS.ts","../src/utils/isContainer.ts","../src/fields/TEMPLATE.ts","../src/fields/UINT.ts","../src/IsoBoxWriteView.ts","../src/utils/writeBoxes.ts","../src/utils/writeChildBoxes.ts","../src/utils/writeContainerBox.ts","../src/utils/writeBox.ts","../src/writeIsoBox.ts","../src/IsoBoxReadableStream.ts","../src/createIsoBoxReadableStream.ts","../src/fields/DATA.ts","../src/fields/INT.ts","../src/fields/STRING.ts","../src/fields/UTF8.ts","../src/utils/readData.ts","../src/utils/readInt.ts","../src/utils/readUint.ts","../src/utils/readString.ts","../src/utils/readTemplate.ts","../src/utils/readTerminatedString.ts","../src/utils/readUtf8String.ts","../src/utils/readUtf8TerminatedString.ts","../src/IsoBoxReadView.ts","../src/readIsoBoxes.ts","../src/traverseIsoBoxes.ts","../src/writeIsoBoxes.ts","../src/readers/readArdi.ts","../src/readers/readAudioSampleEntryBox.ts","../src/readers/readVisualSampleEntryBox.ts","../src/readers/readAvc1.ts","../src/readers/readAvc2.ts","../src/readers/readAvc3.ts","../src/readers/readAvc4.ts","../src/readers/readCtts.ts","../src/readers/readDref.ts","../src/readers/readElng.ts","../src/readers/readElst.ts","../src/readers/readEmsg.ts","../src/readers/readEnca.ts","../src/readers/readEncv.ts","../src/readers/readFree.ts","../src/readers/readFrma.ts","../src/readers/readFtyp.ts","../src/readers/readHdlr.ts","../src/readers/readHev1.ts","../src/readers/readHvc1.ts","../src/readers/readIden.ts","../src/readers/readImda.ts","../src/readers/readKind.ts","../src/readers/readLabl.ts","../src/readers/readMdat.ts","../src/readers/readMdhd.ts","../src/readers/readMehd.ts","../src/readers/readMeta.ts","../src/readers/readMfhd.ts","../src/readers/readMfro.ts","../src/readers/readMp4a.ts","../src/readers/readMvhd.ts","../src/readers/readPayl.ts","../src/readers/readPrft.ts","../src/readers/readPrsl.ts","../src/readers/readPssh.ts","../src/readers/readSchm.ts","../src/readers/readSdtp.ts","../src/readers/readSidx.ts","../src/readers/readSkip.ts","../src/readers/readSmhd.ts","../src/readers/readSsix.ts","../src/readers/readSthd.ts","../src/readers/readStsd.ts","../src/readers/readStss.ts","../src/readers/readSttg.ts","../src/readers/readStts.ts","../src/readers/readStyp.ts","../src/readers/readSubs.ts","../src/readers/readTenc.ts","../src/readers/readTfdt.ts","../src/readers/readTfhd.ts","../src/readers/readTfra.ts","../src/readers/readTkhd.ts","../src/readers/readTrex.ts","../src/readers/readTrun.ts","../src/readers/readUrl.ts","../src/readers/readUrn.ts","../src/readers/readVlab.ts","../src/readers/readVmhd.ts","../src/readers/readVttC.ts","../src/readers/readVtte.ts","../src/utils/isFullBox.ts","../src/writers/writeArdi.ts","../src/writers/writeAudioSampleEntryBox.ts","../src/writers/writeVisualSampleEntryBox.ts","../src/writers/writeAvc1.ts","../src/writers/writeAvc2.ts","../src/writers/writeAvc3.ts","../src/writers/writeAvc4.ts","../src/writers/writeCtts.ts","../src/writers/writeDref.ts","../src/writers/writeElng.ts","../src/writers/writeElst.ts","../src/writers/writeEmsg.ts","../src/writers/writeEnca.ts","../src/writers/writeEncv.ts","../src/writers/writeFree.ts","../src/writers/writeFrma.ts","../src/writers/writeFtyp.ts","../src/writers/writeHdlr.ts","../src/writers/writeHev1.ts","../src/writers/writeHvc1.ts","../src/writers/writeIden.ts","../src/writers/writeImda.ts","../src/writers/writeKind.ts","../src/writers/writeLabl.ts","../src/writers/writeMdat.ts","../src/writers/writeMdhd.ts","../src/writers/writeMehd.ts","../src/writers/writeMeta.ts","../src/writers/writeMfhd.ts","../src/writers/writeMfro.ts","../src/writers/writeMp4a.ts","../src/writers/writeMvhd.ts","../src/writers/writePayl.ts","../src/writers/writePrft.ts","../src/writers/writePrsl.ts","../src/writers/writePssh.ts","../src/writers/writeSchm.ts","../src/writers/writeSdtp.ts","../src/writers/writeSidx.ts","../src/writers/writeSkip.ts","../src/writers/writeSmhd.ts","../src/writers/writeSsix.ts","../src/writers/writeSthd.ts","../src/writers/writeStsd.ts","../src/writers/writeStss.ts","../src/writers/writeSttg.ts","../src/writers/writeStts.ts","../src/writers/writeStyp.ts","../src/writers/writeSubs.ts","../src/writers/writeTenc.ts","../src/writers/writeTfdt.ts","../src/writers/writeTfhd.ts","../src/writers/writeTfra.ts","../src/writers/writeTkhd.ts","../src/writers/writeTrex.ts","../src/writers/writeTrun.ts","../src/writers/writeUrl.ts","../src/writers/writeUrn.ts","../src/writers/writeVlab.ts","../src/writers/writeVmhd.ts","../src/writers/writeVttC.ts","../src/writers/writeVtte.ts"],"sourcesContent":["import type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\n\nexport function createWriterConfig(config?: Partial<IsoBoxWriteViewConfig>): Required<IsoBoxWriteViewConfig> {\n\treturn {\n\t\twriters: config?.writers ?? {},\n\t}\n}\n","/**\n * List of container box types\n *\n * @public\n */\nexport const CONTAINERS: string[] = [\n\t'dinf',\n\t'edts',\n\t'grpl',\n\t'mdia',\n\t'meco',\n\t'mfra',\n\t'minf',\n\t'moof',\n\t'moov',\n\t'mvex',\n\t'schi',\n\t'sinf',\n\t'stbl',\n\t'strk',\n\t'traf',\n\t'trak',\n\t'tref',\n\t'udta',\n\t'vttc',\n]\n","import type { Box } from '../boxes/Box.ts'\nimport type { IsoBox } from '../IsoBox.ts'\nimport type { IsoBoxContainer } from '../IsoBoxContainer.ts'\nimport { CONTAINERS } from './CONTAINERS.ts'\n\n/**\n * Check if a box is a container\n *\n * @param box - The box to check\n *\n * @returns `true` if the box is a container, `false` otherwise\n *\n * @public\n */\nexport function isContainer(box: IsoBox | Box): box is IsoBoxContainer {\n\treturn 'boxes' in box || CONTAINERS.includes(box.type)\n}\n","/**\n * The template field type\n *\n * @public\n */\nexport const TEMPLATE = 'template'\n","/**\n * The unsigned integer field type\n *\n * @public\n */\nexport const UINT = 'uint'\n","import { encodeText } from '@svta/cml-utils'\nimport { TEMPLATE } from './fields/TEMPLATE.ts'\nimport { UINT } from './fields/UINT.ts'\nimport type { IsoFieldTypeMap } from './IsoFieldTypeMap.ts'\n\n/**\n * A view for writing ISO BMFF data.\n *\n * @public\n */\nexport class IsoBoxWriteView {\n\tprivate dataView: DataView<ArrayBuffer>\n\tprivate cursor: number\n\n\t/**\n\t * Constructs a new IsoBoxWriteView.\n\t *\n\t * @param size - The size of the data view.\n\t */\n\tconstructor(type: string, size: number) {\n\t\tthis.dataView = new DataView(new ArrayBuffer(size))\n\t\tthis.cursor = 0\n\t\tthis.writeBoxHeader(type, size)\n\t}\n\n\t/**\n\t * The buffer of the data view.\n\t *\n\t * @returns The buffer of the data view.\n\t */\n\tget buffer(): ArrayBuffer {\n\t\treturn this.dataView.buffer\n\t}\n\n\t/**\n\t * The length of the data view.\n\t *\n\t * @returns The length of the data view.\n\t */\n\tget byteLength(): number {\n\t\treturn this.dataView.byteLength\n\t}\n\n\t/**\n\t * The offset of the data view.\n\t *\n\t * @returns The offset of the data view.\n\t */\n\tget byteOffset(): number {\n\t\treturn this.dataView.byteOffset\n\t}\n\n\t/**\n\t * Writes a uint to the data view.\n\t *\n\t * @param value - The value to write.\n\t * @param size - The size, in bytes, of the value.\n\t */\n\twriteUint = (value: number, size: number): void => {\n\t\tconst { dataView, cursor } = this\n\n\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdataView.setUint8(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 2:\n\t\t\t\tdataView.setUint16(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 3: {\n\t\t\t\tconst s1 = (value & 0xFFFF00) >> 8\n\t\t\t\tconst s2 = (value & 0x0000FF)\n\t\t\t\tdataView.setUint16(cursor, s1)\n\t\t\t\tdataView.setUint8(cursor + 2, s2)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcase 4:\n\t\t\t\tdataView.setUint32(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 8: {\n\t\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\t\tconst s1 = Math.floor(value / Math.pow(2, 32))\n\t\t\t\tconst s2 = value - (s1 * Math.pow(2, 32))\n\t\t\t\tdataView.setUint32(cursor, s1)\n\t\t\t\tdataView.setUint32(cursor + 4, s2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tthis.cursor += size\n\t}\n\n\t/**\n\t * Writes an int to the data view.\n\t *\n\t * @param value - The value to write.\n\t * @param size - The size, in bytes, of the value.\n\t */\n\twriteInt = (value: number, size: number): void => {\n\t\tconst { dataView, cursor } = this\n\n\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdataView.setInt8(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 2:\n\t\t\t\tdataView.setInt16(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 4:\n\t\t\t\tdataView.setInt32(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 8:\n\t\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\t\tconst s1 = Math.floor(value / Math.pow(2, 32))\n\t\t\t\tconst s2 = value - (s1 * Math.pow(2, 32))\n\t\t\t\tdataView.setUint32(cursor, s1)\n\t\t\t\tdataView.setUint32(cursor + 4, s2)\n\t\t\t\tbreak\n\t\t}\n\n\t\tthis.cursor += size\n\t}\n\n\t/**\n\t * Writes a string to the data view.\n\t *\n\t * @param value - The value to write.\n\t */\n\twriteString = (value: string): void => {\n\t\tfor (let c = 0, len = value.length; c < len; c++) {\n\t\t\tthis.writeUint(value.charCodeAt(c), 1)\n\t\t}\n\t}\n\n\t/**\n\t * Writes a null terminated string to the data view.\n\t *\n\t * @param value - The value to write.\n\t */\n\twriteTerminatedString = (value: string): void => {\n\t\tif (value.length === 0) {\n\t\t\treturn\n\t\t}\n\n\t\tfor (let c = 0, len = value.length; c < len; c++) {\n\t\t\tthis.writeUint(value.charCodeAt(c), 1)\n\t\t}\n\n\t\tthis.writeUint(0, 1)\n\t}\n\n\t/**\n\t * Writes a UTF-8 null terminated string to the data view.\n\t *\n\t * @param value - The value to write.\n\t */\n\twriteUtf8TerminatedString = (value: string): void => {\n\t\tconst bytes = encodeText(value)\n\t\tconst uint8View = new Uint8Array(this.dataView.buffer)\n\t\tuint8View.set(bytes, this.cursor)\n\t\tthis.cursor += bytes.length\n\t\tthis.writeUint(0, 1) // null terminator\n\t}\n\n\t/**\n\t * Writes a Uint8Array to the data view.\n\t *\n\t * @param data - The data to write.\n\t */\n\twriteBytes = (data: Uint8Array | Uint8Array[]): void => {\n\t\tif (!Array.isArray(data)) {\n\t\t\tdata = [data]\n\t\t}\n\n\t\tfor (const bytes of data) {\n\t\t\tconst uint8View = new Uint8Array(this.dataView.buffer)\n\t\t\tuint8View.set(bytes, this.cursor)\n\t\t\tthis.cursor += bytes.length\n\t\t}\n\t}\n\n\t/**\n\t * Writes an array of numbers to the data view.\n\t *\n\t * @param data - The data to write.\n\t * @param type - The type of the data.\n\t * @param size - The size, in bytes, of each data value.\n\t * @param length - The number of values to write. (optional)\n\t */\n\twriteArray = <T extends keyof IsoFieldTypeMap>(data: number[], type: T, size: number, length: number): void => {\n\t\tconst write = type === UINT ? this.writeUint : type === TEMPLATE ? this.writeTemplate : this.writeInt\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\twrite(data[i] ?? 0, size)\n\t\t}\n\t}\n\n\t/**\n\t * Writes a template to the data view.\n\t *\n\t * @param value - The value to write.\n\t * @param size - The size, in bytes, of the template.\n\t */\n\twriteTemplate = (value: number, size: number): void => {\n\t\tconst shift = size === 4 ? 16 : 8\n\t\tconst fixedPoint = Math.round(value * Math.pow(2, shift))\n\t\tthis.writeUint(fixedPoint, size)\n\t}\n\n\t/**\n\t * Writes a box header to the data view.\n\t *\n\t * @param type - The type of the box.\n\t * @param size - The size, in bytes, of the box.\n\t */\n\twriteBoxHeader = (type: string, size: number): void => {\n\t\tconst isLarge = size > 0xffffffff\n\t\tif (isLarge) {\n\t\t\tthis.writeUint(1, 4) // size = 1 indicates largesize follows\n\t\t\tthis.writeString(type)\n\t\t\tthis.writeUint(size, 8)\n\t\t} else {\n\t\t\tthis.writeUint(size, 4)\n\t\t\tthis.writeString(type)\n\t\t}\n\t}\n\n\t// writeBoxHeader(type: string, extendedType?: number[]): void {\n\t// \tconst { size } = box\n\t// \tconst isLarge = size > 0xffffffff\n\t// \tconst isExtended = box.type === 'uuid' && extendedType\n\t// \tlet boxSize = size\n\n\t// \tif (isLarge) {\n\t// \t\tboxSize += 8\n\t// \t}\n\n\t// \tif (isExtended) {\n\t// \t\tboxSize += 16\n\t// \t}\n\t// \tthis.writeUint(isLarge ? 1 : boxSize, 4)\n\t// \tthis.writeString(box.type)\n\n\t// \tif (isLarge) {\n\t// \t\tthis.writeUint(boxSize, 8)\n\t// \t}\n\n\t// \tif (isExtended) {\n\t// \t\tthis.writeArray(extendedType, UINT, 1)\n\t// \t}\n\t// }\n\n\t/**\n\t * Writes a full box header to the data view.\n\t *\n\t * @param version - The version of the full box.\n\t * @param flags - The flags of the full box.\n\t */\n\twriteFullBox(version: number, flags: number): void {\n\t\tthis.writeUint(version, 1)\n\t\tthis.writeUint(flags, 3)\n\t}\n}\n","import type { IsoBoxStreamable } from '../IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeBox } from './writeBox.ts'\n\n/**\n * Write boxes to an array of Uint8Arrays.\n *\n * @param boxes - The boxes to write\n * @param config - The configuration for the writer\n *\n * @returns The written boxes\n *\n * @internal\n */\nexport function writeBoxes(boxes: Iterable<IsoBoxStreamable>, config: IsoBoxWriteViewConfig): Uint8Array[] {\n\treturn Array.from(boxes, box => writeBox(box, config))\n}\n","import type { IsoBox } from '../IsoBox.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeBoxes } from './writeBoxes.ts'\n\n/**\n * Write child boxes\n *\n * @param boxes - The boxes to write\n * @param config - The configuration for the writer\n *\n * @returns The byte arrays and total size of the written boxes\n *\n * @internal\n */\nexport function writeChildBoxes(boxes: IsoBox[], config: IsoBoxWriteViewConfig): { bytes: Uint8Array[], size: number } {\n\tconst bytes = writeBoxes(boxes, config)\n\tconst size = bytes.reduce((size, byte) => size + byte.byteLength, 0)\n\n\treturn {\n\t\tbytes,\n\t\tsize,\n\t}\n}\n","import type { IsoBoxContainer } from '../IsoBoxContainer.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a ContainerBox to an IsoBmffWriter.\n *\n * This function writes a container box with its child boxes. Child boxes are\n * extracted from the container box's `boxes` array and encoded using their `view` property.\n *\n * @param box - The ContainerBox to write\n *\n * @returns An IsoBmffWriter containing the encoded box\n *\n * @internal\n */\nexport function writeContainerBox<T extends IsoBoxContainer>(\n\tbox: T,\n\tconfig: IsoBoxWriteViewConfig\n): IsoBoxWriteView {\n\tconst headerSize = 8\n\t// TODO: Is there a way to avoid creating the intermediate Uint8Arrays?\n\tconst { bytes, size } = writeChildBoxes(box.boxes as any, config)\n\n\tconst totalSize = headerSize + size\n\n\tconst writer = new IsoBoxWriteView(box.type, totalSize)\n\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { IsoBox } from '../IsoBox.ts'\nimport type { IsoBoxStreamable } from '../IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { isContainer } from '../utils/isContainer.ts'\nimport { writeContainerBox } from './writeContainerBox.ts'\n\n/**\n * Write a box to a Uint8Array.\n *\n * @param box - The box to write\n * @param writers - The writers to use\n * @returns The written box\n *\n * @internal\n */\nexport function writeBox(box: IsoBoxStreamable, config: IsoBoxWriteViewConfig): Uint8Array {\n\tlet view: ArrayBufferView | null = null\n\n\tif ('type' in box) {\n\t\tconst { type } = box\n\t\tconst writer = config.writers?.[type as IsoBox['type']]\n\n\t\tif (writer) {\n\t\t\t// TODO: Find a better way to do this without casting to any\n\t\t\tview = writer(box as any, config)\n\t\t}\n\t\telse if (isContainer(box)) {\n\t\t\tview = writeContainerBox(box, config)\n\t\t}\n\t\telse if ('view' in box) {\n\t\t\tview = box.view\n\t\t}\n\n\t\tif (!view) {\n\t\t\tthrow new Error(`No writer found for box type: ${type}`)\n\t\t}\n\t}\n\n\tif ('buffer' in box) {\n\t\tview = box\n\t}\n\n\tif (!view) {\n\t\tthrow new Error('Invalid box')\n\t}\n\n\treturn new Uint8Array(view.buffer, view.byteOffset, view.byteLength)\n}\n","import type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\nimport { createWriterConfig } from './utils/createWriterConfig.ts'\nimport { writeBox } from './utils/writeBox.ts'\n\n/**\n * Write an ISO box to a Uint8Array.\n *\n * @param box - The box to write\n * @param config - The configuration for the writer\n *\n * @returns The written box\n *\n * @public\n */\nexport function writeIsoBox(box: IsoBoxStreamable, config?: IsoBoxWriteViewConfig): Uint8Array {\n\treturn writeBox(box, createWriterConfig(config))\n}\n","import type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\nimport { createWriterConfig } from './utils/createWriterConfig.ts'\nimport { writeIsoBox } from './writeIsoBox.ts'\n\n/**\n * A readable stream of ISO BMFF boxes as Uint8Arrays.\n *\n * @public\n */\nexport class IsoBoxReadableStream extends ReadableStream<Uint8Array> {\n\t/**\n\t * Constructs a new IsoBoxReadableStream.\n\t *\n\t * @param boxes - The boxes to stream.\n\t * @param config - The configuration for the stream.\n\t */\n\tconstructor(boxes: Iterable<IsoBoxStreamable>, config: IsoBoxWriteViewConfig = {}) {\n\t\tconst iterator = boxes[Symbol.iterator]()\n\t\tconst cfg = createWriterConfig(config)\n\n\t\tfunction pull(controller: ReadableStreamDefaultController<Uint8Array>) {\n\t\t\tconst desiredSize = controller.desiredSize ?? 0\n\n\t\t\tfor (let i = 0; i < desiredSize; i++) {\n\t\t\t\tconst { value, done } = iterator.next()\n\n\t\t\t\tif (done) {\n\t\t\t\t\tcontroller.close()\n\t\t\t\t} else {\n\t\t\t\t\tcontroller.enqueue(writeIsoBox(value, cfg))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper({ start: pull, pull })\n\t}\n}\n","import { IsoBoxReadableStream } from './IsoBoxReadableStream.ts'\nimport type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\n\n/**\n * Creates a ReadableStream of ISO BMFF boxes as Uint8Arrays.\n *\n * @param boxes - The boxes to stream.\n * @param config - The configuration for the stream.\n *\n * @returns A new IsoBoxReadableStream.\n *\n * @example\n * {@includeCode ../test/createIsoBoxReadableStream.test.ts#example}\n *\n * @public\n */\nexport function createIsoBoxReadableStream(boxes: Iterable<IsoBoxStreamable>, config: IsoBoxWriteViewConfig = {}): ReadableStream<Uint8Array> {\n\treturn new IsoBoxReadableStream(boxes, config)\n}\n","/**\n * The data field type\n *\n * @public\n */\nexport const DATA = 'data'\n","/**\n * The integer field type\n *\n * @public\n */\nexport const INT = 'int'\n","/**\n * The string field type\n *\n * @public\n */\nexport const STRING = 'string'\n","/**\n * The UTF8 field type\n *\n * @public\n */\nexport const UTF8 = 'utf8'\n","export function readData(dataView: DataView, offset: number, size: number): Uint8Array {\n\tconst length = (size > 0) ? size : (dataView.byteLength - (offset - dataView.byteOffset))\n\treturn new Uint8Array(dataView.buffer, offset, Math.max(length, 0))\n};\n","export function readInt(dataView: DataView, offset: number, size: number): number {\n\tlet result = NaN\n\tconst cursor = offset - dataView.byteOffset\n\n\tswitch (size) {\n\t\tcase 1:\n\t\t\tresult = dataView.getInt8(cursor)\n\t\t\tbreak\n\n\t\tcase 2:\n\t\t\tresult = dataView.getInt16(cursor)\n\t\t\tbreak\n\n\t\tcase 4:\n\t\t\tresult = dataView.getInt32(cursor)\n\t\t\tbreak\n\n\t\tcase 8:\n\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\tconst s1 = dataView.getInt32(cursor)\n\t\t\tconst s2 = dataView.getInt32(cursor + 4)\n\t\t\tresult = (s1 * Math.pow(2, 32)) + s2\n\t\t\tbreak\n\t}\n\n\treturn result\n};\n","export function readUint(dataView: DataView, offset: number, size: number): number {\n\tconst cursor = offset - dataView.byteOffset\n\n\tlet value: number = NaN\n\tlet s1: number\n\tlet s2: number\n\n\tswitch (size) {\n\t\tcase 1:\n\t\t\tvalue = dataView.getUint8(cursor)\n\t\t\tbreak\n\n\t\tcase 2:\n\t\t\tvalue = dataView.getUint16(cursor)\n\t\t\tbreak\n\n\t\tcase 3:\n\t\t\ts1 = dataView.getUint16(cursor)\n\t\t\ts2 = dataView.getUint8(cursor + 2)\n\t\t\tvalue = (s1 << 8) + s2\n\t\t\tbreak\n\n\t\tcase 4:\n\t\t\tvalue = dataView.getUint32(cursor)\n\t\t\tbreak\n\n\t\tcase 8:\n\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\ts1 = dataView.getUint32(cursor)\n\t\t\ts2 = dataView.getUint32(cursor + 4)\n\t\t\tvalue = (s1 * Math.pow(2, 32)) + s2\n\t\t\tbreak\n\t}\n\n\treturn value\n};\n","import { readUint } from './readUint.ts'\n\nexport function readString(dataView: DataView, offset: number, length: number): string {\n\tlet str = ''\n\n\tfor (let c = 0; c < length; c++) {\n\t\tconst cursor = offset + c\n\t\tconst char = readUint(dataView, cursor, 1)\n\t\tstr += String.fromCharCode(char)\n\t}\n\n\treturn str\n}\n","import { readUint } from './readUint.ts'\n\nexport function readTemplate(dataView: DataView, offset: number, size: number): number {\n\tconst half = size / 2\n\tconst pre = readUint(dataView, offset, half)\n\tconst post = readUint(dataView, offset + half, half)\n\treturn pre + (post / Math.pow(2, half))\n};\n","import { readUint } from './readUint.ts'\n\nexport function readTerminatedString(dataView: DataView, offset: number): string {\n\tlet str = ''\n\tlet cursor = offset\n\n\twhile (cursor - dataView.byteOffset < dataView.byteLength) {\n\t\tconst char = readUint(dataView, cursor, 1)\n\t\tif (char === 0) {\n\t\t\tbreak\n\t\t}\n\n\t\tstr += String.fromCharCode(char)\n\t\tcursor++\n\t}\n\n\treturn str\n};\n","import { decodeText, UTF_8 } from '@svta/cml-utils'\n\n/**\n * Reads a UTF-8 string from a data view.\n *\n * @param dataView - The data view to read from.\n * @param offset - The offset to start reading from.\n * @returns The UTF-8 string.\n *\n * @internal\n */\nexport function readUtf8String(dataView: DataView<ArrayBuffer>, offset: number): string {\n\tconst length = dataView.byteLength - (offset - dataView.byteOffset)\n\treturn (length > 0) ? decodeText(new DataView(dataView.buffer, offset, length), { encoding: UTF_8 }) : ''\n};\n","import { decodeText, UTF_8 } from '@svta/cml-utils'\n\n/**\n * Reads a UTF-8 terminated string from a data view.\n *\n * @param dataView - The data view to read from.\n * @param offset - The offset to start reading from.\n * @returns The UTF-8 terminated string.\n *\n * @internal\n */\nexport function readUtf8TerminatedString(dataView: DataView<ArrayBuffer>, offset: number): string {\n\tconst length = dataView.byteLength - (offset - dataView.byteOffset)\n\n\tlet data = ''\n\n\tif (length > 0) {\n\t\tconst view = new DataView(dataView.buffer, offset, length)\n\n\t\tlet l = 0\n\n\t\tfor (; l < length; l++) {\n\t\t\tif (view.getUint8(l) === 0) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// remap the Dataview with the actual length\n\t\tdata = decodeText(new DataView(dataView.buffer, offset, l), { encoding: UTF_8 })\n\t}\n\n\treturn data\n};\n","import type { Box } from './boxes/Box.ts'\nimport type { FullBox } from './boxes/FullBox.ts'\nimport { DATA } from './fields/DATA.ts'\nimport { INT } from './fields/INT.ts'\nimport { STRING } from './fields/STRING.ts'\nimport { TEMPLATE } from './fields/TEMPLATE.ts'\nimport { UINT } from './fields/UINT.ts'\nimport { UTF8 } from './fields/UTF8.ts'\nimport type { IsoBox } from './IsoBox.ts'\nimport type { IsoBoxData } from './IsoBoxData.ts'\nimport type { IsoBoxReaderMap } from './IsoBoxReaderMap.ts'\nimport type { IsoBoxReadViewConfig } from './IsoBoxReadViewConfig.ts'\nimport type { IsoFieldTypeMap } from './IsoFieldTypeMap.ts'\nimport type { ParsedBox } from './ParsedBox.ts'\nimport { isContainer } from './utils/isContainer.ts'\nimport { readData } from './utils/readData.ts'\nimport { readInt } from './utils/readInt.ts'\nimport { readString } from './utils/readString.ts'\nimport { readTemplate } from './utils/readTemplate.ts'\nimport { readTerminatedString } from './utils/readTerminatedString.ts'\nimport { readUint } from './utils/readUint.ts'\nimport { readUtf8String } from './utils/readUtf8String.ts'\nimport { readUtf8TerminatedString } from './utils/readUtf8TerminatedString.ts'\n\n/**\n * ISO BMFF data view. Similar to DataView, but with additional methods for reading ISO BMFF data.\n * It implements the iterator protocol, so it can be used in a for...of loop.\n *\n * @public\n */\nexport class IsoBoxReadView<R extends IsoBoxReaderMap = IsoBoxReaderMap> {\n\tprivate dataView: DataView<ArrayBuffer>\n\tprivate offset: number\n\tprivate config: IsoBoxReadViewConfig<R>\n\tprivate truncated: boolean = false\n\n\t/**\n\t * Creates a new IsoView instance. Similar to DataView, but with additional\n\t * methods for reading ISO BMFF data. It implements the iterator protocol,\n\t * so it can be used in a for...of loop.\n\t *\n\t * @param raw - The raw data to view.\n\t * @param config - The configuration for the IsoView.\n\t */\n\tconstructor(raw: IsoBoxData, config?: IsoBoxReadViewConfig<R>) {\n\t\tthis.dataView = (raw instanceof ArrayBuffer) ? new DataView<ArrayBuffer>(raw) : (raw instanceof DataView) ? raw : new DataView<ArrayBuffer>(raw.buffer, raw.byteOffset, raw.byteLength)\n\t\tthis.offset = this.dataView.byteOffset\n\t\tthis.config = config || { readers: {} as R }\n\t}\n\n\t/**\n\t * The buffer of the data view.\n\t */\n\tget buffer(): ArrayBuffer {\n\t\treturn this.dataView.buffer\n\t}\n\n\t/**\n\t * The byte offset of the data view.\n\t */\n\tget byteOffset(): number {\n\t\treturn this.dataView.byteOffset\n\t}\n\n\t/**\n\t * The byte length of the data view.\n\t */\n\tget byteLength(): number {\n\t\treturn this.dataView.byteLength\n\t}\n\n\t/**\n\t * The current byteoffset in the data view.\n\t */\n\tget cursor(): number {\n\t\treturn this.offset - this.dataView.byteOffset\n\t}\n\n\t/**\n\t * Whether the end of the data view has been reached.\n\t */\n\tget done(): boolean {\n\t\treturn this.cursor >= this.dataView.byteLength || this.truncated\n\t}\n\n\t/**\n\t * The number of bytes remaining in the data view.\n\t */\n\tget bytesRemaining(): number {\n\t\treturn this.dataView.byteLength - this.cursor\n\t}\n\n\t/**\n\t * Creates a new IsoView instance with a slice of the current data view.\n\t *\n\t * @param size - The size of the slice.\n\t * @returns A new IsoView instance.\n\t */\n\tslice = (offset: number, size: number): IsoBoxReadView<R> => {\n\t\tconst dataView = new DataView(this.dataView.buffer, offset, size)\n\t\tconst isoView = new IsoBoxReadView(dataView, this.config)\n\t\tconst headerSize = this.offset - offset\n\t\tconst bodySize = size - headerSize\n\n\t\tthis.offset += bodySize\n\t\tisoView.jump(headerSize)\n\n\t\treturn isoView\n\t}\n\n\tprivate read = <T extends keyof IsoFieldTypeMap>(type: T, size: number = 0): IsoFieldTypeMap[T] => {\n\t\t// TODO: Change all sizes from bits to bytes\n\t\tconst { dataView, offset } = this\n\n\t\tlet result: any\n\t\tlet cursor = size\n\n\t\tswitch (type) {\n\t\t\tcase UINT:\n\t\t\t\tresult = readUint(dataView, offset, size)\n\t\t\t\tbreak\n\n\t\t\tcase INT:\n\t\t\t\tresult = readInt(dataView, offset, size)\n\t\t\t\tbreak\n\n\t\t\tcase TEMPLATE:\n\t\t\t\tresult = readTemplate(dataView, offset, size)\n\t\t\t\tbreak\n\n\t\t\tcase STRING:\n\t\t\t\tif (size === -1) {\n\t\t\t\t\tresult = readTerminatedString(dataView, offset)\n\t\t\t\t\tcursor = result.length + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresult = readString(dataView, offset, size)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase DATA:\n\t\t\t\tresult = readData(dataView, offset, size)\n\t\t\t\tcursor = result.length\n\t\t\t\tbreak\n\n\t\t\tcase UTF8:\n\t\t\t\tif (size === -1) {\n\t\t\t\t\tresult = readUtf8TerminatedString(dataView, offset)\n\t\t\t\t\tcursor = result.length + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresult = readUtf8String(dataView, offset)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tresult = -1\n\t\t}\n\n\t\tthis.offset += cursor\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Reads a unsigned integer from the data view.\n\t *\n\t * @param size - The size of the integer in bytes.\n\t * @returns The unsigned integer.\n\t */\n\treadUint = (size: number): number => {\n\t\treturn this.read(UINT, size)\n\t}\n\n\t/**\n\t * Reads a signed integer from the data view.\n\t *\n\t * @param size - The size of the integer in bytes.\n\t * @returns The signed integer.\n\t */\n\treadInt = (size: number): number => {\n\t\treturn this.read(INT, size)\n\t}\n\n\t/**\n\t * Reads a string from the data view.\n\t *\n\t * @param size - The size of the string in bytes.\n\t * @returns The string.\n\t */\n\treadString = (size: number): string => {\n\t\treturn this.read(STRING, size)\n\t}\n\n\t/**\n\t * Reads a template from the data view.\n\t *\n\t * @param size - The size of the template in bytes.\n\t * @returns The template.\n\t */\n\treadTemplate = (size: number): number => {\n\t\treturn this.read(TEMPLATE, size)\n\t}\n\n\t/**\n\t * Reads a byte array from the data view.\n\t *\n\t * @param size - The size of the data in bytes.\n\t * @returns The data.\n\t */\n\treadData = (size: number): Uint8Array<ArrayBuffer> => {\n\t\treturn this.read(DATA, size)\n\t}\n\n\t/**\n\t * Reads a UTF-8 string from the data view.\n\t *\n\t * @param size - The size of the string in bytes.\n\t * @returns The UTF-8 string.\n\t */\n\treadUtf8 = (size?: number): string => {\n\t\treturn this.read(UTF8, size)\n\t}\n\n\t/**\n\t * Reads a full box from the data view.\n\t *\n\t * @returns The full box.\n\t */\n\treadFullBox = (): FullBox => {\n\t\treturn {\n\t\t\tversion: this.readUint(1),\n\t\t\tflags: this.readUint(3),\n\t\t}\n\t}\n\n\t/**\n\t * Reads an array of values from the data view.\n\t *\n\t * @param type - The type of the values.\n\t * @param size - The size of the values in bytes.\n\t * @param length - The number of values to read.\n\t * @returns The array of values.\n\t */\n\treadArray = <T extends keyof IsoFieldTypeMap>(type: T, size: number, length: number): IsoFieldTypeMap[T][] => {\n\t\tconst value = []\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tvalue.push(this.read(type, size))\n\t\t}\n\n\t\treturn value as IsoFieldTypeMap[T][]\n\t}\n\n\t/**\n\t * Skips a number of bytes in the view.\n\t *\n\t * @param size - The number of bytes to skip.\n\t */\n\tjump = (size: number): void => {\n\t\tthis.offset += size\n\t}\n\n\t/**\n\t * Reads a raw box from the data view.\n\t *\n\t * @returns The box.\n\t */\n\treadBox = (): Box => {\n\t\tconst { dataView, offset } = this\n\n\t\t// read box size and type without advancing the cursor in case the box is truncated\n\t\tlet cursor = 0\n\t\tconst size = readUint(dataView, offset, 4)\n\t\tconst type = readString(dataView, offset + 4, 4)\n\t\tconst box = { size, type } as Box\n\n\t\tcursor += 8\n\n\t\tif (box.size === 1) {\n\t\t\tbox.largesize = readUint(dataView, offset + cursor, 8)\n\t\t\tcursor += 8\n\t\t}\n\n\t\tconst actualSize = box.size === 0 ? this.bytesRemaining : box.largesize ?? box.size\n\t\tif (this.cursor + actualSize > dataView.byteLength) {\n\t\t\tthis.truncated = true\n\t\t\tthrow new Error('Truncated box')\n\t\t}\n\n\t\tthis.jump(cursor)\n\n\t\tif (type === 'uuid') {\n\t\t\tbox.usertype = this.readArray('uint', 1, 16)\n\t\t}\n\n\t\tbox.view = this.slice(offset, actualSize)\n\n\t\treturn box\n\t}\n\n\t/**\n\t * Reads a number of boxes from the data view.\n\t *\n\t * @param length - The number of boxes to read.\n\t * @returns The boxes.\n\t */\n\treadBoxes = <T = IsoBox>(length: number = -1): T[] => {\n\t\tconst result: T[] = []\n\n\t\tfor (const box of this) {\n\t\t\tresult.push(box as T)\n\n\t\t\tif (length > 0 && result.length >= length) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Reads a number of entries from the data view.\n\t *\n\t * @param length - The number of entries to read.\n\t * @param map - The function to map the entries.\n\t * @returns The entries.\n\t */\n\treadEntries = <T>(length: number, map: () => T): T[] => {\n\t\tconst result: T[] = []\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tresult.push(map())\n\t\t}\n\n\t\treturn result\n\t};\n\n\t/**\n\t * Iterates over the boxes in the data view.\n\t *\n\t * @returns A generator of boxes.\n\t */\n\t*[Symbol.iterator](): Generator<ParsedBox> {\n\t\tconst { readers = {} as R } = this.config\n\n\t\twhile (!this.done) {\n\t\t\ttry {\n\t\t\t\tconst box = this.readBox() as ParsedBox\n\t\t\t\tconst { type, view } = box\n\t\t\t\tconst parser = readers[type as keyof IsoBoxReaderMap] || readers[type.trim() as keyof IsoBoxReaderMap] // url and urn boxes have a trailing space in their type field\n\n\t\t\t\tif (parser) {\n\t\t\t\t\tObject.assign(box, parser(view))\n\t\t\t\t}\n\n\t\t\t\t// Some boxes, like meta, parse their child boxes themselves.\n\t\t\t\tif (isContainer(box) && !box.boxes) {\n\t\t\t\t\tconst boxes = []\n\n\t\t\t\t\tfor (const child of view) {\n\t\t\t\t\t\tboxes.push(child)\n\t\t\t\t\t}\n\n\t\t\t\t\tbox.boxes = boxes\n\t\t\t\t}\n\n\t\t\t\tyield box as IsoBox & Box\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\tif (error instanceof Error && error.message === 'Truncated box') {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { IsoBoxData } from './IsoBoxData.ts'\nimport type { IsoBoxReaderMap } from './IsoBoxReaderMap.ts'\nimport type { IsoBoxReaderReturn } from './IsoBoxReaderReturn.ts'\nimport { IsoBoxReadView } from './IsoBoxReadView.ts'\nimport type { IsoBoxReadViewConfig } from './IsoBoxReadViewConfig.ts'\n\n/**\n * Reads ISO boxes from a data source.\n *\n * @param raw - The raw ISO data\n * @param config - The configuration for the IsoView\n *\n * @returns The parsed boxes\n *\n * @example\n * {@includeCode ../test/readIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function readIsoBoxes<R extends IsoBoxReaderMap>(raw: IsoBoxData, config?: IsoBoxReadViewConfig<R>): IsoBoxReaderReturn<R>[] {\n\tconst boxes = []\n\n\tfor (const box of new IsoBoxReadView(raw, config)) {\n\t\tboxes.push(box)\n\t}\n\n\treturn boxes\n}\n","import type { ParsedBox } from './ParsedBox.ts'\nimport { isContainer } from './utils/isContainer.ts'\n\n/**\n * Traverse ISO boxes\n *\n * @param boxes - The boxes to traverse\n * @param depthFirst - Whether to traverse the boxes depth-first or breadth-first\n * @param maxDepth - The maximum depth to traverse. A value of 0 will only traverse the root boxes.\n *\n * @returns A generator of boxes\n *\n * @example\n * {@includeCode ../test/traverseIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function* traverseIsoBoxes(boxes: Iterable<ParsedBox>, depthFirst: boolean = true, maxDepth: number = Infinity): Generator<ParsedBox> {\n\tif (maxDepth < 0 || typeof maxDepth !== 'number' || Number.isNaN(maxDepth)) {\n\t\treturn\n\t}\n\n\tconst queue: [Iterable<ParsedBox>, number][] = [[boxes, 0]]\n\n\twhile (queue.length > 0) {\n\t\tconst item = queue.shift()\n\t\tif (!item) {\n\t\t\tcontinue\n\t\t}\n\t\tconst [children, depth] = item\n\n\t\tfor (const child of children) {\n\t\t\tyield child\n\n\t\t\tif (depth >= maxDepth) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (isContainer(child) && child.boxes) {\n\t\t\t\tconst next = child.boxes as ParsedBox[]\n\n\t\t\t\tif (depthFirst) {\n\t\t\t\t\tyield* traverseIsoBoxes(next, depthFirst, maxDepth - 1)\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tqueue.push([next, depth + 1])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\nimport { createWriterConfig } from './utils/createWriterConfig.ts'\nimport { writeBoxes } from './utils/writeBoxes.ts'\n\n/**\n * Writes ISO boxes to a readable stream.\n *\n * @param boxes - The boxes to write\n * @param config - The configuration for the readable stream\n *\n * @returns A readable stream of the written boxes\n *\n * @example\n * {@includeCode ../test/writeIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function writeIsoBoxes(boxes: Iterable<IsoBoxStreamable>, config?: IsoBoxWriteViewConfig): Uint8Array[] {\n\treturn writeBoxes(boxes, createWriterConfig(config))\n}\n","import type { AudioRenderingIndicationBox } from '../boxes/AudioRenderingIndicationBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a AudioRenderingIndicationBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioRenderingIndicationBox\n *\n * @public\n */\nexport function readArdi(view: IsoBoxReadView): AudioRenderingIndicationBox {\n\treturn {\n\t\ttype: 'ardi',\n\t\t...view.readFullBox(),\n\t\taudioRenderingIndication: view.readUint(1),\n\t}\n};\n","import type { AudioSampleEntryBox, AudioSampleEntryBoxChild } from '../boxes/AudioSampleEntryBox.ts'\nimport type { AudioSampleEntryType } from '../boxes/AudioSampleEntryType.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a AudioSampleEntryBox from an IsoView\n *\n * @param type - The type of AudioSampleEntryBox to read\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioSampleEntryBox\n *\n * @public\n */\nexport function readAudioSampleEntryBox<T extends AudioSampleEntryType>(type: T, view: IsoBoxReadView): AudioSampleEntryBox<T> {\n\tconst { readArray, readUint, readTemplate, readBoxes } = view\n\n\treturn {\n\t\ttype,\n\t\treserved1: readArray(UINT, 1, 6),\n\t\tdataReferenceIndex: readUint(2),\n\t\treserved2: readArray(UINT, 4, 2),\n\t\tchannelcount: readUint(2),\n\t\tsamplesize: readUint(2),\n\t\tpreDefined: readUint(2),\n\t\treserved3: readUint(2),\n\t\tsamplerate: readTemplate(4),\n\t\tboxes: readBoxes<AudioSampleEntryBoxChild>()\n\t}\n};\n","import type { VisualSampleEntryBox, VisualSampleEntryBoxChild } from '../boxes/VisualSampleEntryBox.ts'\nimport type { VisualSampleEntryType } from '../boxes/VisualSampleEntryType.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param type - The type of VisualSampleEntryBox to read\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readVisualSampleEntryBox<T extends VisualSampleEntryType>(type: T, view: IsoBoxReadView): VisualSampleEntryBox<T> {\n\tconst { readArray, readUint, readInt, readTemplate, readBoxes } = view\n\n\treturn {\n\t\ttype,\n\t\treserved1: readArray(UINT, 1, 6),\n\t\tdataReferenceIndex: readUint(2),\n\t\tpreDefined1: readUint(2),\n\t\treserved2: readUint(2),\n\t\tpreDefined2: readArray(UINT, 4, 3),\n\t\twidth: readUint(2),\n\t\theight: readUint(2),\n\t\thorizresolution: readTemplate(4),\n\t\tvertresolution: readTemplate(4),\n\t\treserved3: readUint(4),\n\t\tframeCount: readUint(2),\n\t\tcompressorName: readArray(UINT, 1, 32),\n\t\tdepth: readUint(2),\n\t\tpreDefined3: readInt(2),\n\t\tboxes: readBoxes<VisualSampleEntryBoxChild>(),\n\t}\n};\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc1(view: IsoBoxReadView): VisualSampleEntryBox<'avc1'> {\n\treturn readVisualSampleEntryBox('avc1', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc2(view: IsoBoxReadView): VisualSampleEntryBox<'avc2'> {\n\treturn readVisualSampleEntryBox('avc2', view)\n}\n\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc3(view: IsoBoxReadView): VisualSampleEntryBox<'avc3'> {\n\treturn readVisualSampleEntryBox('avc3', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc4(view: IsoBoxReadView): VisualSampleEntryBox<'avc4'> {\n\treturn readVisualSampleEntryBox('avc4', view)\n}\n","import type { CompositionTimeToSampleBox } from '../boxes/CompositionTimeToSampleBox.ts'\nimport type { CompositionTimeToSampleEntry } from '../boxes/CompositionTimeToSampleEntry.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a CompositionTimeToSampleBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed CompositionTimeToSampleBox\n *\n * @public\n */\nexport function readCtts(view: IsoBoxReadView): CompositionTimeToSampleBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst read = version === 1 ? view.readInt : view.readUint\n\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries<CompositionTimeToSampleEntry>(entryCount, () => ({\n\t\tsampleCount: view.readUint(4),\n\t\tsampleOffset: read(4),\n\t}))\n\n\treturn {\n\t\ttype: 'ctts',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { DataEntryUrlBox } from '../boxes/DataEntryUrlBox.ts'\nimport type { DataEntryUrnBox } from '../boxes/DataEntryUrnBox.ts'\nimport type { DataReferenceBox } from '../boxes/DataReferenceBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a DataReferenceBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed DataReferenceBox\n *\n * @public\n */\nexport function readDref(view: IsoBoxReadView): DataReferenceBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readBoxes<DataEntryUrlBox | DataEntryUrnBox>(entryCount)\n\n\treturn {\n\t\ttype: 'dref',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { ExtendedLanguageBox } from '../boxes/ExtendedLanguageBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a ExtendedLanguageBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed ExtendedLanguageBox\n *\n * @public\n */\nexport function readElng(view: IsoBoxReadView): ExtendedLanguageBox {\n\treturn {\n\t\ttype: 'elng',\n\t\t...view.readFullBox(),\n\t\textendedLanguage: view.readUtf8(-1),\n\t}\n};\n","import type { EditListBox } from '../boxes/EditListBox.ts'\nimport type { EditListEntry } from '../boxes/EditListEntry.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a Box from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed Box\n *\n * @public\n */\nexport function readElst(view: IsoBoxReadView): EditListBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst v1 = version === 1\n\tconst size = v1 ? 8 : 4\n\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries<EditListEntry>(entryCount, () => ({\n\t\tsegmentDuration: view.readUint(size),\n\t\tmediaTime: view.readInt(size),\n\t\tmediaRateInteger: view.readInt(2),\n\t\tmediaRateFraction: view.readInt(2),\n\t}))\n\n\treturn {\n\t\ttype: 'elst',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { EventMessageBox } from '../boxes/EventMessageBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse an EventMessageBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed EventMessageBox\n *\n * @public\n */\nexport function readEmsg(view: IsoBoxReadView): EventMessageBox {\n\tconst { readUint, readString, readData } = view\n\n\tconst result = { type: 'emsg', ...view.readFullBox() } as EventMessageBox\n\n\tif (result.version == 1) {\n\t\tresult.timescale = readUint(4)\n\t\tresult.presentationTime = readUint(8)\n\t\tresult.eventDuration = readUint(4)\n\t\tresult.id = readUint(4)\n\t\tresult.schemeIdUri = readString(-1)\n\t\tresult.value = readString(-1)\n\t}\n\telse {\n\t\tresult.schemeIdUri = readString(-1)\n\t\tresult.value = readString(-1)\n\t\tresult.timescale = readUint(4)\n\t\tresult.presentationTimeDelta = readUint(4)\n\t\tresult.eventDuration = readUint(4)\n\t\tresult.id = readUint(4)\n\t}\n\n\tresult.messageData = readData(-1)\n\n\treturn result\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readAudioSampleEntryBox } from './readAudioSampleEntryBox.ts'\n\n/**\n * Parse an AudioSampleEntry from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioSampleEntry\n *\n * @public\n */\nexport function readEnca(view: IsoBoxReadView): AudioSampleEntryBox<'enca'> {\n\treturn readAudioSampleEntryBox('enca', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readEncv(view: IsoBoxReadView): VisualSampleEntryBox<'encv'> {\n\treturn readVisualSampleEntryBox('encv', view)\n}\n","import type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a Box from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed Box\n *\n * @public\n */\nexport function readFree(view: IsoBoxReadView): FreeSpaceBox {\n\treturn {\n\t\ttype: 'free',\n\t\tdata: view.readData(-1),\n\t}\n};\n","import type { OriginalFormatBox } from '../boxes/OriginalFormatBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse an OriginalFormatBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed OriginalFormatBox\n *\n * @public\n */\nexport function readFrma(view: IsoBoxReadView): OriginalFormatBox {\n\treturn {\n\t\ttype: 'frma',\n\t\tdataFormat: view.readUint(4),\n\t}\n};\n","import type { FileTypeBox } from '../boxes/FileTypeBox.ts'\nimport { STRING } from '../fields/STRING.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a FileTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed FileTypeBox\n *\n * @public\n */\nexport function readFtyp(view: IsoBoxReadView): FileTypeBox {\n\tconst size = 4\n\tconst majorBrand = view.readString(4)\n\tconst minorVersion = view.readUint(4)\n\tconst length = view.bytesRemaining / size\n\tconst compatibleBrands = view.readArray(STRING, size, length)\n\n\treturn {\n\t\ttype: 'ftyp',\n\t\tmajorBrand,\n\t\tminorVersion,\n\t\tcompatibleBrands,\n\t}\n}\n","import type { HandlerReferenceBox } from '../boxes/HandlerReferenceBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a HandlerReferenceBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed HandlerReferenceBox\n *\n * @public\n */\nexport function readHdlr(view: IsoBoxReadView): HandlerReferenceBox {\n\treturn {\n\t\ttype: 'hdlr',\n\t\t...view.readFullBox(),\n\t\tpreDefined: view.readUint(4),\n\t\thandlerType: view.readString(4),\n\t\treserved: view.readArray(UINT, 4, 3),\n\t\tname: view.readString(-1),\n\t}\n};\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readHev1(view: IsoBoxReadView): VisualSampleEntryBox<'hev1'> {\n\treturn readVisualSampleEntryBox('hev1', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readHvc1(view: IsoBoxReadView): VisualSampleEntryBox<'hvc1'> {\n\treturn readVisualSampleEntryBox('hvc1', view)\n}\n","import type { WebVttCueIdBox } from '../boxes/WebVttCueIdBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTCueIdBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTCueIdBox\n *\n * @public\n */\nexport function readIden(view: IsoBoxReadView): WebVttCueIdBox {\n\treturn {\n\t\ttype: 'iden',\n\t\tcueId: view.readUtf8(-1),\n\t}\n};\n","import type { IdentifiedMediaDataBox } from '../boxes/IdentifiedMediaDataBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a IdentifiedMediaDataBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed IdentifiedMediaDataBox\n *\n * @public\n */\nexport function readImda(view: IsoBoxReadView): IdentifiedMediaDataBox {\n\treturn {\n\t\ttype: 'imda',\n\t\timdaIdentifier: view.readUint(4),\n\t\tdata: view.readData(-1),\n\t}\n};\n","import type { TrackKindBox } from '../boxes/TrackKindBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackKinBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackKindBox\n *\n * @public\n */\nexport function readKind(view: IsoBoxReadView): TrackKindBox {\n\treturn {\n\t\ttype: 'kind',\n\t\t...view.readFullBox(),\n\t\tschemeUri: view.readUtf8(-1),\n\t\tvalue: view.readUtf8(-1),\n\t}\n};\n","import type { LabelBox } from '../boxes/LabelBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a LabelBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed LabelBox\n *\n * @public\n */\nexport function readLabl(view: IsoBoxReadView): LabelBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'labl',\n\t\tversion,\n\t\tflags,\n\t\tisGroupLabel: (flags & 0x1) !== 0,\n\t\tlabelId: view.readUint(2),\n\t\tlanguage: view.readUtf8(-1),\n\t\tlabel: view.readUtf8(-1),\n\t}\n}\n","import type { MediaDataBox } from '../boxes/MediaDataBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MediaDataBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MediaDataBox\n *\n * @public\n */\nexport function readMdat(view: IsoBoxReadView): MediaDataBox {\n\treturn {\n\t\ttype: 'mdat',\n\t\tdata: view.readData(-1),\n\t}\n};\n","import type { MediaHeaderBox } from '../boxes/MediaHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MediaHeaderBox\n *\n * @public\n */\nexport function readMdhd(view: IsoBoxReadView): MediaHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\n\tconst creationTime = view.readUint(version == 1 ? 8 : 4)\n\tconst modificationTime = view.readUint(version == 1 ? 8 : 4)\n\tconst timescale = view.readUint(4)\n\tconst duration = view.readUint(version == 1 ? 8 : 4)\n\tconst lang = view.readUint(2)\n\tconst language = String.fromCharCode(((lang >> 10) & 0x1F) + 0x60,\n\t\t((lang >> 5) & 0x1F) + 0x60,\n\t\t(lang & 0x1F) + 0x60)\n\n\tconst preDefined = view.readUint(2)\n\n\treturn {\n\t\ttype: 'mdhd',\n\t\tversion,\n\t\tflags,\n\t\tcreationTime,\n\t\tmodificationTime,\n\t\ttimescale,\n\t\tduration,\n\t\tlanguage,\n\t\tpreDefined,\n\t}\n}\n","import type { MovieExtendsHeaderBox } from '../boxes/MovieExtendsHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MovieExtendsHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MovieExtendsHeaderBox\n *\n * @public\n */\nexport function readMehd(view: IsoBoxReadView): MovieExtendsHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'mehd',\n\t\tversion,\n\t\tflags,\n\t\tfragmentDuration: view.readUint((version === 1) ? 8 : 4),\n\t}\n};\n","import type { MetaBox, MetaBoxChild } from '../boxes/MetaBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MetaBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MetaBox\n *\n * @public\n */\nexport function readMeta(view: IsoBoxReadView): MetaBox {\n\treturn {\n\t\ttype: 'meta',\n\t\t...view.readFullBox(),\n\t\tboxes: view.readBoxes<MetaBoxChild>(),\n\t}\n}\n","import type { MovieFragmentHeaderBox } from '../boxes/MovieFragmentHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MovieFragmentHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MovieFragmentHeaderBox\n *\n * @public\n */\nexport function readMfhd(view: IsoBoxReadView): MovieFragmentHeaderBox {\n\treturn {\n\t\ttype: 'mfhd',\n\t\t...view.readFullBox(),\n\t\tsequenceNumber: view.readUint(4),\n\t}\n};\n","import type { MovieFragmentRandomAccessOffsetBox } from '../boxes/MovieFragmentRandomAccessOffsetBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MovieFragmentRandomAccessBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MovieFragmentRandomAccessBox\n *\n * @public\n */\nexport function readMfro(view: IsoBoxReadView): MovieFragmentRandomAccessOffsetBox {\n\treturn {\n\t\ttype: 'mfro',\n\t\t...view.readFullBox(),\n\t\tmfraSize: view.readUint(4),\n\t}\n};\n\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readAudioSampleEntryBox } from './readAudioSampleEntryBox.ts'\n\n/**\n * Parse an AudioSampleEntry from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioSampleEntry\n *\n * @public\n */\nexport function readMp4a(view: IsoBoxReadView): AudioSampleEntryBox<'mp4a'> {\n\treturn readAudioSampleEntryBox('mp4a', view)\n};\n","import type { MovieHeaderBox } from '../boxes/MovieHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a Box from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed Box\n *\n * @public\n */\nexport function readMvhd(view: IsoBoxReadView): MovieHeaderBox {\n\tconst { readUint, readTemplate, readArray } = view\n\n\tconst { version, flags } = view.readFullBox()\n\tconst size = (version == 1) ? 8 : 4\n\n\treturn {\n\t\ttype: 'mvhd',\n\t\tversion,\n\t\tflags,\n\t\tcreationTime: readUint(size),\n\t\tmodificationTime: readUint(size),\n\t\ttimescale: readUint(4),\n\t\tduration: readUint(size),\n\t\trate: readTemplate(4),\n\t\tvolume: readTemplate(2),\n\t\treserved1: readUint(2),\n\t\treserved2: readArray(UINT, 4, 2),\n\t\tmatrix: readArray(TEMPLATE, 4, 9),\n\t\tpreDefined: readArray(UINT, 4, 6),\n\t\tnextTrackId: readUint(4),\n\t}\n};\n","import type { WebVttCuePayloadBox } from '../boxes/WebVttCuePayloadBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTCuePayloadBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTCuePayloadBox\n *\n * @public\n */\nexport function readPayl(view: IsoBoxReadView): WebVttCuePayloadBox {\n\treturn {\n\t\ttype: 'payl',\n\t\tcueText: view.readUtf8(-1),\n\t}\n};\n","import type { ProducerReferenceTimeBox } from '../boxes/ProducerReferenceTimeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a ProducerReferenceTimeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed ProducerReferenceTimeBox\n *\n * @public\n */\nexport function readPrft(view: IsoBoxReadView): ProducerReferenceTimeBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'prft',\n\t\tversion,\n\t\tflags,\n\t\treferenceTrackId: view.readUint(4),\n\t\tntpTimestampSec: view.readUint(4),\n\t\tntpTimestampFrac: view.readUint(4),\n\t\tmediaTime: view.readUint(version === 1 ? 8 : 4),\n\t}\n};\n","import type { Entity } from '../boxes/Entity.ts'\nimport type { PreselectionGroupBox, PreselectionGroupBoxChild } from '../boxes/PreselectionGroupBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a PreselectionGroupBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed PreselectionGroupBox\n *\n * @public\n */\nexport function readPrsl(view: IsoBoxReadView): PreselectionGroupBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst groupId = view.readUint(4)\n\tconst numEntitiesInGroup = view.readUint(4)\n\tconst entities = view.readEntries<Entity>(numEntitiesInGroup, () => ({\n\t\tentityId: view.readUint(4),\n\t}))\n\tconst preselectionTag = flags & 0x1000 ? view.readUtf8(-1) : undefined\n\tconst selectionPriority = flags & 0x2000 ? view.readUint(1) : undefined\n\tconst interleavingTag = flags & 0x4000 ? view.readUtf8(-1) : undefined\n\n\treturn {\n\t\ttype: 'prsl',\n\t\tversion,\n\t\tflags,\n\t\tgroupId,\n\t\tnumEntitiesInGroup,\n\t\tentities,\n\t\tpreselectionTag,\n\t\tselectionPriority,\n\t\tinterleavingTag,\n\t\tboxes: view.readBoxes<PreselectionGroupBoxChild>(),\n\t}\n}\n","import type { ProtectionSystemSpecificHeaderBox } from '../boxes/ProtectionSystemSpecificHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a ProtectionSystemSpecificHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed ProtectionSystemSpecificHeaderBox\n *\n * @public\n */\nexport function readPssh(view: IsoBoxReadView): ProtectionSystemSpecificHeaderBox {\n\tconst { readUint, readArray } = view\n\tconst { version, flags } = view.readFullBox()\n\n\tconst systemId = readArray(UINT, 1, 16)\n\n\tlet kidCount: number = 0\n\tlet kid: number[] = []\n\n\tif (version > 0) {\n\t\tkidCount = readUint(4)\n\t\tkid = readArray(UINT, 1, kidCount)\n\t}\n\n\tconst dataSize = readUint(4)\n\tconst data = readArray(UINT, 1, dataSize)\n\n\treturn {\n\t\ttype: 'pssh',\n\t\tversion,\n\t\tflags,\n\t\tsystemId,\n\t\tkidCount,\n\t\tkid,\n\t\tdataSize,\n\t\tdata,\n\t}\n};\n","import type { SchemeTypeBox } from '../boxes/SchemeTypeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SchemeTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SchemeTypeBox\n *\n * @public\n */\nexport function readSchm(view: IsoBoxReadView): SchemeTypeBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'schm',\n\t\tversion,\n\t\tflags,\n\t\tschemeType: view.readUint(4),\n\t\tschemeVersion: view.readUint(4),\n\t\tschemeUri: flags & 0x000001 ? view.readString(-1) : undefined,\n\t}\n};\n","import type { SampleDependencyTypeBox } from '../boxes/SampleDependencyTypeBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SampleDependencyTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SampleDependencyTypeBox\n *\n * @public\n */\nexport function readSdtp(view: IsoBoxReadView): SampleDependencyTypeBox {\n\treturn {\n\t\ttype: 'sdtp',\n\t\t...view.readFullBox(),\n\t\tsampleDependencyTable: view.readArray(UINT, 1, view.bytesRemaining),\n\t}\n};\n","import type { SegmentIndexBox } from '../boxes/SegmentIndexBox.ts'\nimport type { SegmentIndexReference } from '../boxes/SegmentIndexReference.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SegmentIndexBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SegmentIndexBox\n *\n * @public\n */\nexport function readSidx(view: IsoBoxReadView): SegmentIndexBox {\n\tconst { readUint } = view\n\tconst { version, flags } = view.readFullBox()\n\tconst v1 = version === 1\n\tconst size = v1 ? 8 : 4\n\n\tconst referenceId = readUint(4)\n\tconst timescale = readUint(4)\n\tconst earliestPresentationTime = readUint(size)\n\tconst firstOffset = readUint(size)\n\tconst reserved = readUint(2)\n\tconst referenceCount = readUint(2)\n\tconst references = view.readEntries<SegmentIndexReference>(referenceCount, () => {\n\t\tconst entry = {} as any\n\n\t\tentry.reference = readUint(4)\n\t\tentry.subsegmentDuration = readUint(4)\n\t\tentry.sap = readUint(4)\n\t\tentry.referenceType = (entry.reference >> 31) & 0x00000001\n\t\tentry.referencedSize = entry.reference & 0x7FFFFFFF\n\t\tentry.startsWithSap = (entry.sap >> 31) & 0x00000001\n\t\tentry.sapType = (entry.sap >> 28) & 0x00000007\n\t\tentry.sapDeltaTime = (entry.sap & 0x0FFFFFFF)\n\n\t\treturn entry\n\t})\n\n\treturn {\n\t\ttype: 'sidx',\n\t\tversion,\n\t\tflags,\n\t\treferenceId,\n\t\ttimescale,\n\t\tearliestPresentationTime,\n\t\tfirstOffset,\n\t\treserved,\n\t\treferences,\n\t}\n};\n","import type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport { readFree } from './readFree.ts'\n\n/**\n * Parse a FreeSpaceBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed FreeSpaceBox\n *\n * @public\n */\nexport function readSkip(view: IsoBoxReadView): FreeSpaceBox<'skip'> {\n\treturn {\n\t\t...readFree(view),\n\t\ttype: 'skip',\n\t}\n};\n","import type { SoundMediaHeaderBox } from '../boxes/SoundMediaHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SoundMediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SoundMediaHeaderBox\n *\n * @public\n */\nexport function readSmhd(view: IsoBoxReadView): SoundMediaHeaderBox {\n\treturn {\n\t\ttype: 'smhd',\n\t\t...view.readFullBox(),\n\t\tbalance: view.readUint(2),\n\t\treserved: view.readUint(2),\n\t}\n};\n","import type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { SubsegmentIndexBox } from '../boxes/SubsegmentIndexBox.ts'\n\n/**\n * Parse a SubsegmentIndexBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SubsegmentIndexBox\n *\n * @public\n */\nexport function readSsix(view: IsoBoxReadView): SubsegmentIndexBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst subsegmentCount = view.readUint(4)\n\tconst subsegments = view.readEntries(subsegmentCount, () => {\n\t\tconst rangesCount = view.readUint(4)\n\t\tconst ranges = view.readEntries(rangesCount, () => ({\n\t\t\tlevel: view.readUint(1),\n\t\t\trangeSize: view.readUint(3),\n\t\t}))\n\t\treturn { rangesCount, ranges }\n\t})\n\n\treturn {\n\t\ttype: 'ssix',\n\t\tversion,\n\t\tflags,\n\t\tsubsegmentCount,\n\t\tsubsegments,\n\t}\n};\n","import type { SubtitleMediaHeaderBox } from '../boxes/SubtitleMediaHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SubtitleMediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SubtitleMediaHeaderBox\n *\n * @public\n */\nexport function readSthd(view: IsoBoxReadView): SubtitleMediaHeaderBox {\n\treturn {\n\t\ttype: 'sthd',\n\t\t...view.readFullBox(),\n\t}\n};\n","import type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { SampleDescriptionBox } from '../boxes/SampleDescriptionBox.ts'\nimport type { SampleEntryBox } from '../boxes/SampleEntryBox.ts'\n\n/**\n * Parse a SampleDescriptionBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SampleDescriptionBox\n *\n * @public\n */\nexport function readStsd<E extends SampleEntryBox = SampleEntryBox>(view: IsoBoxReadView): SampleDescriptionBox<E> {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\n\treturn {\n\t\ttype: 'stsd',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries: view.readBoxes<E>(entryCount),\n\t}\n};\n","import type { SyncSample } from '../boxes/SyncSample.ts'\nimport type { SyncSampleBox } from '../boxes/SyncSampleBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SyncSampleBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SyncSampleBox\n *\n * @public\n */\nexport function readStss(view: IsoBoxReadView): SyncSampleBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\n\treturn {\n\t\ttype: 'stss',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries: view.readEntries<SyncSample>(entryCount, () => ({\n\t\t\tsampleNumber: view.readUint(4),\n\t\t})),\n\t}\n};\n","import type { WebVttSettingsBox } from '../boxes/WebVttSettingsBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTSettingsBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTSettingsBox\n *\n * @public\n */\nexport function readSttg(view: IsoBoxReadView): WebVttSettingsBox {\n\treturn {\n\t\ttype: 'sttg',\n\t\tsettings: view.readUtf8(-1),\n\t}\n};\n","import type { DecodingTimeToSampleBox } from '../boxes/DecodingTimeToSampleBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a DecodingTimeToSampleBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed DecodingTimeToSampleBox\n *\n * @public\n */\nexport function readStts(view: IsoBoxReadView): DecodingTimeToSampleBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries(entryCount, () => ({\n\t\tsampleCount: view.readUint(4),\n\t\tsampleDelta: view.readUint(4),\n\t}))\n\n\treturn {\n\t\ttype: 'stts',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { SegmentTypeBox } from '../boxes/SegmentTypeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readFtyp } from './readFtyp.ts'\n\n/**\n * Parse a SegmentTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SegmentTypeBox\n *\n * @public\n */\nexport function readStyp(view: IsoBoxReadView): SegmentTypeBox {\n\treturn {\n\t\t...readFtyp(view),\n\t\ttype: 'styp',\n\t}\n}\n","import type { SubsampleInformationBox } from '../boxes/SubsampleInformationBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SubSampleInformationBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SubSampleInformationBox\n *\n * @public\n */\nexport function readSubs(view: IsoBoxReadView): SubsampleInformationBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries(entryCount, () => {\n\t\tconst sampleDelta = view.readUint(4)\n\t\tconst subsampleCount = view.readUint(2)\n\t\tconst subsamples = view.readEntries(subsampleCount, () => ({\n\t\t\tsubsampleSize: view.readUint((version === 1) ? 4 : 2),\n\t\t\tsubsamplePriority: view.readUint(1),\n\t\t\tdiscardable: view.readUint(1),\n\t\t\tcodecSpecificParameters: view.readUint(4),\n\t\t}))\n\n\t\treturn {\n\t\t\tsampleDelta,\n\t\t\tsubsampleCount,\n\t\t\tsubsamples,\n\t\t}\n\t})\n\n\treturn {\n\t\ttype: 'subs',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { TrackEncryptionBox } from '../boxes/TrackEncryptionBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackEncryptionBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackEncryptionBox\n *\n * @public\n */\nexport function readTenc(view: IsoBoxReadView): TrackEncryptionBox {\n\treturn {\n\t\ttype: 'tenc',\n\t\t...view.readFullBox(),\n\t\tdefaultIsEncrypted: view.readUint(3),\n\t\tdefaultIvSize: view.readUint(1),\n\t\tdefaultKid: view.readArray(UINT, 1, 16),\n\t}\n};\n","import type { TrackFragmentBaseMediaDecodeTimeBox } from '../boxes/TrackFragmentBaseMediaDecodeTimeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackFragmentDecodeTimeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackFragmentDecodeTimeBox\n *\n * @public\n */\nexport function readTfdt(view: IsoBoxReadView): TrackFragmentBaseMediaDecodeTimeBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'tfdt',\n\t\tversion,\n\t\tflags,\n\t\tbaseMediaDecodeTime: view.readUint((version == 1) ? 8 : 4),\n\t}\n};\n","import type { TrackFragmentHeaderBox } from '../boxes/TrackFragmentHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackFragmentHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackFragmentHeaderBox\n *\n * @public\n */\nexport function readTfhd(view: IsoBoxReadView): TrackFragmentHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'tfhd',\n\t\tversion,\n\t\tflags,\n\t\ttrackId: view.readUint(4),\n\t\tbaseDataOffset: flags & 0x01 ? view.readUint(8) : undefined,\n\t\tsampleDescriptionIndex: flags & 0x02 ? view.readUint(4) : undefined,\n\t\tdefaultSampleDuration: flags & 0x08 ? view.readUint(4) : undefined,\n\t\tdefaultSampleSize: flags & 0x10 ? view.readUint(4) : undefined,\n\t\tdefaultSampleFlags: flags & 0x20 ? view.readUint(4) : undefined,\n\t}\n};\n","import type { TrackFragmentRandomAccessBox } from '../boxes/TrackFragmentRandomAccessBox.ts'\nimport type { TrackFragmentRandomAccessEntry } from '../boxes/TrackFragmentRandomAccessEntry.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackFragmentRandomAccessBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackFragmentRandomAccessBox\n *\n * @public\n */\nexport function readTfra(view: IsoBoxReadView): TrackFragmentRandomAccessBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst trackId = view.readUint(4)\n\tconst reserved = view.readUint(4)\n\n\tconst lengthSizeOfTrafNum = (reserved & 0x00000030) >> 4\n\tconst lengthSizeOfTrunNum = (reserved & 0x0000000C) >> 2\n\tconst lengthSizeOfSampleNum = (reserved & 0x00000003)\n\n\tconst numberOfEntry = view.readUint(4)\n\n\tconst entries = view.readEntries<TrackFragmentRandomAccessEntry>(numberOfEntry, () => ({\n\t\ttime: view.readUint((version === 1) ? 8 : 4),\n\t\tmoofOffset: view.readUint((version === 1) ? 8 : 4),\n\t\ttrafNumber: view.readUint(lengthSizeOfTrafNum + 1),\n\t\ttrunNumber: view.readUint(lengthSizeOfTrunNum + 1),\n\t\tsampleNumber: view.readUint(lengthSizeOfSampleNum + 1),\n\t}))\n\n\treturn {\n\t\ttype: 'tfra',\n\t\tversion,\n\t\tflags,\n\t\ttrackId,\n\t\treserved,\n\t\tlengthSizeOfTrafNum,\n\t\tlengthSizeOfTrunNum,\n\t\tlengthSizeOfSampleNum,\n\t\tnumberOfEntry,\n\t\tentries,\n\t}\n};\n","import type { TrackHeaderBox } from '../boxes/TrackHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackHeaderBox\n *\n * @public\n */\nexport function readTkhd(view: IsoBoxReadView): TrackHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst size = version === 1 ? 8 : 4\n\n\treturn {\n\t\ttype: 'tkhd',\n\t\tversion,\n\t\tflags,\n\t\tcreationTime: view.readUint(size),\n\t\tmodificationTime: view.readUint(size),\n\t\ttrackId: view.readUint(4),\n\t\treserved1: view.readUint(4),\n\t\tduration: view.readUint(size),\n\t\treserved2: view.readArray(UINT, 4, 2),\n\t\tlayer: view.readUint(2),\n\t\talternateGroup: view.readUint(2),\n\t\tvolume: view.readTemplate(2),\n\t\treserved3: view.readUint(2),\n\t\tmatrix: view.readArray(TEMPLATE, 4, 9),\n\t\twidth: view.readTemplate(4),\n\t\theight: view.readTemplate(4),\n\t}\n};\n","import type { TrackExtendsBox } from '../boxes/TrackExtendsBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackExtendsBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackExtendsBox\n *\n * @public\n */\nexport function readTrex(view: IsoBoxReadView): TrackExtendsBox {\n\treturn {\n\t\ttype: 'trex',\n\t\t...view.readFullBox(),\n\t\ttrackId: view.readUint(4),\n\t\tdefaultSampleDescriptionIndex: view.readUint(4),\n\t\tdefaultSampleDuration: view.readUint(4),\n\t\tdefaultSampleSize: view.readUint(4),\n\t\tdefaultSampleFlags: view.readUint(4),\n\t}\n};\n","import type { TrackRunBox } from '../boxes/TrackRunBox.ts'\nimport type { TrackRunSample } from '../boxes/TrackRunSample.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackRunBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackRunBox\n *\n * @public\n */\nexport function readTrun(view: IsoBoxReadView): TrackRunBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst sampleCount = view.readUint(4)\n\tlet dataOffset: number | undefined\n\tlet firstSampleFlags: number | undefined\n\n\tif (flags & 0x1) {\n\t\tdataOffset = view.readInt(4)\n\t}\n\n\tif (flags & 0x4) {\n\t\tfirstSampleFlags = view.readUint(4)\n\t}\n\n\tconst samples = view.readEntries<TrackRunSample>(sampleCount, () => {\n\t\tconst sample: TrackRunSample = {}\n\n\t\tif (flags & 0x100) {\n\t\t\tsample.sampleDuration = view.readUint(4)\n\t\t}\n\t\tif (flags & 0x200) {\n\t\t\tsample.sampleSize = view.readUint(4)\n\t\t}\n\t\tif (flags & 0x400) {\n\t\t\tsample.sampleFlags = view.readUint(4)\n\t\t}\n\t\tif (flags & 0x800) {\n\t\t\tsample.sampleCompositionTimeOffset = (version === 1) ? view.readInt(4) : view.readUint(4)\n\t\t}\n\n\t\treturn sample\n\t})\n\n\treturn {\n\t\ttype: 'trun',\n\t\tversion,\n\t\tflags,\n\t\tsampleCount,\n\t\tdataOffset,\n\t\tfirstSampleFlags,\n\t\tsamples,\n\t}\n};\n","import type { DataEntryUrlBox } from '../boxes/DataEntryUrlBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a UrlBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed UrlBox\n *\n * @public\n */\nexport function readUrl(view: IsoBoxReadView): DataEntryUrlBox {\n\treturn {\n\t\ttype: 'url ',\n\t\t...view.readFullBox(),\n\t\tlocation: view.readString(-1),\n\t}\n};\n","import type { DataEntryUrnBox } from '../boxes/DataEntryUrnBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a UrnBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed UrnBox\n *\n * @public\n */\nexport function readUrn(view: IsoBoxReadView): DataEntryUrnBox {\n\treturn {\n\t\ttype: 'urn ',\n\t\t...view.readFullBox(),\n\t\tname: view.readString(-1),\n\t\tlocation: view.readString(-1),\n\t}\n};\n","import type { WebVttSourceLabelBox } from '../boxes/WebVttSourceLabelBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTSourceLabelBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTSourceLabelBox\n *\n * @public\n */\nexport function readVlab(view: IsoBoxReadView): WebVttSourceLabelBox {\n\treturn {\n\t\ttype: 'vlab',\n\t\tsourceLabel: view.readUtf8(-1),\n\t}\n};\n","import type { VideoMediaHeaderBox } from '../boxes/VideoMediaHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a VideoMediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VideoMediaHeaderBox\n *\n * @public\n */\nexport function readVmhd(view: IsoBoxReadView): VideoMediaHeaderBox {\n\treturn {\n\t\ttype: 'vmhd',\n\t\t...view.readFullBox(),\n\t\tgraphicsmode: view.readUint(2),\n\t\topcolor: view.readArray(UINT, 2, 3),\n\t}\n};\n","import type { WebVttConfigurationBox } from '../boxes/WebVttConfigurationBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTConfigurationBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVttConfigurationBox\n *\n * @public\n */\nexport function readVttC(view: IsoBoxReadView): WebVttConfigurationBox {\n\treturn {\n\t\ttype: 'vttC',\n\t\tconfig: view.readUtf8(),\n\t}\n};\n","import type { WebVttEmptySampleBox } from '../boxes/WebVttEmptySampleBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTT Empty Sample Box from an IsoView\n *\n * @returns A parsed WebVTT Empty Sample Box\n *\n * @public\n */\n// eslint-disable-next-line\nexport function readVtte(_: IsoBoxReadView): WebVttEmptySampleBox {\n\t// Nothing should happen here.\n\treturn {\n\t\ttype: 'vtte',\n\t}\n};\n","import type { FullBox } from '../boxes/FullBox.ts'\n\n/**\n * Check if a box is a full box\n *\n * @param box - The box to check\n *\n * @returns `true` if the box is a full box, `false` otherwise\n *\n * @public\n */\nexport function isFullBox(box: any): box is FullBox {\n\treturn 'version' in box && 'flags' in box\n}\n","import type { AudioRenderingIndicationBox } from '../boxes/AudioRenderingIndicationBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an AudioRenderingIndicationBox to an IsoDataWriter.\n *\n * @param box - The AudioRenderingIndicationBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeArdi(box: AudioRenderingIndicationBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst audioRenderingIndicationSize = 1\n\tconst totalSize = headerSize + fullBoxSize + audioRenderingIndicationSize\n\n\tconst writer = new IsoBoxWriteView('ardi', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.audioRenderingIndication, 1)\n\n\treturn writer\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { AudioSampleEntryType } from '../boxes/AudioSampleEntryType.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write an AudioSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.2.3 Audio Sample Entry\n *\n * @param box - The AudioSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAudioSampleEntryBox<T extends AudioSampleEntryType = AudioSampleEntryType>(box: AudioSampleEntryBox<T>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst reserved1Size = 6\n\tconst dataReferenceIndexSize = 2\n\tconst reserved2Size = 8 // 2 x 4 bytes\n\tconst channelcountSize = 2\n\tconst samplesizeSize = 2\n\tconst preDefinedSize = 2\n\tconst reserved3Size = 2\n\tconst samplerateSize = 4\n\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\n\tconst totalSize = headerSize + reserved1Size + dataReferenceIndexSize + reserved2Size +\n\t\tchannelcountSize + samplesizeSize + preDefinedSize + reserved3Size + samplerateSize + size\n\n\tconst writer = new IsoBoxWriteView(box.type, totalSize)\n\n\twriter.writeArray(box.reserved1, UINT, 1, 6)\n\twriter.writeUint(box.dataReferenceIndex, 2)\n\twriter.writeArray(box.reserved2, UINT, 4, 2)\n\twriter.writeUint(box.channelcount, 2)\n\twriter.writeUint(box.samplesize, 2)\n\twriter.writeUint(box.preDefined, 2)\n\twriter.writeUint(box.reserved3, 2)\n\twriter.writeTemplate(box.samplerate, 4)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { VisualSampleEntryType } from '../boxes/VisualSampleEntryType.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a VisualSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.1.3 Visual Sample Entry\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The configuration for the writer\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVisualSampleEntryBox<T extends VisualSampleEntryType = VisualSampleEntryType>(box: VisualSampleEntryBox<T>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst reserved1Size = 6\n\tconst dataReferenceIndexSize = 2\n\tconst preDefined1Size = 2\n\tconst reserved2Size = 2\n\tconst preDefined2Size = 12 // 3 x 4 bytes\n\tconst widthSize = 2\n\tconst heightSize = 2\n\tconst horizresolutionSize = 4\n\tconst vertresolutionSize = 4\n\tconst reserved3Size = 4\n\tconst frameCountSize = 2\n\tconst compressorNameSize = 32\n\tconst depthSize = 2\n\tconst preDefined3Size = 2\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\tconst totalSize = headerSize + reserved1Size + dataReferenceIndexSize + preDefined1Size +\n\t\treserved2Size + preDefined2Size + widthSize + heightSize + horizresolutionSize +\n\t\tvertresolutionSize + reserved3Size + frameCountSize + compressorNameSize +\n\t\tdepthSize + preDefined3Size + size\n\n\tconst writer = new IsoBoxWriteView(box.type, totalSize)\n\n\twriter.writeArray(box.reserved1, UINT, 1, 6)\n\twriter.writeUint(box.dataReferenceIndex, 2)\n\twriter.writeUint(box.preDefined1, 2)\n\twriter.writeUint(box.reserved2, 2)\n\twriter.writeArray(box.preDefined2, UINT, 4, 3)\n\twriter.writeUint(box.width, 2)\n\twriter.writeUint(box.height, 2)\n\twriter.writeTemplate(box.horizresolution, 4)\n\twriter.writeTemplate(box.vertresolution, 4)\n\twriter.writeUint(box.reserved3, 4)\n\twriter.writeUint(box.frameCount, 2)\n\twriter.writeArray(box.compressorName, UINT, 1, 32)\n\twriter.writeUint(box.depth, 2)\n\twriter.writeUint(box.preDefined3 & 0xFFFF, 2)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.1.3 Visual Sample Entry\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc1(box: VisualSampleEntryBox<'avc1'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (avc2) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc2(box: VisualSampleEntryBox<'avc2'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (avc3) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc3(box: VisualSampleEntryBox<'avc3'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (avc4) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc4(box: VisualSampleEntryBox<'avc4'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { CompositionTimeToSampleBox } from '../boxes/CompositionTimeToSampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a CompositionTimeToSampleBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.1.3 Composition Time to Sample Box\n *\n * @param box - The CompositionTimeToSampleBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeCtts(box: CompositionTimeToSampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entriesSize = box.entryCount * 8 // 4 bytes sampleCount + 4 bytes sampleOffset\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('ctts', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleCount, 4)\n\t\t// For version 1, sampleOffset is signed, but we store as unsigned\n\t\twriter.writeUint(entry.sampleOffset, 4)\n\t}\n\n\treturn writer\n}\n","import type { DataReferenceBox } from '../boxes/DataReferenceBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a DataReferenceBox to an IsoDataWriter.\n *\n * @param box - The DataReferenceBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeDref(box: DataReferenceBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entryCount = box.entries.length\n\n\t// TODO: Is there a way to avoid creating the intermediate Uint8Arrays?\n\tconst { bytes, size } = writeChildBoxes(box.entries, config)\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + size\n\n\tconst writer = new IsoBoxWriteView('dref', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(entryCount, 4)\n\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { ExtendedLanguageBox } from '../boxes/ExtendedLanguageBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an ExtendedLanguageBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.4.6 Extended Language Tag\n *\n * @param box - The ExtendedLanguageBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeElng(box: ExtendedLanguageBox): IsoBoxWriteView {\n\tconst extendedLanguageBytes = encodeText(box.extendedLanguage)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst extendedLanguageSize = extendedLanguageBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + extendedLanguageSize\n\n\tconst writer = new IsoBoxWriteView('elng', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUtf8TerminatedString(box.extendedLanguage)\n\n\treturn writer\n}\n","import type { EditListBox } from '../boxes/EditListBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an EditListBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.6 Edit List Box\n *\n * @param box - The EditListBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeElst(box: EditListBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entrySize = size + size + 2 + 2 // segmentDuration + mediaTime + mediaRateInteger + mediaRateFraction\n\tconst entriesSize = box.entryCount * entrySize\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('elst', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.segmentDuration, size)\n\t\twriter.writeInt(entry.mediaTime, size)\n\t\twriter.writeInt(entry.mediaRateInteger, 2)\n\t\twriter.writeInt(entry.mediaRateFraction, 2)\n\t}\n\n\treturn writer\n}\n","import type { EventMessageBox } from '../boxes/EventMessageBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an EventMessageBox to an IsoDataWriter.\n *\n * ISO/IEC 23009-1 - 5.10.3.3 Event Message Box\n *\n * @param box - The EventMessageBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeEmsg(box: EventMessageBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\n\tlet contentSize: number\n\n\tif (box.version === 0) {\n\t\t// version 0: scheme_id_uri, value, timescale, presentation_time_delta, event_duration, id, message_data\n\t\tcontentSize = (box.schemeIdUri.length + 1) + (box.value.length + 1) + 4 + 4 + 4 + 4 + box.messageData.length\n\t} else {\n\t\t// version 1: timescale, presentation_time, event_duration, id, scheme_id_uri, value, message_data\n\t\tcontentSize = 4 + 8 + 4 + 4 + (box.schemeIdUri.length + 1) + (box.value.length + 1) + box.messageData.length\n\t}\n\n\tconst totalSize = headerSize + fullBoxSize + contentSize\n\n\tconst writer = new IsoBoxWriteView('emsg', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\tif (box.version === 0) {\n\t\twriter.writeTerminatedString(box.schemeIdUri)\n\t\twriter.writeTerminatedString(box.value)\n\t\twriter.writeUint(box.timescale, 4)\n\t\twriter.writeUint(box.presentationTimeDelta ?? 0, 4)\n\t\twriter.writeUint(box.eventDuration, 4)\n\t\twriter.writeUint(box.id, 4)\n\t} else {\n\t\twriter.writeUint(box.timescale, 4)\n\t\twriter.writeUint(box.presentationTime ?? 0, 8)\n\t\twriter.writeUint(box.eventDuration, 4)\n\t\twriter.writeUint(box.id, 4)\n\t\twriter.writeTerminatedString(box.schemeIdUri)\n\t\twriter.writeTerminatedString(box.value)\n\t}\n\n\twriter.writeBytes(box.messageData)\n\n\treturn writer\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeAudioSampleEntryBox } from './writeAudioSampleEntryBox.ts'\n\n/**\n * Write an AudioSampleEntryBox (enca) to an IsoDataWriter.\n *\n * @param box - The AudioSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeEnca(box: AudioSampleEntryBox<'enca'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeAudioSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (encv) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeEncv(box: VisualSampleEntryBox<'encv'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a FreeSpaceBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.1.2 Free Space Box\n *\n * @param box - The FreeSpaceBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeFree(box: FreeSpaceBox<'free'>): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('free', totalSize)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import type { OriginalFormatBox } from '../boxes/OriginalFormatBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an OriginalFormatBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.12.2 Original Format Box\n *\n * @param box - The OriginalFormatBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeFrma(box: OriginalFormatBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataFormatSize = 4\n\tconst totalSize = headerSize + dataFormatSize\n\n\tconst writer = new IsoBoxWriteView('frma', totalSize)\n\twriter.writeUint(box.dataFormat, 4)\n\n\treturn writer\n}\n","import type { FileTypeBox } from '../boxes/FileTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a FileTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 4.3 File Type Box\n *\n * @param box - The FileTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeFtyp(box: FileTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst majorBrandSize = 4\n\tconst minorVersionSize = 4\n\tconst compatibleBrandsSize = box.compatibleBrands.length * 4\n\tconst totalSize = headerSize + majorBrandSize + minorVersionSize + compatibleBrandsSize\n\n\tconst writer = new IsoBoxWriteView('ftyp', totalSize)\n\twriter.writeString(box.majorBrand)\n\twriter.writeUint(box.minorVersion, 4)\n\n\tfor (const brand of box.compatibleBrands) {\n\t\twriter.writeString(brand)\n\t}\n\n\treturn writer\n}\n","import type { HandlerReferenceBox } from '../boxes/HandlerReferenceBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a HandlerReferenceBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.4.3 Handler Reference Box\n *\n * @param box - The HandlerReferenceBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeHdlr(box: HandlerReferenceBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst preDefinedSize = 4\n\tconst handlerTypeSize = 4\n\tconst reservedSize = 12 // 3 x 4 bytes\n\tconst nameSize = box.name.length + 1 // null-terminated string\n\tconst totalSize = headerSize + fullBoxSize + preDefinedSize + handlerTypeSize + reservedSize + nameSize\n\n\tconst writer = new IsoBoxWriteView('hdlr', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.preDefined, 4)\n\twriter.writeString(box.handlerType)\n\twriter.writeArray(box.reserved, UINT, 4, 3)\n\twriter.writeTerminatedString(box.name)\n\n\treturn writer\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (hev1) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeHev1(box: VisualSampleEntryBox<'hev1'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (hvc1) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeHvc1(box: VisualSampleEntryBox<'hvc1'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttCueIdBox } from '../boxes/WebVttCueIdBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttCueIdBox to an IsoDataWriter.\n *\n * @param box - The WebVttCueIdBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeIden(box: WebVttCueIdBox): IsoBoxWriteView {\n\tconst cueIdBytes = encodeText(box.cueId)\n\n\tconst headerSize = 8\n\tconst cueIdSize = cueIdBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + cueIdSize\n\n\tconst writer = new IsoBoxWriteView('iden', totalSize)\n\twriter.writeUtf8TerminatedString(box.cueId)\n\n\treturn writer\n}\n","import type { IdentifiedMediaDataBox } from '../boxes/IdentifiedMediaDataBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an IdentifiedMediaDataBox to an IsoDataWriter.\n *\n * @param box - The IdentifiedMediaDataBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeImda(box: IdentifiedMediaDataBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst imdaIdentifierSize = 4\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + imdaIdentifierSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('imda', totalSize)\n\twriter.writeUint(box.imdaIdentifier, 4)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { TrackKindBox } from '../boxes/TrackKindBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackKindBox to an IsoDataWriter.\n *\n * @param box - The TrackKindBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeKind(box: TrackKindBox): IsoBoxWriteView {\n\tconst schemeUriBytes = encodeText(box.schemeUri)\n\tconst valueBytes = encodeText(box.value)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst schemeUriSize = schemeUriBytes.length + 1 // null-terminated\n\tconst valueSize = valueBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + schemeUriSize + valueSize\n\n\tconst writer = new IsoBoxWriteView('kind', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUtf8TerminatedString(box.schemeUri)\n\twriter.writeUtf8TerminatedString(box.value)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { LabelBox } from '../boxes/LabelBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a LabelBox to an IsoDataWriter.\n *\n * @param box - The LabelBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeLabl(box: LabelBox): IsoBoxWriteView {\n\tconst languageBytes = encodeText(box.language)\n\tconst labelBytes = encodeText(box.label)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst labelIdSize = 2\n\tconst languageSize = languageBytes.length + 1 // null-terminated\n\tconst labelSize = labelBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + labelIdSize + languageSize + labelSize\n\n\tconst writer = new IsoBoxWriteView('labl', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.labelId, 2)\n\twriter.writeUtf8TerminatedString(box.language)\n\twriter.writeUtf8TerminatedString(box.label)\n\n\treturn writer\n}\n","import type { MediaDataBox } from '../boxes/MediaDataBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MediaDataBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.1.1 Media Data Box\n *\n * @param box - The MediaDataBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMdat(box: MediaDataBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('mdat', totalSize)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import type { MediaHeaderBox } from '../boxes/MediaHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.4.2 Media Header Box\n *\n * @param box - The MediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMdhd(box: MediaHeaderBox): IsoBoxWriteView {\n\tconst size = box.version === 1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst timesSize = size * 3 // creationTime, modificationTime, duration\n\tconst timescaleSize = 4\n\tconst languageSize = 2\n\tconst preDefined = 2\n\tconst totalSize = headerSize + fullBoxSize + timesSize + timescaleSize + languageSize + preDefined\n\n\tconst writer = new IsoBoxWriteView('mdhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.creationTime, size)\n\twriter.writeUint(box.modificationTime, size)\n\twriter.writeUint(box.timescale, 4)\n\twriter.writeUint(box.duration, size)\n\n\t// Encode ISO-639-2/T language code as 3 5-bit integers in a 16-bit value\n\t// Format: bits 14-10 (char1), bits 9-5 (char2), bits 4-0 (char3)\n\t// Each character code is (charCode - 0x60) to convert from ASCII to 5-bit value\n\tconst lang = box.language.length >= 3\n\t\t? (((box.language.charCodeAt(0) - 0x60) & 0x1F) << 10) |\n\t\t(((box.language.charCodeAt(1) - 0x60) & 0x1F) << 5) |\n\t\t((box.language.charCodeAt(2) - 0x60) & 0x1F)\n\t\t: 0 // Default to \"und\" (undefined) if invalid\n\twriter.writeUint(lang, 2)\n\n\twriter.writeUint(box.preDefined, 2)\n\n\treturn writer\n}\n","import type { MovieExtendsHeaderBox } from '../boxes/MovieExtendsHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieExtendsHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.2 Movie Extends Header Box\n *\n * @param box - The MovieExtendsHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMehd(box: MovieExtendsHeaderBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst fragmentDurationSize = size\n\tconst totalSize = headerSize + fullBoxSize + fragmentDurationSize\n\n\tconst writer = new IsoBoxWriteView('mehd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.fragmentDuration, size)\n\n\treturn writer\n}\n","import type { MetaBox } from '../boxes/MetaBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a MetaBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.11.1 Meta Box\n *\n * @param box - The MetaBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMeta(box: MetaBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\n\tconst totalSize = headerSize + fullBoxSize + size\n\n\tconst writer = new IsoBoxWriteView('meta', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { MovieFragmentHeaderBox } from '../boxes/MovieFragmentHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieFragmentHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.5 Movie Fragment Header Box\n *\n * @param box - The MovieFragmentHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMfhd(box: MovieFragmentHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst sequenceNumberSize = 4\n\tconst totalSize = headerSize + fullBoxSize + sequenceNumberSize\n\n\tconst writer = new IsoBoxWriteView('mfhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.sequenceNumber, 4)\n\n\treturn writer\n}\n","import type { MovieFragmentRandomAccessOffsetBox } from '../boxes/MovieFragmentRandomAccessOffsetBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieFragmentRandomAccessOffsetBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.11 Movie Fragment Random Access Offset Box\n *\n * @param box - The MovieFragmentRandomAccessOffsetBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMfro(box: MovieFragmentRandomAccessOffsetBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst mfraSizeSize = 4\n\tconst totalSize = headerSize + fullBoxSize + mfraSizeSize\n\n\tconst writer = new IsoBoxWriteView('mfro', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.mfraSize, 4)\n\n\treturn writer\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeAudioSampleEntryBox } from './writeAudioSampleEntryBox.ts'\n\n/**\n * Write an AudioSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.2.3 Audio Sample Entry\n *\n * @param box - The AudioSampleEntryBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMp4a(box: AudioSampleEntryBox<'mp4a'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeAudioSampleEntryBox(box, config)\n}\n","import type { MovieHeaderBox } from '../boxes/MovieHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.2.2 Movie Header Box\n *\n * @param box - The MovieHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMvhd(box: MovieHeaderBox): IsoBoxWriteView {\n\tconst size = box.version === 1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst timesSize = size * 3 // creationTime, modificationTime, duration\n\tconst timescaleSize = 4\n\tconst rateSize = 4\n\tconst volumeSize = 2\n\tconst reserved1Size = 2\n\tconst reserved2Size = 8 // 2 x 4 bytes\n\tconst matrixSize = 36 // 9 x 4 bytes\n\tconst preDefinedSize = 24 // 6 x 4 bytes\n\tconst nextTrackIdSize = 4\n\n\tconst totalSize = headerSize + fullBoxSize + timesSize + timescaleSize + rateSize +\n\t\tvolumeSize + reserved1Size + reserved2Size + matrixSize + preDefinedSize + nextTrackIdSize\n\n\tconst writer = new IsoBoxWriteView('mvhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.creationTime, size)\n\twriter.writeUint(box.modificationTime, size)\n\twriter.writeUint(box.timescale, 4)\n\twriter.writeUint(box.duration, size)\n\twriter.writeTemplate(box.rate, 4)\n\twriter.writeTemplate(box.volume, 2)\n\twriter.writeUint(box.reserved1, 2)\n\twriter.writeArray(box.reserved2, UINT, 4, 2)\n\twriter.writeArray(box.matrix, TEMPLATE, 4, 9)\n\twriter.writeArray(box.preDefined, UINT, 4, 6)\n\twriter.writeUint(box.nextTrackId, 4)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttCuePayloadBox } from '../boxes/WebVttCuePayloadBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttCuePayloadBox to an IsoDataWriter.\n *\n * @param box - The WebVttCuePayloadBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePayl(box: WebVttCuePayloadBox): IsoBoxWriteView {\n\tconst cueTextBytes = encodeText(box.cueText)\n\n\tconst headerSize = 8\n\tconst cueTextSize = cueTextBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + cueTextSize\n\n\tconst writer = new IsoBoxWriteView('payl', totalSize)\n\twriter.writeUtf8TerminatedString(box.cueText)\n\n\treturn writer\n}\n","import type { ProducerReferenceTimeBox } from '../boxes/ProducerReferenceTimeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a ProducerReferenceTimeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.5 Producer Reference Time Box\n *\n * @param box - The ProducerReferenceTimeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePrft(box: ProducerReferenceTimeBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst mediaTimeSize = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst referenceTrackIdSize = 4\n\tconst ntpTimestampSecSize = 4\n\tconst ntpTimestampFracSize = 4\n\tconst totalSize = headerSize + fullBoxSize + referenceTrackIdSize +\n\t\tntpTimestampSecSize + ntpTimestampFracSize + mediaTimeSize\n\n\tconst writer = new IsoBoxWriteView('prft', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.referenceTrackId, 4)\n\twriter.writeUint(box.ntpTimestampSec, 4)\n\twriter.writeUint(box.ntpTimestampFrac, 4)\n\twriter.writeUint(box.mediaTime, mediaTimeSize)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { PreselectionGroupBox } from '../boxes/PreselectionGroupBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a PreselectionGroupBox to an IsoDataWriter.\n *\n * @param box - The PreselectionGroupBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePrsl(box: PreselectionGroupBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst preselectionTagBytes = (box.flags & 0x1000) && box.preselectionTag\n\t\t? encodeText(box.preselectionTag)\n\t\t: null\n\tconst interleavingTagBytes = (box.flags & 0x4000) && box.interleavingTag\n\t\t? encodeText(box.interleavingTag)\n\t\t: null\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst groupIdSize = 4\n\tconst numEntitiesInGroupSize = 4\n\tconst entitiesSize = box.numEntitiesInGroup * 4\n\tconst preselectionTagSize = preselectionTagBytes ? preselectionTagBytes.length + 1 : 0\n\tconst selectionPrioritySize = (box.flags & 0x2000) ? 1 : 0\n\tconst interleavingTagSize = interleavingTagBytes ? interleavingTagBytes.length + 1 : 0\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\n\tconst totalSize = headerSize + fullBoxSize + groupIdSize + numEntitiesInGroupSize +\n\t\tentitiesSize + preselectionTagSize + selectionPrioritySize + interleavingTagSize + size\n\n\tconst writer = new IsoBoxWriteView('prsl', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.groupId, 4)\n\twriter.writeUint(box.numEntitiesInGroup, 4)\n\n\tfor (const entity of box.entities) {\n\t\twriter.writeUint(entity.entityId, 4)\n\t}\n\n\tif (preselectionTagBytes && box.preselectionTag) {\n\t\twriter.writeUtf8TerminatedString(box.preselectionTag)\n\t}\n\n\tif (box.flags & 0x2000) {\n\t\twriter.writeUint(box.selectionPriority ?? 0, 1)\n\t}\n\n\tif (interleavingTagBytes && box.interleavingTag) {\n\t\twriter.writeUtf8TerminatedString(box.interleavingTag)\n\t}\n\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { ProtectionSystemSpecificHeaderBox } from '../boxes/ProtectionSystemSpecificHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a ProtectionSystemSpecificHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 23001-7 - 8.1 Protection System Specific Header Box\n *\n * @param box - The ProtectionSystemSpecificHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePssh(box: ProtectionSystemSpecificHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst systemIdSize = 16\n\tconst kidCountSize = box.version > 0 ? 4 : 0\n\tconst kidSize = box.version > 0 ? box.kidCount * 16 : 0\n\tconst dataSizeField = 4\n\tconst dataSize = box.dataSize\n\tconst totalSize = headerSize + fullBoxSize + systemIdSize + kidCountSize + kidSize + dataSizeField + dataSize\n\n\tconst writer = new IsoBoxWriteView('pssh', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeArray(box.systemId, UINT, 1, 16)\n\n\tif (box.version > 0) {\n\t\twriter.writeUint(box.kidCount, 4)\n\t\twriter.writeArray(box.kid, UINT, 1, box.kidCount)\n\t}\n\n\twriter.writeUint(box.dataSize, 4)\n\twriter.writeArray(box.data, UINT, 1, box.dataSize)\n\n\treturn writer\n}\n","import type { SchemeTypeBox } from '../boxes/SchemeTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SchemeTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.12.5 Scheme Type Box\n *\n * @param box - The SchemeTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSchm(box: SchemeTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst schemeTypeSize = 4\n\tconst schemeVersionSize = 4\n\tconst schemeUriSize = (box.flags & 0x000001) && box.schemeUri ? box.schemeUri.length + 1 : 0\n\tconst totalSize = headerSize + fullBoxSize + schemeTypeSize + schemeVersionSize + schemeUriSize\n\n\tconst writer = new IsoBoxWriteView('schm', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.schemeType, 4)\n\twriter.writeUint(box.schemeVersion, 4)\n\n\tif ((box.flags & 0x000001) && box.schemeUri) {\n\t\twriter.writeTerminatedString(box.schemeUri)\n\t}\n\n\treturn writer\n}\n","import type { SampleDependencyTypeBox } from '../boxes/SampleDependencyTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SampleDependencyTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.4 Independent and Disposable Samples Box\n *\n * @param box - The SampleDependencyTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSdtp(box: SampleDependencyTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst sampleDependencyTableSize = box.sampleDependencyTable.length\n\tconst totalSize = headerSize + fullBoxSize + sampleDependencyTableSize\n\n\tconst writer = new IsoBoxWriteView('sdtp', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\tfor (const entry of box.sampleDependencyTable) {\n\t\twriter.writeUint(entry, 1)\n\t}\n\n\treturn writer\n}\n","import type { SegmentIndexBox } from '../boxes/SegmentIndexBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SegmentIndexBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.3 Segment Index Box\n *\n * @param box - The SegmentIndexBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSidx(box: SegmentIndexBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst referenceIdSize = 4\n\tconst timescaleSize = 4\n\tconst earliestPresentationTimeSize = size\n\tconst firstOffsetSize = size\n\tconst reservedSize = 2\n\tconst referenceCountSize = 2\n\tconst referencesSize = box.references.length * 12 // 3 x 4 bytes per reference\n\tconst totalSize = headerSize + fullBoxSize + referenceIdSize + timescaleSize +\n\t\tearliestPresentationTimeSize + firstOffsetSize + reservedSize + referenceCountSize + referencesSize\n\n\tconst writer = new IsoBoxWriteView('sidx', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.referenceId, 4)\n\twriter.writeUint(box.timescale, 4)\n\twriter.writeUint(box.earliestPresentationTime, size)\n\twriter.writeUint(box.firstOffset, size)\n\twriter.writeUint(box.reserved ?? 0, 2)\n\twriter.writeUint(box.references.length, 2)\n\n\tfor (const ref of box.references) {\n\t\t// Pack referenceType (1 bit) + referencedSize (31 bits)\n\t\tconst reference = ((ref.referenceType & 0x1) << 31) | (ref.referencedSize & 0x7FFFFFFF)\n\t\twriter.writeUint(reference, 4)\n\n\t\twriter.writeUint(ref.subsegmentDuration, 4)\n\n\t\t// Pack startsWithSap (1 bit) + sapType (3 bits) + sapDeltaTime (28 bits)\n\t\tconst sap = ((ref.startsWithSap & 0x1) << 31) | ((ref.sapType & 0x7) << 28) | (ref.sapDeltaTime & 0x0FFFFFFF)\n\t\twriter.writeUint(sap, 4)\n\t}\n\n\treturn writer\n}\n","import type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a FreeSpaceBox (skip variant) to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.1.2 Free Space Box\n *\n * @param box - The FreeSpaceBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSkip(box: FreeSpaceBox<'skip'>): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('skip', totalSize)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import type { SoundMediaHeaderBox } from '../boxes/SoundMediaHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SoundMediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.2.2 Sound Media Header Box\n *\n * @param box - The SoundMediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSmhd(box: SoundMediaHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst balanceSize = 2\n\tconst reservedSize = 2\n\tconst totalSize = headerSize + fullBoxSize + balanceSize + reservedSize\n\n\tconst writer = new IsoBoxWriteView('smhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.balance, 2)\n\twriter.writeUint(box.reserved, 2)\n\n\treturn writer\n}\n","import type { SubsegmentIndexBox } from '../boxes/SubsegmentIndexBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SubsegmentIndexBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.4 Subsegment Index Box\n *\n * @param box - The SubsegmentIndexBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSsix(box: SubsegmentIndexBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst subsegmentCountSize = 4\n\n\tlet rangesSize = 0\n\tfor (const subsegment of box.subsegments) {\n\t\trangesSize += 4 // rangesCount\n\t\trangesSize += subsegment.rangesCount * 4 // level (1) + rangeSize (3) per range\n\t}\n\n\tconst totalSize = headerSize + fullBoxSize + subsegmentCountSize + rangesSize\n\n\tconst writer = new IsoBoxWriteView('ssix', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.subsegmentCount, 4)\n\n\tfor (const subsegment of box.subsegments) {\n\t\twriter.writeUint(subsegment.rangesCount, 4)\n\n\t\tfor (const range of subsegment.ranges) {\n\t\t\twriter.writeUint(range.level, 1)\n\t\t\twriter.writeUint(range.rangeSize, 3)\n\t\t}\n\t}\n\n\treturn writer\n}\n","import type { SubtitleMediaHeaderBox } from '../boxes/SubtitleMediaHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SubtitleMediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.6.2 Subtitle Media Header Box\n *\n * @param box - The SubtitleMediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSthd(box: SubtitleMediaHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst totalSize = headerSize + fullBoxSize\n\n\tconst writer = new IsoBoxWriteView('sthd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\treturn writer\n}\n","import type { SampleDescriptionBox } from '../boxes/SampleDescriptionBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a SampleDescriptionBox to an IsoDataWriter.\n *\n * @param box - The SampleDescriptionBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStsd(box: SampleDescriptionBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entryCount = box.entries.length\n\n\t// TODO: Is there a way to avoid creating the intermediate Uint8Arrays?\n\tconst { bytes, size } = writeChildBoxes(box.entries, config)\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + size\n\n\tconst writer = new IsoBoxWriteView('stsd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(entryCount, 4)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { SyncSampleBox } from '../boxes/SyncSampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SyncSampleBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.2 Sync Sample Box\n *\n * @param box - The SyncSampleBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStss(box: SyncSampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entriesSize = box.entryCount * 4\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('stss', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleNumber, 4)\n\t}\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttSettingsBox } from '../boxes/WebVttSettingsBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttSettingsBox to an IsoDataWriter.\n *\n * @param box - The WebVttSettingsBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSttg(box: WebVttSettingsBox): IsoBoxWriteView {\n\tconst settingsBytes = encodeText(box.settings)\n\n\tconst headerSize = 8\n\tconst settingsSize = settingsBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + settingsSize\n\n\tconst writer = new IsoBoxWriteView('sttg', totalSize)\n\twriter.writeUtf8TerminatedString(box.settings)\n\n\treturn writer\n}\n","import type { DecodingTimeToSampleBox } from '../boxes/DecodingTimeToSampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a DecodingTimeToSampleBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.1.2 Decoding Time to Sample Box\n *\n * @param box - The DecodingTimeToSampleBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStts(box: DecodingTimeToSampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entriesSize = box.entryCount * 8 // 4 bytes sampleCount + 4 bytes sampleDelta\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('stts', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleCount, 4)\n\t\twriter.writeUint(entry.sampleDelta, 4)\n\t}\n\n\treturn writer\n}\n","import type { SegmentTypeBox } from '../boxes/SegmentTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SegmentTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.2 Segment Type Box\n *\n * @param box - The SegmentTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStyp(box: SegmentTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst majorBrandSize = 4\n\tconst minorVersionSize = 4\n\tconst compatibleBrandsSize = box.compatibleBrands.length * 4\n\tconst totalSize = headerSize + majorBrandSize + minorVersionSize + compatibleBrandsSize\n\n\tconst writer = new IsoBoxWriteView('styp', totalSize)\n\twriter.writeString(box.majorBrand)\n\twriter.writeUint(box.minorVersion, 4)\n\n\tfor (const brand of box.compatibleBrands) {\n\t\twriter.writeString(brand)\n\t}\n\n\treturn writer\n}\n","import type { SubsampleInformationBox } from '../boxes/SubsampleInformationBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SubsampleInformationBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.7.7 Sub-Sample Information Box\n *\n * @param box - The SubsampleInformationBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSubs(box: SubsampleInformationBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst subsampleSizeBytes = v1 ? 4 : 2\n\n\tlet entriesSize = 0\n\tfor (const entry of box.entries) {\n\t\tentriesSize += 4 // sampleDelta\n\t\tentriesSize += 2 // subsampleCount\n\t\tentriesSize += entry.subsampleCount * (subsampleSizeBytes + 1 + 1 + 4) // size + priority + discardable + codecSpecificParameters\n\t}\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('subs', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleDelta, 4)\n\t\twriter.writeUint(entry.subsampleCount, 2)\n\n\t\tfor (const subsample of entry.subsamples) {\n\t\t\twriter.writeUint(subsample.subsampleSize, subsampleSizeBytes)\n\t\t\twriter.writeUint(subsample.subsamplePriority, 1)\n\t\t\twriter.writeUint(subsample.discardable, 1)\n\t\t\twriter.writeUint(subsample.codecSpecificParameters, 4)\n\t\t}\n\t}\n\n\treturn writer\n}\n","import type { TrackEncryptionBox } from '../boxes/TrackEncryptionBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackEncryptionBox to an IsoDataWriter.\n *\n * ISO/IEC 23001-7 - 8.2 Track Encryption Box\n *\n * @param box - The TrackEncryptionBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTenc(box: TrackEncryptionBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst defaultIsEncryptedSize = 3\n\tconst defaultIvSizeSize = 1\n\tconst defaultKidSize = 16\n\tconst totalSize = headerSize + fullBoxSize + defaultIsEncryptedSize + defaultIvSizeSize + defaultKidSize\n\n\tconst writer = new IsoBoxWriteView('tenc', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.defaultIsEncrypted, 3)\n\twriter.writeUint(box.defaultIvSize, 1)\n\twriter.writeArray(box.defaultKid, UINT, 1, 16)\n\n\treturn writer\n}\n","import type { TrackFragmentBaseMediaDecodeTimeBox } from '../boxes/TrackFragmentBaseMediaDecodeTimeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackFragmentBaseMediaDecodeTimeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.12 Track Fragment Base Media Decode Time Box\n *\n * @param box - The TrackFragmentBaseMediaDecodeTimeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTfdt(box: TrackFragmentBaseMediaDecodeTimeBox): IsoBoxWriteView {\n\tconst size = box.version === 1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst baseMediaDecodeTimeSize = size\n\tconst totalSize = headerSize + fullBoxSize + baseMediaDecodeTimeSize\n\n\tconst writer = new IsoBoxWriteView('tfdt', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.baseMediaDecodeTime, size)\n\n\treturn writer\n}\n","import type { TrackFragmentHeaderBox } from '../boxes/TrackFragmentHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackFragmentHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.7 Track Fragment Header Box\n *\n * @param box - The TrackFragmentHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTfhd(box: TrackFragmentHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst trackIdSize = 4\n\tconst baseDataOffsetSize = (box.flags & 0x01) ? 8 : 0\n\tconst sampleDescriptionIndexSize = (box.flags & 0x02) ? 4 : 0\n\tconst defaultSampleDurationSize = (box.flags & 0x08) ? 4 : 0\n\tconst defaultSampleSizeSize = (box.flags & 0x10) ? 4 : 0\n\tconst defaultSampleFlagsSize = (box.flags & 0x20) ? 4 : 0\n\tconst totalSize = headerSize + fullBoxSize + trackIdSize + baseDataOffsetSize +\n\t\tsampleDescriptionIndexSize + defaultSampleDurationSize + defaultSampleSizeSize + defaultSampleFlagsSize\n\n\tconst writer = new IsoBoxWriteView('tfhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.trackId, 4)\n\n\tif (box.flags & 0x01) {\n\t\twriter.writeUint(box.baseDataOffset ?? 0, 8)\n\t}\n\n\tif (box.flags & 0x02) {\n\t\twriter.writeUint(box.sampleDescriptionIndex ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x08) {\n\t\twriter.writeUint(box.defaultSampleDuration ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x10) {\n\t\twriter.writeUint(box.defaultSampleSize ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x20) {\n\t\twriter.writeUint(box.defaultSampleFlags ?? 0, 4)\n\t}\n\n\treturn writer\n}\n","import type { TrackFragmentRandomAccessBox } from '../boxes/TrackFragmentRandomAccessBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackFragmentRandomAccessBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.10 Track Fragment Random Access Box\n *\n * @param box - The TrackFragmentRandomAccessBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTfra(box: TrackFragmentRandomAccessBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst timeSize = v1 ? 8 : 4\n\tconst entrySize = timeSize + timeSize + // time + moofOffset\n\t\t(box.lengthSizeOfTrafNum + 1) +\n\t\t(box.lengthSizeOfTrunNum + 1) +\n\t\t(box.lengthSizeOfSampleNum + 1)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst trackIdSize = 4\n\tconst reservedSize = 4\n\tconst numberOfEntrySize = 4\n\tconst entriesSize = box.numberOfEntry * entrySize\n\tconst totalSize = headerSize + fullBoxSize + trackIdSize + reservedSize + numberOfEntrySize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('tfra', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.trackId, 4)\n\n\t// Pack reserved with length sizes\n\tconst reserved = (box.lengthSizeOfTrafNum << 4) | (box.lengthSizeOfTrunNum << 2) | box.lengthSizeOfSampleNum\n\twriter.writeUint(reserved, 4)\n\n\twriter.writeUint(box.numberOfEntry, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.time, timeSize)\n\t\twriter.writeUint(entry.moofOffset, timeSize)\n\t\twriter.writeUint(entry.trafNumber, box.lengthSizeOfTrafNum + 1)\n\t\twriter.writeUint(entry.trunNumber, box.lengthSizeOfTrunNum + 1)\n\t\twriter.writeUint(entry.sampleNumber, box.lengthSizeOfSampleNum + 1)\n\t}\n\n\treturn writer\n}\n","import type { TrackHeaderBox } from '../boxes/TrackHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.3.2 Track Header Box\n *\n * @param box - The TrackHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTkhd(box: TrackHeaderBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst timesSize = size * 3 // creationTime, modificationTime, duration\n\tconst trackIdSize = 4\n\tconst reserved1Size = 4\n\tconst reserved2Size = 8 // 2 x 4 bytes\n\tconst layerSize = 2\n\tconst alternateGroupSize = 2\n\tconst volumeSize = 2\n\tconst reserved3Size = 2\n\tconst matrixSize = 36 // 9 x 4 bytes\n\tconst widthSize = 4\n\tconst heightSize = 4\n\n\tconst totalSize = headerSize + fullBoxSize + timesSize + trackIdSize + reserved1Size +\n\t\treserved2Size + layerSize + alternateGroupSize + volumeSize + reserved3Size +\n\t\tmatrixSize + widthSize + heightSize\n\n\tconst writer = new IsoBoxWriteView('tkhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.creationTime, size)\n\twriter.writeUint(box.modificationTime, size)\n\twriter.writeUint(box.trackId, 4)\n\twriter.writeUint(box.reserved1, 4)\n\twriter.writeUint(box.duration, size)\n\twriter.writeArray(box.reserved2, UINT, 4, 2)\n\twriter.writeUint(box.layer, 2)\n\twriter.writeUint(box.alternateGroup, 2)\n\twriter.writeTemplate(box.volume, 2)\n\twriter.writeUint(box.reserved3, 2)\n\twriter.writeArray(box.matrix, TEMPLATE, 4, 9)\n\twriter.writeTemplate(box.width, 4)\n\twriter.writeTemplate(box.height, 4)\n\n\treturn writer\n}\n","import type { TrackExtendsBox } from '../boxes/TrackExtendsBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackExtendsBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.3 Track Extends Box\n *\n * @param box - The TrackExtendsBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTrex(box: TrackExtendsBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst trackIdSize = 4\n\tconst defaultSampleDescriptionIndexSize = 4\n\tconst defaultSampleDurationSize = 4\n\tconst defaultSampleSizeSize = 4\n\tconst defaultSampleFlagsSize = 4\n\tconst totalSize = headerSize + fullBoxSize + trackIdSize + defaultSampleDescriptionIndexSize +\n\t\tdefaultSampleDurationSize + defaultSampleSizeSize + defaultSampleFlagsSize\n\n\tconst writer = new IsoBoxWriteView('trex', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.trackId, 4)\n\twriter.writeUint(box.defaultSampleDescriptionIndex, 4)\n\twriter.writeUint(box.defaultSampleDuration, 4)\n\twriter.writeUint(box.defaultSampleSize, 4)\n\twriter.writeUint(box.defaultSampleFlags, 4)\n\n\treturn writer\n}\n","import type { TrackRunBox } from '../boxes/TrackRunBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackRunBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.8 Track Run Box\n *\n * @param box - The TrackRunBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTrun(box: TrackRunBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst sampleCountSize = 4\n\tconst dataOffsetSize = (box.flags & 0x1) ? 4 : 0\n\tconst firstSampleFlagsSize = (box.flags & 0x4) ? 4 : 0\n\n\tlet sampleSize = 0\n\tif (box.flags & 0x100) sampleSize += 4 // sampleDuration\n\tif (box.flags & 0x200) sampleSize += 4 // sampleSize\n\tif (box.flags & 0x400) sampleSize += 4 // sampleFlags\n\tif (box.flags & 0x800) sampleSize += 4 // sampleCompositionTimeOffset\n\n\tconst samplesSize = sampleSize * box.sampleCount\n\tconst totalSize = headerSize + fullBoxSize + sampleCountSize + dataOffsetSize + firstSampleFlagsSize + samplesSize\n\n\tconst writer = new IsoBoxWriteView('trun', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.sampleCount, 4)\n\n\tif (box.flags & 0x1) {\n\t\twriter.writeUint(box.dataOffset ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x4) {\n\t\twriter.writeUint(box.firstSampleFlags ?? 0, 4)\n\t}\n\n\tfor (const sample of box.samples) {\n\t\tif (box.flags & 0x100) {\n\t\t\twriter.writeUint(sample.sampleDuration ?? 0, 4)\n\t\t}\n\t\tif (box.flags & 0x200) {\n\t\t\twriter.writeUint(sample.sampleSize ?? 0, 4)\n\t\t}\n\t\tif (box.flags & 0x400) {\n\t\t\twriter.writeUint(sample.sampleFlags ?? 0, 4)\n\t\t}\n\t\tif (box.flags & 0x800) {\n\t\t\twriter.writeUint(sample.sampleCompositionTimeOffset ?? 0, 4)\n\t\t}\n\t}\n\n\treturn writer\n}\n","import type { DataEntryUrlBox } from '../boxes/DataEntryUrlBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a UrlBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box\n *\n * @param box - The UrlBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeUrl(box: DataEntryUrlBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst locationSize = box.location.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + locationSize\n\n\tconst writer = new IsoBoxWriteView('url ', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeTerminatedString(box.location)\n\n\treturn writer\n}\n","import type { DataEntryUrnBox } from '../boxes/DataEntryUrnBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a UrnBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box\n *\n * @param box - The UrnBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeUrn(box: DataEntryUrnBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst nameSize = box.name.length + 1 // null-terminated\n\tconst locationSize = box.location.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + nameSize + locationSize\n\n\tconst writer = new IsoBoxWriteView('urn ', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeTerminatedString(box.name)\n\twriter.writeTerminatedString(box.location)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttSourceLabelBox } from '../boxes/WebVttSourceLabelBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttSourceLabelBox to an IsoDataWriter.\n *\n * @param box - The WebVttSourceLabelBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVlab(box: WebVttSourceLabelBox): IsoBoxWriteView {\n\tconst sourceLabelBytes = encodeText(box.sourceLabel)\n\n\tconst headerSize = 8\n\tconst sourceLabelSize = sourceLabelBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + sourceLabelSize\n\n\tconst writer = new IsoBoxWriteView('vlab', totalSize)\n\twriter.writeUtf8TerminatedString(box.sourceLabel)\n\n\treturn writer\n}\n","import type { VideoMediaHeaderBox } from '../boxes/VideoMediaHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a VideoMediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.1.2 Video Media Header Box\n *\n * @param box - The VideoMediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVmhd(box: VideoMediaHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst graphicsmodeSize = 2\n\tconst opcolorSize = 6 // 3 x 2 bytes\n\tconst totalSize = headerSize + fullBoxSize + graphicsmodeSize + opcolorSize\n\n\tconst writer = new IsoBoxWriteView('vmhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.graphicsmode, 2)\n\twriter.writeArray(box.opcolor, UINT, 2, 3)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttConfigurationBox } from '../boxes/WebVttConfigurationBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttConfigurationBox to an IsoDataWriter.\n *\n * @param box - The WebVttConfigurationBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVttC(box: WebVttConfigurationBox): IsoBoxWriteView {\n\tconst configBytes = encodeText(box.config)\n\n\tconst headerSize = 8\n\tconst configSize = configBytes.length\n\tconst totalSize = headerSize + configSize\n\n\tconst writer = new IsoBoxWriteView('vttC', totalSize)\n\twriter.writeBytes(configBytes)\n\n\treturn writer\n}\n","import type { WebVttEmptySampleBox } from '../boxes/WebVttEmptySampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttEmptySampleBox to an IsoDataWriter.\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\n// eslint-disable-next-line\nexport function writeVtte(_: WebVttEmptySampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst totalSize = headerSize\n\n\tconst writer = new IsoBoxWriteView('vtte', totalSize)\n\treturn writer\n}\n"],"mappings":";;;AAEA,SAAgB,mBAAmB,QAA0E;AAC5G,QAAO,EACN,SAAS,QAAQ,WAAW,EAAE,EAC9B;;;;;;;;;;ACAF,MAAaA,aAAuB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;ACXD,SAAgB,YAAY,KAA2C;AACtE,QAAO,WAAW,OAAO,WAAW,SAAS,IAAI,KAAK;;;;;;;;;;ACVvD,MAAa,WAAW;;;;;;;;;ACAxB,MAAa,OAAO;;;;;;;;;ACKpB,IAAa,kBAAb,MAA6B;;;;;;CAS5B,YAAY,MAAc,MAAc;oBAuC3B,OAAe,WAAuB;GAClD,MAAM,EAAE,UAAU,WAAW;AAE7B,WAAQC,QAAR;IACC,KAAK;AACJ,cAAS,SAAS,QAAQ,MAAM;AAChC;IAED,KAAK;AACJ,cAAS,UAAU,QAAQ,MAAM;AACjC;IAED,KAAK,GAAG;KACP,MAAM,MAAM,QAAQ,aAAa;KACjC,MAAM,KAAM,QAAQ;AACpB,cAAS,UAAU,QAAQ,GAAG;AAC9B,cAAS,SAAS,SAAS,GAAG,GAAG;AACjC;;IAGD,KAAK;AACJ,cAAS,UAAU,QAAQ,MAAM;AACjC;IAED,KAAK,GAAG;KAGP,MAAM,KAAK,KAAK,MAAM,QAAQ,K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AAK,SAAS;CACnC,MAAM,eAAe,IAAI,SAAS,SAAS;CAG3C,MAAM,SAAS,IAAI,gBAAgB,QAFjB,aAAa,cAAc,WAAW,aAEH;AACrD,QAAO,aAAa,IAAI,SAAS,IAAI,MAAM;AAC3C,QAAO,sBAAsB,IAAI,KAAK;AACtC,QAAO,sBAAsB,IAAI,SAAS;AAE1C,QAAO;;;;;;;;;;;;;;ACbR,SAAgB,UAAU,KAA4C;CAOrE,MAAM,SAAS,IAAI,gBAAgB,QAJhB,KAFM,WAAW,IAAI,YAAY,CAGX,SAAS,GAGG;AACrD,QAAO,0BAA0B,IAAI,YAAY;AAEjD,QAAO;;;;;;;;;;;;;;;;ACRR,SAAgB,UAAU,KAA2C;CAOpE,MAAM,SAAS,IAAI,gBAAgB,QAFjB,GAEmC;AACrD,QAAO,aAAa,IAAI,SAAS,IAAI,MAAM;AAE3C,QAAO,UAAU,IAAI,cAAc,EAAE;AACrC,QAAO,WAAW,IAAI,SAAS,MAAM,GAAG,EAAE;AAE1C,QAAO;;;;;;;;;;;;;;ACfR,SAAgB,UAAU,KAA8C;CACvE,MAAM,cAAc,WAAW,IAAI,OAAO;CAM1C,MAAM,SAAS,IAAI,gBAAgB,QAJhB,IACA,YAAY,OAGsB;AACrD,QAAO,WAAW,YAAY;AAE9B,QAAO;;;;;;;;;;;;ACZR,SAAgB,UAAU,GAA0C;AAKnE,QADe,IAAI,gBAAgB,QAHhB,EAGkC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["CONTAINERS: string[]","size","type","view: ArrayBufferView | null","queue: [Iterable<ParsedIsoBox>, number][]","result: T[]","value: number","s1: number","s2: number","result: any","result: T[]","readUint","readTemplate","readUint","readTemplate","readInt","readUint","readString","readData","readUint","readTemplate","kidCount: number","kid: number[]","readUint","readUint","dataOffset: number | undefined","firstSampleFlags: number | undefined","sample: TrackRunSample","contentSize: number"],"sources":["../src/utils/createWriterConfig.ts","../src/utils/CONTAINERS.ts","../src/utils/isContainer.ts","../src/fields/TEMPLATE.ts","../src/fields/UINT.ts","../src/IsoBoxWriteView.ts","../src/utils/writeBoxes.ts","../src/utils/writeChildBoxes.ts","../src/utils/writeContainerBox.ts","../src/utils/writeBox.ts","../src/writeIsoBox.ts","../src/IsoBoxReadableStream.ts","../src/createIsoBoxReadableStream.ts","../src/traverseIsoBoxes.ts","../src/filterIsoBoxes.ts","../src/findIsoBox.ts","../src/fields/DATA.ts","../src/fields/INT.ts","../src/fields/STRING.ts","../src/fields/UTF8.ts","../src/utils/readData.ts","../src/utils/readInt.ts","../src/utils/readUint.ts","../src/utils/readString.ts","../src/utils/readTemplate.ts","../src/utils/readTerminatedString.ts","../src/utils/readUtf8String.ts","../src/utils/readUtf8TerminatedString.ts","../src/IsoBoxReadView.ts","../src/readIsoBoxes.ts","../src/writeIsoBoxes.ts","../src/readers/readAudioSampleEntryBox.ts","../src/readers/createAudioSampleEntryReader.ts","../src/readers/readVisualSampleEntryBox.ts","../src/readers/createVisualSampleEntryReader.ts","../src/readers/readArdi.ts","../src/readers/readAvc1.ts","../src/readers/readAvc2.ts","../src/readers/readAvc3.ts","../src/readers/readAvc4.ts","../src/readers/readCtts.ts","../src/readers/readDref.ts","../src/readers/readElng.ts","../src/readers/readElst.ts","../src/readers/readEmsg.ts","../src/readers/readEnca.ts","../src/readers/readEncv.ts","../src/readers/readFree.ts","../src/readers/readFrma.ts","../src/readers/readFtyp.ts","../src/readers/readHdlr.ts","../src/readers/readHev1.ts","../src/readers/readHvc1.ts","../src/readers/readIden.ts","../src/readers/readImda.ts","../src/readers/readKind.ts","../src/readers/readLabl.ts","../src/readers/readMdat.ts","../src/readers/readMdhd.ts","../src/readers/readMehd.ts","../src/readers/readMeta.ts","../src/readers/readMfhd.ts","../src/readers/readMfro.ts","../src/readers/readMp4a.ts","../src/readers/readMvhd.ts","../src/readers/readPayl.ts","../src/readers/readPrft.ts","../src/readers/readPrsl.ts","../src/readers/readPssh.ts","../src/readers/readSchm.ts","../src/readers/readSdtp.ts","../src/readers/readSidx.ts","../src/readers/readSkip.ts","../src/readers/readSmhd.ts","../src/readers/readSsix.ts","../src/readers/readSthd.ts","../src/readers/readStsd.ts","../src/readers/readStss.ts","../src/readers/readSttg.ts","../src/readers/readStts.ts","../src/readers/readStyp.ts","../src/readers/readSubs.ts","../src/readers/readTenc.ts","../src/readers/readTfdt.ts","../src/readers/readTfhd.ts","../src/readers/readTfra.ts","../src/readers/readTkhd.ts","../src/readers/readTrex.ts","../src/readers/readTrun.ts","../src/readers/readUrl.ts","../src/readers/readUrn.ts","../src/readers/readVlab.ts","../src/readers/readVmhd.ts","../src/readers/readVttC.ts","../src/readers/readVtte.ts","../src/utils/isFullBox.ts","../src/writers/writeArdi.ts","../src/writers/writeAudioSampleEntryBox.ts","../src/writers/writeVisualSampleEntryBox.ts","../src/writers/writeAvc1.ts","../src/writers/writeAvc2.ts","../src/writers/writeAvc3.ts","../src/writers/writeAvc4.ts","../src/writers/writeCtts.ts","../src/writers/writeDref.ts","../src/writers/writeElng.ts","../src/writers/writeElst.ts","../src/writers/writeEmsg.ts","../src/writers/writeEnca.ts","../src/writers/writeEncv.ts","../src/writers/writeFree.ts","../src/writers/writeFrma.ts","../src/writers/writeFtyp.ts","../src/writers/writeHdlr.ts","../src/writers/writeHev1.ts","../src/writers/writeHvc1.ts","../src/writers/writeIden.ts","../src/writers/writeImda.ts","../src/writers/writeKind.ts","../src/writers/writeLabl.ts","../src/writers/writeMdat.ts","../src/writers/writeMdhd.ts","../src/writers/writeMehd.ts","../src/writers/writeMeta.ts","../src/writers/writeMfhd.ts","../src/writers/writeMfro.ts","../src/writers/writeMp4a.ts","../src/writers/writeMvhd.ts","../src/writers/writePayl.ts","../src/writers/writePrft.ts","../src/writers/writePrsl.ts","../src/writers/writePssh.ts","../src/writers/writeSchm.ts","../src/writers/writeSdtp.ts","../src/writers/writeSidx.ts","../src/writers/writeSkip.ts","../src/writers/writeSmhd.ts","../src/writers/writeSsix.ts","../src/writers/writeSthd.ts","../src/writers/writeStsd.ts","../src/writers/writeStss.ts","../src/writers/writeSttg.ts","../src/writers/writeStts.ts","../src/writers/writeStyp.ts","../src/writers/writeSubs.ts","../src/writers/writeTenc.ts","../src/writers/writeTfdt.ts","../src/writers/writeTfhd.ts","../src/writers/writeTfra.ts","../src/writers/writeTkhd.ts","../src/writers/writeTrex.ts","../src/writers/writeTrun.ts","../src/writers/writeUrl.ts","../src/writers/writeUrn.ts","../src/writers/writeVlab.ts","../src/writers/writeVmhd.ts","../src/writers/writeVttC.ts","../src/writers/writeVtte.ts"],"sourcesContent":["import type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\n\nexport function createWriterConfig(config?: Partial<IsoBoxWriteViewConfig>): Required<IsoBoxWriteViewConfig> {\n\treturn {\n\t\twriters: config?.writers ?? {},\n\t}\n}\n","/**\n * List of container box types\n *\n * @public\n */\nexport const CONTAINERS: string[] = [\n\t'dinf',\n\t'edts',\n\t'grpl',\n\t'mdia',\n\t'meco',\n\t'mfra',\n\t'minf',\n\t'moof',\n\t'moov',\n\t'mvex',\n\t'schi',\n\t'sinf',\n\t'stbl',\n\t'strk',\n\t'traf',\n\t'trak',\n\t'tref',\n\t'udta',\n\t'vttc',\n]\n","import type { Box } from '../boxes/Box.ts'\nimport type { IsoBox } from '../IsoBox.ts'\nimport type { IsoBoxContainer } from '../IsoBoxContainer.ts'\nimport { CONTAINERS } from './CONTAINERS.ts'\n\n/**\n * Check if a box is a container\n *\n * @param box - The box to check\n *\n * @returns `true` if the box is a container, `false` otherwise\n *\n * @public\n */\nexport function isContainer<T extends IsoBox | Box<IsoBox['type']>>(box: T): box is T & IsoBoxContainer {\n\treturn 'boxes' in box || CONTAINERS.includes(box.type)\n}\n","/**\n * The template field type\n *\n * @public\n */\nexport const TEMPLATE = 'template'\n","/**\n * The unsigned integer field type\n *\n * @public\n */\nexport const UINT = 'uint'\n","import { encodeText } from '@svta/cml-utils'\nimport { TEMPLATE } from './fields/TEMPLATE.ts'\nimport { UINT } from './fields/UINT.ts'\nimport type { IsoFieldTypeMap } from './IsoFieldTypeMap.ts'\n\n/**\n * A view for writing ISO BMFF data.\n *\n * @public\n */\nexport class IsoBoxWriteView {\n\tprivate dataView: DataView<ArrayBuffer>\n\tprivate cursor: number\n\n\t/**\n\t * Constructs a new IsoBoxWriteView.\n\t *\n\t * @param size - The size of the data view.\n\t */\n\tconstructor(type: string, size: number) {\n\t\tthis.dataView = new DataView(new ArrayBuffer(size))\n\t\tthis.cursor = 0\n\t\tthis.writeBoxHeader(type, size)\n\t}\n\n\t/**\n\t * The buffer of the data view.\n\t *\n\t * @returns The buffer of the data view.\n\t */\n\tget buffer(): ArrayBuffer {\n\t\treturn this.dataView.buffer\n\t}\n\n\t/**\n\t * The length of the data view.\n\t *\n\t * @returns The length of the data view.\n\t */\n\tget byteLength(): number {\n\t\treturn this.dataView.byteLength\n\t}\n\n\t/**\n\t * The offset of the data view.\n\t *\n\t * @returns The offset of the data view.\n\t */\n\tget byteOffset(): number {\n\t\treturn this.dataView.byteOffset\n\t}\n\n\t/**\n\t * Writes a uint to the data view.\n\t *\n\t * @param value - The value to write.\n\t * @param size - The size, in bytes, of the value.\n\t */\n\twriteUint = (value: number, size: number): void => {\n\t\tconst { dataView, cursor } = this\n\n\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdataView.setUint8(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 2:\n\t\t\t\tdataView.setUint16(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 3: {\n\t\t\t\tconst s1 = (value & 0xFFFF00) >> 8\n\t\t\t\tconst s2 = (value & 0x0000FF)\n\t\t\t\tdataView.setUint16(cursor, s1)\n\t\t\t\tdataView.setUint8(cursor + 2, s2)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcase 4:\n\t\t\t\tdataView.setUint32(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 8: {\n\t\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\t\tconst s1 = Math.floor(value / Math.pow(2, 32))\n\t\t\t\tconst s2 = value - (s1 * Math.pow(2, 32))\n\t\t\t\tdataView.setUint32(cursor, s1)\n\t\t\t\tdataView.setUint32(cursor + 4, s2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tthis.cursor += size\n\t}\n\n\t/**\n\t * Writes an int to the data view.\n\t *\n\t * @param value - The value to write.\n\t * @param size - The size, in bytes, of the value.\n\t */\n\twriteInt = (value: number, size: number): void => {\n\t\tconst { dataView, cursor } = this\n\n\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdataView.setInt8(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 2:\n\t\t\t\tdataView.setInt16(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 4:\n\t\t\t\tdataView.setInt32(cursor, value)\n\t\t\t\tbreak\n\n\t\t\tcase 8:\n\t\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\t\tconst s1 = Math.floor(value / Math.pow(2, 32))\n\t\t\t\tconst s2 = value - (s1 * Math.pow(2, 32))\n\t\t\t\tdataView.setUint32(cursor, s1)\n\t\t\t\tdataView.setUint32(cursor + 4, s2)\n\t\t\t\tbreak\n\t\t}\n\n\t\tthis.cursor += size\n\t}\n\n\t/**\n\t * Writes a string to the data view.\n\t *\n\t * @param value - The value to write.\n\t */\n\twriteString = (value: string): void => {\n\t\tfor (let c = 0, len = value.length; c < len; c++) {\n\t\t\tthis.writeUint(value.charCodeAt(c), 1)\n\t\t}\n\t}\n\n\t/**\n\t * Writes a null terminated string to the data view.\n\t *\n\t * @param value - The value to write.\n\t */\n\twriteTerminatedString = (value: string): void => {\n\t\tif (value.length === 0) {\n\t\t\treturn\n\t\t}\n\n\t\tfor (let c = 0, len = value.length; c < len; c++) {\n\t\t\tthis.writeUint(value.charCodeAt(c), 1)\n\t\t}\n\n\t\tthis.writeUint(0, 1)\n\t}\n\n\t/**\n\t * Writes a UTF-8 null terminated string to the data view.\n\t *\n\t * @param value - The value to write.\n\t */\n\twriteUtf8TerminatedString = (value: string): void => {\n\t\tconst bytes = encodeText(value)\n\t\tconst uint8View = new Uint8Array(this.dataView.buffer)\n\t\tuint8View.set(bytes, this.cursor)\n\t\tthis.cursor += bytes.length\n\t\tthis.writeUint(0, 1) // null terminator\n\t}\n\n\t/**\n\t * Writes a Uint8Array to the data view.\n\t *\n\t * @param data - The data to write.\n\t */\n\twriteBytes = (data: Uint8Array | Uint8Array[]): void => {\n\t\tif (!Array.isArray(data)) {\n\t\t\tdata = [data]\n\t\t}\n\n\t\tfor (const bytes of data) {\n\t\t\tconst uint8View = new Uint8Array(this.dataView.buffer)\n\t\t\tuint8View.set(bytes, this.cursor)\n\t\t\tthis.cursor += bytes.length\n\t\t}\n\t}\n\n\t/**\n\t * Writes an array of numbers to the data view.\n\t *\n\t * @param data - The data to write.\n\t * @param type - The type of the data.\n\t * @param size - The size, in bytes, of each data value.\n\t * @param length - The number of values to write. (optional)\n\t */\n\twriteArray = <T extends keyof IsoFieldTypeMap>(data: number[], type: T, size: number, length: number): void => {\n\t\tconst write = type === UINT ? this.writeUint : type === TEMPLATE ? this.writeTemplate : this.writeInt\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\twrite(data[i] ?? 0, size)\n\t\t}\n\t}\n\n\t/**\n\t * Writes a template to the data view.\n\t *\n\t * @param value - The value to write.\n\t * @param size - The size, in bytes, of the template.\n\t */\n\twriteTemplate = (value: number, size: number): void => {\n\t\tconst shift = size === 4 ? 16 : 8\n\t\tconst fixedPoint = Math.round(value * Math.pow(2, shift))\n\t\tthis.writeUint(fixedPoint, size)\n\t}\n\n\t/**\n\t * Writes a box header to the data view.\n\t *\n\t * @param type - The type of the box.\n\t * @param size - The size, in bytes, of the box.\n\t */\n\twriteBoxHeader = (type: string, size: number): void => {\n\t\tconst isLarge = size > 0xffffffff\n\t\tif (isLarge) {\n\t\t\tthis.writeUint(1, 4) // size = 1 indicates largesize follows\n\t\t\tthis.writeString(type)\n\t\t\tthis.writeUint(size, 8)\n\t\t} else {\n\t\t\tthis.writeUint(size, 4)\n\t\t\tthis.writeString(type)\n\t\t}\n\t}\n\n\t// writeBoxHeader(type: string, extendedType?: number[]): void {\n\t// \tconst { size } = box\n\t// \tconst isLarge = size > 0xffffffff\n\t// \tconst isExtended = box.type === 'uuid' && extendedType\n\t// \tlet boxSize = size\n\n\t// \tif (isLarge) {\n\t// \t\tboxSize += 8\n\t// \t}\n\n\t// \tif (isExtended) {\n\t// \t\tboxSize += 16\n\t// \t}\n\t// \tthis.writeUint(isLarge ? 1 : boxSize, 4)\n\t// \tthis.writeString(box.type)\n\n\t// \tif (isLarge) {\n\t// \t\tthis.writeUint(boxSize, 8)\n\t// \t}\n\n\t// \tif (isExtended) {\n\t// \t\tthis.writeArray(extendedType, UINT, 1)\n\t// \t}\n\t// }\n\n\t/**\n\t * Writes a full box header to the data view.\n\t *\n\t * @param version - The version of the full box.\n\t * @param flags - The flags of the full box.\n\t */\n\twriteFullBox(version: number, flags: number): void {\n\t\tthis.writeUint(version, 1)\n\t\tthis.writeUint(flags, 3)\n\t}\n}\n","import type { IsoBoxStreamable } from '../IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeBox } from './writeBox.ts'\n\n/**\n * Write boxes to an array of Uint8Arrays.\n *\n * @param boxes - The boxes to write\n * @param config - The configuration for the writer\n *\n * @returns The written boxes\n *\n * @internal\n */\nexport function writeBoxes(boxes: Iterable<IsoBoxStreamable>, config: IsoBoxWriteViewConfig): Uint8Array[] {\n\treturn Array.from(boxes, box => writeBox(box, config))\n}\n","import type { IsoBox } from '../IsoBox.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeBoxes } from './writeBoxes.ts'\n\n/**\n * Write child boxes\n *\n * @param boxes - The boxes to write\n * @param config - The configuration for the writer\n *\n * @returns The byte arrays and total size of the written boxes\n *\n * @internal\n */\nexport function writeChildBoxes(boxes: IsoBox[], config: IsoBoxWriteViewConfig): { bytes: Uint8Array[], size: number } {\n\tconst bytes = writeBoxes(boxes, config)\n\tconst size = bytes.reduce((size, byte) => size + byte.byteLength, 0)\n\n\treturn {\n\t\tbytes,\n\t\tsize,\n\t}\n}\n","import type { IsoBoxContainer } from '../IsoBoxContainer.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a ContainerBox to an IsoBmffWriter.\n *\n * This function writes a container box with its child boxes. Child boxes are\n * extracted from the container box's `boxes` array and encoded using their `view` property.\n *\n * @param box - The ContainerBox to write\n *\n * @returns An IsoBmffWriter containing the encoded box\n *\n * @internal\n */\nexport function writeContainerBox<T extends IsoBoxContainer>(\n\tbox: T,\n\tconfig: IsoBoxWriteViewConfig\n): IsoBoxWriteView {\n\tconst headerSize = 8\n\t// TODO: Is there a way to avoid creating the intermediate Uint8Arrays?\n\tconst { bytes, size } = writeChildBoxes(box.boxes as any, config)\n\n\tconst totalSize = headerSize + size\n\n\tconst writer = new IsoBoxWriteView(box.type, totalSize)\n\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { IsoBoxStreamable } from '../IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { isContainer } from '../utils/isContainer.ts'\nimport { writeContainerBox } from './writeContainerBox.ts'\n\n/**\n * Write a box to a Uint8Array.\n *\n * @param box - The box to write\n * @param writers - The writers to use\n * @returns The written box\n *\n * @internal\n */\nexport function writeBox(box: IsoBoxStreamable, config: IsoBoxWriteViewConfig): Uint8Array {\n\tlet view: ArrayBufferView | null = null\n\n\tif ('type' in box) {\n\t\tconst { type } = box\n\t\tconst writer = config.writers?.[type]\n\n\t\tif (writer) {\n\t\t\t// TODO: Find a better way to do this without casting to any\n\t\t\tview = writer(box as any, config)\n\t\t}\n\t\telse if (isContainer(box)) {\n\t\t\tview = writeContainerBox(box, config)\n\t\t}\n\t\telse if ('view' in box) {\n\t\t\tview = box.view\n\t\t}\n\n\t\tif (!view) {\n\t\t\tthrow new Error(`No writer found for box type: ${type}`)\n\t\t}\n\t}\n\n\tif ('buffer' in box) {\n\t\tview = box\n\t}\n\n\tif (!view) {\n\t\tthrow new Error('Invalid box')\n\t}\n\n\treturn new Uint8Array(view.buffer, view.byteOffset, view.byteLength)\n}\n","import type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\nimport { createWriterConfig } from './utils/createWriterConfig.ts'\nimport { writeBox } from './utils/writeBox.ts'\n\n/**\n * Write an ISO box to a Uint8Array.\n *\n * @param box - The box to write\n * @param config - The configuration for the writer\n *\n * @returns The written box\n *\n * @public\n */\nexport function writeIsoBox(box: IsoBoxStreamable, config?: IsoBoxWriteViewConfig): Uint8Array {\n\treturn writeBox(box, createWriterConfig(config))\n}\n","import type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\nimport { createWriterConfig } from './utils/createWriterConfig.ts'\nimport { writeIsoBox } from './writeIsoBox.ts'\n\n/**\n * A readable stream of ISO BMFF boxes as Uint8Arrays.\n *\n * @public\n */\nexport class IsoBoxReadableStream extends ReadableStream<Uint8Array> {\n\t/**\n\t * Constructs a new IsoBoxReadableStream.\n\t *\n\t * @param boxes - The boxes to stream.\n\t * @param config - The configuration for the stream.\n\t */\n\tconstructor(boxes: Iterable<IsoBoxStreamable>, config: IsoBoxWriteViewConfig = {}) {\n\t\tconst iterator = boxes[Symbol.iterator]()\n\t\tconst cfg = createWriterConfig(config)\n\n\t\tfunction pull(controller: ReadableStreamDefaultController<Uint8Array>) {\n\t\t\tconst desiredSize = controller.desiredSize ?? 0\n\n\t\t\tfor (let i = 0; i < desiredSize; i++) {\n\t\t\t\tconst { value, done } = iterator.next()\n\n\t\t\t\tif (done) {\n\t\t\t\t\tcontroller.close()\n\t\t\t\t} else {\n\t\t\t\t\tcontroller.enqueue(writeIsoBox(value, cfg))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper({ start: pull, pull })\n\t}\n}\n","import { IsoBoxReadableStream } from './IsoBoxReadableStream.ts'\nimport type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\n\n/**\n * Creates a ReadableStream of ISO BMFF boxes as Uint8Arrays.\n *\n * @param boxes - The boxes to stream.\n * @param config - The configuration for the stream.\n *\n * @returns A new IsoBoxReadableStream.\n *\n * @example\n * {@includeCode ../test/createIsoBoxReadableStream.test.ts#example}\n *\n * @public\n */\nexport function createIsoBoxReadableStream(boxes: Iterable<IsoBoxStreamable>, config: IsoBoxWriteViewConfig = {}): ReadableStream<Uint8Array> {\n\treturn new IsoBoxReadableStream(boxes, config)\n}\n","import type { ParsedIsoBox } from './ParsedIsoBox.ts'\nimport type { TraverseIsoBoxesConfig } from './TraverseIsoBoxesConfig.ts'\nimport { isContainer } from './utils/isContainer.ts'\n\n/**\n * Traverse ISO boxes\n *\n * @param boxes - The boxes to traverse\n * @param config - Configuration options for traversal\n *\n * @returns A generator of boxes\n *\n * @example\n * {@includeCode ../test/traverseIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function* traverseIsoBoxes(boxes: Iterable<ParsedIsoBox>, config?: TraverseIsoBoxesConfig): Generator<ParsedIsoBox> {\n\tconst depthFirst = config?.depthFirst ?? true\n\tconst maxDepth = config?.maxDepth ?? Infinity\n\n\tif (maxDepth < 0 || typeof maxDepth !== 'number' || Number.isNaN(maxDepth)) {\n\t\treturn\n\t}\n\n\tconst queue: [Iterable<ParsedIsoBox>, number][] = [[boxes, 0]]\n\n\twhile (queue.length > 0) {\n\t\tconst item = queue.shift()\n\t\tif (!item) {\n\t\t\tcontinue\n\t\t}\n\t\tconst [children, depth] = item\n\n\t\tfor (const child of children) {\n\t\t\tyield child\n\n\t\t\tif (depth >= maxDepth) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (isContainer(child) && child.boxes) {\n\t\t\t\tconst next = child.boxes as ParsedIsoBox[]\n\n\t\t\t\tif (depthFirst) {\n\t\t\t\t\tyield* traverseIsoBoxes(next, { depthFirst, maxDepth: maxDepth - 1 })\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tqueue.push([next, depth + 1])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { ParsedIsoBox } from './ParsedIsoBox.ts'\nimport type { TraverseIsoBoxesConfig } from './TraverseIsoBoxesConfig.ts'\nimport { traverseIsoBoxes } from './traverseIsoBoxes.ts'\n\n/**\n * Filters boxes in the tree that satisfy the provided testing function.\n *\n * This function traverses the entire box structure (including nested boxes)\n * and returns all boxes for which the callback returns true.\n *\n * @param boxes - The boxes to search through\n * @param callback - A function that accepts a box and returns true if it matches\n * @param config - Configuration options for traversal\n *\n * @returns An array of boxes that satisfy the callback\n *\n * @example\n * {@includeCode ../test/filterIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function filterIsoBoxes<T extends ParsedIsoBox>(boxes: Iterable<T>, callback: (box: T) => boolean, config?: TraverseIsoBoxesConfig): T[] {\n\tconst result: T[] = []\n\n\tfor (const box of traverseIsoBoxes(boxes as Iterable<ParsedIsoBox>, config)) {\n\t\tif (callback(box as T)) {\n\t\t\tresult.push(box as T)\n\t\t}\n\t}\n\n\treturn result\n}\n","import type { ParsedIsoBox } from './ParsedIsoBox.ts'\nimport type { TraverseIsoBoxesConfig } from './TraverseIsoBoxesConfig.ts'\nimport { traverseIsoBoxes } from './traverseIsoBoxes.ts'\n\n/**\n * Finds the first box in the tree that satisfies the provided testing function.\n *\n * This function traverses the entire box structure (including nested boxes)\n * and returns the first box for which the callback returns true.\n *\n * @param boxes - The boxes to search through\n * @param callback - A function that accepts a box and returns true if it matches\n * @param config - Configuration options for traversal\n *\n * @returns The first box that satisfies the callback, or null if none is found\n *\n * @example\n * {@includeCode ../test/findIsoBox.test.ts#example}\n *\n * @public\n */\nexport function findIsoBox<T extends ParsedIsoBox>(boxes: Iterable<T>, callback: (box: T) => boolean, config?: TraverseIsoBoxesConfig): T | null {\n\tfor (const box of traverseIsoBoxes(boxes as Iterable<ParsedIsoBox>, config)) {\n\t\tif (callback(box as T)) {\n\t\t\treturn box as T\n\t\t}\n\t}\n\n\treturn null\n}\n","/**\n * The data field type\n *\n * @public\n */\nexport const DATA = 'data'\n","/**\n * The integer field type\n *\n * @public\n */\nexport const INT = 'int'\n","/**\n * The string field type\n *\n * @public\n */\nexport const STRING = 'string'\n","/**\n * The UTF8 field type\n *\n * @public\n */\nexport const UTF8 = 'utf8'\n","export function readData(dataView: DataView, offset: number, size: number): Uint8Array {\n\tconst length = (size > 0) ? size : (dataView.byteLength - (offset - dataView.byteOffset))\n\treturn new Uint8Array(dataView.buffer, offset, Math.max(length, 0))\n};\n","export function readInt(dataView: DataView, offset: number, size: number): number {\n\tlet result = NaN\n\tconst cursor = offset - dataView.byteOffset\n\n\tswitch (size) {\n\t\tcase 1:\n\t\t\tresult = dataView.getInt8(cursor)\n\t\t\tbreak\n\n\t\tcase 2:\n\t\t\tresult = dataView.getInt16(cursor)\n\t\t\tbreak\n\n\t\tcase 4:\n\t\t\tresult = dataView.getInt32(cursor)\n\t\t\tbreak\n\n\t\tcase 8:\n\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\tconst s1 = dataView.getInt32(cursor)\n\t\t\tconst s2 = dataView.getInt32(cursor + 4)\n\t\t\tresult = (s1 * Math.pow(2, 32)) + s2\n\t\t\tbreak\n\t}\n\n\treturn result\n};\n","export function readUint(dataView: DataView, offset: number, size: number): number {\n\tconst cursor = offset - dataView.byteOffset\n\n\tlet value: number = NaN\n\tlet s1: number\n\tlet s2: number\n\n\tswitch (size) {\n\t\tcase 1:\n\t\t\tvalue = dataView.getUint8(cursor)\n\t\t\tbreak\n\n\t\tcase 2:\n\t\t\tvalue = dataView.getUint16(cursor)\n\t\t\tbreak\n\n\t\tcase 3:\n\t\t\ts1 = dataView.getUint16(cursor)\n\t\t\ts2 = dataView.getUint8(cursor + 2)\n\t\t\tvalue = (s1 << 8) + s2\n\t\t\tbreak\n\n\t\tcase 4:\n\t\t\tvalue = dataView.getUint32(cursor)\n\t\t\tbreak\n\n\t\tcase 8:\n\t\t\t// Warning: JavaScript cannot handle 64-bit integers natively.\n\t\t\t// This will give unexpected results for integers >= 2^53\n\t\t\ts1 = dataView.getUint32(cursor)\n\t\t\ts2 = dataView.getUint32(cursor + 4)\n\t\t\tvalue = (s1 * Math.pow(2, 32)) + s2\n\t\t\tbreak\n\t}\n\n\treturn value\n};\n","import { readUint } from './readUint.ts'\n\nexport function readString(dataView: DataView, offset: number, length: number): string {\n\tlet str = ''\n\n\tfor (let c = 0; c < length; c++) {\n\t\tconst cursor = offset + c\n\t\tconst char = readUint(dataView, cursor, 1)\n\t\tstr += String.fromCharCode(char)\n\t}\n\n\treturn str\n}\n","import { readUint } from './readUint.ts'\n\nexport function readTemplate(dataView: DataView, offset: number, size: number): number {\n\tconst half = size / 2\n\tconst pre = readUint(dataView, offset, half)\n\tconst post = readUint(dataView, offset + half, half)\n\treturn pre + (post / Math.pow(2, half))\n};\n","import { readUint } from './readUint.ts'\n\nexport function readTerminatedString(dataView: DataView, offset: number): string {\n\tlet str = ''\n\tlet cursor = offset\n\n\twhile (cursor - dataView.byteOffset < dataView.byteLength) {\n\t\tconst char = readUint(dataView, cursor, 1)\n\t\tif (char === 0) {\n\t\t\tbreak\n\t\t}\n\n\t\tstr += String.fromCharCode(char)\n\t\tcursor++\n\t}\n\n\treturn str\n};\n","import { decodeText, UTF_8 } from '@svta/cml-utils'\n\n/**\n * Reads a UTF-8 string from a data view.\n *\n * @param dataView - The data view to read from.\n * @param offset - The offset to start reading from.\n * @returns The UTF-8 string.\n *\n * @internal\n */\nexport function readUtf8String(dataView: DataView<ArrayBuffer>, offset: number): string {\n\tconst length = dataView.byteLength - (offset - dataView.byteOffset)\n\treturn (length > 0) ? decodeText(new DataView(dataView.buffer, offset, length), { encoding: UTF_8 }) : ''\n};\n","import { decodeText, UTF_8 } from '@svta/cml-utils'\n\n/**\n * Reads a UTF-8 terminated string from a data view.\n *\n * @param dataView - The data view to read from.\n * @param offset - The offset to start reading from.\n * @returns The UTF-8 terminated string.\n *\n * @internal\n */\nexport function readUtf8TerminatedString(dataView: DataView<ArrayBuffer>, offset: number): string {\n\tconst length = dataView.byteLength - (offset - dataView.byteOffset)\n\n\tlet data = ''\n\n\tif (length > 0) {\n\t\tconst view = new DataView(dataView.buffer, offset, length)\n\n\t\tlet l = 0\n\n\t\tfor (; l < length; l++) {\n\t\t\tif (view.getUint8(l) === 0) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// remap the Dataview with the actual length\n\t\tdata = decodeText(new DataView(dataView.buffer, offset, l), { encoding: UTF_8 })\n\t}\n\n\treturn data\n};\n","import type { FullBox } from './boxes/FullBox.ts'\nimport { DATA } from './fields/DATA.ts'\nimport { INT } from './fields/INT.ts'\nimport { STRING } from './fields/STRING.ts'\nimport { TEMPLATE } from './fields/TEMPLATE.ts'\nimport { UINT } from './fields/UINT.ts'\nimport { UTF8 } from './fields/UTF8.ts'\nimport type { IsoBox } from './IsoBox.ts'\nimport type { IsoBoxData } from './IsoBoxData.ts'\nimport type { IsoBoxReadViewConfig } from './IsoBoxReadViewConfig.ts'\nimport type { IsoFieldTypeMap } from './IsoFieldTypeMap.ts'\nimport type { ParsedBox } from './ParsedBox.ts'\nimport type { ParsedIsoBox } from './ParsedIsoBox.ts'\nimport { isContainer } from './utils/isContainer.ts'\nimport { readData } from './utils/readData.ts'\nimport { readInt } from './utils/readInt.ts'\nimport { readString } from './utils/readString.ts'\nimport { readTemplate } from './utils/readTemplate.ts'\nimport { readTerminatedString } from './utils/readTerminatedString.ts'\nimport { readUint } from './utils/readUint.ts'\nimport { readUtf8String } from './utils/readUtf8String.ts'\nimport { readUtf8TerminatedString } from './utils/readUtf8TerminatedString.ts'\n\n/**\n * ISO BMFF data view. Similar to DataView, but with additional methods for reading ISO BMFF data.\n * It implements the iterator protocol, so it can be used in a for...of loop.\n *\n * @public\n */\nexport class IsoBoxReadView {\n\tprivate dataView: DataView<ArrayBuffer>\n\tprivate offset: number\n\tprivate config: IsoBoxReadViewConfig\n\tprivate truncated: boolean = false\n\n\t/**\n\t * Creates a new IsoView instance. Similar to DataView, but with additional\n\t * methods for reading ISO BMFF data. It implements the iterator protocol,\n\t * so it can be used in a for...of loop.\n\t *\n\t * @param raw - The raw data to view.\n\t * @param config - The configuration for the IsoView.\n\t */\n\tconstructor(raw: IsoBoxData, config?: IsoBoxReadViewConfig) {\n\t\tthis.dataView = (raw instanceof ArrayBuffer) ? new DataView<ArrayBuffer>(raw) : (raw instanceof DataView) ? raw : new DataView<ArrayBuffer>(raw.buffer, raw.byteOffset, raw.byteLength)\n\t\tthis.offset = this.dataView.byteOffset\n\t\tthis.config = config || {}\n\t}\n\n\t/**\n\t * The buffer of the data view.\n\t */\n\tget buffer(): ArrayBuffer {\n\t\treturn this.dataView.buffer\n\t}\n\n\t/**\n\t * The byte offset of the data view.\n\t */\n\tget byteOffset(): number {\n\t\treturn this.dataView.byteOffset\n\t}\n\n\t/**\n\t * The byte length of the data view.\n\t */\n\tget byteLength(): number {\n\t\treturn this.dataView.byteLength\n\t}\n\n\t/**\n\t * The current byteoffset in the data view.\n\t */\n\tget cursor(): number {\n\t\treturn this.offset - this.dataView.byteOffset\n\t}\n\n\t/**\n\t * Whether the end of the data view has been reached.\n\t */\n\tget done(): boolean {\n\t\treturn this.cursor >= this.dataView.byteLength || this.truncated\n\t}\n\n\t/**\n\t * The number of bytes remaining in the data view.\n\t */\n\tget bytesRemaining(): number {\n\t\treturn this.dataView.byteLength - this.cursor\n\t}\n\n\t/**\n\t * Creates a new IsoView instance with a slice of the current data view.\n\t *\n\t * @param size - The size of the slice.\n\t * @returns A new IsoView instance.\n\t */\n\tslice = (offset: number, size: number): IsoBoxReadView => {\n\t\tconst dataView = new DataView(this.dataView.buffer, offset, size)\n\t\tconst isoView = new IsoBoxReadView(dataView, this.config)\n\t\tconst headerSize = this.offset - offset\n\t\tconst bodySize = size - headerSize\n\n\t\tthis.offset += bodySize\n\t\tisoView.jump(headerSize)\n\n\t\treturn isoView\n\t}\n\n\tprivate read = <T extends keyof IsoFieldTypeMap>(type: T, size: number = 0): IsoFieldTypeMap[T] => {\n\t\t// TODO: Change all sizes from bits to bytes\n\t\tconst { dataView, offset } = this\n\n\t\tlet result: any\n\t\tlet cursor = size\n\n\t\tswitch (type) {\n\t\t\tcase UINT:\n\t\t\t\tresult = readUint(dataView, offset, size)\n\t\t\t\tbreak\n\n\t\t\tcase INT:\n\t\t\t\tresult = readInt(dataView, offset, size)\n\t\t\t\tbreak\n\n\t\t\tcase TEMPLATE:\n\t\t\t\tresult = readTemplate(dataView, offset, size)\n\t\t\t\tbreak\n\n\t\t\tcase STRING:\n\t\t\t\tif (size === -1) {\n\t\t\t\t\tresult = readTerminatedString(dataView, offset)\n\t\t\t\t\tcursor = result.length + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresult = readString(dataView, offset, size)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase DATA:\n\t\t\t\tresult = readData(dataView, offset, size)\n\t\t\t\tcursor = result.length\n\t\t\t\tbreak\n\n\t\t\tcase UTF8:\n\t\t\t\tif (size === -1) {\n\t\t\t\t\tresult = readUtf8TerminatedString(dataView, offset)\n\t\t\t\t\tcursor = result.length + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tresult = readUtf8String(dataView, offset)\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tresult = -1\n\t\t}\n\n\t\tthis.offset += cursor\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Reads a unsigned integer from the data view.\n\t *\n\t * @param size - The size of the integer in bytes.\n\t * @returns The unsigned integer.\n\t */\n\treadUint = (size: number): number => {\n\t\treturn this.read(UINT, size)\n\t}\n\n\t/**\n\t * Reads a signed integer from the data view.\n\t *\n\t * @param size - The size of the integer in bytes.\n\t * @returns The signed integer.\n\t */\n\treadInt = (size: number): number => {\n\t\treturn this.read(INT, size)\n\t}\n\n\t/**\n\t * Reads a string from the data view.\n\t *\n\t * @param size - The size of the string in bytes.\n\t * @returns The string.\n\t */\n\treadString = (size: number): string => {\n\t\treturn this.read(STRING, size)\n\t}\n\n\t/**\n\t * Reads a template from the data view.\n\t *\n\t * @param size - The size of the template in bytes.\n\t * @returns The template.\n\t */\n\treadTemplate = (size: number): number => {\n\t\treturn this.read(TEMPLATE, size)\n\t}\n\n\t/**\n\t * Reads a byte array from the data view.\n\t *\n\t * @param size - The size of the data in bytes.\n\t * @returns The data.\n\t */\n\treadData = (size: number): Uint8Array<ArrayBuffer> => {\n\t\treturn this.read(DATA, size)\n\t}\n\n\t/**\n\t * Reads a UTF-8 string from the data view.\n\t *\n\t * @param size - The size of the string in bytes.\n\t * @returns The UTF-8 string.\n\t */\n\treadUtf8 = (size?: number): string => {\n\t\treturn this.read(UTF8, size)\n\t}\n\n\t/**\n\t * Reads a full box from the data view.\n\t *\n\t * @returns The full box.\n\t */\n\treadFullBox = (): FullBox => {\n\t\treturn {\n\t\t\tversion: this.readUint(1),\n\t\t\tflags: this.readUint(3),\n\t\t}\n\t}\n\n\t/**\n\t * Reads an array of values from the data view.\n\t *\n\t * @param type - The type of the values.\n\t * @param size - The size of the values in bytes.\n\t * @param length - The number of values to read.\n\t * @returns The array of values.\n\t */\n\treadArray = <T extends keyof IsoFieldTypeMap>(type: T, size: number, length: number): IsoFieldTypeMap[T][] => {\n\t\tconst value = []\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tvalue.push(this.read(type, size))\n\t\t}\n\n\t\treturn value as IsoFieldTypeMap[T][]\n\t}\n\n\t/**\n\t * Skips a number of bytes in the view.\n\t *\n\t * @param size - The number of bytes to skip.\n\t */\n\tjump = (size: number): void => {\n\t\tthis.offset += size\n\t}\n\n\t/**\n\t * Reads a raw box from the data view.\n\t *\n\t * @returns The box.\n\t */\n\treadBox = (): ParsedBox => {\n\t\tconst { dataView, offset } = this\n\n\t\t// read box size and type without advancing the cursor in case the box is truncated\n\t\tlet cursor = 0\n\t\tconst size = readUint(dataView, offset, 4)\n\t\tconst type = readString(dataView, offset + 4, 4)\n\t\tconst box = { size, type } as ParsedBox\n\n\t\tcursor += 8\n\n\t\tif (box.size === 1) {\n\t\t\tbox.largesize = readUint(dataView, offset + cursor, 8)\n\t\t\tcursor += 8\n\t\t}\n\n\t\tconst actualSize = box.size === 0 ? this.bytesRemaining : box.largesize ?? box.size\n\t\tif (this.cursor + actualSize > dataView.byteLength) {\n\t\t\tthis.truncated = true\n\t\t\tthrow new Error('Truncated box')\n\t\t}\n\n\t\tthis.jump(cursor)\n\n\t\tif (type === 'uuid') {\n\t\t\tbox.usertype = this.readArray('uint', 1, 16)\n\t\t}\n\n\t\tbox.view = this.slice(offset, actualSize)\n\n\t\treturn box\n\t}\n\n\t/**\n\t * Reads a number of boxes from the data view.\n\t *\n\t * @param length - The number of boxes to read.\n\t * @returns The boxes.\n\t */\n\treadBoxes = <T = IsoBox>(length: number = -1): T[] => {\n\t\tconst result: T[] = []\n\n\t\tfor (const box of this) {\n\t\t\tresult.push(box as T)\n\n\t\t\tif (length > 0 && result.length >= length) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Reads a number of entries from the data view.\n\t *\n\t * @param length - The number of entries to read.\n\t * @param map - The function to map the entries.\n\t * @returns The entries.\n\t */\n\treadEntries = <T>(length: number, map: () => T): T[] => {\n\t\tconst result: T[] = []\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tresult.push(map())\n\t\t}\n\n\t\treturn result\n\t};\n\n\t/**\n\t * Iterates over the boxes in the data view.\n\t *\n\t * @returns A generator of boxes.\n\t */\n\t*[Symbol.iterator](): Generator<ParsedIsoBox> {\n\t\tconst { readers = {} } = this.config\n\n\t\twhile (!this.done) {\n\t\t\ttry {\n\t\t\t\tconst box = this.readBox() as ParsedIsoBox\n\t\t\t\tconst { type, view } = box\n\t\t\t\tconst parser = readers[type] || readers[type.trim()] // url and urn boxes have a trailing space in their type field\n\n\t\t\t\tif (parser) {\n\t\t\t\t\tObject.assign(box, parser(view))\n\t\t\t\t}\n\n\t\t\t\t// Some boxes, like meta, parse their child boxes themselves.\n\t\t\t\tif (isContainer(box) && !box.boxes) {\n\t\t\t\t\tconst boxes = []\n\n\t\t\t\t\tfor (const child of view) {\n\t\t\t\t\t\tboxes.push(child)\n\t\t\t\t\t}\n\n\t\t\t\t\tbox.boxes = boxes\n\t\t\t\t}\n\n\t\t\t\tyield box\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\tif (error instanceof Error && error.message === 'Truncated box') {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tthrow error\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { IsoBoxData } from './IsoBoxData.ts'\nimport type { IsoBoxReaderMap } from './IsoBoxReaderMap.ts'\nimport type { IsoBoxReaderReturn } from './IsoBoxReaderReturn.ts'\nimport { IsoBoxReadView } from './IsoBoxReadView.ts'\nimport type { IsoBoxReadViewConfig } from './IsoBoxReadViewConfig.ts'\nimport type { ParsedIsoBox } from './ParsedIsoBox.ts'\n\n/**\n * Reads ISO boxes from a data source.\n *\n * @param raw - The raw ISO data\n * @param config - The configuration for the IsoView\n *\n * @returns The parsed boxes\n *\n * @example\n * {@includeCode ../test/readIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function readIsoBoxes<const R extends IsoBoxReaderMap>(raw: IsoBoxData, config: IsoBoxReadViewConfig & { readers: R }): IsoBoxReaderReturn<R>[];\n\n/**\n * @public\n */\nexport function readIsoBoxes(raw: IsoBoxData, config?: IsoBoxReadViewConfig): ParsedIsoBox[];\nexport function readIsoBoxes(raw: IsoBoxData, config?: IsoBoxReadViewConfig): ParsedIsoBox[] {\n\tconst boxes = []\n\n\tfor (const box of new IsoBoxReadView(raw, config)) {\n\t\tboxes.push(box)\n\t}\n\n\treturn boxes\n}\n","import type { IsoBoxStreamable } from './IsoBoxStreamable.ts'\nimport type { IsoBoxWriteViewConfig } from './IsoBoxWriteViewConfig.ts'\nimport { createWriterConfig } from './utils/createWriterConfig.ts'\nimport { writeBoxes } from './utils/writeBoxes.ts'\n\n/**\n * Writes ISO boxes to a readable stream.\n *\n * @param boxes - The boxes to write\n * @param config - The configuration for the readable stream\n *\n * @returns A readable stream of the written boxes\n *\n * @example\n * {@includeCode ../test/writeIsoBoxes.test.ts#example}\n *\n * @public\n */\nexport function writeIsoBoxes(boxes: Iterable<IsoBoxStreamable>, config?: IsoBoxWriteViewConfig): Uint8Array[] {\n\treturn writeBoxes(boxes, createWriterConfig(config))\n}\n","import type { AudioSampleEntryBox, AudioSampleEntryBoxChild } from '../boxes/AudioSampleEntryBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { IsoBoxType } from '../IsoBoxType.ts'\n\n/**\n * Parse a AudioSampleEntryBox from an IsoView\n *\n * @param type - The type of AudioSampleEntryBox to read\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioSampleEntryBox\n *\n * @public\n */\nexport function readAudioSampleEntryBox<T extends IsoBoxType>(type: T, view: IsoBoxReadView): AudioSampleEntryBox<T> {\n\tconst { readArray, readUint, readTemplate, readBoxes } = view\n\n\treturn {\n\t\ttype,\n\t\treserved1: readArray(UINT, 1, 6),\n\t\tdataReferenceIndex: readUint(2),\n\t\treserved2: readArray(UINT, 4, 2),\n\t\tchannelcount: readUint(2),\n\t\tsamplesize: readUint(2),\n\t\tpreDefined: readUint(2),\n\t\treserved3: readUint(2),\n\t\tsamplerate: readTemplate(4),\n\t\tboxes: readBoxes<AudioSampleEntryBoxChild>()\n\t}\n};\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { IsoBoxType } from '../IsoBoxType.ts'\nimport { readAudioSampleEntryBox } from './readAudioSampleEntryBox.ts'\n\n/**\n * Creates a reader function for AudioSampleEntryBox with a custom type.\n *\n * This utility allows reading audio sample entry boxes with types that\n * aren't in the standard AudioSampleEntryType union (e.g., 'mp4a', 'enca').\n *\n * @param type - The 4-character box type\n *\n * @returns A reader function that can be passed to readIsoBoxes\n *\n * @example\n * ```ts\n * const boxes = readIsoBoxes(data, {\n * readers: {\n * 'ac-3': createAudioSampleEntryReader('ac-3'),\n * 'ec-3': createAudioSampleEntryReader('ec-3'),\n * }\n * })\n * ```\n *\n * @public\n */\nexport function createAudioSampleEntryReader<T extends IsoBoxType>(type: T): (view: IsoBoxReadView) => AudioSampleEntryBox<T> {\n\treturn (view: IsoBoxReadView) => readAudioSampleEntryBox(type, view)\n}\n","import type { VisualSampleEntryBox, VisualSampleEntryBoxChild } from '../boxes/VisualSampleEntryBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { IsoBoxType } from '../IsoBoxType.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param type - The type of VisualSampleEntryBox to read\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readVisualSampleEntryBox<T extends IsoBoxType>(type: T, view: IsoBoxReadView): VisualSampleEntryBox<T> {\n\tconst { readArray, readUint, readInt, readTemplate, readBoxes } = view\n\n\treturn {\n\t\ttype,\n\t\treserved1: readArray(UINT, 1, 6),\n\t\tdataReferenceIndex: readUint(2),\n\t\tpreDefined1: readUint(2),\n\t\treserved2: readUint(2),\n\t\tpreDefined2: readArray(UINT, 4, 3),\n\t\twidth: readUint(2),\n\t\theight: readUint(2),\n\t\thorizresolution: readTemplate(4),\n\t\tvertresolution: readTemplate(4),\n\t\treserved3: readUint(4),\n\t\tframeCount: readUint(2),\n\t\tcompressorName: readArray(UINT, 1, 32),\n\t\tdepth: readUint(2),\n\t\tpreDefined3: readInt(2),\n\t\tboxes: readBoxes<VisualSampleEntryBoxChild>(),\n\t}\n};\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { IsoBoxType } from '../IsoBoxType.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Creates a reader function for VisualSampleEntryBox with a custom type.\n *\n * This utility allows reading visual sample entry boxes with types that\n * aren't in the standard VisualSampleEntryType union (e.g., 'avc1', 'hvc1').\n *\n * @param type - The 4-character box type\n *\n * @returns A reader function that can be passed to readIsoBoxes\n *\n * @example\n * ```ts\n * const boxes = readIsoBoxes(data, {\n * readers: {\n * 'vp09': createVisualSampleEntryReader('vp09'),\n * 'av01': createVisualSampleEntryReader('av01'),\n * }\n * })\n * ```\n *\n * @public\n */\nexport function createVisualSampleEntryReader<T extends IsoBoxType>(type: T): (view: IsoBoxReadView) => VisualSampleEntryBox<T> {\n\treturn (view: IsoBoxReadView) => readVisualSampleEntryBox(type, view)\n}\n","import type { AudioRenderingIndicationBox } from '../boxes/AudioRenderingIndicationBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a AudioRenderingIndicationBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioRenderingIndicationBox\n *\n * @public\n */\nexport function readArdi(view: IsoBoxReadView): AudioRenderingIndicationBox {\n\treturn {\n\t\ttype: 'ardi',\n\t\t...view.readFullBox(),\n\t\taudioRenderingIndication: view.readUint(1),\n\t}\n};\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc1(view: IsoBoxReadView): VisualSampleEntryBox<'avc1'> {\n\treturn readVisualSampleEntryBox('avc1', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc2(view: IsoBoxReadView): VisualSampleEntryBox<'avc2'> {\n\treturn readVisualSampleEntryBox('avc2', view)\n}\n\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc3(view: IsoBoxReadView): VisualSampleEntryBox<'avc3'> {\n\treturn readVisualSampleEntryBox('avc3', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readAvc4(view: IsoBoxReadView): VisualSampleEntryBox<'avc4'> {\n\treturn readVisualSampleEntryBox('avc4', view)\n}\n","import type { CompositionTimeToSampleBox } from '../boxes/CompositionTimeToSampleBox.ts'\nimport type { CompositionTimeToSampleEntry } from '../boxes/CompositionTimeToSampleEntry.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a CompositionTimeToSampleBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed CompositionTimeToSampleBox\n *\n * @public\n */\nexport function readCtts(view: IsoBoxReadView): CompositionTimeToSampleBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst read = version === 1 ? view.readInt : view.readUint\n\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries<CompositionTimeToSampleEntry>(entryCount, () => ({\n\t\tsampleCount: view.readUint(4),\n\t\tsampleOffset: read(4),\n\t}))\n\n\treturn {\n\t\ttype: 'ctts',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { DataEntryUrlBox } from '../boxes/DataEntryUrlBox.ts'\nimport type { DataEntryUrnBox } from '../boxes/DataEntryUrnBox.ts'\nimport type { DataReferenceBox } from '../boxes/DataReferenceBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a DataReferenceBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed DataReferenceBox\n *\n * @public\n */\nexport function readDref(view: IsoBoxReadView): DataReferenceBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readBoxes<DataEntryUrlBox | DataEntryUrnBox>(entryCount)\n\n\treturn {\n\t\ttype: 'dref',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { ExtendedLanguageBox } from '../boxes/ExtendedLanguageBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a ExtendedLanguageBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed ExtendedLanguageBox\n *\n * @public\n */\nexport function readElng(view: IsoBoxReadView): ExtendedLanguageBox {\n\treturn {\n\t\ttype: 'elng',\n\t\t...view.readFullBox(),\n\t\textendedLanguage: view.readUtf8(-1),\n\t}\n};\n","import type { EditListBox } from '../boxes/EditListBox.ts'\nimport type { EditListEntry } from '../boxes/EditListEntry.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a Box from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed Box\n *\n * @public\n */\nexport function readElst(view: IsoBoxReadView): EditListBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst v1 = version === 1\n\tconst size = v1 ? 8 : 4\n\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries<EditListEntry>(entryCount, () => ({\n\t\tsegmentDuration: view.readUint(size),\n\t\tmediaTime: view.readInt(size),\n\t\tmediaRateInteger: view.readInt(2),\n\t\tmediaRateFraction: view.readInt(2),\n\t}))\n\n\treturn {\n\t\ttype: 'elst',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { EventMessageBox } from '../boxes/EventMessageBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse an EventMessageBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed EventMessageBox\n *\n * @public\n */\nexport function readEmsg(view: IsoBoxReadView): EventMessageBox {\n\tconst { readUint, readString, readData } = view\n\n\tconst result = { type: 'emsg', ...view.readFullBox() } as EventMessageBox\n\n\tif (result.version == 1) {\n\t\tresult.timescale = readUint(4)\n\t\tresult.presentationTime = readUint(8)\n\t\tresult.eventDuration = readUint(4)\n\t\tresult.id = readUint(4)\n\t\tresult.schemeIdUri = readString(-1)\n\t\tresult.value = readString(-1)\n\t}\n\telse {\n\t\tresult.schemeIdUri = readString(-1)\n\t\tresult.value = readString(-1)\n\t\tresult.timescale = readUint(4)\n\t\tresult.presentationTimeDelta = readUint(4)\n\t\tresult.eventDuration = readUint(4)\n\t\tresult.id = readUint(4)\n\t}\n\n\tresult.messageData = readData(-1)\n\n\treturn result\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readAudioSampleEntryBox } from './readAudioSampleEntryBox.ts'\n\n/**\n * Parse an AudioSampleEntry from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioSampleEntry\n *\n * @public\n */\nexport function readEnca(view: IsoBoxReadView): AudioSampleEntryBox<'enca'> {\n\treturn readAudioSampleEntryBox('enca', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readEncv(view: IsoBoxReadView): VisualSampleEntryBox<'encv'> {\n\treturn readVisualSampleEntryBox('encv', view)\n}\n","import type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a Box from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed Box\n *\n * @public\n */\nexport function readFree(view: IsoBoxReadView): FreeSpaceBox {\n\treturn {\n\t\ttype: 'free',\n\t\tdata: view.readData(-1),\n\t}\n};\n","import type { OriginalFormatBox } from '../boxes/OriginalFormatBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse an OriginalFormatBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed OriginalFormatBox\n *\n * @public\n */\nexport function readFrma(view: IsoBoxReadView): OriginalFormatBox {\n\treturn {\n\t\ttype: 'frma',\n\t\tdataFormat: view.readUint(4),\n\t}\n};\n","import type { FileTypeBox } from '../boxes/FileTypeBox.ts'\nimport { STRING } from '../fields/STRING.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a FileTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed FileTypeBox\n *\n * @public\n */\nexport function readFtyp(view: IsoBoxReadView): FileTypeBox {\n\tconst size = 4\n\tconst majorBrand = view.readString(4)\n\tconst minorVersion = view.readUint(4)\n\tconst length = view.bytesRemaining / size\n\tconst compatibleBrands = view.readArray(STRING, size, length)\n\n\treturn {\n\t\ttype: 'ftyp',\n\t\tmajorBrand,\n\t\tminorVersion,\n\t\tcompatibleBrands,\n\t}\n}\n","import type { HandlerReferenceBox } from '../boxes/HandlerReferenceBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a HandlerReferenceBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed HandlerReferenceBox\n *\n * @public\n */\nexport function readHdlr(view: IsoBoxReadView): HandlerReferenceBox {\n\treturn {\n\t\ttype: 'hdlr',\n\t\t...view.readFullBox(),\n\t\tpreDefined: view.readUint(4),\n\t\thandlerType: view.readString(4),\n\t\treserved: view.readArray(UINT, 4, 3),\n\t\tname: view.readString(-1),\n\t}\n};\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readHev1(view: IsoBoxReadView): VisualSampleEntryBox<'hev1'> {\n\treturn readVisualSampleEntryBox('hev1', view)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readVisualSampleEntryBox } from './readVisualSampleEntryBox.ts'\n\n/**\n * Parse a VisualSampleEntryBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VisualSampleEntryBox\n *\n * @public\n */\nexport function readHvc1(view: IsoBoxReadView): VisualSampleEntryBox<'hvc1'> {\n\treturn readVisualSampleEntryBox('hvc1', view)\n}\n","import type { WebVttCueIdBox } from '../boxes/WebVttCueIdBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTCueIdBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTCueIdBox\n *\n * @public\n */\nexport function readIden(view: IsoBoxReadView): WebVttCueIdBox {\n\treturn {\n\t\ttype: 'iden',\n\t\tcueId: view.readUtf8(-1),\n\t}\n};\n","import type { IdentifiedMediaDataBox } from '../boxes/IdentifiedMediaDataBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a IdentifiedMediaDataBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed IdentifiedMediaDataBox\n *\n * @public\n */\nexport function readImda(view: IsoBoxReadView): IdentifiedMediaDataBox {\n\treturn {\n\t\ttype: 'imda',\n\t\timdaIdentifier: view.readUint(4),\n\t\tdata: view.readData(-1),\n\t}\n};\n","import type { TrackKindBox } from '../boxes/TrackKindBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackKinBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackKindBox\n *\n * @public\n */\nexport function readKind(view: IsoBoxReadView): TrackKindBox {\n\treturn {\n\t\ttype: 'kind',\n\t\t...view.readFullBox(),\n\t\tschemeUri: view.readUtf8(-1),\n\t\tvalue: view.readUtf8(-1),\n\t}\n};\n","import type { LabelBox } from '../boxes/LabelBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a LabelBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed LabelBox\n *\n * @public\n */\nexport function readLabl(view: IsoBoxReadView): LabelBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'labl',\n\t\tversion,\n\t\tflags,\n\t\tisGroupLabel: (flags & 0x1) !== 0,\n\t\tlabelId: view.readUint(2),\n\t\tlanguage: view.readUtf8(-1),\n\t\tlabel: view.readUtf8(-1),\n\t}\n}\n","import type { MediaDataBox } from '../boxes/MediaDataBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MediaDataBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MediaDataBox\n *\n * @public\n */\nexport function readMdat(view: IsoBoxReadView): MediaDataBox {\n\treturn {\n\t\ttype: 'mdat',\n\t\tdata: view.readData(-1),\n\t}\n};\n","import type { MediaHeaderBox } from '../boxes/MediaHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MediaHeaderBox\n *\n * @public\n */\nexport function readMdhd(view: IsoBoxReadView): MediaHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\n\tconst creationTime = view.readUint(version == 1 ? 8 : 4)\n\tconst modificationTime = view.readUint(version == 1 ? 8 : 4)\n\tconst timescale = view.readUint(4)\n\tconst duration = view.readUint(version == 1 ? 8 : 4)\n\tconst lang = view.readUint(2)\n\tconst language = String.fromCharCode(((lang >> 10) & 0x1F) + 0x60,\n\t\t((lang >> 5) & 0x1F) + 0x60,\n\t\t(lang & 0x1F) + 0x60)\n\n\tconst preDefined = view.readUint(2)\n\n\treturn {\n\t\ttype: 'mdhd',\n\t\tversion,\n\t\tflags,\n\t\tcreationTime,\n\t\tmodificationTime,\n\t\ttimescale,\n\t\tduration,\n\t\tlanguage,\n\t\tpreDefined,\n\t}\n}\n","import type { MovieExtendsHeaderBox } from '../boxes/MovieExtendsHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MovieExtendsHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MovieExtendsHeaderBox\n *\n * @public\n */\nexport function readMehd(view: IsoBoxReadView): MovieExtendsHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'mehd',\n\t\tversion,\n\t\tflags,\n\t\tfragmentDuration: view.readUint((version === 1) ? 8 : 4),\n\t}\n};\n","import type { MetaBox, MetaBoxChild } from '../boxes/MetaBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MetaBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MetaBox\n *\n * @public\n */\nexport function readMeta(view: IsoBoxReadView): MetaBox {\n\treturn {\n\t\ttype: 'meta',\n\t\t...view.readFullBox(),\n\t\tboxes: view.readBoxes<MetaBoxChild>(),\n\t}\n}\n","import type { MovieFragmentHeaderBox } from '../boxes/MovieFragmentHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MovieFragmentHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MovieFragmentHeaderBox\n *\n * @public\n */\nexport function readMfhd(view: IsoBoxReadView): MovieFragmentHeaderBox {\n\treturn {\n\t\ttype: 'mfhd',\n\t\t...view.readFullBox(),\n\t\tsequenceNumber: view.readUint(4),\n\t}\n};\n","import type { MovieFragmentRandomAccessOffsetBox } from '../boxes/MovieFragmentRandomAccessOffsetBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a MovieFragmentRandomAccessBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed MovieFragmentRandomAccessBox\n *\n * @public\n */\nexport function readMfro(view: IsoBoxReadView): MovieFragmentRandomAccessOffsetBox {\n\treturn {\n\t\ttype: 'mfro',\n\t\t...view.readFullBox(),\n\t\tmfraSize: view.readUint(4),\n\t}\n};\n\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readAudioSampleEntryBox } from './readAudioSampleEntryBox.ts'\n\n/**\n * Parse an AudioSampleEntry from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed AudioSampleEntry\n *\n * @public\n */\nexport function readMp4a(view: IsoBoxReadView): AudioSampleEntryBox<'mp4a'> {\n\treturn readAudioSampleEntryBox('mp4a', view)\n};\n","import type { MovieHeaderBox } from '../boxes/MovieHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a Box from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed Box\n *\n * @public\n */\nexport function readMvhd(view: IsoBoxReadView): MovieHeaderBox {\n\tconst { readUint, readTemplate, readArray } = view\n\n\tconst { version, flags } = view.readFullBox()\n\tconst size = (version == 1) ? 8 : 4\n\n\treturn {\n\t\ttype: 'mvhd',\n\t\tversion,\n\t\tflags,\n\t\tcreationTime: readUint(size),\n\t\tmodificationTime: readUint(size),\n\t\ttimescale: readUint(4),\n\t\tduration: readUint(size),\n\t\trate: readTemplate(4),\n\t\tvolume: readTemplate(2),\n\t\treserved1: readUint(2),\n\t\treserved2: readArray(UINT, 4, 2),\n\t\tmatrix: readArray(TEMPLATE, 4, 9),\n\t\tpreDefined: readArray(UINT, 4, 6),\n\t\tnextTrackId: readUint(4),\n\t}\n};\n","import type { WebVttCuePayloadBox } from '../boxes/WebVttCuePayloadBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTCuePayloadBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTCuePayloadBox\n *\n * @public\n */\nexport function readPayl(view: IsoBoxReadView): WebVttCuePayloadBox {\n\treturn {\n\t\ttype: 'payl',\n\t\tcueText: view.readUtf8(-1),\n\t}\n};\n","import type { ProducerReferenceTimeBox } from '../boxes/ProducerReferenceTimeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a ProducerReferenceTimeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed ProducerReferenceTimeBox\n *\n * @public\n */\nexport function readPrft(view: IsoBoxReadView): ProducerReferenceTimeBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'prft',\n\t\tversion,\n\t\tflags,\n\t\treferenceTrackId: view.readUint(4),\n\t\tntpTimestampSec: view.readUint(4),\n\t\tntpTimestampFrac: view.readUint(4),\n\t\tmediaTime: view.readUint(version === 1 ? 8 : 4),\n\t}\n};\n","import type { Entity } from '../boxes/Entity.ts'\nimport type { PreselectionGroupBox, PreselectionGroupBoxChild } from '../boxes/PreselectionGroupBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a PreselectionGroupBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed PreselectionGroupBox\n *\n * @public\n */\nexport function readPrsl(view: IsoBoxReadView): PreselectionGroupBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst groupId = view.readUint(4)\n\tconst numEntitiesInGroup = view.readUint(4)\n\tconst entities = view.readEntries<Entity>(numEntitiesInGroup, () => ({\n\t\tentityId: view.readUint(4),\n\t}))\n\tconst preselectionTag = flags & 0x1000 ? view.readUtf8(-1) : undefined\n\tconst selectionPriority = flags & 0x2000 ? view.readUint(1) : undefined\n\tconst interleavingTag = flags & 0x4000 ? view.readUtf8(-1) : undefined\n\n\treturn {\n\t\ttype: 'prsl',\n\t\tversion,\n\t\tflags,\n\t\tgroupId,\n\t\tnumEntitiesInGroup,\n\t\tentities,\n\t\tpreselectionTag,\n\t\tselectionPriority,\n\t\tinterleavingTag,\n\t\tboxes: view.readBoxes<PreselectionGroupBoxChild>(),\n\t}\n}\n","import type { ProtectionSystemSpecificHeaderBox } from '../boxes/ProtectionSystemSpecificHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a ProtectionSystemSpecificHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed ProtectionSystemSpecificHeaderBox\n *\n * @public\n */\nexport function readPssh(view: IsoBoxReadView): ProtectionSystemSpecificHeaderBox {\n\tconst { readUint, readArray } = view\n\tconst { version, flags } = view.readFullBox()\n\n\tconst systemId = readArray(UINT, 1, 16)\n\n\tlet kidCount: number = 0\n\tlet kid: number[] = []\n\n\tif (version > 0) {\n\t\tkidCount = readUint(4)\n\t\tkid = readArray(UINT, 1, kidCount)\n\t}\n\n\tconst dataSize = readUint(4)\n\tconst data = readArray(UINT, 1, dataSize)\n\n\treturn {\n\t\ttype: 'pssh',\n\t\tversion,\n\t\tflags,\n\t\tsystemId,\n\t\tkidCount,\n\t\tkid,\n\t\tdataSize,\n\t\tdata,\n\t}\n};\n","import type { SchemeTypeBox } from '../boxes/SchemeTypeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SchemeTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SchemeTypeBox\n *\n * @public\n */\nexport function readSchm(view: IsoBoxReadView): SchemeTypeBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'schm',\n\t\tversion,\n\t\tflags,\n\t\tschemeType: view.readUint(4),\n\t\tschemeVersion: view.readUint(4),\n\t\tschemeUri: flags & 0x000001 ? view.readString(-1) : undefined,\n\t}\n};\n","import type { SampleDependencyTypeBox } from '../boxes/SampleDependencyTypeBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SampleDependencyTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SampleDependencyTypeBox\n *\n * @public\n */\nexport function readSdtp(view: IsoBoxReadView): SampleDependencyTypeBox {\n\treturn {\n\t\ttype: 'sdtp',\n\t\t...view.readFullBox(),\n\t\tsampleDependencyTable: view.readArray(UINT, 1, view.bytesRemaining),\n\t}\n};\n","import type { SegmentIndexBox } from '../boxes/SegmentIndexBox.ts'\nimport type { SegmentIndexReference } from '../boxes/SegmentIndexReference.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SegmentIndexBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SegmentIndexBox\n *\n * @public\n */\nexport function readSidx(view: IsoBoxReadView): SegmentIndexBox {\n\tconst { readUint } = view\n\tconst { version, flags } = view.readFullBox()\n\tconst v1 = version === 1\n\tconst size = v1 ? 8 : 4\n\n\tconst referenceId = readUint(4)\n\tconst timescale = readUint(4)\n\tconst earliestPresentationTime = readUint(size)\n\tconst firstOffset = readUint(size)\n\tconst reserved = readUint(2)\n\tconst referenceCount = readUint(2)\n\tconst references = view.readEntries<SegmentIndexReference>(referenceCount, () => {\n\t\tconst entry = {} as any\n\n\t\tentry.reference = readUint(4)\n\t\tentry.subsegmentDuration = readUint(4)\n\t\tentry.sap = readUint(4)\n\t\tentry.referenceType = (entry.reference >> 31) & 0x00000001\n\t\tentry.referencedSize = entry.reference & 0x7FFFFFFF\n\t\tentry.startsWithSap = (entry.sap >> 31) & 0x00000001\n\t\tentry.sapType = (entry.sap >> 28) & 0x00000007\n\t\tentry.sapDeltaTime = (entry.sap & 0x0FFFFFFF)\n\n\t\treturn entry\n\t})\n\n\treturn {\n\t\ttype: 'sidx',\n\t\tversion,\n\t\tflags,\n\t\treferenceId,\n\t\ttimescale,\n\t\tearliestPresentationTime,\n\t\tfirstOffset,\n\t\treserved,\n\t\treferences,\n\t}\n};\n","import type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport { readFree } from './readFree.ts'\n\n/**\n * Parse a FreeSpaceBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed FreeSpaceBox\n *\n * @public\n */\nexport function readSkip(view: IsoBoxReadView): FreeSpaceBox<'skip'> {\n\treturn {\n\t\t...readFree(view),\n\t\ttype: 'skip',\n\t}\n};\n","import type { SoundMediaHeaderBox } from '../boxes/SoundMediaHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SoundMediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SoundMediaHeaderBox\n *\n * @public\n */\nexport function readSmhd(view: IsoBoxReadView): SoundMediaHeaderBox {\n\treturn {\n\t\ttype: 'smhd',\n\t\t...view.readFullBox(),\n\t\tbalance: view.readUint(2),\n\t\treserved: view.readUint(2),\n\t}\n};\n","import type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { SubsegmentIndexBox } from '../boxes/SubsegmentIndexBox.ts'\n\n/**\n * Parse a SubsegmentIndexBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SubsegmentIndexBox\n *\n * @public\n */\nexport function readSsix(view: IsoBoxReadView): SubsegmentIndexBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst subsegmentCount = view.readUint(4)\n\tconst subsegments = view.readEntries(subsegmentCount, () => {\n\t\tconst rangesCount = view.readUint(4)\n\t\tconst ranges = view.readEntries(rangesCount, () => ({\n\t\t\tlevel: view.readUint(1),\n\t\t\trangeSize: view.readUint(3),\n\t\t}))\n\t\treturn { rangesCount, ranges }\n\t})\n\n\treturn {\n\t\ttype: 'ssix',\n\t\tversion,\n\t\tflags,\n\t\tsubsegmentCount,\n\t\tsubsegments,\n\t}\n};\n","import type { SubtitleMediaHeaderBox } from '../boxes/SubtitleMediaHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SubtitleMediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SubtitleMediaHeaderBox\n *\n * @public\n */\nexport function readSthd(view: IsoBoxReadView): SubtitleMediaHeaderBox {\n\treturn {\n\t\ttype: 'sthd',\n\t\t...view.readFullBox(),\n\t}\n};\n","import type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport type { SampleDescriptionBox } from '../boxes/SampleDescriptionBox.ts'\nimport type { SampleEntryBox } from '../boxes/SampleEntryBox.ts'\n\n/**\n * Parse a SampleDescriptionBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SampleDescriptionBox\n *\n * @public\n */\nexport function readStsd<E extends SampleEntryBox = SampleEntryBox>(view: IsoBoxReadView): SampleDescriptionBox<E> {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\n\treturn {\n\t\ttype: 'stsd',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries: view.readBoxes<E>(entryCount),\n\t}\n};\n","import type { SyncSample } from '../boxes/SyncSample.ts'\nimport type { SyncSampleBox } from '../boxes/SyncSampleBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SyncSampleBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SyncSampleBox\n *\n * @public\n */\nexport function readStss(view: IsoBoxReadView): SyncSampleBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\n\treturn {\n\t\ttype: 'stss',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries: view.readEntries<SyncSample>(entryCount, () => ({\n\t\t\tsampleNumber: view.readUint(4),\n\t\t})),\n\t}\n};\n","import type { WebVttSettingsBox } from '../boxes/WebVttSettingsBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTSettingsBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTSettingsBox\n *\n * @public\n */\nexport function readSttg(view: IsoBoxReadView): WebVttSettingsBox {\n\treturn {\n\t\ttype: 'sttg',\n\t\tsettings: view.readUtf8(-1),\n\t}\n};\n","import type { DecodingTimeToSampleBox } from '../boxes/DecodingTimeToSampleBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a DecodingTimeToSampleBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed DecodingTimeToSampleBox\n *\n * @public\n */\nexport function readStts(view: IsoBoxReadView): DecodingTimeToSampleBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries(entryCount, () => ({\n\t\tsampleCount: view.readUint(4),\n\t\tsampleDelta: view.readUint(4),\n\t}))\n\n\treturn {\n\t\ttype: 'stts',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { SegmentTypeBox } from '../boxes/SegmentTypeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\nimport { readFtyp } from './readFtyp.ts'\n\n/**\n * Parse a SegmentTypeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SegmentTypeBox\n *\n * @public\n */\nexport function readStyp(view: IsoBoxReadView): SegmentTypeBox {\n\treturn {\n\t\t...readFtyp(view),\n\t\ttype: 'styp',\n\t}\n}\n","import type { SubsampleInformationBox } from '../boxes/SubsampleInformationBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a SubSampleInformationBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed SubSampleInformationBox\n *\n * @public\n */\nexport function readSubs(view: IsoBoxReadView): SubsampleInformationBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst entryCount = view.readUint(4)\n\tconst entries = view.readEntries(entryCount, () => {\n\t\tconst sampleDelta = view.readUint(4)\n\t\tconst subsampleCount = view.readUint(2)\n\t\tconst subsamples = view.readEntries(subsampleCount, () => ({\n\t\t\tsubsampleSize: view.readUint((version === 1) ? 4 : 2),\n\t\t\tsubsamplePriority: view.readUint(1),\n\t\t\tdiscardable: view.readUint(1),\n\t\t\tcodecSpecificParameters: view.readUint(4),\n\t\t}))\n\n\t\treturn {\n\t\t\tsampleDelta,\n\t\t\tsubsampleCount,\n\t\t\tsubsamples,\n\t\t}\n\t})\n\n\treturn {\n\t\ttype: 'subs',\n\t\tversion,\n\t\tflags,\n\t\tentryCount,\n\t\tentries,\n\t}\n};\n","import type { TrackEncryptionBox } from '../boxes/TrackEncryptionBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackEncryptionBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackEncryptionBox\n *\n * @public\n */\nexport function readTenc(view: IsoBoxReadView): TrackEncryptionBox {\n\treturn {\n\t\ttype: 'tenc',\n\t\t...view.readFullBox(),\n\t\tdefaultIsEncrypted: view.readUint(3),\n\t\tdefaultIvSize: view.readUint(1),\n\t\tdefaultKid: view.readArray(UINT, 1, 16),\n\t}\n};\n","import type { TrackFragmentBaseMediaDecodeTimeBox } from '../boxes/TrackFragmentBaseMediaDecodeTimeBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackFragmentDecodeTimeBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackFragmentDecodeTimeBox\n *\n * @public\n */\nexport function readTfdt(view: IsoBoxReadView): TrackFragmentBaseMediaDecodeTimeBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'tfdt',\n\t\tversion,\n\t\tflags,\n\t\tbaseMediaDecodeTime: view.readUint((version == 1) ? 8 : 4),\n\t}\n};\n","import type { TrackFragmentHeaderBox } from '../boxes/TrackFragmentHeaderBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackFragmentHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackFragmentHeaderBox\n *\n * @public\n */\nexport function readTfhd(view: IsoBoxReadView): TrackFragmentHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\n\treturn {\n\t\ttype: 'tfhd',\n\t\tversion,\n\t\tflags,\n\t\ttrackId: view.readUint(4),\n\t\tbaseDataOffset: flags & 0x01 ? view.readUint(8) : undefined,\n\t\tsampleDescriptionIndex: flags & 0x02 ? view.readUint(4) : undefined,\n\t\tdefaultSampleDuration: flags & 0x08 ? view.readUint(4) : undefined,\n\t\tdefaultSampleSize: flags & 0x10 ? view.readUint(4) : undefined,\n\t\tdefaultSampleFlags: flags & 0x20 ? view.readUint(4) : undefined,\n\t}\n};\n","import type { TrackFragmentRandomAccessBox } from '../boxes/TrackFragmentRandomAccessBox.ts'\nimport type { TrackFragmentRandomAccessEntry } from '../boxes/TrackFragmentRandomAccessEntry.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackFragmentRandomAccessBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackFragmentRandomAccessBox\n *\n * @public\n */\nexport function readTfra(view: IsoBoxReadView): TrackFragmentRandomAccessBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst trackId = view.readUint(4)\n\tconst reserved = view.readUint(4)\n\n\tconst lengthSizeOfTrafNum = (reserved & 0x00000030) >> 4\n\tconst lengthSizeOfTrunNum = (reserved & 0x0000000C) >> 2\n\tconst lengthSizeOfSampleNum = (reserved & 0x00000003)\n\n\tconst numberOfEntry = view.readUint(4)\n\n\tconst entries = view.readEntries<TrackFragmentRandomAccessEntry>(numberOfEntry, () => ({\n\t\ttime: view.readUint((version === 1) ? 8 : 4),\n\t\tmoofOffset: view.readUint((version === 1) ? 8 : 4),\n\t\ttrafNumber: view.readUint(lengthSizeOfTrafNum + 1),\n\t\ttrunNumber: view.readUint(lengthSizeOfTrunNum + 1),\n\t\tsampleNumber: view.readUint(lengthSizeOfSampleNum + 1),\n\t}))\n\n\treturn {\n\t\ttype: 'tfra',\n\t\tversion,\n\t\tflags,\n\t\ttrackId,\n\t\treserved,\n\t\tlengthSizeOfTrafNum,\n\t\tlengthSizeOfTrunNum,\n\t\tlengthSizeOfSampleNum,\n\t\tnumberOfEntry,\n\t\tentries,\n\t}\n};\n","import type { TrackHeaderBox } from '../boxes/TrackHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackHeaderBox\n *\n * @public\n */\nexport function readTkhd(view: IsoBoxReadView): TrackHeaderBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst size = version === 1 ? 8 : 4\n\n\treturn {\n\t\ttype: 'tkhd',\n\t\tversion,\n\t\tflags,\n\t\tcreationTime: view.readUint(size),\n\t\tmodificationTime: view.readUint(size),\n\t\ttrackId: view.readUint(4),\n\t\treserved1: view.readUint(4),\n\t\tduration: view.readUint(size),\n\t\treserved2: view.readArray(UINT, 4, 2),\n\t\tlayer: view.readUint(2),\n\t\talternateGroup: view.readUint(2),\n\t\tvolume: view.readTemplate(2),\n\t\treserved3: view.readUint(2),\n\t\tmatrix: view.readArray(TEMPLATE, 4, 9),\n\t\twidth: view.readTemplate(4),\n\t\theight: view.readTemplate(4),\n\t}\n};\n","import type { TrackExtendsBox } from '../boxes/TrackExtendsBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackExtendsBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackExtendsBox\n *\n * @public\n */\nexport function readTrex(view: IsoBoxReadView): TrackExtendsBox {\n\treturn {\n\t\ttype: 'trex',\n\t\t...view.readFullBox(),\n\t\ttrackId: view.readUint(4),\n\t\tdefaultSampleDescriptionIndex: view.readUint(4),\n\t\tdefaultSampleDuration: view.readUint(4),\n\t\tdefaultSampleSize: view.readUint(4),\n\t\tdefaultSampleFlags: view.readUint(4),\n\t}\n};\n","import type { TrackRunBox } from '../boxes/TrackRunBox.ts'\nimport type { TrackRunSample } from '../boxes/TrackRunSample.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a TrackRunBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed TrackRunBox\n *\n * @public\n */\nexport function readTrun(view: IsoBoxReadView): TrackRunBox {\n\tconst { version, flags } = view.readFullBox()\n\tconst sampleCount = view.readUint(4)\n\tlet dataOffset: number | undefined\n\tlet firstSampleFlags: number | undefined\n\n\tif (flags & 0x1) {\n\t\tdataOffset = view.readInt(4)\n\t}\n\n\tif (flags & 0x4) {\n\t\tfirstSampleFlags = view.readUint(4)\n\t}\n\n\tconst samples = view.readEntries<TrackRunSample>(sampleCount, () => {\n\t\tconst sample: TrackRunSample = {}\n\n\t\tif (flags & 0x100) {\n\t\t\tsample.sampleDuration = view.readUint(4)\n\t\t}\n\t\tif (flags & 0x200) {\n\t\t\tsample.sampleSize = view.readUint(4)\n\t\t}\n\t\tif (flags & 0x400) {\n\t\t\tsample.sampleFlags = view.readUint(4)\n\t\t}\n\t\tif (flags & 0x800) {\n\t\t\tsample.sampleCompositionTimeOffset = (version === 1) ? view.readInt(4) : view.readUint(4)\n\t\t}\n\n\t\treturn sample\n\t})\n\n\treturn {\n\t\ttype: 'trun',\n\t\tversion,\n\t\tflags,\n\t\tsampleCount,\n\t\tdataOffset,\n\t\tfirstSampleFlags,\n\t\tsamples,\n\t}\n};\n","import type { DataEntryUrlBox } from '../boxes/DataEntryUrlBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a UrlBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed UrlBox\n *\n * @public\n */\nexport function readUrl(view: IsoBoxReadView): DataEntryUrlBox {\n\treturn {\n\t\ttype: 'url ',\n\t\t...view.readFullBox(),\n\t\tlocation: view.readString(-1),\n\t}\n};\n","import type { DataEntryUrnBox } from '../boxes/DataEntryUrnBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a UrnBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed UrnBox\n *\n * @public\n */\nexport function readUrn(view: IsoBoxReadView): DataEntryUrnBox {\n\treturn {\n\t\ttype: 'urn ',\n\t\t...view.readFullBox(),\n\t\tname: view.readString(-1),\n\t\tlocation: view.readString(-1),\n\t}\n};\n","import type { WebVttSourceLabelBox } from '../boxes/WebVttSourceLabelBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTSourceLabelBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVTTSourceLabelBox\n *\n * @public\n */\nexport function readVlab(view: IsoBoxReadView): WebVttSourceLabelBox {\n\treturn {\n\t\ttype: 'vlab',\n\t\tsourceLabel: view.readUtf8(-1),\n\t}\n};\n","import type { VideoMediaHeaderBox } from '../boxes/VideoMediaHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a VideoMediaHeaderBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed VideoMediaHeaderBox\n *\n * @public\n */\nexport function readVmhd(view: IsoBoxReadView): VideoMediaHeaderBox {\n\treturn {\n\t\ttype: 'vmhd',\n\t\t...view.readFullBox(),\n\t\tgraphicsmode: view.readUint(2),\n\t\topcolor: view.readArray(UINT, 2, 3),\n\t}\n};\n","import type { WebVttConfigurationBox } from '../boxes/WebVttConfigurationBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTTConfigurationBox from an IsoView\n *\n * @param view - The IsoView to read data from\n *\n * @returns A parsed WebVttConfigurationBox\n *\n * @public\n */\nexport function readVttC(view: IsoBoxReadView): WebVttConfigurationBox {\n\treturn {\n\t\ttype: 'vttC',\n\t\tconfig: view.readUtf8(),\n\t}\n};\n","import type { WebVttEmptySampleBox } from '../boxes/WebVttEmptySampleBox.ts'\nimport type { IsoBoxReadView } from '../IsoBoxReadView.ts'\n\n/**\n * Parse a WebVTT Empty Sample Box from an IsoView\n *\n * @returns A parsed WebVTT Empty Sample Box\n *\n * @public\n */\n// eslint-disable-next-line\nexport function readVtte(_: IsoBoxReadView): WebVttEmptySampleBox {\n\t// Nothing should happen here.\n\treturn {\n\t\ttype: 'vtte',\n\t}\n};\n","import type { FullBox } from '../boxes/FullBox.ts'\n\n/**\n * Check if a box is a full box\n *\n * @param box - The box to check\n *\n * @returns `true` if the box is a full box, `false` otherwise\n *\n * @public\n */\nexport function isFullBox(box: any): box is FullBox {\n\treturn 'version' in box && 'flags' in box\n}\n","import type { AudioRenderingIndicationBox } from '../boxes/AudioRenderingIndicationBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an AudioRenderingIndicationBox to an IsoDataWriter.\n *\n * @param box - The AudioRenderingIndicationBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeArdi(box: AudioRenderingIndicationBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst audioRenderingIndicationSize = 1\n\tconst totalSize = headerSize + fullBoxSize + audioRenderingIndicationSize\n\n\tconst writer = new IsoBoxWriteView('ardi', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.audioRenderingIndication, 1)\n\n\treturn writer\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport type { AudioSampleEntryType } from '../boxes/AudioSampleEntryType.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write an AudioSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.2.3 Audio Sample Entry\n *\n * @param box - The AudioSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAudioSampleEntryBox<T extends AudioSampleEntryType = AudioSampleEntryType>(box: AudioSampleEntryBox<T>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst reserved1Size = 6\n\tconst dataReferenceIndexSize = 2\n\tconst reserved2Size = 8 // 2 x 4 bytes\n\tconst channelcountSize = 2\n\tconst samplesizeSize = 2\n\tconst preDefinedSize = 2\n\tconst reserved3Size = 2\n\tconst samplerateSize = 4\n\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\n\tconst totalSize = headerSize + reserved1Size + dataReferenceIndexSize + reserved2Size +\n\t\tchannelcountSize + samplesizeSize + preDefinedSize + reserved3Size + samplerateSize + size\n\n\tconst writer = new IsoBoxWriteView(box.type, totalSize)\n\n\twriter.writeArray(box.reserved1, UINT, 1, 6)\n\twriter.writeUint(box.dataReferenceIndex, 2)\n\twriter.writeArray(box.reserved2, UINT, 4, 2)\n\twriter.writeUint(box.channelcount, 2)\n\twriter.writeUint(box.samplesize, 2)\n\twriter.writeUint(box.preDefined, 2)\n\twriter.writeUint(box.reserved3, 2)\n\twriter.writeTemplate(box.samplerate, 4)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { VisualSampleEntryType } from '../boxes/VisualSampleEntryType.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a VisualSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.1.3 Visual Sample Entry\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The configuration for the writer\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVisualSampleEntryBox<T extends VisualSampleEntryType = VisualSampleEntryType>(box: VisualSampleEntryBox<T>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst reserved1Size = 6\n\tconst dataReferenceIndexSize = 2\n\tconst preDefined1Size = 2\n\tconst reserved2Size = 2\n\tconst preDefined2Size = 12 // 3 x 4 bytes\n\tconst widthSize = 2\n\tconst heightSize = 2\n\tconst horizresolutionSize = 4\n\tconst vertresolutionSize = 4\n\tconst reserved3Size = 4\n\tconst frameCountSize = 2\n\tconst compressorNameSize = 32\n\tconst depthSize = 2\n\tconst preDefined3Size = 2\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\tconst totalSize = headerSize + reserved1Size + dataReferenceIndexSize + preDefined1Size +\n\t\treserved2Size + preDefined2Size + widthSize + heightSize + horizresolutionSize +\n\t\tvertresolutionSize + reserved3Size + frameCountSize + compressorNameSize +\n\t\tdepthSize + preDefined3Size + size\n\n\tconst writer = new IsoBoxWriteView(box.type, totalSize)\n\n\twriter.writeArray(box.reserved1, UINT, 1, 6)\n\twriter.writeUint(box.dataReferenceIndex, 2)\n\twriter.writeUint(box.preDefined1, 2)\n\twriter.writeUint(box.reserved2, 2)\n\twriter.writeArray(box.preDefined2, UINT, 4, 3)\n\twriter.writeUint(box.width, 2)\n\twriter.writeUint(box.height, 2)\n\twriter.writeTemplate(box.horizresolution, 4)\n\twriter.writeTemplate(box.vertresolution, 4)\n\twriter.writeUint(box.reserved3, 4)\n\twriter.writeUint(box.frameCount, 2)\n\twriter.writeArray(box.compressorName, UINT, 1, 32)\n\twriter.writeUint(box.depth, 2)\n\twriter.writeUint(box.preDefined3 & 0xFFFF, 2)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.1.3 Visual Sample Entry\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc1(box: VisualSampleEntryBox<'avc1'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (avc2) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc2(box: VisualSampleEntryBox<'avc2'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (avc3) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc3(box: VisualSampleEntryBox<'avc3'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (avc4) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeAvc4(box: VisualSampleEntryBox<'avc4'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { CompositionTimeToSampleBox } from '../boxes/CompositionTimeToSampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a CompositionTimeToSampleBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.1.3 Composition Time to Sample Box\n *\n * @param box - The CompositionTimeToSampleBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeCtts(box: CompositionTimeToSampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entriesSize = box.entryCount * 8 // 4 bytes sampleCount + 4 bytes sampleOffset\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('ctts', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleCount, 4)\n\t\t// For version 1, sampleOffset is signed, but we store as unsigned\n\t\twriter.writeUint(entry.sampleOffset, 4)\n\t}\n\n\treturn writer\n}\n","import type { DataReferenceBox } from '../boxes/DataReferenceBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a DataReferenceBox to an IsoDataWriter.\n *\n * @param box - The DataReferenceBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeDref(box: DataReferenceBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entryCount = box.entries.length\n\n\t// TODO: Is there a way to avoid creating the intermediate Uint8Arrays?\n\tconst { bytes, size } = writeChildBoxes(box.entries, config)\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + size\n\n\tconst writer = new IsoBoxWriteView('dref', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(entryCount, 4)\n\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { ExtendedLanguageBox } from '../boxes/ExtendedLanguageBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an ExtendedLanguageBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.4.6 Extended Language Tag\n *\n * @param box - The ExtendedLanguageBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeElng(box: ExtendedLanguageBox): IsoBoxWriteView {\n\tconst extendedLanguageBytes = encodeText(box.extendedLanguage)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst extendedLanguageSize = extendedLanguageBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + extendedLanguageSize\n\n\tconst writer = new IsoBoxWriteView('elng', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUtf8TerminatedString(box.extendedLanguage)\n\n\treturn writer\n}\n","import type { EditListBox } from '../boxes/EditListBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an EditListBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.6 Edit List Box\n *\n * @param box - The EditListBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeElst(box: EditListBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entrySize = size + size + 2 + 2 // segmentDuration + mediaTime + mediaRateInteger + mediaRateFraction\n\tconst entriesSize = box.entryCount * entrySize\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('elst', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.segmentDuration, size)\n\t\twriter.writeInt(entry.mediaTime, size)\n\t\twriter.writeInt(entry.mediaRateInteger, 2)\n\t\twriter.writeInt(entry.mediaRateFraction, 2)\n\t}\n\n\treturn writer\n}\n","import type { EventMessageBox } from '../boxes/EventMessageBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an EventMessageBox to an IsoDataWriter.\n *\n * ISO/IEC 23009-1 - 5.10.3.3 Event Message Box\n *\n * @param box - The EventMessageBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeEmsg(box: EventMessageBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\n\tlet contentSize: number\n\n\tif (box.version === 0) {\n\t\t// version 0: scheme_id_uri, value, timescale, presentation_time_delta, event_duration, id, message_data\n\t\tcontentSize = (box.schemeIdUri.length + 1) + (box.value.length + 1) + 4 + 4 + 4 + 4 + box.messageData.length\n\t} else {\n\t\t// version 1: timescale, presentation_time, event_duration, id, scheme_id_uri, value, message_data\n\t\tcontentSize = 4 + 8 + 4 + 4 + (box.schemeIdUri.length + 1) + (box.value.length + 1) + box.messageData.length\n\t}\n\n\tconst totalSize = headerSize + fullBoxSize + contentSize\n\n\tconst writer = new IsoBoxWriteView('emsg', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\tif (box.version === 0) {\n\t\twriter.writeTerminatedString(box.schemeIdUri)\n\t\twriter.writeTerminatedString(box.value)\n\t\twriter.writeUint(box.timescale, 4)\n\t\twriter.writeUint(box.presentationTimeDelta ?? 0, 4)\n\t\twriter.writeUint(box.eventDuration, 4)\n\t\twriter.writeUint(box.id, 4)\n\t} else {\n\t\twriter.writeUint(box.timescale, 4)\n\t\twriter.writeUint(box.presentationTime ?? 0, 8)\n\t\twriter.writeUint(box.eventDuration, 4)\n\t\twriter.writeUint(box.id, 4)\n\t\twriter.writeTerminatedString(box.schemeIdUri)\n\t\twriter.writeTerminatedString(box.value)\n\t}\n\n\twriter.writeBytes(box.messageData)\n\n\treturn writer\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeAudioSampleEntryBox } from './writeAudioSampleEntryBox.ts'\n\n/**\n * Write an AudioSampleEntryBox (enca) to an IsoDataWriter.\n *\n * @param box - The AudioSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeEnca(box: AudioSampleEntryBox<'enca'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeAudioSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (encv) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeEncv(box: VisualSampleEntryBox<'encv'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a FreeSpaceBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.1.2 Free Space Box\n *\n * @param box - The FreeSpaceBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeFree(box: FreeSpaceBox<'free'>): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('free', totalSize)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import type { OriginalFormatBox } from '../boxes/OriginalFormatBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an OriginalFormatBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.12.2 Original Format Box\n *\n * @param box - The OriginalFormatBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeFrma(box: OriginalFormatBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataFormatSize = 4\n\tconst totalSize = headerSize + dataFormatSize\n\n\tconst writer = new IsoBoxWriteView('frma', totalSize)\n\twriter.writeUint(box.dataFormat, 4)\n\n\treturn writer\n}\n","import type { FileTypeBox } from '../boxes/FileTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a FileTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 4.3 File Type Box\n *\n * @param box - The FileTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeFtyp(box: FileTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst majorBrandSize = 4\n\tconst minorVersionSize = 4\n\tconst compatibleBrandsSize = box.compatibleBrands.length * 4\n\tconst totalSize = headerSize + majorBrandSize + minorVersionSize + compatibleBrandsSize\n\n\tconst writer = new IsoBoxWriteView('ftyp', totalSize)\n\twriter.writeString(box.majorBrand)\n\twriter.writeUint(box.minorVersion, 4)\n\n\tfor (const brand of box.compatibleBrands) {\n\t\twriter.writeString(brand)\n\t}\n\n\treturn writer\n}\n","import type { HandlerReferenceBox } from '../boxes/HandlerReferenceBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a HandlerReferenceBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.4.3 Handler Reference Box\n *\n * @param box - The HandlerReferenceBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeHdlr(box: HandlerReferenceBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst preDefinedSize = 4\n\tconst handlerTypeSize = 4\n\tconst reservedSize = 12 // 3 x 4 bytes\n\tconst nameSize = box.name.length + 1 // null-terminated string\n\tconst totalSize = headerSize + fullBoxSize + preDefinedSize + handlerTypeSize + reservedSize + nameSize\n\n\tconst writer = new IsoBoxWriteView('hdlr', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.preDefined, 4)\n\twriter.writeString(box.handlerType)\n\twriter.writeArray(box.reserved, UINT, 4, 3)\n\twriter.writeTerminatedString(box.name)\n\n\treturn writer\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (hev1) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeHev1(box: VisualSampleEntryBox<'hev1'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import type { VisualSampleEntryBox } from '../boxes/VisualSampleEntryBox.ts'\nimport type { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeVisualSampleEntryBox } from './writeVisualSampleEntryBox.ts'\n\n/**\n * Write a VisualSampleEntryBox (hvc1) to an IsoDataWriter.\n *\n * @param box - The VisualSampleEntryBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeHvc1(box: VisualSampleEntryBox<'hvc1'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeVisualSampleEntryBox(box, config)\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttCueIdBox } from '../boxes/WebVttCueIdBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttCueIdBox to an IsoDataWriter.\n *\n * @param box - The WebVttCueIdBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeIden(box: WebVttCueIdBox): IsoBoxWriteView {\n\tconst cueIdBytes = encodeText(box.cueId)\n\n\tconst headerSize = 8\n\tconst cueIdSize = cueIdBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + cueIdSize\n\n\tconst writer = new IsoBoxWriteView('iden', totalSize)\n\twriter.writeUtf8TerminatedString(box.cueId)\n\n\treturn writer\n}\n","import type { IdentifiedMediaDataBox } from '../boxes/IdentifiedMediaDataBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write an IdentifiedMediaDataBox to an IsoDataWriter.\n *\n * @param box - The IdentifiedMediaDataBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeImda(box: IdentifiedMediaDataBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst imdaIdentifierSize = 4\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + imdaIdentifierSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('imda', totalSize)\n\twriter.writeUint(box.imdaIdentifier, 4)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { TrackKindBox } from '../boxes/TrackKindBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackKindBox to an IsoDataWriter.\n *\n * @param box - The TrackKindBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeKind(box: TrackKindBox): IsoBoxWriteView {\n\tconst schemeUriBytes = encodeText(box.schemeUri)\n\tconst valueBytes = encodeText(box.value)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst schemeUriSize = schemeUriBytes.length + 1 // null-terminated\n\tconst valueSize = valueBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + schemeUriSize + valueSize\n\n\tconst writer = new IsoBoxWriteView('kind', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUtf8TerminatedString(box.schemeUri)\n\twriter.writeUtf8TerminatedString(box.value)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { LabelBox } from '../boxes/LabelBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a LabelBox to an IsoDataWriter.\n *\n * @param box - The LabelBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeLabl(box: LabelBox): IsoBoxWriteView {\n\tconst languageBytes = encodeText(box.language)\n\tconst labelBytes = encodeText(box.label)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst labelIdSize = 2\n\tconst languageSize = languageBytes.length + 1 // null-terminated\n\tconst labelSize = labelBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + labelIdSize + languageSize + labelSize\n\n\tconst writer = new IsoBoxWriteView('labl', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.labelId, 2)\n\twriter.writeUtf8TerminatedString(box.language)\n\twriter.writeUtf8TerminatedString(box.label)\n\n\treturn writer\n}\n","import type { MediaDataBox } from '../boxes/MediaDataBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MediaDataBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.1.1 Media Data Box\n *\n * @param box - The MediaDataBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMdat(box: MediaDataBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('mdat', totalSize)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import type { MediaHeaderBox } from '../boxes/MediaHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.4.2 Media Header Box\n *\n * @param box - The MediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMdhd(box: MediaHeaderBox): IsoBoxWriteView {\n\tconst size = box.version === 1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst timesSize = size * 3 // creationTime, modificationTime, duration\n\tconst timescaleSize = 4\n\tconst languageSize = 2\n\tconst preDefined = 2\n\tconst totalSize = headerSize + fullBoxSize + timesSize + timescaleSize + languageSize + preDefined\n\n\tconst writer = new IsoBoxWriteView('mdhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.creationTime, size)\n\twriter.writeUint(box.modificationTime, size)\n\twriter.writeUint(box.timescale, 4)\n\twriter.writeUint(box.duration, size)\n\n\t// Encode ISO-639-2/T language code as 3 5-bit integers in a 16-bit value\n\t// Format: bits 14-10 (char1), bits 9-5 (char2), bits 4-0 (char3)\n\t// Each character code is (charCode - 0x60) to convert from ASCII to 5-bit value\n\tconst lang = box.language.length >= 3\n\t\t? (((box.language.charCodeAt(0) - 0x60) & 0x1F) << 10) |\n\t\t(((box.language.charCodeAt(1) - 0x60) & 0x1F) << 5) |\n\t\t((box.language.charCodeAt(2) - 0x60) & 0x1F)\n\t\t: 0 // Default to \"und\" (undefined) if invalid\n\twriter.writeUint(lang, 2)\n\n\twriter.writeUint(box.preDefined, 2)\n\n\treturn writer\n}\n","import type { MovieExtendsHeaderBox } from '../boxes/MovieExtendsHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieExtendsHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.2 Movie Extends Header Box\n *\n * @param box - The MovieExtendsHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMehd(box: MovieExtendsHeaderBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst fragmentDurationSize = size\n\tconst totalSize = headerSize + fullBoxSize + fragmentDurationSize\n\n\tconst writer = new IsoBoxWriteView('mehd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.fragmentDuration, size)\n\n\treturn writer\n}\n","import type { MetaBox } from '../boxes/MetaBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a MetaBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.11.1 Meta Box\n *\n * @param box - The MetaBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMeta(box: MetaBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\n\tconst totalSize = headerSize + fullBoxSize + size\n\n\tconst writer = new IsoBoxWriteView('meta', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { MovieFragmentHeaderBox } from '../boxes/MovieFragmentHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieFragmentHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.5 Movie Fragment Header Box\n *\n * @param box - The MovieFragmentHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMfhd(box: MovieFragmentHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst sequenceNumberSize = 4\n\tconst totalSize = headerSize + fullBoxSize + sequenceNumberSize\n\n\tconst writer = new IsoBoxWriteView('mfhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.sequenceNumber, 4)\n\n\treturn writer\n}\n","import type { MovieFragmentRandomAccessOffsetBox } from '../boxes/MovieFragmentRandomAccessOffsetBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieFragmentRandomAccessOffsetBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.11 Movie Fragment Random Access Offset Box\n *\n * @param box - The MovieFragmentRandomAccessOffsetBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMfro(box: MovieFragmentRandomAccessOffsetBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst mfraSizeSize = 4\n\tconst totalSize = headerSize + fullBoxSize + mfraSizeSize\n\n\tconst writer = new IsoBoxWriteView('mfro', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.mfraSize, 4)\n\n\treturn writer\n}\n","import type { AudioSampleEntryBox } from '../boxes/AudioSampleEntryBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeAudioSampleEntryBox } from './writeAudioSampleEntryBox.ts'\n\n/**\n * Write an AudioSampleEntryBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.2.3 Audio Sample Entry\n *\n * @param box - The AudioSampleEntryBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMp4a(box: AudioSampleEntryBox<'mp4a'>, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\treturn writeAudioSampleEntryBox(box, config)\n}\n","import type { MovieHeaderBox } from '../boxes/MovieHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a MovieHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.2.2 Movie Header Box\n *\n * @param box - The MovieHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeMvhd(box: MovieHeaderBox): IsoBoxWriteView {\n\tconst size = box.version === 1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst timesSize = size * 3 // creationTime, modificationTime, duration\n\tconst timescaleSize = 4\n\tconst rateSize = 4\n\tconst volumeSize = 2\n\tconst reserved1Size = 2\n\tconst reserved2Size = 8 // 2 x 4 bytes\n\tconst matrixSize = 36 // 9 x 4 bytes\n\tconst preDefinedSize = 24 // 6 x 4 bytes\n\tconst nextTrackIdSize = 4\n\n\tconst totalSize = headerSize + fullBoxSize + timesSize + timescaleSize + rateSize +\n\t\tvolumeSize + reserved1Size + reserved2Size + matrixSize + preDefinedSize + nextTrackIdSize\n\n\tconst writer = new IsoBoxWriteView('mvhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.creationTime, size)\n\twriter.writeUint(box.modificationTime, size)\n\twriter.writeUint(box.timescale, 4)\n\twriter.writeUint(box.duration, size)\n\twriter.writeTemplate(box.rate, 4)\n\twriter.writeTemplate(box.volume, 2)\n\twriter.writeUint(box.reserved1, 2)\n\twriter.writeArray(box.reserved2, UINT, 4, 2)\n\twriter.writeArray(box.matrix, TEMPLATE, 4, 9)\n\twriter.writeArray(box.preDefined, UINT, 4, 6)\n\twriter.writeUint(box.nextTrackId, 4)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttCuePayloadBox } from '../boxes/WebVttCuePayloadBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttCuePayloadBox to an IsoDataWriter.\n *\n * @param box - The WebVttCuePayloadBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePayl(box: WebVttCuePayloadBox): IsoBoxWriteView {\n\tconst cueTextBytes = encodeText(box.cueText)\n\n\tconst headerSize = 8\n\tconst cueTextSize = cueTextBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + cueTextSize\n\n\tconst writer = new IsoBoxWriteView('payl', totalSize)\n\twriter.writeUtf8TerminatedString(box.cueText)\n\n\treturn writer\n}\n","import type { ProducerReferenceTimeBox } from '../boxes/ProducerReferenceTimeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a ProducerReferenceTimeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.5 Producer Reference Time Box\n *\n * @param box - The ProducerReferenceTimeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePrft(box: ProducerReferenceTimeBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst mediaTimeSize = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst referenceTrackIdSize = 4\n\tconst ntpTimestampSecSize = 4\n\tconst ntpTimestampFracSize = 4\n\tconst totalSize = headerSize + fullBoxSize + referenceTrackIdSize +\n\t\tntpTimestampSecSize + ntpTimestampFracSize + mediaTimeSize\n\n\tconst writer = new IsoBoxWriteView('prft', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.referenceTrackId, 4)\n\twriter.writeUint(box.ntpTimestampSec, 4)\n\twriter.writeUint(box.ntpTimestampFrac, 4)\n\twriter.writeUint(box.mediaTime, mediaTimeSize)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { PreselectionGroupBox } from '../boxes/PreselectionGroupBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a PreselectionGroupBox to an IsoDataWriter.\n *\n * @param box - The PreselectionGroupBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePrsl(box: PreselectionGroupBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst preselectionTagBytes = (box.flags & 0x1000) && box.preselectionTag\n\t\t? encodeText(box.preselectionTag)\n\t\t: null\n\tconst interleavingTagBytes = (box.flags & 0x4000) && box.interleavingTag\n\t\t? encodeText(box.interleavingTag)\n\t\t: null\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst groupIdSize = 4\n\tconst numEntitiesInGroupSize = 4\n\tconst entitiesSize = box.numEntitiesInGroup * 4\n\tconst preselectionTagSize = preselectionTagBytes ? preselectionTagBytes.length + 1 : 0\n\tconst selectionPrioritySize = (box.flags & 0x2000) ? 1 : 0\n\tconst interleavingTagSize = interleavingTagBytes ? interleavingTagBytes.length + 1 : 0\n\tconst { bytes, size } = writeChildBoxes(box.boxes, config)\n\n\tconst totalSize = headerSize + fullBoxSize + groupIdSize + numEntitiesInGroupSize +\n\t\tentitiesSize + preselectionTagSize + selectionPrioritySize + interleavingTagSize + size\n\n\tconst writer = new IsoBoxWriteView('prsl', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.groupId, 4)\n\twriter.writeUint(box.numEntitiesInGroup, 4)\n\n\tfor (const entity of box.entities) {\n\t\twriter.writeUint(entity.entityId, 4)\n\t}\n\n\tif (preselectionTagBytes && box.preselectionTag) {\n\t\twriter.writeUtf8TerminatedString(box.preselectionTag)\n\t}\n\n\tif (box.flags & 0x2000) {\n\t\twriter.writeUint(box.selectionPriority ?? 0, 1)\n\t}\n\n\tif (interleavingTagBytes && box.interleavingTag) {\n\t\twriter.writeUtf8TerminatedString(box.interleavingTag)\n\t}\n\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { ProtectionSystemSpecificHeaderBox } from '../boxes/ProtectionSystemSpecificHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a ProtectionSystemSpecificHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 23001-7 - 8.1 Protection System Specific Header Box\n *\n * @param box - The ProtectionSystemSpecificHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writePssh(box: ProtectionSystemSpecificHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst systemIdSize = 16\n\tconst kidCountSize = box.version > 0 ? 4 : 0\n\tconst kidSize = box.version > 0 ? box.kidCount * 16 : 0\n\tconst dataSizeField = 4\n\tconst dataSize = box.dataSize\n\tconst totalSize = headerSize + fullBoxSize + systemIdSize + kidCountSize + kidSize + dataSizeField + dataSize\n\n\tconst writer = new IsoBoxWriteView('pssh', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeArray(box.systemId, UINT, 1, 16)\n\n\tif (box.version > 0) {\n\t\twriter.writeUint(box.kidCount, 4)\n\t\twriter.writeArray(box.kid, UINT, 1, box.kidCount)\n\t}\n\n\twriter.writeUint(box.dataSize, 4)\n\twriter.writeArray(box.data, UINT, 1, box.dataSize)\n\n\treturn writer\n}\n","import type { SchemeTypeBox } from '../boxes/SchemeTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SchemeTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.12.5 Scheme Type Box\n *\n * @param box - The SchemeTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSchm(box: SchemeTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst schemeTypeSize = 4\n\tconst schemeVersionSize = 4\n\tconst schemeUriSize = (box.flags & 0x000001) && box.schemeUri ? box.schemeUri.length + 1 : 0\n\tconst totalSize = headerSize + fullBoxSize + schemeTypeSize + schemeVersionSize + schemeUriSize\n\n\tconst writer = new IsoBoxWriteView('schm', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.schemeType, 4)\n\twriter.writeUint(box.schemeVersion, 4)\n\n\tif ((box.flags & 0x000001) && box.schemeUri) {\n\t\twriter.writeTerminatedString(box.schemeUri)\n\t}\n\n\treturn writer\n}\n","import type { SampleDependencyTypeBox } from '../boxes/SampleDependencyTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SampleDependencyTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.4 Independent and Disposable Samples Box\n *\n * @param box - The SampleDependencyTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSdtp(box: SampleDependencyTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst sampleDependencyTableSize = box.sampleDependencyTable.length\n\tconst totalSize = headerSize + fullBoxSize + sampleDependencyTableSize\n\n\tconst writer = new IsoBoxWriteView('sdtp', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\tfor (const entry of box.sampleDependencyTable) {\n\t\twriter.writeUint(entry, 1)\n\t}\n\n\treturn writer\n}\n","import type { SegmentIndexBox } from '../boxes/SegmentIndexBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SegmentIndexBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.3 Segment Index Box\n *\n * @param box - The SegmentIndexBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSidx(box: SegmentIndexBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst referenceIdSize = 4\n\tconst timescaleSize = 4\n\tconst earliestPresentationTimeSize = size\n\tconst firstOffsetSize = size\n\tconst reservedSize = 2\n\tconst referenceCountSize = 2\n\tconst referencesSize = box.references.length * 12 // 3 x 4 bytes per reference\n\tconst totalSize = headerSize + fullBoxSize + referenceIdSize + timescaleSize +\n\t\tearliestPresentationTimeSize + firstOffsetSize + reservedSize + referenceCountSize + referencesSize\n\n\tconst writer = new IsoBoxWriteView('sidx', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.referenceId, 4)\n\twriter.writeUint(box.timescale, 4)\n\twriter.writeUint(box.earliestPresentationTime, size)\n\twriter.writeUint(box.firstOffset, size)\n\twriter.writeUint(box.reserved ?? 0, 2)\n\twriter.writeUint(box.references.length, 2)\n\n\tfor (const ref of box.references) {\n\t\t// Pack referenceType (1 bit) + referencedSize (31 bits)\n\t\tconst reference = ((ref.referenceType & 0x1) << 31) | (ref.referencedSize & 0x7FFFFFFF)\n\t\twriter.writeUint(reference, 4)\n\n\t\twriter.writeUint(ref.subsegmentDuration, 4)\n\n\t\t// Pack startsWithSap (1 bit) + sapType (3 bits) + sapDeltaTime (28 bits)\n\t\tconst sap = ((ref.startsWithSap & 0x1) << 31) | ((ref.sapType & 0x7) << 28) | (ref.sapDeltaTime & 0x0FFFFFFF)\n\t\twriter.writeUint(sap, 4)\n\t}\n\n\treturn writer\n}\n","import type { FreeSpaceBox } from '../boxes/FreeSpaceBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a FreeSpaceBox (skip variant) to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.1.2 Free Space Box\n *\n * @param box - The FreeSpaceBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSkip(box: FreeSpaceBox<'skip'>): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst dataSize = box.data.length\n\tconst totalSize = headerSize + dataSize\n\n\tconst writer = new IsoBoxWriteView('skip', totalSize)\n\twriter.writeBytes(box.data)\n\n\treturn writer\n}\n","import type { SoundMediaHeaderBox } from '../boxes/SoundMediaHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SoundMediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.2.2 Sound Media Header Box\n *\n * @param box - The SoundMediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSmhd(box: SoundMediaHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst balanceSize = 2\n\tconst reservedSize = 2\n\tconst totalSize = headerSize + fullBoxSize + balanceSize + reservedSize\n\n\tconst writer = new IsoBoxWriteView('smhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.balance, 2)\n\twriter.writeUint(box.reserved, 2)\n\n\treturn writer\n}\n","import type { SubsegmentIndexBox } from '../boxes/SubsegmentIndexBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SubsegmentIndexBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.4 Subsegment Index Box\n *\n * @param box - The SubsegmentIndexBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSsix(box: SubsegmentIndexBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst subsegmentCountSize = 4\n\n\tlet rangesSize = 0\n\tfor (const subsegment of box.subsegments) {\n\t\trangesSize += 4 // rangesCount\n\t\trangesSize += subsegment.rangesCount * 4 // level (1) + rangeSize (3) per range\n\t}\n\n\tconst totalSize = headerSize + fullBoxSize + subsegmentCountSize + rangesSize\n\n\tconst writer = new IsoBoxWriteView('ssix', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.subsegmentCount, 4)\n\n\tfor (const subsegment of box.subsegments) {\n\t\twriter.writeUint(subsegment.rangesCount, 4)\n\n\t\tfor (const range of subsegment.ranges) {\n\t\t\twriter.writeUint(range.level, 1)\n\t\t\twriter.writeUint(range.rangeSize, 3)\n\t\t}\n\t}\n\n\treturn writer\n}\n","import type { SubtitleMediaHeaderBox } from '../boxes/SubtitleMediaHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SubtitleMediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.6.2 Subtitle Media Header Box\n *\n * @param box - The SubtitleMediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSthd(box: SubtitleMediaHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst totalSize = headerSize + fullBoxSize\n\n\tconst writer = new IsoBoxWriteView('sthd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\treturn writer\n}\n","import type { SampleDescriptionBox } from '../boxes/SampleDescriptionBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\nimport type { IsoBoxWriteViewConfig } from '../IsoBoxWriteViewConfig.ts'\nimport { writeChildBoxes } from '../utils/writeChildBoxes.ts'\n\n/**\n * Write a SampleDescriptionBox to an IsoDataWriter.\n *\n * @param box - The SampleDescriptionBox fields to write\n * @param config - The IsoBoxWriteViewConfig to use\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStsd(box: SampleDescriptionBox, config: IsoBoxWriteViewConfig): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entryCount = box.entries.length\n\n\t// TODO: Is there a way to avoid creating the intermediate Uint8Arrays?\n\tconst { bytes, size } = writeChildBoxes(box.entries, config)\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + size\n\n\tconst writer = new IsoBoxWriteView('stsd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(entryCount, 4)\n\twriter.writeBytes(bytes)\n\n\treturn writer\n}\n","import type { SyncSampleBox } from '../boxes/SyncSampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SyncSampleBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.2 Sync Sample Box\n *\n * @param box - The SyncSampleBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStss(box: SyncSampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entriesSize = box.entryCount * 4\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('stss', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleNumber, 4)\n\t}\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttSettingsBox } from '../boxes/WebVttSettingsBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttSettingsBox to an IsoDataWriter.\n *\n * @param box - The WebVttSettingsBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSttg(box: WebVttSettingsBox): IsoBoxWriteView {\n\tconst settingsBytes = encodeText(box.settings)\n\n\tconst headerSize = 8\n\tconst settingsSize = settingsBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + settingsSize\n\n\tconst writer = new IsoBoxWriteView('sttg', totalSize)\n\twriter.writeUtf8TerminatedString(box.settings)\n\n\treturn writer\n}\n","import type { DecodingTimeToSampleBox } from '../boxes/DecodingTimeToSampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a DecodingTimeToSampleBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.6.1.2 Decoding Time to Sample Box\n *\n * @param box - The DecodingTimeToSampleBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStts(box: DecodingTimeToSampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst entriesSize = box.entryCount * 8 // 4 bytes sampleCount + 4 bytes sampleDelta\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('stts', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleCount, 4)\n\t\twriter.writeUint(entry.sampleDelta, 4)\n\t}\n\n\treturn writer\n}\n","import type { SegmentTypeBox } from '../boxes/SegmentTypeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SegmentTypeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.16.2 Segment Type Box\n *\n * @param box - The SegmentTypeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeStyp(box: SegmentTypeBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst majorBrandSize = 4\n\tconst minorVersionSize = 4\n\tconst compatibleBrandsSize = box.compatibleBrands.length * 4\n\tconst totalSize = headerSize + majorBrandSize + minorVersionSize + compatibleBrandsSize\n\n\tconst writer = new IsoBoxWriteView('styp', totalSize)\n\twriter.writeString(box.majorBrand)\n\twriter.writeUint(box.minorVersion, 4)\n\n\tfor (const brand of box.compatibleBrands) {\n\t\twriter.writeString(brand)\n\t}\n\n\treturn writer\n}\n","import type { SubsampleInformationBox } from '../boxes/SubsampleInformationBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a SubsampleInformationBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.7.7 Sub-Sample Information Box\n *\n * @param box - The SubsampleInformationBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeSubs(box: SubsampleInformationBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst subsampleSizeBytes = v1 ? 4 : 2\n\n\tlet entriesSize = 0\n\tfor (const entry of box.entries) {\n\t\tentriesSize += 4 // sampleDelta\n\t\tentriesSize += 2 // subsampleCount\n\t\tentriesSize += entry.subsampleCount * (subsampleSizeBytes + 1 + 1 + 4) // size + priority + discardable + codecSpecificParameters\n\t}\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst entryCountSize = 4\n\tconst totalSize = headerSize + fullBoxSize + entryCountSize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('subs', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.entryCount, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.sampleDelta, 4)\n\t\twriter.writeUint(entry.subsampleCount, 2)\n\n\t\tfor (const subsample of entry.subsamples) {\n\t\t\twriter.writeUint(subsample.subsampleSize, subsampleSizeBytes)\n\t\t\twriter.writeUint(subsample.subsamplePriority, 1)\n\t\t\twriter.writeUint(subsample.discardable, 1)\n\t\t\twriter.writeUint(subsample.codecSpecificParameters, 4)\n\t\t}\n\t}\n\n\treturn writer\n}\n","import type { TrackEncryptionBox } from '../boxes/TrackEncryptionBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackEncryptionBox to an IsoDataWriter.\n *\n * ISO/IEC 23001-7 - 8.2 Track Encryption Box\n *\n * @param box - The TrackEncryptionBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTenc(box: TrackEncryptionBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst defaultIsEncryptedSize = 3\n\tconst defaultIvSizeSize = 1\n\tconst defaultKidSize = 16\n\tconst totalSize = headerSize + fullBoxSize + defaultIsEncryptedSize + defaultIvSizeSize + defaultKidSize\n\n\tconst writer = new IsoBoxWriteView('tenc', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.defaultIsEncrypted, 3)\n\twriter.writeUint(box.defaultIvSize, 1)\n\twriter.writeArray(box.defaultKid, UINT, 1, 16)\n\n\treturn writer\n}\n","import type { TrackFragmentBaseMediaDecodeTimeBox } from '../boxes/TrackFragmentBaseMediaDecodeTimeBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackFragmentBaseMediaDecodeTimeBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.12 Track Fragment Base Media Decode Time Box\n *\n * @param box - The TrackFragmentBaseMediaDecodeTimeBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTfdt(box: TrackFragmentBaseMediaDecodeTimeBox): IsoBoxWriteView {\n\tconst size = box.version === 1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst baseMediaDecodeTimeSize = size\n\tconst totalSize = headerSize + fullBoxSize + baseMediaDecodeTimeSize\n\n\tconst writer = new IsoBoxWriteView('tfdt', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeUint(box.baseMediaDecodeTime, size)\n\n\treturn writer\n}\n","import type { TrackFragmentHeaderBox } from '../boxes/TrackFragmentHeaderBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackFragmentHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.7 Track Fragment Header Box\n *\n * @param box - The TrackFragmentHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTfhd(box: TrackFragmentHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst trackIdSize = 4\n\tconst baseDataOffsetSize = (box.flags & 0x01) ? 8 : 0\n\tconst sampleDescriptionIndexSize = (box.flags & 0x02) ? 4 : 0\n\tconst defaultSampleDurationSize = (box.flags & 0x08) ? 4 : 0\n\tconst defaultSampleSizeSize = (box.flags & 0x10) ? 4 : 0\n\tconst defaultSampleFlagsSize = (box.flags & 0x20) ? 4 : 0\n\tconst totalSize = headerSize + fullBoxSize + trackIdSize + baseDataOffsetSize +\n\t\tsampleDescriptionIndexSize + defaultSampleDurationSize + defaultSampleSizeSize + defaultSampleFlagsSize\n\n\tconst writer = new IsoBoxWriteView('tfhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.trackId, 4)\n\n\tif (box.flags & 0x01) {\n\t\twriter.writeUint(box.baseDataOffset ?? 0, 8)\n\t}\n\n\tif (box.flags & 0x02) {\n\t\twriter.writeUint(box.sampleDescriptionIndex ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x08) {\n\t\twriter.writeUint(box.defaultSampleDuration ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x10) {\n\t\twriter.writeUint(box.defaultSampleSize ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x20) {\n\t\twriter.writeUint(box.defaultSampleFlags ?? 0, 4)\n\t}\n\n\treturn writer\n}\n","import type { TrackFragmentRandomAccessBox } from '../boxes/TrackFragmentRandomAccessBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackFragmentRandomAccessBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.10 Track Fragment Random Access Box\n *\n * @param box - The TrackFragmentRandomAccessBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTfra(box: TrackFragmentRandomAccessBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst timeSize = v1 ? 8 : 4\n\tconst entrySize = timeSize + timeSize + // time + moofOffset\n\t\t(box.lengthSizeOfTrafNum + 1) +\n\t\t(box.lengthSizeOfTrunNum + 1) +\n\t\t(box.lengthSizeOfSampleNum + 1)\n\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst trackIdSize = 4\n\tconst reservedSize = 4\n\tconst numberOfEntrySize = 4\n\tconst entriesSize = box.numberOfEntry * entrySize\n\tconst totalSize = headerSize + fullBoxSize + trackIdSize + reservedSize + numberOfEntrySize + entriesSize\n\n\tconst writer = new IsoBoxWriteView('tfra', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.trackId, 4)\n\n\t// Pack reserved with length sizes\n\tconst reserved = (box.lengthSizeOfTrafNum << 4) | (box.lengthSizeOfTrunNum << 2) | box.lengthSizeOfSampleNum\n\twriter.writeUint(reserved, 4)\n\n\twriter.writeUint(box.numberOfEntry, 4)\n\n\tfor (const entry of box.entries) {\n\t\twriter.writeUint(entry.time, timeSize)\n\t\twriter.writeUint(entry.moofOffset, timeSize)\n\t\twriter.writeUint(entry.trafNumber, box.lengthSizeOfTrafNum + 1)\n\t\twriter.writeUint(entry.trunNumber, box.lengthSizeOfTrunNum + 1)\n\t\twriter.writeUint(entry.sampleNumber, box.lengthSizeOfSampleNum + 1)\n\t}\n\n\treturn writer\n}\n","import type { TrackHeaderBox } from '../boxes/TrackHeaderBox.ts'\nimport { TEMPLATE } from '../fields/TEMPLATE.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.3.2 Track Header Box\n *\n * @param box - The TrackHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTkhd(box: TrackHeaderBox): IsoBoxWriteView {\n\tconst v1 = box.version === 1\n\tconst size = v1 ? 8 : 4\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst timesSize = size * 3 // creationTime, modificationTime, duration\n\tconst trackIdSize = 4\n\tconst reserved1Size = 4\n\tconst reserved2Size = 8 // 2 x 4 bytes\n\tconst layerSize = 2\n\tconst alternateGroupSize = 2\n\tconst volumeSize = 2\n\tconst reserved3Size = 2\n\tconst matrixSize = 36 // 9 x 4 bytes\n\tconst widthSize = 4\n\tconst heightSize = 4\n\n\tconst totalSize = headerSize + fullBoxSize + timesSize + trackIdSize + reserved1Size +\n\t\treserved2Size + layerSize + alternateGroupSize + volumeSize + reserved3Size +\n\t\tmatrixSize + widthSize + heightSize\n\n\tconst writer = new IsoBoxWriteView('tkhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.creationTime, size)\n\twriter.writeUint(box.modificationTime, size)\n\twriter.writeUint(box.trackId, 4)\n\twriter.writeUint(box.reserved1, 4)\n\twriter.writeUint(box.duration, size)\n\twriter.writeArray(box.reserved2, UINT, 4, 2)\n\twriter.writeUint(box.layer, 2)\n\twriter.writeUint(box.alternateGroup, 2)\n\twriter.writeTemplate(box.volume, 2)\n\twriter.writeUint(box.reserved3, 2)\n\twriter.writeArray(box.matrix, TEMPLATE, 4, 9)\n\twriter.writeTemplate(box.width, 4)\n\twriter.writeTemplate(box.height, 4)\n\n\treturn writer\n}\n","import type { TrackExtendsBox } from '../boxes/TrackExtendsBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackExtendsBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.3 Track Extends Box\n *\n * @param box - The TrackExtendsBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTrex(box: TrackExtendsBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst trackIdSize = 4\n\tconst defaultSampleDescriptionIndexSize = 4\n\tconst defaultSampleDurationSize = 4\n\tconst defaultSampleSizeSize = 4\n\tconst defaultSampleFlagsSize = 4\n\tconst totalSize = headerSize + fullBoxSize + trackIdSize + defaultSampleDescriptionIndexSize +\n\t\tdefaultSampleDurationSize + defaultSampleSizeSize + defaultSampleFlagsSize\n\n\tconst writer = new IsoBoxWriteView('trex', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.trackId, 4)\n\twriter.writeUint(box.defaultSampleDescriptionIndex, 4)\n\twriter.writeUint(box.defaultSampleDuration, 4)\n\twriter.writeUint(box.defaultSampleSize, 4)\n\twriter.writeUint(box.defaultSampleFlags, 4)\n\n\treturn writer\n}\n","import type { TrackRunBox } from '../boxes/TrackRunBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a TrackRunBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.8.8 Track Run Box\n *\n * @param box - The TrackRunBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeTrun(box: TrackRunBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst sampleCountSize = 4\n\tconst dataOffsetSize = (box.flags & 0x1) ? 4 : 0\n\tconst firstSampleFlagsSize = (box.flags & 0x4) ? 4 : 0\n\n\tlet sampleSize = 0\n\tif (box.flags & 0x100) sampleSize += 4 // sampleDuration\n\tif (box.flags & 0x200) sampleSize += 4 // sampleSize\n\tif (box.flags & 0x400) sampleSize += 4 // sampleFlags\n\tif (box.flags & 0x800) sampleSize += 4 // sampleCompositionTimeOffset\n\n\tconst samplesSize = sampleSize * box.sampleCount\n\tconst totalSize = headerSize + fullBoxSize + sampleCountSize + dataOffsetSize + firstSampleFlagsSize + samplesSize\n\n\tconst writer = new IsoBoxWriteView('trun', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.sampleCount, 4)\n\n\tif (box.flags & 0x1) {\n\t\twriter.writeUint(box.dataOffset ?? 0, 4)\n\t}\n\n\tif (box.flags & 0x4) {\n\t\twriter.writeUint(box.firstSampleFlags ?? 0, 4)\n\t}\n\n\tfor (const sample of box.samples) {\n\t\tif (box.flags & 0x100) {\n\t\t\twriter.writeUint(sample.sampleDuration ?? 0, 4)\n\t\t}\n\t\tif (box.flags & 0x200) {\n\t\t\twriter.writeUint(sample.sampleSize ?? 0, 4)\n\t\t}\n\t\tif (box.flags & 0x400) {\n\t\t\twriter.writeUint(sample.sampleFlags ?? 0, 4)\n\t\t}\n\t\tif (box.flags & 0x800) {\n\t\t\twriter.writeUint(sample.sampleCompositionTimeOffset ?? 0, 4)\n\t\t}\n\t}\n\n\treturn writer\n}\n","import type { DataEntryUrlBox } from '../boxes/DataEntryUrlBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a UrlBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box\n *\n * @param box - The UrlBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeUrl(box: DataEntryUrlBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst locationSize = box.location.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + locationSize\n\n\tconst writer = new IsoBoxWriteView('url ', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeTerminatedString(box.location)\n\n\treturn writer\n}\n","import type { DataEntryUrnBox } from '../boxes/DataEntryUrnBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a UrnBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box\n *\n * @param box - The UrnBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeUrn(box: DataEntryUrnBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst nameSize = box.name.length + 1 // null-terminated\n\tconst locationSize = box.location.length + 1 // null-terminated\n\tconst totalSize = headerSize + fullBoxSize + nameSize + locationSize\n\n\tconst writer = new IsoBoxWriteView('urn ', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\twriter.writeTerminatedString(box.name)\n\twriter.writeTerminatedString(box.location)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttSourceLabelBox } from '../boxes/WebVttSourceLabelBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttSourceLabelBox to an IsoDataWriter.\n *\n * @param box - The WebVttSourceLabelBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVlab(box: WebVttSourceLabelBox): IsoBoxWriteView {\n\tconst sourceLabelBytes = encodeText(box.sourceLabel)\n\n\tconst headerSize = 8\n\tconst sourceLabelSize = sourceLabelBytes.length + 1 // null-terminated\n\tconst totalSize = headerSize + sourceLabelSize\n\n\tconst writer = new IsoBoxWriteView('vlab', totalSize)\n\twriter.writeUtf8TerminatedString(box.sourceLabel)\n\n\treturn writer\n}\n","import type { VideoMediaHeaderBox } from '../boxes/VideoMediaHeaderBox.ts'\nimport { UINT } from '../fields/UINT.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a VideoMediaHeaderBox to an IsoDataWriter.\n *\n * ISO/IEC 14496-12:2012 - 12.1.2 Video Media Header Box\n *\n * @param box - The VideoMediaHeaderBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVmhd(box: VideoMediaHeaderBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst fullBoxSize = 4\n\tconst graphicsmodeSize = 2\n\tconst opcolorSize = 6 // 3 x 2 bytes\n\tconst totalSize = headerSize + fullBoxSize + graphicsmodeSize + opcolorSize\n\n\tconst writer = new IsoBoxWriteView('vmhd', totalSize)\n\twriter.writeFullBox(box.version, box.flags)\n\n\twriter.writeUint(box.graphicsmode, 2)\n\twriter.writeArray(box.opcolor, UINT, 2, 3)\n\n\treturn writer\n}\n","import { encodeText } from '@svta/cml-utils'\nimport type { WebVttConfigurationBox } from '../boxes/WebVttConfigurationBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttConfigurationBox to an IsoDataWriter.\n *\n * @param box - The WebVttConfigurationBox fields to write\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\nexport function writeVttC(box: WebVttConfigurationBox): IsoBoxWriteView {\n\tconst configBytes = encodeText(box.config)\n\n\tconst headerSize = 8\n\tconst configSize = configBytes.length\n\tconst totalSize = headerSize + configSize\n\n\tconst writer = new IsoBoxWriteView('vttC', totalSize)\n\twriter.writeBytes(configBytes)\n\n\treturn writer\n}\n","import type { WebVttEmptySampleBox } from '../boxes/WebVttEmptySampleBox.ts'\nimport { IsoBoxWriteView } from '../IsoBoxWriteView.ts'\n\n/**\n * Write a WebVttEmptySampleBox to an IsoDataWriter.\n *\n * @returns An IsoDataWriter containing the encoded box\n *\n * @public\n */\n// eslint-disable-next-line\nexport function writeVtte(_: WebVttEmptySampleBox): IsoBoxWriteView {\n\tconst headerSize = 8\n\tconst totalSize = headerSize\n\n\tconst writer = new IsoBoxWriteView('vtte', totalSize)\n\treturn writer\n}\n"],"mappings":";;;AAEA,SAAgB,mBAAmB,QAA0E;AAC5G,QAAO,EACN,SAAS,QAAQ,WAAW,EAAE,EAC9B;;;;;;;;;;ACAF,MAAaA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