1159cl/lib/icecast-metadata-player-1.17.3.mediasource.min.js.map
Mario1159 5b6b79892c
Some checks failed
Release / test (push) Failing after 51s
Release / push-docker-image (push) Has been skipped
2024 new version
2024-12-06 20:38:18 -03:00

1 line
64 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"icecast-metadata-player-1.17.3.mediasource.min.js","mappings":";;;;;;;;;;;;;;;;;;;;uKACO,MACMA,EAAO,OAGPC,EAAM,MACNC,EAAY,YACZC,EAAO,OACPC,EAAS,SACTC,EAAO,OAEdC,EAAQ,SACRC,EAAS,WACFC,EAAYF,EAZN,MAYoBC,EAC1BE,EAAaH,EAAQN,EAAOO,EAE5BG,EAAoB,oBCElB,MAAMC,EAQnB,WAAAC,EAAY,KAAEC,EAAI,SAAEC,EAAW,GAAE,SAAEC,EAAW,KAC5CC,KAAKC,EAAQJ,EACbG,KAAKE,EAAYJ,EACjBE,KAAKG,EAAYJ,CACnB,CAOA,wBAAOK,CAAkBP,GACvB,MAAO,IAAIA,GAAMQ,KAAKC,GAASA,EAAKC,WAAW,IACjD,CAOA,iBAAOC,CAAWC,GAChB,MAAMC,EAAQ,IAAIC,WAAW,GAE7B,OADA,IAAIC,SAASF,EAAMG,QAAQC,WAAW,EAAGL,GAClCC,CACT,CAOA,gBAAOK,CAAUN,GACf,MAAMC,EAAQ,IAAIC,WAAW,GAE7B,OADA,IAAIC,SAASF,EAAMG,QAAQG,aAAa,EAAGC,OAAOR,IAC3CC,CACT,CAOA,gBAAOQ,CAAUT,GACf,MAAMC,EAAQ,IAAIC,WAAW,GAE7B,OADA,IAAIC,SAASF,EAAMG,QAAQM,UAAU,EAAGV,GACjCC,CACT,CAOA,gBAAOU,CAAUX,GACf,MAAMC,EAAQ,IAAIC,WAAW,GAE7B,OADA,IAAIC,SAASF,EAAMG,QAAQQ,UAAU,EAAGZ,GACjCC,CACT,CA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,OAHAa,KAAKuI,EAAY,GAAG9I,KAAcL,KAElCY,KAAKiI,wBAA0B,MACxB,IAAIxB,EAAcrH,GAC3B,IAAK,OACH,OAAIY,KAAKyH,sBAAwBzI,GAC/BgB,KAAKuI,EAAY,GAAG9I,KAAcJ,KAElCW,KAAKiI,wBAA0B,MACxB,IAAIxB,EAAcpH,KAE3BW,KAAKuI,EAAY,GAAG/I,KAAaH,KAC1B,IAAImE,EAAiBnE,IAElC,E","sources":["webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/constants.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/containers/ContainerElement.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/containers/isobmff/Box.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/containers/isobmff/ESTag.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/containers/isobmff/ISOBMFFContainer.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/utilities.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/containers/webm/EBML.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/containers/webm/WEBMContainer.js","webpack://IcecastMetadataPlayer/./node_modules/mse-audio-wrapper/src/MSEAudioWrapper.js"],"sourcesContent":["// containers\nexport const MP4 = \"mp4\";\nexport const WEBM = \"webm\";\n\n// codecs\nexport const MP3 = \"mp3\";\nexport const MP4A_40_2 = \"mp4a.40.2\";\nexport const FLAC = \"flac\";\nexport const VORBIS = \"vorbis\";\nexport const OPUS = \"opus\";\n\nconst audio = \"audio/\";\nconst codecs = \";codecs=\";\nexport const AUDIO_MP4 = audio + MP4 + codecs;\nexport const AUDIO_WEBM = audio + WEBM + codecs;\n\nexport const MSE_AUDIO_WRAPPER = \"mse-audio-wrapper\";\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nexport default class ContainerElement {\n /**\n * @abstract\n * @description Container Object structure Abstract Class\n * @param {any} name Name of the object\n * @param {Array<Uint8>} [contents] Array of arrays or typed arrays, or a single number or typed array\n * @param {Array<ContainerElement>} [objects] Array of objects to insert into this object\n */\n constructor({ name, contents = [], children = [] }) {\n this._name = name;\n this._contents = contents;\n this._children = children;\n }\n\n /**\n * @description Converts a string to a byte array\n * @param {string} name String to convert\n * @returns {Uint8Array}\n */\n static stringToByteArray(name) {\n return [...name].map((char) => char.charCodeAt(0));\n }\n\n /**\n * @description Converts a JavaScript number to Uint32\n * @param {number} number Number to convert\n * @returns {Uint32}\n */\n static getFloat64(number) {\n const bytes = new Uint8Array(8);\n new DataView(bytes.buffer).setFloat64(0, number);\n return bytes;\n }\n\n /**\n * @description Converts a JavaScript number to Uint32\n * @param {number} number Number to convert\n * @returns {Uint32}\n */\n static getUint64(number) {\n const bytes = new Uint8Array(8);\n new DataView(bytes.buffer).setBigUint64(0, BigInt(number));\n return bytes;\n }\n\n /**\n * @description Converts a JavaScript number to Uint32\n * @param {number} number Number to convert\n * @returns {Uint32}\n */\n static getUint32(number) {\n const bytes = new Uint8Array(4);\n new DataView(bytes.buffer).setUint32(0, number);\n return bytes;\n }\n\n /**\n * @description Converts a JavaScript number to Uint16\n * @param {number} number Number to convert\n * @returns {Uint32}\n */\n static getUint16(number) {\n const bytes = new Uint8Array(2);\n new DataView(bytes.buffer).setUint16(0, number);\n return bytes;\n }\n\n /**\n * @description Converts a JavaScript number to Int16\n * @param {number} number Number to convert\n * @returns {Uint32}\n */\n static getInt16(number) {\n const bytes = new Uint8Array(2);\n new DataView(bytes.buffer).setInt16(0, number);\n return bytes;\n }\n\n static *flatten(array) {\n for (const item of array) {\n if (Array.isArray(item)) {\n yield* ContainerElement.flatten(item);\n } else {\n yield item;\n }\n }\n }\n\n /**\n * @returns {Uint8Array} Contents of this container element\n */\n get contents() {\n const buffer = new Uint8Array(this.length);\n const contents = this._buildContents();\n\n let offset = 0;\n\n for (const element of ContainerElement.flatten(contents)) {\n if (typeof element !== \"object\") {\n buffer[offset] = element;\n offset++;\n } else {\n buffer.set(element, offset);\n offset += element.length;\n }\n }\n\n return buffer;\n }\n\n /**\n * @returns {number} Length of this container element\n */\n get length() {\n return this._buildLength();\n }\n\n _buildContents() {\n return [\n this._contents,\n ...this._children.map((obj) => obj._buildContents()),\n ];\n }\n\n _buildLength() {\n let length;\n\n if (Array.isArray(this._contents)) {\n length = this._contents.reduce(\n (acc, val) => acc + (val.length === undefined ? 1 : val.length),\n 0,\n );\n } else {\n length = this._contents.length === undefined ? 1 : this._contents.length;\n }\n\n return length + this._children.reduce((acc, obj) => acc + obj.length, 0);\n }\n\n addChild(object) {\n this._children.push(object);\n }\n}\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport ContainerElement from \"../ContainerElement.js\";\n\nexport default class Box extends ContainerElement {\n /**\n * @description ISO/IEC 14496-12 Part 12 ISO Base Media File Format Box\n * @param {string} name Name of the box (i.e. 'moov', 'moof', 'traf')\n * @param {object} params Object containing contents or child boxes\n * @param {Array<Uint8>} [params.contents] Array of bytes to insert into this box\n * @param {Array<Box>} [params.children] Array of child boxes to insert into this box\n */\n constructor(name, { contents, children } = {}) {\n super({ name, contents, children });\n }\n\n _buildContents() {\n return [\n ...this._lengthBytes,\n ...ContainerElement.stringToByteArray(this._name),\n ...super._buildContents(),\n ];\n }\n\n _buildLength() {\n if (!this._length) {\n // length bytes + name length + content length\n this._length = 4 + this._name.length + super._buildLength();\n this._lengthBytes = ContainerElement.getUint32(this._length);\n }\n\n return this._length;\n }\n}\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport ContainerElement from \"../ContainerElement.js\";\n\nexport default class ESTag extends ContainerElement {\n constructor(tagNumber, { contents, tags } = {}) {\n super({ name: tagNumber, contents, children: tags });\n }\n\n static getLength(length) {\n const bytes = ContainerElement.getUint32(length);\n\n bytes.every((byte, i, array) => {\n if (byte === 0x00) {\n array[i] = 0x80;\n return true;\n }\n return false;\n });\n\n return bytes;\n }\n\n /**\n * @returns {Uint8Array} Contents of this stream descriptor tag\n */\n _buildContents() {\n return [this._name, ...this._lengthBytes, ...super._buildContents()];\n }\n\n _buildLength() {\n if (!this._length) {\n const length = super._buildLength();\n this._lengthBytes = ESTag.getLength(length);\n this._length = 1 + length + this._lengthBytes.length;\n }\n\n return this._length;\n }\n\n addTag(tag) {\n this.addChild(tag);\n }\n}\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport { MP3, MP4A_40_2, FLAC, OPUS } from \"../../constants.js\";\n\nimport ContainerElement from \"../ContainerElement.js\";\nimport Box from \"./Box.js\";\nimport ESTag from \"./ESTag.js\";\n\n/**\n * @description Fragmented ISO Base Media File Format Builder is a class to\n * wrap codec frames in a MP4 container for streaming MP3 / AAC compatibility in Firefox.\n */\nexport default class ISOBMFFContainer {\n constructor(codec) {\n this._codec = codec;\n }\n\n getCodecBox(header) {\n /**\n * @description Codec mapping for `esds` box\n * https://stackoverflow.com/questions/3987850/mp4-atom-how-to-discriminate-the-audio-codec-is-it-aac-or-mp3\n * https://web.archive.org/web/20180312163039/http://mp4ra.org/object.html\n * 0x40 - MPEG-4 Audio\n * 0x6b - MPEG-1 Audio (MPEG-1 Layers 1, 2, and 3)\n * 0x69 - MPEG-2 Backward Compatible Audio (MPEG-2 Layers 1, 2, and 3)\n * 0x67 - MPEG-2 AAC LC\n */\n switch (this._codec) {\n case MP3:\n return this.getMp4a(header, 0x6b);\n case MP4A_40_2:\n return this.getMp4a(header, 0x40);\n case OPUS:\n return this.getOpus(header);\n case FLAC:\n return this.getFlaC(header);\n }\n }\n\n getOpus(header) {\n // https://opus-codec.org/docs/opus_in_isobmff.html\n return new Box(\"Opus\", {\n /* prettier-ignore */\n contents: [\n 0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,0x01, // data reference index\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,header.channels, // channel count\n 0x00,header.bitDepth, // PCM bitrate (16bit)\n 0x00,0x00, // predefined\n 0x00,0x00, // reserved\n Box.getUint16(header.sampleRate),0x00,0x00, // sample rate 16.16 fixed-point\n ],\n children: [\n new Box(\"dOps\", {\n /* prettier-ignore */\n contents: [0x00, // version\n header.channels, // output channel count\n Box.getUint16(header.preSkip), // pre skip\n Box.getUint32(header.inputSampleRate),// input sample rate\n Box.getInt16(header.outputGain), // output gain\n header.channelMappingFamily, // channel mapping family int(8)\n (header.channelMappingFamily !== 0 ? [\n header.streamCount,\n header.coupledStreamCount,\n header.channelMappingTable // channel mapping table\n ] : [])\n ],\n }),\n ],\n });\n }\n\n getFlaC(header) {\n // https://github.com/xiph/flac/blob/master/doc/isoflac.txt\n return new Box(\"fLaC\", {\n /* prettier-ignore */\n contents: [\n 0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,0x01, // data reference index\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,header.channels, // channel count\n 0x00,header.bitDepth, // PCM bitrate (16bit)\n 0x00,0x00, // predefined\n 0x00,0x00, // reserved\n Box.getUint16(header.sampleRate),0x00,0x00, // sample rate 16.16 fixed-point\n /*\n When the bitstream's native sample rate is greater\n than the maximum expressible value of 65535 Hz,\n the samplerate field shall hold the greatest\n expressible regular division of that rate. I.e.\n the samplerate field shall hold 48000.0 for\n native sample rates of 96 and 192 kHz. In the\n case of unusual sample rates which do not have\n an expressible regular division, the maximum value\n of 65535.0 Hz should be used.\n */\n ],\n children: [\n new Box(\"dfLa\", {\n /* prettier-ignore */\n contents: [\n 0x00, // version\n 0x00,0x00,0x00, // flags\n ...(header.streamInfo || [\n // * `A........` Last metadata block flag\n // * `.BBBBBBBB` BlockType\n 0x80, // last metadata block, stream info\n 0x00,0x00,0x22, // Length\n Box.getUint16(header.blockSize), // maximum block size\n Box.getUint16(header.blockSize), // minimum block size\n 0x00,0x00,0x00, // maximum frame size\n 0x00,0x00,0x00, // minimum frame size\n Box.getUint32((header.sampleRate << 12) | (header.channels << 8) | ((header.bitDepth - 1) << 4)), // 20bits sample rate, 3bits channels, 5bits bitDepth - 1\n 0x00,0x00,0x00,0x00, // total samples\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // md5 of stream\n ])\n ],\n }),\n ],\n });\n }\n\n getMp4a(header, esdsCodec) {\n const streamDescriptorTag = new ESTag(4, {\n /* prettier-ignore */\n contents: [\n esdsCodec,\n 0x15, // stream type(6bits)=5 audio, flags(2bits)=1\n 0x00,0x00,0x00, // 24bit buffer size\n 0x00,0x00,0x00,0x00, // max bitrate\n 0x00,0x00,0x00,0x00, // avg bitrate\n ],\n });\n\n // mp4a.40.2\n if (esdsCodec === 0x40) {\n streamDescriptorTag.addTag(\n new ESTag(5, {\n contents: header.audioSpecificConfig,\n }),\n );\n }\n\n return new Box(\"mp4a\", {\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,0x01, // data reference index\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,header.channels, // channel count\n 0x00,0x10, // PCM bitrate (16bit)\n 0x00,0x00, // Compression ID\n 0x00,0x00, // Packet size\n Box.getUint16(header.sampleRate),0x00,0x00], // sample rate unsigned floating point\n children: [\n new Box(\"esds\", {\n contents: [0x00, 0x00, 0x00, 0x00],\n children: [\n new ESTag(3, {\n contents: [\n 0x00,\n 0x01, // ES_ID = 1\n 0x00, // flags etc = 0\n ],\n tags: [\n streamDescriptorTag,\n new ESTag(6, {\n contents: 0x02,\n }),\n ],\n }),\n ],\n }),\n ],\n });\n }\n\n /**\n * @param {Header} header Codec frame\n * @returns {Uint8Array} Filetype and Movie Box information for the codec\n */\n getInitializationSegment({ header, samples }) {\n return new ContainerElement({\n children: [\n new Box(\"ftyp\", {\n /* prettier-ignore */\n contents: [Box.stringToByteArray(\"iso5\"), // major brand\n 0x00,0x00,0x02,0x00, // minor version\n Box.stringToByteArray(\"iso6mp41\")], // compatible brands\n }),\n new Box(\"moov\", {\n children: [\n new Box(\"mvhd\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0x00,0x00, // flags\n 0x00,0x00,0x00,0x00, // creation time\n 0x00,0x00,0x00,0x00, // modification time\n 0x00,0x00,0x03,0xe8, // timescale\n 0x00,0x00,0x00,0x00, // duration\n 0x00,0x01,0x00,0x00, // rate\n 0x01,0x00, // volume\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // a b u (matrix structure)\n 0x00,0x00,0x00,0x00, 0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00, // c d v\n 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x40,0x00,0x00,0x00, // x y w\n 0x00,0x00,0x00,0x00, // preview time\n 0x00,0x00,0x00,0x00, // preview duration\n 0x00,0x00,0x00,0x00, // poster time\n 0x00,0x00,0x00,0x00, // selection time\n 0x00,0x00,0x00,0x00, // selection duration\n 0x00,0x00,0x00,0x00, // current time\n 0x00,0x00,0x00,0x02], // next track\n }),\n new Box(\"trak\", {\n children: [\n new Box(\"tkhd\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0x00,0x03, // flags (0x01 - track enabled, 0x02 - track in movie, 0x04 - track in preview, 0x08 - track in poster)\n 0x00,0x00,0x00,0x00, // creation time\n 0x00,0x00,0x00,0x00, // modification time\n 0x00,0x00,0x00,0x01, // track id\n 0x00,0x00,0x00,0x00, // reserved\n 0x00,0x00,0x00,0x00, // duration\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // reserved\n 0x00,0x00, // layer\n 0x00,0x01, // alternate group\n 0x01,0x00, // volume\n 0x00,0x00, // reserved\n 0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // a b u (matrix structure)\n 0x00,0x00,0x00,0x00, 0x00,0x01,0x00,0x00, 0x00,0x00,0x00,0x00, // c d v \n 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x40,0x00,0x00,0x00, // x y w\n 0x00,0x00,0x00,0x00, // track width\n 0x00,0x00,0x00,0x00], // track height\n }),\n new Box(\"mdia\", {\n children: [\n new Box(\"mdhd\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0x00,0x00, // flags\n 0x00,0x00,0x00,0x00, // creation time (in seconds since midnight, January 1, 1904)\n 0x00,0x00,0x00,0x00, // modification time\n Box.getUint32(header.sampleRate), // time scale\n 0x00,0x00,0x00,0x00, // duration\n 0x55,0xc4, // language\n 0x00,0x00], // quality\n }),\n new Box(\"hdlr\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0x00,0x00, // flags\n Box.stringToByteArray('mhlr'), // component type (mhlr, dhlr)\n Box.stringToByteArray('soun'), // component subtype (vide' for video data, 'soun' for sound data or subt for subtitles)\n 0x00,0x00,0x00,0x00, // component manufacturer\n 0x00,0x00,0x00,0x00, // component flags\n 0x00,0x00,0x00,0x00, // component flags mask\n 0x00], // String that specifies the name of the component, terminated by a null character\n }),\n new Box(\"minf\", {\n children: [\n new Box(\"stbl\", {\n children: [\n new Box(\"stsd\", {\n // Sample description atom\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0x00,0x00, // flags\n 0x00,0x00,0x00,0x01], // entry count\n children: [this.getCodecBox(header)],\n }),\n new Box(\"stts\", {\n // Time-to-sample atom\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],\n }),\n new Box(\"stsc\", {\n // Sample-to-chunk atom\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],\n }),\n new Box(\"stsz\", {\n // Sample Size atom\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\n 0x00,0x00,0x00,0x00],\n }),\n new Box(\"stco\", {\n // Chunk Offset atom\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],\n }),\n ],\n }),\n ],\n }),\n ],\n }),\n ],\n }),\n new Box(\"mvex\", {\n children: [\n new Box(\"trex\", {\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00, // flags\n 0x00,0x00,0x00,0x01, // track id\n 0x00,0x00,0x00,0x01, // default_sample_description_index\n Box.getUint32(samples), // default_sample_duration\n 0x00,0x00,0x00,0x00, // default_sample_size;\n 0x00,0x00,0x00,0x00], // default_sample_flags;\n }),\n ],\n }),\n ],\n }),\n ],\n }).contents;\n }\n\n getSamplesPerFrame(frames) {\n return this._codec === MP4A_40_2\n ? frames.map(({ data, header }) =>\n Box.getUint32(data.length - header.length),\n )\n : frames.map(({ data }) => Box.getUint32(data.length));\n }\n\n getFrameData(frames) {\n return this._codec === MP4A_40_2\n ? frames.map(({ data, header }) => data.subarray(header.length))\n : frames.map(({ data }) => data);\n }\n\n /**\n * @description Wraps codec frames into a Movie Fragment\n * @param {Array<Frame>} frames Frames to contain in this Movie Fragment\n * @returns {Uint8Array} Movie Fragment containing the frames\n */\n getMediaSegment(frames) {\n return new ContainerElement({\n children: [\n new Box(\"moof\", {\n children: [\n new Box(\"mfhd\", {\n /* prettier-ignore */\n contents: [0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00], // sequence number\n }),\n new Box(\"traf\", {\n children: [\n new Box(\"tfhd\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0b00000010,0x00,0b00000000, // flags\n // * `AB|00000000|00CDE0FG`\n // * `A.|........|........` default-base-is-moof\n // * `.B|........|........` duration-is-empty\n // * `..|........|..C.....` default-sample-flags-present\n // * `..|........|...D....` default-sample-size-present\n // * `..|........|....E...` default-sample-duration-present\n // * `..|........|......F.` sample-description-index-present\n // * `..|........|.......G` base-data-offset-present\n 0x00,0x00,0x00,0x01], // track id\n }),\n new Box(\"tfdt\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0x00,0x00, // flags\n 0x00,0x00,0x00,0x00], // base media decode time\n }),\n new Box(\"trun\", {\n /* prettier-ignore */\n contents: [0x00, // version\n 0x00,0b0000010,0b00000001, // flags\n // * `ABCD|00000E0F`\n // * `A...|........` samplecompositiontimeoffsetspresent\n // * `.B..|........` sampleflagspresent\n // * `..C.|........` samplesizepresent\n // * `...D|........` sampledurationpresent\n // * `....|.....E..` firstsampleflagspresent\n // * `....|.......G` data-offset-present\n Box.getUint32(frames.length), // number of samples\n Box.getUint32(92 + frames.length * 4), // data offset\n ...this.getSamplesPerFrame(frames)], // samples size per frame\n }),\n ],\n }),\n ],\n }),\n new Box(\"mdat\", {\n contents: this.getFrameData(frames),\n }),\n ],\n }).contents;\n }\n}\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport { MSE_AUDIO_WRAPPER } from \"./constants.js\";\n\nconst xiphLacing = (...buffers) =>\n buffers.flatMap((buffer) => {\n const lacing = [];\n for (let l = buffer.length; l >= 0; l -= 255) {\n lacing.push(l >= 255 ? 255 : l);\n }\n return lacing;\n });\n\nconst logError = (...messages) => {\n console.error(\n MSE_AUDIO_WRAPPER,\n messages.reduce((acc, message) => acc + \"\\n \" + message, \"\"),\n );\n};\n\nexport { logError, xiphLacing };\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport { MSE_AUDIO_WRAPPER } from \"../../constants.js\";\nimport { logError } from \"../../utilities.js\";\n\nimport ContainerElement from \"../ContainerElement.js\";\n\nexport default class EBML extends ContainerElement {\n /**\n * @description Extensible Binary Meta Language element\n * @param {name} name ID of the EBML element\n * @param {object} params Object containing contents or children\n * @param {boolean} [isUnknownLength] Set to true to use the unknown length constant for EBML\n * @param {Array<Uint8>} [params.contents] Array of bytes to insert into this box\n * @param {Array<Box>} [params.children] Array of children to insert into this box\n */\n constructor(name, { contents, children, isUnknownLength = false } = {}) {\n super({ name, contents, children });\n\n this._isUnknownLength = isUnknownLength;\n }\n\n /**\n * @description Converts a JavaScript number into a variable length EBML integer\n * @param {number} number Number to convert\n */\n static getUintVariable(number) {\n let buffer;\n\n if (number < 0x7f) {\n buffer = [0b10000000 | number];\n } else if (number < 0x3fff) {\n buffer = ContainerElement.getUint16(number);\n buffer[0] |= 0b01000000;\n } else if (number < 0x1fffff) {\n buffer = ContainerElement.getUint32(number).subarray(1);\n buffer[0] |= 0b00100000;\n } else if (number < 0xfffffff) {\n buffer = ContainerElement.getUint32(number);\n buffer[0] |= 0b00010000;\n } else if (number < 0x7ffffffff) {\n buffer = ContainerElement.getUint64(number).subarray(3);\n buffer[0] |= 0b00001000;\n } else if (number < 0x3ffffffffff) {\n buffer = ContainerElement.getUint64(number).subarray(2);\n buffer[0] |= 0b00000100;\n } else if (number < 0x1ffffffffffff) {\n buffer = ContainerElement.getUint64(number).subarray(1);\n buffer[0] |= 0b00000010;\n } else if (number < 0xffffffffffffff) {\n buffer = ContainerElement.getUint64(number);\n buffer[0] |= 0b00000001;\n } else if (typeof number !== \"number\" || isNaN(number)) {\n logError(\n `EBML Variable integer must be a number, instead received ${number}`,\n );\n throw new Error(MSE_AUDIO_WRAPPER + \": Unable to encode WEBM\");\n }\n\n return buffer;\n }\n\n _buildContents() {\n return [...this._name, ...this._lengthBytes, ...super._buildContents()];\n }\n\n _buildLength() {\n if (!this._length) {\n this._contentLength = super._buildLength();\n this._lengthBytes = this._isUnknownLength\n ? [0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff] // unknown length constant\n : EBML.getUintVariable(this._contentLength);\n this._length =\n this._name.length + this._lengthBytes.length + this._contentLength;\n }\n\n return this._length;\n }\n}\n\n// https://tools.ietf.org/id/draft-lhomme-cellar-matroska-00.html\nexport const id = {\n AlphaMode: [0x53, 0xc0],\n AspectRatioType: [0x54, 0xb3],\n AttachedFile: [0x61, 0xa7],\n AttachmentLink: [0x74, 0x46],\n Attachments: [0x19, 0x41, 0xa4, 0x69],\n Audio: [0xe1],\n BitDepth: [0x62, 0x64],\n BitsPerChannel: [0x55, 0xb2],\n Block: [0xa1],\n BlockAddID: [0xee],\n BlockAdditional: [0xa5],\n BlockAdditions: [0x75, 0xa1],\n BlockDuration: [0x9b],\n BlockGroup: [0xa0],\n BlockMore: [0xa6],\n CbSubsamplingHorz: [0x55, 0xb5],\n CbSubsamplingVert: [0x55, 0xb6],\n Channels: [0x9f],\n ChapCountry: [0x43, 0x7e],\n ChapLanguage: [0x43, 0x7c],\n ChapProcess: [0x69, 0x44],\n ChapProcessCodecID: [0x69, 0x55],\n ChapProcessCommand: [0x69, 0x11],\n ChapProcessData: [0x69, 0x33],\n ChapProcessPrivate: [0x45, 0x0d],\n ChapProcessTime: [0x69, 0x22],\n ChapString: [0x85],\n ChapterAtom: [0xb6],\n ChapterDisplay: [0x80],\n ChapterFlagEnabled: [0x45, 0x98],\n ChapterFlagHidden: [0x98],\n ChapterPhysicalEquiv: [0x63, 0xc3],\n Chapters: [0x10, 0x43, 0xa7, 0x70],\n ChapterSegmentEditionUID: [0x6e, 0xbc],\n ChapterSegmentUID: [0x6e, 0x67],\n ChapterStringUID: [0x56, 0x54],\n ChapterTimeEnd: [0x92],\n ChapterTimeStart: [0x91],\n ChapterTrack: [0x8f],\n ChapterTrackNumber: [0x89],\n ChapterTranslate: [0x69, 0x24],\n ChapterTranslateCodec: [0x69, 0xbf],\n ChapterTranslateEditionUID: [0x69, 0xfc],\n ChapterTranslateID: [0x69, 0xa5],\n ChapterUID: [0x73, 0xc4],\n ChromaSitingHorz: [0x55, 0xb7],\n ChromaSitingVert: [0x55, 0xb8],\n ChromaSubsamplingHorz: [0x55, 0xb3],\n ChromaSubsamplingVert: [0x55, 0xb4],\n Cluster: [0x1f, 0x43, 0xb6, 0x75],\n CodecDecodeAll: [0xaa],\n CodecDelay: [0x56, 0xaa],\n CodecID: [0x86],\n CodecName: [0x25, 0x86, 0x88],\n CodecPrivate: [0x63, 0xa2],\n CodecState: [0xa4],\n Colour: [0x55, 0xb0],\n ColourSpace: [0x2e, 0xb5, 0x24],\n ContentCompAlgo: [0x42, 0x54],\n ContentCompression: [0x50, 0x34],\n ContentCompSettings: [0x42, 0x55],\n ContentEncAlgo: [0x47, 0xe1],\n ContentEncKeyID: [0x47, 0xe2],\n ContentEncoding: [0x62, 0x40],\n ContentEncodingOrder: [0x50, 0x31],\n ContentEncodings: [0x6d, 0x80],\n ContentEncodingScope: [0x50, 0x32],\n ContentEncodingType: [0x50, 0x33],\n ContentEncryption: [0x50, 0x35],\n ContentSigAlgo: [0x47, 0xe5],\n ContentSigHashAlgo: [0x47, 0xe6],\n ContentSigKeyID: [0x47, 0xe4],\n ContentSignature: [0x47, 0xe3],\n CRC32: [0xbf],\n CueBlockNumber: [0x53, 0x78],\n CueClusterPosition: [0xf1],\n CueCodecState: [0xea],\n CueDuration: [0xb2],\n CuePoint: [0xbb],\n CueReference: [0xdb],\n CueRefTime: [0x96],\n CueRelativePosition: [0xf0],\n Cues: [0x1c, 0x53, 0xbb, 0x6b],\n CueTime: [0xb3],\n CueTrack: [0xf7],\n CueTrackPositions: [0xb7],\n DateUTC: [0x44, 0x61],\n DefaultDecodedFieldDuration: [0x23, 0x4e, 0x7a],\n DefaultDuration: [0x23, 0xe3, 0x83],\n DiscardPadding: [0x75, 0xa2],\n DisplayHeight: [0x54, 0xba],\n DisplayUnit: [0x54, 0xb2],\n DisplayWidth: [0x54, 0xb0],\n DocType: [0x42, 0x82],\n DocTypeReadVersion: [0x42, 0x85],\n DocTypeVersion: [0x42, 0x87],\n Duration: [0x44, 0x89],\n EBML: [0x1a, 0x45, 0xdf, 0xa3],\n EBMLMaxIDLength: [0x42, 0xf2],\n EBMLMaxSizeLength: [0x42, 0xf3],\n EBMLReadVersion: [0x42, 0xf7],\n EBMLVersion: [0x42, 0x86],\n EditionEntry: [0x45, 0xb9],\n EditionFlagDefault: [0x45, 0xdb],\n EditionFlagHidden: [0x45, 0xbd],\n EditionFlagOrdered: [0x45, 0xdd],\n EditionUID: [0x45, 0xbc],\n FieldOrder: [0x9d],\n FileData: [0x46, 0x5c],\n FileDescription: [0x46, 0x7e],\n FileMimeType: [0x46, 0x60],\n FileName: [0x46, 0x6e],\n FileUID: [0x46, 0xae],\n FlagDefault: [0x88],\n FlagEnabled: [0xb9],\n FlagForced: [0x55, 0xaa],\n FlagInterlaced: [0x9a],\n FlagLacing: [0x9c],\n Info: [0x15, 0x49, 0xa9, 0x66],\n LaceNumber: [0xcc],\n Language: [0x22, 0xb5, 0x9c],\n LuminanceMax: [0x55, 0xd9],\n LuminanceMin: [0x55, 0xda],\n MasteringMetadata: [0x55, 0xd0],\n MatrixCoefficients: [0x55, 0xb1],\n MaxBlockAdditionID: [0x55, 0xee],\n MaxCache: [0x6d, 0xf8],\n MaxCLL: [0x55, 0xbc],\n MaxFALL: [0x55, 0xbd],\n MinCache: [0x6d, 0xe7],\n MuxingApp: [0x4d, 0x80],\n Name: [0x53, 0x6e],\n NextFilename: [0x3e, 0x83, 0xbb],\n NextUID: [0x3e, 0xb9, 0x23],\n OutputSamplingFrequency: [0x78, 0xb5],\n PixelCropBottom: [0x54, 0xaa],\n PixelCropLeft: [0x54, 0xcc],\n PixelCropRight: [0x54, 0xdd],\n PixelCropTop: [0x54, 0xbb],\n PixelHeight: [0xba],\n PixelWidth: [0xb0],\n Position: [0xa7],\n PrevFilename: [0x3c, 0x83, 0xab],\n PrevSize: [0xab],\n PrevUID: [0x3c, 0xb9, 0x23],\n Primaries: [0x55, 0xbb],\n PrimaryBChromaticityX: [0x55, 0xd5],\n PrimaryBChromaticityY: [0x55, 0xd6],\n PrimaryGChromaticityX: [0x55, 0xd3],\n PrimaryGChromaticityY: [0x55, 0xd4],\n PrimaryRChromaticityX: [0x55, 0xd1],\n PrimaryRChromaticityY: [0x55, 0xd2],\n Range: [0x55, 0xb9],\n ReferenceBlock: [0xfb],\n ReferencePriority: [0xfa],\n SamplingFrequency: [0xb5],\n Seek: [0x4d, 0xbb],\n SeekHead: [0x11, 0x4d, 0x9b, 0x74],\n SeekID: [0x53, 0xab],\n SeekPosition: [0x53, 0xac],\n SeekPreRoll: [0x56, 0xbb],\n Segment: [0x18, 0x53, 0x80, 0x67],\n SegmentFamily: [0x44, 0x44],\n SegmentFilename: [0x73, 0x84],\n SegmentUID: [0x73, 0xa4],\n SilentTrackNumber: [0x58, 0xd7],\n SilentTracks: [0x58, 0x54],\n SimpleBlock: [0xa3],\n SimpleTag: [0x67, 0xc8],\n Slices: [0x8e],\n StereoMode: [0x53, 0xb8],\n Tag: [0x73, 0x73],\n TagAttachmentUID: [0x63, 0xc6],\n TagBinary: [0x44, 0x85],\n TagChapterUID: [0x63, 0xc4],\n TagDefault: [0x44, 0x84],\n TagEditionUID: [0x63, 0xc9],\n TagLanguage: [0x44, 0x7a],\n TagName: [0x45, 0xa3],\n Tags: [0x12, 0x54, 0xc3, 0x67],\n TagString: [0x44, 0x87],\n TagTrackUID: [0x63, 0xc5],\n Targets: [0x63, 0xc0],\n TargetType: [0x63, 0xca],\n TargetTypeValue: [0x68, 0xca],\n Timestamp: [0xe7],\n TimestampScale: [0x2a, 0xd7, 0xb1],\n TimeSlice: [0xe8],\n Title: [0x7b, 0xa9],\n TrackCombinePlanes: [0xe3],\n TrackEntry: [0xae],\n TrackJoinBlocks: [0xe9],\n TrackJoinUID: [0xed],\n TrackNumber: [0xd7],\n TrackOperation: [0xe2],\n TrackOverlay: [0x6f, 0xab],\n TrackPlane: [0xe4],\n TrackPlaneType: [0xe6],\n TrackPlaneUID: [0xe5],\n Tracks: [0x16, 0x54, 0xae, 0x6b],\n TrackTranslate: [0x66, 0x24],\n TrackTranslateCodec: [0x66, 0xbf],\n TrackTranslateEditionUID: [0x66, 0xfc],\n TrackTranslateTrackID: [0x66, 0xa5],\n TrackType: [0x83],\n TrackUID: [0x73, 0xc5],\n TransferCharacteristics: [0x55, 0xba],\n Video: [0xe0],\n Void: [0xec],\n WhitePointChromaticityX: [0x55, 0xd7],\n WhitePointChromaticityY: [0x55, 0xd8],\n WritingApp: [0x57, 0x41],\n};\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport { VORBIS, OPUS, WEBM, MSE_AUDIO_WRAPPER } from \"../../constants.js\";\nimport { xiphLacing } from \"../../utilities.js\";\n\nimport ContainerElement from \"../ContainerElement.js\";\nimport EBML, { id } from \"./EBML.js\";\n\nexport default class WEBMContainer {\n constructor(codec) {\n switch (codec) {\n case OPUS: {\n this._codecId = \"A_OPUS\";\n this._getCodecSpecificTrack = (header) => [\n new EBML(id.CodecDelay, {\n contents: EBML.getUint32(\n Math.round(header.preSkip * this._timestampScale),\n ),\n }), // OPUS codec delay\n new EBML(id.SeekPreRoll, {\n contents: EBML.getUint32(Math.round(3840 * this._timestampScale)),\n }), // OPUS seek preroll 80ms\n new EBML(id.CodecPrivate, { contents: header.data }), // OpusHead bytes\n ];\n break;\n }\n case VORBIS: {\n this._codecId = \"A_VORBIS\";\n this._getCodecSpecificTrack = (header) => [\n new EBML(id.CodecPrivate, {\n contents: [\n 0x02, // number of packets\n xiphLacing(header.data, header.vorbisComments),\n header.data,\n header.vorbisComments,\n header.vorbisSetup,\n ],\n }),\n ];\n break;\n }\n }\n }\n\n getInitializationSegment({ header }) {\n this._timestampScale = 1000000000 / header.sampleRate;\n\n return new ContainerElement({\n children: [\n new EBML(id.EBML, {\n children: [\n new EBML(id.EBMLVersion, { contents: 1 }),\n new EBML(id.EBMLReadVersion, { contents: 1 }),\n new EBML(id.EBMLMaxIDLength, { contents: 4 }),\n new EBML(id.EBMLMaxSizeLength, { contents: 8 }),\n new EBML(id.DocType, { contents: EBML.stringToByteArray(WEBM) }),\n new EBML(id.DocTypeVersion, { contents: 4 }),\n new EBML(id.DocTypeReadVersion, { contents: 2 }),\n ],\n }),\n new EBML(id.Segment, {\n isUnknownLength: true,\n children: [\n new EBML(id.Info, {\n children: [\n new EBML(id.TimestampScale, {\n contents: EBML.getUint32(\n Math.floor(this._timestampScale), // Base timestamps on sample rate vs. milliseconds https://www.matroska.org/technical/notes.html#timestamps\n ),\n }),\n new EBML(id.MuxingApp, {\n contents: EBML.stringToByteArray(MSE_AUDIO_WRAPPER),\n }),\n new EBML(id.WritingApp, {\n contents: EBML.stringToByteArray(MSE_AUDIO_WRAPPER),\n }),\n ],\n }),\n new EBML(id.Tracks, {\n children: [\n new EBML(id.TrackEntry, {\n children: [\n new EBML(id.TrackNumber, { contents: 0x01 }),\n new EBML(id.TrackUID, { contents: 0x01 }),\n new EBML(id.FlagLacing, { contents: 0x00 }),\n new EBML(id.CodecID, {\n contents: EBML.stringToByteArray(this._codecId),\n }),\n new EBML(id.TrackType, { contents: 0x02 }), // audio\n new EBML(id.Audio, {\n children: [\n new EBML(id.Channels, { contents: header.channels }),\n new EBML(id.SamplingFrequency, {\n contents: EBML.getFloat64(header.sampleRate),\n }),\n new EBML(id.BitDepth, { contents: header.bitDepth }),\n ],\n }),\n ...this._getCodecSpecificTrack(header),\n ],\n }),\n ],\n }),\n ],\n }),\n ],\n }).contents;\n }\n\n getMediaSegment(frames) {\n const offsetSamples = frames[0].totalSamples;\n\n return new EBML(id.Cluster, {\n children: [\n new EBML(id.Timestamp, {\n contents: EBML.getUintVariable(offsetSamples), // Absolute timecode of the cluster\n }),\n ...frames.map(\n ({ data, totalSamples }) =>\n new EBML(id.SimpleBlock, {\n contents: [\n 0x81, // track number\n EBML.getInt16(totalSamples - offsetSamples), // timestamp relative to cluster Int16\n 0x80, // No lacing\n data, // ogg page contents\n ],\n }),\n ),\n ],\n }).contents;\n }\n}\n","/* Copyright 2020-2021 Ethan Halsall\n \n This file is part of mse-audio-wrapper.\n \n mse-audio-wrapper is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n mse-audio-wrapper is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <https://www.gnu.org/licenses/>\n*/\n\nimport CodecParser from \"codec-parser\";\n\nimport {\n WEBM,\n MP3,\n MP4A_40_2,\n FLAC,\n VORBIS,\n OPUS,\n AUDIO_MP4,\n AUDIO_WEBM,\n} from \"./constants.js\";\n\nimport ISOBMFFContainer from \"./containers/isobmff/ISOBMFFContainer.js\";\nimport WEBMContainer from \"./containers/webm/WEBMContainer.js\";\n\nconst noOp = () => {};\n\nexport default class MSEAudioWrapper {\n /**\n * @description Wraps audio data into media source API compatible containers\n * @param {string} mimeType Mimetype of the audio data to wrap\n * @param {string} options.codec Codec of the audio data to wrap\n * @param {object} options.preferredContainer Preferred audio container to output if multiple containers are available\n * @param {number} options.minBytesPerSegment Minimum number of bytes to process before returning a media segment\n * @param {number} options.minFramesPerSegment Minimum number of frames to process before returning a media segment\n * @param {number} options.minBytesPerSegment Minimum number of bytes to process before returning a media segment\n * @param {boolean} options.enableLogging Set to true to enable debug logging\n */\n constructor(mimeType, options = {}) {\n this._inputMimeType = mimeType;\n\n this.PREFERRED_CONTAINER = options.preferredContainer || WEBM;\n this.MIN_FRAMES = options.minFramesPerSegment || 4;\n this.MAX_FRAMES = options.maxFramesPerSegment || 50;\n this.MIN_FRAMES_LENGTH = options.minBytesPerSegment || 1022;\n this.MAX_SAMPLES_PER_SEGMENT = Infinity;\n\n this._onMimeType = options.onMimeType || noOp;\n\n if (options.codec) {\n this._container = this._getContainer(options.codec);\n this._onMimeType(this._mimeType);\n }\n\n this._frames = [];\n this._codecParser = new CodecParser(mimeType, {\n onCodec: (codec) => {\n this._container = this._getContainer(codec);\n this._onMimeType(this._mimeType);\n },\n onCodecUpdate: options.onCodecUpdate,\n enableLogging: options.enableLogging,\n enableFrameCRC32: false,\n });\n }\n\n /**\n * @public\n * @returns The mimetype being returned from MSEAudioWrapper\n */\n get mimeType() {\n return this._mimeType;\n }\n\n /**\n * @public\n * @returns The mimetype of the incoming audio data\n */\n get inputMimeType() {\n return this._inputMimeType;\n }\n\n /**\n * @public\n * @description Returns an iterator for the passed in codec data.\n * @param {Uint8Array | Array<Frame>} chunk Next chunk of codec data to read\n * @returns {Iterator} Iterator that operates over the codec data.\n * @yields {Uint8Array} Movie Fragments containing codec frames\n */\n *iterator(chunk) {\n if (chunk.constructor === Uint8Array) {\n yield* this._processFrames(\n [...this._codecParser.parseChunk(chunk)].flatMap(\n (frame) => frame.codecFrames || frame,\n ),\n );\n } else if (Array.isArray(chunk)) {\n yield* this._processFrames(chunk);\n }\n }\n\n /**\n * @private\n */\n *_processFrames(frames) {\n this._frames.push(...frames);\n\n if (this._frames.length) {\n const groups = this._groupFrames();\n\n if (groups.length) {\n if (!this._sentInitialSegment) {\n this._sentInitialSegment = true;\n\n yield this._container.getInitializationSegment(groups[0][0]);\n }\n for (const frameGroup of groups) {\n yield this._container.getMediaSegment(frameGroup);\n }\n }\n }\n }\n\n /**\n * @private\n */\n _groupFrames() {\n const groups = [[]];\n let currentGroup = groups[0];\n let samples = 0;\n\n for (const frame of this._frames) {\n if (\n currentGroup.length === this.MAX_FRAMES ||\n samples >= this.MAX_SAMPLES_PER_SEGMENT\n ) {\n samples = 0;\n groups.push((currentGroup = [])); // create new group\n }\n\n currentGroup.push(frame);\n samples += frame.samples;\n }\n\n // store remaining frames\n this._frames =\n currentGroup.length < this.MIN_FRAMES ||\n currentGroup.reduce((acc, frame) => acc + frame.data.length, 0) <\n this.MIN_FRAMES_LENGTH\n ? groups.pop()\n : [];\n\n return groups;\n }\n\n /**\n * @private\n */\n _getContainer(codec) {\n switch (codec) {\n case \"mpeg\":\n this._mimeType = `${AUDIO_MP4}\"${MP3}\"`;\n return new ISOBMFFContainer(MP3);\n case \"aac\":\n this._mimeType = `${AUDIO_MP4}\"${MP4A_40_2}\"`;\n return new ISOBMFFContainer(MP4A_40_2);\n case \"flac\":\n this._mimeType = `${AUDIO_MP4}\"${FLAC}\"`;\n return new ISOBMFFContainer(FLAC);\n case \"vorbis\":\n this._mimeType = `${AUDIO_WEBM}\"${VORBIS}\"`;\n\n this.MAX_SAMPLES_PER_SEGMENT = 32767;\n return new WEBMContainer(VORBIS);\n case \"opus\":\n if (this.PREFERRED_CONTAINER === WEBM) {\n this._mimeType = `${AUDIO_WEBM}\"${OPUS}\"`;\n\n this.MAX_SAMPLES_PER_SEGMENT = 32767;\n return new WEBMContainer(OPUS);\n }\n this._mimeType = `${AUDIO_MP4}\"${OPUS}\"`;\n return new ISOBMFFContainer(OPUS);\n }\n }\n}\n"],"names":["WEBM","MP3","MP4A_40_2","FLAC","VORBIS","OPUS","audio","codecs","AUDIO_MP4","AUDIO_WEBM","MSE_AUDIO_WRAPPER","ContainerElement","constructor","name","contents","children","this","_name","_contents","_children","stringToByteArray","map","char","charCodeAt","getFloat64","number","bytes","Uint8Array","DataView","buffer","setFloat64","getUint64","setBigUint64","BigInt","getUint32","setUint32","getUint16","setUint16","getInt16","setInt16","flatten","array","item","Array","isArray","length","_buildContents","offset","element","set","_buildLength","obj","reduce","acc","val","undefined","addChild","object","push","Box","super","_lengthBytes","_length","ESTag","tagNumber","tags","getLength","every","byte","i","addTag","tag","ISOBMFFContainer","codec","_codec","getCodecBox","header","getMp4a","getOpus","getFlaC","channels","bitDepth","sampleRate","preSkip","inputSampleRate","outputGain","channelMappingFamily","streamCount","coupledStreamCount","channelMappingTable","streamInfo","blockSize","esdsCodec","streamDescriptorTag","audioSpecificConfig","getInitializationSegment","samples","getSamplesPerFrame","frames","data","getFrameData","subarray","getMediaSegment","xiphLacing","buffers","flatMap","lacing","l","EBML","isUnknownLength","_isUnknownLength","getUintVariable","isNaN","messages","console","error","message","logError","Error","_contentLength","id","WEBMContainer","_codecId","_getCodecSpecificTrack","Math","round","_timestampScale","vorbisComments","vorbisSetup","floor","offsetSamples","totalSamples","noOp","MSEAudioWrapper","mimeType","options","_inputMimeType","PREFERRED_CONTAINER","preferredContainer","MIN_FRAMES","minFramesPerSegment","MAX_FRAMES","maxFramesPerSegment","MIN_FRAMES_LENGTH","minBytesPerSegment","MAX_SAMPLES_PER_SEGMENT","Infinity","_onMimeType","onMimeType","_container","_getContainer","_mimeType","_frames","_codecParser","onCodec","onCodecUpdate","enableLogging","enableFrameCRC32","inputMimeType","iterator","chunk","_processFrames","parseChunk","frame","codecFrames","groups","_groupFrames","_sentInitialSegment","frameGroup","currentGroup","pop"],"sourceRoot":""}