@digabi/exam-engine-core 23.8.1 → 23.8.2-alpha.0
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/__tests__/examServerApi.d.ts.map +1 -1
- package/dist/__tests__/examServerApi.js +2 -0
- package/dist/__tests__/examServerApi.js.map +1 -1
- package/dist/__tests__/playwright/exam/Exam.test.js +17 -18
- package/dist/__tests__/playwright/exam/Exam.test.js.map +1 -1
- package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts +1 -5
- package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts.map +1 -1
- package/dist/__tests__/playwright/stories/exam/Exam.story.js +7 -45
- package/dist/__tests__/playwright/stories/exam/Exam.story.js.map +1 -1
- package/dist/__tests__/playwright/utils/utils.d.ts +1 -1
- package/dist/__tests__/playwright/utils/utils.d.ts.map +1 -1
- package/dist/__tests__/playwright/utils/utils.js +2 -2
- package/dist/__tests__/playwright/utils/utils.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/assets/NotoMono.ttf +0 -0
- package/dist/assets/NotoMono.woff +0 -0
- package/dist/assets/NotoMono.woff2 +0 -0
- package/dist/assets/NotoSans-Bold.ttf +0 -0
- package/dist/assets/NotoSans-Bold.woff +0 -0
- package/dist/assets/NotoSans-Bold.woff2 +0 -0
- package/dist/assets/NotoSans-BoldItalic.ttf +0 -0
- package/dist/assets/NotoSans-BoldItalic.woff +0 -0
- package/dist/assets/NotoSans-BoldItalic.woff2 +0 -0
- package/dist/assets/NotoSans-Italic.ttf +0 -0
- package/dist/assets/NotoSans-Italic.woff +0 -0
- package/dist/assets/NotoSans-Italic.woff2 +0 -0
- package/dist/assets/NotoSans-Light.ttf +0 -0
- package/dist/assets/NotoSans-Light.woff +0 -0
- package/dist/assets/NotoSans-Light.woff2 +0 -0
- package/dist/assets/NotoSans-LightItalic.ttf +0 -0
- package/dist/assets/NotoSans-LightItalic.woff +0 -0
- package/dist/assets/NotoSans-LightItalic.woff2 +0 -0
- package/dist/assets/NotoSans-Regular.ttf +0 -0
- package/dist/assets/NotoSans-Regular.woff +0 -0
- package/dist/assets/NotoSans-Regular.woff2 +0 -0
- package/dist/assets/NotoSans-SemiBold.ttf +0 -0
- package/dist/assets/NotoSans-SemiBold.woff +0 -0
- package/dist/assets/NotoSans-SemiBold.woff2 +0 -0
- package/dist/assets/NotoSans-SemiBoldItalic.ttf +0 -0
- package/dist/assets/NotoSans-SemiBoldItalic.woff +0 -0
- package/dist/assets/NotoSans-SemiBoldItalic.woff2 +0 -0
- package/dist/components/context/QuestionContext.d.ts.map +1 -1
- package/dist/components/context/QuestionContext.js +1 -1
- package/dist/components/context/QuestionContext.js.map +1 -1
- package/dist/components/exam/AudioAnswer.d.ts +7 -0
- package/dist/components/exam/AudioAnswer.d.ts.map +1 -0
- package/dist/components/exam/AudioAnswer.js +79 -0
- package/dist/components/exam/AudioAnswer.js.map +1 -0
- package/dist/components/exam/AudioAnswerRecorder.d.ts +10 -0
- package/dist/components/exam/AudioAnswerRecorder.d.ts.map +1 -0
- package/dist/components/exam/AudioAnswerRecorder.js +28 -0
- package/dist/components/exam/AudioAnswerRecorder.js.map +1 -0
- package/dist/components/exam/Exam.d.ts.map +1 -1
- package/dist/components/exam/Exam.js +13 -2
- package/dist/components/exam/Exam.js.map +1 -1
- package/dist/components/exam/OralAnswer.d.ts +6 -0
- package/dist/components/exam/OralAnswer.d.ts.map +1 -0
- package/dist/components/exam/OralAnswer.js +18 -0
- package/dist/components/exam/OralAnswer.js.map +1 -0
- package/dist/components/grading/GradingAnswer.d.ts +2 -6
- package/dist/components/grading/GradingAnswer.d.ts.map +1 -1
- package/dist/components/grading/GradingAnswer.js +4 -3
- package/dist/components/grading/GradingAnswer.js.map +1 -1
- package/dist/components/results/AudioAnswer.d.ts +6 -0
- package/dist/components/results/AudioAnswer.d.ts.map +1 -0
- package/dist/components/results/AudioAnswer.js +13 -0
- package/dist/components/results/AudioAnswer.js.map +1 -0
- package/dist/components/results/Results.d.ts.map +1 -1
- package/dist/components/results/Results.js +3 -1
- package/dist/components/results/Results.js.map +1 -1
- package/dist/components/shared/internal/AudioError.d.ts +8 -0
- package/dist/components/shared/internal/AudioError.d.ts.map +1 -0
- package/dist/components/shared/internal/AudioError.js +17 -0
- package/dist/components/shared/internal/AudioError.js.map +1 -0
- package/dist/components/shared/internal/AudioRecordingError.d.ts +8 -0
- package/dist/components/shared/internal/AudioRecordingError.d.ts.map +1 -0
- package/dist/components/shared/internal/AudioRecordingError.js +17 -0
- package/dist/components/shared/internal/AudioRecordingError.js.map +1 -0
- package/dist/dom-utils.js +1 -1
- package/dist/dom-utils.js.map +1 -1
- package/dist/i18n/fi-FI.d.ts +4 -0
- package/dist/i18n/fi-FI.d.ts.map +1 -1
- package/dist/i18n/fi-FI.js +4 -0
- package/dist/i18n/fi-FI.js.map +1 -1
- package/dist/i18n/sv-FI.d.ts.map +1 -1
- package/dist/i18n/sv-FI.js +4 -0
- package/dist/i18n/sv-FI.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/main-bundle.js +13 -13
- package/dist/main-bundle.js.LICENSE.txt +7 -0
- package/dist/main.css +1 -1
- package/dist/node_modules_music-metadata_lib_aiff_AiffParser_js.main-bundle.js +33 -0
- package/dist/node_modules_music-metadata_lib_dsdiff_DsdiffParser_js.main-bundle.js +26 -0
- package/dist/node_modules_music-metadata_lib_dsf_DsfParser_js.main-bundle.js +33 -0
- package/dist/node_modules_music-metadata_lib_wavpack_WavPackParser_js.main-bundle.js +26 -0
- package/dist/parser/parseExamStructure.d.ts +8 -1
- package/dist/parser/parseExamStructure.d.ts.map +1 -1
- package/dist/parser/parseExamStructure.js +1 -1
- package/dist/parser/parseExamStructure.js.map +1 -1
- package/dist/types/ExamAnswer.d.ts +5 -1
- package/dist/types/ExamAnswer.d.ts.map +1 -1
- package/dist/types/ExamServerAPI.d.ts +4 -0
- package/dist/types/ExamServerAPI.d.ts.map +1 -1
- package/dist/types/GradingStructure.d.ts +7 -1
- package/dist/types/GradingStructure.d.ts.map +1 -1
- package/dist/validateAnswers.d.ts.map +1 -1
- package/dist/validateAnswers.js +1 -0
- package/dist/validateAnswers.js.map +1 -1
- package/dist/vendors-node_modules_music-metadata_lib_asf_AsfParser_js.main-bundle.js +40 -0
- package/dist/vendors-node_modules_music-metadata_lib_flac_FlacParser_js.main-bundle.js +47 -0
- package/dist/vendors-node_modules_music-metadata_lib_id3v2_ID3v2Parser_js.main-bundle.js +26 -0
- package/dist/vendors-node_modules_music-metadata_lib_matroska_MatroskaParser_js.main-bundle.js +40 -0
- package/dist/vendors-node_modules_music-metadata_lib_mp4_MP4Parser_js.main-bundle.js +33 -0
- package/dist/vendors-node_modules_music-metadata_lib_mpeg_MpegParser_js.main-bundle.js +47 -0
- package/dist/vendors-node_modules_music-metadata_lib_musepack_MusepackParser_js.main-bundle.js +68 -0
- package/dist/vendors-node_modules_music-metadata_lib_ogg_OggParser_js.main-bundle.js +82 -0
- package/dist/vendors-node_modules_music-metadata_lib_wav_WaveParser_js.main-bundle.js +40 -0
- package/package.json +4 -3
- package/dist/__tests__/annotations.test.d.ts +0 -2
- package/dist/__tests__/annotations.test.d.ts.map +0 -1
- package/dist/__tests__/annotations.test.js +0 -306
- package/dist/__tests__/annotations.test.js.map +0 -1
- package/dist/__tests__/playwright/Annotations.test.d.ts +0 -2
- package/dist/__tests__/playwright/Annotations.test.d.ts.map +0 -1
- package/dist/__tests__/playwright/Annotations.test.js +0 -201
- package/dist/__tests__/playwright/Annotations.test.js.map +0 -1
- package/dist/__tests__/playwright/attachments/Attachments.test.d.ts +0 -2
- package/dist/__tests__/playwright/attachments/Attachments.test.d.ts.map +0 -1
- package/dist/__tests__/playwright/attachments/Attachments.test.js +0 -30
- package/dist/__tests__/playwright/attachments/Attachments.test.js.map +0 -1
- package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.d.ts +0 -2
- package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.d.ts.map +0 -1
- package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js +0 -30
- package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js.map +0 -1
- package/dist/__tests__/playwright/stories/Annotations.story.d.ts +0 -15
- package/dist/__tests__/playwright/stories/Annotations.story.d.ts.map +0 -1
- package/dist/__tests__/playwright/stories/Annotations.story.js +0 -27
- package/dist/__tests__/playwright/stories/Annotations.story.js.map +0 -1
- package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts +0 -13
- package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts.map +0 -1
- package/dist/__tests__/playwright/stories/attachments/Attachments.story.js +0 -17
- package/dist/__tests__/playwright/stories/attachments/Attachments.story.js.map +0 -1
- package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts +0 -13
- package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts.map +0 -1
- package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.js +0 -16
- package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.js.map +0 -1
- package/dist/assets/closeButton.svg +0 -1
- package/dist/assets/collapse.svg +0 -12
- package/dist/assets/expand.svg +0 -12
- package/dist/assets/helpButton.svg +0 -9
- package/dist/assets/redoButton.svg +0 -5
- package/dist/assets/undoButton.svg +0 -5
- package/dist/components/grading/examAnnotationUtils.d.ts +0 -4
- package/dist/components/grading/examAnnotationUtils.d.ts.map +0 -1
- package/dist/components/grading/examAnnotationUtils.js +0 -123
- package/dist/components/grading/examAnnotationUtils.js.map +0 -1
- package/dist/components/results/DNDAnswerContainer.d.ts +0 -4
- package/dist/components/results/DNDAnswerContainer.d.ts.map +0 -1
- package/dist/components/results/DNDAnswerContainer.js +0 -22
- package/dist/components/results/DNDAnswerContainer.js.map +0 -1
- package/dist/components/shared/AnnotatableText.d.ts +0 -5
- package/dist/components/shared/AnnotatableText.d.ts.map +0 -1
- package/dist/components/shared/AnnotatableText.js +0 -25
- package/dist/components/shared/AnnotatableText.js.map +0 -1
- package/dist/components/shared/AnnotationImageMark.d.ts +0 -16
- package/dist/components/shared/AnnotationImageMark.d.ts.map +0 -1
- package/dist/components/shared/AnnotationImageMark.js +0 -99
- package/dist/components/shared/AnnotationImageMark.js.map +0 -1
- package/dist/components/shared/AnnotationMark.d.ts +0 -9
- package/dist/components/shared/AnnotationMark.d.ts.map +0 -1
- package/dist/components/shared/AnnotationMark.js +0 -14
- package/dist/components/shared/AnnotationMark.js.map +0 -1
- package/dist/components/shared/AnnotationPopup.d.ts +0 -3
- package/dist/components/shared/AnnotationPopup.d.ts.map +0 -1
- package/dist/components/shared/AnnotationPopup.js +0 -24
- package/dist/components/shared/AnnotationPopup.js.map +0 -1
- package/dist/components/shared/AnnotationTextMark.d.ts +0 -11
- package/dist/components/shared/AnnotationTextMark.d.ts.map +0 -1
- package/dist/components/shared/AnnotationTextMark.js +0 -21
- package/dist/components/shared/AnnotationTextMark.js.map +0 -1
- package/dist/components/shared/markText.d.ts +0 -6
- package/dist/components/shared/markText.d.ts.map +0 -1
- package/dist/components/shared/markText.js +0 -77
- package/dist/components/shared/markText.js.map +0 -1
- package/dist/eslint.config.d.ts +0 -22
- package/dist/eslint.config.d.ts.map +0 -1
- package/dist/eslint.config.js +0 -31
- package/dist/eslint.config.js.map +0 -1
- package/dist/i18n/exam_titles_fi-FI.d.ts +0 -46
- package/dist/i18n/exam_titles_fi-FI.d.ts.map +0 -1
- package/dist/i18n/exam_titles_fi-FI.js +0 -46
- package/dist/i18n/exam_titles_fi-FI.js.map +0 -1
- package/dist/i18n/exam_titles_fi-FI.json +0 -45
- package/dist/i18n/exam_titles_sv-FI.d.ts +0 -46
- package/dist/i18n/exam_titles_sv-FI.d.ts.map +0 -1
- package/dist/i18n/exam_titles_sv-FI.js +0 -46
- package/dist/i18n/exam_titles_sv-FI.js.map +0 -1
- package/dist/i18n/exam_titles_sv-FI.json +0 -45
- package/dist/i18n/exams.d.ts +0 -11
- package/dist/i18n/exams.d.ts.map +0 -1
- package/dist/i18n/exams.js +0 -10
- package/dist/i18n/exams.js.map +0 -1
- package/dist/types/ExamAnnotations.d.ts +0 -46
- package/dist/types/ExamAnnotations.d.ts.map +0 -1
- package/dist/types/ExamAnnotations.js +0 -2
- package/dist/types/ExamAnnotations.js.map +0 -1
package/dist/vendors-node_modules_music-metadata_lib_matroska_MatroskaParser_js.main-bundle.js
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
4
|
+
* This devtool is neither made for production nor for readable output files.
|
5
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
6
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
7
|
+
* or disable the default devtool with "devtool: false".
|
8
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
9
|
+
*/
|
10
|
+
(this["webpackChunkExamBundle"] = this["webpackChunkExamBundle"] || []).push([["vendors-node_modules_music-metadata_lib_matroska_MatroskaParser_js"],{
|
11
|
+
|
12
|
+
/***/ "../../node_modules/music-metadata/lib/ebml/EbmlIterator.js":
|
13
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
14
|
+
|
15
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EbmlContentError: () => (/* binding */ EbmlContentError),\n/* harmony export */ EbmlIterator: () => (/* binding */ EbmlIterator),\n/* harmony export */ ParseAction: () => (/* binding */ ParseAction),\n/* harmony export */ getElementPath: () => (/* binding */ getElementPath)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var strtok3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/strtok3/lib/core.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ebml/types.js\");\n/* harmony import */ var _ParseError_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ParseError.js\");\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_1__('music-metadata:parser:ebml');\nclass EbmlContentError extends (0,_ParseError_js__WEBPACK_IMPORTED_MODULE_4__.makeUnexpectedFileContentError)('EBML') {\n}\nvar ParseAction;\n(function (ParseAction) {\n ParseAction[ParseAction[\"ReadNext\"] = 0] = \"ReadNext\";\n ParseAction[ParseAction[\"IgnoreElement\"] = 2] = \"IgnoreElement\";\n ParseAction[ParseAction[\"SkipSiblings\"] = 3] = \"SkipSiblings\";\n ParseAction[ParseAction[\"TerminateParsing\"] = 4] = \"TerminateParsing\";\n ParseAction[ParseAction[\"SkipElement\"] = 5] = \"SkipElement\"; // Consider the element has read, assume position is at the next element\n})(ParseAction || (ParseAction = {}));\n/**\n * Extensible Binary Meta Language (EBML) iterator\n * https://en.wikipedia.org/wiki/Extensible_Binary_Meta_Language\n * http://matroska.sourceforge.net/technical/specs/rfc/index.html\n *\n * WEBM VP8 AUDIO FILE\n */\nclass EbmlIterator {\n /**\n * @param {ITokenizer} tokenizer Input\n * @param tokenizer\n */\n constructor(tokenizer) {\n this.tokenizer = tokenizer;\n this.padding = 0;\n this.parserMap = new Map();\n this.ebmlMaxIDLength = 4;\n this.ebmlMaxSizeLength = 8;\n this.parserMap.set(_types_js__WEBPACK_IMPORTED_MODULE_3__.DataType.uint, e => this.readUint(e));\n this.parserMap.set(_types_js__WEBPACK_IMPORTED_MODULE_3__.DataType.string, e => this.readString(e));\n this.parserMap.set(_types_js__WEBPACK_IMPORTED_MODULE_3__.DataType.binary, e => this.readBuffer(e));\n this.parserMap.set(_types_js__WEBPACK_IMPORTED_MODULE_3__.DataType.uid, async (e) => this.readBuffer(e));\n this.parserMap.set(_types_js__WEBPACK_IMPORTED_MODULE_3__.DataType.bool, e => this.readFlag(e));\n this.parserMap.set(_types_js__WEBPACK_IMPORTED_MODULE_3__.DataType.float, e => this.readFloat(e));\n }\n async iterate(dtdElement, posDone, listener) {\n return this.parseContainer(linkParents(dtdElement), posDone, listener);\n }\n async parseContainer(dtdElement, posDone, listener) {\n const tree = {};\n while (this.tokenizer.position < posDone) {\n let element;\n const elementPosition = this.tokenizer.position;\n try {\n element = await this.readElement();\n }\n catch (error) {\n if (error instanceof strtok3__WEBPACK_IMPORTED_MODULE_2__.EndOfStreamError) {\n break;\n }\n throw error;\n }\n const child = dtdElement.container[element.id];\n if (child) {\n const action = listener.startNext(child);\n switch (action) {\n case ParseAction.ReadNext:\n {\n if (element.id === 0x1F43B675) {\n // Hack to ignore remaining segment, when cluster element received\n // await this.tokenizer.ignore(posDone - this.tokenizer.position);\n // break;\n }\n debug(`Read element: name=${getElementPath(child)}{id=0x${element.id.toString(16)}, container=${!!child.container}} at position=${elementPosition}`);\n if (child.container) {\n const res = await this.parseContainer(child, element.len >= 0 ? this.tokenizer.position + element.len : -1, listener);\n if (child.multiple) {\n if (!tree[child.name]) {\n tree[child.name] = [];\n }\n tree[child.name].push(res);\n }\n else {\n tree[child.name] = res;\n }\n await listener.elementValue(child, res, elementPosition);\n }\n else {\n const parser = this.parserMap.get(child.value);\n if (typeof parser === 'function') {\n const value = await parser(element);\n tree[child.name] = value;\n await listener.elementValue(child, value, elementPosition);\n }\n }\n }\n break;\n case ParseAction.SkipElement:\n debug(`Go to next element: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`);\n break;\n case ParseAction.IgnoreElement:\n debug(`Ignore element: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`);\n await this.tokenizer.ignore(element.len);\n break;\n case ParseAction.SkipSiblings:\n debug(`Ignore remaining container, at: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`);\n await this.tokenizer.ignore(posDone - this.tokenizer.position);\n break;\n case ParseAction.TerminateParsing:\n debug(`Terminate parsing at element: name=${getElementPath(child)}, element.id=0x${element.id}, container=${!!child.container} at position=${elementPosition}`);\n return tree;\n }\n }\n else {\n switch (element.id) {\n case 0xec: // void\n this.padding += element.len;\n await this.tokenizer.ignore(element.len);\n break;\n default:\n debug(`parseEbml: parent=${getElementPath(dtdElement)}, unknown child: id=${element.id.toString(16)} at position=${elementPosition}`);\n this.padding += element.len;\n await this.tokenizer.ignore(element.len);\n }\n }\n }\n return tree;\n }\n async readVintData(maxLength) {\n const msb = await this.tokenizer.peekNumber(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8);\n let mask = 0x80;\n let oc = 1;\n // Calculate VINT_WIDTH\n while ((msb & mask) === 0) {\n if (oc > maxLength) {\n throw new EbmlContentError('VINT value exceeding maximum size');\n }\n ++oc;\n mask >>= 1;\n }\n const id = new Uint8Array(oc);\n await this.tokenizer.readBuffer(id);\n return id;\n }\n async readElement() {\n const id = await this.readVintData(this.ebmlMaxIDLength);\n const lenField = await this.readVintData(this.ebmlMaxSizeLength);\n lenField[0] ^= 0x80 >> (lenField.length - 1);\n return {\n id: readUIntBE(id, id.length),\n len: readUIntBE(lenField, lenField.length)\n };\n }\n async readFloat(e) {\n switch (e.len) {\n case 0:\n return 0.0;\n case 4:\n return this.tokenizer.readNumber(token_types__WEBPACK_IMPORTED_MODULE_0__.Float32_BE);\n case 8:\n return this.tokenizer.readNumber(token_types__WEBPACK_IMPORTED_MODULE_0__.Float64_BE);\n case 10:\n return this.tokenizer.readNumber(token_types__WEBPACK_IMPORTED_MODULE_0__.Float64_BE);\n default:\n throw new EbmlContentError(`Invalid IEEE-754 float length: ${e.len}`);\n }\n }\n async readFlag(e) {\n return (await this.readUint(e)) === 1;\n }\n async readUint(e) {\n const buf = await this.readBuffer(e);\n return readUIntBE(buf, e.len);\n }\n async readString(e) {\n const rawString = await this.tokenizer.readToken(new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(e.len, 'utf-8'));\n return rawString.replace(/\\x00.*$/g, '');\n }\n async readBuffer(e) {\n const buf = new Uint8Array(e.len);\n await this.tokenizer.readBuffer(buf);\n return buf;\n }\n}\nfunction readUIntBE(buf, len) {\n return Number(readUIntBeAsBigInt(buf, len));\n}\n/**\n * Reeds an unsigned integer from a big endian buffer of length `len`\n * @param buf Buffer to decode from\n * @param len Number of bytes\n * @private\n */\nfunction readUIntBeAsBigInt(buf, len) {\n const normalizedNumber = new Uint8Array(8);\n const cleanNumber = buf.subarray(0, len);\n try {\n normalizedNumber.set(cleanNumber, 8 - len);\n return token_types__WEBPACK_IMPORTED_MODULE_0__.UINT64_BE.get(normalizedNumber, 0);\n }\n catch (error) {\n return BigInt(-1);\n }\n}\nfunction linkParents(element) {\n if (element.container) {\n Object.keys(element.container)\n .map(id => {\n const child = element.container[id];\n child.id = Number.parseInt(id);\n return child;\n }).forEach(child => {\n child.parent = element;\n linkParents(child);\n });\n }\n return element;\n}\nfunction getElementPath(element) {\n let path = '';\n if (element.parent && element.parent.name !== 'dtd') {\n path += `${getElementPath(element.parent)}/`;\n }\n return path + element.name;\n}\n//# sourceMappingURL=EbmlIterator.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/ebml/EbmlIterator.js?");
|
16
|
+
|
17
|
+
/***/ }),
|
18
|
+
|
19
|
+
/***/ "../../node_modules/music-metadata/lib/ebml/types.js":
|
20
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
21
|
+
|
22
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DataType: () => (/* binding */ DataType)\n/* harmony export */ });\nvar DataType;\n(function (DataType) {\n DataType[DataType[\"string\"] = 0] = \"string\";\n DataType[DataType[\"uint\"] = 1] = \"uint\";\n DataType[DataType[\"uid\"] = 2] = \"uid\";\n DataType[DataType[\"bool\"] = 3] = \"bool\";\n DataType[DataType[\"binary\"] = 4] = \"binary\";\n DataType[DataType[\"float\"] = 5] = \"float\";\n})(DataType || (DataType = {}));\n//# sourceMappingURL=types.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/ebml/types.js?");
|
23
|
+
|
24
|
+
/***/ }),
|
25
|
+
|
26
|
+
/***/ "../../node_modules/music-metadata/lib/matroska/MatroskaDtd.js":
|
27
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
28
|
+
|
29
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ matroskaDtd: () => (/* binding */ matroskaDtd)\n/* harmony export */ });\n/* harmony import */ var _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ebml/types.js\");\n\n/**\n * Elements of document type description\n * Derived from https://github.com/tungol/EBML/blob/master/doctypes/matroska.dtd\n * Extended with:\n * - https://www.matroska.org/technical/specs/index.html\n */\nconst matroskaDtd = {\n name: 'dtd',\n container: {\n 0x1a45dfa3: {\n name: 'ebml',\n container: {\n 0x4286: { name: 'ebmlVersion', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // 5.1.1\n 0x42f7: { name: 'ebmlReadVersion', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // 5.1.2\n 0x42f2: { name: 'ebmlMaxIDWidth', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // 5.1.3\n 0x42f3: { name: 'ebmlMaxSizeWidth', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // 5.1.4\n 0x4282: { name: 'docType', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string }, // 5.1.5\n 0x4287: { name: 'docTypeVersion', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // 5.1.6\n 0x4285: { name: 'docTypeReadVersion', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint } // 5.1.7\n }\n },\n // Matroska segments\n 0x18538067: {\n name: 'segment',\n container: {\n // Meta Seek Information (also known as MetaSeek)\n 0x114d9b74: {\n name: 'seekHead',\n container: {\n 0x4dbb: {\n name: 'seek',\n multiple: true,\n container: {\n 0x53ab: { name: 'id', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x53ac: { name: 'position', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }\n }\n }\n }\n },\n // Segment Information\n 0x1549a966: {\n name: 'info',\n container: {\n 0x73a4: { name: 'uid', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x7384: { name: 'filename', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x3cb923: { name: 'prevUID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x3c83ab: { name: 'prevFilename', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x3eb923: { name: 'nextUID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x3e83bb: { name: 'nextFilename', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x2ad7b1: { name: 'timecodeScale', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x4489: { name: 'duration', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.float },\n 0x4461: { name: 'dateUTC', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x7ba9: { name: 'title', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x4d80: { name: 'muxingApp', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x5741: { name: 'writingApp', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string }\n }\n },\n // Cluster\n 0x1f43b675: {\n name: 'cluster',\n multiple: true,\n container: {\n 0xe7: { name: 'timecode', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x58d7: { name: 'silentTracks ', multiple: true },\n 0xa7: { name: 'position', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0xab: { name: 'prevSize', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0xa0: { name: 'blockGroup' },\n 0xa3: { name: 'simpleBlock' }\n }\n },\n // Track\n 0x1654ae6b: {\n name: 'tracks',\n container: {\n 0xae: {\n name: 'entries',\n multiple: true,\n container: {\n 0xd7: { name: 'trackNumber', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x73c5: { name: 'uid', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x83: { name: 'trackType', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xb9: { name: 'flagEnabled', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x88: { name: 'flagDefault', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x55aa: { name: 'flagForced', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool }, // extended\n 0x9c: { name: 'flagLacing', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x6de7: { name: 'minCache', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x6de8: { name: 'maxCache', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x23e383: { name: 'defaultDuration', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x23314f: { name: 'timecodeScale', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.float },\n 0x536e: { name: 'name', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x22b59c: { name: 'language', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x86: { name: 'codecID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x63a2: { name: 'codecPrivate', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x258688: { name: 'codecName', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x3a9697: { name: 'codecSettings', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x3b4040: { name: 'codecInfoUrl', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x26b240: { name: 'codecDownloadUrl', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0xaa: { name: 'codecDecodeAll', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x6fab: { name: 'trackOverlay', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n // Video\n 0xe0: {\n name: 'video',\n container: {\n 0x9a: { name: 'flagInterlaced', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x53b8: { name: 'stereoMode', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xb0: { name: 'pixelWidth', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xba: { name: 'pixelHeight', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x54b0: { name: 'displayWidth', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x54ba: { name: 'displayHeight', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x54b3: { name: 'aspectRatioType', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x2eb524: { name: 'colourSpace', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x2fb523: { name: 'gammaValue', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.float }\n }\n },\n // Audio\n 0xe1: {\n name: 'audio',\n container: {\n 0xb5: { name: 'samplingFrequency', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.float },\n 0x78b5: { name: 'outputSamplingFrequency', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.float },\n 0x9f: { name: 'channels', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // https://www.matroska.org/technical/specs/index.html\n 0x94: { name: 'channels', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x7d7b: { name: 'channelPositions', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x6264: { name: 'bitDepth', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }\n }\n },\n // Content Encoding\n 0x6d80: {\n name: 'contentEncodings',\n container: {\n 0x6240: {\n name: 'contentEncoding',\n container: {\n 0x5031: { name: 'order', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x5032: { name: 'scope', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x5033: { name: 'type', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x5034: {\n name: 'contentEncoding',\n container: {\n 0x4254: { name: 'contentCompAlgo', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x4255: { name: 'contentCompSettings', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary }\n }\n },\n 0x5035: {\n name: 'contentEncoding',\n container: {\n 0x47e1: { name: 'contentEncAlgo', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x47e2: { name: 'contentEncKeyID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x47e3: { name: 'contentSignature ', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x47e4: { name: 'ContentSigKeyID ', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x47e5: { name: 'contentSigAlgo ', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x47e6: { name: 'contentSigHashAlgo ', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }\n }\n },\n 0x6264: { name: 'bitDepth', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }\n }\n }\n }\n }\n }\n }\n }\n },\n // Cueing Data\n 0x1c53bb6b: {\n name: 'cues',\n container: {\n 0xbb: {\n name: 'cuePoint',\n container: {\n 0xb3: { name: 'cueTime', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0xb7: {\n name: 'positions',\n container: {\n 0xf7: { name: 'track', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xf1: { name: 'clusterPosition', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x5378: { name: 'blockNumber', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xea: { name: 'codecState', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xdb: {\n name: 'reference', container: {\n 0x96: { name: 'time', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x97: { name: 'cluster', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x535f: { name: 'number', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0xeb: { name: 'codecState', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }\n }\n },\n 0xf0: { name: 'relativePosition', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint } // extended\n }\n }\n }\n }\n }\n },\n // Attachment\n 0x1941a469: {\n name: 'attachments',\n container: {\n 0x61a7: {\n name: 'attachedFiles',\n multiple: true,\n container: {\n 0x467e: { name: 'description', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x466e: { name: 'name', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x4660: { name: 'mimeType', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x465c: { name: 'data', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x46ae: { name: 'uid', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid }\n }\n }\n }\n },\n // Chapters\n 0x1043a770: {\n name: 'chapters',\n container: {\n 0x45b9: {\n name: 'editionEntry',\n container: {\n 0xb6: {\n name: 'chapterAtom',\n container: {\n 0x73c4: { name: 'uid', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x91: { name: 'timeStart', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x92: { name: 'timeEnd', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x98: { name: 'hidden', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool },\n 0x4598: { name: 'enabled', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x8f: {\n name: 'track', container: {\n 0x89: { name: 'trackNumber', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x80: {\n name: 'display', container: {\n 0x85: { name: 'string', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x437c: { name: 'language ', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x437e: { name: 'country ', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n },\n // Tagging\n 0x1254c367: {\n name: 'tags',\n container: {\n 0x7373: {\n name: 'tag',\n multiple: true,\n container: {\n 0x63c0: {\n name: 'target',\n container: {\n 0x63c5: { name: 'tagTrackUID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x63c4: { name: 'tagChapterUID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint },\n 0x63c6: { name: 'tagAttachmentUID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid },\n 0x63ca: { name: 'targetType', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string }, // extended\n 0x68ca: { name: 'targetTypeValue', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uint }, // extended\n 0x63c9: { name: 'tagEditionUID', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.uid } // extended\n }\n },\n 0x67c8: {\n name: 'simpleTags',\n multiple: true,\n container: {\n 0x45a3: { name: 'name', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x4487: { name: 'string', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string },\n 0x4485: { name: 'binary', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.binary },\n 0x447a: { name: 'language', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string }, // extended\n 0x447b: { name: 'languageIETF', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.string }, // extended\n 0x4484: { name: 'default', value: _ebml_types_js__WEBPACK_IMPORTED_MODULE_0__.DataType.bool } // extended\n }\n }\n }\n }\n }\n }\n }\n }\n }\n};\n//# sourceMappingURL=MatroskaDtd.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/matroska/MatroskaDtd.js?");
|
30
|
+
|
31
|
+
/***/ }),
|
32
|
+
|
33
|
+
/***/ "../../node_modules/music-metadata/lib/matroska/MatroskaParser.js":
|
34
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
35
|
+
|
36
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MatroskaParser: () => (/* binding */ MatroskaParser)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/BasicParser.js\");\n/* harmony import */ var _MatroskaDtd_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/matroska/MatroskaDtd.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/matroska/types.js\");\n/* harmony import */ var _ebml_EbmlIterator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ebml/EbmlIterator.js\");\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('music-metadata:parser:matroska');\n/**\n * Extensible Binary Meta Language (EBML) parser\n * https://en.wikipedia.org/wiki/Extensible_Binary_Meta_Language\n * http://matroska.sourceforge.net/technical/specs/rfc/index.html\n *\n * WEBM VP8 AUDIO FILE\n */\nclass MatroskaParser extends _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_1__.BasicParser {\n constructor() {\n super(...arguments);\n this.seekHeadOffset = 0;\n /**\n * Use index to skip multiple segment/cluster elements at once.\n * Significant performance impact\n */\n this.flagUseIndexToSkipClusters = this.options.mkvUseIndex ?? false;\n }\n async parse() {\n const containerSize = this.tokenizer.fileInfo.size ?? Number.MAX_SAFE_INTEGER;\n const matroskaIterator = new _ebml_EbmlIterator_js__WEBPACK_IMPORTED_MODULE_4__.EbmlIterator(this.tokenizer);\n debug('Initializing DTD end MatroskaIterator');\n await matroskaIterator.iterate(_MatroskaDtd_js__WEBPACK_IMPORTED_MODULE_2__.matroskaDtd, containerSize, {\n startNext: (element) => {\n switch (element.id) {\n // case 0x1f43b675: // cluster\n case 0x1c53bb6b: // Cueing Data\n debug(`Skip element: name=${element.name}, id=0x${element.id.toString(16)}`);\n return _ebml_EbmlIterator_js__WEBPACK_IMPORTED_MODULE_4__.ParseAction.IgnoreElement;\n case 0x1f43b675: // cluster\n if (this.flagUseIndexToSkipClusters && this.seekHead) {\n const index = this.seekHead.seek.find(index => index.position + this.seekHeadOffset > this.tokenizer.position);\n if (index) {\n // Go to next index position\n const ignoreSize = index.position + this.seekHeadOffset - this.tokenizer.position;\n debug(`Use index to go to next position, ignoring ${ignoreSize} bytes`);\n this.tokenizer.ignore(ignoreSize);\n return _ebml_EbmlIterator_js__WEBPACK_IMPORTED_MODULE_4__.ParseAction.SkipElement;\n }\n }\n return _ebml_EbmlIterator_js__WEBPACK_IMPORTED_MODULE_4__.ParseAction.IgnoreElement;\n default:\n return _ebml_EbmlIterator_js__WEBPACK_IMPORTED_MODULE_4__.ParseAction.ReadNext;\n }\n },\n elementValue: async (element, value, offset) => {\n debug(`Received: name=${element.name}, value=${value}`);\n switch (element.id) {\n case 0x4282: // docType\n this.metadata.setFormat('container', `EBML/${value}`);\n break;\n case 0x114d9b74:\n this.seekHead = value;\n this.seekHeadOffset = offset;\n break;\n case 0x1549a966:\n { // Info (Segment Information)\n const info = value;\n const timecodeScale = info.timecodeScale ? info.timecodeScale : 1000000;\n if (typeof info.duration === 'number') {\n const duration = info.duration * timecodeScale / 1000000000;\n await this.addTag('segment:title', info.title);\n this.metadata.setFormat('duration', Number(duration));\n }\n }\n break;\n case 0x1654ae6b:\n { // tracks\n const audioTracks = value;\n if (audioTracks?.entries) {\n audioTracks.entries.forEach(entry => {\n const stream = {\n codecName: entry.codecID.replace('A_', '').replace('V_', ''),\n codecSettings: entry.codecSettings,\n flagDefault: entry.flagDefault,\n flagLacing: entry.flagLacing,\n flagEnabled: entry.flagEnabled,\n language: entry.language,\n name: entry.name,\n type: entry.trackType,\n audio: entry.audio,\n video: entry.video\n };\n this.metadata.addStreamInfo(stream);\n });\n const audioTrack = audioTracks.entries\n .filter(entry => entry.trackType === _types_js__WEBPACK_IMPORTED_MODULE_3__.TrackType.audio)\n .reduce((acc, cur) => {\n if (!acc)\n return cur;\n if (cur.flagDefault && !acc.flagDefault)\n return cur;\n if (cur.trackNumber < acc.trackNumber)\n return cur;\n return acc;\n }, null);\n if (audioTrack) {\n this.metadata.setFormat('codec', audioTrack.codecID.replace('A_', ''));\n this.metadata.setFormat('sampleRate', audioTrack.audio.samplingFrequency);\n this.metadata.setFormat('numberOfChannels', audioTrack.audio.channels);\n }\n }\n }\n break;\n case 0x1254c367:\n { // tags\n const tags = value;\n await Promise.all(tags.tag.map(async (tag) => {\n const target = tag.target;\n const targetType = target?.targetTypeValue ? _types_js__WEBPACK_IMPORTED_MODULE_3__.TargetType[target.targetTypeValue] : (target?.targetType ? target.targetType : 'track');\n await Promise.all(tag.simpleTags.map(async (simpleTag) => {\n const value = simpleTag.string ? simpleTag.string : simpleTag.binary;\n await this.addTag(`${targetType}:${simpleTag.name}`, value);\n }));\n }));\n }\n break;\n case 0x1941a469:\n { // attachments\n const attachments = value;\n await Promise.all(attachments.attachedFiles\n .filter(file => file.mimeType.startsWith('image/'))\n .map(file => this.addTag('picture', {\n data: file.data,\n format: file.mimeType,\n description: file.description,\n name: file.name\n })));\n }\n break;\n }\n }\n });\n }\n async addTag(tagId, value) {\n await this.metadata.addTag('matroska', tagId, value);\n }\n}\n//# sourceMappingURL=MatroskaParser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/matroska/MatroskaParser.js?");
|
37
|
+
|
38
|
+
/***/ })
|
39
|
+
|
40
|
+
}]);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
4
|
+
* This devtool is neither made for production nor for readable output files.
|
5
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
6
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
7
|
+
* or disable the default devtool with "devtool: false".
|
8
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
9
|
+
*/
|
10
|
+
(this["webpackChunkExamBundle"] = this["webpackChunkExamBundle"] || []).push([["vendors-node_modules_music-metadata_lib_mp4_MP4Parser_js"],{
|
11
|
+
|
12
|
+
/***/ "../../node_modules/music-metadata/lib/mp4/Atom.js":
|
13
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
14
|
+
|
15
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Atom: () => (/* binding */ Atom)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _AtomToken_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/mp4/AtomToken.js\");\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('music-metadata:parser:MP4:Atom');\nclass Atom {\n static async readAtom(tokenizer, dataHandler, parent, remaining) {\n // Parse atom header\n const offset = tokenizer.position;\n debug(`Reading next token on offset=${offset}...`); // buf.toString('ascii')\n const header = await tokenizer.readToken(_AtomToken_js__WEBPACK_IMPORTED_MODULE_1__.Header);\n const extended = header.length === 1n;\n if (extended) {\n header.length = await tokenizer.readToken(_AtomToken_js__WEBPACK_IMPORTED_MODULE_1__.ExtendedSize);\n }\n const atomBean = new Atom(header, extended, parent);\n const payloadLength = atomBean.getPayloadLength(remaining);\n debug(`parse atom name=${atomBean.atomPath}, extended=${atomBean.extended}, offset=${offset}, len=${atomBean.header.length}`); // buf.toString('ascii')\n await atomBean.readData(tokenizer, dataHandler, payloadLength);\n return atomBean;\n }\n constructor(header, extended, parent) {\n this.header = header;\n this.extended = extended;\n this.parent = parent;\n this.children = [];\n this.atomPath = (this.parent ? `${this.parent.atomPath}.` : '') + this.header.name;\n }\n getHeaderLength() {\n return this.extended ? 16 : 8;\n }\n getPayloadLength(remaining) {\n return (this.header.length === 0n ? remaining : Number(this.header.length)) - this.getHeaderLength();\n }\n async readAtoms(tokenizer, dataHandler, size) {\n while (size > 0) {\n const atomBean = await Atom.readAtom(tokenizer, dataHandler, this, size);\n this.children.push(atomBean);\n size -= atomBean.header.length === 0n ? size : Number(atomBean.header.length);\n }\n }\n async readData(tokenizer, dataHandler, remaining) {\n switch (this.header.name) {\n // \"Container\" atoms, contains nested atoms\n case 'moov': // The Movie Atom: contains other atoms\n case 'udta': // User defined atom\n case 'trak':\n case 'mdia': // Media atom\n case 'minf': // Media Information Atom\n case 'stbl': // The Sample Table Atom\n case '<id>':\n case 'ilst':\n case 'tref':\n return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining));\n case 'meta': { // Metadata Atom, ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW8\n // meta has 4 bytes of padding, ignore\n const peekHeader = await tokenizer.peekToken(_AtomToken_js__WEBPACK_IMPORTED_MODULE_1__.Header);\n const paddingLength = peekHeader.name === 'hdlr' ? 0 : 4;\n await tokenizer.ignore(paddingLength);\n return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining) - paddingLength);\n }\n default:\n return dataHandler(this, remaining);\n }\n }\n}\n//# sourceMappingURL=Atom.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mp4/Atom.js?");
|
16
|
+
|
17
|
+
/***/ }),
|
18
|
+
|
19
|
+
/***/ "../../node_modules/music-metadata/lib/mp4/AtomToken.js":
|
20
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
21
|
+
|
22
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ChapterText: () => (/* binding */ ChapterText),\n/* harmony export */ DataAtom: () => (/* binding */ DataAtom),\n/* harmony export */ ExtendedSize: () => (/* binding */ ExtendedSize),\n/* harmony export */ FixedLengthAtom: () => (/* binding */ FixedLengthAtom),\n/* harmony export */ Header: () => (/* binding */ Header),\n/* harmony export */ MdhdAtom: () => (/* binding */ MdhdAtom),\n/* harmony export */ Mp4ContentError: () => (/* binding */ Mp4ContentError),\n/* harmony export */ MvhdAtom: () => (/* binding */ MvhdAtom),\n/* harmony export */ NameAtom: () => (/* binding */ NameAtom),\n/* harmony export */ SampleToChunkToken: () => (/* binding */ SampleToChunkToken),\n/* harmony export */ SoundSampleDescriptionV0: () => (/* binding */ SoundSampleDescriptionV0),\n/* harmony export */ SoundSampleDescriptionVersion: () => (/* binding */ SoundSampleDescriptionVersion),\n/* harmony export */ StcoAtom: () => (/* binding */ StcoAtom),\n/* harmony export */ StscAtom: () => (/* binding */ StscAtom),\n/* harmony export */ StsdAtom: () => (/* binding */ StsdAtom),\n/* harmony export */ StszAtom: () => (/* binding */ StszAtom),\n/* harmony export */ SttsAtom: () => (/* binding */ SttsAtom),\n/* harmony export */ TimeToSampleToken: () => (/* binding */ TimeToSampleToken),\n/* harmony export */ TrackHeaderAtom: () => (/* binding */ TrackHeaderAtom),\n/* harmony export */ ftyp: () => (/* binding */ ftyp),\n/* harmony export */ mhdr: () => (/* binding */ mhdr),\n/* harmony export */ tkhd: () => (/* binding */ tkhd)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _common_FourCC_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/FourCC.js\");\n/* harmony import */ var _ParseError_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ParseError.js\");\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_1__('music-metadata:parser:MP4:atom');\nclass Mp4ContentError extends (0,_ParseError_js__WEBPACK_IMPORTED_MODULE_3__.makeUnexpectedFileContentError)('MP4') {\n}\nconst Header = {\n len: 8,\n get: (buf, off) => {\n const length = token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off);\n if (length < 0)\n throw new Mp4ContentError('Invalid atom header length');\n return {\n length: BigInt(length),\n name: new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(4, 'latin1').get(buf, off + 4)\n };\n },\n put: (buf, off, hdr) => {\n token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.put(buf, off, Number(hdr.length));\n return _common_FourCC_js__WEBPACK_IMPORTED_MODULE_2__.FourCcToken.put(buf, off + 4, hdr.name);\n }\n};\n/**\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190\n */\nconst ExtendedSize = token_types__WEBPACK_IMPORTED_MODULE_0__.UINT64_BE;\nconst ftyp = {\n len: 4,\n get: (buf, off) => {\n return {\n type: new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(4, 'ascii').get(buf, off)\n };\n }\n};\nconst tkhd = {\n len: 4,\n get: (buf, off) => {\n return {\n type: new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(4, 'ascii').get(buf, off)\n };\n }\n};\n/**\n * Token: Movie Header Atom\n */\nconst mhdr = {\n len: 8,\n get: (buf, off) => {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1),\n nextItemID: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 4)\n };\n }\n};\n/**\n * Base class for 'fixed' length atoms.\n * In some cases these atoms are longer then the sum of the described fields.\n * Issue: https://github.com/Borewit/music-metadata/issues/120\n */\nclass FixedLengthAtom {\n /**\n *\n * @param {number} len Length as specified in the size field\n * @param {number} expLen Total length of sum of specified fields in the standard\n * @param atomId Atom ID\n */\n constructor(len, expLen, atomId) {\n this.len = len;\n if (len < expLen) {\n throw new Mp4ContentError(`Atom ${atomId} expected to be ${expLen}, but specifies ${len} bytes long.`);\n }\n if (len > expLen) {\n debug(`Warning: atom ${atomId} expected to be ${expLen}, but was actually ${len} bytes long.`);\n }\n }\n}\n/**\n * Timestamp stored in seconds since Mac Epoch (1 January 1904)\n */\nconst SecondsSinceMacEpoch = {\n len: 4,\n get: (buf, off) => {\n const secondsSinceUnixEpoch = token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off) - 2082844800;\n return new Date(secondsSinceUnixEpoch * 1000);\n }\n};\n/**\n * Token: Media Header Atom\n * Ref:\n * - https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW34\n * - https://wiki.multimedia.cx/index.php/QuickTime_container#mdhd\n */\nclass MdhdAtom extends FixedLengthAtom {\n constructor(len) {\n super(len, 24, 'mdhd');\n this.len = len;\n }\n get(buf, off) {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off + 0),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1),\n creationTime: SecondsSinceMacEpoch.get(buf, off + 4),\n modificationTime: SecondsSinceMacEpoch.get(buf, off + 8),\n timeScale: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 12),\n duration: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 16),\n language: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 20),\n quality: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 22)\n };\n }\n}\n/**\n * Token: Movie Header Atom\n */\nclass MvhdAtom extends FixedLengthAtom {\n constructor(len) {\n super(len, 100, 'mvhd');\n this.len = len;\n }\n get(buf, off) {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1),\n creationTime: SecondsSinceMacEpoch.get(buf, off + 4),\n modificationTime: SecondsSinceMacEpoch.get(buf, off + 8),\n timeScale: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 12),\n duration: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 16),\n preferredRate: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 20),\n preferredVolume: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 24),\n // ignore reserver: 10 bytes\n // ignore matrix structure: 36 bytes\n previewTime: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 72),\n previewDuration: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 76),\n posterTime: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 80),\n selectionTime: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 84),\n selectionDuration: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 88),\n currentTime: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 92),\n nextTrackID: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 96)\n };\n }\n}\n/**\n * Data Atom Structure\n */\nclass DataAtom {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n return {\n type: {\n set: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off + 0),\n type: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1)\n },\n locale: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 4),\n value: new token_types__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayType(this.len - 8).get(buf, off + 8)\n };\n }\n}\n/**\n * Data Atom Structure\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW31\n */\nclass NameAtom {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1),\n name: new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(this.len - 4, 'utf-8').get(buf, off + 4)\n };\n }\n}\n/**\n * Track Header Atoms structure\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25550\n */\nclass TrackHeaderAtom {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1),\n creationTime: SecondsSinceMacEpoch.get(buf, off + 4),\n modificationTime: SecondsSinceMacEpoch.get(buf, off + 8),\n trackId: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 12),\n // reserved 4 bytes\n duration: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 20),\n layer: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 24),\n alternateGroup: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 26),\n volume: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 28) // ToDo: fixed point\n // ToDo: add remaining fields\n };\n }\n}\n/**\n * Atom: Sample Description Atom ('stsd')\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691\n */\nconst stsdHeader = {\n len: 8,\n get: (buf, off) => {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT24_BE.get(buf, off + 1),\n numberOfEntries: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 4)\n };\n }\n};\n/**\n * Atom: Sample Description Atom ('stsd')\n * Ref: https://developer.apple.com/documentation/quicktime-file-format/sample_description_atom\n */\nclass SampleDescriptionTable {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n const descrLen = this.len - 12;\n return {\n dataFormat: _common_FourCC_js__WEBPACK_IMPORTED_MODULE_2__.FourCcToken.get(buf, off),\n dataReferenceIndex: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 10),\n description: descrLen > 0 ? new token_types__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayType(descrLen).get(buf, off + 12) : undefined\n };\n }\n}\n/**\n * Atom: Sample-description Atom ('stsd')\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25691\n */\nclass StsdAtom {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n const header = stsdHeader.get(buf, off);\n off += stsdHeader.len;\n const table = [];\n for (let n = 0; n < header.numberOfEntries; ++n) {\n const size = token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off); // Sample description size\n off += token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.len;\n table.push(new SampleDescriptionTable(size - token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.len).get(buf, off));\n off += size;\n }\n return {\n header,\n table\n };\n }\n}\n/**\n * Common Sound Sample Description (version & revision)\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-57317\n */\nconst SoundSampleDescriptionVersion = {\n len: 8,\n get(buf, off) {\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off),\n revision: token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off + 2),\n vendor: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 4)\n };\n }\n};\n/**\n * Sound Sample Description (Version 0)\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-130736\n */\nconst SoundSampleDescriptionV0 = {\n len: 12,\n get(buf, off) {\n return {\n numAudioChannels: token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off + 0),\n sampleSize: token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off + 2),\n compressionId: token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off + 4),\n packetSize: token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off + 6),\n sampleRate: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 8) + token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 10) / 10000\n };\n }\n};\nclass SimpleTableAtom {\n constructor(len, token) {\n this.len = len;\n this.token = token;\n }\n get(buf, off) {\n const nrOfEntries = token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 4);\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.INT8.get(buf, off + 0),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.INT24_BE.get(buf, off + 1),\n numberOfEntries: nrOfEntries,\n entries: readTokenTable(buf, this.token, off + 8, this.len - 8, nrOfEntries)\n };\n }\n}\nconst TimeToSampleToken = {\n len: 8,\n get(buf, off) {\n return {\n count: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 0),\n duration: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 4)\n };\n }\n};\n/**\n * Time-to-sample('stts') atom.\n * Store duration information for a media’s samples.\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25696\n */\nclass SttsAtom extends SimpleTableAtom {\n constructor(len) {\n super(len, TimeToSampleToken);\n this.len = len;\n }\n}\nconst SampleToChunkToken = {\n len: 12,\n get(buf, off) {\n return {\n firstChunk: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off),\n samplesPerChunk: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 4),\n sampleDescriptionId: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 8)\n };\n }\n};\n/**\n * Sample-to-Chunk ('stsc') atom interface\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25706\n */\nclass StscAtom extends SimpleTableAtom {\n constructor(len) {\n super(len, SampleToChunkToken);\n this.len = len;\n }\n}\n/**\n * Sample-size ('stsz') atom\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25710\n */\nclass StszAtom {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n const nrOfEntries = token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 8);\n return {\n version: token_types__WEBPACK_IMPORTED_MODULE_0__.INT8.get(buf, off),\n flags: token_types__WEBPACK_IMPORTED_MODULE_0__.INT24_BE.get(buf, off + 1),\n sampleSize: token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE.get(buf, off + 4),\n numberOfEntries: nrOfEntries,\n entries: readTokenTable(buf, token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE, off + 12, this.len - 12, nrOfEntries)\n };\n }\n}\n/**\n * Chunk offset atom, 'stco'\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25715\n */\nclass StcoAtom extends SimpleTableAtom {\n constructor(len) {\n super(len, token_types__WEBPACK_IMPORTED_MODULE_0__.INT32_BE);\n this.len = len;\n }\n}\n/**\n * Token used to decode text-track from 'mdat' atom (raw data stream)\n */\nclass ChapterText {\n constructor(len) {\n this.len = len;\n }\n get(buf, off) {\n const titleLen = token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE.get(buf, off + 0);\n const str = new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(titleLen, 'utf-8');\n return str.get(buf, off + 2);\n }\n}\nfunction readTokenTable(buf, token, off, remainingLen, numberOfEntries) {\n debug(`remainingLen=${remainingLen}, numberOfEntries=${numberOfEntries} * token-len=${token.len}`);\n if (remainingLen === 0)\n return [];\n if (remainingLen !== numberOfEntries * token.len)\n throw new Mp4ContentError('mismatch number-of-entries with remaining atom-length');\n const entries = [];\n // parse offset-table\n for (let n = 0; n < numberOfEntries; ++n) {\n entries.push(token.get(buf, off));\n off += token.len;\n }\n return entries;\n}\n//# sourceMappingURL=AtomToken.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mp4/AtomToken.js?");
|
23
|
+
|
24
|
+
/***/ }),
|
25
|
+
|
26
|
+
/***/ "../../node_modules/music-metadata/lib/mp4/MP4Parser.js":
|
27
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
28
|
+
|
29
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MP4Parser: () => (/* binding */ MP4Parser)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/BasicParser.js\");\n/* harmony import */ var _id3v1_ID3v1Parser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v1/ID3v1Parser.js\");\n/* harmony import */ var _Atom_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/mp4/Atom.js\");\n/* harmony import */ var _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/mp4/AtomToken.js\");\n/* harmony import */ var _type_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(\"../../node_modules/music-metadata/lib/type.js\");\n/* harmony import */ var uint8array_extras__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(\"../../node_modules/uint8array-extras/index.js\");\n\n\n\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('music-metadata:parser:MP4');\nconst tagFormat = 'iTunes';\nconst encoderDict = {\n raw: {\n lossy: false,\n format: 'raw'\n },\n MAC3: {\n lossy: true,\n format: 'MACE 3:1'\n },\n MAC6: {\n lossy: true,\n format: 'MACE 6:1'\n },\n ima4: {\n lossy: true,\n format: 'IMA 4:1'\n },\n ulaw: {\n lossy: true,\n format: 'uLaw 2:1'\n },\n alaw: {\n lossy: true,\n format: 'uLaw 2:1'\n },\n Qclp: {\n lossy: true,\n format: 'QUALCOMM PureVoice'\n },\n '.mp3': {\n lossy: true,\n format: 'MPEG-1 layer 3'\n },\n alac: {\n lossy: false,\n format: 'ALAC'\n },\n 'ac-3': {\n lossy: true,\n format: 'AC-3'\n },\n mp4a: {\n lossy: true,\n format: 'MPEG-4/AAC'\n },\n mp4s: {\n lossy: true,\n format: 'MP4S'\n },\n // Closed Captioning Media, https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-SW87\n c608: {\n lossy: true,\n format: 'CEA-608'\n },\n c708: {\n lossy: true,\n format: 'CEA-708'\n }\n};\nfunction distinct(value, index, self) {\n return self.indexOf(value) === index;\n}\n/*\n * Parser for the MP4 (MPEG-4 Part 14) container format\n * Standard: ISO/IEC 14496-14\n * supporting:\n * - QuickTime container\n * - MP4 File Format\n * - 3GPP file format\n * - 3GPP2 file format\n *\n * MPEG-4 Audio / Part 3 (.m4a)& MPEG 4 Video (m4v, mp4) extension.\n * Support for Apple iTunes tags as found in a M4A/M4V files.\n * Ref:\n * https://en.wikipedia.org/wiki/ISO_base_media_file_format\n * https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html\n * http://atomicparsley.sourceforge.net/mpeg-4files.html\n * https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata\n * https://wiki.multimedia.cx/index.php/QuickTime_container\n */\nclass MP4Parser extends _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_2__.BasicParser {\n constructor() {\n super(...arguments);\n this.tracks = [];\n this.atomParsers = {\n /**\n * Parse movie header (mvhd) atom\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-56313\n */\n mvhd: async (len) => {\n const mvhd = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.MvhdAtom(len));\n this.metadata.setFormat('creationTime', mvhd.creationTime);\n this.metadata.setFormat('modificationTime', mvhd.modificationTime);\n },\n /**\n * Parse media header (mdhd) atom\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25615\n */\n mdhd: async (len) => {\n const mdhd_data = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.MdhdAtom(len));\n // this.parse_mxhd(mdhd_data, this.currentTrack);\n const td = this.getTrackDescription();\n td.creationTime = mdhd_data.creationTime;\n td.modificationTime = mdhd_data.modificationTime;\n td.timeScale = mdhd_data.timeScale;\n td.duration = mdhd_data.duration;\n },\n chap: async (len) => {\n const td = this.getTrackDescription();\n const trackIds = [];\n while (len >= token_types__WEBPACK_IMPORTED_MODULE_1__.UINT32_BE.len) {\n trackIds.push(await this.tokenizer.readNumber(token_types__WEBPACK_IMPORTED_MODULE_1__.UINT32_BE));\n len -= token_types__WEBPACK_IMPORTED_MODULE_1__.UINT32_BE.len;\n }\n td.chapterList = trackIds;\n },\n tkhd: async (len) => {\n const track = (await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.TrackHeaderAtom(len)));\n this.tracks.push(track);\n },\n /**\n * Parse mdat atom.\n * Will scan for chapters\n */\n mdat: async (len) => {\n this.audioLengthInBytes = len;\n this.calculateBitRate();\n if (this.options.includeChapters) {\n const trackWithChapters = this.tracks.filter(track => track.chapterList);\n if (trackWithChapters.length === 1) {\n const chapterTrackIds = trackWithChapters[0].chapterList;\n const chapterTracks = this.tracks.filter(track => chapterTrackIds.indexOf(track.trackId) !== -1);\n if (chapterTracks.length === 1) {\n return this.parseChapterTrack(chapterTracks[0], trackWithChapters[0], len);\n }\n }\n }\n await this.tokenizer.ignore(len);\n },\n ftyp: async (len) => {\n const types = [];\n while (len > 0) {\n const ftype = await this.tokenizer.readToken(_AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.ftyp);\n len -= _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.ftyp.len;\n const value = ftype.type.replace(/\\W/g, '');\n if (value.length > 0) {\n types.push(value); // unshift for backward compatibility\n }\n }\n debug(`ftyp: ${types.join('/')}`);\n const x = types.filter(distinct).join('/');\n this.metadata.setFormat('container', x);\n },\n /**\n * Parse sample description atom\n */\n stsd: async (len) => {\n const stsd = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.StsdAtom(len));\n const trackDescription = this.getTrackDescription();\n trackDescription.soundSampleDescription = stsd.table.map(dfEntry => this.parseSoundSampleDescription(dfEntry));\n },\n /**\n * sample-to-Chunk Atoms\n */\n stsc: async (len) => {\n const stsc = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.StscAtom(len));\n this.getTrackDescription().sampleToChunkTable = stsc.entries;\n },\n /**\n * time-to-sample table\n */\n stts: async (len) => {\n const stts = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.SttsAtom(len));\n this.getTrackDescription().timeToSampleTable = stts.entries;\n },\n /**\n * Parse sample-sizes atom ('stsz')\n */\n stsz: async (len) => {\n const stsz = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.StszAtom(len));\n const td = this.getTrackDescription();\n td.sampleSize = stsz.sampleSize;\n td.sampleSizeTable = stsz.entries;\n },\n /**\n * Parse chunk-offset atom ('stco')\n */\n stco: async (len) => {\n const stco = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.StcoAtom(len));\n this.getTrackDescription().chunkOffsetTable = stco.entries; // remember chunk offsets\n },\n date: async (len) => {\n const date = await this.tokenizer.readToken(new token_types__WEBPACK_IMPORTED_MODULE_1__.StringType(len, 'utf-8'));\n await this.addTag('date', date);\n }\n };\n }\n static read_BE_Integer(array, signed) {\n const integerType = (signed ? 'INT' : 'UINT') + array.length * 8 + (array.length > 1 ? '_BE' : '');\n const token = token_types__WEBPACK_IMPORTED_MODULE_1__[integerType];\n if (!token) {\n throw new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.Mp4ContentError(`Token for integer type not found: \"${integerType}\"`);\n }\n return Number(token.get(array, 0));\n }\n async parse() {\n this.tracks = [];\n let remainingFileSize = this.tokenizer.fileInfo.size || 0;\n while (!this.tokenizer.fileInfo.size || remainingFileSize > 0) {\n try {\n const token = await this.tokenizer.peekToken(_AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.Header);\n if (token.name === '\\0\\0\\0\\0') {\n const errMsg = `Error at offset=${this.tokenizer.position}: box.id=0`;\n debug(errMsg);\n this.addWarning(errMsg);\n break;\n }\n }\n catch (error) {\n if (error instanceof Error) {\n const errMsg = `Error at offset=${this.tokenizer.position}: ${error.message}`;\n debug(errMsg);\n this.addWarning(errMsg);\n }\n else\n throw error;\n break;\n }\n const rootAtom = await _Atom_js__WEBPACK_IMPORTED_MODULE_4__.Atom.readAtom(this.tokenizer, (atom, remaining) => this.handleAtom(atom, remaining), null, remainingFileSize);\n remainingFileSize -= rootAtom.header.length === BigInt(0) ? remainingFileSize : Number(rootAtom.header.length);\n }\n // Post process metadata\n const formatList = [];\n this.tracks.forEach(track => {\n const trackFormats = [];\n track.soundSampleDescription.forEach(ssd => {\n const streamInfo = {};\n const encoderInfo = encoderDict[ssd.dataFormat];\n if (encoderInfo) {\n trackFormats.push(encoderInfo.format);\n streamInfo.codecName = encoderInfo.format;\n }\n else {\n streamInfo.codecName = `<${ssd.dataFormat}>`;\n }\n if (ssd.description) {\n const { description } = ssd;\n if (description.sampleRate > 0) {\n streamInfo.type = _type_js__WEBPACK_IMPORTED_MODULE_6__.TrackType.audio;\n streamInfo.audio = {\n samplingFrequency: description.sampleRate,\n bitDepth: description.sampleSize,\n channels: description.numAudioChannels\n };\n }\n }\n this.metadata.addStreamInfo(streamInfo);\n });\n if (trackFormats.length >= 1) {\n formatList.push(trackFormats.join('/'));\n }\n });\n if (formatList.length > 0) {\n this.metadata.setFormat('codec', formatList.filter(distinct).join('+'));\n }\n const audioTracks = this.tracks.filter(track => {\n return track.soundSampleDescription.length >= 1 && track.soundSampleDescription[0].description && track.soundSampleDescription[0].description.numAudioChannels > 0;\n });\n if (audioTracks.length >= 1) {\n const audioTrack = audioTracks[0];\n if (audioTrack.timeScale > 0) {\n const duration = audioTrack.duration / audioTrack.timeScale; // calculate duration in seconds\n this.metadata.setFormat('duration', duration);\n }\n const ssd = audioTrack.soundSampleDescription[0];\n if (ssd.description) {\n this.metadata.setFormat('sampleRate', ssd.description.sampleRate);\n this.metadata.setFormat('bitsPerSample', ssd.description.sampleSize);\n this.metadata.setFormat('numberOfChannels', ssd.description.numAudioChannels);\n if (audioTrack.timeScale === 0 && audioTrack.timeToSampleTable.length > 0) {\n const totalSampleSize = audioTrack.timeToSampleTable\n .map(ttstEntry => ttstEntry.count * ttstEntry.duration)\n .reduce((total, sampleSize) => total + sampleSize);\n const duration = totalSampleSize / ssd.description.sampleRate;\n this.metadata.setFormat('duration', duration);\n }\n }\n const encoderInfo = encoderDict[ssd.dataFormat];\n if (encoderInfo) {\n this.metadata.setFormat('lossless', !encoderInfo.lossy);\n }\n this.calculateBitRate();\n }\n }\n async handleAtom(atom, remaining) {\n if (atom.parent) {\n switch (atom.parent.header.name) {\n case 'ilst':\n case '<id>':\n return this.parseMetadataItemData(atom);\n }\n }\n // const payloadLength = atom.getPayloadLength(remaining);\n if (this.atomParsers[atom.header.name]) {\n return this.atomParsers[atom.header.name](remaining);\n }\n debug(`No parser for atom path=${atom.atomPath}, payload-len=${remaining}, ignoring atom`);\n await this.tokenizer.ignore(remaining);\n }\n getTrackDescription() {\n return this.tracks[this.tracks.length - 1];\n }\n calculateBitRate() {\n if (this.audioLengthInBytes && this.metadata.format.duration) {\n this.metadata.setFormat('bitrate', 8 * this.audioLengthInBytes / this.metadata.format.duration);\n }\n }\n async addTag(id, value) {\n await this.metadata.addTag(tagFormat, id, value);\n }\n addWarning(message) {\n debug(`Warning: ${message}`);\n this.metadata.addWarning(message);\n }\n /**\n * Parse data of Meta-item-list-atom (item of 'ilst' atom)\n * @param metaAtom\n * Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW8\n */\n parseMetadataItemData(metaAtom) {\n let tagKey = metaAtom.header.name;\n return metaAtom.readAtoms(this.tokenizer, async (child, remaining) => {\n const payLoadLength = child.getPayloadLength(remaining);\n switch (child.header.name) {\n case 'data': // value atom\n return this.parseValueAtom(tagKey, child);\n case 'name': // name atom (optional)\n case 'mean':\n case 'rate': {\n const name = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.NameAtom(payLoadLength));\n tagKey += `:${name.name}`;\n break;\n }\n default: {\n const uint8Array = await this.tokenizer.readToken(new token_types__WEBPACK_IMPORTED_MODULE_1__.Uint8ArrayType(payLoadLength));\n this.addWarning(`Unsupported meta-item: ${tagKey}[${child.header.name}] => value=${(0,uint8array_extras__WEBPACK_IMPORTED_MODULE_7__.uint8ArrayToHex)(uint8Array)} ascii=${(0,uint8array_extras__WEBPACK_IMPORTED_MODULE_7__.uint8ArrayToString)(uint8Array, 'ascii')}`);\n }\n }\n }, metaAtom.getPayloadLength(0));\n }\n async parseValueAtom(tagKey, metaAtom) {\n const dataAtom = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.DataAtom(Number(metaAtom.header.length) - _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.Header.len));\n if (dataAtom.type.set !== 0) {\n throw new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.Mp4ContentError(`Unsupported type-set != 0: ${dataAtom.type.set}`);\n }\n // Use well-known-type table\n // Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW35\n switch (dataAtom.type.type) {\n case 0: // reserved: Reserved for use where no type needs to be indicated\n switch (tagKey) {\n case 'trkn':\n case 'disk': {\n const num = token_types__WEBPACK_IMPORTED_MODULE_1__.UINT8.get(dataAtom.value, 3);\n const of = token_types__WEBPACK_IMPORTED_MODULE_1__.UINT8.get(dataAtom.value, 5);\n // console.log(\" %s[data] = %s/%s\", tagKey, num, of);\n await this.addTag(tagKey, `${num}/${of}`);\n break;\n }\n case 'gnre': {\n const genreInt = token_types__WEBPACK_IMPORTED_MODULE_1__.UINT8.get(dataAtom.value, 1);\n const genreStr = _id3v1_ID3v1Parser_js__WEBPACK_IMPORTED_MODULE_3__.Genres[genreInt - 1];\n // console.log(\" %s[data] = %s\", tagKey, genreStr);\n await this.addTag(tagKey, genreStr);\n break;\n }\n case 'rate': {\n const rate = new TextDecoder('ascii').decode(dataAtom.value);\n await this.addTag(tagKey, rate);\n break;\n }\n default:\n debug(`unknown proprietary value type for: ${metaAtom.atomPath}`);\n }\n break;\n case 1: // UTF-8: Without any count or NULL terminator\n case 18: // Unknown: Found in m4b in combination with a '©gen' tag\n await this.addTag(tagKey, new TextDecoder('utf-8').decode(dataAtom.value));\n break;\n case 13: // JPEG\n if (this.options.skipCovers)\n break;\n await this.addTag(tagKey, {\n format: 'image/jpeg',\n data: Uint8Array.from(dataAtom.value)\n });\n break;\n case 14: // PNG\n if (this.options.skipCovers)\n break;\n await this.addTag(tagKey, {\n format: 'image/png',\n data: Uint8Array.from(dataAtom.value)\n });\n break;\n case 21: // BE Signed Integer\n await this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, true));\n break;\n case 22: // BE Unsigned Integer\n await this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, false));\n break;\n case 65: // An 8-bit signed integer\n await this.addTag(tagKey, token_types__WEBPACK_IMPORTED_MODULE_1__.UINT8.get(dataAtom.value, 0));\n break;\n case 66: // A big-endian 16-bit signed integer\n await this.addTag(tagKey, token_types__WEBPACK_IMPORTED_MODULE_1__.UINT16_BE.get(dataAtom.value, 0));\n break;\n case 67: // A big-endian 32-bit signed integer\n await this.addTag(tagKey, token_types__WEBPACK_IMPORTED_MODULE_1__.UINT32_BE.get(dataAtom.value, 0));\n break;\n default:\n this.addWarning(`atom key=${tagKey}, has unknown well-known-type (data-type): ${dataAtom.type.type}`);\n }\n }\n /**\n * @param sampleDescription\n * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-128916\n */\n parseSoundSampleDescription(sampleDescription) {\n const ssd = {\n dataFormat: sampleDescription.dataFormat,\n dataReferenceIndex: sampleDescription.dataReferenceIndex\n };\n let offset = 0;\n if (sampleDescription.description) {\n const version = _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.SoundSampleDescriptionVersion.get(sampleDescription.description, offset);\n offset += _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.SoundSampleDescriptionVersion.len;\n if (version.version === 0 || version.version === 1) {\n // Sound Sample Description (Version 0)\n ssd.description = _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.SoundSampleDescriptionV0.get(sampleDescription.description, offset);\n }\n else {\n debug(`Warning: sound-sample-description ${version} not implemented`);\n }\n }\n return ssd;\n }\n async parseChapterTrack(chapterTrack, track, len) {\n if (!chapterTrack.sampleSize) {\n if (chapterTrack.chunkOffsetTable.length !== chapterTrack.sampleSizeTable.length)\n throw new Error('Expected equal chunk-offset-table & sample-size-table length.');\n }\n const chapters = [];\n for (let i = 0; i < chapterTrack.chunkOffsetTable.length && len > 0; ++i) {\n const chunkOffset = chapterTrack.chunkOffsetTable[i];\n const nextChunkLen = chunkOffset - this.tokenizer.position;\n const sampleSize = chapterTrack.sampleSize > 0 ? chapterTrack.sampleSize : chapterTrack.sampleSizeTable[i];\n len -= nextChunkLen + sampleSize;\n if (len < 0)\n throw new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.Mp4ContentError('Chapter chunk exceeding token length');\n await this.tokenizer.ignore(nextChunkLen);\n const title = await this.tokenizer.readToken(new _AtomToken_js__WEBPACK_IMPORTED_MODULE_5__.ChapterText(sampleSize));\n debug(`Chapter ${i + 1}: ${title}`);\n const chapter = {\n title,\n sampleOffset: this.findSampleOffset(track, this.tokenizer.position)\n };\n debug(`Chapter title=${chapter.title}, offset=${chapter.sampleOffset}/${this.tracks[0].duration}`);\n chapters.push(chapter);\n }\n this.metadata.setFormat('chapters', chapters);\n await this.tokenizer.ignore(len);\n }\n findSampleOffset(track, chapterOffset) {\n let totalDuration = 0;\n track.timeToSampleTable.forEach(e => {\n totalDuration += e.count * e.duration;\n });\n debug(`Total duration=${totalDuration}`);\n let chunkIndex = 0;\n while (chunkIndex < track.chunkOffsetTable.length && track.chunkOffsetTable[chunkIndex] < chapterOffset) {\n ++chunkIndex;\n }\n return this.getChunkDuration(chunkIndex + 1, track);\n }\n getChunkDuration(chunkId, track) {\n let ttsi = 0;\n let ttsc = track.timeToSampleTable[ttsi].count;\n let ttsd = track.timeToSampleTable[ttsi].duration;\n let curChunkId = 1;\n let samplesPerChunk = this.getSamplesPerChunk(curChunkId, track.sampleToChunkTable);\n let totalDuration = 0;\n while (curChunkId < chunkId) {\n const nrOfSamples = Math.min(ttsc, samplesPerChunk);\n totalDuration += nrOfSamples * ttsd;\n ttsc -= nrOfSamples;\n samplesPerChunk -= nrOfSamples;\n if (samplesPerChunk === 0) {\n ++curChunkId;\n samplesPerChunk = this.getSamplesPerChunk(curChunkId, track.sampleToChunkTable);\n }\n else {\n ++ttsi;\n ttsc = track.timeToSampleTable[ttsi].count;\n ttsd = track.timeToSampleTable[ttsi].duration;\n }\n }\n return totalDuration;\n }\n getSamplesPerChunk(chunkId, stcTable) {\n for (let i = 0; i < stcTable.length - 1; ++i) {\n if (chunkId >= stcTable[i].firstChunk && chunkId < stcTable[i + 1].firstChunk) {\n return stcTable[i].samplesPerChunk;\n }\n }\n return stcTable[stcTable.length - 1].samplesPerChunk;\n }\n}\n//# sourceMappingURL=MP4Parser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mp4/MP4Parser.js?");
|
30
|
+
|
31
|
+
/***/ })
|
32
|
+
|
33
|
+
}]);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
4
|
+
* This devtool is neither made for production nor for readable output files.
|
5
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
6
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
7
|
+
* or disable the default devtool with "devtool: false".
|
8
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
9
|
+
*/
|
10
|
+
(this["webpackChunkExamBundle"] = this["webpackChunkExamBundle"] || []).push([["vendors-node_modules_music-metadata_lib_mpeg_MpegParser_js"],{
|
11
|
+
|
12
|
+
/***/ "../../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js":
|
13
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
14
|
+
|
15
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbstractID3Parser: () => (/* binding */ AbstractID3Parser)\n/* harmony export */ });\n/* harmony import */ var strtok3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/strtok3/lib/core.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _ID3v2Token_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v2/ID3v2Token.js\");\n/* harmony import */ var _ID3v2Parser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v2/ID3v2Parser.js\");\n/* harmony import */ var _id3v1_ID3v1Parser_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v1/ID3v1Parser.js\");\n/* harmony import */ var _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/BasicParser.js\");\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_1__('music-metadata:parser:ID3');\n/**\n * Abstract parser which tries take ID3v2 and ID3v1 headers.\n */\nclass AbstractID3Parser extends _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_5__.BasicParser {\n constructor() {\n super(...arguments);\n this.id3parser = new _ID3v2Parser_js__WEBPACK_IMPORTED_MODULE_3__.ID3v2Parser();\n }\n static async startsWithID3v2Header(tokenizer) {\n return (await tokenizer.peekToken(_ID3v2Token_js__WEBPACK_IMPORTED_MODULE_2__.ID3v2Header)).fileIdentifier === 'ID3';\n }\n async parse() {\n try {\n await this.parseID3v2();\n }\n catch (err) {\n if (err instanceof strtok3__WEBPACK_IMPORTED_MODULE_0__.EndOfStreamError) {\n debug(\"End-of-stream\");\n }\n else {\n throw err;\n }\n }\n }\n finalize() {\n return;\n }\n async parseID3v2() {\n await this.tryReadId3v2Headers();\n debug('End of ID3v2 header, go to MPEG-parser: pos=%s', this.tokenizer.position);\n await this.postId3v2Parse();\n if (this.options.skipPostHeaders && this.metadata.hasAny()) {\n this.finalize();\n }\n else {\n const id3v1parser = new _id3v1_ID3v1Parser_js__WEBPACK_IMPORTED_MODULE_4__.ID3v1Parser(this.metadata, this.tokenizer, this.options);\n await id3v1parser.parse();\n this.finalize();\n }\n }\n async tryReadId3v2Headers() {\n const id3Header = await this.tokenizer.peekToken(_ID3v2Token_js__WEBPACK_IMPORTED_MODULE_2__.ID3v2Header);\n if (id3Header.fileIdentifier === 'ID3') {\n debug('Found ID3v2 header, pos=%s', this.tokenizer.position);\n await this.id3parser.parse(this.metadata, this.tokenizer, this.options);\n return this.tryReadId3v2Headers();\n }\n }\n}\n//# sourceMappingURL=AbstractID3Parser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js?");
|
16
|
+
|
17
|
+
/***/ }),
|
18
|
+
|
19
|
+
/***/ "../../node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.js":
|
20
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
21
|
+
|
22
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExtendedLameHeader: () => (/* binding */ ExtendedLameHeader)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var _common_Util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/Util.js\");\n/* harmony import */ var _ReplayGainDataFormat_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js\");\n/**\n * Extended Lame Header\n */\n\n\n\n/**\n * Info Tag\n * @link http://gabriel.mp3-tech.org/mp3infotag.html\n * @link https://github.com/quodlibet/mutagen/blob/abd58ee58772224334a18817c3fb31103572f70e/mutagen/mp3/_util.py#L112\n */\nconst ExtendedLameHeader = {\n len: 27,\n get: (buf, off) => {\n const track_peak = token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 2);\n return {\n revision: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off, 0, 4),\n vbr_method: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off, 4, 4),\n lowpass_filter: 100 * token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off + 1),\n track_peak: track_peak === 0 ? null : track_peak / 2 ** 23,\n track_gain: _ReplayGainDataFormat_js__WEBPACK_IMPORTED_MODULE_2__.ReplayGain.get(buf, 6),\n album_gain: _ReplayGainDataFormat_js__WEBPACK_IMPORTED_MODULE_2__.ReplayGain.get(buf, 8),\n music_length: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE.get(buf, off + 20),\n music_crc: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off + 24),\n header_crc: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_BE.get(buf, off + 24)\n };\n }\n};\n//# sourceMappingURL=ExtendedLameHeader.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.js?");
|
23
|
+
|
24
|
+
/***/ }),
|
25
|
+
|
26
|
+
/***/ "../../node_modules/music-metadata/lib/mpeg/MpegParser.js":
|
27
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
28
|
+
|
29
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MpegContentError: () => (/* binding */ MpegContentError),\n/* harmony export */ MpegParser: () => (/* binding */ MpegParser)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var strtok3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/strtok3/lib/core.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _common_Util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/Util.js\");\n/* harmony import */ var _id3v2_AbstractID3Parser_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js\");\n/* harmony import */ var _XingTag_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/mpeg/XingTag.js\");\n/* harmony import */ var _ParseError_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ParseError.js\");\n\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_2__('music-metadata:parser:mpeg');\nclass MpegContentError extends (0,_ParseError_js__WEBPACK_IMPORTED_MODULE_6__.makeUnexpectedFileContentError)('MPEG') {\n}\n/**\n * Cache buffer size used for searching synchronization preabmle\n */\nconst maxPeekLen = 1024;\n/**\n * MPEG-4 Audio definitions\n * Ref: https://wiki.multimedia.cx/index.php/MPEG-4_Audio\n */\nconst MPEG4 = {\n /**\n * Audio Object Types\n */\n AudioObjectTypes: [\n 'AAC Main',\n 'AAC LC', // Low Complexity\n 'AAC SSR', // Scalable Sample Rate\n 'AAC LTP' // Long Term Prediction\n ],\n /**\n * Sampling Frequencies\n * https://wiki.multimedia.cx/index.php/MPEG-4_Audio#Sampling_Frequencies\n */\n SamplingFrequencies: [\n 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, null, null, -1\n ]\n /**\n * Channel Configurations\n */\n};\nconst MPEG4_ChannelConfigurations = [\n undefined,\n ['front-center'],\n ['front-left', 'front-right'],\n ['front-center', 'front-left', 'front-right'],\n ['front-center', 'front-left', 'front-right', 'back-center'],\n ['front-center', 'front-left', 'front-right', 'back-left', 'back-right'],\n ['front-center', 'front-left', 'front-right', 'back-left', 'back-right', 'LFE-channel'],\n ['front-center', 'front-left', 'front-right', 'side-left', 'side-right', 'back-left', 'back-right', 'LFE-channel']\n];\n/**\n * MPEG Audio Layer I/II/III frame header\n * Ref: https://www.mp3-tech.org/programmer/frame_header.html\n * Bit layout: AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM\n * Ref: https://wiki.multimedia.cx/index.php/ADTS\n */\nclass MpegFrameHeader {\n constructor(buf, off) {\n // E(15,12): Bitrate index\n this.bitrateIndex = null;\n // F(11,10): Sampling rate frequency index\n this.sampRateFreqIndex = null;\n // G(9): Padding bit\n this.padding = null;\n // H(8): Private bit\n this.privateBit = null;\n // I(7,6): Channel Mode\n this.channelModeIndex = null;\n // J(5,4): Mode extension (Only used in Joint stereo)\n this.modeExtension = null;\n // L(2): Original\n this.isOriginalMedia = null;\n this.version = null;\n this.bitrate = null;\n this.samplingRate = null;\n this.frameLength = 0;\n // B(20,19): MPEG Audio versionIndex ID\n this.versionIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 1, 3, 2);\n // C(18,17): Layer description\n this.layer = MpegFrameHeader.LayerDescription[_common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 1, 5, 2)];\n if (this.versionIndex > 1 && this.layer === 0) {\n this.parseAdtsHeader(buf, off); // Audio Data Transport Stream (ADTS)\n }\n else {\n this.parseMpegHeader(buf, off); // Conventional MPEG header\n }\n // D(16): Protection bit (if true 16-bit CRC follows header)\n this.isProtectedByCRC = !_common_Util_js__WEBPACK_IMPORTED_MODULE_3__.isBitSet(buf, off + 1, 7);\n }\n calcDuration(numFrames) {\n return this.samplingRate == null ? null : (numFrames * this.calcSamplesPerFrame() / this.samplingRate);\n }\n calcSamplesPerFrame() {\n return MpegFrameHeader.samplesInFrameTable[this.version === 1 ? 0 : 1][this.layer];\n }\n calculateSideInfoLength() {\n if (this.layer !== 3)\n return 2;\n if (this.channelModeIndex === 3) {\n // mono\n if (this.version === 1) {\n return 17;\n }\n if (this.version === 2 || this.version === 2.5) {\n return 9;\n }\n }\n else {\n if (this.version === 1) {\n return 32;\n }\n if (this.version === 2 || this.version === 2.5) {\n return 17;\n }\n }\n return null;\n }\n calcSlotSize() {\n return [null, 4, 1, 1][this.layer];\n }\n parseMpegHeader(buf, off) {\n this.container = 'MPEG';\n // E(15,12): Bitrate index\n this.bitrateIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 2, 0, 4);\n // F(11,10): Sampling rate frequency index\n this.sampRateFreqIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 2, 4, 2);\n // G(9): Padding bit\n this.padding = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.isBitSet(buf, off + 2, 6);\n // H(8): Private bit\n this.privateBit = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.isBitSet(buf, off + 2, 7);\n // I(7,6): Channel Mode\n this.channelModeIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 3, 0, 2);\n // J(5,4): Mode extension (Only used in Joint stereo)\n this.modeExtension = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 3, 2, 2);\n // K(3): Copyright\n this.isCopyrighted = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.isBitSet(buf, off + 3, 4);\n // L(2): Original\n this.isOriginalMedia = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.isBitSet(buf, off + 3, 5);\n // M(3): The original bit indicates, if it is set, that the frame is located on its original media.\n this.emphasis = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 3, 7, 2);\n this.version = MpegFrameHeader.VersionID[this.versionIndex];\n this.channelMode = MpegFrameHeader.ChannelMode[this.channelModeIndex];\n this.codec = `MPEG ${this.version} Layer ${this.layer}`;\n // Calculate bitrate\n const bitrateInKbps = this.calcBitrate();\n if (!bitrateInKbps) {\n throw new MpegContentError('Cannot determine bit-rate');\n }\n this.bitrate = bitrateInKbps * 1000;\n // Calculate sampling rate\n this.samplingRate = this.calcSamplingRate();\n if (this.samplingRate == null) {\n throw new MpegContentError('Cannot determine sampling-rate');\n }\n }\n parseAdtsHeader(buf, off) {\n debug(\"layer=0 => ADTS\");\n this.version = this.versionIndex === 2 ? 4 : 2;\n this.container = `ADTS/MPEG-${this.version}`;\n const profileIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 2, 0, 2);\n this.codec = 'AAC';\n this.codecProfile = MPEG4.AudioObjectTypes[profileIndex];\n debug(`MPEG-4 audio-codec=${this.codec}`);\n const samplingFrequencyIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 2, 2, 4);\n this.samplingRate = MPEG4.SamplingFrequencies[samplingFrequencyIndex];\n debug(`sampling-rate=${this.samplingRate}`);\n const channelIndex = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 2, 7, 3);\n this.mp4ChannelConfig = MPEG4_ChannelConfigurations[channelIndex];\n debug(`channel-config=${this.mp4ChannelConfig ? this.mp4ChannelConfig.join('+') : '?'}`);\n this.frameLength = _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, off + 3, 6, 2) << 11;\n }\n calcBitrate() {\n if (this.bitrateIndex === 0x00 || // free\n this.bitrateIndex === 0x0F) { // reserved\n return null;\n }\n if (this.version && this.bitrateIndex) {\n const codecIndex = 10 * Math.floor(this.version) + this.layer;\n return MpegFrameHeader.bitrate_index[this.bitrateIndex][codecIndex];\n }\n return null;\n }\n calcSamplingRate() {\n if (this.sampRateFreqIndex === 0x03 || this.version === null || this.sampRateFreqIndex == null)\n return null; // 'reserved'\n return MpegFrameHeader.sampling_rate_freq_index[this.version][this.sampRateFreqIndex];\n }\n}\nMpegFrameHeader.SyncByte1 = 0xFF;\nMpegFrameHeader.SyncByte2 = 0xE0;\nMpegFrameHeader.VersionID = [2.5, null, 2, 1];\nMpegFrameHeader.LayerDescription = [0, 3, 2, 1];\nMpegFrameHeader.ChannelMode = ['stereo', 'joint_stereo', 'dual_channel', 'mono'];\nMpegFrameHeader.bitrate_index = {\n 1: { 11: 32, 12: 32, 13: 32, 21: 32, 22: 8, 23: 8 },\n 2: { 11: 64, 12: 48, 13: 40, 21: 48, 22: 16, 23: 16 },\n 3: { 11: 96, 12: 56, 13: 48, 21: 56, 22: 24, 23: 24 },\n 4: { 11: 128, 12: 64, 13: 56, 21: 64, 22: 32, 23: 32 },\n 5: { 11: 160, 12: 80, 13: 64, 21: 80, 22: 40, 23: 40 },\n 6: { 11: 192, 12: 96, 13: 80, 21: 96, 22: 48, 23: 48 },\n 7: { 11: 224, 12: 112, 13: 96, 21: 112, 22: 56, 23: 56 },\n 8: { 11: 256, 12: 128, 13: 112, 21: 128, 22: 64, 23: 64 },\n 9: { 11: 288, 12: 160, 13: 128, 21: 144, 22: 80, 23: 80 },\n 10: { 11: 320, 12: 192, 13: 160, 21: 160, 22: 96, 23: 96 },\n 11: { 11: 352, 12: 224, 13: 192, 21: 176, 22: 112, 23: 112 },\n 12: { 11: 384, 12: 256, 13: 224, 21: 192, 22: 128, 23: 128 },\n 13: { 11: 416, 12: 320, 13: 256, 21: 224, 22: 144, 23: 144 },\n 14: { 11: 448, 12: 384, 13: 320, 21: 256, 22: 160, 23: 160 }\n};\nMpegFrameHeader.sampling_rate_freq_index = {\n 1: { 0: 44100, 1: 48000, 2: 32000 },\n 2: { 0: 22050, 1: 24000, 2: 16000 },\n 2.5: { 0: 11025, 1: 12000, 2: 8000 }\n};\nMpegFrameHeader.samplesInFrameTable = [\n /* Layer I II III */\n [0, 384, 1152, 1152], // MPEG-1\n [0, 384, 1152, 576] // MPEG-2(.5\n];\n/**\n * MPEG Audio Layer I/II/III\n */\nconst FrameHeader = {\n len: 4,\n get: (buf, off) => {\n return new MpegFrameHeader(buf, off);\n }\n};\nfunction getVbrCodecProfile(vbrScale) {\n return `V${Math.floor((100 - vbrScale) / 10)}`;\n}\nclass MpegParser extends _id3v2_AbstractID3Parser_js__WEBPACK_IMPORTED_MODULE_4__.AbstractID3Parser {\n constructor() {\n super(...arguments);\n this.frameCount = 0;\n this.syncFrameCount = -1;\n this.countSkipFrameData = 0;\n this.totalDataLength = 0;\n this.bitrates = [];\n this.offset = 0;\n this.frame_size = 0;\n this.crc = null;\n this.calculateEofDuration = false;\n this.samplesPerFrame = null;\n this.buf_frame_header = new Uint8Array(4);\n /**\n * Number of bytes already parsed since beginning of stream / file\n */\n this.mpegOffset = null;\n this.syncPeek = {\n buf: new Uint8Array(maxPeekLen),\n len: 0\n };\n }\n /**\n * Called after ID3 headers have been parsed\n */\n async postId3v2Parse() {\n this.metadata.setFormat('lossless', false);\n try {\n let quit = false;\n while (!quit) {\n await this.sync();\n quit = await this.parseCommonMpegHeader();\n }\n }\n catch (err) {\n if (err instanceof strtok3__WEBPACK_IMPORTED_MODULE_1__.EndOfStreamError) {\n debug(\"End-of-stream\");\n if (this.calculateEofDuration) {\n if (this.samplesPerFrame !== null) {\n const numberOfSamples = this.frameCount * this.samplesPerFrame;\n this.metadata.setFormat('numberOfSamples', numberOfSamples);\n if (this.metadata.format.sampleRate) {\n const duration = numberOfSamples / this.metadata.format.sampleRate;\n debug(`Calculate duration at EOF: ${duration} sec.`, duration);\n this.metadata.setFormat('duration', duration);\n }\n }\n }\n }\n else {\n throw err;\n }\n }\n }\n /**\n * Called after file has been fully parsed, this allows, if present, to exclude the ID3v1.1 header length\n */\n finalize() {\n const format = this.metadata.format;\n const hasID3v1 = !!this.metadata.native.ID3v1;\n if (this.mpegOffset !== null) {\n if (format.duration && this.tokenizer.fileInfo.size) {\n const mpegSize = this.tokenizer.fileInfo.size - this.mpegOffset - (hasID3v1 ? 128 : 0);\n if (format.codecProfile && format.codecProfile[0] === 'V') {\n this.metadata.setFormat('bitrate', mpegSize * 8 / format.duration);\n }\n }\n if (this.tokenizer.fileInfo.size && format.codecProfile === 'CBR') {\n const mpegSize = this.tokenizer.fileInfo.size - this.mpegOffset - (hasID3v1 ? 128 : 0);\n if (this.frame_size !== null && this.samplesPerFrame !== null) {\n const numberOfSamples = Math.round(mpegSize / this.frame_size) * this.samplesPerFrame;\n this.metadata.setFormat('numberOfSamples', numberOfSamples);\n if (format.sampleRate && !format.duration) {\n const duration = numberOfSamples / format.sampleRate;\n debug(\"Calculate CBR duration based on file size: %s\", duration);\n this.metadata.setFormat('duration', duration);\n }\n }\n }\n }\n }\n async sync() {\n let gotFirstSync = false;\n while (true) {\n let bo = 0;\n this.syncPeek.len = await this.tokenizer.peekBuffer(this.syncPeek.buf, { length: maxPeekLen, mayBeLess: true });\n if (this.syncPeek.len <= 163) {\n throw new strtok3__WEBPACK_IMPORTED_MODULE_1__.EndOfStreamError();\n }\n while (true) {\n if (gotFirstSync && (this.syncPeek.buf[bo] & 0xE0) === 0xE0) {\n this.buf_frame_header[0] = MpegFrameHeader.SyncByte1;\n this.buf_frame_header[1] = this.syncPeek.buf[bo];\n await this.tokenizer.ignore(bo);\n debug(`Sync at offset=${this.tokenizer.position - 1}, frameCount=${this.frameCount}`);\n if (this.syncFrameCount === this.frameCount) {\n debug(`Re-synced MPEG stream, frameCount=${this.frameCount}`);\n this.frameCount = 0;\n this.frame_size = 0;\n }\n this.syncFrameCount = this.frameCount;\n return; // sync\n }\n gotFirstSync = false;\n bo = this.syncPeek.buf.indexOf(MpegFrameHeader.SyncByte1, bo);\n if (bo === -1) {\n if (this.syncPeek.len < this.syncPeek.buf.length) {\n throw new strtok3__WEBPACK_IMPORTED_MODULE_1__.EndOfStreamError();\n }\n await this.tokenizer.ignore(this.syncPeek.len);\n break; // continue with next buffer\n }\n ++bo;\n gotFirstSync = true;\n }\n }\n }\n /**\n * Combined ADTS & MPEG (MP2 & MP3) header handling\n * @return {Promise<boolean>} true if parser should quit\n */\n async parseCommonMpegHeader() {\n if (this.frameCount === 0) {\n this.mpegOffset = this.tokenizer.position - 1;\n }\n await this.tokenizer.peekBuffer(this.buf_frame_header.subarray(1), { length: 3 });\n let header;\n try {\n header = FrameHeader.get(this.buf_frame_header, 0);\n }\n catch (err) {\n await this.tokenizer.ignore(1);\n if (err instanceof Error) {\n this.metadata.addWarning(`Parse error: ${err.message}`);\n return false; // sync\n }\n throw err;\n }\n await this.tokenizer.ignore(3);\n this.metadata.setFormat('container', header.container);\n this.metadata.setFormat('codec', header.codec);\n this.metadata.setFormat('lossless', false);\n this.metadata.setFormat('sampleRate', header.samplingRate);\n this.frameCount++;\n return header.version !== null && header.version >= 2 && header.layer === 0 ? this.parseAdts(header) : this.parseAudioFrameHeader(header);\n }\n /**\n * @return {Promise<boolean>} true if parser should quit\n */\n async parseAudioFrameHeader(header) {\n this.metadata.setFormat('numberOfChannels', header.channelMode === 'mono' ? 1 : 2);\n this.metadata.setFormat('bitrate', header.bitrate);\n if (this.frameCount < 20 * 10000) {\n debug('offset=%s MP%s bitrate=%s sample-rate=%s', this.tokenizer.position - 4, header.layer, header.bitrate, header.samplingRate);\n }\n const slot_size = header.calcSlotSize();\n if (slot_size === null) {\n throw new MpegContentError('invalid slot_size');\n }\n const samples_per_frame = header.calcSamplesPerFrame();\n debug(`samples_per_frame=${samples_per_frame}`);\n const bps = samples_per_frame / 8.0;\n if (header.bitrate !== null && header.samplingRate != null) {\n const fsize = (bps * header.bitrate / header.samplingRate) + ((header.padding) ? slot_size : 0);\n this.frame_size = Math.floor(fsize);\n }\n this.audioFrameHeader = header;\n if (header.bitrate !== null) {\n this.bitrates.push(header.bitrate);\n }\n // xtra header only exists in first frame\n if (this.frameCount === 1) {\n this.offset = FrameHeader.len;\n await this.skipSideInformation();\n return false;\n }\n if (this.frameCount === 3) {\n // the stream is CBR if the first 3 frame bitrates are the same\n if (this.areAllSame(this.bitrates)) {\n // Actual calculation will be done in finalize\n this.samplesPerFrame = samples_per_frame;\n this.metadata.setFormat('codecProfile', 'CBR');\n if (this.tokenizer.fileInfo.size)\n return true; // Will calculate duration based on the file size\n }\n else if (this.metadata.format.duration) {\n return true; // We already got the duration, stop processing MPEG stream any further\n }\n if (!this.options.duration) {\n return true; // Enforce duration not enabled, stop processing entire stream\n }\n }\n // once we know the file is VBR attach listener to end of\n // stream so we can do the duration calculation when we\n // have counted all the frames\n if (this.options.duration && this.frameCount === 4) {\n this.samplesPerFrame = samples_per_frame;\n this.calculateEofDuration = true;\n }\n this.offset = 4;\n if (header.isProtectedByCRC) {\n await this.parseCrc();\n return false;\n }\n await this.skipSideInformation();\n return false;\n }\n async parseAdts(header) {\n const buf = new Uint8Array(3);\n await this.tokenizer.readBuffer(buf);\n header.frameLength += _common_Util_js__WEBPACK_IMPORTED_MODULE_3__.getBitAllignedNumber(buf, 0, 0, 11);\n this.totalDataLength += header.frameLength;\n this.samplesPerFrame = 1024;\n if (header.samplingRate !== null) {\n const framesPerSec = header.samplingRate / this.samplesPerFrame;\n const bytesPerFrame = this.frameCount === 0 ? 0 : this.totalDataLength / this.frameCount;\n const bitrate = 8 * bytesPerFrame * framesPerSec + 0.5;\n this.metadata.setFormat('bitrate', bitrate);\n debug(`frame-count=${this.frameCount}, size=${header.frameLength} bytes, bit-rate=${bitrate}`);\n }\n await this.tokenizer.ignore(header.frameLength > 7 ? header.frameLength - 7 : 1);\n // Consume remaining header and frame data\n if (this.frameCount === 3) {\n this.metadata.setFormat('codecProfile', header.codecProfile);\n if (header.mp4ChannelConfig) {\n this.metadata.setFormat('numberOfChannels', header.mp4ChannelConfig.length);\n }\n if (this.options.duration) {\n this.calculateEofDuration = true;\n }\n else {\n return true; // Stop parsing after the third frame\n }\n }\n return false;\n }\n async parseCrc() {\n this.crc = await this.tokenizer.readNumber(token_types__WEBPACK_IMPORTED_MODULE_0__.INT16_BE);\n this.offset += 2;\n return this.skipSideInformation();\n }\n async skipSideInformation() {\n if (this.audioFrameHeader) {\n const sideinfo_length = this.audioFrameHeader.calculateSideInfoLength();\n if (sideinfo_length !== null) {\n await this.tokenizer.readToken(new token_types__WEBPACK_IMPORTED_MODULE_0__.Uint8ArrayType(sideinfo_length));\n // side information\n this.offset += sideinfo_length;\n await this.readXtraInfoHeader();\n return;\n }\n }\n }\n async readXtraInfoHeader() {\n const headerTag = await this.tokenizer.readToken(_XingTag_js__WEBPACK_IMPORTED_MODULE_5__.InfoTagHeaderTag);\n this.offset += _XingTag_js__WEBPACK_IMPORTED_MODULE_5__.InfoTagHeaderTag.len; // 12\n switch (headerTag) {\n case 'Info':\n this.metadata.setFormat('codecProfile', 'CBR');\n return this.readXingInfoHeader();\n case 'Xing': {\n const infoTag = await this.readXingInfoHeader();\n if (infoTag.vbrScale !== null) {\n const codecProfile = getVbrCodecProfile(infoTag.vbrScale);\n this.metadata.setFormat('codecProfile', codecProfile);\n }\n return null;\n }\n case 'Xtra':\n // ToDo: ???\n break;\n case 'LAME': {\n const version = await this.tokenizer.readToken(_XingTag_js__WEBPACK_IMPORTED_MODULE_5__.LameEncoderVersion);\n if (this.frame_size !== null && this.frame_size >= this.offset + _XingTag_js__WEBPACK_IMPORTED_MODULE_5__.LameEncoderVersion.len) {\n this.offset += _XingTag_js__WEBPACK_IMPORTED_MODULE_5__.LameEncoderVersion.len;\n this.metadata.setFormat('tool', `LAME ${version}`);\n await this.skipFrameData(this.frame_size - this.offset);\n return null;\n }\n this.metadata.addWarning('Corrupt LAME header');\n break;\n }\n // ToDo: ???\n }\n // ToDo: promise duration???\n const frameDataLeft = this.frame_size - this.offset;\n if (frameDataLeft < 0) {\n this.metadata.addWarning(`Frame ${this.frameCount}corrupt: negative frameDataLeft`);\n }\n else {\n await this.skipFrameData(frameDataLeft);\n }\n return null;\n }\n /**\n * Ref: http://gabriel.mp3-tech.org/mp3infotag.html\n * @returns {Promise<string>}\n */\n async readXingInfoHeader() {\n const offset = this.tokenizer.position;\n const infoTag = await (0,_XingTag_js__WEBPACK_IMPORTED_MODULE_5__.readXingHeader)(this.tokenizer);\n this.offset += this.tokenizer.position - offset;\n if (infoTag.lame) {\n this.metadata.setFormat('tool', `LAME ${_common_Util_js__WEBPACK_IMPORTED_MODULE_3__.stripNulls(infoTag.lame.version)}`);\n if (infoTag.lame.extended) {\n // this.metadata.setFormat('trackGain', infoTag.lame.extended.track_gain);\n this.metadata.setFormat('trackPeakLevel', infoTag.lame.extended.track_peak);\n if (infoTag.lame.extended.track_gain) {\n this.metadata.setFormat('trackGain', infoTag.lame.extended.track_gain.adjustment);\n }\n if (infoTag.lame.extended.album_gain) {\n this.metadata.setFormat('albumGain', infoTag.lame.extended.album_gain.adjustment);\n }\n this.metadata.setFormat('duration', infoTag.lame.extended.music_length / 1000);\n }\n }\n if (infoTag.streamSize && this.audioFrameHeader && infoTag.numFrames !== null) {\n const duration = this.audioFrameHeader.calcDuration(infoTag.numFrames);\n this.metadata.setFormat('duration', duration);\n debug('Get duration from Xing header: %s', this.metadata.format.duration);\n return infoTag;\n }\n // frames field is not present\n const frameDataLeft = this.frame_size - this.offset;\n await this.skipFrameData(frameDataLeft);\n return infoTag;\n }\n async skipFrameData(frameDataLeft) {\n if (frameDataLeft < 0)\n throw new MpegContentError('frame-data-left cannot be negative');\n await this.tokenizer.ignore(frameDataLeft);\n this.countSkipFrameData += frameDataLeft;\n }\n areAllSame(array) {\n const first = array[0];\n return array.every(element => {\n return element === first;\n });\n }\n}\n//# sourceMappingURL=MpegParser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mpeg/MpegParser.js?");
|
30
|
+
|
31
|
+
/***/ }),
|
32
|
+
|
33
|
+
/***/ "../../node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js":
|
34
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
35
|
+
|
36
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ReplayGain: () => (/* binding */ ReplayGain)\n/* harmony export */ });\n/* harmony import */ var _common_Util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/Util.js\");\n\n/**\n * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format#name-code\n */\nvar NameCode;\n(function (NameCode) {\n /**\n * not set\n */\n NameCode[NameCode[\"not_set\"] = 0] = \"not_set\";\n /**\n * Radio Gain Adjustment\n */\n NameCode[NameCode[\"radio\"] = 1] = \"radio\";\n /**\n * Audiophile Gain Adjustment\n */\n NameCode[NameCode[\"audiophile\"] = 2] = \"audiophile\";\n})(NameCode || (NameCode = {}));\n/**\n * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format#originator-code\n */\nvar ReplayGainOriginator;\n(function (ReplayGainOriginator) {\n /**\n * Replay Gain unspecified\n */\n ReplayGainOriginator[ReplayGainOriginator[\"unspecified\"] = 0] = \"unspecified\";\n /**\n * Replay Gain pre-set by artist/producer/mastering engineer\n */\n ReplayGainOriginator[ReplayGainOriginator[\"engineer\"] = 1] = \"engineer\";\n /**\n * Replay Gain set by user\n */\n ReplayGainOriginator[ReplayGainOriginator[\"user\"] = 2] = \"user\";\n /**\n * Replay Gain determined automatically, as described on this site\n */\n ReplayGainOriginator[ReplayGainOriginator[\"automatic\"] = 3] = \"automatic\";\n /**\n * Set by simple RMS average\n */\n ReplayGainOriginator[ReplayGainOriginator[\"rms_average\"] = 4] = \"rms_average\";\n})(ReplayGainOriginator || (ReplayGainOriginator = {}));\n/**\n * Replay Gain Data Format\n *\n * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format\n */\nconst ReplayGain = {\n len: 2,\n get: (buf, off) => {\n const gain_type = _common_Util_js__WEBPACK_IMPORTED_MODULE_0__.getBitAllignedNumber(buf, off, 0, 3);\n const sign = _common_Util_js__WEBPACK_IMPORTED_MODULE_0__.getBitAllignedNumber(buf, off, 6, 1);\n const gain_adj = _common_Util_js__WEBPACK_IMPORTED_MODULE_0__.getBitAllignedNumber(buf, off, 7, 9) / 10.0;\n if (gain_type > 0) {\n return {\n type: _common_Util_js__WEBPACK_IMPORTED_MODULE_0__.getBitAllignedNumber(buf, off, 0, 3),\n origin: _common_Util_js__WEBPACK_IMPORTED_MODULE_0__.getBitAllignedNumber(buf, off, 3, 3),\n adjustment: (sign ? -gain_adj : gain_adj)\n };\n }\n return undefined;\n }\n};\n//# sourceMappingURL=ReplayGainDataFormat.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js?");
|
37
|
+
|
38
|
+
/***/ }),
|
39
|
+
|
40
|
+
/***/ "../../node_modules/music-metadata/lib/mpeg/XingTag.js":
|
41
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
42
|
+
|
43
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InfoTagHeaderTag: () => (/* binding */ InfoTagHeaderTag),\n/* harmony export */ LameEncoderVersion: () => (/* binding */ LameEncoderVersion),\n/* harmony export */ XingHeaderFlags: () => (/* binding */ XingHeaderFlags),\n/* harmony export */ readXingHeader: () => (/* binding */ readXingHeader)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var _common_Util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/Util.js\");\n/* harmony import */ var _ExtendedLameHeader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/mpeg/ExtendedLameHeader.js\");\n\n\n\n/**\n * Info Tag: Xing, LAME\n */\nconst InfoTagHeaderTag = new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(4, 'ascii');\n/**\n * LAME TAG value\n * Did not find any official documentation for this\n * Value e.g.: \"3.98.4\"\n */\nconst LameEncoderVersion = new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(6, 'ascii');\n/**\n * Info Tag\n * Ref: http://gabriel.mp3-tech.org/mp3infotag.html\n */\nconst XingHeaderFlags = {\n len: 4,\n get: (buf, off) => {\n return {\n frames: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off, 31),\n bytes: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off, 30),\n toc: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off, 29),\n vbrScale: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off, 28)\n };\n }\n};\n// /**\n// * XING Header Tag\n// * Ref: http://gabriel.mp3-tech.org/mp3infotag.html\n// */\nasync function readXingHeader(tokenizer) {\n const flags = await tokenizer.readToken(XingHeaderFlags);\n const xingInfoTag = { numFrames: null, streamSize: null, vbrScale: null };\n if (flags.frames) {\n xingInfoTag.numFrames = await tokenizer.readToken(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE);\n }\n if (flags.bytes) {\n xingInfoTag.streamSize = await tokenizer.readToken(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE);\n }\n if (flags.toc) {\n xingInfoTag.toc = new Uint8Array(100);\n await tokenizer.readBuffer(xingInfoTag.toc);\n }\n if (flags.vbrScale) {\n xingInfoTag.vbrScale = await tokenizer.readToken(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_BE);\n }\n const lameTag = await tokenizer.peekToken(new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(4, 'ascii'));\n if (lameTag === 'LAME') {\n await tokenizer.ignore(4);\n xingInfoTag.lame = {\n version: await tokenizer.readToken(new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(5, 'ascii'))\n };\n const match = xingInfoTag.lame.version.match(/\\d+.\\d+/g);\n if (match !== null) {\n const majorMinorVersion = match[0]; // e.g. 3.97\n const version = majorMinorVersion.split('.').map(n => Number.parseInt(n, 10));\n if (version[0] >= 3 && version[1] >= 90) {\n xingInfoTag.lame.extended = await tokenizer.readToken(_ExtendedLameHeader_js__WEBPACK_IMPORTED_MODULE_2__.ExtendedLameHeader);\n }\n }\n }\n return xingInfoTag;\n}\n//# sourceMappingURL=XingTag.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/mpeg/XingTag.js?");
|
44
|
+
|
45
|
+
/***/ })
|
46
|
+
|
47
|
+
}]);
|
package/dist/vendors-node_modules_music-metadata_lib_musepack_MusepackParser_js.main-bundle.js
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
4
|
+
* This devtool is neither made for production nor for readable output files.
|
5
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
6
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
7
|
+
* or disable the default devtool with "devtool: false".
|
8
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
9
|
+
*/
|
10
|
+
(this["webpackChunkExamBundle"] = this["webpackChunkExamBundle"] || []).push([["vendors-node_modules_music-metadata_lib_musepack_MusepackParser_js"],{
|
11
|
+
|
12
|
+
/***/ "../../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js":
|
13
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
14
|
+
|
15
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbstractID3Parser: () => (/* binding */ AbstractID3Parser)\n/* harmony export */ });\n/* harmony import */ var strtok3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/strtok3/lib/core.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _ID3v2Token_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v2/ID3v2Token.js\");\n/* harmony import */ var _ID3v2Parser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v2/ID3v2Parser.js\");\n/* harmony import */ var _id3v1_ID3v1Parser_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v1/ID3v1Parser.js\");\n/* harmony import */ var _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/BasicParser.js\");\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_1__('music-metadata:parser:ID3');\n/**\n * Abstract parser which tries take ID3v2 and ID3v1 headers.\n */\nclass AbstractID3Parser extends _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_5__.BasicParser {\n constructor() {\n super(...arguments);\n this.id3parser = new _ID3v2Parser_js__WEBPACK_IMPORTED_MODULE_3__.ID3v2Parser();\n }\n static async startsWithID3v2Header(tokenizer) {\n return (await tokenizer.peekToken(_ID3v2Token_js__WEBPACK_IMPORTED_MODULE_2__.ID3v2Header)).fileIdentifier === 'ID3';\n }\n async parse() {\n try {\n await this.parseID3v2();\n }\n catch (err) {\n if (err instanceof strtok3__WEBPACK_IMPORTED_MODULE_0__.EndOfStreamError) {\n debug(\"End-of-stream\");\n }\n else {\n throw err;\n }\n }\n }\n finalize() {\n return;\n }\n async parseID3v2() {\n await this.tryReadId3v2Headers();\n debug('End of ID3v2 header, go to MPEG-parser: pos=%s', this.tokenizer.position);\n await this.postId3v2Parse();\n if (this.options.skipPostHeaders && this.metadata.hasAny()) {\n this.finalize();\n }\n else {\n const id3v1parser = new _id3v1_ID3v1Parser_js__WEBPACK_IMPORTED_MODULE_4__.ID3v1Parser(this.metadata, this.tokenizer, this.options);\n await id3v1parser.parse();\n this.finalize();\n }\n }\n async tryReadId3v2Headers() {\n const id3Header = await this.tokenizer.peekToken(_ID3v2Token_js__WEBPACK_IMPORTED_MODULE_2__.ID3v2Header);\n if (id3Header.fileIdentifier === 'ID3') {\n debug('Found ID3v2 header, pos=%s', this.tokenizer.position);\n await this.id3parser.parse(this.metadata, this.tokenizer, this.options);\n return this.tryReadId3v2Headers();\n }\n }\n}\n//# sourceMappingURL=AbstractID3Parser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js?");
|
16
|
+
|
17
|
+
/***/ }),
|
18
|
+
|
19
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/MusepackConentError.js":
|
20
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
21
|
+
|
22
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MusepackContentError: () => (/* binding */ MusepackContentError)\n/* harmony export */ });\n/* harmony import */ var _ParseError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/music-metadata/lib/ParseError.js\");\n\nclass MusepackContentError extends (0,_ParseError_js__WEBPACK_IMPORTED_MODULE_0__.makeUnexpectedFileContentError)('Musepack') {\n}\n//# sourceMappingURL=MusepackConentError.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/MusepackConentError.js?");
|
23
|
+
|
24
|
+
/***/ }),
|
25
|
+
|
26
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/MusepackParser.js":
|
27
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
28
|
+
|
29
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MusepackParser: () => (/* binding */ MusepackParser)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var _id3v2_AbstractID3Parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js\");\n/* harmony import */ var _sv8_MpcSv8Parser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js\");\n/* harmony import */ var _sv7_MpcSv7Parser_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js\");\n/* harmony import */ var _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/MusepackConentError.js\");\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('music-metadata:parser:musepack');\nclass MusepackParser extends _id3v2_AbstractID3Parser_js__WEBPACK_IMPORTED_MODULE_2__.AbstractID3Parser {\n async postId3v2Parse() {\n const signature = await this.tokenizer.peekToken(new token_types__WEBPACK_IMPORTED_MODULE_1__.StringType(3, 'latin1'));\n let mpcParser;\n switch (signature) {\n case 'MP+': {\n debug('Stream-version 7');\n mpcParser = new _sv7_MpcSv7Parser_js__WEBPACK_IMPORTED_MODULE_4__.MpcSv7Parser(this.metadata, this.tokenizer, this.options);\n break;\n }\n case 'MPC': {\n debug('Stream-version 8');\n mpcParser = new _sv8_MpcSv8Parser_js__WEBPACK_IMPORTED_MODULE_3__.MpcSv8Parser(this.metadata, this.tokenizer, this.options);\n break;\n }\n default: {\n throw new _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__.MusepackContentError('Invalid signature prefix');\n }\n }\n return mpcParser.parse();\n }\n}\n//# sourceMappingURL=MusepackParser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/MusepackParser.js?");
|
30
|
+
|
31
|
+
/***/ }),
|
32
|
+
|
33
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/sv7/BitReader.js":
|
34
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
35
|
+
|
36
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BitReader: () => (/* binding */ BitReader)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n\nclass BitReader {\n constructor(tokenizer) {\n this.tokenizer = tokenizer;\n this.pos = 0;\n this.dword = null;\n }\n /**\n *\n * @param bits 1..30 bits\n */\n async read(bits) {\n while (this.dword === null) {\n this.dword = await this.tokenizer.readToken(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_LE);\n }\n let out = this.dword;\n this.pos += bits;\n if (this.pos < 32) {\n out >>>= (32 - this.pos);\n return out & ((1 << bits) - 1);\n }\n this.pos -= 32;\n if (this.pos === 0) {\n this.dword = null;\n return out & ((1 << bits) - 1);\n }\n this.dword = await this.tokenizer.readToken(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_LE);\n if (this.pos) {\n out <<= this.pos;\n out |= this.dword >>> (32 - this.pos);\n }\n return out & ((1 << bits) - 1);\n }\n async ignore(bits) {\n if (this.pos > 0) {\n const remaining = 32 - this.pos;\n this.dword = null;\n bits -= remaining;\n this.pos = 0;\n }\n const remainder = bits % 32;\n const numOfWords = (bits - remainder) / 32;\n await this.tokenizer.ignore(numOfWords * 4);\n return this.read(remainder);\n }\n}\n//# sourceMappingURL=BitReader.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/sv7/BitReader.js?");
|
37
|
+
|
38
|
+
/***/ }),
|
39
|
+
|
40
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js":
|
41
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
42
|
+
|
43
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MpcSv7Parser: () => (/* binding */ MpcSv7Parser)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/BasicParser.js\");\n/* harmony import */ var _apev2_APEv2Parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/apev2/APEv2Parser.js\");\n/* harmony import */ var _BitReader_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/sv7/BitReader.js\");\n/* harmony import */ var _StreamVersion7_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js\");\n/* harmony import */ var _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/MusepackConentError.js\");\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('music-metadata:parser:musepack');\nclass MpcSv7Parser extends _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_1__.BasicParser {\n constructor() {\n super(...arguments);\n this.bitreader = null;\n this.audioLength = 0;\n this.duration = null;\n }\n async parse() {\n const header = await this.tokenizer.readToken(_StreamVersion7_js__WEBPACK_IMPORTED_MODULE_4__.Header);\n if (header.signature !== 'MP+')\n throw new _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__.MusepackContentError('Unexpected magic number');\n debug(`stream-version=${header.streamMajorVersion}.${header.streamMinorVersion}`);\n this.metadata.setFormat('container', 'Musepack, SV7');\n this.metadata.setFormat('sampleRate', header.sampleFrequency);\n const numberOfSamples = 1152 * (header.frameCount - 1) + header.lastFrameLength;\n this.metadata.setFormat('numberOfSamples', numberOfSamples);\n this.duration = numberOfSamples / header.sampleFrequency;\n this.metadata.setFormat('duration', this.duration);\n this.bitreader = new _BitReader_js__WEBPACK_IMPORTED_MODULE_3__.BitReader(this.tokenizer);\n this.metadata.setFormat('numberOfChannels', header.midSideStereo || header.intensityStereo ? 2 : 1);\n const version = await this.bitreader.read(8);\n this.metadata.setFormat('codec', (version / 100).toFixed(2));\n await this.skipAudioData(header.frameCount);\n debug(`End of audio stream, switching to APEv2, offset=${this.tokenizer.position}`);\n return _apev2_APEv2Parser_js__WEBPACK_IMPORTED_MODULE_2__.APEv2Parser.tryParseApeHeader(this.metadata, this.tokenizer, this.options);\n }\n async skipAudioData(frameCount) {\n while (frameCount-- > 0) {\n const frameLength = await this.bitreader.read(20);\n this.audioLength += 20 + frameLength;\n await this.bitreader.ignore(frameLength);\n }\n // last frame\n const lastFrameLength = await this.bitreader.read(11);\n this.audioLength += lastFrameLength;\n if (this.duration !== null) {\n this.metadata.setFormat('bitrate', this.audioLength / this.duration);\n }\n }\n}\n//# sourceMappingURL=MpcSv7Parser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js?");
|
44
|
+
|
45
|
+
/***/ }),
|
46
|
+
|
47
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js":
|
48
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
49
|
+
|
50
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Header: () => (/* binding */ Header)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var _common_Util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/Util.js\");\n\n\n/**\n * BASIC STRUCTURE\n */\nconst Header = {\n len: 6 * 4,\n get: (buf, off) => {\n const header = {\n // word 0\n signature: new TextDecoder('latin1').decode(buf.subarray(off, off + 3)),\n // versionIndex number * 1000 (3.81 = 3810) (remember that 4-byte alignment causes this to take 4-bytes)\n streamMinorVersion: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off + 3, 0, 4),\n streamMajorVersion: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off + 3, 4, 4),\n // word 1\n frameCount: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_LE.get(buf, off + 4),\n // word 2\n maxLevel: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_LE.get(buf, off + 8),\n sampleFrequency: [44100, 48000, 37800, 32000][_common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off + 10, 0, 2)],\n link: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off + 10, 2, 2),\n profile: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off + 10, 4, 4),\n maxBand: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.getBitAllignedNumber(buf, off + 11, 0, 6),\n intensityStereo: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off + 11, 6),\n midSideStereo: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off + 11, 7),\n // word 3\n titlePeak: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_LE.get(buf, off + 12),\n titleGain: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_LE.get(buf, off + 14),\n // word 4\n albumPeak: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_LE.get(buf, off + 16),\n albumGain: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT16_LE.get(buf, off + 18),\n // word\n lastFrameLength: (token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_LE.get(buf, off + 20) >>> 20) & 0x7FF,\n trueGapless: _common_Util_js__WEBPACK_IMPORTED_MODULE_1__.isBitSet(buf, off + 23, 0)\n };\n header.lastFrameLength = header.trueGapless ? (token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_LE.get(buf, 20) >>> 20) & 0x7FF : 0;\n return header;\n }\n};\n//# sourceMappingURL=StreamVersion7.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js?");
|
51
|
+
|
52
|
+
/***/ }),
|
53
|
+
|
54
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js":
|
55
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
56
|
+
|
57
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MpcSv8Parser: () => (/* binding */ MpcSv8Parser)\n/* harmony export */ });\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/BasicParser.js\");\n/* harmony import */ var _apev2_APEv2Parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/apev2/APEv2Parser.js\");\n/* harmony import */ var _common_FourCC_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/FourCC.js\");\n/* harmony import */ var _StreamVersion8_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js\");\n/* harmony import */ var _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(\"../../node_modules/music-metadata/lib/musepack/MusepackConentError.js\");\n\n\n\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_0__('music-metadata:parser:musepack');\nclass MpcSv8Parser extends _common_BasicParser_js__WEBPACK_IMPORTED_MODULE_1__.BasicParser {\n constructor() {\n super(...arguments);\n this.audioLength = 0;\n }\n async parse() {\n const signature = await this.tokenizer.readToken(_common_FourCC_js__WEBPACK_IMPORTED_MODULE_3__.FourCcToken);\n if (signature !== 'MPCK')\n throw new _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__.MusepackContentError('Invalid Magic number');\n this.metadata.setFormat('container', 'Musepack, SV8');\n return this.parsePacket();\n }\n async parsePacket() {\n const sv8reader = new _StreamVersion8_js__WEBPACK_IMPORTED_MODULE_4__.StreamReader(this.tokenizer);\n do {\n const header = await sv8reader.readPacketHeader();\n debug(`packet-header key=${header.key}, payloadLength=${header.payloadLength}`);\n switch (header.key) {\n case 'SH': { // Stream Header\n const sh = await sv8reader.readStreamHeader(header.payloadLength);\n this.metadata.setFormat('numberOfSamples', sh.sampleCount);\n this.metadata.setFormat('sampleRate', sh.sampleFrequency);\n this.metadata.setFormat('duration', sh.sampleCount / sh.sampleFrequency);\n this.metadata.setFormat('numberOfChannels', sh.channelCount);\n break;\n }\n case 'AP': // Audio Packet\n this.audioLength += header.payloadLength;\n await this.tokenizer.ignore(header.payloadLength);\n break;\n case 'RG': // Replaygain\n case 'EI': // Encoder Info\n case 'SO': // Seek Table Offset\n case 'ST': // Seek Table\n case 'CT': // Chapter-Tag\n await this.tokenizer.ignore(header.payloadLength);\n break;\n case 'SE': // Stream End\n if (this.metadata.format.duration) {\n this.metadata.setFormat('bitrate', this.audioLength * 8 / this.metadata.format.duration);\n }\n return _apev2_APEv2Parser_js__WEBPACK_IMPORTED_MODULE_2__.APEv2Parser.tryParseApeHeader(this.metadata, this.tokenizer, this.options);\n default:\n throw new _MusepackConentError_js__WEBPACK_IMPORTED_MODULE_5__.MusepackContentError(`Unexpected header: ${header.key}`);\n }\n } while (true);\n }\n}\n//# sourceMappingURL=MpcSv8Parser.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js?");
|
58
|
+
|
59
|
+
/***/ }),
|
60
|
+
|
61
|
+
/***/ "../../node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js":
|
62
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
63
|
+
|
64
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StreamReader: () => (/* binding */ StreamReader)\n/* harmony export */ });\n/* harmony import */ var token_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(\"../../node_modules/token-types/lib/index.js\");\n/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(\"../../node_modules/debug/src/browser.js\");\n/* harmony import */ var _common_Util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(\"../../node_modules/music-metadata/lib/common/Util.js\");\n\n\n\nconst debug = debug__WEBPACK_IMPORTED_MODULE_1__('music-metadata:parser:musepack:sv8');\nconst PacketKey = new token_types__WEBPACK_IMPORTED_MODULE_0__.StringType(2, 'latin1');\n/**\n * Stream Header Packet part 1\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */\nconst SH_part1 = {\n len: 5,\n get: (buf, off) => {\n return {\n crc: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT32_LE.get(buf, off),\n streamVersion: token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8.get(buf, off + 4)\n };\n }\n};\n/**\n * Stream Header Packet part 3\n * Ref: http://trac.musepack.net/musepack/wiki/SV8Specification#StreamHeaderPacket\n */\nconst SH_part3 = {\n len: 2,\n get: (buf, off) => {\n return {\n sampleFrequency: [44100, 48000, 37800, 32000][_common_Util_js__WEBPACK_IMPORTED_MODULE_2__.getBitAllignedNumber(buf, off, 0, 3)],\n maxUsedBands: _common_Util_js__WEBPACK_IMPORTED_MODULE_2__.getBitAllignedNumber(buf, off, 3, 5),\n channelCount: _common_Util_js__WEBPACK_IMPORTED_MODULE_2__.getBitAllignedNumber(buf, off + 1, 0, 4) + 1,\n msUsed: _common_Util_js__WEBPACK_IMPORTED_MODULE_2__.isBitSet(buf, off + 1, 4),\n audioBlockFrames: _common_Util_js__WEBPACK_IMPORTED_MODULE_2__.getBitAllignedNumber(buf, off + 1, 5, 3)\n };\n }\n};\nclass StreamReader {\n constructor(tokenizer) {\n this.tokenizer = tokenizer;\n }\n async readPacketHeader() {\n const key = await this.tokenizer.readToken(PacketKey);\n const size = await this.readVariableSizeField();\n return {\n key,\n payloadLength: size.value - 2 - size.len\n };\n }\n async readStreamHeader(size) {\n const streamHeader = {};\n debug(`Reading SH at offset=${this.tokenizer.position}`);\n const part1 = await this.tokenizer.readToken(SH_part1);\n size -= SH_part1.len;\n Object.assign(streamHeader, part1);\n debug(`SH.streamVersion = ${part1.streamVersion}`);\n const sampleCount = await this.readVariableSizeField();\n size -= sampleCount.len;\n streamHeader.sampleCount = sampleCount.value;\n const bs = await this.readVariableSizeField();\n size -= bs.len;\n streamHeader.beginningOfSilence = bs.value;\n const part3 = await this.tokenizer.readToken(SH_part3);\n size -= SH_part3.len;\n Object.assign(streamHeader, part3);\n // assert.equal(size, 0);\n await this.tokenizer.ignore(size);\n return streamHeader;\n }\n async readVariableSizeField(len = 1, hb = 0) {\n let n = await this.tokenizer.readNumber(token_types__WEBPACK_IMPORTED_MODULE_0__.UINT8);\n if ((n & 0x80) === 0) {\n return { len, value: hb + n };\n }\n n &= 0x7F;\n n += hb;\n return this.readVariableSizeField(len + 1, n << 7);\n }\n}\n//# sourceMappingURL=StreamVersion8.js.map\n\n//# sourceURL=webpack://ExamBundle/../../node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js?");
|
65
|
+
|
66
|
+
/***/ })
|
67
|
+
|
68
|
+
}]);
|