@openclaw/matrix 2026.11.7 → 2026.11.10-beta.2
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/.setup/{account-config-CRsKoMqJ.mjs → account-config-CVM2a28p.mjs} +1 -2
- package/dist/.setup/{account-selection-UUPhMBmu.mjs → account-selection-Cow3TMFO.mjs} +5 -8
- package/dist/.setup/{approval-handler.runtime-LBvkygUK.mjs → approval-handler.runtime-KhjfA3Qm.mjs} +8 -9
- package/dist/.setup/{approval-reactions-BazmsDbe.mjs → approval-reactions-Bz_8XB01.mjs} +2 -3
- package/dist/.setup/{backup-health-Dm_YMVFT.mjs → backup-health-BxH69np2.mjs} +1 -2
- package/dist/.setup/{channel-CHryi9FS.mjs → channel-DkjJIQBk.mjs} +30 -40
- package/dist/.setup/{channel.runtime-DluXWaGb.mjs → channel.runtime-DOjRmnx0.mjs} +10 -12
- package/dist/.setup/{channel.setup-BDbs0FLq.mjs → channel.setup-tIeMccfh.mjs} +9 -7
- package/dist/.setup/{cli-C7Jmy2x4.mjs → cli-CChA7Tf5.mjs} +23 -31
- package/dist/.setup/{cli-doctor-BVstkgJE.mjs → cli-doctor-CoRX0erj.mjs} +3 -4
- package/dist/.setup/{cli-metadata-B0GHIn05.mjs → cli-metadata-FwlOHfdX.mjs} +3 -5
- package/dist/.setup/{client-Bk_tBqNp.mjs → client-BVgnwwz0.mjs} +21 -26
- package/dist/.setup/{client-mFRVrUt3.mjs → client-BgOKS4W7.mjs} +4 -5
- package/dist/.setup/{client-bootstrap-Bhhri97J.mjs → client-bootstrap-CHs5OQ1Z.mjs} +2 -3
- package/dist/.setup/{client-support-B_Mp4Qk9.mjs → client-support-CqXAOZp3.mjs} +2 -3
- package/dist/.setup/{config-paths-CnREYb1Y.mjs → config-paths-DBpHxDyc.mjs} +1 -2
- package/dist/.setup/{create-client-CzUtZgYF.mjs → create-client-mnjEWdZV.mjs} +8 -9
- package/dist/.setup/{credentials-kT20jk_u.mjs → credentials-CGgWuhFV.mjs} +5 -6
- package/dist/.setup/{credentials-read-CM6wXUjL.mjs → credentials-read-rPqEpuxv.mjs} +5 -6
- package/dist/.setup/{credentials-state-B3cuUFwZ.mjs → credentials-state-jxq29yQw.mjs} +1 -2
- package/dist/.setup/{crypto-node.runtime-6Aj_ltHQ.mjs → crypto-node.runtime-E_hqXGxm.mjs} +1 -2
- package/dist/.setup/{crypto-runtime-BI9Pc344.mjs → crypto-runtime-tZ95jwNO.mjs} +10 -15
- package/dist/.setup/{crypto-state-store-BZLlwkv_.mjs → crypto-state-store-CzAmeC_Z.mjs} +4 -4
- package/dist/.setup/{crypto-store-ownership-CiQ1l_O7.mjs → crypto-store-ownership-DPO9WcVz.mjs} +3 -4
- package/dist/.setup/{crypto-unsafe-state-doctor-CmF1X1dZ.mjs → crypto-unsafe-state-doctor-D3WLE-t4.mjs} +6 -7
- package/dist/.setup/{deps-D-W_QQjz.mjs → deps-CVPT2Ros.mjs} +1 -2
- package/dist/.setup/{device-health-Ck2YpEVN.mjs → device-health-D7n-lPeb.mjs} +2 -3
- package/dist/.setup/{direct-management-Dp1giZ34.mjs → direct-management-D59C1WO-.mjs} +7 -11
- package/dist/.setup/{directory-live-DmkH9hcp.mjs → directory-live-CQNKUJJx.mjs} +5 -6
- package/dist/.setup/{doctor-contract-BANpMUbP.mjs → doctor-contract-GiXgCj7k.mjs} +2 -3
- package/dist/.setup/{draft-stream-bVedfEB3.mjs → draft-stream-B1hQ9Mgx.mjs} +3 -4
- package/dist/.setup/{encryption-guidance-Br3Lv9Hm.mjs → encryption-guidance-DfbEaKct.mjs} +3 -4
- package/dist/.setup/{env-vars-aEBngJPa.mjs → env-vars-Bh1iOXJ1.mjs} +1 -2
- package/dist/.setup/{errors-Bw4EHwKX.mjs → errors-CL3YJV8U.mjs} +1 -2
- package/dist/.setup/{event-helpers-CxNgMQqH.mjs → event-helpers-DDUjVVf7.mjs} +1 -2
- package/dist/.setup/{exec-approvals-BeYF9-3o.mjs → exec-approvals-C692_FeS.mjs} +6 -9
- package/dist/.setup/{file-sync-store-BpS12yaK.mjs → file-sync-store-CAhnwOPA.mjs} +6 -36
- package/dist/.setup/{http-client-B_ohXrBm.mjs → http-client-CqnKFKUH.mjs} +5 -8
- package/dist/.setup/{idb-persistence-BTOsltD9.mjs → idb-persistence-DeGUs--C.mjs} +6 -7
- package/dist/.setup/{idb-persistence-lock-Bh3ZLIsE.mjs → idb-persistence-lock-CH2K6d_3.mjs} +1 -2
- package/dist/.setup/{joined-room-encryption-C0gHa2DG.mjs → joined-room-encryption-9sJK1kM-.mjs} +2 -3
- package/dist/.setup/{logger-CuAzdD8Q.mjs → logger-B9TwnY6C.mjs} +2 -3
- package/dist/.setup/{logging-CoaEyRtA.mjs → logging-Bnsn7s4r.mjs} +3 -4
- package/dist/.setup/{messages-BqVczVlt.mjs → messages-DSS3EtqP.mjs} +9 -14
- package/dist/.setup/{monitor-BsSo3tCv.mjs → monitor-Ci1BOpAp.mjs} +94 -136
- package/dist/.setup/{onboarding-CoMpgTiK.mjs → onboarding-DA5lN0I1.mjs} +10 -11
- package/dist/.setup/{outbound-ntm0KOfK.mjs → outbound-CFFxi_uJ.mjs} +5 -6
- package/dist/.setup/{profile-update-gC436enW.mjs → profile-update-DP-a-BxL.mjs} +7 -9
- package/dist/.setup/{reaction-events-DTThoaJQ.mjs → reaction-events-B8JhmXYM.mjs} +8 -9
- package/dist/.setup/{resolve-targets-CWW9zTYp.mjs → resolve-targets-B3NLls5a.mjs} +4 -5
- package/dist/.setup/{retired-state-JGUEBE72.mjs → retired-state-BsxdpJNk.mjs} +3 -41
- package/dist/.setup/{room-info-CM3MKoh4.mjs → room-info-gld8p2j7.mjs} +6 -8
- package/dist/.setup/{runtime-1kn1P6io.mjs → runtime-Ck8TjD7L.mjs} +1 -2
- package/dist/.setup/{runtime-doctor-migrations-hxP-CXX7.mjs → runtime-doctor-migrations-CSvRANPN.mjs} +5 -10
- package/dist/.setup/{runtime-setter-api-i2MOXoT3.mjs → runtime-setter-api-CpwhcBQK.mjs} +1 -1
- package/dist/.setup/{sdk-ByFgA6Il.mjs → sdk-Bzp2OIxv.mjs} +33 -48
- package/dist/.setup/{secret-contract-DxyzKSzf.mjs → secret-contract-AKnr45nw.mjs} +2 -3
- package/dist/.setup/{secret-contract-api-Dukgvike.mjs → secret-contract-api-DMSwMIxd.mjs} +1 -1
- package/dist/.setup/{send-DFB7JGg2.mjs → send-COg4UAcR.mjs} +58 -44
- package/dist/.setup/{send-currentness-DGxiiBn9.mjs → send-currentness-D1x6YP9O.mjs} +2 -4
- package/dist/.setup/{setup-bootstrap-razh2kSp.mjs → setup-bootstrap-DCCxNvFW.mjs} +4 -5
- package/dist/.setup/{setup-core-BVbxltMM.mjs → setup-core-BRD4PRVa.mjs} +13 -20
- package/dist/.setup/setup-plugin-api-YtkxNQTz.mjs +2 -0
- package/dist/.setup/sqlite-state-D6Zpz1q1.mjs +36 -0
- package/dist/.setup/{startup-verification-UkaoSldm.mjs → startup-verification-DfOuAruK.mjs} +5 -5
- package/dist/.setup/{state-layout-walk-BQMgMykU.mjs → state-layout-walk-BqCZTHpp.mjs} +2 -3
- package/dist/.setup/{storage-C3N6YZIn.mjs → storage-CCarF_gm.mjs} +9 -10
- package/dist/.setup/{storage-paths-B51JM-pC.mjs → storage-paths-e_Vq6cvw.mjs} +1 -2
- package/dist/.setup/{subagent-hooks-CfGAysJi.mjs → subagent-hooks-BdbuojSv.mjs} +2 -3
- package/dist/.setup/{sync-cache-state-BKVaKRzQ.mjs → sync-cache-state-BMvqW4Ii.mjs} +5 -5
- package/dist/.setup/{sync-state-CWbp0QSY.mjs → sync-state-Cu1nagBV.mjs} +1 -2
- package/dist/.setup/{target-ids-HhcaKX1n.mjs → target-ids-DltG_ZHJ.mjs} +1 -2
- package/dist/.setup/{task-runner-DY3aKiQa.mjs → task-runner-CYyGHdNW.mjs} +1 -2
- package/dist/.setup/{thread-binding-api-BvuaKpd0.mjs → thread-binding-api-OtSciHmZ.mjs} +2 -3
- package/dist/.setup/{thread-bindings-D5VJEDZV.mjs → thread-bindings-DrYooQd3.mjs} +54 -23
- package/dist/.setup/{thread-bindings-shared-QmZOfX9Q.mjs → thread-bindings-shared-DEAGGuDA.mjs} +6 -3
- package/dist/.setup/{tool-actions-DexlmVDf.mjs → tool-actions-4dKbrHJ5.mjs} +25 -25
- package/dist/.setup/{url-validation-By_2hsXr.mjs → url-validation-DesoKUns.mjs} +1 -2
- package/dist/.setup/{verification-B122bsH2.mjs → verification-DIxfxgMv.mjs} +4 -5
- package/dist/.source-module-urls/1cd4d4ff8d44e1c8b830932b44d7cf8a7f3350e09e169910e1d7a85e131b7bea.json +1 -1
- package/dist/api.js +8 -8
- package/dist/auth-presence.js +2 -3
- package/dist/channel-plugin-api.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/doctor-contract-api.js +15 -17
- package/dist/helper-api.js +3 -3
- package/dist/index.js +3 -4
- package/dist/plugin-entry.handlers.runtime.js +3 -4
- package/dist/runtime-api.js +7 -8
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/session-binding-contract-api.js +2 -2
- package/dist/setup-entry.js +4 -5
- package/dist/setup-plugin-api.js +1 -1
- package/dist/subagent-hooks-api.js +2 -3
- package/dist/thread-binding-api.js +1 -1
- package/dist/thread-bindings-runtime.js +1 -1
- package/node_modules/@tokenizer/inflate/README.md +57 -17
- package/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts +12 -1
- package/node_modules/@tokenizer/inflate/lib/ZipHandler.js +127 -57
- package/node_modules/@tokenizer/inflate/lib/ZipLimitError.d.ts +18 -4
- package/node_modules/@tokenizer/inflate/lib/ZipLimitError.js +1 -1
- package/node_modules/@tokenizer/inflate/lib/index.d.ts +1 -1
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/LICENSE.txt +21 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/README.md +736 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/AbortSignal.d.ts +2 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/AbortSignal.js +7 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/AbstractTokenizer.d.ts +117 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/AbstractTokenizer.js +204 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/BlobTokenizer.d.ts +29 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/BlobTokenizer.js +57 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/BufferSizeError.d.ts +19 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/BufferSizeError.js +27 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/BufferTokenizer.d.ts +29 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/BufferTokenizer.js +51 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/FileTokenizer.d.ts +47 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/FileTokenizer.js +83 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/NotRegularFileError.d.ts +5 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/NotRegularFileError.js +8 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +34 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/ReadStreamTokenizer.js +140 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/TokenizerBoundaryError.d.ts +7 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/TokenizerBoundaryError.js +10 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/TokenizerView.d.ts +9 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/TokenizerView.js +184 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/core.d.ts +44 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/core.js +56 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/index.d.ts +17 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/index.js +46 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/isRandomAccessTokenizer.d.ts +6 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/isRandomAccessTokenizer.js +10 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +54 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/AbstractStreamReader.js +73 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/Deferred.d.ts +6 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/Deferred.js +10 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/Errors.d.ts +10 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/Errors.js +16 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/StreamReader.d.ts +34 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/StreamReader.js +125 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +14 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamByobReader.js +29 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +19 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +67 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +24 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamReader.js +13 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +5 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +19 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/index.d.ts +6 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/stream/index.js +5 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/types.d.ts +163 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/lib/types.js +1 -0
- package/node_modules/@tokenizer/inflate/node_modules/strtok3/package.json +97 -0
- package/node_modules/@tokenizer/inflate/package.json +5 -5
- package/node_modules/fake-indexeddb/README.md +7 -7
- package/node_modules/fake-indexeddb/build/cjs/lib/Index.js +47 -22
- package/node_modules/fake-indexeddb/build/cjs/lib/ObjectStore.js +4 -2
- package/node_modules/fake-indexeddb/build/cjs/lib/RecordStore.js +14 -9
- package/node_modules/fake-indexeddb/build/esm/lib/Index.js +47 -22
- package/node_modules/fake-indexeddb/build/esm/lib/ObjectStore.js +4 -2
- package/node_modules/fake-indexeddb/build/esm/lib/RecordStore.js +14 -9
- package/node_modules/fake-indexeddb/package.json +1 -1
- package/node_modules/file-type/node_modules/strtok3/README.md +154 -9
- package/node_modules/file-type/node_modules/strtok3/lib/AbstractTokenizer.d.ts +3 -0
- package/node_modules/file-type/node_modules/strtok3/lib/AbstractTokenizer.js +12 -4
- package/node_modules/file-type/node_modules/strtok3/lib/BlobTokenizer.js +1 -0
- package/node_modules/file-type/node_modules/strtok3/lib/BufferTokenizer.js +2 -1
- package/node_modules/file-type/node_modules/strtok3/lib/FileTokenizer.d.ts +1 -1
- package/node_modules/file-type/node_modules/strtok3/lib/FileTokenizer.js +3 -3
- package/node_modules/file-type/node_modules/strtok3/lib/ReadStreamTokenizer.js +17 -2
- package/node_modules/file-type/node_modules/strtok3/lib/TokenizerBoundaryError.d.ts +7 -0
- package/node_modules/file-type/node_modules/strtok3/lib/TokenizerBoundaryError.js +10 -0
- package/node_modules/file-type/node_modules/strtok3/lib/TokenizerView.d.ts +9 -0
- package/node_modules/file-type/node_modules/strtok3/lib/TokenizerView.js +184 -0
- package/node_modules/file-type/node_modules/strtok3/lib/core.d.ts +4 -1
- package/node_modules/file-type/node_modules/strtok3/lib/core.js +5 -18
- package/node_modules/file-type/node_modules/strtok3/lib/index.js +28 -5
- package/node_modules/file-type/node_modules/strtok3/lib/isRandomAccessTokenizer.d.ts +6 -0
- package/node_modules/file-type/node_modules/strtok3/lib/isRandomAccessTokenizer.js +10 -0
- package/node_modules/file-type/node_modules/strtok3/lib/stream/StreamReader.d.ts +4 -0
- package/node_modules/file-type/node_modules/strtok3/lib/stream/StreamReader.js +29 -8
- package/node_modules/file-type/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +12 -2
- package/node_modules/file-type/node_modules/strtok3/lib/types.d.ts +19 -2
- package/node_modules/file-type/node_modules/strtok3/package.json +10 -8
- package/node_modules/file-type/package.json +3 -3
- package/node_modules/file-type/source/detectors/ebml.js +31 -16
- package/node_modules/file-type/source/detectors/zip.js +21 -203
- package/node_modules/matrix-js-sdk/CHANGELOG.md +28 -0
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts +30 -25
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +91 -100
- package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.d.ts +6 -4
- package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.d.ts +2 -15
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts +36 -7
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js +29 -2
- package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts +12 -51
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +10 -66
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts +5 -10
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +25 -44
- package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.d.ts +8 -8
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js +30 -22
- package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js +7 -8
- package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts +8 -13
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +2 -11
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.d.ts +6 -2
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js +3 -0
- package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts +5 -0
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +5 -0
- package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.d.ts +9 -2
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +8 -5
- package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts +17 -2
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js +88 -47
- package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.d.ts +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/room.js +8 -2
- package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/models/thread.js +23 -2
- package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts +3 -3
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/SignInWithQRFlow.d.ts +95 -0
- package/node_modules/matrix-js-sdk/lib/rendezvous/SignInWithQRFlow.d.ts.map +1 -0
- package/node_modules/matrix-js-sdk/lib/rendezvous/SignInWithQRFlow.js +3 -0
- package/node_modules/matrix-js-sdk/lib/rendezvous/SignInWithQRFlow.js.map +1 -0
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.d.ts +1 -0
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.d.ts.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +5 -1
- package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
- package/node_modules/matrix-js-sdk/package.json +3 -3
- package/node_modules/matrix-js-sdk/src/matrixrtc/CallMembership.ts +85 -95
- package/node_modules/matrix-js-sdk/src/matrixrtc/EncryptionManager.ts +6 -4
- package/node_modules/matrix-js-sdk/src/matrixrtc/IMembershipManager.ts +2 -15
- package/node_modules/matrix-js-sdk/src/matrixrtc/LivekitTransport.ts +58 -9
- package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +21 -80
- package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +23 -40
- package/node_modules/matrix-js-sdk/src/matrixrtc/RTCEncryptionManager.ts +51 -39
- package/node_modules/matrix-js-sdk/src/matrixrtc/ToDeviceKeyTransport.ts +7 -7
- package/node_modules/matrix-js-sdk/src/matrixrtc/membershipData/rtc.ts +9 -23
- package/node_modules/matrix-js-sdk/src/matrixrtc/membershipData/session.ts +14 -2
- package/node_modules/matrix-js-sdk/src/matrixrtc/types.ts +6 -0
- package/node_modules/matrix-js-sdk/src/models/event-timeline-set.ts +19 -4
- package/node_modules/matrix-js-sdk/src/models/room-sticky-events.ts +92 -58
- package/node_modules/matrix-js-sdk/src/models/room.ts +8 -2
- package/node_modules/matrix-js-sdk/src/models/thread.ts +25 -3
- package/node_modules/matrix-js-sdk/src/rendezvous/MSC4108SignInWithQR.ts +3 -3
- package/node_modules/matrix-js-sdk/src/rendezvous/SignInWithQRFlow.ts +117 -0
- package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +1 -0
- package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +5 -1
- package/node_modules/music-metadata/README.md +62 -67
- package/node_modules/music-metadata/lib/ParserFactory.js +3 -1
- package/node_modules/music-metadata/lib/aiff/AiffParser.d.ts +2 -0
- package/node_modules/music-metadata/lib/aiff/AiffParser.js +42 -3
- package/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +1 -0
- package/node_modules/music-metadata/lib/aiff/AiffToken.js +1 -0
- package/node_modules/music-metadata/lib/apev2/APEv2Parser.js +11 -1
- package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +2 -2
- package/node_modules/music-metadata/lib/asf/AsfObject.js +81 -111
- package/node_modules/music-metadata/lib/asf/AsfParser.js +5 -3
- package/node_modules/music-metadata/lib/asf/AsfTagMapper.js +27 -3
- package/node_modules/music-metadata/lib/asf/AsfUtil.d.ts +1 -1
- package/node_modules/music-metadata/lib/caf/CafParser.js +13 -2
- package/node_modules/music-metadata/lib/caf/CafToken.d.ts +2 -2
- package/node_modules/music-metadata/lib/caf/CafToken.js +9 -2
- package/node_modules/music-metadata/lib/common/Allocation.d.ts +6 -0
- package/node_modules/music-metadata/lib/common/Allocation.js +18 -0
- package/node_modules/music-metadata/lib/common/GenericTagMapper.js +1 -1
- package/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +2 -0
- package/node_modules/music-metadata/lib/common/MetadataCollector.js +21 -4
- package/node_modules/music-metadata/lib/common/Util.d.ts +4 -0
- package/node_modules/music-metadata/lib/common/Util.js +34 -1
- package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.d.ts +4 -1
- package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +32 -36
- package/node_modules/music-metadata/lib/ebml/EbmlIterator.js +6 -2
- package/node_modules/music-metadata/lib/flac/FlacParser.js +2 -1
- package/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +7 -3
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +91 -46
- package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +6 -0
- package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.d.ts +5 -0
- package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +6 -4
- package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +2 -1
- package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +57 -15
- package/node_modules/music-metadata/lib/lrc/LyricsParser.d.ts +18 -2
- package/node_modules/music-metadata/lib/lrc/LyricsParser.js +14 -3
- package/node_modules/music-metadata/lib/mp4/Atom.d.ts +3 -3
- package/node_modules/music-metadata/lib/mp4/Atom.js +14 -7
- package/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +25 -25
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +136 -119
- package/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +16 -2
- package/node_modules/music-metadata/lib/mp4/MP4Parser.js +370 -132
- package/node_modules/music-metadata/lib/mp4/MP4TagMapper.js +30 -0
- package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +19 -8
- package/node_modules/music-metadata/lib/ogg/OggParser.js +6 -2
- package/node_modules/music-metadata/lib/ogg/OggToken.d.ts +2 -2
- package/node_modules/music-metadata/lib/ogg/OggToken.js +3 -9
- package/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +9 -11
- package/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +111 -27
- package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +6 -0
- package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.js +6 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.d.ts +2 -2
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +8 -4
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +1 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +23 -3
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.d.ts +4 -0
- package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +15 -2
- package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.js +1 -0
- package/node_modules/music-metadata/lib/type.d.ts +23 -6
- package/node_modules/music-metadata/lib/wav/BwfChunk.d.ts +12 -2
- package/node_modules/music-metadata/lib/wav/BwfChunk.js +39 -11
- package/node_modules/music-metadata/lib/wav/WaveParser.js +13 -2
- package/node_modules/music-metadata/package.json +2 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -1
- package/node_modules/typebox/build/format/date_time.mjs +12 -3
- package/node_modules/typebox/package.json +1 -1
- package/package.json +8 -8
- package/dist/.setup/setup-plugin-api-CQKySg7F.mjs +0 -2
- package/node_modules/fake-indexeddb/build/cjs/test/fakeIndexedDB/auto.js +0 -54
- package/node_modules/fake-indexeddb/build/cjs/test/fakeIndexedDB/binarySearchTree.js +0 -413
- package/node_modules/fake-indexeddb/build/cjs/test/fakeIndexedDB/fakeIndexedDB.js +0 -1018
- package/node_modules/fake-indexeddb/build/cjs/test/fakeIndexedDB/forceCloseDatabase.js +0 -99
- package/node_modules/fake-indexeddb/build/cjs/test/fakeIndexedDB/getAll.js +0 -707
- package/node_modules/fake-indexeddb/build/cjs/test/fakeIndexedDB/memoryLeaks.js +0 -42
- package/node_modules/fake-indexeddb/build/esm/test/fakeIndexedDB/auto.js +0 -52
- package/node_modules/fake-indexeddb/build/esm/test/fakeIndexedDB/binarySearchTree.js +0 -409
- package/node_modules/fake-indexeddb/build/esm/test/fakeIndexedDB/fakeIndexedDB.js +0 -1014
- package/node_modules/fake-indexeddb/build/esm/test/fakeIndexedDB/forceCloseDatabase.js +0 -95
- package/node_modules/fake-indexeddb/build/esm/test/fakeIndexedDB/getAll.js +0 -703
- package/node_modules/fake-indexeddb/build/esm/test/fakeIndexedDB/memoryLeaks.js +0 -38
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { textDecode } from '@borewit/text-codec';
|
|
2
2
|
import initDebug from 'debug';
|
|
3
|
+
import { createTokenizerView } from 'strtok3';
|
|
3
4
|
import * as Token from 'token-types';
|
|
4
5
|
import { uint8ArrayToHex } from 'uint8array-extras';
|
|
5
|
-
import { readToken, validateAllocation } from '../common/Allocation.js';
|
|
6
|
+
import { getMaxChapterCount, getMaxMetadataEntries, readToken, validateAllocation } from '../common/Allocation.js';
|
|
6
7
|
import { BasicParser } from '../common/BasicParser.js';
|
|
7
8
|
import { Genres } from '../id3v1/ID3v1Parser.js';
|
|
8
9
|
import { TrackType } from '../type.js';
|
|
@@ -11,7 +12,6 @@ import * as AtomToken from './AtomToken.js';
|
|
|
11
12
|
import { ChapterTrackReferenceBox, Mp4ContentError } from './AtomToken.js';
|
|
12
13
|
const debug = initDebug('music-metadata:parser:MP4');
|
|
13
14
|
const tagFormat = 'iTunes';
|
|
14
|
-
const maxChapterCount = 1_000;
|
|
15
15
|
const maxChapterTitleBytes = 64 * 1024;
|
|
16
16
|
const encoderDict = {
|
|
17
17
|
raw: {
|
|
@@ -72,9 +72,6 @@ const encoderDict = {
|
|
|
72
72
|
format: 'CEA-708'
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
function distinct(value, index, self) {
|
|
76
|
-
return self.indexOf(value) === index;
|
|
77
|
-
}
|
|
78
75
|
/** Chapter offsets can be revisited even when the total input size is unknown. */
|
|
79
76
|
function supportsSeeking(tokenizer) {
|
|
80
77
|
return tokenizer.supportsRandomAccess() && 'setPosition' in tokenizer && typeof tokenizer.setPosition === 'function';
|
|
@@ -117,6 +114,7 @@ function isAudioTrack(track) {
|
|
|
117
114
|
* https://wiki.multimedia.cx/index.php/QuickTime_container
|
|
118
115
|
*/
|
|
119
116
|
export class MP4Parser extends BasicParser {
|
|
117
|
+
maxChapterCount = getMaxChapterCount(this.options);
|
|
120
118
|
static read_BE_Integer(array, signed) {
|
|
121
119
|
const integerType = (signed ? 'INT' : 'UINT') + array.length * 8 + (array.length > 1 ? '_BE' : '');
|
|
122
120
|
const token = Token[integerType];
|
|
@@ -142,9 +140,15 @@ export class MP4Parser extends BasicParser {
|
|
|
142
140
|
neroChapters = [];
|
|
143
141
|
hasVideoTrack = false;
|
|
144
142
|
hasAudioTrack = false;
|
|
143
|
+
remainingAtoms = 0;
|
|
144
|
+
maxMetadataEntries = 0;
|
|
145
|
+
metadataKeys = new WeakMap();
|
|
146
|
+
pendingTags = [];
|
|
145
147
|
async parse() {
|
|
146
148
|
this.hasVideoTrack = false;
|
|
147
149
|
this.hasAudioTrack = false;
|
|
150
|
+
this.maxMetadataEntries = getMaxMetadataEntries(this.options);
|
|
151
|
+
this.remainingAtoms = this.maxMetadataEntries;
|
|
148
152
|
this.tracks.clear();
|
|
149
153
|
this.mediaDataRanges = [];
|
|
150
154
|
this.streamedChapters.clear();
|
|
@@ -152,6 +156,8 @@ export class MP4Parser extends BasicParser {
|
|
|
152
156
|
this.neroChapters = [];
|
|
153
157
|
this.trackDefaults.clear();
|
|
154
158
|
this.movieHeader = undefined;
|
|
159
|
+
this.pendingTags = [];
|
|
160
|
+
this.metadataKeys = new WeakMap();
|
|
155
161
|
let remainingFileSize = this.tokenizer.fileInfo.size ?? Number.POSITIVE_INFINITY;
|
|
156
162
|
while (remainingFileSize > 0) {
|
|
157
163
|
try {
|
|
@@ -174,8 +180,28 @@ export class MP4Parser extends BasicParser {
|
|
|
174
180
|
}
|
|
175
181
|
break;
|
|
176
182
|
}
|
|
177
|
-
const
|
|
183
|
+
const atomsBeforeRoot = this.remainingAtoms;
|
|
184
|
+
const rootAtom = await Atom.readAtom(this.tokenizer, (atom, remaining) => this.handleAtom(atom, remaining), null, remainingFileSize, () => this.reserveAtom());
|
|
185
|
+
// Release the root tree budget; each table is limited separately.
|
|
186
|
+
this.remainingAtoms = atomsBeforeRoot;
|
|
178
187
|
remainingFileSize = rootAtom.header.length === 0n ? 0 : remainingFileSize - Number(rootAtom.header.length);
|
|
188
|
+
// A keys box can follow its ilst. Keep wire order and resolve only within the owning meta box.
|
|
189
|
+
for (const tag of this.pendingTags) {
|
|
190
|
+
let id = tag.id;
|
|
191
|
+
if (tag.scope && id.length === 4 && id.charCodeAt(0) === 0) {
|
|
192
|
+
const index = [...id].reduce((value, character) => value * 256 + character.charCodeAt(0), 0);
|
|
193
|
+
const key = this.metadataKeys.get(tag.scope)?.[index - 1];
|
|
194
|
+
if (key !== undefined) {
|
|
195
|
+
id = key;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
this.addWarning(`Unresolved MP4 metadata key index ${index}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
await this.metadata.addTag(tagFormat, id, tag.value);
|
|
202
|
+
}
|
|
203
|
+
this.pendingTags = [];
|
|
204
|
+
this.metadataKeys = new WeakMap();
|
|
179
205
|
}
|
|
180
206
|
if (this.mediaDataRanges.length > 0 && supportsSeeking(this.tokenizer)) {
|
|
181
207
|
// Track references and sample tables may follow the media data in a trailing moov box.
|
|
@@ -205,7 +231,7 @@ export class MP4Parser extends BasicParser {
|
|
|
205
231
|
const trackFormats = [];
|
|
206
232
|
// Sample descriptions are alternative encodings of one track, not separate tracks.
|
|
207
233
|
for (const ssd of track.soundSampleDescription) {
|
|
208
|
-
const encoderInfo = encoderDict[ssd.dataFormat];
|
|
234
|
+
const encoderInfo = ssd.encoder ?? encoderDict[ssd.dataFormat];
|
|
209
235
|
if (encoderInfo) {
|
|
210
236
|
trackFormats.push(encoderInfo.format);
|
|
211
237
|
}
|
|
@@ -215,7 +241,7 @@ export class MP4Parser extends BasicParser {
|
|
|
215
241
|
}
|
|
216
242
|
});
|
|
217
243
|
if (formatList.length > 0) {
|
|
218
|
-
this.metadata.setFormat('codec', formatList
|
|
244
|
+
this.metadata.setFormat('codec', [...new Set(formatList)].join('+'));
|
|
219
245
|
}
|
|
220
246
|
const audioTracks = [...this.tracks.values()].filter(isAudioTrack);
|
|
221
247
|
// Both audio and video use the same sample tables and fragment timing.
|
|
@@ -237,7 +263,7 @@ export class MP4Parser extends BasicParser {
|
|
|
237
263
|
audioTrack.duration = totalSampleSize / ssd.description.sampleRate;
|
|
238
264
|
}
|
|
239
265
|
}
|
|
240
|
-
const encoderInfo = encoderDict[ssd.dataFormat];
|
|
266
|
+
const encoderInfo = ssd.encoder ?? encoderDict[ssd.dataFormat];
|
|
241
267
|
if (encoderInfo) {
|
|
242
268
|
this.metadata.setFormat('lossless', !encoderInfo.lossy);
|
|
243
269
|
}
|
|
@@ -270,6 +296,9 @@ export class MP4Parser extends BasicParser {
|
|
|
270
296
|
}
|
|
271
297
|
}
|
|
272
298
|
async handleAtom(atom, remaining) {
|
|
299
|
+
if (atom.header.name === 'keys' && atom.parent?.header.name === 'meta') {
|
|
300
|
+
return this.parseMetadataKeys(atom.parent, remaining);
|
|
301
|
+
}
|
|
273
302
|
if (atom.parent) {
|
|
274
303
|
switch (atom.parent.header.name) {
|
|
275
304
|
case 'ilst':
|
|
@@ -296,7 +325,7 @@ export class MP4Parser extends BasicParser {
|
|
|
296
325
|
this.validatePayloadLength(remaining);
|
|
297
326
|
// Retain structural validation of sample tables, including malformed-entry rejection.
|
|
298
327
|
if (atom.header.name === 'stsd') {
|
|
299
|
-
await this.readToken(new AtomToken.StsdAtom(remaining));
|
|
328
|
+
await this.readToken(new AtomToken.StsdAtom(remaining, getMaxMetadataEntries(this.options)));
|
|
300
329
|
}
|
|
301
330
|
else if (atom.header.name === 'stsz') {
|
|
302
331
|
await this.readToken(new AtomToken.StszAtom(remaining));
|
|
@@ -316,8 +345,56 @@ export class MP4Parser extends BasicParser {
|
|
|
316
345
|
debug(`No parser for atom path=${atom.atomPath}, payload-len=${remaining}, ignoring atom`);
|
|
317
346
|
await this.tokenizer.ignore(remaining);
|
|
318
347
|
}
|
|
319
|
-
|
|
320
|
-
|
|
348
|
+
reserveAtom() {
|
|
349
|
+
if (this.remainingAtoms === 0) {
|
|
350
|
+
throw new Mp4ContentError('MP4 atom count exceeds entry limit');
|
|
351
|
+
}
|
|
352
|
+
--this.remainingAtoms;
|
|
353
|
+
}
|
|
354
|
+
assertRetainedEntryCapacity(count, collection) {
|
|
355
|
+
if (count >= this.maxMetadataEntries) {
|
|
356
|
+
throw new Mp4ContentError(`${collection} count exceeds entry limit ${this.maxMetadataEntries}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async addTag(id, value, scope) {
|
|
360
|
+
this.assertRetainedEntryCapacity(this.pendingTags.length, 'MP4 metadata value');
|
|
361
|
+
this.pendingTags.push({ id, value, scope });
|
|
362
|
+
}
|
|
363
|
+
async parseMetadataKeys(scope, length) {
|
|
364
|
+
if (length < 8) {
|
|
365
|
+
throw new Mp4ContentError('Truncated metadata keys header');
|
|
366
|
+
}
|
|
367
|
+
const data = await this.readToken(new Token.Uint8ArrayType(length));
|
|
368
|
+
if (Token.UINT32_BE.get(data, 0) !== 0) {
|
|
369
|
+
throw new Mp4ContentError('Unsupported metadata keys version or flags');
|
|
370
|
+
}
|
|
371
|
+
const count = Token.UINT32_BE.get(data, 4);
|
|
372
|
+
if (count > this.maxMetadataEntries || count > Math.floor((length - 8) / 8)) {
|
|
373
|
+
throw new Mp4ContentError('Metadata keys count exceeds entry limit or payload bounds');
|
|
374
|
+
}
|
|
375
|
+
const keys = [];
|
|
376
|
+
let offset = 8;
|
|
377
|
+
for (let index = 0; index < count; ++index) {
|
|
378
|
+
if (offset + 8 > length) {
|
|
379
|
+
throw new Mp4ContentError('Truncated metadata key entry');
|
|
380
|
+
}
|
|
381
|
+
const size = Token.UINT32_BE.get(data, offset);
|
|
382
|
+
if (size < 8 || size > length - offset) {
|
|
383
|
+
throw new Mp4ContentError('Invalid metadata key entry size');
|
|
384
|
+
}
|
|
385
|
+
const namespace = new Token.StringType(4, 'latin1').get(data, offset + 4);
|
|
386
|
+
keys.push(`${namespace}:${textDecode(data.subarray(offset + 8, offset + size))}`);
|
|
387
|
+
offset += size;
|
|
388
|
+
}
|
|
389
|
+
if (offset !== length) {
|
|
390
|
+
throw new Mp4ContentError('Unexpected bytes after metadata keys');
|
|
391
|
+
}
|
|
392
|
+
if (this.metadataKeys.has(scope)) {
|
|
393
|
+
this.addWarning('Duplicate MP4 metadata keys table; keeping the first table');
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
this.metadataKeys.set(scope, keys);
|
|
397
|
+
}
|
|
321
398
|
}
|
|
322
399
|
addWarning(message) {
|
|
323
400
|
debug(`Warning: ${message}`);
|
|
@@ -330,16 +407,23 @@ export class MP4Parser extends BasicParser {
|
|
|
330
407
|
*/
|
|
331
408
|
parseMetadataItemData(metaAtom) {
|
|
332
409
|
let tagKey = metaAtom.header.name;
|
|
410
|
+
let scope = metaAtom.parent;
|
|
411
|
+
while (scope && scope.header.name !== 'meta') {
|
|
412
|
+
scope = scope.parent;
|
|
413
|
+
}
|
|
414
|
+
const indexed = scope !== null && tagKey.charCodeAt(0) === 0;
|
|
333
415
|
return metaAtom.readAtoms(this.tokenizer, async (child) => {
|
|
334
416
|
const payLoadLength = child.getPayloadLength();
|
|
335
417
|
switch (child.header.name) {
|
|
336
418
|
case 'data': // value atom
|
|
337
|
-
return this.parseValueAtom(tagKey, child);
|
|
419
|
+
return this.parseValueAtom(tagKey, child, scope ?? undefined);
|
|
338
420
|
case 'name': // name atom (optional)
|
|
339
421
|
case 'mean':
|
|
340
422
|
case 'rate': {
|
|
341
423
|
const name = await this.readToken(new AtomToken.NameAtom(payLoadLength));
|
|
342
|
-
|
|
424
|
+
if (!indexed) {
|
|
425
|
+
tagKey += `:${name.name}`;
|
|
426
|
+
}
|
|
343
427
|
break;
|
|
344
428
|
}
|
|
345
429
|
default: {
|
|
@@ -349,11 +433,29 @@ export class MP4Parser extends BasicParser {
|
|
|
349
433
|
}
|
|
350
434
|
}, metaAtom.getPayloadLength());
|
|
351
435
|
}
|
|
352
|
-
async parseValueAtom(tagKey, metaAtom) {
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
throw new Mp4ContentError(
|
|
436
|
+
async parseValueAtom(tagKey, metaAtom, scope) {
|
|
437
|
+
const length = metaAtom.getPayloadLength();
|
|
438
|
+
if (length < AtomToken.DataAtomHeader.len) {
|
|
439
|
+
throw new Mp4ContentError('Truncated data atom header');
|
|
440
|
+
}
|
|
441
|
+
const header = await this.readToken(AtomToken.DataAtomHeader);
|
|
442
|
+
if (header.type.set !== 0) {
|
|
443
|
+
throw new Mp4ContentError(`Unsupported type-set != 0: ${header.type.set}`);
|
|
356
444
|
}
|
|
445
|
+
const bodyLength = length - AtomToken.DataAtomHeader.len;
|
|
446
|
+
if (this.options.skipCovers && (header.type.type === 13 || header.type.type === 14)) {
|
|
447
|
+
const body = createTokenizerView(this.tokenizer, bodyLength);
|
|
448
|
+
try {
|
|
449
|
+
await body.consumeRemainder();
|
|
450
|
+
}
|
|
451
|
+
finally {
|
|
452
|
+
await body.close();
|
|
453
|
+
}
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
// Preserve the complete value's allocation policy when buffering its body.
|
|
457
|
+
this.validatePayloadLength(length);
|
|
458
|
+
const dataAtom = { ...header, value: await this.readToken(new Token.Uint8ArrayType(bodyLength)) };
|
|
357
459
|
// Use well-known-type table
|
|
358
460
|
// Ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW35
|
|
359
461
|
switch (dataAtom.type.type) {
|
|
@@ -364,19 +466,19 @@ export class MP4Parser extends BasicParser {
|
|
|
364
466
|
const num = Token.UINT8.get(dataAtom.value, 3);
|
|
365
467
|
const of = Token.UINT8.get(dataAtom.value, 5);
|
|
366
468
|
// console.log(" %s[data] = %s/%s", tagKey, num, of);
|
|
367
|
-
await this.addTag(tagKey, `${num}/${of}
|
|
469
|
+
await this.addTag(tagKey, `${num}/${of}`, scope);
|
|
368
470
|
break;
|
|
369
471
|
}
|
|
370
472
|
case 'gnre': {
|
|
371
473
|
const genreInt = Token.UINT8.get(dataAtom.value, 1);
|
|
372
474
|
const genreStr = Genres[genreInt - 1];
|
|
373
475
|
// console.log(" %s[data] = %s", tagKey, genreStr);
|
|
374
|
-
await this.addTag(tagKey, genreStr);
|
|
476
|
+
await this.addTag(tagKey, genreStr, scope);
|
|
375
477
|
break;
|
|
376
478
|
}
|
|
377
479
|
case 'rate': {
|
|
378
480
|
const rate = textDecode(dataAtom.value, 'ascii');
|
|
379
|
-
await this.addTag(tagKey, rate);
|
|
481
|
+
await this.addTag(tagKey, rate, scope);
|
|
380
482
|
break;
|
|
381
483
|
}
|
|
382
484
|
default:
|
|
@@ -385,40 +487,34 @@ export class MP4Parser extends BasicParser {
|
|
|
385
487
|
break;
|
|
386
488
|
case 1: // UTF-8: Without any count or NULL terminator
|
|
387
489
|
case 18: // Unknown: Found in m4b in combination with a '©gen' tag
|
|
388
|
-
await this.addTag(tagKey, textDecode(dataAtom.value));
|
|
490
|
+
await this.addTag(tagKey, textDecode(dataAtom.value), scope);
|
|
389
491
|
break;
|
|
390
492
|
case 13: // JPEG
|
|
391
|
-
if (this.options.skipCovers) {
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
493
|
await this.addTag(tagKey, {
|
|
395
494
|
format: 'image/jpeg',
|
|
396
495
|
data: Uint8Array.from(dataAtom.value)
|
|
397
|
-
});
|
|
496
|
+
}, scope);
|
|
398
497
|
break;
|
|
399
498
|
case 14: // PNG
|
|
400
|
-
if (this.options.skipCovers) {
|
|
401
|
-
break;
|
|
402
|
-
}
|
|
403
499
|
await this.addTag(tagKey, {
|
|
404
500
|
format: 'image/png',
|
|
405
501
|
data: Uint8Array.from(dataAtom.value)
|
|
406
|
-
});
|
|
502
|
+
}, scope);
|
|
407
503
|
break;
|
|
408
504
|
case 21: // BE Signed Integer
|
|
409
|
-
await this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, true));
|
|
505
|
+
await this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, true), scope);
|
|
410
506
|
break;
|
|
411
507
|
case 22: // BE Unsigned Integer
|
|
412
|
-
await this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, false));
|
|
508
|
+
await this.addTag(tagKey, MP4Parser.read_BE_Integer(dataAtom.value, false), scope);
|
|
413
509
|
break;
|
|
414
510
|
case 65: // An 8-bit signed integer
|
|
415
|
-
await this.addTag(tagKey, Token.
|
|
511
|
+
await this.addTag(tagKey, Token.INT8.get(dataAtom.value, 0), scope);
|
|
416
512
|
break;
|
|
417
513
|
case 66: // A big-endian 16-bit signed integer
|
|
418
|
-
await this.addTag(tagKey, Token.
|
|
514
|
+
await this.addTag(tagKey, Token.INT16_BE.get(dataAtom.value, 0), scope);
|
|
419
515
|
break;
|
|
420
516
|
case 67: // A big-endian 32-bit signed integer
|
|
421
|
-
await this.addTag(tagKey, Token.
|
|
517
|
+
await this.addTag(tagKey, Token.INT32_BE.get(dataAtom.value, 0), scope);
|
|
422
518
|
break;
|
|
423
519
|
default:
|
|
424
520
|
this.addWarning(`atom key=${tagKey}, has unknown well-known-type (data-type): ${dataAtom.type.type}`);
|
|
@@ -438,76 +534,26 @@ export class MP4Parser extends BasicParser {
|
|
|
438
534
|
const timeScale = track.media.header?.timeScale;
|
|
439
535
|
track.duration = this.getDuration(track.media.header);
|
|
440
536
|
track.endTime = track.duration;
|
|
441
|
-
if (track.sampleSize > 0 && track.sampleCount !== undefined) {
|
|
442
|
-
track.sizeInBytes = track.sampleSize * track.sampleCount;
|
|
443
|
-
}
|
|
444
|
-
else if (track.sampleSizeTable.length > 0) {
|
|
445
|
-
track.sizeInBytes = track.sampleSizeTable.reduce((sum, size) => sum + size, 0);
|
|
446
|
-
}
|
|
447
537
|
let sampleCount = track.timeToSampleTable.reduce((sum, entry) => sum + entry.count, 0);
|
|
448
538
|
let timeUnits = track.timeToSampleTable.reduce((sum, entry) => sum + entry.count * entry.duration, 0);
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
let end = 0;
|
|
455
|
-
let size = track.sizeInBytes ?? 0;
|
|
456
|
-
let timingComplete = true;
|
|
457
|
-
let sizesComplete = track.sampleCount === 0 || track.sizeInBytes !== undefined;
|
|
458
|
-
for (const fragment of track.fragments) {
|
|
459
|
-
cursor = fragment.decodeTime ?? cursor;
|
|
460
|
-
start = start === undefined ? cursor : Math.min(start, cursor);
|
|
461
|
-
const run = fragment.trackRun;
|
|
462
|
-
if (!run.flags.sampleDurationPresent &&
|
|
463
|
-
!run.flags.sampleSizePresent &&
|
|
464
|
-
!run.flags.sampleFlagsPresent &&
|
|
465
|
-
!run.flags.sampleCompositionTimeOffsetsPresent) {
|
|
466
|
-
const duration = fragment.header.defaultSampleDuration ?? defaults?.duration;
|
|
467
|
-
const sampleSize = fragment.header.defaultSampleSize ?? defaults?.size;
|
|
468
|
-
if (duration === undefined || duration <= 0) {
|
|
469
|
-
timingComplete = false;
|
|
470
|
-
}
|
|
471
|
-
else {
|
|
472
|
-
cursor += duration * run.sampleCount;
|
|
473
|
-
}
|
|
474
|
-
if (sampleSize === undefined) {
|
|
475
|
-
sizesComplete = false;
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
size += sampleSize * run.sampleCount;
|
|
479
|
-
}
|
|
480
|
-
sampleCount += run.sampleCount;
|
|
481
|
-
}
|
|
482
|
-
for (const sample of fragment.trackRun.samples) {
|
|
483
|
-
const duration = sample.sampleDuration ?? fragment.header.defaultSampleDuration ?? defaults?.duration;
|
|
484
|
-
const sampleSize = sample.sampleSize ?? fragment.header.defaultSampleSize ?? defaults?.size;
|
|
485
|
-
if (duration === undefined || duration <= 0) {
|
|
486
|
-
timingComplete = false;
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
cursor += duration;
|
|
490
|
-
}
|
|
491
|
-
if (sampleSize === undefined) {
|
|
492
|
-
sizesComplete = false;
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
495
|
-
size += sampleSize;
|
|
496
|
-
}
|
|
497
|
-
++sampleCount;
|
|
498
|
-
}
|
|
499
|
-
end = Math.max(end, cursor);
|
|
500
|
-
}
|
|
539
|
+
const fragments = track.fragmentStatistics;
|
|
540
|
+
if (fragments) {
|
|
541
|
+
const size = (track.sizeInBytes ?? 0) + fragments.size;
|
|
542
|
+
const sizesComplete = (track.sampleCount === 0 || track.sizeInBytes !== undefined) && fragments.sizesComplete;
|
|
543
|
+
sampleCount += fragments.sampleCount;
|
|
501
544
|
if (sizesComplete && Number.isSafeInteger(size)) {
|
|
502
545
|
track.sizeInBytes = size;
|
|
503
546
|
}
|
|
504
547
|
else {
|
|
505
548
|
track.sizeInBytes = undefined;
|
|
506
549
|
}
|
|
507
|
-
if (timingComplete &&
|
|
508
|
-
|
|
550
|
+
if (fragments.timingComplete &&
|
|
551
|
+
timeScale &&
|
|
552
|
+
fragments.start !== undefined &&
|
|
553
|
+
Number.isSafeInteger(fragments.end)) {
|
|
554
|
+
timeUnits += fragments.end - fragments.start;
|
|
509
555
|
track.duration = Math.max(track.duration ?? 0, timeUnits / timeScale);
|
|
510
|
-
track.endTime = Math.max(end / timeScale, track.duration);
|
|
556
|
+
track.endTime = Math.max(fragments.end / timeScale, track.duration);
|
|
511
557
|
}
|
|
512
558
|
else {
|
|
513
559
|
timeUnits = 0;
|
|
@@ -517,7 +563,7 @@ export class MP4Parser extends BasicParser {
|
|
|
517
563
|
track.duration = timeUnits / timeScale;
|
|
518
564
|
track.endTime = track.duration;
|
|
519
565
|
}
|
|
520
|
-
if (timeScale && timeUnits > 0 && sampleCount > 0) {
|
|
566
|
+
if (timeScale && timeUnits > 0 && sampleCount > 0 && Number.isSafeInteger(sampleCount)) {
|
|
521
567
|
track.frameRate = (sampleCount * timeScale) / timeUnits;
|
|
522
568
|
}
|
|
523
569
|
if (track.duration === undefined &&
|
|
@@ -530,6 +576,45 @@ export class MP4Parser extends BasicParser {
|
|
|
530
576
|
track.endTime = track.duration;
|
|
531
577
|
}
|
|
532
578
|
}
|
|
579
|
+
aggregateFragment(track, header, run, decodeTime) {
|
|
580
|
+
if (run.sampleCount === 0) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const defaults = this.trackDefaults.get(track.header.trackId);
|
|
584
|
+
const fragments = (track.fragmentStatistics ??= {
|
|
585
|
+
cursor: track.timeToSampleTable.reduce((sum, entry) => sum + entry.count * entry.duration, 0),
|
|
586
|
+
end: 0,
|
|
587
|
+
sampleCount: 0,
|
|
588
|
+
size: 0,
|
|
589
|
+
timingComplete: true,
|
|
590
|
+
sizesComplete: true
|
|
591
|
+
});
|
|
592
|
+
fragments.cursor = decodeTime ?? fragments.cursor;
|
|
593
|
+
fragments.start = fragments.start === undefined ? fragments.cursor : Math.min(fragments.start, fragments.cursor);
|
|
594
|
+
const defaultDuration = header.defaultSampleDuration ?? defaults?.duration;
|
|
595
|
+
const defaultSize = header.defaultSampleSize ?? defaults?.size;
|
|
596
|
+
if (run.flags.sampleDurationPresent) {
|
|
597
|
+
fragments.cursor += run.duration;
|
|
598
|
+
fragments.timingComplete &&= run.timingComplete;
|
|
599
|
+
}
|
|
600
|
+
else if (defaultDuration !== undefined && defaultDuration > 0) {
|
|
601
|
+
fragments.cursor += defaultDuration * run.sampleCount;
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
fragments.timingComplete = false;
|
|
605
|
+
}
|
|
606
|
+
if (run.flags.sampleSizePresent) {
|
|
607
|
+
fragments.size += run.size;
|
|
608
|
+
}
|
|
609
|
+
else if (defaultSize !== undefined) {
|
|
610
|
+
fragments.size += defaultSize * run.sampleCount;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
fragments.sizesComplete = false;
|
|
614
|
+
}
|
|
615
|
+
fragments.sampleCount += run.sampleCount;
|
|
616
|
+
fragments.end = Math.max(fragments.end, fragments.cursor);
|
|
617
|
+
}
|
|
533
618
|
getTrackInfo(track) {
|
|
534
619
|
const info = {
|
|
535
620
|
id: track.header.trackId,
|
|
@@ -576,7 +661,7 @@ export class MP4Parser extends BasicParser {
|
|
|
576
661
|
const ssd = track.soundSampleDescription[0];
|
|
577
662
|
if (ssd) {
|
|
578
663
|
info.codecId = ssd.dataFormat;
|
|
579
|
-
const encoder = encoderDict[ssd.dataFormat];
|
|
664
|
+
const encoder = ssd.encoder ?? encoderDict[ssd.dataFormat];
|
|
580
665
|
info.codecName = encoder?.format ?? `<${ssd.dataFormat}>`;
|
|
581
666
|
if (info.type === TrackType.audio) {
|
|
582
667
|
if (encoder) {
|
|
@@ -622,7 +707,6 @@ export class MP4Parser extends BasicParser {
|
|
|
622
707
|
// The handler and header can occur in any order; resolve them after parsing the track.
|
|
623
708
|
const track = {
|
|
624
709
|
media: {},
|
|
625
|
-
fragments: [],
|
|
626
710
|
soundSampleDescription: [],
|
|
627
711
|
chunkOffsetTable: [],
|
|
628
712
|
sampleSize: 0,
|
|
@@ -635,7 +719,7 @@ export class MP4Parser extends BasicParser {
|
|
|
635
719
|
const payLoadLength = child.getPayloadLength();
|
|
636
720
|
switch (child.header.name) {
|
|
637
721
|
case 'chap': {
|
|
638
|
-
const chap = await this.readToken(new ChapterTrackReferenceBox(payLoadLength));
|
|
722
|
+
const chap = await this.readToken(new ChapterTrackReferenceBox(payLoadLength, getMaxMetadataEntries(this.options)));
|
|
639
723
|
track.chapterList = chap;
|
|
640
724
|
break;
|
|
641
725
|
}
|
|
@@ -666,36 +750,38 @@ export class MP4Parser extends BasicParser {
|
|
|
666
750
|
case 'stco':
|
|
667
751
|
case 'co64': {
|
|
668
752
|
const token = child.header.name === 'co64'
|
|
669
|
-
? new AtomToken.Co64Atom(payLoadLength)
|
|
670
|
-
: new AtomToken.StcoAtom(payLoadLength);
|
|
753
|
+
? new AtomToken.Co64Atom(payLoadLength, getMaxMetadataEntries(this.options))
|
|
754
|
+
: new AtomToken.StcoAtom(payLoadLength, getMaxMetadataEntries(this.options));
|
|
671
755
|
const stco = await this.readToken(token);
|
|
672
756
|
track.chunkOffsetTable = stco.entries; // remember chunk offsets
|
|
673
757
|
break;
|
|
674
758
|
}
|
|
675
759
|
case 'stsc': {
|
|
676
760
|
// sample-to-Chunk box
|
|
677
|
-
const stsc = await this.readToken(new AtomToken.StscAtom(payLoadLength));
|
|
761
|
+
const stsc = await this.readToken(new AtomToken.StscAtom(payLoadLength, getMaxMetadataEntries(this.options)));
|
|
678
762
|
track.sampleToChunkTable = stsc.entries;
|
|
679
763
|
break;
|
|
680
764
|
}
|
|
681
765
|
case 'stsd': {
|
|
682
766
|
// sample description box
|
|
683
|
-
const stsd = await this.readToken(new AtomToken.StsdAtom(payLoadLength));
|
|
767
|
+
const stsd = await this.readToken(new AtomToken.StsdAtom(payLoadLength, getMaxMetadataEntries(this.options)));
|
|
684
768
|
track.sampleDescriptions = stsd.table;
|
|
685
769
|
track.soundSampleDescription = stsd.table.map(dfEntry => this.parseSoundSampleDescription(dfEntry));
|
|
686
770
|
break;
|
|
687
771
|
}
|
|
688
772
|
case 'stts': {
|
|
689
773
|
// time-to-sample table
|
|
690
|
-
const stts = await this.readToken(new AtomToken.SttsAtom(payLoadLength));
|
|
774
|
+
const stts = await this.readToken(new AtomToken.SttsAtom(payLoadLength, getMaxMetadataEntries(this.options)));
|
|
691
775
|
track.timeToSampleTable = stts.entries;
|
|
692
776
|
break;
|
|
693
777
|
}
|
|
694
778
|
case 'stsz': {
|
|
695
|
-
|
|
779
|
+
// References and handlers may appear later; retain a bounded chapter prefix for any track.
|
|
780
|
+
const stsz = await this.readToken(new AtomToken.StszAtom(payLoadLength, this.options.includeChapters ? this.maxChapterCount : 0));
|
|
696
781
|
track.sampleSize = stsz.sampleSize;
|
|
697
782
|
track.sampleCount = stsz.numberOfEntries;
|
|
698
783
|
track.sampleSizeTable = stsz.entries;
|
|
784
|
+
track.sizeInBytes = stsz.totalSize;
|
|
699
785
|
break;
|
|
700
786
|
}
|
|
701
787
|
case 'dinf':
|
|
@@ -705,6 +791,12 @@ export class MP4Parser extends BasicParser {
|
|
|
705
791
|
await this.tokenizer.ignore(payLoadLength);
|
|
706
792
|
break;
|
|
707
793
|
default: {
|
|
794
|
+
if (child.parent?.header.name === 'ilst' ||
|
|
795
|
+
child.parent?.header.name === '<id>' ||
|
|
796
|
+
(child.header.name === 'keys' && child.parent?.header.name === 'meta')) {
|
|
797
|
+
await this.handleAtom(child, payLoadLength);
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
708
800
|
debug(`Unexpected track box: ${child.header.name}`);
|
|
709
801
|
await this.tokenizer.ignore(payLoadLength);
|
|
710
802
|
}
|
|
@@ -712,6 +804,9 @@ export class MP4Parser extends BasicParser {
|
|
|
712
804
|
}, trakBox.getPayloadLength());
|
|
713
805
|
// Register track
|
|
714
806
|
if (track.header) {
|
|
807
|
+
if (!this.tracks.has(track.header.trackId)) {
|
|
808
|
+
this.assertRetainedEntryCapacity(this.tracks.size, 'MP4 track');
|
|
809
|
+
}
|
|
715
810
|
this.tracks.set(track.header.trackId, { ...track, header: track.header });
|
|
716
811
|
}
|
|
717
812
|
}
|
|
@@ -719,6 +814,7 @@ export class MP4Parser extends BasicParser {
|
|
|
719
814
|
let tfhd;
|
|
720
815
|
let decodeTime;
|
|
721
816
|
const runs = [];
|
|
817
|
+
let remainingSamples = this.maxMetadataEntries;
|
|
722
818
|
await trafBox.readAtoms(this.tokenizer, async (child) => {
|
|
723
819
|
const length = child.getPayloadLength();
|
|
724
820
|
switch (child.header.name) {
|
|
@@ -744,9 +840,12 @@ export class MP4Parser extends BasicParser {
|
|
|
744
840
|
}
|
|
745
841
|
break;
|
|
746
842
|
}
|
|
747
|
-
case 'trun':
|
|
748
|
-
|
|
843
|
+
case 'trun': {
|
|
844
|
+
const run = await this.readToken(new AtomToken.TrackRunBox(length, remainingSamples));
|
|
845
|
+
remainingSamples -= run.explicitSampleCount;
|
|
846
|
+
runs.push(run);
|
|
749
847
|
break;
|
|
848
|
+
}
|
|
750
849
|
default:
|
|
751
850
|
await this.tokenizer.ignore(length);
|
|
752
851
|
}
|
|
@@ -754,7 +853,9 @@ export class MP4Parser extends BasicParser {
|
|
|
754
853
|
if (tfhd) {
|
|
755
854
|
const track = this.tracks.get(tfhd.trackId);
|
|
756
855
|
for (const run of runs) {
|
|
757
|
-
track
|
|
856
|
+
if (track) {
|
|
857
|
+
this.aggregateFragment(track, tfhd, run, decodeTime);
|
|
858
|
+
}
|
|
758
859
|
decodeTime = undefined;
|
|
759
860
|
}
|
|
760
861
|
}
|
|
@@ -772,7 +873,9 @@ export class MP4Parser extends BasicParser {
|
|
|
772
873
|
},
|
|
773
874
|
chpl: async (len) => {
|
|
774
875
|
if (this.options.includeChapters) {
|
|
775
|
-
this.neroChapters = await this.readToken(new AtomToken.ChapterListAtom(len)
|
|
876
|
+
this.neroChapters = await this.readToken(new AtomToken.ChapterListAtom(len, this.maxChapterCount, () => {
|
|
877
|
+
this.addWarning(`Chapter count exceeds the ${this.maxChapterCount} chapter limit`);
|
|
878
|
+
}));
|
|
776
879
|
}
|
|
777
880
|
else {
|
|
778
881
|
await this.tokenizer.ignore(len);
|
|
@@ -783,7 +886,11 @@ export class MP4Parser extends BasicParser {
|
|
|
783
886
|
if (len < 24) {
|
|
784
887
|
throw new Mp4ContentError('Truncated trex box');
|
|
785
888
|
}
|
|
786
|
-
|
|
889
|
+
const trackId = Token.UINT32_BE.get(data, 4);
|
|
890
|
+
if (!this.trackDefaults.has(trackId)) {
|
|
891
|
+
this.assertRetainedEntryCapacity(this.trackDefaults.size, 'MP4 track-default');
|
|
892
|
+
}
|
|
893
|
+
this.trackDefaults.set(trackId, {
|
|
787
894
|
duration: Token.UINT32_BE.get(data, 12),
|
|
788
895
|
size: Token.UINT32_BE.get(data, 16)
|
|
789
896
|
});
|
|
@@ -796,6 +903,7 @@ export class MP4Parser extends BasicParser {
|
|
|
796
903
|
const range = { offset: this.tokenizer.position, end: this.tokenizer.position + len };
|
|
797
904
|
if (this.options.includeChapters) {
|
|
798
905
|
if (supportsSeeking(this.tokenizer)) {
|
|
906
|
+
this.assertRetainedEntryCapacity(this.mediaDataRanges.length, 'MP4 media-data range');
|
|
799
907
|
this.mediaDataRanges.push(range);
|
|
800
908
|
}
|
|
801
909
|
else {
|
|
@@ -808,6 +916,10 @@ export class MP4Parser extends BasicParser {
|
|
|
808
916
|
if (len < 8 || len % AtomToken.ftyp.len !== 0) {
|
|
809
917
|
throw new Mp4ContentError(`Invalid ftyp payload length: ${len}`);
|
|
810
918
|
}
|
|
919
|
+
const typeCount = len / AtomToken.ftyp.len;
|
|
920
|
+
if (typeCount > getMaxMetadataEntries(this.options)) {
|
|
921
|
+
throw new Mp4ContentError(`ftyp entry count ${typeCount} exceeds entry limit ${getMaxMetadataEntries(this.options)}`);
|
|
922
|
+
}
|
|
811
923
|
const types = [];
|
|
812
924
|
while (len > 0) {
|
|
813
925
|
const ftype = await this.readToken(AtomToken.ftyp);
|
|
@@ -818,7 +930,7 @@ export class MP4Parser extends BasicParser {
|
|
|
818
930
|
}
|
|
819
931
|
}
|
|
820
932
|
debug(`ftyp: ${types.join('/')}`);
|
|
821
|
-
const x = types
|
|
933
|
+
const x = [...new Set(types)].join('/');
|
|
822
934
|
this.metadata.setFormat('container', x);
|
|
823
935
|
},
|
|
824
936
|
date: async (len) => {
|
|
@@ -846,6 +958,15 @@ export class MP4Parser extends BasicParser {
|
|
|
846
958
|
// Sound Sample Description (Version 0)
|
|
847
959
|
if (description.length >= offset + AtomToken.SoundSampleDescriptionV0.len) {
|
|
848
960
|
ssd.description = AtomToken.SoundSampleDescriptionV0.get(description, offset);
|
|
961
|
+
if (ssd.dataFormat === 'mp4a') {
|
|
962
|
+
const childOffset = offset + AtomToken.SoundSampleDescriptionV0.len + (version.version === 1 ? 16 : 0);
|
|
963
|
+
if (childOffset > description.length) {
|
|
964
|
+
throw new Mp4ContentError('Truncated mp4a sound sample description');
|
|
965
|
+
}
|
|
966
|
+
if (this.readAudioObjectType(description, childOffset) === 36) {
|
|
967
|
+
ssd.encoder = { format: 'MPEG-4/ALS', lossy: false };
|
|
968
|
+
}
|
|
969
|
+
}
|
|
849
970
|
}
|
|
850
971
|
else {
|
|
851
972
|
debug(`Warning: sound-sample-description too short: ${description.length} bytes`);
|
|
@@ -857,6 +978,109 @@ export class MP4Parser extends BasicParser {
|
|
|
857
978
|
}
|
|
858
979
|
return ssd;
|
|
859
980
|
}
|
|
981
|
+
/** Read codec configuration only inside the bounded AudioSampleEntry child boxes. */
|
|
982
|
+
readAudioObjectType(data, offset) {
|
|
983
|
+
while (offset < data.length) {
|
|
984
|
+
this.reserveAtom();
|
|
985
|
+
if (data.length - offset < 8) {
|
|
986
|
+
throw new Mp4ContentError('Truncated mp4a child box header');
|
|
987
|
+
}
|
|
988
|
+
let size = Token.UINT32_BE.get(data, offset);
|
|
989
|
+
const name = AtomToken.Header.get(data, offset).name;
|
|
990
|
+
let headerSize = 8;
|
|
991
|
+
if (size === 1) {
|
|
992
|
+
if (data.length - offset < 16) {
|
|
993
|
+
throw new Mp4ContentError('Truncated mp4a extended child box header');
|
|
994
|
+
}
|
|
995
|
+
const extendedSize = Token.UINT64_BE.get(data, offset + 8);
|
|
996
|
+
if (extendedSize > BigInt(data.length - offset)) {
|
|
997
|
+
throw new Mp4ContentError('mp4a child box exceeds sample entry');
|
|
998
|
+
}
|
|
999
|
+
size = Number(extendedSize);
|
|
1000
|
+
headerSize = 16;
|
|
1001
|
+
}
|
|
1002
|
+
else if (size === 0) {
|
|
1003
|
+
size = data.length - offset;
|
|
1004
|
+
}
|
|
1005
|
+
if (size < headerSize || size > data.length - offset) {
|
|
1006
|
+
throw new Mp4ContentError('Invalid mp4a child box size');
|
|
1007
|
+
}
|
|
1008
|
+
if (name === 'esds') {
|
|
1009
|
+
return this.readEsdsAudioObjectType(data.subarray(offset + headerSize, offset + size));
|
|
1010
|
+
}
|
|
1011
|
+
offset += size;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
/** ISO/IEC 14496-1 descriptor sizes have at most four base-128 bytes. */
|
|
1015
|
+
*readDescriptors(data, offset) {
|
|
1016
|
+
while (offset < data.length) {
|
|
1017
|
+
this.reserveAtom();
|
|
1018
|
+
const tag = data[offset++];
|
|
1019
|
+
let size = 0;
|
|
1020
|
+
for (let i = 0;; i++) {
|
|
1021
|
+
if (offset >= data.length || i === 4) {
|
|
1022
|
+
throw new Mp4ContentError('Truncated or invalid MPEG-4 descriptor length');
|
|
1023
|
+
}
|
|
1024
|
+
const byte = data[offset++];
|
|
1025
|
+
size = (size << 7) | (byte & 0x7f);
|
|
1026
|
+
if (!(byte & 0x80)) {
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (size > data.length - offset) {
|
|
1031
|
+
throw new Mp4ContentError('MPEG-4 descriptor exceeds its parent');
|
|
1032
|
+
}
|
|
1033
|
+
yield { tag, body: data.subarray(offset, offset + size) };
|
|
1034
|
+
offset += size;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
readEsdsAudioObjectType(data) {
|
|
1038
|
+
if (data.length < 4) {
|
|
1039
|
+
throw new Mp4ContentError('Truncated esds full-box header');
|
|
1040
|
+
}
|
|
1041
|
+
for (const es of this.readDescriptors(data, 4)) {
|
|
1042
|
+
if (es.tag !== 3) {
|
|
1043
|
+
continue;
|
|
1044
|
+
}
|
|
1045
|
+
if (es.body.length < 3) {
|
|
1046
|
+
throw new Mp4ContentError('Truncated ES descriptor');
|
|
1047
|
+
}
|
|
1048
|
+
const flags = es.body[2];
|
|
1049
|
+
let offset = 3 + (flags & 0x80 ? 2 : 0);
|
|
1050
|
+
if (flags & 0x40) {
|
|
1051
|
+
if (offset >= es.body.length) {
|
|
1052
|
+
throw new Mp4ContentError('Truncated ES URL length');
|
|
1053
|
+
}
|
|
1054
|
+
offset += 1 + es.body[offset];
|
|
1055
|
+
}
|
|
1056
|
+
offset += flags & 0x20 ? 2 : 0;
|
|
1057
|
+
if (offset > es.body.length) {
|
|
1058
|
+
throw new Mp4ContentError('Truncated optional ES descriptor fields');
|
|
1059
|
+
}
|
|
1060
|
+
for (const decoder of this.readDescriptors(es.body, offset)) {
|
|
1061
|
+
if (decoder.tag !== 4) {
|
|
1062
|
+
continue;
|
|
1063
|
+
}
|
|
1064
|
+
if (decoder.body.length < 13) {
|
|
1065
|
+
throw new Mp4ContentError('Truncated decoder configuration');
|
|
1066
|
+
}
|
|
1067
|
+
// AudioSpecificConfig is defined for MPEG-4 Audio (0x40), stream type Audio (5).
|
|
1068
|
+
if (decoder.body[0] !== 0x40 || decoder.body[1] >>> 2 !== 5) {
|
|
1069
|
+
continue;
|
|
1070
|
+
}
|
|
1071
|
+
for (const specific of this.readDescriptors(decoder.body, 13)) {
|
|
1072
|
+
if (specific.tag !== 5) {
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
if (specific.body.length === 0 || (specific.body[0] >>> 3 === 31 && specific.body.length < 2)) {
|
|
1076
|
+
throw new Mp4ContentError('Truncated AudioSpecificConfig object type');
|
|
1077
|
+
}
|
|
1078
|
+
const type = specific.body[0] >>> 3;
|
|
1079
|
+
return type === 31 ? 32 + ((specific.body[0] & 7) << 3) + (specific.body[1] >>> 5) : type;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
860
1084
|
async parseChapters(mediaDataRanges, forwardOnly = false) {
|
|
861
1085
|
for (const track of this.tracks.values()) {
|
|
862
1086
|
for (const id of track.chapterList ?? []) {
|
|
@@ -883,9 +1107,13 @@ export class MP4Parser extends BasicParser {
|
|
|
883
1107
|
}
|
|
884
1108
|
}
|
|
885
1109
|
async parseChapterTrack(chapterTrack, track, mediaDataRanges, forwardOnly) {
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
|
|
1110
|
+
const timeScale = chapterTrack.media.header?.timeScale;
|
|
1111
|
+
if (timeScale === undefined || timeScale <= 0) {
|
|
1112
|
+
throw new Mp4ContentError('Invalid chapter track timescale');
|
|
1113
|
+
}
|
|
1114
|
+
const sampleCount = Math.min(chapterTrack.sampleCount, this.maxChapterCount);
|
|
1115
|
+
if (chapterTrack.sampleCount > this.maxChapterCount) {
|
|
1116
|
+
this.addWarning(`Chapter count exceeds the ${this.maxChapterCount} chapter limit`);
|
|
889
1117
|
}
|
|
890
1118
|
if (forwardOnly) {
|
|
891
1119
|
this.streamedChapterCount = sampleCount;
|
|
@@ -934,13 +1162,14 @@ export class MP4Parser extends BasicParser {
|
|
|
934
1162
|
: await this.readToken(new AtomToken.ChapterText(size), offset);
|
|
935
1163
|
const chapter = {
|
|
936
1164
|
title,
|
|
937
|
-
timeScale
|
|
1165
|
+
timeScale,
|
|
938
1166
|
start
|
|
939
1167
|
};
|
|
940
1168
|
if (track.chunkOffsetTable.length > 0 &&
|
|
941
1169
|
track.sampleToChunkTable.length > 0 &&
|
|
942
1170
|
track.timeToSampleTable.length > 0) {
|
|
943
|
-
|
|
1171
|
+
track.chapterSampleLookup ??= this.createSampleOffsetLookup(track);
|
|
1172
|
+
chapter.sampleOffset = track.chapterSampleLookup(offset + size);
|
|
944
1173
|
}
|
|
945
1174
|
if (forwardOnly) {
|
|
946
1175
|
this.streamedChapters.set(sampleIndex, chapter);
|
|
@@ -966,14 +1195,8 @@ export class MP4Parser extends BasicParser {
|
|
|
966
1195
|
this.metadata.setFormat('chapters', [...this.streamedChapters].sort(([left], [right]) => left - right).map(([, chapter]) => chapter));
|
|
967
1196
|
}
|
|
968
1197
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
while (chunkIndex < track.chunkOffsetTable.length && track.chunkOffsetTable[chunkIndex] < chapterOffset) {
|
|
972
|
-
++chunkIndex;
|
|
973
|
-
}
|
|
974
|
-
return this.getChunkDuration(chunkIndex + 1, track);
|
|
975
|
-
}
|
|
976
|
-
getChunkDuration(chunkId, track) {
|
|
1198
|
+
/** Advance across monotone queries; restart for backward queries without sorting file tables. */
|
|
1199
|
+
createSampleOffsetLookup(track) {
|
|
977
1200
|
let previousChunk = 0;
|
|
978
1201
|
for (const entry of track.sampleToChunkTable) {
|
|
979
1202
|
if ((previousChunk === 0 && entry.firstChunk !== 1) ||
|
|
@@ -983,15 +1206,30 @@ export class MP4Parser extends BasicParser {
|
|
|
983
1206
|
}
|
|
984
1207
|
previousChunk = entry.firstChunk;
|
|
985
1208
|
}
|
|
1209
|
+
let chunkIndex = 0;
|
|
1210
|
+
let chunkId = 1;
|
|
1211
|
+
let chunkRun = 0;
|
|
986
1212
|
let timingIndex = 0;
|
|
987
1213
|
let remainingSamples = 0;
|
|
988
1214
|
let sampleDuration = 0;
|
|
989
1215
|
let totalDuration = 0;
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1216
|
+
let previousOffset = Number.NEGATIVE_INFINITY;
|
|
1217
|
+
return chapterOffset => {
|
|
1218
|
+
if (chapterOffset < previousOffset) {
|
|
1219
|
+
chunkIndex = chunkRun = timingIndex = remainingSamples = sampleDuration = totalDuration = 0;
|
|
1220
|
+
chunkId = 1;
|
|
1221
|
+
}
|
|
1222
|
+
previousOffset = chapterOffset;
|
|
1223
|
+
// Earlier rejected offsets remain below any later query, even in an unordered table.
|
|
1224
|
+
while (chunkIndex < track.chunkOffsetTable.length && track.chunkOffsetTable[chunkIndex] < chapterOffset) {
|
|
1225
|
+
++chunkIndex;
|
|
1226
|
+
}
|
|
1227
|
+
const targetChunk = chunkIndex + 1;
|
|
1228
|
+
for (; chunkId < targetChunk; ++chunkId) {
|
|
1229
|
+
while (track.sampleToChunkTable[chunkRun + 1]?.firstChunk <= chunkId) {
|
|
1230
|
+
++chunkRun;
|
|
1231
|
+
}
|
|
1232
|
+
let samplesPerChunk = track.sampleToChunkTable[chunkRun].samplesPerChunk;
|
|
995
1233
|
while (samplesPerChunk > 0) {
|
|
996
1234
|
while (remainingSamples === 0) {
|
|
997
1235
|
const timing = track.timeToSampleTable[timingIndex++];
|
|
@@ -1010,7 +1248,7 @@ export class MP4Parser extends BasicParser {
|
|
|
1010
1248
|
samplesPerChunk -= samples;
|
|
1011
1249
|
}
|
|
1012
1250
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1251
|
+
return totalDuration;
|
|
1252
|
+
};
|
|
1015
1253
|
}
|
|
1016
1254
|
}
|