@blockcast/mmt-container 0.3.0 → 0.4.0-main.d6f2737828fc
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/README.md +22 -8
- package/dist/browser-runtime.js +1185 -1049
- package/dist/browser-runtime.js.map +4 -4
- package/dist/carp-catalog.d.ts +24 -8
- package/dist/carp-catalog.d.ts.map +1 -1
- package/dist/carp-catalog.js +21 -8
- package/dist/carp-catalog.js.map +2 -2
- package/dist/catalog-fec-params.d.ts +88 -28
- package/dist/catalog-fec-params.d.ts.map +1 -1
- package/dist/catalog-fec-params.js +59 -17
- package/dist/catalog-fec-params.js.map +3 -3
- package/dist/catalog-network-source.js +0 -1
- package/dist/catalog-network-source.js.map +2 -2
- package/dist/cmaf-block-assembler.d.ts +0 -2
- package/dist/cmaf-block-assembler.d.ts.map +1 -1
- package/dist/cmaf-block-assembler.js +0 -1
- package/dist/cmaf-block-assembler.js.map +2 -2
- package/dist/delta-fallback-config.d.ts +42 -0
- package/dist/delta-fallback-config.d.ts.map +1 -0
- package/dist/delta-fallback-config.js +59 -0
- package/dist/delta-fallback-config.js.map +7 -0
- package/dist/fec-manager.d.ts +35 -26
- package/dist/fec-manager.d.ts.map +1 -1
- package/dist/fec-manager.js +300 -273
- package/dist/fec-manager.js.map +2 -2
- package/dist/fec-state.d.ts +19 -31
- package/dist/fec-state.d.ts.map +1 -1
- package/dist/fec-state.js +3 -4
- package/dist/fec-state.js.map +2 -2
- package/dist/fec-worker-setup.d.ts +16 -6
- package/dist/fec-worker-setup.d.ts.map +1 -1
- package/dist/fec-worker-setup.js +72 -34
- package/dist/fec-worker-setup.js.map +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +2 -2
- package/dist/iso-block-locator.js +0 -1
- package/dist/iso-block-locator.js.map +2 -2
- package/dist/media-router.d.ts +20 -8
- package/dist/media-router.d.ts.map +1 -1
- package/dist/media-router.js +46 -21
- package/dist/media-router.js.map +2 -2
- package/dist/mfu-reassembler.js +0 -1
- package/dist/mfu-reassembler.js.map +2 -2
- package/dist/mmtp-container-parser.d.ts +5 -0
- package/dist/mmtp-container-parser.d.ts.map +1 -1
- package/dist/mmtp-container-parser.js +22 -1
- package/dist/mmtp-container-parser.js.map +2 -2
- package/dist/mmtp-container-parser.no-modules.js +37 -9
- package/dist/mmtp-container-parser.no-modules.js.map +2 -2
- package/dist/mmtp-decode-pipeline.js +22 -1
- package/dist/mmtp-decode-pipeline.js.map +2 -2
- package/dist/mmtp-router.d.ts +36 -16
- package/dist/mmtp-router.d.ts.map +1 -1
- package/dist/mmtp-router.js +126 -213
- package/dist/mmtp-router.js.map +2 -2
- package/dist/multicast-input.js +0 -1
- package/dist/multicast-input.js.map +2 -2
- package/dist/multicast-manager.d.ts +33 -3
- package/dist/multicast-manager.d.ts.map +1 -1
- package/dist/multicast-manager.js +660 -529
- package/dist/multicast-manager.js.map +4 -4
- package/dist/multicast-transport.d.ts +1 -1
- package/dist/multicast-transport.d.ts.map +1 -1
- package/dist/multicast-transport.js +42 -14
- package/dist/multicast-transport.js.map +3 -3
- package/dist/multicast-unwrap.js +0 -1
- package/dist/multicast-unwrap.js.map +2 -2
- package/dist/no-modules.js +36 -8
- package/dist/no-modules.js.map +2 -2
- package/dist/repair-fetch.d.ts +30 -19
- package/dist/repair-fetch.d.ts.map +1 -1
- package/dist/repair-fetch.js +32 -18
- package/dist/repair-fetch.js.map +3 -3
- package/dist/repair-layers.d.ts +18 -7
- package/dist/repair-layers.d.ts.map +1 -1
- package/dist/repair-layers.js +11 -4
- package/dist/repair-layers.js.map +2 -2
- package/dist/signaling.js +0 -4
- package/dist/signaling.js.map +2 -2
- package/dist/timestamp-codec.js +0 -1
- package/dist/timestamp-codec.js.map +2 -2
- package/dist/track-session.d.ts +7 -0
- package/dist/track-session.d.ts.map +1 -1
- package/dist/track-session.js +15 -8
- package/dist/track-session.js.map +2 -2
- package/dist/wasm-mfu-reassembler.js +0 -1
- package/dist/wasm-mfu-reassembler.js.map +2 -2
- package/dist/wasm-mmtp-container-parser.js +22 -1
- package/dist/wasm-mmtp-container-parser.js.map +2 -2
- package/package.json +8 -14
- package/schemas/catalog.schema.json +3 -3
- package/src/carp-catalog.ts +35 -13
- package/src/catalog-fec-params.ts +173 -64
- package/src/cmaf-block-assembler.ts +1 -4
- package/src/delta-fallback-config.ts +72 -0
- package/src/fec-manager.ts +413 -317
- package/src/fec-state.ts +20 -32
- package/src/fec-worker-setup.ts +105 -55
- package/src/index.ts +10 -0
- package/src/media-router.ts +59 -21
- package/src/mmtp-container-parser.ts +26 -0
- package/src/mmtp-router.ts +145 -303
- package/src/multicast-manager.ts +172 -60
- package/src/multicast-transport.ts +16 -9
- package/src/repair-fetch.ts +46 -27
- package/src/repair-layers.ts +28 -8
- package/src/track-session.ts +28 -9
- package/test-vectors/catalog/README.md +34 -17
- package/test-vectors/catalog/negative/fec-block-profile-retired.json +52 -0
- package/test-vectors/catalog/negative/fec-enhancement-repair-removed.json +1 -1
- package/test-vectors/catalog/negative/fec-repair-layer-geometry.json +1 -1
- package/test-vectors/catalog/negative/fec-repair-layer-missing-symbols.json +1 -1
- package/test-vectors/catalog/negative/fec-repair-multiple-depends.json +1 -1
- package/test-vectors/catalog/negative/fec-repair-overlay-with-layer.json +1 -1
- package/test-vectors/catalog/negative/fec-repair-priority-out-of-band.json +1 -1
- package/test-vectors/catalog/negative/fec-repair-source-symbols-without-scope.json +1 -1
- package/test-vectors/catalog/negative/multicast-network-source-empty.json +1 -1
- package/test-vectors/catalog/negative/raptorq-source-symbols-over-max.json +1 -1
- package/test-vectors/catalog/negative/raptorq-unaligned-symbol.json +1 -1
- package/test-vectors/catalog/positive/fec-layered-repair.json +2 -2
- package/test-vectors/catalog/positive/fec-multicast.json +2 -1
- package/test-vectors/catalog/positive/multicast-native-ssm-no-network-source.json +2 -1
- package/test-vectors/catalog-timing.json +356 -0
- package/test-vectors/catalog-validation.json +40 -5
- package/node_modules/@blockcast/fec-worker/README.md +0 -223
- package/node_modules/@blockcast/fec-worker/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/fec-worker/dist/block-order.d.ts +0 -38
- package/node_modules/@blockcast/fec-worker/dist/block-order.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/block-order.js +0 -78
- package/node_modules/@blockcast/fec-worker/dist/block-order.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts +0 -93
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js +0 -346
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-client.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts +0 -380
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.js +0 -11
- package/node_modules/@blockcast/fec-worker/dist/fec-worker-types.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.d.ts +0 -14
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.js +0 -859
- package/node_modules/@blockcast/fec-worker/dist/fec-worker.js.map +0 -7
- package/node_modules/@blockcast/fec-worker/dist/index.d.ts +0 -10
- package/node_modules/@blockcast/fec-worker/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/index.js +0 -8
- package/node_modules/@blockcast/fec-worker/dist/index.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.d.ts +0 -20
- package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.js +0 -370
- package/node_modules/@blockcast/fec-worker/dist/shred-fec-worker.js.map +0 -7
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.d.ts +0 -104
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.js +0 -181
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-client.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.d.ts +0 -194
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.js +0 -62
- package/node_modules/@blockcast/fec-worker/dist/shred-worker-types.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/transfer.d.ts +0 -9
- package/node_modules/@blockcast/fec-worker/dist/transfer.d.ts.map +0 -1
- package/node_modules/@blockcast/fec-worker/dist/transfer.js +0 -13
- package/node_modules/@blockcast/fec-worker/dist/transfer.js.map +0 -1
- package/node_modules/@blockcast/fec-worker/package.json +0 -59
- package/node_modules/@blockcast/fec-worker/src/block-order.ts +0 -93
- package/node_modules/@blockcast/fec-worker/src/fec-worker-client.ts +0 -392
- package/node_modules/@blockcast/fec-worker/src/fec-worker-types.ts +0 -399
- package/node_modules/@blockcast/fec-worker/src/fec-worker.ts +0 -1502
- package/node_modules/@blockcast/fec-worker/src/index.ts +0 -35
- package/node_modules/@blockcast/fec-worker/src/shred-fec-worker.ts +0 -589
- package/node_modules/@blockcast/fec-worker/src/shred-worker-client.ts +0 -222
- package/node_modules/@blockcast/fec-worker/src/shred-worker-types.ts +0 -209
- package/node_modules/@blockcast/fec-worker/src/transfer.ts +0 -12
- package/node_modules/@blockcast/mmt-alta-parse/README.md +0 -181
- package/node_modules/@blockcast/mmt-alta-parse/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts +0 -57
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.js +0 -115
- package/node_modules/@blockcast/mmt-alta-parse/dist/index.js.map +0 -1
- package/node_modules/@blockcast/mmt-alta-parse/package.json +0 -50
- package/node_modules/@blockcast/mmt-alta-parse/src/index.ts +0 -136
- package/node_modules/@blockcast/mmt-base/README.md +0 -134
- package/node_modules/@blockcast/mmt-base/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts +0 -55
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js +0 -128
- package/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/index.d.ts +0 -7
- package/node_modules/@blockcast/mmt-base/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/index.js +0 -7
- package/node_modules/@blockcast/mmt-base/dist/index.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +0 -292
- package/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/mmtp.js +0 -612
- package/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts +0 -18
- package/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/net-constants.js +0 -18
- package/node_modules/@blockcast/mmt-base/dist/net-constants.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts +0 -47
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.js +0 -54
- package/node_modules/@blockcast/mmt-base/dist/ntp-short.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts +0 -57
- package/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/serial-number.js +0 -98
- package/node_modules/@blockcast/mmt-base/dist/serial-number.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/signalling.d.ts +0 -312
- package/node_modules/@blockcast/mmt-base/dist/signalling.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-base/dist/signalling.js +0 -637
- package/node_modules/@blockcast/mmt-base/dist/signalling.js.map +0 -1
- package/node_modules/@blockcast/mmt-base/package.json +0 -49
- package/node_modules/@blockcast/mmt-base/src/fec-block-profile.ts +0 -145
- package/node_modules/@blockcast/mmt-base/src/index.ts +0 -6
- package/node_modules/@blockcast/mmt-base/src/mmtp.ts +0 -892
- package/node_modules/@blockcast/mmt-base/src/net-constants.ts +0 -17
- package/node_modules/@blockcast/mmt-base/src/ntp-short.ts +0 -67
- package/node_modules/@blockcast/mmt-base/src/serial-number.ts +0 -107
- package/node_modules/@blockcast/mmt-base/src/signalling.ts +0 -862
- package/node_modules/@blockcast/mmt-fec/README.md +0 -271
- package/node_modules/@blockcast/mmt-fec/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts +0 -82
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.js +0 -296
- package/node_modules/@blockcast/mmt-fec/dist/block-manager.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/block-processor.d.ts +0 -106
- package/node_modules/@blockcast/mmt-fec/dist/block-processor.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/block-processor.js +0 -288
- package/node_modules/@blockcast/mmt-fec/dist/block-processor.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.d.ts +0 -46
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.js +0 -96
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-recovery.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.d.ts +0 -33
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.js +0 -57
- package/node_modules/@blockcast/mmt-fec/dist/cmaf-symbols.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.d.ts +0 -205
- package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.js +0 -240
- package/node_modules/@blockcast/mmt-fec/dist/fec-block-mapper.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/index.d.ts +0 -28
- package/node_modules/@blockcast/mmt-fec/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/index.js +0 -28
- package/node_modules/@blockcast/mmt-fec/dist/index.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.d.ts +0 -20
- package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.js +0 -28
- package/node_modules/@blockcast/mmt-fec/dist/loc-symbols.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts +0 -258
- package/node_modules/@blockcast/mmt-fec/dist/oti.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/oti.js +0 -382
- package/node_modules/@blockcast/mmt-fec/dist/oti.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.d.ts +0 -41
- package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.js +0 -81
- package/node_modules/@blockcast/mmt-fec/dist/reorder-buffer.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/repair-group.d.ts +0 -82
- package/node_modules/@blockcast/mmt-fec/dist/repair-group.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/dist/repair-group.js +0 -170
- package/node_modules/@blockcast/mmt-fec/dist/repair-group.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/README.md +0 -181
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts +0 -57
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.js +0 -115
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/dist/index.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/package.json +0 -50
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-alta-parse/src/index.ts +0 -136
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/README.md +0 -134
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts +0 -55
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/fec-block-profile.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js +0 -128
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/fec-block-profile.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.d.ts +0 -7
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.js +0 -7
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/index.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts +0 -292
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.js +0 -612
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/mmtp.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts +0 -18
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/net-constants.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/net-constants.js +0 -18
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/net-constants.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts +0 -47
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/ntp-short.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/ntp-short.js +0 -54
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/ntp-short.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts +0 -57
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/serial-number.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/serial-number.js +0 -98
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/serial-number.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/signalling.d.ts +0 -312
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/signalling.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/signalling.js +0 -637
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/dist/signalling.js.map +0 -1
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/package.json +0 -49
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/fec-block-profile.ts +0 -145
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/index.ts +0 -6
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/mmtp.ts +0 -892
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/net-constants.ts +0 -17
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/ntp-short.ts +0 -67
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/serial-number.ts +0 -107
- package/node_modules/@blockcast/mmt-fec/node_modules/@blockcast/mmt-base/src/signalling.ts +0 -862
- package/node_modules/@blockcast/mmt-fec/package.json +0 -79
- package/node_modules/@blockcast/mmt-fec/src/block-manager.ts +0 -371
- package/node_modules/@blockcast/mmt-fec/src/block-processor.ts +0 -439
- package/node_modules/@blockcast/mmt-fec/src/cmaf-recovery.ts +0 -127
- package/node_modules/@blockcast/mmt-fec/src/cmaf-symbols.ts +0 -68
- package/node_modules/@blockcast/mmt-fec/src/fec-block-mapper.ts +0 -310
- package/node_modules/@blockcast/mmt-fec/src/index.ts +0 -94
- package/node_modules/@blockcast/mmt-fec/src/loc-symbols.ts +0 -34
- package/node_modules/@blockcast/mmt-fec/src/oti.ts +0 -463
- package/node_modules/@blockcast/mmt-fec/src/reorder-buffer.ts +0 -101
- package/node_modules/@blockcast/mmt-fec/src/repair-group.ts +0 -195
- package/node_modules/@blockcast/mmt-manifest-verify/dist/.build-stamp +0 -0
- package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.d.ts +0 -28
- package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.js +0 -128
- package/node_modules/@blockcast/mmt-manifest-verify/dist/admission.js.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/index.d.ts +0 -4
- package/node_modules/@blockcast/mmt-manifest-verify/dist/index.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/index.js +0 -4
- package/node_modules/@blockcast/mmt-manifest-verify/dist/index.js.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.d.ts +0 -37
- package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.js +0 -179
- package/node_modules/@blockcast/mmt-manifest-verify/dist/source-auth.js.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts +0 -99
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.d.ts.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js +0 -492
- package/node_modules/@blockcast/mmt-manifest-verify/dist/verifier.js.map +0 -1
- package/node_modules/@blockcast/mmt-manifest-verify/package.json +0 -45
- package/node_modules/@blockcast/mmt-manifest-verify/src/admission.ts +0 -171
- package/node_modules/@blockcast/mmt-manifest-verify/src/index.ts +0 -3
- package/node_modules/@blockcast/mmt-manifest-verify/src/source-auth.ts +0 -230
- package/node_modules/@blockcast/mmt-manifest-verify/src/verifier.ts +0 -669
- package/node_modules/@noble/hashes/LICENSE +0 -21
- package/node_modules/@noble/hashes/README.md +0 -521
- package/node_modules/@noble/hashes/_assert.d.ts +0 -17
- package/node_modules/@noble/hashes/_assert.d.ts.map +0 -1
- package/node_modules/@noble/hashes/_assert.js +0 -18
- package/node_modules/@noble/hashes/_assert.js.map +0 -1
- package/node_modules/@noble/hashes/_blake.d.ts +0 -14
- package/node_modules/@noble/hashes/_blake.d.ts.map +0 -1
- package/node_modules/@noble/hashes/_blake.js +0 -50
- package/node_modules/@noble/hashes/_blake.js.map +0 -1
- package/node_modules/@noble/hashes/_md.d.ts +0 -51
- package/node_modules/@noble/hashes/_md.d.ts.map +0 -1
- package/node_modules/@noble/hashes/_md.js +0 -162
- package/node_modules/@noble/hashes/_md.js.map +0 -1
- package/node_modules/@noble/hashes/_u64.d.ts +0 -55
- package/node_modules/@noble/hashes/_u64.d.ts.map +0 -1
- package/node_modules/@noble/hashes/_u64.js +0 -90
- package/node_modules/@noble/hashes/_u64.js.map +0 -1
- package/node_modules/@noble/hashes/argon2.d.ts +0 -32
- package/node_modules/@noble/hashes/argon2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/argon2.js +0 -401
- package/node_modules/@noble/hashes/argon2.js.map +0 -1
- package/node_modules/@noble/hashes/blake1.d.ts +0 -106
- package/node_modules/@noble/hashes/blake1.d.ts.map +0 -1
- package/node_modules/@noble/hashes/blake1.js +0 -459
- package/node_modules/@noble/hashes/blake1.js.map +0 -1
- package/node_modules/@noble/hashes/blake2.d.ts +0 -116
- package/node_modules/@noble/hashes/blake2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/blake2.js +0 -420
- package/node_modules/@noble/hashes/blake2.js.map +0 -1
- package/node_modules/@noble/hashes/blake2b.d.ts +0 -11
- package/node_modules/@noble/hashes/blake2b.d.ts.map +0 -1
- package/node_modules/@noble/hashes/blake2b.js +0 -14
- package/node_modules/@noble/hashes/blake2b.js.map +0 -1
- package/node_modules/@noble/hashes/blake2s.d.ts +0 -20
- package/node_modules/@noble/hashes/blake2s.d.ts.map +0 -1
- package/node_modules/@noble/hashes/blake2s.js +0 -24
- package/node_modules/@noble/hashes/blake2s.js.map +0 -1
- package/node_modules/@noble/hashes/blake3.d.ts +0 -54
- package/node_modules/@noble/hashes/blake3.d.ts.map +0 -1
- package/node_modules/@noble/hashes/blake3.js +0 -255
- package/node_modules/@noble/hashes/blake3.js.map +0 -1
- package/node_modules/@noble/hashes/crypto.d.ts +0 -2
- package/node_modules/@noble/hashes/crypto.d.ts.map +0 -1
- package/node_modules/@noble/hashes/crypto.js +0 -5
- package/node_modules/@noble/hashes/crypto.js.map +0 -1
- package/node_modules/@noble/hashes/cryptoNode.d.ts +0 -2
- package/node_modules/@noble/hashes/cryptoNode.d.ts.map +0 -1
- package/node_modules/@noble/hashes/cryptoNode.js +0 -18
- package/node_modules/@noble/hashes/cryptoNode.js.map +0 -1
- package/node_modules/@noble/hashes/eskdf.d.ts +0 -47
- package/node_modules/@noble/hashes/eskdf.d.ts.map +0 -1
- package/node_modules/@noble/hashes/eskdf.js +0 -166
- package/node_modules/@noble/hashes/eskdf.js.map +0 -1
- package/node_modules/@noble/hashes/esm/_assert.d.ts +0 -17
- package/node_modules/@noble/hashes/esm/_assert.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/_assert.js +0 -15
- package/node_modules/@noble/hashes/esm/_assert.js.map +0 -1
- package/node_modules/@noble/hashes/esm/_blake.d.ts +0 -14
- package/node_modules/@noble/hashes/esm/_blake.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/_blake.js +0 -45
- package/node_modules/@noble/hashes/esm/_blake.js.map +0 -1
- package/node_modules/@noble/hashes/esm/_md.d.ts +0 -51
- package/node_modules/@noble/hashes/esm/_md.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/_md.js +0 -155
- package/node_modules/@noble/hashes/esm/_md.js.map +0 -1
- package/node_modules/@noble/hashes/esm/_u64.d.ts +0 -55
- package/node_modules/@noble/hashes/esm/_u64.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/_u64.js +0 -67
- package/node_modules/@noble/hashes/esm/_u64.js.map +0 -1
- package/node_modules/@noble/hashes/esm/argon2.d.ts +0 -32
- package/node_modules/@noble/hashes/esm/argon2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/argon2.js +0 -392
- package/node_modules/@noble/hashes/esm/argon2.js.map +0 -1
- package/node_modules/@noble/hashes/esm/blake1.d.ts +0 -106
- package/node_modules/@noble/hashes/esm/blake1.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/blake1.js +0 -452
- package/node_modules/@noble/hashes/esm/blake1.js.map +0 -1
- package/node_modules/@noble/hashes/esm/blake2.d.ts +0 -116
- package/node_modules/@noble/hashes/esm/blake2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/blake2.js +0 -413
- package/node_modules/@noble/hashes/esm/blake2.js.map +0 -1
- package/node_modules/@noble/hashes/esm/blake2b.d.ts +0 -11
- package/node_modules/@noble/hashes/esm/blake2b.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/blake2b.js +0 -11
- package/node_modules/@noble/hashes/esm/blake2b.js.map +0 -1
- package/node_modules/@noble/hashes/esm/blake2s.d.ts +0 -20
- package/node_modules/@noble/hashes/esm/blake2s.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/blake2s.js +0 -21
- package/node_modules/@noble/hashes/esm/blake2s.js.map +0 -1
- package/node_modules/@noble/hashes/esm/blake3.d.ts +0 -54
- package/node_modules/@noble/hashes/esm/blake3.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/blake3.js +0 -251
- package/node_modules/@noble/hashes/esm/blake3.js.map +0 -1
- package/node_modules/@noble/hashes/esm/crypto.d.ts +0 -2
- package/node_modules/@noble/hashes/esm/crypto.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/crypto.js +0 -2
- package/node_modules/@noble/hashes/esm/crypto.js.map +0 -1
- package/node_modules/@noble/hashes/esm/cryptoNode.d.ts +0 -2
- package/node_modules/@noble/hashes/esm/cryptoNode.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/cryptoNode.js +0 -15
- package/node_modules/@noble/hashes/esm/cryptoNode.js.map +0 -1
- package/node_modules/@noble/hashes/esm/eskdf.d.ts +0 -47
- package/node_modules/@noble/hashes/esm/eskdf.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/eskdf.js +0 -160
- package/node_modules/@noble/hashes/esm/eskdf.js.map +0 -1
- package/node_modules/@noble/hashes/esm/hkdf.d.ts +0 -36
- package/node_modules/@noble/hashes/esm/hkdf.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/hkdf.js +0 -82
- package/node_modules/@noble/hashes/esm/hkdf.js.map +0 -1
- package/node_modules/@noble/hashes/esm/hmac.d.ts +0 -35
- package/node_modules/@noble/hashes/esm/hmac.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/hmac.js +0 -86
- package/node_modules/@noble/hashes/esm/hmac.js.map +0 -1
- package/node_modules/@noble/hashes/esm/index.d.ts +0 -2
- package/node_modules/@noble/hashes/esm/index.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/index.js +0 -33
- package/node_modules/@noble/hashes/esm/index.js.map +0 -1
- package/node_modules/@noble/hashes/esm/legacy.d.ts +0 -71
- package/node_modules/@noble/hashes/esm/legacy.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/legacy.js +0 -281
- package/node_modules/@noble/hashes/esm/legacy.js.map +0 -1
- package/node_modules/@noble/hashes/esm/package.json +0 -10
- package/node_modules/@noble/hashes/esm/pbkdf2.d.ts +0 -23
- package/node_modules/@noble/hashes/esm/pbkdf2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/pbkdf2.js +0 -97
- package/node_modules/@noble/hashes/esm/pbkdf2.js.map +0 -1
- package/node_modules/@noble/hashes/esm/ripemd160.d.ts +0 -13
- package/node_modules/@noble/hashes/esm/ripemd160.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/ripemd160.js +0 -13
- package/node_modules/@noble/hashes/esm/ripemd160.js.map +0 -1
- package/node_modules/@noble/hashes/esm/scrypt.d.ts +0 -34
- package/node_modules/@noble/hashes/esm/scrypt.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/scrypt.js +0 -228
- package/node_modules/@noble/hashes/esm/scrypt.js.map +0 -1
- package/node_modules/@noble/hashes/esm/sha1.d.ts +0 -11
- package/node_modules/@noble/hashes/esm/sha1.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/sha1.js +0 -11
- package/node_modules/@noble/hashes/esm/sha1.js.map +0 -1
- package/node_modules/@noble/hashes/esm/sha2.d.ts +0 -159
- package/node_modules/@noble/hashes/esm/sha2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/sha2.js +0 -375
- package/node_modules/@noble/hashes/esm/sha2.js.map +0 -1
- package/node_modules/@noble/hashes/esm/sha256.d.ts +0 -20
- package/node_modules/@noble/hashes/esm/sha256.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/sha256.js +0 -20
- package/node_modules/@noble/hashes/esm/sha256.js.map +0 -1
- package/node_modules/@noble/hashes/esm/sha3-addons.d.ts +0 -142
- package/node_modules/@noble/hashes/esm/sha3-addons.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/sha3-addons.js +0 -393
- package/node_modules/@noble/hashes/esm/sha3-addons.js.map +0 -1
- package/node_modules/@noble/hashes/esm/sha3.d.ts +0 -53
- package/node_modules/@noble/hashes/esm/sha3.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/sha3.js +0 -234
- package/node_modules/@noble/hashes/esm/sha3.js.map +0 -1
- package/node_modules/@noble/hashes/esm/sha512.d.ts +0 -26
- package/node_modules/@noble/hashes/esm/sha512.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/sha512.js +0 -26
- package/node_modules/@noble/hashes/esm/sha512.js.map +0 -1
- package/node_modules/@noble/hashes/esm/utils.d.ts +0 -161
- package/node_modules/@noble/hashes/esm/utils.d.ts.map +0 -1
- package/node_modules/@noble/hashes/esm/utils.js +0 -281
- package/node_modules/@noble/hashes/esm/utils.js.map +0 -1
- package/node_modules/@noble/hashes/hkdf.d.ts +0 -36
- package/node_modules/@noble/hashes/hkdf.d.ts.map +0 -1
- package/node_modules/@noble/hashes/hkdf.js +0 -88
- package/node_modules/@noble/hashes/hkdf.js.map +0 -1
- package/node_modules/@noble/hashes/hmac.d.ts +0 -35
- package/node_modules/@noble/hashes/hmac.d.ts.map +0 -1
- package/node_modules/@noble/hashes/hmac.js +0 -91
- package/node_modules/@noble/hashes/hmac.js.map +0 -1
- package/node_modules/@noble/hashes/index.d.ts +0 -1
- package/node_modules/@noble/hashes/index.d.ts.map +0 -1
- package/node_modules/@noble/hashes/index.js +0 -33
- package/node_modules/@noble/hashes/index.js.map +0 -1
- package/node_modules/@noble/hashes/legacy.d.ts +0 -71
- package/node_modules/@noble/hashes/legacy.d.ts.map +0 -1
- package/node_modules/@noble/hashes/legacy.js +0 -287
- package/node_modules/@noble/hashes/legacy.js.map +0 -1
- package/node_modules/@noble/hashes/package.json +0 -266
- package/node_modules/@noble/hashes/pbkdf2.d.ts +0 -23
- package/node_modules/@noble/hashes/pbkdf2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/pbkdf2.js +0 -101
- package/node_modules/@noble/hashes/pbkdf2.js.map +0 -1
- package/node_modules/@noble/hashes/ripemd160.d.ts +0 -13
- package/node_modules/@noble/hashes/ripemd160.d.ts.map +0 -1
- package/node_modules/@noble/hashes/ripemd160.js +0 -16
- package/node_modules/@noble/hashes/ripemd160.js.map +0 -1
- package/node_modules/@noble/hashes/scrypt.d.ts +0 -34
- package/node_modules/@noble/hashes/scrypt.d.ts.map +0 -1
- package/node_modules/@noble/hashes/scrypt.js +0 -232
- package/node_modules/@noble/hashes/scrypt.js.map +0 -1
- package/node_modules/@noble/hashes/sha1.d.ts +0 -11
- package/node_modules/@noble/hashes/sha1.d.ts.map +0 -1
- package/node_modules/@noble/hashes/sha1.js +0 -14
- package/node_modules/@noble/hashes/sha1.js.map +0 -1
- package/node_modules/@noble/hashes/sha2.d.ts +0 -159
- package/node_modules/@noble/hashes/sha2.d.ts.map +0 -1
- package/node_modules/@noble/hashes/sha2.js +0 -384
- package/node_modules/@noble/hashes/sha2.js.map +0 -1
- package/node_modules/@noble/hashes/sha256.d.ts +0 -20
- package/node_modules/@noble/hashes/sha256.d.ts.map +0 -1
- package/node_modules/@noble/hashes/sha256.js +0 -23
- package/node_modules/@noble/hashes/sha256.js.map +0 -1
- package/node_modules/@noble/hashes/sha3-addons.d.ts +0 -142
- package/node_modules/@noble/hashes/sha3-addons.d.ts.map +0 -1
- package/node_modules/@noble/hashes/sha3-addons.js +0 -402
- package/node_modules/@noble/hashes/sha3-addons.js.map +0 -1
- package/node_modules/@noble/hashes/sha3.d.ts +0 -53
- package/node_modules/@noble/hashes/sha3.d.ts.map +0 -1
- package/node_modules/@noble/hashes/sha3.js +0 -239
- package/node_modules/@noble/hashes/sha3.js.map +0 -1
- package/node_modules/@noble/hashes/sha512.d.ts +0 -26
- package/node_modules/@noble/hashes/sha512.d.ts.map +0 -1
- package/node_modules/@noble/hashes/sha512.js +0 -29
- package/node_modules/@noble/hashes/sha512.js.map +0 -1
- package/node_modules/@noble/hashes/src/_assert.ts +0 -22
- package/node_modules/@noble/hashes/src/_blake.ts +0 -50
- package/node_modules/@noble/hashes/src/_md.ts +0 -176
- package/node_modules/@noble/hashes/src/_u64.ts +0 -91
- package/node_modules/@noble/hashes/src/argon2.ts +0 -497
- package/node_modules/@noble/hashes/src/blake1.ts +0 -534
- package/node_modules/@noble/hashes/src/blake2.ts +0 -486
- package/node_modules/@noble/hashes/src/blake2b.ts +0 -10
- package/node_modules/@noble/hashes/src/blake2s.ts +0 -20
- package/node_modules/@noble/hashes/src/blake3.ts +0 -272
- package/node_modules/@noble/hashes/src/crypto.ts +0 -9
- package/node_modules/@noble/hashes/src/cryptoNode.ts +0 -15
- package/node_modules/@noble/hashes/src/eskdf.ts +0 -187
- package/node_modules/@noble/hashes/src/hkdf.ts +0 -88
- package/node_modules/@noble/hashes/src/hmac.ts +0 -94
- package/node_modules/@noble/hashes/src/index.ts +0 -31
- package/node_modules/@noble/hashes/src/legacy.ts +0 -293
- package/node_modules/@noble/hashes/src/pbkdf2.ts +0 -122
- package/node_modules/@noble/hashes/src/ripemd160.ts +0 -12
- package/node_modules/@noble/hashes/src/scrypt.ts +0 -257
- package/node_modules/@noble/hashes/src/sha1.ts +0 -10
- package/node_modules/@noble/hashes/src/sha2.ts +0 -402
- package/node_modules/@noble/hashes/src/sha256.ts +0 -24
- package/node_modules/@noble/hashes/src/sha3-addons.ts +0 -499
- package/node_modules/@noble/hashes/src/sha3.ts +0 -258
- package/node_modules/@noble/hashes/src/sha512.ts +0 -34
- package/node_modules/@noble/hashes/src/utils.ts +0 -395
- package/node_modules/@noble/hashes/utils.d.ts +0 -161
- package/node_modules/@noble/hashes/utils.d.ts.map +0 -1
- package/node_modules/@noble/hashes/utils.js +0 -313
- package/node_modules/@noble/hashes/utils.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { type CombinedSample, type SampleCombinerStats, SampleCombiner, SampleCo
|
|
|
11
11
|
export { isCompleteFmp4DataUnit } from './fmp4-completion.js';
|
|
12
12
|
export { type AvcCInfo, type AacAscInfo, type SpsPps, type FallbackAvcCOptions, type HevcParameterSets, type H264KeyframeDetectionOptions, type H264AvccSample, type H264SampleFormat, type H264NalUnitFormat, type H264NalUnitSample, extractAvcCFromInitSegment, extractAacAscFromInitSegment, normalizeMmtpInitSegment, generateFallbackAvcC, extractSpsPpsFromAvcC, avccToAnnexB, extractCodecDescriptionFromAnnexB, codecStringFromAvcC, isAnnexB, isCompleteAvccSample, findAnnexBStartCode, splitAnnexBNalUnits, annexBToAvcc, normalizeH264SampleToAvcc, splitH264SampleNalUnits, classifyH264Keyframe, detectH264Keyframe, mmtpTimestampToMicros, isFmp4InitSegment, wrapAdtsFrame, isHevcCodec, removeEmulationPrevention, splitAvccNalUnits, extractHevcParameterSets, generateHvcCFromParameterSets, extractHevcCodecDescription, hevcVclOnly, type VideoSampleEntry, type VideoCodecFamily, type HevcSpsInfo, type HevcCmafSample, videoSampleEntryFromCodecString, videoCodecFamily, HEVC_NAL_UNIT_TYPE, HEVC_NAL_HEADER_LENGTH, hevcNalUnitType, isHevcIrapNalUnitType, parseHevcSps, hevcCodecStringFromSps, classifyHevcKeyframe, detectHevcKeyframe, normalizeHevcSampleToLengthPrefixed, prepareHevcCmafSample, } from './codec-utils.js';
|
|
13
13
|
export { LOCHeaderExtensionId, FEC_SS_ID_MAX, FEC_SOURCE_INFO_LEN, encodeFecSourceInfo, decodeFecSourceInfo, FecSourceInfo, AuthTag, } from './loc.js';
|
|
14
|
-
export { type FecAlgorithm, type FecCatalogConfig, isFecCatalogConfig, type MulticastProtocol, type MulticastTrack, type MulticastTrackObject, type MulticastEndpoint, type AmtDiscovery, type MulticastCatalogConfig, type NetworkSource, isMulticastTrackObject, isMulticastEndpoint, isMulticastCatalogConfig, type TrackTimingConfig, isTrackTimingConfig, resolveGroupDurationTicks, resolveGroupDurationMs, validateSwitchingSetTiming, type CmsfCatalog, type CmsfCatalogErrorCode, CmsfCatalogValidationError, validateCmsfMmtpCatalog, type ArchiveConfig, archiveOrigin, } from './carp-catalog.js';
|
|
14
|
+
export { type FecAlgorithm, type FecCatalogConfig, isFecCatalogConfig, isFecCatalogGeometry, type MulticastProtocol, type MulticastTrack, type MulticastTrackObject, type MulticastEndpoint, type AmtDiscovery, type MulticastCatalogConfig, type NetworkSource, isMulticastTrackObject, isMulticastEndpoint, isMulticastCatalogConfig, type TrackTimingConfig, isTrackTimingConfig, resolveGroupDurationTicks, resolveGroupDurationMs, validateSwitchingSetTiming, type CmsfCatalog, type CmsfCatalogErrorCode, CmsfCatalogValidationError, validateCmsfMmtpCatalog, type ArchiveConfig, archiveOrigin, } from './carp-catalog.js';
|
|
15
15
|
export { type MulticastInput, type MulticastEndpointInput, type MulticastInputErrorKind, MulticastInputError, multicastFromConfig, multicastFromEnv, } from './multicast-input.js';
|
|
16
16
|
export { type Phase14OverrideTrack, type Phase14CatalogOverride, getPhase14CatalogOverride, mergeOverrideIntoHangRenditions, mergeOverrideIntoCmsfTracks, } from './phase14-catalog-override.js';
|
|
17
17
|
export { type MulticastContainerContract, type MulticastContainerErrorCode, type FecPayloadId as MulticastFecPayloadId, type MulticastFrame, MulticastContainerContractError, validateMulticastContainerContract, unwrapMulticastPacket, } from './multicast-unwrap.js';
|
|
@@ -32,7 +32,8 @@ export { MulticastManager, forwardRepairLifecycleEvents, isRepairLifecycleEvent,
|
|
|
32
32
|
export { BlockClassifier, decideGap, deriveBlockClassifierGeometry, keyframeIntervalMediaTicks, repairPriorityForClass, type BlockClass, type BlockClassifierGeometry, type BlockClassifierGeometryInput, type ClassifierChange, type ClassifierMode, type ClassifierReason, type DecideGapInput, type FrameGapAction, type FrameGapDecision, type FrameGapReason, type GapFrameEvidence, type GapStreamIdentity, type KeyframeInterval, type ReclassificationEvidence, type RepairPriority, type SourceSymbolEvidence, type TrackKind, } from './block-policy.js';
|
|
33
33
|
export { AudioGapConcealer, HoldLastTimeline, videoConcealModeForCodec, type AudioAccessUnit, type AudioGapConcealerStats, type AudioGapPlan, type HoldLastTimelineOptions, type HoldLastTimelineStats, type TimelineEmit, type TimelineSample, type VideoConcealMode, } from './conceal-timeline.js';
|
|
34
34
|
export { setupFecWorkerForTrack, type FecWorkerAssetUrls, type FecWorkerSetupOptions, type FecWorkerSetupResult, } from './fec-worker-setup.js';
|
|
35
|
-
export { MediaRouter, TrackSourceConflictError, type MediaRouterOptions, type TrackSource, type SetTrackSourceOptions, type MigrationPolicy, type FrameMeta as RouterFrameMeta, type FrameKind, type SourceKind, } from './media-router.js';
|
|
35
|
+
export { MediaRouter, TrackSourceConflictError, type MediaRouterOptions, type TrackSource, type SetTrackSourceOptions, type MigrationPolicy, type FrameMeta as RouterFrameMeta, type FrameKind, type SourceKind, type DeltaFallbackConfig, } from './media-router.js';
|
|
36
|
+
export { resolveDeltaFallback, type DeltaFallbackTrack, type ResolvedDeltaFallback, } from './delta-fallback-config.js';
|
|
36
37
|
export { groupIdForTicks, groupIdFor, secondsFromTicks, asSeconds, driftCheck, type Seconds, type DriftCheckResult, } from './align.js';
|
|
37
38
|
export { AudioRingBuffer, type AudioRingBufferConfig, } from './audio-ring-buffer.js';
|
|
38
39
|
export { MmtpDecodePipeline, type PipelineFecClient, type PipelineConfig, type MmtpFeedStats, } from './mmtp-decode-pipeline.js';
|
|
@@ -43,7 +44,7 @@ export { TransportPool, type SubscriptionMode, type DirectSocketHealth, type Sub
|
|
|
43
44
|
export { TrackSession, SessionManager, MAX_TAKEOVER_DEADLINE_MS, JOIN_DEFER_WARN_MS, computeFecDeliveryWindowMs, computeFecDeliveryWindowMediaUnits, computeFecLossWindowMs, type FecDeliveryWindowConfig, type TrackState, type TrackSessionConfig, type SessionManagerCallbacks, type MmtpTrackEvent, type MmtpSessionCallbacks, } from './track-session.js';
|
|
44
45
|
export { FecStarvationDetector, type FecStarvationSnapshot, type FecStarvationDetectorConfig, } from './fec-starvation-detector.js';
|
|
45
46
|
export { CmcdProducer, type CmcdParams, type CmcdProducerOptions, type SnapshotData, type TransportSnapshot, type TransportTransitionEvent, } from './cmcd-producer.js';
|
|
46
|
-
export { catalogFecInterleaveMs, resolveCatalogTrackFec, type CatalogTrackRef, type FecInterleaveCatalog, type GroupDurationCatalog, type KeyframeCadenceCatalog, type TrackFecParams, type TrackFecUnavailable, catalogGroupDurationMs, type GroupDurationRendition, resolveCatalogTrackGroupDurationMs, joinedRepairSymbolCount, FEC_BLOCK_PROFILES, isFecBlockProfile, parseFecBlockProfile, readFecBlockProfile, type FecBlockProfile, resolveRepairLayers, catalogRepairTarget, assembleRepairLayers, assertRepairTrackReachable, repairReachability, type AssembleRepairLayersOptions, type RepairReachability, dependsTarget, describeRepairTrack, rejectRepairFieldsOnMediaTrack, rejectRepairTrackGeometry, REPAIR_TRACK_GEOMETRY_KEYS, REPAIR_TRACK_ONLY_KEYS, validateRepairTrackFields, RepairContractError, DEFAULT_REPAIR_PRIORITY, MAX_ENCODING_SYMBOL_ID, MAX_RAPTORQ_SOURCE_SYMBOLS, MAX_REPAIR_SYMBOLS, REPAIR_PRIORITY_MAX, REPAIR_PRIORITY_MIN, type RepairContractCode, type RepairContractFail, type RepairLayerCatalog, type RepairLayerParams, type RepairLayersResolution, type RepairOverlayParams, type RepairRenditionCatalog, type RepairSourceGeometry, type RepairTrackDescriptor, } from "./catalog-fec-params.js";
|
|
47
|
+
export { catalogFecInterleaveMs, resolveCatalogTrackFec, type CatalogTrackRef, type FecInterleaveCatalog, type GroupDurationCatalog, type KeyframeCadenceCatalog, type TrackFecParams, type TrackFecUnavailable, catalogFecUnavailable, catalogGroupDurationMs, catalogKeyframeCadenceMs, catalogFecMediaUnitsPerSecond, type GroupDurationRendition, resolveCatalogTrackGroupDurationMs, joinedRepairSymbolCount, FEC_BLOCK_PROFILES, isFecBlockProfile, parseFecBlockProfile, readFecBlockProfile, type FecBlockProfile, resolveRepairLayers, catalogRepairTarget, assembleRepairLayers, assertRepairTrackReachable, repairReachability, type AssembleRepairLayersOptions, type RepairReachability, dependsTarget, describeRepairTrack, rejectRepairFieldsOnMediaTrack, rejectRepairTrackGeometry, REPAIR_TRACK_GEOMETRY_KEYS, REPAIR_TRACK_ONLY_KEYS, validateRepairTrackFields, RepairContractError, DEFAULT_REPAIR_PRIORITY, MAX_ENCODING_SYMBOL_ID, MAX_RAPTORQ_SOURCE_SYMBOLS, MAX_REPAIR_SYMBOLS, REPAIR_PRIORITY_MAX, REPAIR_PRIORITY_MIN, type RepairContractCode, type RepairContractFail, type RepairLayerCatalog, type RepairLayerParams, type RepairLayersResolution, type RepairOverlayParams, type RepairRenditionCatalog, type RepairSourceGeometry, type RepairTrackDescriptor, } from "./catalog-fec-params.js";
|
|
47
48
|
export { FEC_INACTIVE_REASONS, catalogDeclaresFec, resolveFecState, type FecActiveState, type FecInactiveReason, type FecInactiveState, type FecState, type FecStateEvidence, type FecTransportPolicy, type NoFecCounters, } from "./fec-state.js";
|
|
48
49
|
export { catalogAmtNetworkSource, DEFAULT_AMT_RELAY_PORT, type AmtNetworkSource, type CatalogNetworkSource, } from "./catalog-network-source.js";
|
|
49
50
|
export { wireRepairFetch, repairFetchSubscriberPriority, SOURCE_MEDIA_PRIORITY_MAX, type ResolveRepairTarget, type RepairTarget, type RepairFetchHost, type RepairFetchPriority, type RepairFetchRequest, type RepairFetchTransport, type RepairPriorityReason, type RepairSkipReason, type RepairSubscribeCallback, type WireRepairFetchOptions, } from './repair-fetch.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAG1D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,cAAc,EACd,yBAAyB,GAC1B,MAAM,sBAAsB,CAAA;AAK7B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,cAAc,EACd,kBAAkB,EAClB,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAc7D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,iCAAiC,EACjC,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EAEb,WAAW,EACX,yBAAyB,EACzB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B,KAAK,oBAAoB,GACzB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EACf,6BAA6B,EAC7B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
} from "./loc.js";
|
|
64
64
|
import {
|
|
65
65
|
isFecCatalogConfig,
|
|
66
|
+
isFecCatalogGeometry,
|
|
66
67
|
isMulticastTrackObject,
|
|
67
68
|
isMulticastEndpoint,
|
|
68
69
|
isMulticastCatalogConfig,
|
|
@@ -175,6 +176,9 @@ import {
|
|
|
175
176
|
MediaRouter,
|
|
176
177
|
TrackSourceConflictError
|
|
177
178
|
} from "./media-router.js";
|
|
179
|
+
import {
|
|
180
|
+
resolveDeltaFallback
|
|
181
|
+
} from "./delta-fallback-config.js";
|
|
178
182
|
import {
|
|
179
183
|
groupIdForTicks,
|
|
180
184
|
groupIdFor,
|
|
@@ -221,7 +225,10 @@ import {
|
|
|
221
225
|
import {
|
|
222
226
|
catalogFecInterleaveMs,
|
|
223
227
|
resolveCatalogTrackFec,
|
|
228
|
+
catalogFecUnavailable,
|
|
224
229
|
catalogGroupDurationMs,
|
|
230
|
+
catalogKeyframeCadenceMs,
|
|
231
|
+
catalogFecMediaUnitsPerSecond,
|
|
225
232
|
resolveCatalogTrackGroupDurationMs,
|
|
226
233
|
joinedRepairSymbolCount,
|
|
227
234
|
FEC_BLOCK_PROFILES,
|
|
@@ -338,7 +345,10 @@ export {
|
|
|
338
345
|
catalogAmtNetworkSource,
|
|
339
346
|
catalogDeclaresFec,
|
|
340
347
|
catalogFecInterleaveMs,
|
|
348
|
+
catalogFecMediaUnitsPerSecond,
|
|
349
|
+
catalogFecUnavailable,
|
|
341
350
|
catalogGroupDurationMs,
|
|
351
|
+
catalogKeyframeCadenceMs,
|
|
342
352
|
catalogRepairTarget,
|
|
343
353
|
classifyH264Keyframe,
|
|
344
354
|
classifyHevcKeyframe,
|
|
@@ -394,6 +404,7 @@ export {
|
|
|
394
404
|
isCompleteFmp4DataUnit,
|
|
395
405
|
isFecBlockProfile,
|
|
396
406
|
isFecCatalogConfig,
|
|
407
|
+
isFecCatalogGeometry,
|
|
397
408
|
isFmp4InitSegment,
|
|
398
409
|
isHevcCodec,
|
|
399
410
|
isHevcIrapNalUnitType,
|
|
@@ -435,6 +446,7 @@ export {
|
|
|
435
446
|
repairReachability,
|
|
436
447
|
resolveCatalogTrackFec,
|
|
437
448
|
resolveCatalogTrackGroupDurationMs,
|
|
449
|
+
resolveDeltaFallback,
|
|
438
450
|
resolveFecState,
|
|
439
451
|
resolveGlobalMmtWasmBindings,
|
|
440
452
|
resolveGroupDurationMs,
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @mmt/container - MMTP/LOC Container Parsing\n *\n * Shared container parsing library for MMT over MoQ and SSM.\n *\n * @packageDocumentation\n */\n\nexport type { AuthoredTiming } from './authored-timing.js'\n\n// MFU Reassembler\nexport {\n type MFUFragment,\n type ReassembledMFU,\n type ReassemblerStats,\n type MFUReassemblerOptions,\n type MfuReassemblerBackend,\n type MmtpSourcePath,\n MFUReassembler,\n isMfuReassemblyError,\n MfuReassemblyError,\n type MfuReassemblyErrorCode,\n createFragment,\n processMMTPWithReassembly,\n} from './mfu-reassembler.js'\n\n// Sample combiner: combines subsample data units (moqcast #37) of one\n// timed sample, each already reassembled by MFUReassembler, back into one\n// contiguous sample.\nexport {\n type CombinedSample,\n type SampleCombinerStats,\n SampleCombiner,\n SampleCombineError,\n type SampleCombineErrorCode,\n} from './sample-combiner.js'\n\n// fMP4 data-unit completion policy (BLO-13291)\nexport { isCompleteFmp4DataUnit } from './fmp4-completion.js'\n\n\n// source-auth (authenticated-manifest / Merkle) is intentionally NOT re-exported\n// from the eager index barrel. It statically imports blake3 from @noble/hashes,\n// and re-exporting it here pulls that bare specifier into every browser consumer\n// of @blockcast/mmt-container (the moq-lib / shred / moqtail players load the\n// barrel as raw ESM via an import map, where @noble/hashes has no mapping \u2192\n// \"Failed to resolve module specifier\". No browser player uses source-auth.)\n// Consumers that need it import the dedicated subpath: '@blockcast/mmt-container/source-auth'.\n// The same rule covers the @blockcast/mmt-manifest-verify surface (ManifestVerifier et al.):\n// import it from that package (or the subpath above) directly, never from this barrel.\n\n// H.264/AVC + H.265/HEVC Codec Utilities\nexport {\n type AvcCInfo,\n type AacAscInfo,\n type SpsPps,\n type FallbackAvcCOptions,\n type HevcParameterSets,\n type H264KeyframeDetectionOptions,\n type H264AvccSample,\n type H264SampleFormat,\n type H264NalUnitFormat,\n type H264NalUnitSample,\n extractAvcCFromInitSegment,\n extractAacAscFromInitSegment,\n normalizeMmtpInitSegment,\n generateFallbackAvcC,\n extractSpsPpsFromAvcC,\n avccToAnnexB,\n extractCodecDescriptionFromAnnexB,\n codecStringFromAvcC,\n isAnnexB,\n isCompleteAvccSample,\n findAnnexBStartCode,\n splitAnnexBNalUnits,\n annexBToAvcc,\n normalizeH264SampleToAvcc,\n splitH264SampleNalUnits,\n classifyH264Keyframe,\n detectH264Keyframe,\n mmtpTimestampToMicros,\n isFmp4InitSegment,\n wrapAdtsFrame,\n // HEVC (BLO-7764): build the hvcC description WebCodecs requires for length-prefixed H.265.\n isHevcCodec,\n removeEmulationPrevention,\n splitAvccNalUnits,\n extractHevcParameterSets,\n generateHvcCFromParameterSets,\n extractHevcCodecDescription,\n hevcVclOnly,\n // HEVC receive path (BLO-35597): catalog-selected family, IRAP keyframes,\n // SPS-derived codec string, MSE sample normalization.\n type VideoSampleEntry,\n type VideoCodecFamily,\n type HevcSpsInfo,\n type HevcCmafSample,\n videoSampleEntryFromCodecString,\n videoCodecFamily,\n HEVC_NAL_UNIT_TYPE,\n HEVC_NAL_HEADER_LENGTH,\n hevcNalUnitType,\n isHevcIrapNalUnitType,\n parseHevcSps,\n hevcCodecStringFromSps,\n classifyHevcKeyframe,\n detectHevcKeyframe,\n normalizeHevcSampleToLengthPrefixed,\n prepareHevcCmafSample,\n} from './codec-utils.js'\n\n// LOC FEC Extensions (draft-ramadan-moq-fec \u00A75.3, object extension 0x11)\nexport {\n LOCHeaderExtensionId,\n FEC_SS_ID_MAX,\n FEC_SOURCE_INFO_LEN,\n encodeFecSourceInfo,\n decodeFecSourceInfo,\n FecSourceInfo,\n AuthTag,\n} from './loc.js'\n\n// CARP Catalog Extensions (draft-law-ramadan-moq-carp-reliability \u00A73-4)\n// + Track Timing (draft-ramadan-moq-mmt-00 \u00A74.4.4)\nexport {\n type FecAlgorithm,\n type FecCatalogConfig,\n isFecCatalogConfig,\n type MulticastProtocol,\n type MulticastTrack,\n type MulticastTrackObject,\n type MulticastEndpoint,\n type AmtDiscovery,\n type MulticastCatalogConfig,\n type NetworkSource,\n isMulticastTrackObject,\n isMulticastEndpoint,\n isMulticastCatalogConfig,\n type TrackTimingConfig,\n isTrackTimingConfig,\n resolveGroupDurationTicks,\n resolveGroupDurationMs,\n validateSwitchingSetTiming,\n type CmsfCatalog,\n type CmsfCatalogErrorCode,\n CmsfCatalogValidationError,\n validateCmsfMmtpCatalog,\n type ArchiveConfig,\n archiveOrigin,\n} from './carp-catalog.js'\n\n// Multicast input contract \u2014 validator + builder for publisher-emitted\n// catalogs (draft-ramadan-moq-multicast-00 \u00A74.1, BLO-3323 A.1).\n// `multicastFromEnv` is the env-var helper used by FFmpeg and the\n// cast bridge (BLO-3337).\nexport {\n type MulticastInput,\n type MulticastEndpointInput,\n type MulticastInputErrorKind,\n MulticastInputError,\n multicastFromConfig,\n multicastFromEnv,\n} from './multicast-input.js'\n\n// Phase 14 catalog override hook (test harness injects\n// globalThis.__PHASE14_CATALOG_OVERRIDE; see 7point-validation.test.mjs)\nexport {\n type Phase14OverrideTrack,\n type Phase14CatalogOverride,\n getPhase14CatalogOverride,\n mergeOverrideIntoHangRenditions,\n mergeOverrideIntoCmsfTracks,\n} from './phase14-catalog-override.js'\n\n// Multicast Unwrap (container-aware MMTP dispatch)\nexport {\n type MulticastContainerContract,\n type MulticastContainerErrorCode,\n type FecPayloadId as MulticastFecPayloadId,\n type MulticastFrame,\n MulticastContainerContractError,\n validateMulticastContainerContract,\n unwrapMulticastPacket,\n} from './multicast-unwrap.js'\n\n// Timestamp Codec \u2014 container-format-agnostic timestamp encoding/decoding\nexport {\n type ContainerFormat,\n type LocHeader,\n encodeTimestamp,\n decodeTimestamp,\n getTimestampSize,\n decodeLocHeader,\n decodeLocTimestamp,\n encodeLocTimestamp,\n} from './timestamp-codec.js'\n\n// MMTP \u2192 CMAF conversion (draft-ramadan-moq-mmt \u00A75.3)\nexport {\n MmtpToCmaf,\n encodeDataSegment,\n encodeMultiSampleSegment,\n buildVideoInitSegment,\n buildHevcVideoInitSegment,\n buildAudioInitSegment,\n generateSilenceFrame,\n} from './mmtp-to-cmaf.js'\n\n// MMTP Signaling \u2014 packet type detection and classification\nexport {\n type PacketClass,\n getPacketType,\n isSignalingPacket,\n isSourcePacket,\n classifyPacket,\n} from './signaling.js'\n\n// FEC Block \u2192 CMAF Segment Assembler\nexport {\n CmafBlockAssembler,\n type CmafBlockSample,\n type CmafSampleOrderPolicy,\n type CmafSampleOrderStats,\n type CmafEmitStats,\n type CmafAudioConcealStats,\n type BlockAssemblerConfig,\n} from './cmaf-block-assembler.js'\n\n// MoQ Group \u2192 CMAF Segment Batcher\nexport {\n CmafGroupBatcher,\n type CmafGroupBatcherConfig,\n} from './cmaf-group-batcher.js'\n\n// FEC Manager (codec-agnostic FEC decode service)\nexport {\n FECManager,\n type FECManagerConfig,\n type FecDecoderUnavailableEvent,\n type FecDecoderUnavailableReason,\n type FecFallbackDecoder,\n type WasmFecDecoder,\n type FecStats,\n type MulticastSymbolDelivery,\n type FecBlockResolution,\n type RepairVia,\n} from './fec-manager.js'\n\n// MMTP Router (packet processing + frame routing)\nexport {\n MmtpRouter,\n KEYFRAME_LOST_TIMEOUT_SLACK,\n type FrameCallback,\n type FECManagerLike,\n type MmtpIngressContext,\n type MmtpStreamIdentity,\n type RoutedPacketMeta,\n type StagedStreamSwitch,\n type StreamSwitchCommit,\n type StreamSwitchCommitReason,\n type StreamSwitchOptions,\n type StreamSwitchPosition,\n type TrackPacketCallback,\n} from './mmtp-router.js'\n\n// MmtpContainerParser (unified, transport-agnostic)\nexport {\n MmtpContainerParser,\n type MmtpParserConfig,\n type MmtpParserRecord,\n type MmtpParserFeedStats,\n type MmtpFeedDropReason,\n type MmtpFeedOutcomeKey,\n type TrackInfo,\n type MmtpReorderStats,\n type MmtpReorderFrameDiagnostics,\n type MmtpReorderStreamDiagnostics,\n type FrameMeta as ParserFrameMeta,\n type PacketInfo,\n type ParsedMmtpPacket,\n} from './mmtp-container-parser.js'\n\nexport {\n datagramMfuReassembly,\n reliableMoqMfuReassembly,\n mmtpFrameReorderWindowFrames,\n mfuReassemblyTimeoutMs,\n type MfuReassemblyPolicy,\n type MmtpTrackType,\n type ReliableMoqReassemblyOptions,\n} from './mfu-reassembly-policy.js'\n\nexport {\n WasmMfuReassembler,\n resolveGlobalMmtWasmBindings,\n type MmtWasmBindings,\n type WasmMfuReassemblerOptions,\n} from './wasm-mfu-reassembler.js'\n\nexport {\n createWasmMmtpContainerParser,\n type WasmMmtpParserConfig,\n} from './wasm-mmtp-container-parser.js'\n\n// FEC Codec (generic, algorithm-pluggable)\nexport {\n type FecCodec,\n NoneCodec,\n ReedSolomonCodec,\n createFecCodec,\n} from './fec-codec.js'\n\n// Multicast Transport (SSM join/socket/watchdog)\nexport {\n MulticastTransport,\n type MulticastFailbackReason,\n type MulticastJoinDeclineReason,\n type MulticastJoinOutcome,\n type MulticastJoinProviderError,\n type MulticastJoinStats,\n type MulticastTransportConfig,\n type ResolvedMulticastTransport,\n} from './multicast-transport.js'\n\n// Multicast Manager (backwards-compat facade composing all three)\nexport {\n MulticastManager,\n forwardRepairLifecycleEvents,\n isRepairLifecycleEvent,\n REPAIR_LIFECYCLE_EVENT_TYPE,\n REPAIR_LIFECYCLE_LOG_PREFIX,\n type MulticastEndpointConfig,\n type MultiTrackCatalog,\n type MultiTrackCatalogTrack,\n type WasmFecDecoderFactory,\n type RepairBlockIdentity,\n type RepairLifecycleApplicationEvent,\n type RepairLifecycleEventOptions,\n type RepairLifecycleEventFactory,\n type RepairLifecycleEventTarget,\n type RepairLifecycleSource,\n type RepairLifecycleEvent,\n type RepairLifecycleObserver,\n type RepairStreamIdentity,\n type BlockPolicyStats,\n type RenditionSwitch,\n type RenditionSwitchCancel,\n type RenditionSwitchRequest,\n type RenditionSwitchState,\n} from './multicast-manager.js'\n\n// Keyframe-protected FEC repair policy: block classification, repair\n// priority, and the stall/conceal decision every player applies.\nexport {\n BlockClassifier,\n decideGap,\n deriveBlockClassifierGeometry,\n keyframeIntervalMediaTicks,\n repairPriorityForClass,\n type BlockClass,\n type BlockClassifierGeometry,\n type BlockClassifierGeometryInput,\n type ClassifierChange,\n type ClassifierMode,\n type ClassifierReason,\n type DecideGapInput,\n type FrameGapAction,\n type FrameGapDecision,\n type FrameGapReason,\n type GapFrameEvidence,\n type GapStreamIdentity,\n type KeyframeInterval,\n type ReclassificationEvidence,\n type RepairPriority,\n type SourceSymbolEvidence,\n type TrackKind,\n} from './block-policy.js'\n\n// Sink-side concealment: hold last good frame, exact audio gap sizing.\nexport {\n AudioGapConcealer,\n HoldLastTimeline,\n videoConcealModeForCodec,\n type AudioAccessUnit,\n type AudioGapConcealerStats,\n type AudioGapPlan,\n type HoldLastTimelineOptions,\n type HoldLastTimelineStats,\n type TimelineEmit,\n type TimelineSample,\n type VideoConcealMode,\n} from './conceal-timeline.js'\n\n// FEC Worker Setup (shared fec-setup helper)\nexport {\n setupFecWorkerForTrack,\n type FecWorkerAssetUrls,\n type FecWorkerSetupOptions,\n type FecWorkerSetupResult,\n} from './fec-worker-setup.js'\n\n// Media Router (shared MoQ \u2194 multicast source arbitration)\nexport {\n MediaRouter,\n TrackSourceConflictError,\n type MediaRouterOptions,\n type TrackSource,\n type SetTrackSourceOptions,\n type MigrationPolicy,\n type FrameMeta as RouterFrameMeta,\n type FrameKind,\n type SourceKind,\n} from './media-router.js'\n\n// Group-alignment primitive \u2014 shared with Go sender + Rust relay.\n// See align.ts docstring for cross-language contract. Authoritative form\n// is integer-ticks (groupIdForTicks); seconds-form is the legacy ramp.\nexport {\n groupIdForTicks,\n groupIdFor,\n secondsFromTicks,\n asSeconds,\n driftCheck,\n type Seconds,\n type DriftCheckResult,\n} from './align.js'\n\n// Audio Ring Buffer \u2014 DEPRECATED: canonical location is @blockcast/mmt-render/audio.\n// Kept here for backwards compat with consumers not yet migrated to mmt-render.\n// The mmt-render version includes warmup-delayed clock recovery + adaptive target fill.\nexport {\n AudioRingBuffer,\n type AudioRingBufferConfig,\n} from './audio-ring-buffer.js'\n\n// MMTP Decode Pipeline (MoQ + multicast unified decode path)\nexport {\n MmtpDecodePipeline,\n type PipelineFecClient,\n type PipelineConfig,\n type MmtpFeedStats,\n} from './mmtp-decode-pipeline.js'\n\n// Track Pipeline (per-track transport promotion + ABR)\nexport {\n TrackPipeline,\n type TrackTransport,\n type TrackTransportPreference,\n type TransportCapabilityReport,\n type TrackTransportResolution,\n type TrackSourceFactory,\n} from './track-pipeline.js'\n\n// Track Pipeline Setup (shared wiring helper for both players)\nexport {\n setupTrackPipeline,\n type TrackDescriptor,\n type SetupTrackPipelineOptions,\n type SetupTrackPipelineResult,\n} from './track-pipeline-setup.js'\n\n// Audio Init Data Parser (spec-compliant frame samples from initData)\nexport {\n parseAacFrameSamples,\n parseAacSampleRate,\n parseOpusFrameSamples,\n frameSamplesFromInit,\n} from './audio-init-parser.js'\n\n// Transport Pool (ref-counted subscription lifecycle, PIM)\nexport {\n TransportPool,\n type SubscriptionMode,\n type DirectSocketHealth,\n type Subscription,\n type SubscriptionStats,\n type AcquireOptions,\n type TransportPoolOptions,\n} from './transport-pool.js'\n\n// Track Session + Session Manager (per-track state machine, Patent Claim 9)\nexport {\n TrackSession,\n SessionManager,\n MAX_TAKEOVER_DEADLINE_MS,\n JOIN_DEFER_WARN_MS,\n computeFecDeliveryWindowMs,\n computeFecDeliveryWindowMediaUnits,\n computeFecLossWindowMs,\n type FecDeliveryWindowConfig,\n type TrackState,\n type TrackSessionConfig,\n type SessionManagerCallbacks,\n type MmtpTrackEvent,\n type MmtpSessionCallbacks,\n} from './track-session.js'\n\n// FEC starvation detector (post-cutover repair-only/no-progress detection,\n// drives TrackSession lossDetected/lossRecovered \u2014 BLO-9413/D4)\nexport {\n FecStarvationDetector,\n type FecStarvationSnapshot,\n type FecStarvationDetectorConfig,\n} from './fec-starvation-detector.js'\n\n// CMCD Producer (x-bc-* vendor key telemetry, BLO-1044)\nexport {\n CmcdProducer,\n type CmcdParams,\n type CmcdProducerOptions,\n type SnapshotData,\n type TransportSnapshot,\n type TransportTransitionEvent,\n} from './cmcd-producer.js'\n\nexport {\n\tcatalogFecInterleaveMs,\n\tresolveCatalogTrackFec,\n\ttype CatalogTrackRef,\n\ttype FecInterleaveCatalog,\n\ttype GroupDurationCatalog,\n\ttype KeyframeCadenceCatalog,\n\ttype TrackFecParams,\n\ttype TrackFecUnavailable,\n\tcatalogGroupDurationMs,\n\ttype GroupDurationRendition,\n\tresolveCatalogTrackGroupDurationMs,\n\tjoinedRepairSymbolCount,\n\tFEC_BLOCK_PROFILES,\n\tisFecBlockProfile,\n\tparseFecBlockProfile,\n\treadFecBlockProfile,\n\ttype FecBlockProfile,\n\tresolveRepairLayers,\n\tcatalogRepairTarget,\n\tassembleRepairLayers,\n\tassertRepairTrackReachable,\n\trepairReachability,\n\ttype AssembleRepairLayersOptions,\n\ttype RepairReachability,\n\tdependsTarget,\n\tdescribeRepairTrack,\n\trejectRepairFieldsOnMediaTrack,\n\trejectRepairTrackGeometry,\n\tREPAIR_TRACK_GEOMETRY_KEYS,\n\tREPAIR_TRACK_ONLY_KEYS,\n\tvalidateRepairTrackFields,\n\tRepairContractError,\n\tDEFAULT_REPAIR_PRIORITY,\n\tMAX_ENCODING_SYMBOL_ID,\n\tMAX_RAPTORQ_SOURCE_SYMBOLS,\n\tMAX_REPAIR_SYMBOLS,\n\tREPAIR_PRIORITY_MAX,\n\tREPAIR_PRIORITY_MIN,\n\ttype RepairContractCode,\n\ttype RepairContractFail,\n\ttype RepairLayerCatalog,\n\ttype RepairLayerParams,\n\ttype RepairLayersResolution,\n\ttype RepairOverlayParams,\n\ttype RepairRenditionCatalog,\n\ttype RepairSourceGeometry,\n\ttype RepairTrackDescriptor,\n} from \"./catalog-fec-params.js\";\n\n// Typed FEC state (active with counters, or inactive with a reason) shared by\n// every player, resolved from catalog, transport policy, bridge and\n// subscription state rather than from counters.\nexport {\n\tFEC_INACTIVE_REASONS,\n\tcatalogDeclaresFec,\n\tresolveFecState,\n\ttype FecActiveState,\n\ttype FecInactiveReason,\n\ttype FecInactiveState,\n\ttype FecState,\n\ttype FecStateEvidence,\n\ttype FecTransportPolicy,\n\ttype NoFecCounters,\n} from \"./fec-state.js\";\n\nexport {\n\tcatalogAmtNetworkSource,\n\tDEFAULT_AMT_RELAY_PORT,\n\ttype AmtNetworkSource,\n\ttype CatalogNetworkSource,\n} from \"./catalog-network-source.js\";\n\n// D-28 shared repair-fetch shell (per-SBN on-demand MoQ FEC repair backfill)\nexport {\n wireRepairFetch,\n repairFetchSubscriberPriority,\n SOURCE_MEDIA_PRIORITY_MAX,\n type ResolveRepairTarget,\n type RepairTarget,\n type RepairFetchHost,\n type RepairFetchPriority,\n type RepairFetchRequest,\n type RepairFetchTransport,\n type RepairPriorityReason,\n type RepairSkipReason,\n type RepairSubscribeCallback,\n type WireRepairFetchOptions,\n} from './repair-fetch.js'\n// MoQ repair group ids for iso-ssbg1-v1 blocks (BLO-35597): the 62-bit\n// wrap-epoch-extended SS_Start and the repair FETCH range for a lost SS_ID.\nexport {\n extSsStart,\n extendSsId,\n repairFetchRange,\n type RepairFetchRange,\n} from '@blockcast/mmt-fec'\nexport { DeliveryGapEstimator } from './delivery-gap.js'\n"],
|
|
5
|
-
"mappings": ";AAWA;AAAA,EAOE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAKP;AAAA,EAGE;AAAA,EACA;AAAA,OAEK;AAGP,SAAS,8BAA8B;AAcvC;AAAA,EAWE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EAGE;AAAA,EAQA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAMP;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,OAOK;AAGP;AAAA,EACE;AAAA,OAEK;AAGP;AAAA,EACE;AAAA,OAUK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,OAYK;AAGP;AAAA,EACE;AAAA,OAaK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAEP;AAAA,EACE;AAAA,OAEK;AAGP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,OAQK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAmBK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAkBK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OASK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * @mmt/container - MMTP/LOC Container Parsing\n *\n * Shared container parsing library for MMT over MoQ and SSM.\n *\n * @packageDocumentation\n */\n\nexport type { AuthoredTiming } from './authored-timing.js'\n\n// MFU Reassembler\nexport {\n type MFUFragment,\n type ReassembledMFU,\n type ReassemblerStats,\n type MFUReassemblerOptions,\n type MfuReassemblerBackend,\n type MmtpSourcePath,\n MFUReassembler,\n isMfuReassemblyError,\n MfuReassemblyError,\n type MfuReassemblyErrorCode,\n createFragment,\n processMMTPWithReassembly,\n} from './mfu-reassembler.js'\n\n// Sample combiner: combines subsample data units (moqcast #37) of one\n// timed sample, each already reassembled by MFUReassembler, back into one\n// contiguous sample.\nexport {\n type CombinedSample,\n type SampleCombinerStats,\n SampleCombiner,\n SampleCombineError,\n type SampleCombineErrorCode,\n} from './sample-combiner.js'\n\n// fMP4 data-unit completion policy (BLO-13291)\nexport { isCompleteFmp4DataUnit } from './fmp4-completion.js'\n\n\n// source-auth (authenticated-manifest / Merkle) is intentionally NOT re-exported\n// from the eager index barrel. It statically imports blake3 from @noble/hashes,\n// and re-exporting it here pulls that bare specifier into every browser consumer\n// of @blockcast/mmt-container (the moq-lib / shred / moqtail players load the\n// barrel as raw ESM via an import map, where @noble/hashes has no mapping \u2192\n// \"Failed to resolve module specifier\". No browser player uses source-auth.)\n// Consumers that need it import the dedicated subpath: '@blockcast/mmt-container/source-auth'.\n// The same rule covers the @blockcast/mmt-manifest-verify surface (ManifestVerifier et al.):\n// import it from that package (or the subpath above) directly, never from this barrel.\n\n// H.264/AVC + H.265/HEVC Codec Utilities\nexport {\n type AvcCInfo,\n type AacAscInfo,\n type SpsPps,\n type FallbackAvcCOptions,\n type HevcParameterSets,\n type H264KeyframeDetectionOptions,\n type H264AvccSample,\n type H264SampleFormat,\n type H264NalUnitFormat,\n type H264NalUnitSample,\n extractAvcCFromInitSegment,\n extractAacAscFromInitSegment,\n normalizeMmtpInitSegment,\n generateFallbackAvcC,\n extractSpsPpsFromAvcC,\n avccToAnnexB,\n extractCodecDescriptionFromAnnexB,\n codecStringFromAvcC,\n isAnnexB,\n isCompleteAvccSample,\n findAnnexBStartCode,\n splitAnnexBNalUnits,\n annexBToAvcc,\n normalizeH264SampleToAvcc,\n splitH264SampleNalUnits,\n classifyH264Keyframe,\n detectH264Keyframe,\n mmtpTimestampToMicros,\n isFmp4InitSegment,\n wrapAdtsFrame,\n // HEVC (BLO-7764): build the hvcC description WebCodecs requires for length-prefixed H.265.\n isHevcCodec,\n removeEmulationPrevention,\n splitAvccNalUnits,\n extractHevcParameterSets,\n generateHvcCFromParameterSets,\n extractHevcCodecDescription,\n hevcVclOnly,\n // HEVC receive path (BLO-35597): catalog-selected family, IRAP keyframes,\n // SPS-derived codec string, MSE sample normalization.\n type VideoSampleEntry,\n type VideoCodecFamily,\n type HevcSpsInfo,\n type HevcCmafSample,\n videoSampleEntryFromCodecString,\n videoCodecFamily,\n HEVC_NAL_UNIT_TYPE,\n HEVC_NAL_HEADER_LENGTH,\n hevcNalUnitType,\n isHevcIrapNalUnitType,\n parseHevcSps,\n hevcCodecStringFromSps,\n classifyHevcKeyframe,\n detectHevcKeyframe,\n normalizeHevcSampleToLengthPrefixed,\n prepareHevcCmafSample,\n} from './codec-utils.js'\n\n// LOC FEC Extensions (draft-ramadan-moq-fec \u00A75.3, object extension 0x11)\nexport {\n LOCHeaderExtensionId,\n FEC_SS_ID_MAX,\n FEC_SOURCE_INFO_LEN,\n encodeFecSourceInfo,\n decodeFecSourceInfo,\n FecSourceInfo,\n AuthTag,\n} from './loc.js'\n\n// CARP Catalog Extensions (draft-law-ramadan-moq-carp-reliability \u00A73-4)\n// + Track Timing (draft-ramadan-moq-mmt-00 \u00A74.4.4)\nexport {\n type FecAlgorithm,\n type FecCatalogConfig,\n isFecCatalogConfig,\n isFecCatalogGeometry,\n type MulticastProtocol,\n type MulticastTrack,\n type MulticastTrackObject,\n type MulticastEndpoint,\n type AmtDiscovery,\n type MulticastCatalogConfig,\n type NetworkSource,\n isMulticastTrackObject,\n isMulticastEndpoint,\n isMulticastCatalogConfig,\n type TrackTimingConfig,\n isTrackTimingConfig,\n resolveGroupDurationTicks,\n resolveGroupDurationMs,\n validateSwitchingSetTiming,\n type CmsfCatalog,\n type CmsfCatalogErrorCode,\n CmsfCatalogValidationError,\n validateCmsfMmtpCatalog,\n type ArchiveConfig,\n archiveOrigin,\n} from './carp-catalog.js'\n\n// Multicast input contract \u2014 validator + builder for publisher-emitted\n// catalogs (draft-ramadan-moq-multicast-00 \u00A74.1, BLO-3323 A.1).\n// `multicastFromEnv` is the env-var helper used by FFmpeg and the\n// cast bridge (BLO-3337).\nexport {\n type MulticastInput,\n type MulticastEndpointInput,\n type MulticastInputErrorKind,\n MulticastInputError,\n multicastFromConfig,\n multicastFromEnv,\n} from './multicast-input.js'\n\n// Phase 14 catalog override hook (test harness injects\n// globalThis.__PHASE14_CATALOG_OVERRIDE; see 7point-validation.test.mjs)\nexport {\n type Phase14OverrideTrack,\n type Phase14CatalogOverride,\n getPhase14CatalogOverride,\n mergeOverrideIntoHangRenditions,\n mergeOverrideIntoCmsfTracks,\n} from './phase14-catalog-override.js'\n\n// Multicast Unwrap (container-aware MMTP dispatch)\nexport {\n type MulticastContainerContract,\n type MulticastContainerErrorCode,\n type FecPayloadId as MulticastFecPayloadId,\n type MulticastFrame,\n MulticastContainerContractError,\n validateMulticastContainerContract,\n unwrapMulticastPacket,\n} from './multicast-unwrap.js'\n\n// Timestamp Codec \u2014 container-format-agnostic timestamp encoding/decoding\nexport {\n type ContainerFormat,\n type LocHeader,\n encodeTimestamp,\n decodeTimestamp,\n getTimestampSize,\n decodeLocHeader,\n decodeLocTimestamp,\n encodeLocTimestamp,\n} from './timestamp-codec.js'\n\n// MMTP \u2192 CMAF conversion (draft-ramadan-moq-mmt \u00A75.3)\nexport {\n MmtpToCmaf,\n encodeDataSegment,\n encodeMultiSampleSegment,\n buildVideoInitSegment,\n buildHevcVideoInitSegment,\n buildAudioInitSegment,\n generateSilenceFrame,\n} from './mmtp-to-cmaf.js'\n\n// MMTP Signaling \u2014 packet type detection and classification\nexport {\n type PacketClass,\n getPacketType,\n isSignalingPacket,\n isSourcePacket,\n classifyPacket,\n} from './signaling.js'\n\n// FEC Block \u2192 CMAF Segment Assembler\nexport {\n CmafBlockAssembler,\n type CmafBlockSample,\n type CmafSampleOrderPolicy,\n type CmafSampleOrderStats,\n type CmafEmitStats,\n type CmafAudioConcealStats,\n type BlockAssemblerConfig,\n} from './cmaf-block-assembler.js'\n\n// MoQ Group \u2192 CMAF Segment Batcher\nexport {\n CmafGroupBatcher,\n type CmafGroupBatcherConfig,\n} from './cmaf-group-batcher.js'\n\n// FEC Manager (codec-agnostic FEC decode service)\nexport {\n FECManager,\n type FECManagerConfig,\n type FecDecoderUnavailableEvent,\n type FecDecoderUnavailableReason,\n type FecFallbackDecoder,\n type WasmFecDecoder,\n type FecStats,\n type MulticastSymbolDelivery,\n type FecBlockResolution,\n type RepairVia,\n} from './fec-manager.js'\n\n// MMTP Router (packet processing + frame routing)\nexport {\n MmtpRouter,\n KEYFRAME_LOST_TIMEOUT_SLACK,\n type FrameCallback,\n type FECManagerLike,\n type MmtpIngressContext,\n type MmtpStreamIdentity,\n type RoutedPacketMeta,\n type StagedStreamSwitch,\n type StreamSwitchCommit,\n type StreamSwitchCommitReason,\n type StreamSwitchOptions,\n type StreamSwitchPosition,\n type TrackPacketCallback,\n} from './mmtp-router.js'\n\n// MmtpContainerParser (unified, transport-agnostic)\nexport {\n MmtpContainerParser,\n type MmtpParserConfig,\n type MmtpParserRecord,\n type MmtpParserFeedStats,\n type MmtpFeedDropReason,\n type MmtpFeedOutcomeKey,\n type TrackInfo,\n type MmtpReorderStats,\n type MmtpReorderFrameDiagnostics,\n type MmtpReorderStreamDiagnostics,\n type FrameMeta as ParserFrameMeta,\n type PacketInfo,\n type ParsedMmtpPacket,\n} from './mmtp-container-parser.js'\n\nexport {\n datagramMfuReassembly,\n reliableMoqMfuReassembly,\n mmtpFrameReorderWindowFrames,\n mfuReassemblyTimeoutMs,\n type MfuReassemblyPolicy,\n type MmtpTrackType,\n type ReliableMoqReassemblyOptions,\n} from './mfu-reassembly-policy.js'\n\nexport {\n WasmMfuReassembler,\n resolveGlobalMmtWasmBindings,\n type MmtWasmBindings,\n type WasmMfuReassemblerOptions,\n} from './wasm-mfu-reassembler.js'\n\nexport {\n createWasmMmtpContainerParser,\n type WasmMmtpParserConfig,\n} from './wasm-mmtp-container-parser.js'\n\n// FEC Codec (generic, algorithm-pluggable)\nexport {\n type FecCodec,\n NoneCodec,\n ReedSolomonCodec,\n createFecCodec,\n} from './fec-codec.js'\n\n// Multicast Transport (SSM join/socket/watchdog)\nexport {\n MulticastTransport,\n type MulticastFailbackReason,\n type MulticastJoinDeclineReason,\n type MulticastJoinOutcome,\n type MulticastJoinProviderError,\n type MulticastJoinStats,\n type MulticastTransportConfig,\n type ResolvedMulticastTransport,\n} from './multicast-transport.js'\n\n// Multicast Manager (backwards-compat facade composing all three)\nexport {\n MulticastManager,\n forwardRepairLifecycleEvents,\n isRepairLifecycleEvent,\n REPAIR_LIFECYCLE_EVENT_TYPE,\n REPAIR_LIFECYCLE_LOG_PREFIX,\n type MulticastEndpointConfig,\n type MultiTrackCatalog,\n type MultiTrackCatalogTrack,\n type WasmFecDecoderFactory,\n type RepairBlockIdentity,\n type RepairLifecycleApplicationEvent,\n type RepairLifecycleEventOptions,\n type RepairLifecycleEventFactory,\n type RepairLifecycleEventTarget,\n type RepairLifecycleSource,\n type RepairLifecycleEvent,\n type RepairLifecycleObserver,\n type RepairStreamIdentity,\n type BlockPolicyStats,\n type RenditionSwitch,\n type RenditionSwitchCancel,\n type RenditionSwitchRequest,\n type RenditionSwitchState,\n} from './multicast-manager.js'\n\n// Keyframe-protected FEC repair policy: block classification, repair\n// priority, and the stall/conceal decision every player applies.\nexport {\n BlockClassifier,\n decideGap,\n deriveBlockClassifierGeometry,\n keyframeIntervalMediaTicks,\n repairPriorityForClass,\n type BlockClass,\n type BlockClassifierGeometry,\n type BlockClassifierGeometryInput,\n type ClassifierChange,\n type ClassifierMode,\n type ClassifierReason,\n type DecideGapInput,\n type FrameGapAction,\n type FrameGapDecision,\n type FrameGapReason,\n type GapFrameEvidence,\n type GapStreamIdentity,\n type KeyframeInterval,\n type ReclassificationEvidence,\n type RepairPriority,\n type SourceSymbolEvidence,\n type TrackKind,\n} from './block-policy.js'\n\n// Sink-side concealment: hold last good frame, exact audio gap sizing.\nexport {\n AudioGapConcealer,\n HoldLastTimeline,\n videoConcealModeForCodec,\n type AudioAccessUnit,\n type AudioGapConcealerStats,\n type AudioGapPlan,\n type HoldLastTimelineOptions,\n type HoldLastTimelineStats,\n type TimelineEmit,\n type TimelineSample,\n type VideoConcealMode,\n} from './conceal-timeline.js'\n\n// FEC Worker Setup (shared fec-setup helper)\nexport {\n setupFecWorkerForTrack,\n type FecWorkerAssetUrls,\n type FecWorkerSetupOptions,\n type FecWorkerSetupResult,\n} from './fec-worker-setup.js'\n\n// Media Router (shared MoQ \u2194 multicast source arbitration)\nexport {\n MediaRouter,\n TrackSourceConflictError,\n type MediaRouterOptions,\n type TrackSource,\n type SetTrackSourceOptions,\n type MigrationPolicy,\n type FrameMeta as RouterFrameMeta,\n type FrameKind,\n type SourceKind,\n type DeltaFallbackConfig,\n} from './media-router.js'\nexport {\n resolveDeltaFallback,\n type DeltaFallbackTrack,\n type ResolvedDeltaFallback,\n} from './delta-fallback-config.js'\n\n// Group-alignment primitive \u2014 shared with Go sender + Rust relay.\n// See align.ts docstring for cross-language contract. Authoritative form\n// is integer-ticks (groupIdForTicks); seconds-form is the legacy ramp.\nexport {\n groupIdForTicks,\n groupIdFor,\n secondsFromTicks,\n asSeconds,\n driftCheck,\n type Seconds,\n type DriftCheckResult,\n} from './align.js'\n\n// Audio Ring Buffer \u2014 DEPRECATED: canonical location is @blockcast/mmt-render/audio.\n// Kept here for backwards compat with consumers not yet migrated to mmt-render.\n// The mmt-render version includes warmup-delayed clock recovery + adaptive target fill.\nexport {\n AudioRingBuffer,\n type AudioRingBufferConfig,\n} from './audio-ring-buffer.js'\n\n// MMTP Decode Pipeline (MoQ + multicast unified decode path)\nexport {\n MmtpDecodePipeline,\n type PipelineFecClient,\n type PipelineConfig,\n type MmtpFeedStats,\n} from './mmtp-decode-pipeline.js'\n\n// Track Pipeline (per-track transport promotion + ABR)\nexport {\n TrackPipeline,\n type TrackTransport,\n type TrackTransportPreference,\n type TransportCapabilityReport,\n type TrackTransportResolution,\n type TrackSourceFactory,\n} from './track-pipeline.js'\n\n// Track Pipeline Setup (shared wiring helper for both players)\nexport {\n setupTrackPipeline,\n type TrackDescriptor,\n type SetupTrackPipelineOptions,\n type SetupTrackPipelineResult,\n} from './track-pipeline-setup.js'\n\n// Audio Init Data Parser (spec-compliant frame samples from initData)\nexport {\n parseAacFrameSamples,\n parseAacSampleRate,\n parseOpusFrameSamples,\n frameSamplesFromInit,\n} from './audio-init-parser.js'\n\n// Transport Pool (ref-counted subscription lifecycle, PIM)\nexport {\n TransportPool,\n type SubscriptionMode,\n type DirectSocketHealth,\n type Subscription,\n type SubscriptionStats,\n type AcquireOptions,\n type TransportPoolOptions,\n} from './transport-pool.js'\n\n// Track Session + Session Manager (per-track state machine, Patent Claim 9)\nexport {\n TrackSession,\n SessionManager,\n MAX_TAKEOVER_DEADLINE_MS,\n JOIN_DEFER_WARN_MS,\n computeFecDeliveryWindowMs,\n computeFecDeliveryWindowMediaUnits,\n computeFecLossWindowMs,\n type FecDeliveryWindowConfig,\n type TrackState,\n type TrackSessionConfig,\n type SessionManagerCallbacks,\n type MmtpTrackEvent,\n type MmtpSessionCallbacks,\n} from './track-session.js'\n\n// FEC starvation detector (post-cutover repair-only/no-progress detection,\n// drives TrackSession lossDetected/lossRecovered \u2014 BLO-9413/D4)\nexport {\n FecStarvationDetector,\n type FecStarvationSnapshot,\n type FecStarvationDetectorConfig,\n} from './fec-starvation-detector.js'\n\n// CMCD Producer (x-bc-* vendor key telemetry, BLO-1044)\nexport {\n CmcdProducer,\n type CmcdParams,\n type CmcdProducerOptions,\n type SnapshotData,\n type TransportSnapshot,\n type TransportTransitionEvent,\n} from './cmcd-producer.js'\n\nexport {\n\tcatalogFecInterleaveMs,\n\tresolveCatalogTrackFec,\n\ttype CatalogTrackRef,\n\ttype FecInterleaveCatalog,\n\ttype GroupDurationCatalog,\n\ttype KeyframeCadenceCatalog,\n\ttype TrackFecParams,\n\ttype TrackFecUnavailable,\n\tcatalogFecUnavailable,\n\tcatalogGroupDurationMs,\n\tcatalogKeyframeCadenceMs,\n\tcatalogFecMediaUnitsPerSecond,\n\ttype GroupDurationRendition,\n\tresolveCatalogTrackGroupDurationMs,\n\tjoinedRepairSymbolCount,\n\tFEC_BLOCK_PROFILES,\n\tisFecBlockProfile,\n\tparseFecBlockProfile,\n\treadFecBlockProfile,\n\ttype FecBlockProfile,\n\tresolveRepairLayers,\n\tcatalogRepairTarget,\n\tassembleRepairLayers,\n\tassertRepairTrackReachable,\n\trepairReachability,\n\ttype AssembleRepairLayersOptions,\n\ttype RepairReachability,\n\tdependsTarget,\n\tdescribeRepairTrack,\n\trejectRepairFieldsOnMediaTrack,\n\trejectRepairTrackGeometry,\n\tREPAIR_TRACK_GEOMETRY_KEYS,\n\tREPAIR_TRACK_ONLY_KEYS,\n\tvalidateRepairTrackFields,\n\tRepairContractError,\n\tDEFAULT_REPAIR_PRIORITY,\n\tMAX_ENCODING_SYMBOL_ID,\n\tMAX_RAPTORQ_SOURCE_SYMBOLS,\n\tMAX_REPAIR_SYMBOLS,\n\tREPAIR_PRIORITY_MAX,\n\tREPAIR_PRIORITY_MIN,\n\ttype RepairContractCode,\n\ttype RepairContractFail,\n\ttype RepairLayerCatalog,\n\ttype RepairLayerParams,\n\ttype RepairLayersResolution,\n\ttype RepairOverlayParams,\n\ttype RepairRenditionCatalog,\n\ttype RepairSourceGeometry,\n\ttype RepairTrackDescriptor,\n} from \"./catalog-fec-params.js\";\n\n// Typed FEC state (active with counters, or inactive with a reason) shared by\n// every player, resolved from catalog, transport policy, bridge and\n// subscription state rather than from counters.\nexport {\n\tFEC_INACTIVE_REASONS,\n\tcatalogDeclaresFec,\n\tresolveFecState,\n\ttype FecActiveState,\n\ttype FecInactiveReason,\n\ttype FecInactiveState,\n\ttype FecState,\n\ttype FecStateEvidence,\n\ttype FecTransportPolicy,\n\ttype NoFecCounters,\n} from \"./fec-state.js\";\n\nexport {\n\tcatalogAmtNetworkSource,\n\tDEFAULT_AMT_RELAY_PORT,\n\ttype AmtNetworkSource,\n\ttype CatalogNetworkSource,\n} from \"./catalog-network-source.js\";\n\n// D-28 shared repair-fetch shell (per-SBN on-demand MoQ FEC repair backfill)\nexport {\n wireRepairFetch,\n repairFetchSubscriberPriority,\n SOURCE_MEDIA_PRIORITY_MAX,\n type ResolveRepairTarget,\n type RepairTarget,\n type RepairFetchHost,\n type RepairFetchPriority,\n type RepairFetchRequest,\n type RepairFetchTransport,\n type RepairPriorityReason,\n type RepairSkipReason,\n type RepairSubscribeCallback,\n type WireRepairFetchOptions,\n} from './repair-fetch.js'\n// MoQ repair group ids for iso-ssbg1-v1 blocks (BLO-35597): the 62-bit\n// wrap-epoch-extended SS_Start and the repair FETCH range for a lost SS_ID.\nexport {\n extSsStart,\n extendSsId,\n repairFetchRange,\n type RepairFetchRange,\n} from '@blockcast/mmt-fec'\nexport { DeliveryGapEstimator } from './delivery-gap.js'\n"],
|
|
5
|
+
"mappings": ";AAWA;AAAA,EAOE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAKP;AAAA,EAGE;AAAA,EACA;AAAA,OAEK;AAGP,SAAS,8BAA8B;AAcvC;AAAA,EAWE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;A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;AAAA,EACA;AAAA,OASK;AACP;AAAA,EACE;AAAA,OAGK;AAKP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAKP;AAAA,EACE;AAAA,OAEK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAMK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,OAOK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AAIP;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAMK;AAEP;AAAA,EACC;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAUM;AAKP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAQM;AAEP;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAWK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,4BAA4B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../mmt-alta-parse/src/index.ts", "../../mmt-base/src/mmtp.ts", "../../mmt-base/src/ntp-short.ts", "../../mmt-base/src/serial-number.ts", "../../mmt-base/src/fec-block-profile.ts", "../src/iso-block-locator.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Zero-dependency helper for extracting the detached ALTA authenticator trailer\n * from an MMTP source packet.\n *\n * Lives in its own leaf package so both `@blockcast/mmt-container` (wire-path\n * parsing) and `@blockcast/fec-worker` (FEC-recovered-source parsing) can share\n * one implementation without creating a package cycle between them.\n *\n * Spec: ISO/IEC 23008-1:2023 + draft-ramadan-moq-mmt \u00A712 (detached trailer, Path 2).\n */\n\n// --- Private MMTP/MPU/MFU constants (ISO/IEC 23008-1 \u00A79.2.2\u20139.2.3) ---\n// Duplicated here as immutable spec values so this package stays a leaf with\n// zero `@blockcast/*` dependencies. Re-deriving from `mmt-container` would\n// reintroduce the package cycle this split exists to avoid.\n\nconst MMTP_HEADER_SIZE = 12\nconst MPU_HEADER_SIZE = 8\nconst MPU_LENGTH_FIELD_SIZE = 2\nconst MPU_HEADER_REMAINDER_SIZE = MPU_HEADER_SIZE - MPU_LENGTH_FIELD_SIZE\nconst TIMED_MFU_DU_HEADER_SIZE = 14\nconst NONTIMED_MFU_DU_HEADER_SIZE = 4\nconst PACKET_TYPE_MPU = 0x00\n\n// --- Public ALTA trailer constants ---\n\n/**\n * MMTP header-extension ext_type assigned to the detached ALTA authenticator\n * trailer (Path 2 / 08-07). Carried in an `[ext_type][ext_length][auth]`\n * block appended after the MPU's declared payload bytes, before the 4-byte\n * Source FEC Payload ID. MMTP X-bit stays 0 \u2014 non-ALTA MMTP receivers treat\n * the trailer as bytes past `payload_length` and skip it (per ISO 23008-1\n * \u00A79.2.2 \"may be discarded without impacting correct processing\").\n */\nexport const MMTP_EXT_TYPE_ALTA_AUTH = 0xf0a1\n\n/** Fixed size of the trailer's `[ext_type][ext_length]` prefix (2 + 2 BE). */\nexport const MMTP_EXT_TRAILER_HEADER_SIZE = 4\n\n/** Result of extracting the detached ALTA authenticator from an MMTP packet. */\nexport interface AltaTrailer {\n /** Authenticator bytes (no ext_type/ext_length prefix, no trailing padding). */\n auth: Uint8Array\n /**\n * Wire-packet byte offset where the signed payload ends, i.e. where the\n * trailer begins. Caller uses this to produce\n * `payload = wirePacket.subarray(0, signedEnd)` for verify_detached.\n */\n signedEnd: number\n}\n\n/**\n * Extract the detached ALTA authenticator trailer from an MMTP source packet.\n *\n * Wire layout:\n * `[MMTP hdr][length(2)][remaining MPU hdr(6)][DU?][media][TRAILER][SS_ID?]`\n * `payload_length = 6 + DU bytes + media bytes`\n *\n * Returns `null` when:\n * - the packet is too small / malformed,\n * - `payload_length` cannot contain the remaining six MPU-header bytes,\n * - the declared payload overruns the packet,\n * - no bytes remain between `payload_length` and the SS_ID,\n * - the trailer's `ext_type` isn't {@link MMTP_EXT_TYPE_ALTA_AUTH},\n * - the declared `ext_length` would extend past the SS_ID boundary.\n *\n * Non-MPU packets (repair, signaling) always return `null`.\n *\n * @param options.skipFecId When true, do NOT reserve 4 trailing bytes for the\n * Source FEC Payload ID. Use on FEC-recovered symbols where the PID has\n * already been stripped upstream.\n */\nexport function extractAltaTrailer(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n): AltaTrailer | null {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) return null\n // ISO/IEC 23008-1:2023 Figure 8 places V=0 packet_type in the low six bits.\n const packetType = mmtpPacket[1]! & 0x3f\n if (packetType !== PACKET_TYPE_MPU) return null\n\n const fecType = (mmtpPacket[0]! >> 3) & 0x03\n let headerLength = MMTP_HEADER_SIZE\n if (fecType < 2 && (mmtpPacket[0]! & 0x20) !== 0) headerLength += 4\n if (fecType < 2 && (mmtpPacket[0]! & 0x02) !== 0) {\n if (headerLength + 4 > mmtpPacket.length) return null\n const extensionLength = new DataView(\n mmtpPacket.buffer,\n mmtpPacket.byteOffset + headerLength + 2,\n 2,\n ).getUint16(0, false)\n headerLength += 4 + extensionLength\n }\n if (headerLength + MPU_HEADER_SIZE > mmtpPacket.length) return null\n\n const payload = mmtpPacket.subarray(headerLength)\n\n // Inline a minimal MPU-header read \u2014 only the fields extractAltaTrailer needs.\n // payloadLength: 16 BE at bytes 0-1.\n // Byte 2 packs FT(4) | T(1) | FI(2) | A(1).\n const payloadLength = (payload[0]! << 8) | payload[1]!\n const flagsByte = payload[2]!\n const fragmentType = (flagsByte >> 4) & 0x0f\n const timed = ((flagsByte >> 3) & 0x01) === 1\n const fragmentationIndicator = (flagsByte >> 1) & 0x03\n\n // Only MFU packets (FT=2) carry the detached trailer.\n if (fragmentType !== 2) return null\n\n // FI=0/1 structurally carries a DU header; FI=2/3 does not. Require at\n // least one media byte after that deterministic layout so the bytes at the\n // declared boundary cannot impersonate ALTA for a header-only fragment.\n const dataUnitHeaderSize = fragmentationIndicator <= 1\n ? (timed ? TIMED_MFU_DU_HEADER_SIZE : NONTIMED_MFU_DU_HEADER_SIZE)\n : 0\n if (payloadLength <= MPU_HEADER_REMAINDER_SIZE + dataUnitHeaderSize) return null\n\n if (fecType > 1) return null\n const hasFecId = !options?.skipFecId && fecType === 1\n const payloadEnd = hasFecId ? payload.length - 4 : payload.length\n const declaredEnd = MPU_LENGTH_FIELD_SIZE + payloadLength\n if (declaredEnd > payloadEnd) return null\n\n if (declaredEnd + MMTP_EXT_TRAILER_HEADER_SIZE > payloadEnd) return null\n const extType = (payload[declaredEnd]! << 8) | payload[declaredEnd + 1]!\n if (extType !== MMTP_EXT_TYPE_ALTA_AUTH) return null\n const extLen = (payload[declaredEnd + 2]! << 8) | payload[declaredEnd + 3]!\n\n const authStart = declaredEnd + MMTP_EXT_TRAILER_HEADER_SIZE\n if (authStart + extLen !== payloadEnd) return null\n\n return {\n auth: payload.subarray(authStart, payloadEnd),\n signedEnd: headerLength + declaredEnd,\n }\n}\n", "import {\n MMTP_EXT_TYPE_ALTA_AUTH as _LEAF_MMTP_EXT_TYPE_ALTA_AUTH,\n MMTP_EXT_TRAILER_HEADER_SIZE as _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE,\n extractAltaTrailer as _leafExtractAltaTrailer,\n type AltaTrailer as _LeafAltaTrailer,\n} from '@blockcast/mmt-alta-parse'\n\n/**\n * @mmt/container - MMTP Parser\n *\n * MMTP (MMT Protocol) packet parser based on ISO/IEC 23008-1:2023 Section 9.2\n *\n * MMTP header format (12 bytes):\n * - Byte 0: V(2) | C(1) | FEC_type(2) | r(1) | X(1) | R(1)\n * - Byte 1: reserved(2) | packet_type(6)\n * - Bytes 2-3: packet_id (big-endian)\n * - Bytes 4-7: timestamp (big-endian, 32-bit)\n * - Bytes 8-11: sequence_number (big-endian)\n *\n * FEC_type values:\n * - 0: No FEC / source packet\n * - 1: FEC mode 0 (source with FEC payload ID)\n * - 2: FEC repair packet mode 0\n * - 3: FEC repair packet mode 1\n *\n * @packageDocumentation\n */\n\nexport interface MMTPHeader {\n version: number\n /** Packet type: 0x00=MPU, 0x02=Signaling, 0x03=Repair */\n packetType: number\n packetId: number\n timestamp: bigint\n sequenceNumber: number\n payloadLength: number\n fecType: number\n /** C flag: header carries a 32-bit packet_counter. */\n packetCounterFlag: boolean\n packetCounter?: number\n /** X flag: header carries an extension header and value. */\n extensionFlag: boolean\n extension?: { type: number; data: Uint8Array }\n /** Byte offset at which the MMTP payload begins. */\n headerLength: number\n /** Random Access Point flag - indicates keyframe (ISO 23008-1, byte 0 bit 0) */\n rapFlag: boolean\n}\n\nexport interface MPUHeader {\n mpuSequenceNumber: number\n fragmentationIndicator: number // FI: 0=complete, 1=first, 2=middle, 3=last\n /** 8-bit MPU fragment_counter from byte 3. */\n fragmentCounter: number\n /** T flag: 1=timed media (14-byte MFU DU header), 0=non-timed (4-byte header) */\n timedFlag: number\n /** A flag: aggregated MPU payload. This strict profile requires A=0. */\n aggregationFlag: boolean\n /** MPU payload_length (bytes 0-1): bytes after the length field, including\n * the remaining six MPU-header bytes and all data-unit bytes. */\n payloadLength: number\n}\n\nexport interface MFUDuHeader {\n movieFragmentSequenceNumber: number\n sampleNumber: number\n offset: number\n priority: number\n dependencyCounter: number\n}\n\nexport interface MMTPPacket {\n header: MMTPHeader\n payload: Uint8Array\n}\n\nexport const MMTP_HEADER_SIZE = 12\nexport const MPU_HEADER_SIZE = 8\nexport const MFU_DU_HEADER_SIZE_TIMED = 14 // T=1: timed media (video/audio samples)\nexport const MFU_DU_HEADER_SIZE_NONTIMED = 4 // T=0: non-timed media (item_id only)\n\nconst MPU_LENGTH_FIELD_SIZE = 2\nconst MPU_HEADER_REMAINDER_SIZE = MPU_HEADER_SIZE - MPU_LENGTH_FIELD_SIZE\nconst SOURCE_FEC_PAYLOAD_ID_SIZE = 4\n\n// MMTP Packet Types (ISO/IEC 23008-1:2023 Section 9.2.2)\nexport const PACKET_TYPE_MPU = 0x00\nexport const PACKET_TYPE_SIGNALING = 0x02\nexport const PACKET_TYPE_REPAIR = 0x03\n\n// AL-FEC Signaling Message ID (ISO/IEC 23008-1:2023 Amendment 1:2025)\nexport const ALFEC_MESSAGE_ID = 0x0203\n\n/**\n * MMTP `packet_id` of the signaling flow, which carries PACKET_TYPE_SIGNALING\n * packets such as the AL-FEC message (ALFEC_MESSAGE_ID). The FFmpeg `moq_mmt`\n * muxer sends that message on this packet_id into the same multicast group as\n * the media, and moqcast-draft (PR #44) makes advertising it for a track a\n * MUST NOT. A track's packet_id is therefore 1..MMTP_PACKET_ID_MAX.\n */\nexport const MMTP_SIGNALING_PACKET_ID = 0\n\n/** Largest value of the 16-bit MMTP `packet_id` header field. */\nexport const MMTP_PACKET_ID_MAX = 0xffff\n\n// FEC Code IDs\nexport const FEC_CODE_XOR = 1\nexport const FEC_CODE_RAPTORQ = 2\n\n/**\n * Parse MMTP header from buffer\n */\nexport function parseMMTPHeader(buffer: Uint8Array): MMTPHeader {\n if (buffer.length < MMTP_HEADER_SIZE) {\n throw new Error(`MMTP packet too small: ${buffer.length} bytes`)\n }\n\n const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)\n\n const version = (buffer[0]! >> 6) & 0x03\n if (version !== 0) {\n throw new Error(`Unsupported MMTP version: ${version}`)\n }\n\n // Extract FEC type from byte 0, bits 3-4\n const fecType = (buffer[0]! >> 3) & 0x03\n const packetCounterFlag = (buffer[0]! & 0x20) !== 0\n const extensionFlag = (buffer[0]! & 0x02) !== 0\n\n // Extract RAP flag from byte 0, bit 0 (R bit - Random Access Point)\n const rapFlag = (buffer[0]! & 0x01) === 1\n\n // ISO/IEC 23008-1:2023 Figure 8 (V=0) places reserved(2) before\n // packet_type(6), so packet_type occupies the low six bits of byte 1.\n const packetType = buffer[1]! & 0x3F\n\n let offset = 2\n\n // Packet ID (2 bytes, big-endian)\n const packetId = view.getUint16(offset, false)\n offset += 2\n\n // Timestamp (4 bytes, big-endian)\n const timestamp = BigInt(view.getUint32(offset, false))\n offset += 4\n\n // Sequence number (4 bytes, big-endian)\n const sequenceNumber = view.getUint32(offset, false)\n offset += 4\n\n let packetCounter: number | undefined\n if (packetCounterFlag) {\n if (offset + 4 > buffer.length) throw new Error('MMTP packet truncated in packet_counter')\n packetCounter = view.getUint32(offset, false)\n offset += 4\n }\n\n let extension: { type: number; data: Uint8Array } | undefined\n if (extensionFlag) {\n if (offset + 4 > buffer.length) throw new Error('MMTP packet truncated in header extension')\n const type = view.getUint16(offset, false)\n const length = view.getUint16(offset + 2, false)\n offset += 4\n if (offset + length > buffer.length) throw new Error('MMTP packet truncated in header extension value')\n extension = { type, data: buffer.subarray(offset, offset + length) }\n offset += length\n }\n\n return {\n version,\n packetType,\n packetId,\n timestamp,\n sequenceNumber,\n payloadLength: buffer.length - offset,\n fecType,\n packetCounterFlag,\n packetCounter,\n extensionFlag,\n extension,\n headerLength: offset,\n rapFlag,\n }\n}\n\n/**\n * The MMTP `packet_id` of `buffer`, or null exactly when parseMMTPHeader would\n * throw for it (short buffer, V != 0, truncated packet_counter or header\n * extension).\n *\n * This is the per-packet filter a receiver runs before any other work, so it\n * builds no header object, DataView or BigInt timestamp (BLO-36599). Use\n * parseMMTPHeader when any other header field is needed.\n */\nexport function readMMTPPacketId(buffer: Uint8Array): number | null {\n if (buffer.length < MMTP_HEADER_SIZE) return null\n const flags = buffer[0]!\n if (((flags >> 6) & 0x03) !== 0) return null\n let offset = MMTP_HEADER_SIZE\n if ((flags & 0x20) !== 0) {\n if (offset + 4 > buffer.length) return null\n offset += 4\n }\n if ((flags & 0x02) !== 0) {\n if (offset + 4 > buffer.length) return null\n const length = (buffer[offset + 2]! << 8) | buffer[offset + 3]!\n if (offset + 4 + length > buffer.length) return null\n }\n return (buffer[2]! << 8) | buffer[3]!\n}\n\n/**\n * Unwrap MMTP packet to extract payload\n */\nexport function unwrapMMTP(buffer: Uint8Array): MMTPPacket {\n const header = parseMMTPHeader(buffer)\n const payload = buffer.subarray(header.headerLength)\n\n return { header, payload }\n}\n\n/**\n * Parse MPU header from payload\n * ISO/IEC 23008-1:2023 Section 9.2.3.3\n *\n * MPU Header format (8 bytes) as written by FFmpeg/libmmt:\n * - Bytes 0-1: payload_length (16 bits, big-endian)\n * - Byte 2: FT(4) | T(1) | FI(2) | A(1)\n * - Byte 3: fragment_counter (8 bits)\n * - Bytes 4-7: MPU_sequence_number (32 bits, big-endian)\n */\nexport function parseMPUHeader(payload: Uint8Array): MPUHeader {\n if (payload.length < MPU_HEADER_SIZE) {\n throw new Error(`Payload too small for MPU header: ${payload.length} bytes`)\n }\n\n const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength)\n\n // Bytes 0-1: payload_length (16 bits, big-endian)\n const payloadLength = view.getUint16(0, false)\n\n // Byte 2: FT(4) | T(1) | FI(2) | A(1)\n const flagsByte = payload[2]!\n const timedFlag = (flagsByte >> 3) & 0x01\n const fragmentationIndicator = (flagsByte >> 1) & 0x03\n const aggregationFlag = (flagsByte & 0x01) !== 0\n\n // Byte 3: fragment_counter (8 bits). The high bit is part of the counter in\n // the current libmmt/FFmpeg writer ABI.\n const fragmentCounter = payload[3]!\n\n // Bytes 4-7: MPU_sequence_number (32 bits, big-endian)\n const mpuSequenceNumber = view.getUint32(4, false)\n\n return {\n mpuSequenceNumber,\n fragmentationIndicator,\n fragmentCounter,\n timedFlag,\n aggregationFlag,\n payloadLength,\n }\n}\n\nexport function parseTimedMfuDuHeader(payload: Uint8Array, offset: number): MFUDuHeader | null {\n if (offset < 0 || offset + MFU_DU_HEADER_SIZE_TIMED > payload.length) return null\n const view = new DataView(payload.buffer, payload.byteOffset + offset, MFU_DU_HEADER_SIZE_TIMED)\n return {\n movieFragmentSequenceNumber: view.getUint32(0, false),\n sampleNumber: view.getUint32(4, false),\n offset: view.getUint32(8, false),\n priority: payload[offset + 12]!,\n dependencyCounter: payload[offset + 13]!,\n }\n}\n\n/**\n * Why `extractMFUPayload` refused a packet.\n *\n * These identifiers are part of the public contract: callers surface them in\n * diagnostics, so renaming one is a breaking change.\n */\nexport type MFURejectionGate =\n | 'packet-shorter-than-mmtp-plus-mpu-header'\n | 'mmtp-header-unparseable'\n | 'not-an-mpu-packet'\n | 'payload-shorter-than-mpu-header'\n | 'aggregation-flag-set'\n | 'mpu-payload-length-below-header-remainder'\n | 'mpu-declared-end-exceeds-payload'\n | 'mfu-offset-at-or-past-declared-end'\n | 'source-fec-payload-id-width-mismatch'\n | 'declared-trailers-unresolved'\n\nexport interface MFURejection {\n gate: MFURejectionGate\n /** Human-readable detail, including the byte arithmetic that decided it. */\n detail: string\n}\n\ninterface MfuPayloadLayout {\n hasMfuDuHeader: boolean\n mfuOffset: number\n dataEnd: number\n}\n\nfunction resolveMfuPayloadLayout(\n mpu: MPUHeader,\n fragmentType: number,\n payload: Uint8Array,\n): { layout: MfuPayloadLayout } | { rejection: MFURejection } {\n if (mpu.payloadLength < MPU_HEADER_REMAINDER_SIZE) {\n return {\n rejection: {\n gate: 'mpu-payload-length-below-header-remainder',\n detail: `payload_length=${mpu.payloadLength} < ${MPU_HEADER_REMAINDER_SIZE}`,\n },\n }\n }\n\n // ISO/IEC 23008-1 defines payload_length from immediately after its own\n // two-byte field. It therefore includes the remaining six MPU-header bytes.\n const declaredEnd = MPU_LENGTH_FIELD_SIZE + mpu.payloadLength\n if (declaredEnd > payload.length) {\n return {\n rejection: {\n gate: 'mpu-declared-end-exceeds-payload',\n detail:\n `payload_length=${mpu.payloadLength} implies end=${declaredEnd}, ` +\n `payload is ${payload.length} bytes`,\n },\n }\n }\n\n const hasHeader = fragmentType === 2 && mpu.fragmentationIndicator <= 1\n const mfuHeaderSize = mpu.timedFlag ? MFU_DU_HEADER_SIZE_TIMED : MFU_DU_HEADER_SIZE_NONTIMED\n const mfuOffset = MPU_HEADER_SIZE + (hasHeader ? mfuHeaderSize : 0)\n if (mfuOffset >= declaredEnd) {\n return {\n rejection: {\n gate: 'mfu-offset-at-or-past-declared-end',\n detail: `mfuOffset=${mfuOffset} >= declaredEnd=${declaredEnd}`,\n },\n }\n }\n\n return {\n layout: {\n hasMfuDuHeader: hasHeader,\n mfuOffset,\n dataEnd: declaredEnd,\n },\n }\n}\n\nfunction isEmptyOrExactAltaTrailer(payload: Uint8Array, start: number, end: number): boolean {\n if (start === end) return true\n if (start < 0 || end > payload.length || start + _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE > end) {\n return false\n }\n\n const view = new DataView(\n payload.buffer,\n payload.byteOffset + start,\n end - start,\n )\n if (view.getUint16(0, false) !== _LEAF_MMTP_EXT_TYPE_ALTA_AUTH) return false\n\n const authLength = view.getUint16(2, false)\n return start + _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE + authLength === end\n}\n\ninterface DeclaredTrailerLayout {\n hasFecId: boolean\n}\n\nfunction resolveDeclaredTrailers(\n payload: Uint8Array,\n declaredEnd: number,\n fecType: number,\n options?: { skipFecId?: boolean },\n): DeclaredTrailerLayout | null {\n if (declaredEnd > payload.length) return null\n\n if (options?.skipFecId) {\n return isEmptyOrExactAltaTrailer(payload, declaredEnd, payload.length)\n ? { hasFecId: false }\n : null\n }\n\n if (fecType === 1) {\n const fecStart = payload.length - SOURCE_FEC_PAYLOAD_ID_SIZE\n if (fecStart < declaredEnd || !isEmptyOrExactAltaTrailer(payload, declaredEnd, fecStart)) {\n return null\n }\n return { hasFecId: true }\n }\n if (fecType !== 0) return null\n\n if (isEmptyOrExactAltaTrailer(payload, declaredEnd, payload.length)) {\n return { hasFecId: false }\n }\n\n return null\n}\n\n/**\n * Extract NAL unit payload from MMTP packet\n */\nexport function extractNALUnit(mmtpPacket: Uint8Array): Uint8Array {\n const extraction = extractMFUPayload(mmtpPacket)\n if (!extraction) throw new Error('Malformed MMTP MPU payload')\n return extraction.data\n}\n\n/** Result of extracting MFU payload from an MMTP packet */\nexport interface MFUExtraction {\n /** MMTP header fields */\n header: MMTPHeader\n /** MPU header fields */\n mpu: MPUHeader\n /** Fragment type (FT field, 4 bits): 0=metadata, 2=MFU data */\n fragmentType: number\n /** MFU payload data (video/audio bytes, headers stripped, FEC ID excluded) */\n data: Uint8Array\n /** Parsed timed MFU DU header when present, otherwise null */\n mfuDuHeader: MFUDuHeader | null\n /** Non-timed MFU Item_ID when the 4-byte DU header is present. */\n itemId: number | null\n /** Source FEC Payload ID if present (`FEC_type == 1`), or null */\n fecPayloadId: { ssId: number } | null\n}\n\n/**\n * Extract MFU payload from a raw MMTP packet.\n *\n * Handles all the byte arithmetic for:\n * - MMTP header (12 bytes)\n * - MPU sub-header (8 bytes, payloadLength field)\n * - MFU DU header (14 bytes timed / 4 bytes non-timed, only for FI \u2264 1)\n * - Source FEC Payload ID (4 bytes at end, only when `FEC_type == 1`)\n *\n * `payloadLength` is the ISO length-after-field value: six remaining MPU-header\n * bytes, then the MFU DU header when present, then media. ALTA and Source FEC\n * trailers are outside that declared span and must consume the exact suffix.\n *\n * @param mmtpPacket Raw MMTP packet (from multicast or MoQ)\n * @param options.skipFecId When true, do NOT subtract the 4-byte Source FEC Payload ID\n * from the payload boundary, even if fecType >= 1 in the MMTP header. Use this for\n * FEC-recovered symbols where the FEC PID was already stripped before WASM decoding\n * but the fecType bits in byte 0 still reflect the original packet (FEC Type=1 per\n * draft-ramadan-moq-mmt-00 \u00A73.1).\n * @returns Extracted MFU data + metadata, or null if packet is too small\n */\ninterface MfuPlan {\n header: MMTPHeader\n payload: Uint8Array\n mpu: MPUHeader\n fragmentType: number\n layout: MfuPayloadLayout\n trailerLayout: DeclaredTrailerLayout\n}\n\n/**\n * Single source of truth for whether a packet yields an MFU payload.\n *\n * `extractMFUPayload` and `explainMFURejection` both delegate here, so the\n * reason reported to operators can never drift from the decision the parser\n * actually made.\n */\nfunction planMfuExtraction(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n parsedHeader?: MMTPHeader,\n): { plan: MfuPlan } | { rejection: MFURejection } {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) {\n return {\n rejection: {\n gate: 'packet-shorter-than-mmtp-plus-mpu-header',\n detail: `${mmtpPacket.length} bytes < ${MMTP_HEADER_SIZE + MPU_HEADER_SIZE}`,\n },\n }\n }\n\n let header: MMTPHeader\n if (parsedHeader) {\n header = parsedHeader\n } else {\n try {\n header = parseMMTPHeader(mmtpPacket)\n } catch (error) {\n return {\n rejection: {\n gate: 'mmtp-header-unparseable',\n detail: error instanceof Error ? error.message : String(error),\n },\n }\n }\n }\n if (header.packetType !== PACKET_TYPE_MPU) {\n return {\n rejection: {\n gate: 'not-an-mpu-packet',\n detail: `packetType=0x${header.packetType.toString(16).padStart(2, '0')}`,\n },\n }\n }\n\n const payload = mmtpPacket.subarray(header.headerLength)\n if (payload.length < MPU_HEADER_SIZE) {\n return {\n rejection: {\n gate: 'payload-shorter-than-mpu-header',\n detail: `${payload.length} bytes < ${MPU_HEADER_SIZE}`,\n },\n }\n }\n\n const mpu = parseMPUHeader(payload)\n if (mpu.aggregationFlag) {\n return {\n rejection: { gate: 'aggregation-flag-set', detail: 'strict profile requires A=0' },\n }\n }\n\n // Fragment type from byte 2 upper nibble (not returned by parseMPUHeader)\n const fragmentType = (payload[2]! >> 4) & 0x0f\n\n const layoutResult = resolveMfuPayloadLayout(mpu, fragmentType, payload)\n if ('rejection' in layoutResult) return layoutResult\n const { layout } = layoutResult\n\n const trailerLayout = resolveDeclaredTrailers(\n payload,\n layout.dataEnd,\n header.fecType,\n options,\n )\n if (!trailerLayout) {\n // The most common cause is a producer whose Source FEC Payload ID width\n // disagrees with ISO/IEC 23008-1 \u00A7C.5.2. Name that explicitly rather than\n // leaving operators to infer it from a generic trailer error.\n if (!options?.skipFecId && header.fecType === 1) {\n const observed = payload.length - layout.dataEnd\n if (observed !== SOURCE_FEC_PAYLOAD_ID_SIZE) {\n return {\n rejection: {\n gate: 'source-fec-payload-id-width-mismatch',\n detail:\n `producer wrote a ${observed}-byte Source FEC Payload ID, ` +\n `ISO/IEC 23008-1 \u00A7C.5.2 requires ${SOURCE_FEC_PAYLOAD_ID_SIZE} ` +\n `(payload=${payload.length}, declaredEnd=${layout.dataEnd})`,\n },\n }\n }\n }\n return {\n rejection: {\n gate: 'declared-trailers-unresolved',\n detail:\n `trailer bytes [${layout.dataEnd}, ${payload.length}) are neither empty ` +\n `nor an exact ALTA trailer (fecType=${header.fecType})`,\n },\n }\n }\n\n return { plan: { header, payload, mpu, fragmentType, layout, trailerLayout } }\n}\n\n/**\n * Report why `extractMFUPayload` would refuse this packet, or null if it would\n * accept it.\n *\n * `extractMFUPayload` returns bare `null` on ten distinct conditions, which\n * makes a producer/consumer framing disagreement indistinguishable from a\n * publisher that never started \u2014 both render as silence. Use this wherever\n * that distinction matters: diagnostics, contract tests, and operator-facing\n * logs.\n */\nexport function explainMFURejection(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n): MFURejection | null {\n const result = planMfuExtraction(mmtpPacket, options)\n return 'rejection' in result ? result.rejection : null\n}\n\nexport function extractMFUPayload(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n): MFUExtraction | null {\n return extractPlannedMfu(mmtpPacket, planMfuExtraction(mmtpPacket, options))\n}\n\n/**\n * extractMFUPayload for a caller that already holds this packet's parsed MMTP\n * header, so the header is not parsed a second time (BLO-36599).\n *\n * `header` must be `parseMMTPHeader(mmtpPacket)` of this same packet; the\n * result is then identical to `extractMFUPayload(mmtpPacket, options)`.\n */\nexport function extractMFUPayloadWithHeader(\n mmtpPacket: Uint8Array,\n header: MMTPHeader,\n options?: { skipFecId?: boolean },\n): MFUExtraction | null {\n return extractPlannedMfu(mmtpPacket, planMfuExtraction(mmtpPacket, options, header))\n}\n\nfunction extractPlannedMfu(\n mmtpPacket: Uint8Array,\n result: { plan: MfuPlan } | { rejection: MFURejection },\n): MFUExtraction | null {\n if ('rejection' in result) return null\n const { header, payload, mpu, fragmentType, layout, trailerLayout } = result.plan\n\n const mfuDuHeaderPresent = layout.hasMfuDuHeader\n const mfuOffset = layout.mfuOffset\n const dataEnd = layout.dataEnd\n\n const mfuDuHeader =\n mfuDuHeaderPresent && mpu.timedFlag === 1\n ? parseTimedMfuDuHeader(payload, MPU_HEADER_SIZE)\n : null\n const itemId =\n mfuDuHeaderPresent && mpu.timedFlag === 0\n ? new DataView(payload.buffer, payload.byteOffset + MPU_HEADER_SIZE, 4).getUint32(0, false)\n : null\n\n const data = payload.subarray(mfuOffset, dataEnd)\n\n const fecPayloadId = trailerLayout.hasFecId\n ? {\n ssId: new DataView(\n mmtpPacket.buffer,\n mmtpPacket.byteOffset + mmtpPacket.length - SOURCE_FEC_PAYLOAD_ID_SIZE,\n SOURCE_FEC_PAYLOAD_ID_SIZE,\n ).getUint32(0, false),\n }\n : null\n\n return { header, mpu, fragmentType, data, mfuDuHeader, itemId, fecPayloadId }\n}\n\n/**\n * Extract timestamp from MMTP packet\n */\nexport function extractTimestamp(mmtpPacket: Uint8Array): bigint {\n const { header } = unwrapMMTP(mmtpPacket)\n return header.timestamp\n}\n\n/**\n * Check if MMTP packet is an FEC repair packet\n * FEC_type 2 and 3 are repair packets\n */\nexport function isFecRepairPacket(mmtpPacket: Uint8Array): boolean {\n if (mmtpPacket.length < 1) return false\n const fecType = (mmtpPacket[0]! >> 3) & 0x03\n return fecType >= 2\n}\n\n/**\n * Extract Source FEC Payload ID (SS_ID) from the last 4 bytes of an MMTP\n * source packet per ISO/IEC 23008-1:2023 Section C.5.2 Figure C.10.\n *\n * SS_ID is a flat 32-bit monotonic counter (incremented by 1 per packet\n * for ssbg_mode0 and ssbg_mode1). Block membership and ESI use the\n * configured K; repair SS_Start identifies the first SS_ID of the block and\n * SSB_length records the authored source-symbol count:\n * SBN = floor(SS_ID / K), ESI = SS_ID % K\n * SS_Start = SBN * K (first SS_ID of the block)\n *\n * This matches FFmpeg moqenc_mmt.c, the drafts (draft-ramadan-moq-fec \u00A76.2),\n * and ATSC A/331 \u00A78.1.2.5 which defers to ISO 23008-1 Annex C.\n */\nexport function extractFecPayloadId(mmtpPacket: Uint8Array): { ssId: number } | null {\n const header = parseHeaderForSourceFecId(mmtpPacket)\n return header ? sourceFecPayloadIdOf(mmtpPacket, header) : null\n}\n\n/**\n * Return true when FEC_type=1 and the exact suffix after the ISO-declared MPU\n * payload contains a four-byte Source FEC Payload ID.\n */\nexport function hasSourceFecPayloadId(mmtpPacket: Uint8Array): boolean {\n const header = parseHeaderForSourceFecId(mmtpPacket)\n return header !== null && sourceFecPayloadIdOf(mmtpPacket, header) !== null\n}\n\nfunction parseHeaderForSourceFecId(mmtpPacket: Uint8Array): MMTPHeader | null {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) return null\n try {\n return parseMMTPHeader(mmtpPacket)\n } catch {\n return null\n }\n}\n\n/**\n * The Source FEC Payload ID of a packet whose MMTP header the caller already\n * parsed, or null when the packet carries none: present only when FEC_type=1\n * and the exact suffix after the ISO-declared MPU payload holds the four-byte\n * ID (ISO/IEC 23008-1 \u00A7C.5.2). Same answer as extractFecPayloadId, without a\n * second header parse (BLO-36599).\n *\n * `header` must be `parseMMTPHeader(mmtpPacket)` of this same packet.\n */\nexport function sourceFecPayloadIdOf(\n mmtpPacket: Uint8Array,\n header: MMTPHeader,\n): { ssId: number } | null {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) return null\n if (header.packetType !== PACKET_TYPE_MPU) return null\n\n const payload = mmtpPacket.subarray(header.headerLength)\n if (payload.length < MPU_HEADER_SIZE) return null\n const payloadLength = (payload[0]! << 8) | payload[1]!\n if (payloadLength < MPU_HEADER_REMAINDER_SIZE) return null\n const declaredEnd = MPU_LENGTH_FIELD_SIZE + payloadLength\n if (!resolveDeclaredTrailers(payload, declaredEnd, header.fecType)?.hasFecId) return null\n\n // Flat 4-byte SS_ID: encoder writes block_id * K + symbol_id\n const off = mmtpPacket.length - SOURCE_FEC_PAYLOAD_ID_SIZE\n return {\n ssId:\n ((mmtpPacket[off]! << 24) |\n (mmtpPacket[off + 1]! << 16) |\n (mmtpPacket[off + 2]! << 8) |\n mmtpPacket[off + 3]!) >>>\n 0,\n }\n}\n\n/**\n * MMTP header-extension ext_type assigned to the detached ALTA authenticator\n * trailer (Path 2 / 08-07). Carried in an `[ext_type][ext_length][auth]`\n * block appended after the MPU's declared payload bytes, before the 4-byte\n * Source FEC Payload ID. MMTP X-bit stays 0 \u2014 non-ALTA MMTP receivers treat\n * the trailer as bytes past `payload_length` and skip it (per ISO 23008-1\n * \u00A79.2.2 \"may be discarded without impacting correct processing\").\n */\n// Re-export the ALTA trailer helper from the zero-dep leaf package. The leaf\n// owns the implementation so container and FEC consumers share one parser\n// without creating a package cycle.\nexport const MMTP_EXT_TYPE_ALTA_AUTH = _LEAF_MMTP_EXT_TYPE_ALTA_AUTH\nexport const MMTP_EXT_TRAILER_HEADER_SIZE = _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE\nexport type AltaTrailer = _LeafAltaTrailer\nexport const extractAltaTrailer = _leafExtractAltaTrailer\n\n/** Size of Repair FEC Payload ID per ISO/IEC 23008-1 Section C.5.3 */\nexport const REPAIR_FEC_PID_SIZE = 13\n\n/**\n * Parse the 13-byte Repair FEC Payload ID after the complete dynamic MMTP header.\n * `parsedHeader`, when given, must be `parseMMTPHeader(mmtpPacket)` of this\n * same packet; it spares the second header parse (BLO-36599).\n */\nfunction readRepairFecPayloadIdFields(mmtpPacket: Uint8Array, parsedHeader?: MMTPHeader): {\n packetId: number; ssStart: number; rsbLength: number; rsId: number; ssbLength: number; dataOffset: number\n} | null {\n let header: MMTPHeader\n if (parsedHeader) {\n header = parsedHeader\n } else {\n try {\n header = parseMMTPHeader(mmtpPacket)\n } catch {\n return null\n }\n }\n if (header.packetType !== PACKET_TYPE_REPAIR || header.fecType !== 2) return null\n\n const off = header.headerLength\n if (mmtpPacket.length < off + REPAIR_FEC_PID_SIZE) return null\n const ssStart =\n ((mmtpPacket[off]! << 24) |\n (mmtpPacket[off + 1]! << 16) |\n (mmtpPacket[off + 2]! << 8) |\n mmtpPacket[off + 3]!) >>>\n 0 // 32 bits\n const rsbLength = (mmtpPacket[off + 4]! << 16) | (mmtpPacket[off + 5]! << 8) | mmtpPacket[off + 6]! // 24 bits\n const rsId = (mmtpPacket[off + 7]! << 16) | (mmtpPacket[off + 8]! << 8) | mmtpPacket[off + 9]! // 24 bits\n const ssbLength = (mmtpPacket[off + 10]! << 16) | (mmtpPacket[off + 11]! << 8) | mmtpPacket[off + 12]! // 24 bits\n return {\n packetId: header.packetId,\n ssStart,\n rsbLength,\n rsId,\n ssbLength,\n dataOffset: off + REPAIR_FEC_PID_SIZE,\n }\n}\n\n/**\n * Extract Repair FEC Payload ID from a raw-multicast MMTP repair packet.\n * Per ISO/IEC 23008-1:2023 Section C.5.3 (ssbg_mode0, one-stage, no FFSRP_TS):\n * [MMTP header][SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][repair data]\n * OTI is delivered via AL-FEC signaling message (Table C.3), not per-packet.\n *\n * Byte 1 is reserved(2)|packet_type(6) for V=0, so repair type 0x03 is 0x03.\n * Pre-migration high-bits bytes (0x0c) are rejected \u2014 no compatibility decode.\n */\nexport function extractRepairFecPayloadId(mmtpPacket: Uint8Array): {\n ssStart: number; rsbLength: number; rsId: number; ssbLength: number\n} | null {\n const fields = readRepairFecPayloadIdFields(mmtpPacket)\n if (!fields) return null\n return {\n ssStart: fields.ssStart,\n rsbLength: fields.rsbLength,\n rsId: fields.rsId,\n ssbLength: fields.ssbLength,\n }\n}\n\n/** Parsed MoQ repair frame per ISO/IEC 23008-1 Section C.4.3 + C.5.3 */\nexport interface MoqRepairFrame {\n /** MMTP packetId (1=video, 2=audio) \u2014 for routing to correct FEC decoder */\n packetId: number\n /** SS_Start (32 bits): SS_ID of first source symbol in block */\n ssStart: number\n /** RSB_length (24 bits): number of repair symbols (P) */\n rsbLength: number\n /** RS_ID (24 bits): repair symbol index (0-based) */\n rsId: number\n /** SSB_length (24 bits): authored source-symbol count (1..=configured K) */\n ssbLength: number\n /** Repair symbol data after the dynamic MMTP header and 13-byte FEC payload ID. */\n symbolData: Uint8Array\n}\n\n/**\n * Parse a MoQ repair frame (ISO/IEC 23008-1 Annex C format).\n *\n * Wire format per ISO 23008-1 \u00A7C.4.3 + \u00A7C.5.3:\n * MMTP Header: fixed 12 bytes plus C/X optional fields\n * then SS_Start (4 bytes) \u2192 block identifier\n * then RSB_length (3 bytes) \u2192 P\n * then RS_ID (3 bytes) \u2192 ESI = K + RS_ID\n * then SSB_length (3 bytes) \u2192 authored source-symbol count (1..=K)\n * then Repair Symbol Data (T bytes)\n *\n * @param frame - Raw MoQ repair frame bytes\n * @returns Parsed frame or null if invalid\n */\nexport function parseMoqRepairFrame(frame: Uint8Array): MoqRepairFrame | null {\n return moqRepairFrameFrom(frame, readRepairFecPayloadIdFields(frame))\n}\n\n/**\n * parseMoqRepairFrame for a caller that already holds this frame's parsed MMTP\n * header, so the header is not parsed a second time (BLO-36599). The router's\n * multicast repair branch uses it: one repair packet in every K + P otherwise\n * paid two header parses.\n *\n * `header` must be `parseMMTPHeader(frame)` of this same frame; the result is\n * then identical to `parseMoqRepairFrame(frame)`.\n */\nexport function parseMoqRepairFrameWithHeader(\n frame: Uint8Array,\n header: MMTPHeader,\n): MoqRepairFrame | null {\n return moqRepairFrameFrom(frame, readRepairFecPayloadIdFields(frame, header))\n}\n\nfunction moqRepairFrameFrom(\n frame: Uint8Array,\n repairId: ReturnType<typeof readRepairFecPayloadIdFields>,\n): MoqRepairFrame | null {\n if (!repairId) return null\n\n const symbolData = frame.subarray(repairId.dataOffset)\n if (\n repairId.rsbLength === 0 ||\n repairId.ssbLength === 0 ||\n repairId.rsId >= repairId.rsbLength ||\n symbolData.length === 0\n ) return null\n\n return {\n packetId: repairId.packetId,\n ssStart: repairId.ssStart,\n rsbLength: repairId.rsbLength,\n rsId: repairId.rsId,\n ssbLength: repairId.ssbLength,\n symbolData,\n }\n}\n\n// The signalling-message parsers (9.3.4.2 payload header, AL-FEC message,\n// PA/MPT) live in ./signalling.ts.\n", "/**\n * NTP short format (RFC 5905 \u00A76): an unsigned 32-bit, 16.16 fixed-point count\n * of seconds. The MMTP header `timestamp` field (ISO/IEC 23008-1 \u00A79.2.2)\n * carries each packet's UTC sending instant in this format, so the value wraps\n * to 0 every 2^16 s (~18.2 h).\n *\n * Plain numeric order on these values breaks at every wrap: a retained\n * `Math.max` stays at the pre-wrap value and every later instant compares as\n * older. Order send times only with {@link compareNtpShort}, which applies\n * RFC 1982 serial-number arithmetic over the field's width.\n */\n\n/** Width in bits of the MMTP `timestamp` field (NTP short). */\nexport const NTP_SHORT_BITS = 32\n\n/** Number of distinct NTP-short values; the field wraps to 0 here. */\nexport const NTP_SHORT_MODULUS = 2 ** NTP_SHORT_BITS\n\n/**\n * RFC 1982 \u00A73.2's `2^(SERIAL_BITS - 1)`. Two values whose forward distance is\n * below this are ordered; exactly this far apart they are not ordered at all.\n * Two instants must be less than this far apart (2^15 s, ~9.1 h of send time)\n * for the comparison to give their true order.\n */\nexport const NTP_SHORT_HALF_RANGE = 2 ** (NTP_SHORT_BITS - 1)\n\n/**\n * Serial order of one NTP-short value relative to another.\n *\n * `'unordered'` is RFC 1982's undefined case: the values are exactly\n * {@link NTP_SHORT_HALF_RANGE} apart, so neither precedes the other. It is\n * never folded into `'before'` or `'after'`; each caller decides what an\n * unorderable pair means for it.\n */\nexport type NtpShortOrder = 'before' | 'equal' | 'after' | 'unordered'\n\n/** True when `value` is an NTP-short value: an integer in [0, NTP_SHORT_MODULUS). */\nexport function isNtpShort(value: number): boolean {\n return Number.isInteger(value) && value >= 0 && value < NTP_SHORT_MODULUS\n}\n\n/**\n * RFC 1982 serial comparison of NTP-short `a` against `b`: `'after'` when `a`\n * is the later instant, `'before'` when it is the earlier one.\n *\n * The answer is the true order only while the two instants are less than\n * {@link NTP_SHORT_HALF_RANGE} apart. Past that a 32-bit field cannot tell\n * later from earlier, and the result names whichever direction is nearer.\n * This is not a total order (it is not transitive across the whole space), so\n * it must never be used to sort.\n *\n * @throws {RangeError} if either operand is not an NTP-short value\n */\nexport function compareNtpShort(a: number, b: number): NtpShortOrder {\n if (!isNtpShort(a) || !isNtpShort(b)) {\n throw new RangeError(\n `NTP-short values must be integers in [0, 2^${NTP_SHORT_BITS}), got ${String(a)} and ${String(b)}`,\n )\n }\n if (a === b) return 'equal'\n // Forward distance from b to a, reduced into [1, NTP_SHORT_MODULUS). Both\n // operands are below 2^32, so every step is exact in a double.\n const forward = (a - b + NTP_SHORT_MODULUS) % NTP_SHORT_MODULUS\n if (forward < NTP_SHORT_HALF_RANGE) return 'after'\n if (forward > NTP_SHORT_HALF_RANGE) return 'before'\n return 'unordered'\n}\n", "/**\n * RFC 1982 serial-number arithmetic for the 32-bit MMTP AL-FEC symbol\n * counters (ISO/IEC 23008-1:2023 C.5.2 SS_ID, C.5.3 SS_Start).\n *\n * SS_ID is a 32-bit field, so a stream that runs long enough wraps it to 0.\n * Ordering two SS_IDs (or two blocks by their first SS_ID) with `<` reads\n * every post-wrap value as older than every pre-wrap one. Serial order\n * agrees with `<` whenever the two values are less than 2^31 apart, so for\n * every stream that has not reached the wrap the result is unchanged; only\n * the order across the wrap point differs (BLO-35597 iso:5).\n */\n\n/** 2^SERIAL_BITS for SERIAL_BITS = 32. */\nexport const SERIAL32_SPAN = 0x1_0000_0000\n\n/** RFC 1982 \u00A73.2's 2^(SERIAL_BITS - 1). */\nexport const SERIAL32_HALF = 0x8000_0000\n\nfunction assertUint32(value: number, name: string): void {\n if (!Number.isInteger(value) || value < 0 || value >= SERIAL32_SPAN) {\n throw new RangeError(`${name} must be a uint32 (got ${value})`)\n }\n}\n\n/**\n * RFC 1982 \u00A73.1 addition, extended to negative `n` for the matching\n * subtraction: `(s + n) mod 2^32`. `n` must lie in (-2^31, 2^31).\n */\nexport function serial32Add(s: number, n: number): number {\n assertUint32(s, 's')\n if (!Number.isInteger(n) || n <= -SERIAL32_HALF || n >= SERIAL32_HALF) {\n throw new RangeError(`serial addend must lie in (-2^31, 2^31) (got ${n})`)\n }\n return (s + n + SERIAL32_SPAN) % SERIAL32_SPAN\n}\n\n/** Forward distance from `from` to `to`: `(to - from) mod 2^32`. */\nexport function serial32Distance(from: number, to: number): number {\n return (to - from) >>> 0\n}\n\n/**\n * RFC 1982 \u00A73.2: `a` precedes `b`. Values exactly 2^31 apart are unordered\n * (neither precedes the other).\n */\nexport function serial32Precedes(a: number, b: number): boolean {\n const distance = serial32Distance(a, b)\n return distance !== 0 && distance < SERIAL32_HALF\n}\n\n/**\n * First SS_ID of block `sbn` under the K-stride numbering every current\n * sender uses (`SS_ID = SBN * K + ESI`, C.5.2), reduced mod 2^32.\n */\nexport function kStrideBlockStart(sbn: number, k: number): number {\n assertUint32(sbn, 'sbn')\n if (!Number.isInteger(k) || k < 1 || k >= SERIAL32_HALF) {\n throw new RangeError(`k must be a positive integer below 2^31 (got ${k})`)\n }\n // sbn < 2^32 and k < 2^31 keep the product below 2^63, but a double is\n // exact only to 2^53; split the product so every step is exact.\n const high = Math.floor(sbn / 0x1_0000) // < 2^16\n const low = sbn % 0x1_0000 // < 2^16\n return (((high * k) % SERIAL32_SPAN) * 0x1_0000 + low * k) % SERIAL32_SPAN\n}\n\n/**\n * Whether block `a` precedes block `b`, ordering the blocks by their first\n * SS_ID in serial arithmetic. Identical to `a < b` for any two blocks of a\n * stream that has not wrapped SS_ID.\n */\nexport function kStrideBlockPrecedes(a: number, b: number, k: number): boolean {\n return serial32Precedes(kStrideBlockStart(a, k), kStrideBlockStart(b, k))\n}\n\n/**\n * How many blocks `a` lies behind `b`: 0 when `a` does not precede `b`,\n * otherwise `ceil(distance / K)` over the SS_ID distance between their first\n * symbols. Without a wrap that is exactly `b - a`; across the wrap the one\n * short pre-wrap block (2^32 mod K symbols) still counts as one block.\n */\nexport function kStrideBlocksBehind(a: number, b: number, k: number): number {\n const from = kStrideBlockStart(a, k)\n const to = kStrideBlockStart(b, k)\n if (!serial32Precedes(from, to)) return 0\n return Math.ceil(serial32Distance(from, to) / k)\n}\n\n/**\n * Whether `sbn` and `k` describe a block of the K-stride numbering:\n * `sbn` a uint32, `k` an integer in 1..2^31-1.\n */\nexport function isKStrideBlock(sbn: number, k: number): boolean {\n return Number.isInteger(sbn) && sbn >= 0 && sbn < SERIAL32_SPAN &&\n Number.isInteger(k) && k >= 1 && k < SERIAL32_HALF\n}\n\n/**\n * The block after `sbn`: `sbn + 1`, or 0 once `(sbn + 1) * K` reaches 2^32\n * and the next SS_ID wraps (C.5.2). There are `ceil(2^32 / K)` blocks per\n * wrap, the last of them short when K does not divide 2^32.\n */\nexport function kStrideNextBlock(sbn: number, k: number): number {\n assertUint32(sbn, 'sbn')\n kStrideBlockStart(sbn, k) // validates k\n return (sbn + 1) * k >= SERIAL32_SPAN ? 0 : sbn + 1\n}\n", "/**\n * FEC block profile (BLO-35597, ISO/IEC 23008-1 Annex C).\n *\n * Every catalog `fec` object that declares an FEC instance names exactly one\n * block profile in `fec.blockProfile`. A receiver applies all of a profile's\n * rules or none of them, so the token is the one explicit per-stream\n * discriminator: it is never defaulted and never inferred from the wire.\n *\n * - `k-padded-v1` (legacy, Blockcast-private): a source symbol is the\n * protected MMTP packet zero-padded to T with no length field; every block\n * is a K-symbol RaptorQ block whose ESIs `SSB_length..K-1` are implicit\n * zero padding; `SS_ID = SBN*K + ESI`, so `SS_Start = SBN*K`; repair\n * ESI = K + RS_ID; the MoQ repair group id is the SBN.\n * - `iso-ssbg1-v1`: ssbg_mode1 (C.3.3): a source symbol is\n * `u16 length || protected packet || zero padding` to T; a block is a\n * K' = SSB_length RaptorQ block (C.5.3) and repair ESI = SSB_length + RS_ID;\n * SS_ID increments by one per FEC source packet and wraps at 2^32 (C.5.2),\n * so a block is located by membership in `[SS_Start, SS_Start + SSB_length)`\n * under RFC 1982 serial arithmetic; the MoQ repair group id is the 62-bit\n * wrap-epoch-extended SS_Start. The AL-FEC coding byte for this profile is\n * 0x14 (one-stage, ssbg_mode1, fec_payload_id_mode 0, Amd 1:2025 Table C.3).\n */\nimport { serial32Add, serial32Distance, serial32Precedes } from './serial-number.js'\n\n/** The two block profiles a catalog `fec.blockProfile` may name. */\nexport type FecBlockProfile = 'k-padded-v1' | 'iso-ssbg1-v1'\n\n/** Every accepted `fec.blockProfile` token, legacy first. */\nexport const FEC_BLOCK_PROFILES: readonly FecBlockProfile[] = Object.freeze([\n 'k-padded-v1',\n 'iso-ssbg1-v1',\n])\n\n/** True for a known block-profile token. */\nexport function isFecBlockProfile(value: unknown): value is FecBlockProfile {\n return value === 'k-padded-v1' || value === 'iso-ssbg1-v1'\n}\n\n/**\n * Read a required `fec.blockProfile`. Throws on an absent or unknown token:\n * there is no default and nothing is inferred, because the two profiles carry\n * identical wire tuples whose repair math differs.\n *\n * @param where the catalog path of the field, for the error message.\n */\nexport function parseFecBlockProfile(value: unknown, where: string): FecBlockProfile {\n if (isFecBlockProfile(value)) return value\n if (value === undefined) {\n throw new Error(\n `${where} is required: name the FEC block profile (\"k-padded-v1\" or \"iso-ssbg1-v1\")`,\n )\n }\n throw new Error(\n `${where} must be \"k-padded-v1\" or \"iso-ssbg1-v1\" (got ${JSON.stringify(value)})`,\n )\n}\n\n/** ISO/IEC 23008-1 C.3.3 ssbg_mode1: the two-octet packet length field. */\nexport const SSBG1_LENGTH_FIELD_BYTES = 2\n\n/** The largest protected packet an ssbg_mode1 symbol of size T can carry. */\nexport function ssbg1MaxPacketLength(symbolSize: number): number {\n return symbolSize - SSBG1_LENGTH_FIELD_BYTES\n}\n\n/** Whether a protected packet of `packetLength` bytes fits one T-byte ssbg_mode1 symbol. */\nexport function ssbg1FitsSymbol(packetLength: number, symbolSize: number): boolean {\n return (\n Number.isSafeInteger(packetLength) &&\n packetLength >= 0 &&\n packetLength <= ssbg1MaxPacketLength(symbolSize) &&\n packetLength <= 0xffff\n )\n}\n\n/**\n * Build one ssbg_mode1 source symbol (C.3.3): the protected packet's length\n * in two octets, network byte order, then the packet, then zero octets up to\n * T. The protected packet is the MMTP packet before its Source FEC Payload ID\n * is appended (C.4.2).\n *\n * @throws when `length + 2 > T`: the packet cannot be protected under this\n * profile, and silently truncating it would corrupt every repair symbol.\n */\nexport function buildSsbg1SourceSymbol(packet: Uint8Array, symbolSize: number): Uint8Array {\n if (!Number.isSafeInteger(symbolSize) || symbolSize <= SSBG1_LENGTH_FIELD_BYTES) {\n throw new Error(`ssbg_mode1 symbol size must exceed ${SSBG1_LENGTH_FIELD_BYTES} (got ${symbolSize})`)\n }\n if (!ssbg1FitsSymbol(packet.byteLength, symbolSize)) {\n throw new Error(\n `ssbg_mode1 source symbol needs ${packet.byteLength} + ${SSBG1_LENGTH_FIELD_BYTES} bytes but T is ${symbolSize}`,\n )\n }\n const symbol = new Uint8Array(symbolSize)\n symbol[0] = (packet.byteLength >>> 8) & 0xff\n symbol[1] = packet.byteLength & 0xff\n symbol.set(packet, SSBG1_LENGTH_FIELD_BYTES)\n return symbol\n}\n\n/**\n * Recover the protected packet from one ssbg_mode1 source symbol: the bytes\n * the length field names. Returns null, never a guess, when the length field\n * points past the symbol or any padding octet is non-zero (C.3.3 padding is\n * all 00h), since either means the recovered symbol is not what was sent.\n */\nexport function trimSsbg1SourceSymbol(symbol: Uint8Array): Uint8Array | null {\n if (symbol.byteLength < SSBG1_LENGTH_FIELD_BYTES) return null\n const length = (symbol[0]! << 8) | symbol[1]!\n const end = SSBG1_LENGTH_FIELD_BYTES + length\n if (end > symbol.byteLength) return null\n for (let i = end; i < symbol.byteLength; i++) {\n if (symbol[i] !== 0) return null\n }\n return symbol.subarray(SSBG1_LENGTH_FIELD_BYTES, end)\n}\n\n/** The SS_ID after the last source symbol of `[ssStart, ssStart + ssbLength)`. */\nexport function isoBlockEnd(ssStart: number, ssbLength: number): number {\n return serial32Add(ssStart, ssbLength)\n}\n\n/**\n * Range membership (C.5.2, C.5.3): whether `ssId` is one of the\n * `ssbLength` consecutive SS_IDs starting at `ssStart`, modulo 2^32.\n */\nexport function isoBlockContains(ssStart: number, ssbLength: number, ssId: number): boolean {\n return serial32Distance(ssStart, ssId) < ssbLength\n}\n\n/**\n * A lower bound on how many blocks the block starting at `a` lies behind the\n * one starting at `b` (0 when `a` does not precede `b`). An iso-ssbg1-v1\n * block holds at most `kMax` source symbols (the catalog `sourceSymbols`, the\n * AL-FEC maximum_k_for_repair_flow), so `n * kMax` SS_IDs always span at least\n * `n` blocks. Every interleave horizon in the receiver (decoder retention,\n * worker retirement, ordered-relay settlement) uses this one bound, so the\n * manager's horizon can never fall inside the decoder's.\n */\nexport function isoBlocksBehindLowerBound(a: number, b: number, kMax: number): number {\n if (!Number.isSafeInteger(kMax) || kMax <= 0) {\n throw new Error(`iso-ssbg1-v1 block horizon needs a positive maximum K (got ${kMax})`)\n }\n return serial32Precedes(a, b) ? Math.floor(serial32Distance(a, b) / kMax) : 0\n}\n", "/**\n * iso-ssbg1-v1 block location for one FEC stream (BLO-35597 iso:2/iso:3/iso:5).\n *\n * Under ISO/IEC 23008-1 C.5.2 the SS_ID increments by one per FEC source\n * packet and wraps at 2^32, and a block is the SS_ID range\n * `[SS_Start, SS_Start + SSB_length)` its Repair FEC Payload ID states (C.5.3).\n * Block lengths vary, so `floor(SS_ID / K)` locates nothing: a source symbol\n * belongs to a block only once a repair symbol has stated that block's range.\n * A source that arrives first is held, unplaced, and handed back when a repair\n * places it. Nothing here guesses a boundary.\n *\n * Coverage grows contiguously from the first block a repair states. When a\n * repair states a block that starts after the end of known coverage, the SS_IDs\n * between are one or more blocks whose every repair symbol was lost: they are\n * kept as one repair-less span, which completes clean once all of its SS_IDs\n * arrived (C.5.2 makes a gap in consecutive SS_IDs directly visible) and\n * otherwise resolves through its catalog-derived deadline. That is the only\n * way a block without repair completes: on the next block's SS_Start, never on\n * a count of K source symbols.\n */\nimport {\n isoBlockContains,\n isoBlockEnd,\n isoBlocksBehindLowerBound,\n serial32Add,\n serial32Distance,\n serial32Precedes,\n} from '@blockcast/mmt-base'\n\n/** One block (or repair-less span) the locator knows the exact range of. */\nexport interface IsoBlockRange {\n readonly start: number\n readonly length: number\n /** True for SS_IDs between two stated blocks whose own repair never came. */\n readonly span: boolean\n}\n\n/** A held source symbol handed back with its block coordinate. */\nexport interface IsoPlacedSource<T> {\n readonly ssId: number\n readonly esi: number\n readonly payload: T\n}\n\n/** What one repair symbol's `(SS_Start, SSB_length)` did to the locator. */\nexport type IsoRepairPlacement<T> =\n | {\n readonly status: 'placed'\n readonly block: IsoBlockRange\n /** Sources this repair placed into `block`, in SS_ID order. */\n readonly placed: readonly IsoPlacedSource<T>[]\n /** The repair-less span this repair closed in front of `block`, if any. */\n readonly span?: { readonly block: IsoBlockRange; readonly placed: readonly IsoPlacedSource<T>[] }\n }\n /** Not a block this stream can use; the repair symbol is dropped. */\n | { readonly status: 'conflict' | 'overlap' | 'stale'; readonly reason: string }\n\n/**\n * Retention: the locator is never without one. Every call that can grow it\n * (`hold`, `placeRepair`) retires, behind the position it just saw, every\n * block, span and held source more than `retentionBlocks` blocks back, by the\n * one ISO horizon metric (`isoBlocksBehindLowerBound`). A block is measured\n * from its last SS_ID, so it stays while any SS_ID of it is inside the\n * horizon: a repair-less span has no length bound, and one measured from its\n * start could be retired the moment it is created, before the sources it\n * placed are fed. Held sources are additionally capped at the SS_IDs the\n * horizon spans (`(retentionBlocks + 1) * kMax`): consecutive SS_IDs (C.5.2)\n * cannot hold more inside it, so the cap only ever bites on a stream whose\n * SS_IDs are not consecutive, and then the oldest arrival goes first.\n */\nexport class IsoBlockLocator<T> {\n /** Known blocks and spans, in serial order of their start. */\n readonly #blocks: IsoBlockRange[] = []\n /** Held first-arrival sources whose block no repair has stated yet. */\n readonly #held = new Map<number, T>()\n /** End of contiguous coverage: the SS_ID the next unknown block starts at. */\n #coverageEnd: number | undefined\n readonly #kMax: number\n #retentionBlocks: number\n #heldEvicted = 0\n #newest: number | undefined\n\n /**\n * @param kMax the catalog maximum K (`sourceSymbols`), the bound on SSB_length.\n * @param retentionBlocks how many blocks behind the newest position the\n * locator keeps, derived by its owner from catalog timing; required, so\n * no locator exists without retention.\n */\n constructor(kMax: number, retentionBlocks: number) {\n if (!Number.isSafeInteger(kMax) || kMax <= 0) {\n throw new Error(`[IsoBlockLocator] maximum K must be a positive integer (got ${kMax})`)\n }\n this.#kMax = kMax\n this.#retentionBlocks = IsoBlockLocator.#checkedRetention(retentionBlocks)\n }\n\n static #checkedRetention(retentionBlocks: number): number {\n if (!Number.isSafeInteger(retentionBlocks) || retentionBlocks <= 0) {\n throw new Error(\n `[IsoBlockLocator] retention must be a positive integer number of blocks (got ${retentionBlocks})`,\n )\n }\n return retentionBlocks\n }\n\n get kMax(): number {\n return this.#kMax\n }\n\n /** Blocks behind the newest position the locator keeps. */\n get retentionBlocks(): number {\n return this.#retentionBlocks\n }\n\n /** Update the retention when the catalog timing it derives from changes. */\n set retentionBlocks(retentionBlocks: number) {\n this.#retentionBlocks = IsoBlockLocator.#checkedRetention(retentionBlocks)\n }\n\n /** The most sources held at once: the SS_IDs the retention horizon spans. */\n get heldCapacity(): number {\n return (this.#retentionBlocks + 1) * this.#kMax\n }\n\n /**\n * The newest position the stream has reached (RFC 1982 order): the newest\n * SS_ID of a source held, or fed once located (`observe`), or SS_Start of a\n * placed repair, so no source the stream has fed follows it. Undefined\n * before the first one.\n */\n get newest(): number | undefined {\n return this.#newest\n }\n\n /** Advance `newest` to `position` if it is newer; retires nothing. */\n observe(position: number): void {\n if (this.#newest === undefined || serial32Precedes(this.#newest, position)) this.#newest = position\n }\n\n /** Held sources evicted by `heldCapacity` (never by the horizon itself). */\n get heldEvicted(): number {\n return this.#heldEvicted\n }\n\n /** Number of known blocks and spans. */\n get blockCount(): number {\n return this.#blocks.length\n }\n\n /** End of contiguous coverage, or undefined before the first repair. */\n get coverageEnd(): number | undefined {\n return this.#coverageEnd\n }\n\n /** Number of sources held for a block no repair has stated yet. */\n get heldCount(): number {\n return this.#held.size\n }\n\n /** The known block or span containing `ssId`, with its ESI. */\n locate(ssId: number): { block: IsoBlockRange; esi: number } | null {\n for (let i = this.#blocks.length - 1; i >= 0; i--) {\n const block = this.#blocks[i]!\n if (isoBlockContains(block.start, block.length, ssId)) {\n return { block, esi: serial32Distance(block.start, ssId) }\n }\n }\n return null\n }\n\n /** The known block or span starting exactly at `start`. */\n blockAt(start: number): IsoBlockRange | undefined {\n return this.#blocks.find((block) => block.start === start)\n }\n\n /** Known blocks and spans overlapping the SS_IDs strictly between `a` and `b`. */\n blocksBetween(a: number, b: number): IsoBlockRange[] {\n const first = (a + 1) >>> 0\n const count = serial32Distance(a, b) - 1\n if (!serial32Precedes(a, b) || count <= 0) return []\n return this.#blocks.filter((block) => {\n const toBlock = serial32Distance(first, block.start)\n const fromBlock = serial32Distance(block.start, first)\n return toBlock < count || fromBlock < block.length\n })\n }\n\n /**\n * Whether every SS_ID strictly between `a` and `b` lies in known coverage,\n * so no block that could hold them is still to be stated by a repair.\n */\n coversBetween(a: number, b: number): boolean {\n if (this.#coverageEnd === undefined) return false\n if (!serial32Precedes(a, b) || serial32Distance(a, b) <= 1) return true\n // The last SS_ID strictly before b must precede the coverage end.\n return serial32Precedes((b - 1) >>> 0, this.#coverageEnd)\n }\n\n /**\n * Hold a first-arrival source symbol whose block is not yet known. Returns\n * false for a second copy of an SS_ID already held, so the first copy wins.\n * Retires behind `ssId` (see the class note).\n */\n hold(ssId: number, payload: T): boolean {\n if (this.#held.has(ssId)) return false\n this.#held.set(ssId, payload)\n this.retireBehind(ssId)\n for (const oldest of this.#held.keys()) {\n if (this.#held.size <= this.heldCapacity) break\n this.#held.delete(oldest)\n this.#heldEvicted++\n }\n return true\n }\n\n /** Whether `ssId` is held unplaced. */\n isHeld(ssId: number): boolean {\n return this.#held.has(ssId)\n }\n\n /**\n * Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a\n * block states its range and places every held source in it; later repair\n * symbols of the same block change nothing. A range that contradicts a\n * known block (a different length, or an overlap with another block or a\n * span) fails closed: the repair symbol is dropped and no block changes.\n * A newly stated block retires behind its SS_Start (see the class note).\n */\n placeRepair(start: number, length: number): IsoRepairPlacement<T> {\n if (!Number.isSafeInteger(length) || length <= 0 || length > this.#kMax) {\n return { status: 'conflict', reason: `SSB_length ${length} is outside 1..${this.#kMax}` }\n }\n const known = this.blockAt(start)\n if (known !== undefined) {\n if (known.span) {\n return { status: 'overlap', reason: `repair block ${start}+${length} falls inside a repair-less span` }\n }\n if (known.length !== length) {\n return {\n status: 'conflict',\n reason: `repair SSB_length ${length} conflicts with ${known.length} for SS_Start ${start}`,\n }\n }\n return { status: 'placed', block: known, placed: [] }\n }\n for (const block of this.#blocks) {\n if (\n isoBlockContains(block.start, block.length, start) ||\n isoBlockContains(start, length, block.start)\n ) {\n return {\n status: 'overlap',\n reason: `repair block ${start}+${length} overlaps known block ${block.start}+${block.length}`,\n }\n }\n }\n let span: { block: IsoBlockRange; placed: IsoPlacedSource<T>[] } | undefined\n if (this.#coverageEnd === undefined) {\n // Reception starts at the first stated block. Held sources before it\n // are the tail of blocks that began before the join: their range is\n // never stated, so they are not FEC symbols of this receiver.\n for (const ssId of this.#held.keys()) {\n if (serial32Precedes(ssId, start)) this.#held.delete(ssId)\n }\n this.#coverageEnd = start\n } else if (serial32Precedes(start, this.#coverageEnd)) {\n return { status: 'stale', reason: `repair block ${start}+${length} precedes known coverage` }\n } else if (start !== this.#coverageEnd) {\n const spanBlock: IsoBlockRange = {\n start: this.#coverageEnd,\n length: serial32Distance(this.#coverageEnd, start),\n span: true,\n }\n span = { block: spanBlock, placed: this.#claim(spanBlock) }\n this.#blocks.push(spanBlock)\n }\n const block: IsoBlockRange = { start, length, span: false }\n const placed = this.#claim(block)\n this.#blocks.push(block)\n this.#coverageEnd = isoBlockEnd(start, length)\n this.retireBehind(start)\n return span === undefined\n ? { status: 'placed', block, placed }\n : { status: 'placed', block, placed, span }\n }\n\n /**\n * Retire every block and span whose last SS_ID, and every held source,\n * lies more than `retentionBlocks` blocks behind `position`, with the shared\n * lower-bound metric (`isoBlocksBehindLowerBound`) every ISO interleave\n * horizon uses. Returns the retired block starts.\n */\n retireBehind(position: number): number[] {\n this.observe(position)\n const horizon = this.#retentionBlocks\n const retired: number[] = []\n for (let i = this.#blocks.length - 1; i >= 0; i--) {\n const block = this.#blocks[i]!\n const last = serial32Add(block.start, block.length - 1)\n if (isoBlocksBehindLowerBound(last, position, this.#kMax) > horizon) {\n retired.push(block.start)\n this.#blocks.splice(i, 1)\n }\n }\n for (const ssId of [...this.#held.keys()]) {\n if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon) this.#held.delete(ssId)\n }\n return retired\n }\n\n /** Forget everything (publisher restart, track reset). */\n reset(): void {\n this.#blocks.length = 0\n this.#held.clear()\n this.#coverageEnd = undefined\n this.#newest = undefined\n }\n\n #claim(block: IsoBlockRange): IsoPlacedSource<T>[] {\n const placed: IsoPlacedSource<T>[] = []\n for (const [ssId, payload] of this.#held) {\n if (!isoBlockContains(block.start, block.length, ssId)) continue\n placed.push({ ssId, esi: serial32Distance(block.start, ssId), payload })\n this.#held.delete(ssId)\n }\n placed.sort((x, y) => x.esi - y.esi)\n return placed\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAiBA,IAAM,kBAAkB;AACxB,IAAM,wBAAwB;AAC9B,IAAM,4BAA4B,kBAAkB;;;AC0D7C,IAAMA,mBAAkB;AAI/B,IAAMC,yBAAwB;AAC9B,IAAMC,6BAA4BC,mBAAkBF;;;ACrE7C,IAAM,iBAAiB;AAGvB,IAAM,oBAAoB,KAAK;AAQ/B,IAAM,uBAAuB,MAAM,iBAAiB;;;ACXpD,IAAM,gBAAgB;AAGtB,IAAM,gBAAgB;AAE7B,SAAS,aAAa,OAAe,MAAY;AAC/C,MAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,SAAS,eAAe;AACnE,UAAM,IAAI,WAAW,GAAG,IAAI,0BAA0B,KAAK,GAAG;EAChE;AACF;AAMM,SAAU,YAAY,GAAW,GAAS;AAC9C,eAAa,GAAG,GAAG;AACnB,MAAI,CAAC,OAAO,UAAU,CAAC,KAAK,KAAK,CAAC,iBAAiB,KAAK,eAAe;AACrE,UAAM,IAAI,WAAW,gDAAgD,CAAC,GAAG;EAC3E;AACA,UAAQ,IAAI,IAAI,iBAAiB;AACnC;AAGM,SAAU,iBAAiB,MAAc,IAAU;AACvD,SAAQ,KAAK,SAAU;AACzB;AAMM,SAAU,iBAAiB,GAAW,GAAS;AACnD,QAAM,WAAW,iBAAiB,GAAG,CAAC;AACtC,SAAO,aAAa,KAAK,WAAW;AACtC;;;
|
|
4
|
+
"sourcesContent": ["/**\n * Zero-dependency helper for extracting the detached ALTA authenticator trailer\n * from an MMTP source packet.\n *\n * Lives in its own leaf package so both `@blockcast/mmt-container` (wire-path\n * parsing) and `@blockcast/fec-worker` (FEC-recovered-source parsing) can share\n * one implementation without creating a package cycle between them.\n *\n * Spec: ISO/IEC 23008-1:2023 + draft-ramadan-moq-mmt \u00A712 (detached trailer, Path 2).\n */\n\n// --- Private MMTP/MPU/MFU constants (ISO/IEC 23008-1 \u00A79.2.2\u20139.2.3) ---\n// Duplicated here as immutable spec values so this package stays a leaf with\n// zero `@blockcast/*` dependencies. Re-deriving from `mmt-container` would\n// reintroduce the package cycle this split exists to avoid.\n\nconst MMTP_HEADER_SIZE = 12\nconst MPU_HEADER_SIZE = 8\nconst MPU_LENGTH_FIELD_SIZE = 2\nconst MPU_HEADER_REMAINDER_SIZE = MPU_HEADER_SIZE - MPU_LENGTH_FIELD_SIZE\nconst TIMED_MFU_DU_HEADER_SIZE = 14\nconst NONTIMED_MFU_DU_HEADER_SIZE = 4\nconst PACKET_TYPE_MPU = 0x00\n\n// --- Public ALTA trailer constants ---\n\n/**\n * MMTP header-extension ext_type assigned to the detached ALTA authenticator\n * trailer (Path 2 / 08-07). Carried in an `[ext_type][ext_length][auth]`\n * block appended after the MPU's declared payload bytes, before the 4-byte\n * Source FEC Payload ID. MMTP X-bit stays 0 \u2014 non-ALTA MMTP receivers treat\n * the trailer as bytes past `payload_length` and skip it (per ISO 23008-1\n * \u00A79.2.2 \"may be discarded without impacting correct processing\").\n */\nexport const MMTP_EXT_TYPE_ALTA_AUTH = 0xf0a1\n\n/** Fixed size of the trailer's `[ext_type][ext_length]` prefix (2 + 2 BE). */\nexport const MMTP_EXT_TRAILER_HEADER_SIZE = 4\n\n/** Result of extracting the detached ALTA authenticator from an MMTP packet. */\nexport interface AltaTrailer {\n /** Authenticator bytes (no ext_type/ext_length prefix, no trailing padding). */\n auth: Uint8Array\n /**\n * Wire-packet byte offset where the signed payload ends, i.e. where the\n * trailer begins. Caller uses this to produce\n * `payload = wirePacket.subarray(0, signedEnd)` for verify_detached.\n */\n signedEnd: number\n}\n\n/**\n * Extract the detached ALTA authenticator trailer from an MMTP source packet.\n *\n * Wire layout:\n * `[MMTP hdr][length(2)][remaining MPU hdr(6)][DU?][media][TRAILER][SS_ID?]`\n * `payload_length = 6 + DU bytes + media bytes`\n *\n * Returns `null` when:\n * - the packet is too small / malformed,\n * - `payload_length` cannot contain the remaining six MPU-header bytes,\n * - the declared payload overruns the packet,\n * - no bytes remain between `payload_length` and the SS_ID,\n * - the trailer's `ext_type` isn't {@link MMTP_EXT_TYPE_ALTA_AUTH},\n * - the declared `ext_length` would extend past the SS_ID boundary.\n *\n * Non-MPU packets (repair, signaling) always return `null`.\n *\n * @param options.skipFecId When true, do NOT reserve 4 trailing bytes for the\n * Source FEC Payload ID. Use on FEC-recovered symbols where the PID has\n * already been stripped upstream.\n */\nexport function extractAltaTrailer(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n): AltaTrailer | null {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) return null\n // ISO/IEC 23008-1:2023 Figure 8 places V=0 packet_type in the low six bits.\n const packetType = mmtpPacket[1]! & 0x3f\n if (packetType !== PACKET_TYPE_MPU) return null\n\n const fecType = (mmtpPacket[0]! >> 3) & 0x03\n let headerLength = MMTP_HEADER_SIZE\n if (fecType < 2 && (mmtpPacket[0]! & 0x20) !== 0) headerLength += 4\n if (fecType < 2 && (mmtpPacket[0]! & 0x02) !== 0) {\n if (headerLength + 4 > mmtpPacket.length) return null\n const extensionLength = new DataView(\n mmtpPacket.buffer,\n mmtpPacket.byteOffset + headerLength + 2,\n 2,\n ).getUint16(0, false)\n headerLength += 4 + extensionLength\n }\n if (headerLength + MPU_HEADER_SIZE > mmtpPacket.length) return null\n\n const payload = mmtpPacket.subarray(headerLength)\n\n // Inline a minimal MPU-header read \u2014 only the fields extractAltaTrailer needs.\n // payloadLength: 16 BE at bytes 0-1.\n // Byte 2 packs FT(4) | T(1) | FI(2) | A(1).\n const payloadLength = (payload[0]! << 8) | payload[1]!\n const flagsByte = payload[2]!\n const fragmentType = (flagsByte >> 4) & 0x0f\n const timed = ((flagsByte >> 3) & 0x01) === 1\n const fragmentationIndicator = (flagsByte >> 1) & 0x03\n\n // Only MFU packets (FT=2) carry the detached trailer.\n if (fragmentType !== 2) return null\n\n // FI=0/1 structurally carries a DU header; FI=2/3 does not. Require at\n // least one media byte after that deterministic layout so the bytes at the\n // declared boundary cannot impersonate ALTA for a header-only fragment.\n const dataUnitHeaderSize = fragmentationIndicator <= 1\n ? (timed ? TIMED_MFU_DU_HEADER_SIZE : NONTIMED_MFU_DU_HEADER_SIZE)\n : 0\n if (payloadLength <= MPU_HEADER_REMAINDER_SIZE + dataUnitHeaderSize) return null\n\n if (fecType > 1) return null\n const hasFecId = !options?.skipFecId && fecType === 1\n const payloadEnd = hasFecId ? payload.length - 4 : payload.length\n const declaredEnd = MPU_LENGTH_FIELD_SIZE + payloadLength\n if (declaredEnd > payloadEnd) return null\n\n if (declaredEnd + MMTP_EXT_TRAILER_HEADER_SIZE > payloadEnd) return null\n const extType = (payload[declaredEnd]! << 8) | payload[declaredEnd + 1]!\n if (extType !== MMTP_EXT_TYPE_ALTA_AUTH) return null\n const extLen = (payload[declaredEnd + 2]! << 8) | payload[declaredEnd + 3]!\n\n const authStart = declaredEnd + MMTP_EXT_TRAILER_HEADER_SIZE\n if (authStart + extLen !== payloadEnd) return null\n\n return {\n auth: payload.subarray(authStart, payloadEnd),\n signedEnd: headerLength + declaredEnd,\n }\n}\n", "import {\n MMTP_EXT_TYPE_ALTA_AUTH as _LEAF_MMTP_EXT_TYPE_ALTA_AUTH,\n MMTP_EXT_TRAILER_HEADER_SIZE as _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE,\n extractAltaTrailer as _leafExtractAltaTrailer,\n type AltaTrailer as _LeafAltaTrailer,\n} from '@blockcast/mmt-alta-parse'\n\n/**\n * @mmt/container - MMTP Parser\n *\n * MMTP (MMT Protocol) packet parser based on ISO/IEC 23008-1:2023 Section 9.2\n *\n * MMTP header format (12 bytes):\n * - Byte 0: V(2) | C(1) | FEC_type(2) | r(1) | X(1) | R(1)\n * - Byte 1: reserved(2) | packet_type(6)\n * - Bytes 2-3: packet_id (big-endian)\n * - Bytes 4-7: timestamp (big-endian, 32-bit)\n * - Bytes 8-11: sequence_number (big-endian)\n *\n * FEC_type values:\n * - 0: No FEC / source packet\n * - 1: FEC mode 0 (source with FEC payload ID)\n * - 2: FEC repair packet mode 0\n * - 3: FEC repair packet mode 1\n *\n * @packageDocumentation\n */\n\nexport interface MMTPHeader {\n version: number\n /** Packet type: 0x00=MPU, 0x02=Signaling, 0x03=Repair */\n packetType: number\n packetId: number\n timestamp: bigint\n sequenceNumber: number\n payloadLength: number\n fecType: number\n /** C flag: header carries a 32-bit packet_counter. */\n packetCounterFlag: boolean\n packetCounter?: number\n /** X flag: header carries an extension header and value. */\n extensionFlag: boolean\n extension?: { type: number; data: Uint8Array }\n /** Byte offset at which the MMTP payload begins. */\n headerLength: number\n /** Random Access Point flag - indicates keyframe (ISO 23008-1, byte 0 bit 0) */\n rapFlag: boolean\n}\n\nexport interface MPUHeader {\n mpuSequenceNumber: number\n fragmentationIndicator: number // FI: 0=complete, 1=first, 2=middle, 3=last\n /** 8-bit MPU fragment_counter from byte 3. */\n fragmentCounter: number\n /** T flag: 1=timed media (14-byte MFU DU header), 0=non-timed (4-byte header) */\n timedFlag: number\n /** A flag: aggregated MPU payload. This strict profile requires A=0. */\n aggregationFlag: boolean\n /** MPU payload_length (bytes 0-1): bytes after the length field, including\n * the remaining six MPU-header bytes and all data-unit bytes. */\n payloadLength: number\n}\n\nexport interface MFUDuHeader {\n movieFragmentSequenceNumber: number\n sampleNumber: number\n offset: number\n priority: number\n dependencyCounter: number\n}\n\nexport interface MMTPPacket {\n header: MMTPHeader\n payload: Uint8Array\n}\n\nexport const MMTP_HEADER_SIZE = 12\nexport const MPU_HEADER_SIZE = 8\nexport const MFU_DU_HEADER_SIZE_TIMED = 14 // T=1: timed media (video/audio samples)\nexport const MFU_DU_HEADER_SIZE_NONTIMED = 4 // T=0: non-timed media (item_id only)\n\nconst MPU_LENGTH_FIELD_SIZE = 2\nconst MPU_HEADER_REMAINDER_SIZE = MPU_HEADER_SIZE - MPU_LENGTH_FIELD_SIZE\nconst SOURCE_FEC_PAYLOAD_ID_SIZE = 4\n\n// MMTP Packet Types (ISO/IEC 23008-1:2023 Section 9.2.2)\nexport const PACKET_TYPE_MPU = 0x00\nexport const PACKET_TYPE_SIGNALING = 0x02\nexport const PACKET_TYPE_REPAIR = 0x03\n\n// AL-FEC Signaling Message ID (ISO/IEC 23008-1:2023 Amendment 1:2025)\nexport const ALFEC_MESSAGE_ID = 0x0203\n\n/**\n * MMTP `packet_id` of the signaling flow, which carries PACKET_TYPE_SIGNALING\n * packets such as the AL-FEC message (ALFEC_MESSAGE_ID). The FFmpeg `moq_mmt`\n * muxer sends that message on this packet_id into the same multicast group as\n * the media, and moqcast-draft (PR #44) makes advertising it for a track a\n * MUST NOT. A track's packet_id is therefore 1..MMTP_PACKET_ID_MAX.\n */\nexport const MMTP_SIGNALING_PACKET_ID = 0\n\n/** Largest value of the 16-bit MMTP `packet_id` header field. */\nexport const MMTP_PACKET_ID_MAX = 0xffff\n\n// FEC Code IDs\nexport const FEC_CODE_XOR = 1\nexport const FEC_CODE_RAPTORQ = 2\n\n/**\n * Parse MMTP header from buffer\n */\nexport function parseMMTPHeader(buffer: Uint8Array): MMTPHeader {\n if (buffer.length < MMTP_HEADER_SIZE) {\n throw new Error(`MMTP packet too small: ${buffer.length} bytes`)\n }\n\n const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)\n\n const version = (buffer[0]! >> 6) & 0x03\n if (version !== 0) {\n throw new Error(`Unsupported MMTP version: ${version}`)\n }\n\n // Extract FEC type from byte 0, bits 3-4\n const fecType = (buffer[0]! >> 3) & 0x03\n const packetCounterFlag = (buffer[0]! & 0x20) !== 0\n const extensionFlag = (buffer[0]! & 0x02) !== 0\n\n // Extract RAP flag from byte 0, bit 0 (R bit - Random Access Point)\n const rapFlag = (buffer[0]! & 0x01) === 1\n\n // ISO/IEC 23008-1:2023 Figure 8 (V=0) places reserved(2) before\n // packet_type(6), so packet_type occupies the low six bits of byte 1.\n const packetType = buffer[1]! & 0x3F\n\n let offset = 2\n\n // Packet ID (2 bytes, big-endian)\n const packetId = view.getUint16(offset, false)\n offset += 2\n\n // Timestamp (4 bytes, big-endian)\n const timestamp = BigInt(view.getUint32(offset, false))\n offset += 4\n\n // Sequence number (4 bytes, big-endian)\n const sequenceNumber = view.getUint32(offset, false)\n offset += 4\n\n let packetCounter: number | undefined\n if (packetCounterFlag) {\n if (offset + 4 > buffer.length) throw new Error('MMTP packet truncated in packet_counter')\n packetCounter = view.getUint32(offset, false)\n offset += 4\n }\n\n let extension: { type: number; data: Uint8Array } | undefined\n if (extensionFlag) {\n if (offset + 4 > buffer.length) throw new Error('MMTP packet truncated in header extension')\n const type = view.getUint16(offset, false)\n const length = view.getUint16(offset + 2, false)\n offset += 4\n if (offset + length > buffer.length) throw new Error('MMTP packet truncated in header extension value')\n extension = { type, data: buffer.subarray(offset, offset + length) }\n offset += length\n }\n\n return {\n version,\n packetType,\n packetId,\n timestamp,\n sequenceNumber,\n payloadLength: buffer.length - offset,\n fecType,\n packetCounterFlag,\n packetCounter,\n extensionFlag,\n extension,\n headerLength: offset,\n rapFlag,\n }\n}\n\n/**\n * The MMTP `packet_id` of `buffer`, or null exactly when parseMMTPHeader would\n * throw for it (short buffer, V != 0, truncated packet_counter or header\n * extension).\n *\n * This is the per-packet filter a receiver runs before any other work, so it\n * builds no header object, DataView or BigInt timestamp (BLO-36599). Use\n * parseMMTPHeader when any other header field is needed.\n */\nexport function readMMTPPacketId(buffer: Uint8Array): number | null {\n if (buffer.length < MMTP_HEADER_SIZE) return null\n const flags = buffer[0]!\n if (((flags >> 6) & 0x03) !== 0) return null\n let offset = MMTP_HEADER_SIZE\n if ((flags & 0x20) !== 0) {\n if (offset + 4 > buffer.length) return null\n offset += 4\n }\n if ((flags & 0x02) !== 0) {\n if (offset + 4 > buffer.length) return null\n const length = (buffer[offset + 2]! << 8) | buffer[offset + 3]!\n if (offset + 4 + length > buffer.length) return null\n }\n return (buffer[2]! << 8) | buffer[3]!\n}\n\n/**\n * Unwrap MMTP packet to extract payload\n */\nexport function unwrapMMTP(buffer: Uint8Array): MMTPPacket {\n const header = parseMMTPHeader(buffer)\n const payload = buffer.subarray(header.headerLength)\n\n return { header, payload }\n}\n\n/**\n * Parse MPU header from payload\n * ISO/IEC 23008-1:2023 Section 9.2.3.3\n *\n * MPU Header format (8 bytes) as written by FFmpeg/libmmt:\n * - Bytes 0-1: payload_length (16 bits, big-endian)\n * - Byte 2: FT(4) | T(1) | FI(2) | A(1)\n * - Byte 3: fragment_counter (8 bits)\n * - Bytes 4-7: MPU_sequence_number (32 bits, big-endian)\n */\nexport function parseMPUHeader(payload: Uint8Array): MPUHeader {\n if (payload.length < MPU_HEADER_SIZE) {\n throw new Error(`Payload too small for MPU header: ${payload.length} bytes`)\n }\n\n const view = new DataView(payload.buffer, payload.byteOffset, payload.byteLength)\n\n // Bytes 0-1: payload_length (16 bits, big-endian)\n const payloadLength = view.getUint16(0, false)\n\n // Byte 2: FT(4) | T(1) | FI(2) | A(1)\n const flagsByte = payload[2]!\n const timedFlag = (flagsByte >> 3) & 0x01\n const fragmentationIndicator = (flagsByte >> 1) & 0x03\n const aggregationFlag = (flagsByte & 0x01) !== 0\n\n // Byte 3: fragment_counter (8 bits). The high bit is part of the counter in\n // the current libmmt/FFmpeg writer ABI.\n const fragmentCounter = payload[3]!\n\n // Bytes 4-7: MPU_sequence_number (32 bits, big-endian)\n const mpuSequenceNumber = view.getUint32(4, false)\n\n return {\n mpuSequenceNumber,\n fragmentationIndicator,\n fragmentCounter,\n timedFlag,\n aggregationFlag,\n payloadLength,\n }\n}\n\nexport function parseTimedMfuDuHeader(payload: Uint8Array, offset: number): MFUDuHeader | null {\n if (offset < 0 || offset + MFU_DU_HEADER_SIZE_TIMED > payload.length) return null\n const view = new DataView(payload.buffer, payload.byteOffset + offset, MFU_DU_HEADER_SIZE_TIMED)\n return {\n movieFragmentSequenceNumber: view.getUint32(0, false),\n sampleNumber: view.getUint32(4, false),\n offset: view.getUint32(8, false),\n priority: payload[offset + 12]!,\n dependencyCounter: payload[offset + 13]!,\n }\n}\n\n/**\n * Why `extractMFUPayload` refused a packet.\n *\n * These identifiers are part of the public contract: callers surface them in\n * diagnostics, so renaming one is a breaking change.\n */\nexport type MFURejectionGate =\n | 'packet-shorter-than-mmtp-plus-mpu-header'\n | 'mmtp-header-unparseable'\n | 'not-an-mpu-packet'\n | 'payload-shorter-than-mpu-header'\n | 'aggregation-flag-set'\n | 'mpu-payload-length-below-header-remainder'\n | 'mpu-declared-end-exceeds-payload'\n | 'mfu-offset-at-or-past-declared-end'\n | 'source-fec-payload-id-width-mismatch'\n | 'declared-trailers-unresolved'\n\nexport interface MFURejection {\n gate: MFURejectionGate\n /** Human-readable detail, including the byte arithmetic that decided it. */\n detail: string\n}\n\ninterface MfuPayloadLayout {\n hasMfuDuHeader: boolean\n mfuOffset: number\n dataEnd: number\n}\n\nfunction resolveMfuPayloadLayout(\n mpu: MPUHeader,\n fragmentType: number,\n payload: Uint8Array,\n): { layout: MfuPayloadLayout } | { rejection: MFURejection } {\n if (mpu.payloadLength < MPU_HEADER_REMAINDER_SIZE) {\n return {\n rejection: {\n gate: 'mpu-payload-length-below-header-remainder',\n detail: `payload_length=${mpu.payloadLength} < ${MPU_HEADER_REMAINDER_SIZE}`,\n },\n }\n }\n\n // ISO/IEC 23008-1 defines payload_length from immediately after its own\n // two-byte field. It therefore includes the remaining six MPU-header bytes.\n const declaredEnd = MPU_LENGTH_FIELD_SIZE + mpu.payloadLength\n if (declaredEnd > payload.length) {\n return {\n rejection: {\n gate: 'mpu-declared-end-exceeds-payload',\n detail:\n `payload_length=${mpu.payloadLength} implies end=${declaredEnd}, ` +\n `payload is ${payload.length} bytes`,\n },\n }\n }\n\n const hasHeader = fragmentType === 2 && mpu.fragmentationIndicator <= 1\n const mfuHeaderSize = mpu.timedFlag ? MFU_DU_HEADER_SIZE_TIMED : MFU_DU_HEADER_SIZE_NONTIMED\n const mfuOffset = MPU_HEADER_SIZE + (hasHeader ? mfuHeaderSize : 0)\n if (mfuOffset >= declaredEnd) {\n return {\n rejection: {\n gate: 'mfu-offset-at-or-past-declared-end',\n detail: `mfuOffset=${mfuOffset} >= declaredEnd=${declaredEnd}`,\n },\n }\n }\n\n return {\n layout: {\n hasMfuDuHeader: hasHeader,\n mfuOffset,\n dataEnd: declaredEnd,\n },\n }\n}\n\nfunction isEmptyOrExactAltaTrailer(payload: Uint8Array, start: number, end: number): boolean {\n if (start === end) return true\n if (start < 0 || end > payload.length || start + _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE > end) {\n return false\n }\n\n const view = new DataView(\n payload.buffer,\n payload.byteOffset + start,\n end - start,\n )\n if (view.getUint16(0, false) !== _LEAF_MMTP_EXT_TYPE_ALTA_AUTH) return false\n\n const authLength = view.getUint16(2, false)\n return start + _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE + authLength === end\n}\n\ninterface DeclaredTrailerLayout {\n hasFecId: boolean\n}\n\nfunction resolveDeclaredTrailers(\n payload: Uint8Array,\n declaredEnd: number,\n fecType: number,\n options?: { skipFecId?: boolean },\n): DeclaredTrailerLayout | null {\n if (declaredEnd > payload.length) return null\n\n if (options?.skipFecId) {\n return isEmptyOrExactAltaTrailer(payload, declaredEnd, payload.length)\n ? { hasFecId: false }\n : null\n }\n\n if (fecType === 1) {\n const fecStart = payload.length - SOURCE_FEC_PAYLOAD_ID_SIZE\n if (fecStart < declaredEnd || !isEmptyOrExactAltaTrailer(payload, declaredEnd, fecStart)) {\n return null\n }\n return { hasFecId: true }\n }\n if (fecType !== 0) return null\n\n if (isEmptyOrExactAltaTrailer(payload, declaredEnd, payload.length)) {\n return { hasFecId: false }\n }\n\n return null\n}\n\n/**\n * Extract NAL unit payload from MMTP packet\n */\nexport function extractNALUnit(mmtpPacket: Uint8Array): Uint8Array {\n const extraction = extractMFUPayload(mmtpPacket)\n if (!extraction) throw new Error('Malformed MMTP MPU payload')\n return extraction.data\n}\n\n/** Result of extracting MFU payload from an MMTP packet */\nexport interface MFUExtraction {\n /** MMTP header fields */\n header: MMTPHeader\n /** MPU header fields */\n mpu: MPUHeader\n /** Fragment type (FT field, 4 bits): 0=metadata, 2=MFU data */\n fragmentType: number\n /** MFU payload data (video/audio bytes, headers stripped, FEC ID excluded) */\n data: Uint8Array\n /** Parsed timed MFU DU header when present, otherwise null */\n mfuDuHeader: MFUDuHeader | null\n /** Non-timed MFU Item_ID when the 4-byte DU header is present. */\n itemId: number | null\n /** Source FEC Payload ID if present (`FEC_type == 1`), or null */\n fecPayloadId: { ssId: number } | null\n}\n\n/**\n * Extract MFU payload from a raw MMTP packet.\n *\n * Handles all the byte arithmetic for:\n * - MMTP header (12 bytes)\n * - MPU sub-header (8 bytes, payloadLength field)\n * - MFU DU header (14 bytes timed / 4 bytes non-timed, only for FI \u2264 1)\n * - Source FEC Payload ID (4 bytes at end, only when `FEC_type == 1`)\n *\n * `payloadLength` is the ISO length-after-field value: six remaining MPU-header\n * bytes, then the MFU DU header when present, then media. ALTA and Source FEC\n * trailers are outside that declared span and must consume the exact suffix.\n *\n * @param mmtpPacket Raw MMTP packet (from multicast or MoQ)\n * @param options.skipFecId When true, do NOT subtract the 4-byte Source FEC Payload ID\n * from the payload boundary, even if fecType >= 1 in the MMTP header. Use this for\n * FEC-recovered symbols where the FEC PID was already stripped before WASM decoding\n * but the fecType bits in byte 0 still reflect the original packet (FEC Type=1 per\n * draft-ramadan-moq-mmt-00 \u00A73.1).\n * @returns Extracted MFU data + metadata, or null if packet is too small\n */\ninterface MfuPlan {\n header: MMTPHeader\n payload: Uint8Array\n mpu: MPUHeader\n fragmentType: number\n layout: MfuPayloadLayout\n trailerLayout: DeclaredTrailerLayout\n}\n\n/**\n * Single source of truth for whether a packet yields an MFU payload.\n *\n * `extractMFUPayload` and `explainMFURejection` both delegate here, so the\n * reason reported to operators can never drift from the decision the parser\n * actually made.\n */\nfunction planMfuExtraction(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n parsedHeader?: MMTPHeader,\n): { plan: MfuPlan } | { rejection: MFURejection } {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) {\n return {\n rejection: {\n gate: 'packet-shorter-than-mmtp-plus-mpu-header',\n detail: `${mmtpPacket.length} bytes < ${MMTP_HEADER_SIZE + MPU_HEADER_SIZE}`,\n },\n }\n }\n\n let header: MMTPHeader\n if (parsedHeader) {\n header = parsedHeader\n } else {\n try {\n header = parseMMTPHeader(mmtpPacket)\n } catch (error) {\n return {\n rejection: {\n gate: 'mmtp-header-unparseable',\n detail: error instanceof Error ? error.message : String(error),\n },\n }\n }\n }\n if (header.packetType !== PACKET_TYPE_MPU) {\n return {\n rejection: {\n gate: 'not-an-mpu-packet',\n detail: `packetType=0x${header.packetType.toString(16).padStart(2, '0')}`,\n },\n }\n }\n\n const payload = mmtpPacket.subarray(header.headerLength)\n if (payload.length < MPU_HEADER_SIZE) {\n return {\n rejection: {\n gate: 'payload-shorter-than-mpu-header',\n detail: `${payload.length} bytes < ${MPU_HEADER_SIZE}`,\n },\n }\n }\n\n const mpu = parseMPUHeader(payload)\n if (mpu.aggregationFlag) {\n return {\n rejection: { gate: 'aggregation-flag-set', detail: 'strict profile requires A=0' },\n }\n }\n\n // Fragment type from byte 2 upper nibble (not returned by parseMPUHeader)\n const fragmentType = (payload[2]! >> 4) & 0x0f\n\n const layoutResult = resolveMfuPayloadLayout(mpu, fragmentType, payload)\n if ('rejection' in layoutResult) return layoutResult\n const { layout } = layoutResult\n\n const trailerLayout = resolveDeclaredTrailers(\n payload,\n layout.dataEnd,\n header.fecType,\n options,\n )\n if (!trailerLayout) {\n // The most common cause is a producer whose Source FEC Payload ID width\n // disagrees with ISO/IEC 23008-1 \u00A7C.5.2. Name that explicitly rather than\n // leaving operators to infer it from a generic trailer error.\n if (!options?.skipFecId && header.fecType === 1) {\n const observed = payload.length - layout.dataEnd\n if (observed !== SOURCE_FEC_PAYLOAD_ID_SIZE) {\n return {\n rejection: {\n gate: 'source-fec-payload-id-width-mismatch',\n detail:\n `producer wrote a ${observed}-byte Source FEC Payload ID, ` +\n `ISO/IEC 23008-1 \u00A7C.5.2 requires ${SOURCE_FEC_PAYLOAD_ID_SIZE} ` +\n `(payload=${payload.length}, declaredEnd=${layout.dataEnd})`,\n },\n }\n }\n }\n return {\n rejection: {\n gate: 'declared-trailers-unresolved',\n detail:\n `trailer bytes [${layout.dataEnd}, ${payload.length}) are neither empty ` +\n `nor an exact ALTA trailer (fecType=${header.fecType})`,\n },\n }\n }\n\n return { plan: { header, payload, mpu, fragmentType, layout, trailerLayout } }\n}\n\n/**\n * Report why `extractMFUPayload` would refuse this packet, or null if it would\n * accept it.\n *\n * `extractMFUPayload` returns bare `null` on ten distinct conditions, which\n * makes a producer/consumer framing disagreement indistinguishable from a\n * publisher that never started \u2014 both render as silence. Use this wherever\n * that distinction matters: diagnostics, contract tests, and operator-facing\n * logs.\n */\nexport function explainMFURejection(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n): MFURejection | null {\n const result = planMfuExtraction(mmtpPacket, options)\n return 'rejection' in result ? result.rejection : null\n}\n\nexport function extractMFUPayload(\n mmtpPacket: Uint8Array,\n options?: { skipFecId?: boolean },\n): MFUExtraction | null {\n return extractPlannedMfu(mmtpPacket, planMfuExtraction(mmtpPacket, options))\n}\n\n/**\n * extractMFUPayload for a caller that already holds this packet's parsed MMTP\n * header, so the header is not parsed a second time (BLO-36599).\n *\n * `header` must be `parseMMTPHeader(mmtpPacket)` of this same packet; the\n * result is then identical to `extractMFUPayload(mmtpPacket, options)`.\n */\nexport function extractMFUPayloadWithHeader(\n mmtpPacket: Uint8Array,\n header: MMTPHeader,\n options?: { skipFecId?: boolean },\n): MFUExtraction | null {\n return extractPlannedMfu(mmtpPacket, planMfuExtraction(mmtpPacket, options, header))\n}\n\nfunction extractPlannedMfu(\n mmtpPacket: Uint8Array,\n result: { plan: MfuPlan } | { rejection: MFURejection },\n): MFUExtraction | null {\n if ('rejection' in result) return null\n const { header, payload, mpu, fragmentType, layout, trailerLayout } = result.plan\n\n const mfuDuHeaderPresent = layout.hasMfuDuHeader\n const mfuOffset = layout.mfuOffset\n const dataEnd = layout.dataEnd\n\n const mfuDuHeader =\n mfuDuHeaderPresent && mpu.timedFlag === 1\n ? parseTimedMfuDuHeader(payload, MPU_HEADER_SIZE)\n : null\n const itemId =\n mfuDuHeaderPresent && mpu.timedFlag === 0\n ? new DataView(payload.buffer, payload.byteOffset + MPU_HEADER_SIZE, 4).getUint32(0, false)\n : null\n\n const data = payload.subarray(mfuOffset, dataEnd)\n\n const fecPayloadId = trailerLayout.hasFecId\n ? {\n ssId: new DataView(\n mmtpPacket.buffer,\n mmtpPacket.byteOffset + mmtpPacket.length - SOURCE_FEC_PAYLOAD_ID_SIZE,\n SOURCE_FEC_PAYLOAD_ID_SIZE,\n ).getUint32(0, false),\n }\n : null\n\n return { header, mpu, fragmentType, data, mfuDuHeader, itemId, fecPayloadId }\n}\n\n/**\n * Extract timestamp from MMTP packet\n */\nexport function extractTimestamp(mmtpPacket: Uint8Array): bigint {\n const { header } = unwrapMMTP(mmtpPacket)\n return header.timestamp\n}\n\n/**\n * Check if MMTP packet is an FEC repair packet\n * FEC_type 2 and 3 are repair packets\n */\nexport function isFecRepairPacket(mmtpPacket: Uint8Array): boolean {\n if (mmtpPacket.length < 1) return false\n const fecType = (mmtpPacket[0]! >> 3) & 0x03\n return fecType >= 2\n}\n\n/**\n * Extract Source FEC Payload ID (SS_ID) from the last 4 bytes of an MMTP\n * source packet per ISO/IEC 23008-1:2023 Section C.5.2 Figure C.10.\n *\n * SS_ID is a flat 32-bit monotonic counter (incremented by 1 per packet\n * for ssbg_mode0 and ssbg_mode1). Block membership and ESI use the\n * configured K; repair SS_Start identifies the first SS_ID of the block and\n * SSB_length records the authored source-symbol count:\n * SBN = floor(SS_ID / K), ESI = SS_ID % K\n * SS_Start = SBN * K (first SS_ID of the block)\n *\n * This matches FFmpeg moqenc_mmt.c, the drafts (draft-ramadan-moq-fec \u00A76.2),\n * and ATSC A/331 \u00A78.1.2.5 which defers to ISO 23008-1 Annex C.\n */\nexport function extractFecPayloadId(mmtpPacket: Uint8Array): { ssId: number } | null {\n const header = parseHeaderForSourceFecId(mmtpPacket)\n return header ? sourceFecPayloadIdOf(mmtpPacket, header) : null\n}\n\n/**\n * Return true when FEC_type=1 and the exact suffix after the ISO-declared MPU\n * payload contains a four-byte Source FEC Payload ID.\n */\nexport function hasSourceFecPayloadId(mmtpPacket: Uint8Array): boolean {\n const header = parseHeaderForSourceFecId(mmtpPacket)\n return header !== null && sourceFecPayloadIdOf(mmtpPacket, header) !== null\n}\n\nfunction parseHeaderForSourceFecId(mmtpPacket: Uint8Array): MMTPHeader | null {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) return null\n try {\n return parseMMTPHeader(mmtpPacket)\n } catch {\n return null\n }\n}\n\n/**\n * The Source FEC Payload ID of a packet whose MMTP header the caller already\n * parsed, or null when the packet carries none: present only when FEC_type=1\n * and the exact suffix after the ISO-declared MPU payload holds the four-byte\n * ID (ISO/IEC 23008-1 \u00A7C.5.2). Same answer as extractFecPayloadId, without a\n * second header parse (BLO-36599).\n *\n * `header` must be `parseMMTPHeader(mmtpPacket)` of this same packet.\n */\nexport function sourceFecPayloadIdOf(\n mmtpPacket: Uint8Array,\n header: MMTPHeader,\n): { ssId: number } | null {\n if (mmtpPacket.length < MMTP_HEADER_SIZE + MPU_HEADER_SIZE) return null\n if (header.packetType !== PACKET_TYPE_MPU) return null\n\n const payload = mmtpPacket.subarray(header.headerLength)\n if (payload.length < MPU_HEADER_SIZE) return null\n const payloadLength = (payload[0]! << 8) | payload[1]!\n if (payloadLength < MPU_HEADER_REMAINDER_SIZE) return null\n const declaredEnd = MPU_LENGTH_FIELD_SIZE + payloadLength\n if (!resolveDeclaredTrailers(payload, declaredEnd, header.fecType)?.hasFecId) return null\n\n // Flat 4-byte SS_ID: encoder writes block_id * K + symbol_id\n const off = mmtpPacket.length - SOURCE_FEC_PAYLOAD_ID_SIZE\n return {\n ssId:\n ((mmtpPacket[off]! << 24) |\n (mmtpPacket[off + 1]! << 16) |\n (mmtpPacket[off + 2]! << 8) |\n mmtpPacket[off + 3]!) >>>\n 0,\n }\n}\n\n/**\n * MMTP header-extension ext_type assigned to the detached ALTA authenticator\n * trailer (Path 2 / 08-07). Carried in an `[ext_type][ext_length][auth]`\n * block appended after the MPU's declared payload bytes, before the 4-byte\n * Source FEC Payload ID. MMTP X-bit stays 0 \u2014 non-ALTA MMTP receivers treat\n * the trailer as bytes past `payload_length` and skip it (per ISO 23008-1\n * \u00A79.2.2 \"may be discarded without impacting correct processing\").\n */\n// Re-export the ALTA trailer helper from the zero-dep leaf package. The leaf\n// owns the implementation so container and FEC consumers share one parser\n// without creating a package cycle.\nexport const MMTP_EXT_TYPE_ALTA_AUTH = _LEAF_MMTP_EXT_TYPE_ALTA_AUTH\nexport const MMTP_EXT_TRAILER_HEADER_SIZE = _LEAF_MMTP_EXT_TRAILER_HEADER_SIZE\nexport type AltaTrailer = _LeafAltaTrailer\nexport const extractAltaTrailer = _leafExtractAltaTrailer\n\n/** Size of Repair FEC Payload ID per ISO/IEC 23008-1 Section C.5.3 */\nexport const REPAIR_FEC_PID_SIZE = 13\n\n/**\n * Parse the 13-byte Repair FEC Payload ID after the complete dynamic MMTP header.\n * `parsedHeader`, when given, must be `parseMMTPHeader(mmtpPacket)` of this\n * same packet; it spares the second header parse (BLO-36599).\n */\nfunction readRepairFecPayloadIdFields(mmtpPacket: Uint8Array, parsedHeader?: MMTPHeader): {\n packetId: number; ssStart: number; rsbLength: number; rsId: number; ssbLength: number; dataOffset: number\n} | null {\n let header: MMTPHeader\n if (parsedHeader) {\n header = parsedHeader\n } else {\n try {\n header = parseMMTPHeader(mmtpPacket)\n } catch {\n return null\n }\n }\n if (header.packetType !== PACKET_TYPE_REPAIR || header.fecType !== 2) return null\n\n const off = header.headerLength\n if (mmtpPacket.length < off + REPAIR_FEC_PID_SIZE) return null\n const ssStart =\n ((mmtpPacket[off]! << 24) |\n (mmtpPacket[off + 1]! << 16) |\n (mmtpPacket[off + 2]! << 8) |\n mmtpPacket[off + 3]!) >>>\n 0 // 32 bits\n const rsbLength = (mmtpPacket[off + 4]! << 16) | (mmtpPacket[off + 5]! << 8) | mmtpPacket[off + 6]! // 24 bits\n const rsId = (mmtpPacket[off + 7]! << 16) | (mmtpPacket[off + 8]! << 8) | mmtpPacket[off + 9]! // 24 bits\n const ssbLength = (mmtpPacket[off + 10]! << 16) | (mmtpPacket[off + 11]! << 8) | mmtpPacket[off + 12]! // 24 bits\n return {\n packetId: header.packetId,\n ssStart,\n rsbLength,\n rsId,\n ssbLength,\n dataOffset: off + REPAIR_FEC_PID_SIZE,\n }\n}\n\n/**\n * Extract Repair FEC Payload ID from a raw-multicast MMTP repair packet.\n * Per ISO/IEC 23008-1:2023 Section C.5.3 (ssbg_mode0, one-stage, no FFSRP_TS):\n * [MMTP header][SS_Start:4][RSB_length:3][RS_ID:3][SSB_length:3][repair data]\n * OTI is delivered via AL-FEC signaling message (Table C.3), not per-packet.\n *\n * Byte 1 is reserved(2)|packet_type(6) for V=0, so repair type 0x03 is 0x03.\n * Pre-migration high-bits bytes (0x0c) are rejected \u2014 no compatibility decode.\n */\nexport function extractRepairFecPayloadId(mmtpPacket: Uint8Array): {\n ssStart: number; rsbLength: number; rsId: number; ssbLength: number\n} | null {\n const fields = readRepairFecPayloadIdFields(mmtpPacket)\n if (!fields) return null\n return {\n ssStart: fields.ssStart,\n rsbLength: fields.rsbLength,\n rsId: fields.rsId,\n ssbLength: fields.ssbLength,\n }\n}\n\n/** Parsed MoQ repair frame per ISO/IEC 23008-1 Section C.4.3 + C.5.3 */\nexport interface MoqRepairFrame {\n /** MMTP packetId (1=video, 2=audio) \u2014 for routing to correct FEC decoder */\n packetId: number\n /** SS_Start (32 bits): SS_ID of first source symbol in block */\n ssStart: number\n /** RSB_length (24 bits): number of repair symbols (P) */\n rsbLength: number\n /** RS_ID (24 bits): repair symbol index (0-based) */\n rsId: number\n /** SSB_length (24 bits): authored source-symbol count (1..=configured K) */\n ssbLength: number\n /** Repair symbol data after the dynamic MMTP header and 13-byte FEC payload ID. */\n symbolData: Uint8Array\n}\n\n/**\n * Parse a MoQ repair frame (ISO/IEC 23008-1 Annex C format).\n *\n * Wire format per ISO 23008-1 \u00A7C.4.3 + \u00A7C.5.3:\n * MMTP Header: fixed 12 bytes plus C/X optional fields\n * then SS_Start (4 bytes) \u2192 block identifier\n * then RSB_length (3 bytes) \u2192 P\n * then RS_ID (3 bytes) \u2192 ESI = K + RS_ID\n * then SSB_length (3 bytes) \u2192 authored source-symbol count (1..=K)\n * then Repair Symbol Data (T bytes)\n *\n * @param frame - Raw MoQ repair frame bytes\n * @returns Parsed frame or null if invalid\n */\nexport function parseMoqRepairFrame(frame: Uint8Array): MoqRepairFrame | null {\n return moqRepairFrameFrom(frame, readRepairFecPayloadIdFields(frame))\n}\n\n/**\n * parseMoqRepairFrame for a caller that already holds this frame's parsed MMTP\n * header, so the header is not parsed a second time (BLO-36599). The router's\n * multicast repair branch uses it: one repair packet in every K + P otherwise\n * paid two header parses.\n *\n * `header` must be `parseMMTPHeader(frame)` of this same frame; the result is\n * then identical to `parseMoqRepairFrame(frame)`.\n */\nexport function parseMoqRepairFrameWithHeader(\n frame: Uint8Array,\n header: MMTPHeader,\n): MoqRepairFrame | null {\n return moqRepairFrameFrom(frame, readRepairFecPayloadIdFields(frame, header))\n}\n\nfunction moqRepairFrameFrom(\n frame: Uint8Array,\n repairId: ReturnType<typeof readRepairFecPayloadIdFields>,\n): MoqRepairFrame | null {\n if (!repairId) return null\n\n const symbolData = frame.subarray(repairId.dataOffset)\n if (\n repairId.rsbLength === 0 ||\n repairId.ssbLength === 0 ||\n repairId.rsId >= repairId.rsbLength ||\n symbolData.length === 0\n ) return null\n\n return {\n packetId: repairId.packetId,\n ssStart: repairId.ssStart,\n rsbLength: repairId.rsbLength,\n rsId: repairId.rsId,\n ssbLength: repairId.ssbLength,\n symbolData,\n }\n}\n\n// The signalling-message parsers (9.3.4.2 payload header, AL-FEC message,\n// PA/MPT) live in ./signalling.ts.\n", "/**\n * NTP short format (RFC 5905 \u00A76): an unsigned 32-bit, 16.16 fixed-point count\n * of seconds. The MMTP header `timestamp` field (ISO/IEC 23008-1 \u00A79.2.2)\n * carries each packet's UTC sending instant in this format, so the value wraps\n * to 0 every 2^16 s (~18.2 h).\n *\n * Plain numeric order on these values breaks at every wrap: a retained\n * `Math.max` stays at the pre-wrap value and every later instant compares as\n * older. Order send times only with {@link compareNtpShort}, which applies\n * RFC 1982 serial-number arithmetic over the field's width.\n */\n\n/** Width in bits of the MMTP `timestamp` field (NTP short). */\nexport const NTP_SHORT_BITS = 32\n\n/** Number of distinct NTP-short values; the field wraps to 0 here. */\nexport const NTP_SHORT_MODULUS = 2 ** NTP_SHORT_BITS\n\n/**\n * RFC 1982 \u00A73.2's `2^(SERIAL_BITS - 1)`. Two values whose forward distance is\n * below this are ordered; exactly this far apart they are not ordered at all.\n * Two instants must be less than this far apart (2^15 s, ~9.1 h of send time)\n * for the comparison to give their true order.\n */\nexport const NTP_SHORT_HALF_RANGE = 2 ** (NTP_SHORT_BITS - 1)\n\n/**\n * Serial order of one NTP-short value relative to another.\n *\n * `'unordered'` is RFC 1982's undefined case: the values are exactly\n * {@link NTP_SHORT_HALF_RANGE} apart, so neither precedes the other. It is\n * never folded into `'before'` or `'after'`; each caller decides what an\n * unorderable pair means for it.\n */\nexport type NtpShortOrder = 'before' | 'equal' | 'after' | 'unordered'\n\n/** True when `value` is an NTP-short value: an integer in [0, NTP_SHORT_MODULUS). */\nexport function isNtpShort(value: number): boolean {\n return Number.isInteger(value) && value >= 0 && value < NTP_SHORT_MODULUS\n}\n\n/**\n * RFC 1982 serial comparison of NTP-short `a` against `b`: `'after'` when `a`\n * is the later instant, `'before'` when it is the earlier one.\n *\n * The answer is the true order only while the two instants are less than\n * {@link NTP_SHORT_HALF_RANGE} apart. Past that a 32-bit field cannot tell\n * later from earlier, and the result names whichever direction is nearer.\n * This is not a total order (it is not transitive across the whole space), so\n * it must never be used to sort.\n *\n * @throws {RangeError} if either operand is not an NTP-short value\n */\nexport function compareNtpShort(a: number, b: number): NtpShortOrder {\n if (!isNtpShort(a) || !isNtpShort(b)) {\n throw new RangeError(\n `NTP-short values must be integers in [0, 2^${NTP_SHORT_BITS}), got ${String(a)} and ${String(b)}`,\n )\n }\n if (a === b) return 'equal'\n // Forward distance from b to a, reduced into [1, NTP_SHORT_MODULUS). Both\n // operands are below 2^32, so every step is exact in a double.\n const forward = (a - b + NTP_SHORT_MODULUS) % NTP_SHORT_MODULUS\n if (forward < NTP_SHORT_HALF_RANGE) return 'after'\n if (forward > NTP_SHORT_HALF_RANGE) return 'before'\n return 'unordered'\n}\n", "/**\n * RFC 1982 serial-number arithmetic for the 32-bit MMTP AL-FEC symbol\n * counters (ISO/IEC 23008-1:2023 C.5.2 SS_ID, C.5.3 SS_Start).\n *\n * SS_ID is a 32-bit field, so a stream that runs long enough wraps it to 0.\n * Ordering two SS_IDs (or two blocks by their first SS_ID) with `<` reads\n * every post-wrap value as older than every pre-wrap one. Serial order\n * agrees with `<` whenever the two values are less than 2^31 apart, so for\n * every stream that has not reached the wrap the result is unchanged; only\n * the order across the wrap point differs (BLO-35597 iso:5).\n */\n\n/** 2^SERIAL_BITS for SERIAL_BITS = 32. */\nexport const SERIAL32_SPAN = 0x1_0000_0000\n\n/** RFC 1982 \u00A73.2's 2^(SERIAL_BITS - 1). */\nexport const SERIAL32_HALF = 0x8000_0000\n\nfunction assertUint32(value: number, name: string): void {\n if (!Number.isInteger(value) || value < 0 || value >= SERIAL32_SPAN) {\n throw new RangeError(`${name} must be a uint32 (got ${value})`)\n }\n}\n\n/**\n * RFC 1982 \u00A73.1 addition, extended to negative `n` for the matching\n * subtraction: `(s + n) mod 2^32`. `n` must lie in (-2^31, 2^31).\n */\nexport function serial32Add(s: number, n: number): number {\n assertUint32(s, 's')\n if (!Number.isInteger(n) || n <= -SERIAL32_HALF || n >= SERIAL32_HALF) {\n throw new RangeError(`serial addend must lie in (-2^31, 2^31) (got ${n})`)\n }\n return (s + n + SERIAL32_SPAN) % SERIAL32_SPAN\n}\n\n/** Forward distance from `from` to `to`: `(to - from) mod 2^32`. */\nexport function serial32Distance(from: number, to: number): number {\n return (to - from) >>> 0\n}\n\n/**\n * RFC 1982 \u00A73.2: `a` precedes `b`. Values exactly 2^31 apart are unordered\n * (neither precedes the other).\n */\nexport function serial32Precedes(a: number, b: number): boolean {\n const distance = serial32Distance(a, b)\n return distance !== 0 && distance < SERIAL32_HALF\n}\n", "/**\n * FEC block profile (BLO-35597, ISO/IEC 23008-1 Annex C).\n *\n * Every catalog `fec` object that declares an FEC instance names its block\n * profile in `fec.blockProfile`. A receiver applies all of a profile's rules\n * or none of them, so the token is the one explicit per-stream discriminator:\n * it is never defaulted and never inferred from the wire.\n *\n * draft-ramadan-moq-fec \u00A75.1 defines exactly one value, and it is the only\n * profile this library implements:\n *\n * - `iso-ssbg1-v1`: ssbg_mode1 (C.3.3): a source symbol is\n * `u16 length || protected packet || zero padding` to T; a block is a\n * K' = SSB_length RaptorQ block (C.5.3) and repair ESI = SSB_length + RS_ID;\n * SS_ID increments by one per FEC source packet and wraps at 2^32 (C.5.2),\n * so a block is located by membership in `[SS_Start, SS_Start + SSB_length)`\n * under RFC 1982 serial arithmetic; the MoQ repair group id is the 62-bit\n * wrap-epoch-extended SS_Start. The AL-FEC coding byte for this profile is\n * 0x14 (one-stage, ssbg_mode1, fec_payload_id_mode 0, Amd 1:2025 Table C.3).\n *\n * A track whose `blockProfile` is absent or names any other token (the\n * retired Blockcast-private `k-padded-v1` included) has no FEC: a receiver\n * consumes its source without FEC and joins none of its repair tracks\n * (draft-ramadan-moq-fec \u00A75.1). `parseFecBlockProfile` throws for such a\n * token; the per-track catalog resolver turns the same rule into a typed\n * per-track \"FEC unavailable\" outcome instead of failing the session.\n */\nimport { serial32Add, serial32Distance, serial32Precedes } from './serial-number.js'\n\n/** The block profile a catalog `fec.blockProfile` may name: the one this library implements. */\nexport type FecBlockProfile = 'iso-ssbg1-v1'\n\n/** Every accepted `fec.blockProfile` token. */\nexport const FEC_BLOCK_PROFILES: readonly FecBlockProfile[] = Object.freeze([\n 'iso-ssbg1-v1',\n])\n\n/** True for a block-profile token this library implements. */\nexport function isFecBlockProfile(value: unknown): value is FecBlockProfile {\n return value === 'iso-ssbg1-v1'\n}\n\n/**\n * Read a required `fec.blockProfile`. Throws on an absent token and on any\n * token other than `iso-ssbg1-v1`: there is no default and nothing is\n * inferred from the wire (draft-ramadan-moq-fec \u00A75.1).\n *\n * @param where the catalog path of the field, for the error message.\n */\nexport function parseFecBlockProfile(value: unknown, where: string): FecBlockProfile {\n if (isFecBlockProfile(value)) return value\n if (value === undefined) {\n throw new Error(`${where} is required: name the FEC block profile (\"iso-ssbg1-v1\")`)\n }\n throw new Error(`${where} must be \"iso-ssbg1-v1\" (got ${JSON.stringify(value)})`)\n}\n\n/** ISO/IEC 23008-1 C.3.3 ssbg_mode1: the two-octet packet length field. */\nexport const SSBG1_LENGTH_FIELD_BYTES = 2\n\n/** The largest protected packet an ssbg_mode1 symbol of size T can carry. */\nexport function ssbg1MaxPacketLength(symbolSize: number): number {\n return symbolSize - SSBG1_LENGTH_FIELD_BYTES\n}\n\n/** Whether a protected packet of `packetLength` bytes fits one T-byte ssbg_mode1 symbol. */\nexport function ssbg1FitsSymbol(packetLength: number, symbolSize: number): boolean {\n return (\n Number.isSafeInteger(packetLength) &&\n packetLength >= 0 &&\n packetLength <= ssbg1MaxPacketLength(symbolSize) &&\n packetLength <= 0xffff\n )\n}\n\n/**\n * Build one ssbg_mode1 source symbol (C.3.3): the protected packet's length\n * in two octets, network byte order, then the packet, then zero octets up to\n * T. The protected packet is the MMTP packet before its Source FEC Payload ID\n * is appended (C.4.2).\n *\n * @throws when `length + 2 > T`: the packet cannot be protected under this\n * profile, and silently truncating it would corrupt every repair symbol.\n */\nexport function buildSsbg1SourceSymbol(packet: Uint8Array, symbolSize: number): Uint8Array {\n if (!Number.isSafeInteger(symbolSize) || symbolSize <= SSBG1_LENGTH_FIELD_BYTES) {\n throw new Error(`ssbg_mode1 symbol size must exceed ${SSBG1_LENGTH_FIELD_BYTES} (got ${symbolSize})`)\n }\n if (!ssbg1FitsSymbol(packet.byteLength, symbolSize)) {\n throw new Error(\n `ssbg_mode1 source symbol needs ${packet.byteLength} + ${SSBG1_LENGTH_FIELD_BYTES} bytes but T is ${symbolSize}`,\n )\n }\n const symbol = new Uint8Array(symbolSize)\n symbol[0] = (packet.byteLength >>> 8) & 0xff\n symbol[1] = packet.byteLength & 0xff\n symbol.set(packet, SSBG1_LENGTH_FIELD_BYTES)\n return symbol\n}\n\n/**\n * Recover the protected packet from one ssbg_mode1 source symbol: the bytes\n * the length field names. Returns null, never a guess, when the length field\n * points past the symbol or any padding octet is non-zero (C.3.3 padding is\n * all 00h), since either means the recovered symbol is not what was sent.\n */\nexport function trimSsbg1SourceSymbol(symbol: Uint8Array): Uint8Array | null {\n if (symbol.byteLength < SSBG1_LENGTH_FIELD_BYTES) return null\n const length = (symbol[0]! << 8) | symbol[1]!\n const end = SSBG1_LENGTH_FIELD_BYTES + length\n if (end > symbol.byteLength) return null\n for (let i = end; i < symbol.byteLength; i++) {\n if (symbol[i] !== 0) return null\n }\n return symbol.subarray(SSBG1_LENGTH_FIELD_BYTES, end)\n}\n\n/** The SS_ID after the last source symbol of `[ssStart, ssStart + ssbLength)`. */\nexport function isoBlockEnd(ssStart: number, ssbLength: number): number {\n return serial32Add(ssStart, ssbLength)\n}\n\n/**\n * Range membership (C.5.2, C.5.3): whether `ssId` is one of the\n * `ssbLength` consecutive SS_IDs starting at `ssStart`, modulo 2^32.\n */\nexport function isoBlockContains(ssStart: number, ssbLength: number, ssId: number): boolean {\n return serial32Distance(ssStart, ssId) < ssbLength\n}\n\n/**\n * A lower bound on how many blocks the block starting at `a` lies behind the\n * one starting at `b` (0 when `a` does not precede `b`). An iso-ssbg1-v1\n * block holds at most `kMax` source symbols (the catalog `sourceSymbols`, the\n * AL-FEC maximum_k_for_repair_flow), so `n * kMax` SS_IDs always span at least\n * `n` blocks. Every interleave horizon in the receiver (decoder retention,\n * worker retirement, ordered-relay settlement) uses this one bound, so the\n * manager's horizon can never fall inside the decoder's.\n */\nexport function isoBlocksBehindLowerBound(a: number, b: number, kMax: number): number {\n if (!Number.isSafeInteger(kMax) || kMax <= 0) {\n throw new Error(`iso-ssbg1-v1 block horizon needs a positive maximum K (got ${kMax})`)\n }\n return serial32Precedes(a, b) ? Math.floor(serial32Distance(a, b) / kMax) : 0\n}\n", "/**\n * iso-ssbg1-v1 block location for one FEC stream (BLO-35597 iso:2/iso:3/iso:5).\n *\n * Under ISO/IEC 23008-1 C.5.2 the SS_ID increments by one per FEC source\n * packet and wraps at 2^32, and a block is the SS_ID range\n * `[SS_Start, SS_Start + SSB_length)` its Repair FEC Payload ID states (C.5.3).\n * Block lengths vary, so `floor(SS_ID / K)` locates nothing: a source symbol\n * belongs to a block only once a repair symbol has stated that block's range.\n * A source that arrives first is held, unplaced, and handed back when a repair\n * places it. Nothing here guesses a boundary.\n *\n * Coverage grows contiguously from the first block a repair states. When a\n * repair states a block that starts after the end of known coverage, the SS_IDs\n * between are one or more blocks whose every repair symbol was lost: they are\n * kept as one repair-less span, which completes clean once all of its SS_IDs\n * arrived (C.5.2 makes a gap in consecutive SS_IDs directly visible) and\n * otherwise resolves through its catalog-derived deadline. That is the only\n * way a block without repair completes: on the next block's SS_Start, never on\n * a count of K source symbols.\n */\nimport {\n isoBlockContains,\n isoBlockEnd,\n isoBlocksBehindLowerBound,\n serial32Add,\n serial32Distance,\n serial32Precedes,\n} from '@blockcast/mmt-base'\n\n/** One block (or repair-less span) the locator knows the exact range of. */\nexport interface IsoBlockRange {\n readonly start: number\n readonly length: number\n /** True for SS_IDs between two stated blocks whose own repair never came. */\n readonly span: boolean\n}\n\n/** A held source symbol handed back with its block coordinate. */\nexport interface IsoPlacedSource<T> {\n readonly ssId: number\n readonly esi: number\n readonly payload: T\n}\n\n/** What one repair symbol's `(SS_Start, SSB_length)` did to the locator. */\nexport type IsoRepairPlacement<T> =\n | {\n readonly status: 'placed'\n readonly block: IsoBlockRange\n /** Sources this repair placed into `block`, in SS_ID order. */\n readonly placed: readonly IsoPlacedSource<T>[]\n /** The repair-less span this repair closed in front of `block`, if any. */\n readonly span?: { readonly block: IsoBlockRange; readonly placed: readonly IsoPlacedSource<T>[] }\n }\n /** Not a block this stream can use; the repair symbol is dropped. */\n | { readonly status: 'conflict' | 'overlap' | 'stale'; readonly reason: string }\n\n/**\n * Retention: the locator is never without one. Every call that can grow it\n * (`hold`, `placeRepair`) retires, behind the position it just saw, every\n * block, span and held source more than `retentionBlocks` blocks back, by the\n * one ISO horizon metric (`isoBlocksBehindLowerBound`). A block is measured\n * from its last SS_ID, so it stays while any SS_ID of it is inside the\n * horizon: a repair-less span has no length bound, and one measured from its\n * start could be retired the moment it is created, before the sources it\n * placed are fed. Held sources are additionally capped at the SS_IDs the\n * horizon spans (`(retentionBlocks + 1) * kMax`): consecutive SS_IDs (C.5.2)\n * cannot hold more inside it, so the cap only ever bites on a stream whose\n * SS_IDs are not consecutive, and then the oldest arrival goes first.\n */\nexport class IsoBlockLocator<T> {\n /** Known blocks and spans, in serial order of their start. */\n readonly #blocks: IsoBlockRange[] = []\n /** Held first-arrival sources whose block no repair has stated yet. */\n readonly #held = new Map<number, T>()\n /** End of contiguous coverage: the SS_ID the next unknown block starts at. */\n #coverageEnd: number | undefined\n readonly #kMax: number\n #retentionBlocks: number\n #heldEvicted = 0\n #newest: number | undefined\n\n /**\n * @param kMax the catalog maximum K (`sourceSymbols`), the bound on SSB_length.\n * @param retentionBlocks how many blocks behind the newest position the\n * locator keeps, derived by its owner from catalog timing; required, so\n * no locator exists without retention.\n */\n constructor(kMax: number, retentionBlocks: number) {\n if (!Number.isSafeInteger(kMax) || kMax <= 0) {\n throw new Error(`[IsoBlockLocator] maximum K must be a positive integer (got ${kMax})`)\n }\n this.#kMax = kMax\n this.#retentionBlocks = IsoBlockLocator.#checkedRetention(retentionBlocks)\n }\n\n static #checkedRetention(retentionBlocks: number): number {\n if (!Number.isSafeInteger(retentionBlocks) || retentionBlocks <= 0) {\n throw new Error(\n `[IsoBlockLocator] retention must be a positive integer number of blocks (got ${retentionBlocks})`,\n )\n }\n return retentionBlocks\n }\n\n get kMax(): number {\n return this.#kMax\n }\n\n /** Blocks behind the newest position the locator keeps. */\n get retentionBlocks(): number {\n return this.#retentionBlocks\n }\n\n /** Update the retention when the catalog timing it derives from changes. */\n set retentionBlocks(retentionBlocks: number) {\n this.#retentionBlocks = IsoBlockLocator.#checkedRetention(retentionBlocks)\n }\n\n /** The most sources held at once: the SS_IDs the retention horizon spans. */\n get heldCapacity(): number {\n return (this.#retentionBlocks + 1) * this.#kMax\n }\n\n /**\n * The newest position the stream has reached (RFC 1982 order): the newest\n * SS_ID of a source held, or fed once located (`observe`), or SS_Start of a\n * placed repair, so no source the stream has fed follows it. Undefined\n * before the first one.\n */\n get newest(): number | undefined {\n return this.#newest\n }\n\n /** Advance `newest` to `position` if it is newer; retires nothing. */\n observe(position: number): void {\n if (this.#newest === undefined || serial32Precedes(this.#newest, position)) this.#newest = position\n }\n\n /** Held sources evicted by `heldCapacity` (never by the horizon itself). */\n get heldEvicted(): number {\n return this.#heldEvicted\n }\n\n /** Number of known blocks and spans. */\n get blockCount(): number {\n return this.#blocks.length\n }\n\n /** End of contiguous coverage, or undefined before the first repair. */\n get coverageEnd(): number | undefined {\n return this.#coverageEnd\n }\n\n /** Number of sources held for a block no repair has stated yet. */\n get heldCount(): number {\n return this.#held.size\n }\n\n /** The known block or span containing `ssId`, with its ESI. */\n locate(ssId: number): { block: IsoBlockRange; esi: number } | null {\n for (let i = this.#blocks.length - 1; i >= 0; i--) {\n const block = this.#blocks[i]!\n if (isoBlockContains(block.start, block.length, ssId)) {\n return { block, esi: serial32Distance(block.start, ssId) }\n }\n }\n return null\n }\n\n /** The known block or span starting exactly at `start`. */\n blockAt(start: number): IsoBlockRange | undefined {\n return this.#blocks.find((block) => block.start === start)\n }\n\n /** Known blocks and spans overlapping the SS_IDs strictly between `a` and `b`. */\n blocksBetween(a: number, b: number): IsoBlockRange[] {\n const first = (a + 1) >>> 0\n const count = serial32Distance(a, b) - 1\n if (!serial32Precedes(a, b) || count <= 0) return []\n return this.#blocks.filter((block) => {\n const toBlock = serial32Distance(first, block.start)\n const fromBlock = serial32Distance(block.start, first)\n return toBlock < count || fromBlock < block.length\n })\n }\n\n /**\n * Whether every SS_ID strictly between `a` and `b` lies in known coverage,\n * so no block that could hold them is still to be stated by a repair.\n */\n coversBetween(a: number, b: number): boolean {\n if (this.#coverageEnd === undefined) return false\n if (!serial32Precedes(a, b) || serial32Distance(a, b) <= 1) return true\n // The last SS_ID strictly before b must precede the coverage end.\n return serial32Precedes((b - 1) >>> 0, this.#coverageEnd)\n }\n\n /**\n * Hold a first-arrival source symbol whose block is not yet known. Returns\n * false for a second copy of an SS_ID already held, so the first copy wins.\n * Retires behind `ssId` (see the class note).\n */\n hold(ssId: number, payload: T): boolean {\n if (this.#held.has(ssId)) return false\n this.#held.set(ssId, payload)\n this.retireBehind(ssId)\n for (const oldest of this.#held.keys()) {\n if (this.#held.size <= this.heldCapacity) break\n this.#held.delete(oldest)\n this.#heldEvicted++\n }\n return true\n }\n\n /** Whether `ssId` is held unplaced. */\n isHeld(ssId: number): boolean {\n return this.#held.has(ssId)\n }\n\n /**\n * Apply one repair symbol's `(SS_Start, SSB_length)`. The first repair of a\n * block states its range and places every held source in it; later repair\n * symbols of the same block change nothing. A range that contradicts a\n * known block (a different length, or an overlap with another block or a\n * span) fails closed: the repair symbol is dropped and no block changes.\n * A newly stated block retires behind its SS_Start (see the class note).\n */\n placeRepair(start: number, length: number): IsoRepairPlacement<T> {\n if (!Number.isSafeInteger(length) || length <= 0 || length > this.#kMax) {\n return { status: 'conflict', reason: `SSB_length ${length} is outside 1..${this.#kMax}` }\n }\n const known = this.blockAt(start)\n if (known !== undefined) {\n if (known.span) {\n return { status: 'overlap', reason: `repair block ${start}+${length} falls inside a repair-less span` }\n }\n if (known.length !== length) {\n return {\n status: 'conflict',\n reason: `repair SSB_length ${length} conflicts with ${known.length} for SS_Start ${start}`,\n }\n }\n return { status: 'placed', block: known, placed: [] }\n }\n for (const block of this.#blocks) {\n if (\n isoBlockContains(block.start, block.length, start) ||\n isoBlockContains(start, length, block.start)\n ) {\n return {\n status: 'overlap',\n reason: `repair block ${start}+${length} overlaps known block ${block.start}+${block.length}`,\n }\n }\n }\n let span: { block: IsoBlockRange; placed: IsoPlacedSource<T>[] } | undefined\n if (this.#coverageEnd === undefined) {\n // Reception starts at the first stated block. Held sources before it\n // are the tail of blocks that began before the join: their range is\n // never stated, so they are not FEC symbols of this receiver.\n for (const ssId of this.#held.keys()) {\n if (serial32Precedes(ssId, start)) this.#held.delete(ssId)\n }\n this.#coverageEnd = start\n } else if (serial32Precedes(start, this.#coverageEnd)) {\n return { status: 'stale', reason: `repair block ${start}+${length} precedes known coverage` }\n } else if (start !== this.#coverageEnd) {\n const spanBlock: IsoBlockRange = {\n start: this.#coverageEnd,\n length: serial32Distance(this.#coverageEnd, start),\n span: true,\n }\n span = { block: spanBlock, placed: this.#claim(spanBlock) }\n this.#blocks.push(spanBlock)\n }\n const block: IsoBlockRange = { start, length, span: false }\n const placed = this.#claim(block)\n this.#blocks.push(block)\n this.#coverageEnd = isoBlockEnd(start, length)\n this.retireBehind(start)\n return span === undefined\n ? { status: 'placed', block, placed }\n : { status: 'placed', block, placed, span }\n }\n\n /**\n * Retire every block and span whose last SS_ID, and every held source,\n * lies more than `retentionBlocks` blocks behind `position`, with the shared\n * lower-bound metric (`isoBlocksBehindLowerBound`) every ISO interleave\n * horizon uses. Returns the retired block starts.\n */\n retireBehind(position: number): number[] {\n this.observe(position)\n const horizon = this.#retentionBlocks\n const retired: number[] = []\n for (let i = this.#blocks.length - 1; i >= 0; i--) {\n const block = this.#blocks[i]!\n const last = serial32Add(block.start, block.length - 1)\n if (isoBlocksBehindLowerBound(last, position, this.#kMax) > horizon) {\n retired.push(block.start)\n this.#blocks.splice(i, 1)\n }\n }\n for (const ssId of [...this.#held.keys()]) {\n if (isoBlocksBehindLowerBound(ssId, position, this.#kMax) > horizon) this.#held.delete(ssId)\n }\n return retired\n }\n\n /** Forget everything (publisher restart, track reset). */\n reset(): void {\n this.#blocks.length = 0\n this.#held.clear()\n this.#coverageEnd = undefined\n this.#newest = undefined\n }\n\n #claim(block: IsoBlockRange): IsoPlacedSource<T>[] {\n const placed: IsoPlacedSource<T>[] = []\n for (const [ssId, payload] of this.#held) {\n if (!isoBlockContains(block.start, block.length, ssId)) continue\n placed.push({ ssId, esi: serial32Distance(block.start, ssId), payload })\n this.#held.delete(ssId)\n }\n placed.sort((x, y) => x.esi - y.esi)\n return placed\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAiBA,IAAM,kBAAkB;AACxB,IAAM,wBAAwB;AAC9B,IAAM,4BAA4B,kBAAkB;;;AC0D7C,IAAMA,mBAAkB;AAI/B,IAAMC,yBAAwB;AAC9B,IAAMC,6BAA4BC,mBAAkBF;;;ACrE7C,IAAM,iBAAiB;AAGvB,IAAM,oBAAoB,KAAK;AAQ/B,IAAM,uBAAuB,MAAM,iBAAiB;;;ACXpD,IAAM,gBAAgB;AAGtB,IAAM,gBAAgB;AAE7B,SAAS,aAAa,OAAe,MAAY;AAC/C,MAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,SAAS,eAAe;AACnE,UAAM,IAAI,WAAW,GAAG,IAAI,0BAA0B,KAAK,GAAG;EAChE;AACF;AAMM,SAAU,YAAY,GAAW,GAAS;AAC9C,eAAa,GAAG,GAAG;AACnB,MAAI,CAAC,OAAO,UAAU,CAAC,KAAK,KAAK,CAAC,iBAAiB,KAAK,eAAe;AACrE,UAAM,IAAI,WAAW,gDAAgD,CAAC,GAAG;EAC3E;AACA,UAAQ,IAAI,IAAI,iBAAiB;AACnC;AAGM,SAAU,iBAAiB,MAAc,IAAU;AACvD,SAAQ,KAAK,SAAU;AACzB;AAMM,SAAU,iBAAiB,GAAW,GAAS;AACnD,QAAM,WAAW,iBAAiB,GAAG,CAAC;AACtC,SAAO,aAAa,KAAK,WAAW;AACtC;;;ACfO,IAAM,qBAAiD,OAAO,OAAO;E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