mattebox 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cdn/mattebox.dash-drm.min.js +3 -3
- package/dist/cdn/mattebox.dash.min.js +3 -3
- package/dist/cdn/mattebox.dual-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ts.min.js +3 -3
- package/dist/cdn/mattebox.dual.min.js +3 -3
- package/dist/cdn/mattebox.hls-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ts.min.js +3 -3
- package/dist/cdn/mattebox.hls.min.js +3 -3
- package/dist/cdn/mattebox.kernel.min.js +1 -1
- package/dist/cdn/mattebox.min.js +6 -2
- package/dist/containers/captions.d.ts +6 -5
- package/dist/containers/captions.d.ts.map +1 -1
- package/dist/containers/captions.js +9 -9
- package/dist/containers/captions.js.map +1 -1
- package/dist/containers/codec-probe/index.d.ts +15 -0
- package/dist/containers/codec-probe/index.d.ts.map +1 -1
- package/dist/containers/codec-probe/index.js +72 -5
- package/dist/containers/codec-probe/index.js.map +1 -1
- package/dist/containers/emsg.d.ts +15 -0
- package/dist/containers/emsg.d.ts.map +1 -0
- package/dist/containers/emsg.js +91 -0
- package/dist/containers/emsg.js.map +1 -0
- package/dist/containers/id3.d.ts +12 -0
- package/dist/containers/id3.d.ts.map +1 -1
- package/dist/containers/id3.js +53 -4
- package/dist/containers/id3.js.map +1 -1
- package/dist/containers/metadata.d.ts +18 -0
- package/dist/containers/metadata.d.ts.map +1 -0
- package/dist/containers/metadata.js +20 -0
- package/dist/containers/metadata.js.map +1 -0
- package/dist/containers/mp4-box/index.d.ts +16 -0
- package/dist/containers/mp4-box/index.d.ts.map +1 -1
- package/dist/containers/mp4-box/index.js +28 -0
- package/dist/containers/mp4-box/index.js.map +1 -1
- package/dist/containers/scte35.d.ts +12 -0
- package/dist/containers/scte35.d.ts.map +1 -0
- package/dist/containers/scte35.js +116 -0
- package/dist/containers/scte35.js.map +1 -0
- package/dist/containers/ts-transmux/demux.d.ts +2 -2
- package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/demux.js +2 -18
- package/dist/containers/ts-transmux/demux.js.map +1 -1
- package/dist/containers/ts-transmux/index.d.ts.map +1 -1
- package/dist/containers/ts-transmux/index.js +14 -3
- package/dist/containers/ts-transmux/index.js.map +1 -1
- package/dist/containers/ts-transmux/module.d.ts +8 -0
- package/dist/containers/ts-transmux/module.d.ts.map +1 -0
- package/dist/containers/ts-transmux/module.js +8 -0
- package/dist/containers/ts-transmux/module.js.map +1 -0
- package/dist/containers/ts-transmux/runner.d.ts +20 -8
- package/dist/containers/ts-transmux/runner.d.ts.map +1 -1
- package/dist/containers/ts-transmux/runner.js +19 -22
- package/dist/containers/ts-transmux/runner.js.map +1 -1
- package/dist/containers/ts-transmux/serve.d.ts +35 -0
- package/dist/containers/ts-transmux/serve.d.ts.map +1 -0
- package/dist/containers/ts-transmux/serve.js +33 -0
- package/dist/containers/ts-transmux/serve.js.map +1 -0
- package/dist/containers/ts-transmux/sniff.d.ts +11 -0
- package/dist/containers/ts-transmux/sniff.d.ts.map +1 -0
- package/dist/containers/ts-transmux/sniff.js +25 -0
- package/dist/containers/ts-transmux/sniff.js.map +1 -0
- package/dist/containers/ts-transmux/source.d.ts +10 -0
- package/dist/containers/ts-transmux/source.d.ts.map +1 -0
- package/dist/containers/ts-transmux/source.js +5 -0
- package/dist/containers/ts-transmux/source.js.map +1 -0
- package/dist/containers/ts-transmux/transmux.d.ts +19 -1
- package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/transmux.js +46 -7
- package/dist/containers/ts-transmux/transmux.js.map +1 -1
- package/dist/containers/ts-transmux/transmux.worker.js +7 -28
- package/dist/containers/ts-transmux/transmux.worker.js.map +1 -1
- package/dist/containers/webvtt.d.ts +2 -0
- package/dist/containers/webvtt.d.ts.map +1 -1
- package/dist/containers/webvtt.js +4 -0
- package/dist/containers/webvtt.js.map +1 -1
- package/dist/containers/wvtt.d.ts +12 -0
- package/dist/containers/wvtt.d.ts.map +1 -0
- package/dist/containers/wvtt.js +46 -0
- package/dist/containers/wvtt.js.map +1 -0
- package/dist/eme/index.d.ts +34 -0
- package/dist/eme/index.d.ts.map +1 -0
- package/dist/eme/index.js +75 -0
- package/dist/eme/index.js.map +1 -0
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/captions.js +8 -8
- package/dist/es2015/containers/codec-probe/index.js +105 -6
- package/dist/es2015/containers/emsg.js +81 -0
- package/dist/es2015/containers/id3.js +54 -4
- package/dist/es2015/containers/metadata.js +20 -0
- package/dist/es2015/containers/mp4-box/index.js +27 -1
- package/dist/es2015/containers/scte35.js +114 -0
- package/dist/es2015/containers/ts-transmux/demux.js +12 -24
- package/dist/es2015/containers/ts-transmux/h264.js +1 -1
- package/dist/es2015/containers/ts-transmux/index.js +12 -4
- package/dist/es2015/containers/ts-transmux/runner.js +34 -27
- package/dist/es2015/containers/ts-transmux/serve.js +36 -0
- package/dist/es2015/containers/ts-transmux/sniff.js +13 -0
- package/dist/es2015/containers/ts-transmux/source.js +7 -0
- package/dist/es2015/containers/ts-transmux/transmux.js +42 -8
- package/dist/es2015/containers/ts-transmux/transmux.worker.js +7 -26
- package/dist/es2015/containers/webvtt.js +6 -2
- package/dist/es2015/containers/wvtt.js +40 -0
- package/dist/es2015/eme/index.js +79 -0
- package/dist/es2015/index.js +40 -14
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/base64.js +14 -3
- package/dist/es2015/kernel/bus.js +11 -8
- package/dist/es2015/kernel/context.js +5 -0
- package/dist/es2015/kernel/lifecycle.js +1 -0
- package/dist/es2015/kernel/loader.js +2 -2
- package/dist/es2015/kernel/mime.js +12 -1
- package/dist/es2015/kernel/mse.js +39 -5
- package/dist/es2015/kernel/prepare.js +2 -2
- package/dist/es2015/kernel/reducer.js +118 -26
- package/dist/es2015/kernel/refresh.js +2 -2
- package/dist/es2015/kernel/rendition-select.js +2 -1
- package/dist/es2015/kernel/scheduler.js +1 -1
- package/dist/es2015/kernel/sinks/caption-tracks.js +82 -0
- package/dist/es2015/kernel/sinks/native-sync.js +46 -0
- package/dist/es2015/kernel/sinks/text-formats.js +64 -0
- package/dist/es2015/kernel/sinks/text-track-sink.js +15 -4
- package/dist/es2015/kernel/timeline.js +12 -8
- package/dist/es2015/kernel/trace.js +1 -1
- package/dist/es2015/kernel/track-registry.js +21 -1
- package/dist/es2015/kernel/transport.js +34 -7
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/full/index.js +22 -2
- package/dist/es2015/protocols/dash-cmaf/index.js +61 -14
- package/dist/es2015/protocols/dash-cmaf/parse.js +389 -106
- package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +134 -0
- package/dist/es2015/protocols/dash-cmaf/periods.js +178 -0
- package/dist/es2015/protocols/dash-live/index.js +1 -1
- package/dist/es2015/protocols/hls-cmaf/index.js +41 -17
- package/dist/es2015/protocols/hls-cmaf/lexer.js +2 -1
- package/dist/es2015/protocols/hls-cmaf/parse.js +132 -22
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +37 -6
- package/dist/es2015/protocols/hls-live/index.js +36 -10
- package/dist/es2015/stages/abr/index.js +10 -5
- package/dist/es2015/stages/abr-persist/index.js +1 -1
- package/dist/es2015/stages/aes-128/index.js +1 -1
- package/dist/es2015/stages/alt-audio/index.js +31 -11
- package/dist/es2015/stages/chapters/index.js +2 -2
- package/dist/es2015/stages/chapters/parse.js +2 -2
- package/dist/es2015/stages/cmcd/index.js +30 -3
- package/dist/es2015/stages/cmsd/index.js +72 -0
- package/dist/es2015/stages/codec-probe/index.js +28 -3
- package/dist/es2015/stages/content-steering/index.js +1 -1
- package/dist/es2015/stages/eme-core/index.js +22 -2
- package/dist/es2015/stages/eme-fairplay/index.js +1 -1
- package/dist/es2015/stages/hdr/index.js +214 -0
- package/dist/es2015/stages/meta-id3/index.js +6 -1
- package/dist/es2015/stages/qoe/index.js +111 -0
- package/dist/es2015/stages/recovery/index.js +1 -1
- package/dist/es2015/stages/rendition-names/index.js +101 -0
- package/dist/es2015/stages/text-cea608/decode.js +56 -5
- package/dist/es2015/stages/text-cea608/index.js +29 -27
- package/dist/es2015/stages/text-cea708/decode.js +377 -0
- package/dist/es2015/stages/text-cea708/index.js +98 -0
- package/dist/es2015/stages/text-ttml/index.js +88 -0
- package/dist/es2015/stages/text-ttml/parse.js +255 -0
- package/dist/es2015/stages/text-webvtt/index.js +31 -62
- package/dist/es2015/stages/thumbnails/index.js +1 -1
- package/dist/es2015/stages/timed-metadata/index.js +331 -0
- package/dist/es2015/stages/trick-play/index.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/dist/kernel/base64.d.ts +7 -2
- package/dist/kernel/base64.d.ts.map +1 -1
- package/dist/kernel/base64.js +14 -2
- package/dist/kernel/base64.js.map +1 -1
- package/dist/kernel/bus.d.ts.map +1 -1
- package/dist/kernel/bus.js +12 -9
- package/dist/kernel/bus.js.map +1 -1
- package/dist/kernel/context.d.ts +3 -1
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/context.js +5 -0
- package/dist/kernel/context.js.map +1 -1
- package/dist/kernel/lifecycle.d.ts +3 -1
- package/dist/kernel/lifecycle.d.ts.map +1 -1
- package/dist/kernel/lifecycle.js +1 -0
- package/dist/kernel/lifecycle.js.map +1 -1
- package/dist/kernel/loader.d.ts.map +1 -1
- package/dist/kernel/loader.js +3 -2
- package/dist/kernel/loader.js.map +1 -1
- package/dist/kernel/mime.d.ts +7 -0
- package/dist/kernel/mime.d.ts.map +1 -1
- package/dist/kernel/mime.js +12 -0
- package/dist/kernel/mime.js.map +1 -1
- package/dist/kernel/mse.d.ts.map +1 -1
- package/dist/kernel/mse.js +37 -2
- package/dist/kernel/mse.js.map +1 -1
- package/dist/kernel/reducer.d.ts +3 -0
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +117 -12
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/refresh.d.ts.map +1 -1
- package/dist/kernel/refresh.js +1 -0
- package/dist/kernel/refresh.js.map +1 -1
- package/dist/kernel/rendition-select.d.ts.map +1 -1
- package/dist/kernel/rendition-select.js +4 -2
- package/dist/kernel/rendition-select.js.map +1 -1
- package/dist/kernel/sinks/caption-tracks.d.ts +11 -0
- package/dist/kernel/sinks/caption-tracks.d.ts.map +1 -0
- package/dist/kernel/sinks/caption-tracks.js +87 -0
- package/dist/kernel/sinks/caption-tracks.js.map +1 -0
- package/dist/kernel/sinks/native-sync.d.ts +24 -0
- package/dist/kernel/sinks/native-sync.d.ts.map +1 -0
- package/dist/kernel/sinks/native-sync.js +42 -0
- package/dist/kernel/sinks/native-sync.js.map +1 -0
- package/dist/kernel/sinks/text-formats.d.ts +25 -0
- package/dist/kernel/sinks/text-formats.d.ts.map +1 -0
- package/dist/kernel/sinks/text-formats.js +69 -0
- package/dist/kernel/sinks/text-formats.js.map +1 -0
- package/dist/kernel/sinks/text-track-sink.d.ts.map +1 -1
- package/dist/kernel/sinks/text-track-sink.js +22 -4
- package/dist/kernel/sinks/text-track-sink.js.map +1 -1
- package/dist/kernel/timeline.d.ts +10 -6
- package/dist/kernel/timeline.d.ts.map +1 -1
- package/dist/kernel/timeline.js +14 -6
- package/dist/kernel/timeline.js.map +1 -1
- package/dist/kernel/track-registry.d.ts +8 -8
- package/dist/kernel/track-registry.d.ts.map +1 -1
- package/dist/kernel/track-registry.js +29 -4
- package/dist/kernel/track-registry.js.map +1 -1
- package/dist/kernel/transport.d.ts +8 -0
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +28 -1
- package/dist/kernel/transport.js.map +1 -1
- package/dist/presets/full/index.d.ts.map +1 -1
- package/dist/presets/full/index.js +21 -1
- package/dist/presets/full/index.js.map +1 -1
- package/dist/protocols/adapter-shared.d.ts +8 -0
- package/dist/protocols/adapter-shared.d.ts.map +1 -1
- package/dist/protocols/adapter-shared.js +6 -0
- package/dist/protocols/adapter-shared.js.map +1 -1
- package/dist/protocols/dash-cmaf/index.d.ts +9 -1
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +78 -14
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +419 -90
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/dash-cmaf/periods-runtime.d.ts +6 -0
- package/dist/protocols/dash-cmaf/periods-runtime.d.ts.map +1 -0
- package/dist/protocols/dash-cmaf/periods-runtime.js +121 -0
- package/dist/protocols/dash-cmaf/periods-runtime.js.map +1 -0
- package/dist/protocols/dash-cmaf/periods.d.ts +24 -0
- package/dist/protocols/dash-cmaf/periods.d.ts.map +1 -0
- package/dist/protocols/dash-cmaf/periods.js +210 -0
- package/dist/protocols/dash-cmaf/periods.js.map +1 -0
- package/dist/protocols/hls-cmaf/index.d.ts +9 -1
- package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/index.js +49 -20
- package/dist/protocols/hls-cmaf/index.js.map +1 -1
- package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/lexer.js +1 -0
- package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
- package/dist/protocols/hls-cmaf/parse.d.ts +3 -1
- package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/parse.js +169 -10
- package/dist/protocols/hls-cmaf/parse.js.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts +9 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.js +29 -3
- package/dist/protocols/hls-cmaf/unavailable.js.map +1 -1
- package/dist/protocols/hls-live/index.d.ts +9 -1
- package/dist/protocols/hls-live/index.d.ts.map +1 -1
- package/dist/protocols/hls-live/index.js +36 -7
- package/dist/protocols/hls-live/index.js.map +1 -1
- package/dist/stages/abr/index.d.ts.map +1 -1
- package/dist/stages/abr/index.js +10 -6
- package/dist/stages/abr/index.js.map +1 -1
- package/dist/stages/alt-audio/index.d.ts +5 -2
- package/dist/stages/alt-audio/index.d.ts.map +1 -1
- package/dist/stages/alt-audio/index.js +31 -11
- package/dist/stages/alt-audio/index.js.map +1 -1
- package/dist/stages/cmcd/index.d.ts.map +1 -1
- package/dist/stages/cmcd/index.js +39 -3
- package/dist/stages/cmcd/index.js.map +1 -1
- package/dist/stages/cmsd/index.d.ts +22 -0
- package/dist/stages/cmsd/index.d.ts.map +1 -0
- package/dist/stages/cmsd/index.js +65 -0
- package/dist/stages/cmsd/index.js.map +1 -0
- package/dist/stages/codec-probe/index.d.ts.map +1 -1
- package/dist/stages/codec-probe/index.js +30 -3
- package/dist/stages/codec-probe/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts +7 -0
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +26 -0
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/hdr/index.d.ts +22 -0
- package/dist/stages/hdr/index.d.ts.map +1 -0
- package/dist/stages/hdr/index.js +191 -0
- package/dist/stages/hdr/index.js.map +1 -0
- package/dist/stages/meta-id3/index.d.ts.map +1 -1
- package/dist/stages/meta-id3/index.js +6 -2
- package/dist/stages/meta-id3/index.js.map +1 -1
- package/dist/stages/qoe/index.d.ts +32 -0
- package/dist/stages/qoe/index.d.ts.map +1 -0
- package/dist/stages/qoe/index.js +116 -0
- package/dist/stages/qoe/index.js.map +1 -0
- package/dist/stages/rendition-names/index.d.ts +41 -0
- package/dist/stages/rendition-names/index.d.ts.map +1 -0
- package/dist/stages/rendition-names/index.js +101 -0
- package/dist/stages/rendition-names/index.js.map +1 -0
- package/dist/stages/text-cea608/decode.d.ts +23 -2
- package/dist/stages/text-cea608/decode.d.ts.map +1 -1
- package/dist/stages/text-cea608/decode.js +55 -5
- package/dist/stages/text-cea608/decode.js.map +1 -1
- package/dist/stages/text-cea608/index.d.ts +10 -3
- package/dist/stages/text-cea608/index.d.ts.map +1 -1
- package/dist/stages/text-cea608/index.js +34 -34
- package/dist/stages/text-cea608/index.js.map +1 -1
- package/dist/stages/text-cea708/decode.d.ts +79 -0
- package/dist/stages/text-cea708/decode.d.ts.map +1 -0
- package/dist/stages/text-cea708/decode.js +404 -0
- package/dist/stages/text-cea708/decode.js.map +1 -0
- package/dist/stages/text-cea708/index.d.ts +3 -0
- package/dist/stages/text-cea708/index.d.ts.map +1 -0
- package/dist/stages/text-cea708/index.js +93 -0
- package/dist/stages/text-cea708/index.js.map +1 -0
- package/dist/stages/text-ttml/index.d.ts +3 -0
- package/dist/stages/text-ttml/index.d.ts.map +1 -0
- package/dist/stages/text-ttml/index.js +74 -0
- package/dist/stages/text-ttml/index.js.map +1 -0
- package/dist/stages/text-ttml/parse.d.ts +16 -0
- package/dist/stages/text-ttml/parse.d.ts.map +1 -0
- package/dist/stages/text-ttml/parse.js +277 -0
- package/dist/stages/text-ttml/parse.js.map +1 -0
- package/dist/stages/text-webvtt/index.d.ts +6 -10
- package/dist/stages/text-webvtt/index.d.ts.map +1 -1
- package/dist/stages/text-webvtt/index.js +22 -64
- package/dist/stages/text-webvtt/index.js.map +1 -1
- package/dist/stages/timed-metadata/index.d.ts +15 -0
- package/dist/stages/timed-metadata/index.d.ts.map +1 -0
- package/dist/stages/timed-metadata/index.js +370 -0
- package/dist/stages/timed-metadata/index.js.map +1 -0
- package/dist/types/error.d.ts +1 -1
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/facade.d.ts +14 -10
- package/dist/types/facade.d.ts.map +1 -1
- package/dist/types/ir.d.ts +71 -0
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +11 -1
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/kernel.js.map +1 -1
- package/dist/types/messages.d.ts +20 -1
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/metadata.d.ts +59 -0
- package/dist/types/metadata.d.ts.map +1 -0
- package/dist/types/metadata.js +7 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/quality.d.ts +3 -0
- package/dist/types/quality.d.ts.map +1 -1
- package/dist/types/stage.d.ts +17 -0
- package/dist/types/stage.d.ts.map +1 -1
- package/package.json +10 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { findBox, parseSidx } from "../../containers/mp4-box/index.js";
|
|
3
|
-
import { resolveUrl } from "../../kernel/url.js";
|
|
4
3
|
import { base64ToBytes } from "../../kernel/base64.js";
|
|
4
|
+
import { resolveUrl } from "../../kernel/url.js";
|
|
5
5
|
import { manifestError } from "../adapter-shared.js";
|
|
6
6
|
import { dimensions } from "../dimensions.js";
|
|
7
|
+
import { flattenPeriods } from "./periods.js";
|
|
7
8
|
//#region src/protocols/dash-cmaf/parse.ts
|
|
8
9
|
/**
|
|
9
10
|
* MPD into the IR. Pure: no fetching, no state, no side effects. DOMParser
|
|
@@ -137,6 +138,113 @@ function audioCharacteristics(adaptationSet) {
|
|
|
137
138
|
return tags;
|
|
138
139
|
}
|
|
139
140
|
/**
|
|
141
|
+
* ISO/IEC 23009-1 §5.10.2: a Period's EventStreams. Each Event's
|
|
142
|
+
* presentationTime counts in the stream's timescale from its
|
|
143
|
+
* presentationTimeOffset, relative to the Period start. The body is the
|
|
144
|
+
* messageData attribute, or else the element's text. Events carry the
|
|
145
|
+
* scheme as written; nothing here decides what one means.
|
|
146
|
+
*/
|
|
147
|
+
function eventsOf(periodElement, periodStart) {
|
|
148
|
+
const out = [];
|
|
149
|
+
for (const stream of children(periodElement, "EventStream")) {
|
|
150
|
+
var _numberAttr, _numberAttr2;
|
|
151
|
+
const scheme = attr(stream, "schemeIdUri");
|
|
152
|
+
if (scheme === null) continue;
|
|
153
|
+
const value = attr(stream, "value");
|
|
154
|
+
const timescale = (_numberAttr = numberAttr(stream, "timescale")) !== null && _numberAttr !== void 0 ? _numberAttr : 1;
|
|
155
|
+
const offset = (_numberAttr2 = numberAttr(stream, "presentationTimeOffset")) !== null && _numberAttr2 !== void 0 ? _numberAttr2 : 0;
|
|
156
|
+
let index = 0;
|
|
157
|
+
for (const event of children(stream, "Event")) {
|
|
158
|
+
var _numberAttr3, _ref, _attr6, _event$textContent, _attr7;
|
|
159
|
+
const time = (_numberAttr3 = numberAttr(event, "presentationTime")) !== null && _numberAttr3 !== void 0 ? _numberAttr3 : 0;
|
|
160
|
+
const duration = numberAttr(event, "duration");
|
|
161
|
+
const data = (_ref = (_attr6 = attr(event, "messageData")) !== null && _attr6 !== void 0 ? _attr6 : (_event$textContent = event.textContent) === null || _event$textContent === void 0 ? void 0 : _event$textContent.trim()) !== null && _ref !== void 0 ? _ref : "";
|
|
162
|
+
out.push(_objectSpread2(_objectSpread2(_objectSpread2({ scheme }, value !== null ? { value } : {}), {}, {
|
|
163
|
+
id: (_attr7 = attr(event, "id")) !== null && _attr7 !== void 0 ? _attr7 : `${scheme}:${index}`,
|
|
164
|
+
start: periodStart + (time - offset) / timescale
|
|
165
|
+
}, duration !== null ? { duration: duration / timescale } : {}), data !== "" ? { data } : {}));
|
|
166
|
+
index += 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return out.sort((a, b) => a.start - b.start);
|
|
170
|
+
}
|
|
171
|
+
const CEA608_SCHEME = "urn:scte:dash:cc:cea-608:2015";
|
|
172
|
+
/**
|
|
173
|
+
* SCTE 214-1: an Accessibility descriptor with the CEA-608 scheme names the
|
|
174
|
+
* in-band caption channels of a video AdaptationSet, as "CC1=eng;CC3=fre",
|
|
175
|
+
* "1=eng", or bare languages. Bare languages take CC1 and CC3 when there
|
|
176
|
+
* are two, else CC1 to CC4 in order; an empty value means CC1. This is the
|
|
177
|
+
* reading Shaka Player applies.
|
|
178
|
+
*/
|
|
179
|
+
function captionChannels(adaptationSet) {
|
|
180
|
+
const out = [];
|
|
181
|
+
for (const descriptor of children(adaptationSet, "Accessibility")) {
|
|
182
|
+
var _attr8;
|
|
183
|
+
if (attr(descriptor, "schemeIdUri") !== CEA608_SCHEME) continue;
|
|
184
|
+
const value = ((_attr8 = attr(descriptor, "value")) !== null && _attr8 !== void 0 ? _attr8 : "").trim();
|
|
185
|
+
if (value === "") {
|
|
186
|
+
out.push(["CC1", null]);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const entries = value.split(";");
|
|
190
|
+
let next = 1;
|
|
191
|
+
for (const entry of entries) {
|
|
192
|
+
const [left, right] = entry.split("=");
|
|
193
|
+
if (right === void 0) {
|
|
194
|
+
out.push([`CC${next}`, left.trim() || null]);
|
|
195
|
+
next += entries.length === 2 ? 2 : 1;
|
|
196
|
+
} else {
|
|
197
|
+
const channel = left.trim().startsWith("CC") ? left.trim() : `CC${left.trim()}`;
|
|
198
|
+
out.push([channel, right.trim() || null]);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
const CEA708_SCHEME = "urn:scte:dash:cc:cea-708:2015";
|
|
205
|
+
/**
|
|
206
|
+
* SCTE 214-1: an Accessibility descriptor with the CEA-708 scheme names the
|
|
207
|
+
* caption services of a video AdaptationSet, as "1=lang:eng;2=lang:spa"
|
|
208
|
+
* (other keys such as `war` and `er` beside `lang` are ignored), "1=eng", or
|
|
209
|
+
* bare languages in service order. An empty value means service 1.
|
|
210
|
+
*/
|
|
211
|
+
function captionServices(adaptationSet) {
|
|
212
|
+
const out = [];
|
|
213
|
+
for (const descriptor of children(adaptationSet, "Accessibility")) {
|
|
214
|
+
var _attr9;
|
|
215
|
+
if (attr(descriptor, "schemeIdUri") !== CEA708_SCHEME) continue;
|
|
216
|
+
const value = ((_attr9 = attr(descriptor, "value")) !== null && _attr9 !== void 0 ? _attr9 : "").trim();
|
|
217
|
+
if (value === "") {
|
|
218
|
+
out.push(["SERVICE1", null]);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
value.split(";").forEach((entry, index) => {
|
|
222
|
+
var _keys$find$split$, _keys$find, _keys$;
|
|
223
|
+
const [left, right] = entry.split("=");
|
|
224
|
+
const service = right === void 0 ? index + 1 : Number.parseInt(left, 10);
|
|
225
|
+
const keys = (right !== null && right !== void 0 ? right : left).split(",");
|
|
226
|
+
const lang = (_keys$find$split$ = (_keys$find = keys.find((key) => key.trim().startsWith("lang:"))) === null || _keys$find === void 0 ? void 0 : _keys$find.split(":")[1]) !== null && _keys$find$split$ !== void 0 ? _keys$find$split$ : keys.length === 1 && !((_keys$ = keys[0]) === null || _keys$ === void 0 ? void 0 : _keys$.includes(":")) ? keys[0] : void 0;
|
|
227
|
+
if (service >= 1 && service <= 63) out.push([`SERVICE${service}`, (lang === null || lang === void 0 ? void 0 : lang.trim()) || null]);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
const TRANSFER_CHARACTERISTICS = "urn:mpeg:mpegB:cicp:TransferCharacteristics";
|
|
233
|
+
/**
|
|
234
|
+
* The video range a representation signals: the CICP transfer
|
|
235
|
+
* characteristics property (ISO/IEC 23001-8; DASH-IF IOP), 16 for PQ and 18
|
|
236
|
+
* for HLG, on the Representation or its AdaptationSet; else PQ for a Dolby
|
|
237
|
+
* Vision codec; else nothing.
|
|
238
|
+
*/
|
|
239
|
+
function videoRangeOf(representation, adaptationSet, codecs) {
|
|
240
|
+
for (const element of [representation, adaptationSet]) for (const property of [...children(element, "EssentialProperty"), ...children(element, "SupplementalProperty")]) {
|
|
241
|
+
if (attr(property, "schemeIdUri") !== TRANSFER_CHARACTERISTICS) continue;
|
|
242
|
+
const value = attr(property, "value");
|
|
243
|
+
return { videoRange: value === "16" ? "PQ" : value === "18" ? "HLG" : "SDR" };
|
|
244
|
+
}
|
|
245
|
+
return codecs !== null && /^dv(h1|he|a1|av)/.test(codecs) ? { videoRange: "PQ" } : {};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
140
248
|
* A trick-mode AdaptationSet: the DASH-IF trickmode EssentialProperty, or a
|
|
141
249
|
* representation declaring a playout rate other than 1. Both mark an
|
|
142
250
|
* I-frame-only set meant for fast forward and previews, never for normal
|
|
@@ -144,8 +252,8 @@ function audioCharacteristics(adaptationSet) {
|
|
|
144
252
|
*/
|
|
145
253
|
function isTrickMode(adaptationSet) {
|
|
146
254
|
for (const property of children(adaptationSet, "EssentialProperty")) {
|
|
147
|
-
var
|
|
148
|
-
if (((
|
|
255
|
+
var _attr10;
|
|
256
|
+
if (((_attr10 = attr(property, "schemeIdUri")) !== null && _attr10 !== void 0 ? _attr10 : "").includes("trickmode")) return true;
|
|
149
257
|
}
|
|
150
258
|
if (numberAttr(adaptationSet, "maxPlayoutRate") !== null) return true;
|
|
151
259
|
for (const representation of children(adaptationSet, "Representation")) {
|
|
@@ -164,8 +272,8 @@ function tileGridOf(representation, adaptationSet, width, height) {
|
|
|
164
272
|
if (width === null || height === null) return null;
|
|
165
273
|
const properties = [...children(representation, "EssentialProperty"), ...children(adaptationSet, "EssentialProperty")];
|
|
166
274
|
for (const property of properties) {
|
|
167
|
-
var
|
|
168
|
-
if (!((
|
|
275
|
+
var _attr11;
|
|
276
|
+
if (!((_attr11 = attr(property, "schemeIdUri")) !== null && _attr11 !== void 0 ? _attr11 : "").includes("thumbnail_tile")) continue;
|
|
169
277
|
const grid = dimensions(attr(property, "value"));
|
|
170
278
|
if (grid === null) continue;
|
|
171
279
|
const [columns, rows] = grid;
|
|
@@ -190,16 +298,16 @@ function mergeTemplates(levels) {
|
|
|
190
298
|
let timelineElement = null;
|
|
191
299
|
let found = false;
|
|
192
300
|
for (const level of levels) {
|
|
193
|
-
var
|
|
301
|
+
var _attr12, _attr13, _numberAttr4, _numberAttr5, _numberAttr6, _numberAttr7, _children$2;
|
|
194
302
|
const template = children(level, "SegmentTemplate")[0];
|
|
195
303
|
if (template === void 0) continue;
|
|
196
304
|
found = true;
|
|
197
|
-
media = (
|
|
198
|
-
initialization = (
|
|
199
|
-
timescale = (
|
|
200
|
-
startNumber = (
|
|
201
|
-
duration = (
|
|
202
|
-
pto = (
|
|
305
|
+
media = (_attr12 = attr(template, "media")) !== null && _attr12 !== void 0 ? _attr12 : media;
|
|
306
|
+
initialization = (_attr13 = attr(template, "initialization")) !== null && _attr13 !== void 0 ? _attr13 : initialization;
|
|
307
|
+
timescale = (_numberAttr4 = numberAttr(template, "timescale")) !== null && _numberAttr4 !== void 0 ? _numberAttr4 : timescale;
|
|
308
|
+
startNumber = (_numberAttr5 = numberAttr(template, "startNumber")) !== null && _numberAttr5 !== void 0 ? _numberAttr5 : startNumber;
|
|
309
|
+
duration = (_numberAttr6 = numberAttr(template, "duration")) !== null && _numberAttr6 !== void 0 ? _numberAttr6 : duration;
|
|
310
|
+
pto = (_numberAttr7 = numberAttr(template, "presentationTimeOffset")) !== null && _numberAttr7 !== void 0 ? _numberAttr7 : pto;
|
|
203
311
|
timelineElement = (_children$2 = children(template, "SegmentTimeline")[0]) !== null && _children$2 !== void 0 ? _children$2 : timelineElement;
|
|
204
312
|
}
|
|
205
313
|
if (!found) return null;
|
|
@@ -217,17 +325,74 @@ function mergeTemplates(levels) {
|
|
|
217
325
|
* SegmentTimeline into compressed runs. @r repeats; a negative @r repeats
|
|
218
326
|
* until the next S@t, or the period end on the last S.
|
|
219
327
|
*/
|
|
328
|
+
/**
|
|
329
|
+
* ISO/IEC 23009-1 §5.3.9.3: a SegmentList names each segment by URL and
|
|
330
|
+
* optional byte range, timed by @duration or a SegmentTimeline. The
|
|
331
|
+
* attributes and the Initialization inherit from Period to Representation;
|
|
332
|
+
* the SegmentURLs come from the deepest level that has them. Null when no
|
|
333
|
+
* level has a SegmentList.
|
|
334
|
+
*/
|
|
335
|
+
function segmentListOf(levels, base, periodStart, periodEndUnits) {
|
|
336
|
+
var _attr15;
|
|
337
|
+
let timescale = 1;
|
|
338
|
+
let duration = null;
|
|
339
|
+
let startNumber = 1;
|
|
340
|
+
let offset = 0;
|
|
341
|
+
let initialization = null;
|
|
342
|
+
let timelineElement = null;
|
|
343
|
+
let urls = [];
|
|
344
|
+
let found = false;
|
|
345
|
+
for (const level of levels) {
|
|
346
|
+
var _numberAttr8, _numberAttr9, _numberAttr10, _numberAttr11, _children$3, _children$4;
|
|
347
|
+
const list = children(level, "SegmentList")[0];
|
|
348
|
+
if (list === void 0) continue;
|
|
349
|
+
found = true;
|
|
350
|
+
timescale = (_numberAttr8 = numberAttr(list, "timescale")) !== null && _numberAttr8 !== void 0 ? _numberAttr8 : timescale;
|
|
351
|
+
duration = (_numberAttr9 = numberAttr(list, "duration")) !== null && _numberAttr9 !== void 0 ? _numberAttr9 : duration;
|
|
352
|
+
startNumber = (_numberAttr10 = numberAttr(list, "startNumber")) !== null && _numberAttr10 !== void 0 ? _numberAttr10 : startNumber;
|
|
353
|
+
offset = (_numberAttr11 = numberAttr(list, "presentationTimeOffset")) !== null && _numberAttr11 !== void 0 ? _numberAttr11 : offset;
|
|
354
|
+
initialization = (_children$3 = children(list, "Initialization")[0]) !== null && _children$3 !== void 0 ? _children$3 : initialization;
|
|
355
|
+
timelineElement = (_children$4 = children(list, "SegmentTimeline")[0]) !== null && _children$4 !== void 0 ? _children$4 : timelineElement;
|
|
356
|
+
const here = children(list, "SegmentURL");
|
|
357
|
+
if (here.length > 0) urls = here;
|
|
358
|
+
}
|
|
359
|
+
if (!found) return null;
|
|
360
|
+
const times = [];
|
|
361
|
+
if (timelineElement !== null) {
|
|
362
|
+
const runs = parseTimeline(timelineElement, periodEndUnits(timescale, offset));
|
|
363
|
+
if (runs === null) return "invalid";
|
|
364
|
+
for (const run of runs) for (let i = 0; i < run.count; i += 1) times.push([run.start + i * run.duration, run.duration]);
|
|
365
|
+
} else if (duration !== null) for (let i = 0; i < urls.length; i += 1) times.push([offset + i * duration, duration]);
|
|
366
|
+
else if (urls.length > 1) return "invalid";
|
|
367
|
+
const segments = [];
|
|
368
|
+
urls.forEach((url, i) => {
|
|
369
|
+
var _times$i, _attr14;
|
|
370
|
+
const [time, length] = (_times$i = times[i]) !== null && _times$i !== void 0 ? _times$i : [offset, 0];
|
|
371
|
+
const range = parseByteRange(attr(url, "mediaRange"));
|
|
372
|
+
segments.push(_objectSpread2({
|
|
373
|
+
seq: startNumber + i,
|
|
374
|
+
start: periodStart + (time - offset) / timescale,
|
|
375
|
+
duration: length / timescale,
|
|
376
|
+
url: resolveUrl((_attr14 = attr(url, "media")) !== null && _attr14 !== void 0 ? _attr14 : "", base)
|
|
377
|
+
}, range !== null ? { byteRange: range } : {}));
|
|
378
|
+
});
|
|
379
|
+
const initRange = initialization === null ? null : parseByteRange(attr(initialization, "range"));
|
|
380
|
+
return {
|
|
381
|
+
segments,
|
|
382
|
+
init: initialization === null ? null : _objectSpread2({ url: resolveUrl((_attr15 = attr(initialization, "sourceURL")) !== null && _attr15 !== void 0 ? _attr15 : "", base) }, initRange !== null ? { byteRange: initRange } : {})
|
|
383
|
+
};
|
|
384
|
+
}
|
|
220
385
|
function parseTimeline(timelineElement, periodEndUnits) {
|
|
221
386
|
const sElements = children(timelineElement, "S");
|
|
222
387
|
const runs = [];
|
|
223
388
|
let time = 0;
|
|
224
389
|
for (let i = 0; i < sElements.length; i += 1) {
|
|
225
|
-
var
|
|
390
|
+
var _numberAttr12, _numberAttr13;
|
|
226
391
|
const s = sElements[i];
|
|
227
392
|
const d = numberAttr(s, "d");
|
|
228
393
|
if (d === null || d <= 0) return null;
|
|
229
|
-
time = (
|
|
230
|
-
const r = (
|
|
394
|
+
time = (_numberAttr12 = numberAttr(s, "t")) !== null && _numberAttr12 !== void 0 ? _numberAttr12 : time;
|
|
395
|
+
const r = (_numberAttr13 = numberAttr(s, "r")) !== null && _numberAttr13 !== void 0 ? _numberAttr13 : 0;
|
|
231
396
|
let count;
|
|
232
397
|
if (r >= 0) count = r + 1;
|
|
233
398
|
else {
|
|
@@ -253,80 +418,65 @@ function substituteIdentity(template, id, bandwidth) {
|
|
|
253
418
|
});
|
|
254
419
|
}
|
|
255
420
|
function contentTypeOf(adaptationSet, mimeType) {
|
|
421
|
+
var _attr16, _children$5;
|
|
256
422
|
const declared = attr(adaptationSet, "contentType");
|
|
257
423
|
if (declared === "video" || declared === "audio" || declared === "text" || declared === "image" || declared === "metadata") return declared;
|
|
258
424
|
if (mimeType.startsWith("audio/")) return "audio";
|
|
259
425
|
if (mimeType.startsWith("image/")) return "image";
|
|
260
426
|
if (mimeType.startsWith("text/") || mimeType === "application/ttml+xml") return "text";
|
|
427
|
+
const codecs = (_attr16 = attr(adaptationSet, "codecs")) !== null && _attr16 !== void 0 ? _attr16 : attr((_children$5 = children(adaptationSet, "Representation")[0]) !== null && _children$5 !== void 0 ? _children$5 : adaptationSet, "codecs");
|
|
428
|
+
if (mimeType === "application/mp4" && codecs !== null && /^(stpp|wvtt)/.test(codecs)) return "text";
|
|
261
429
|
return "video";
|
|
262
430
|
}
|
|
263
|
-
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Each Period's start and duration (ISO/IEC 23009-1 §5.3.2.1): `@start`, or
|
|
433
|
+
* where the previous period ends; `@duration`, or up to the next period's
|
|
434
|
+
* start, or up to the presentation's end.
|
|
435
|
+
*/
|
|
436
|
+
function periodSpans(elements, mpdDuration) {
|
|
437
|
+
const starts = [];
|
|
438
|
+
let previousEnd = 0;
|
|
439
|
+
for (const element of elements) {
|
|
440
|
+
var _parseDuration;
|
|
441
|
+
const start = (_parseDuration = parseDuration(attr(element, "start"))) !== null && _parseDuration !== void 0 ? _parseDuration : previousEnd;
|
|
442
|
+
const duration = parseDuration(attr(element, "duration"));
|
|
443
|
+
starts.push(start);
|
|
444
|
+
previousEnd = start !== null && duration !== null ? start + duration : null;
|
|
445
|
+
}
|
|
446
|
+
return elements.map((element, i) => {
|
|
447
|
+
var _starts$i, _parseDuration2;
|
|
448
|
+
const start = (_starts$i = starts[i]) !== null && _starts$i !== void 0 ? _starts$i : 0;
|
|
449
|
+
const next = starts[i + 1];
|
|
270
450
|
return {
|
|
271
|
-
|
|
272
|
-
|
|
451
|
+
start,
|
|
452
|
+
duration: (_parseDuration2 = parseDuration(attr(element, "duration"))) !== null && _parseDuration2 !== void 0 ? _parseDuration2 : next !== null && next !== void 0 ? next - start : mpdDuration !== null ? mpdDuration - start : null
|
|
273
453
|
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
let steering;
|
|
297
|
-
const steeringElement = children(mpd, "ContentSteering")[0];
|
|
298
|
-
if (steeringElement !== void 0) {
|
|
299
|
-
var _steeringElement$text, _steeringElement$text2;
|
|
300
|
-
const serverUri = (_steeringElement$text = (_steeringElement$text2 = steeringElement.textContent) === null || _steeringElement$text2 === void 0 ? void 0 : _steeringElement$text2.trim()) !== null && _steeringElement$text !== void 0 ? _steeringElement$text : "";
|
|
301
|
-
if (serverUri !== "") {
|
|
302
|
-
const bases = {};
|
|
303
|
-
for (const base of children(mpd, "BaseURL")) {
|
|
304
|
-
var _base$textContent;
|
|
305
|
-
const location = attr(base, "serviceLocation");
|
|
306
|
-
const text = (_base$textContent = base.textContent) === null || _base$textContent === void 0 ? void 0 : _base$textContent.trim();
|
|
307
|
-
if (location !== null && text !== void 0 && text !== "") bases[location] = resolveUrl(text, baseUrl);
|
|
308
|
-
}
|
|
309
|
-
steering = _objectSpread2(_objectSpread2({ serverUri: resolveUrl(serverUri, baseUrl) }, attr(steeringElement, "defaultServiceLocation") !== null ? { defaultPathway: attr(steeringElement, "defaultServiceLocation") } : {}), Object.keys(bases).length > 0 ? { bases } : {});
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
const periodElement = children(mpd, "Period")[0];
|
|
313
|
-
if (periodElement === void 0) return {
|
|
314
|
-
presentation: null,
|
|
315
|
-
error: {
|
|
316
|
-
category: "manifest",
|
|
317
|
-
code: "MANIFEST_EMPTY",
|
|
318
|
-
fatal: true,
|
|
319
|
-
recoverable: false,
|
|
320
|
-
context: { reason: "MPD with no Period" }
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
const periodStart = (_parseDuration = parseDuration(attr(periodElement, "start"))) !== null && _parseDuration !== void 0 ? _parseDuration : 0;
|
|
324
|
-
const periodDuration = (_parseDuration2 = parseDuration(attr(periodElement, "duration"))) !== null && _parseDuration2 !== void 0 ? _parseDuration2 : mpdDuration !== null ? mpdDuration - periodStart : null;
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* The earlier periods an AdaptationSet continues: DASH-IF IOP period
|
|
458
|
+
* continuity and connectivity (ISO/IEC 23009-1 §5.3.2.4), whose value names
|
|
459
|
+
* the earlier Period's id.
|
|
460
|
+
*/
|
|
461
|
+
function followsOf(adaptationSet) {
|
|
462
|
+
return children(adaptationSet, "SupplementalProperty").filter((property) => {
|
|
463
|
+
var _attr17;
|
|
464
|
+
return /^urn:mpeg:dash:period-(continuity|connectivity):2015$/.test((_attr17 = attr(property, "schemeIdUri")) !== null && _attr17 !== void 0 ? _attr17 : "");
|
|
465
|
+
}).flatMap((property) => {
|
|
466
|
+
var _attr18;
|
|
467
|
+
return ((_attr18 = attr(property, "value")) !== null && _attr18 !== void 0 ? _attr18 : "").split(/[\s,]+/).filter((v) => v !== "");
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function parsePeriod(periodElement, span, index, mpdBase, isLive) {
|
|
471
|
+
var _attr27;
|
|
472
|
+
const matching = /* @__PURE__ */ new Map();
|
|
473
|
+
const periodStart = span.start;
|
|
474
|
+
const periodDuration = span.duration;
|
|
325
475
|
const periodBase = applyBaseUrl(periodElement, mpdBase);
|
|
326
476
|
const tracks = [];
|
|
327
477
|
const adaptationSets = children(periodElement, "AdaptationSet");
|
|
328
478
|
for (let asIndex = 0; asIndex < adaptationSets.length; asIndex += 1) {
|
|
329
|
-
var _roles$, _trackMime2;
|
|
479
|
+
var _roles$, _trackMime2, _children$6;
|
|
330
480
|
const adaptationSet = adaptationSets[asIndex];
|
|
331
481
|
const trick = isTrickMode(adaptationSet);
|
|
332
482
|
const asPlayoutRate = numberAttr(adaptationSet, "maxPlayoutRate");
|
|
@@ -340,19 +490,19 @@ function parse(text, baseUrl) {
|
|
|
340
490
|
const renditions = [];
|
|
341
491
|
let trackMime = null;
|
|
342
492
|
for (const representation of children(adaptationSet, "Representation")) {
|
|
343
|
-
var
|
|
493
|
+
var _ref2, _attr19, _trackMime, _parseFrameRate2, _numberAttr15, _attr25, _attr26;
|
|
344
494
|
const id = attr(representation, "id");
|
|
345
495
|
const bandwidth = numberAttr(representation, "bandwidth");
|
|
346
496
|
if (id === null || bandwidth === null) continue;
|
|
347
497
|
const repBase = applyBaseUrl(representation, asBase);
|
|
348
|
-
const mimeType = (
|
|
498
|
+
const mimeType = (_ref2 = (_attr19 = attr(representation, "mimeType")) !== null && _attr19 !== void 0 ? _attr19 : asMime) !== null && _ref2 !== void 0 ? _ref2 : "video/mp4";
|
|
349
499
|
trackMime = (_trackMime = trackMime) !== null && _trackMime !== void 0 ? _trackMime : mimeType;
|
|
350
500
|
const segmentBase = children(representation, "SegmentBase")[0];
|
|
351
501
|
if (segmentBase !== void 0) {
|
|
352
|
-
var
|
|
502
|
+
var _numberAttr14, _parseFrameRate, _attr20, _attr21;
|
|
353
503
|
const indexRange = parseByteRange(attr(segmentBase, "indexRange"));
|
|
354
504
|
if (indexRange === null) continue;
|
|
355
|
-
const baseTimescale = (
|
|
505
|
+
const baseTimescale = (_numberAttr14 = numberAttr(segmentBase, "timescale")) !== null && _numberAttr14 !== void 0 ? _numberAttr14 : 1;
|
|
356
506
|
const pto = numberAttr(segmentBase, "presentationTimeOffset");
|
|
357
507
|
const initElement = children(segmentBase, "Initialization")[0];
|
|
358
508
|
const initRange = initElement !== void 0 ? parseByteRange(attr(initElement, "range")) : null;
|
|
@@ -369,13 +519,31 @@ function parse(text, baseUrl) {
|
|
|
369
519
|
const w = numberAttr(representation, "width");
|
|
370
520
|
const h = numberAttr(representation, "height");
|
|
371
521
|
const fr = (_parseFrameRate = parseFrameRate(attr(representation, "frameRate"))) !== null && _parseFrameRate !== void 0 ? _parseFrameRate : parseFrameRate(attr(adaptationSet, "frameRate"));
|
|
372
|
-
renditions.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
522
|
+
renditions.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
373
523
|
id,
|
|
374
524
|
bitrate: bandwidth,
|
|
375
|
-
codecs: (
|
|
525
|
+
codecs: (_attr20 = attr(representation, "codecs")) !== null && _attr20 !== void 0 ? _attr20 : asCodecs,
|
|
376
526
|
mimeType,
|
|
377
527
|
segments: sidxSegments
|
|
378
|
-
}, sidxInit !== null ? { init: sidxInit } : {}), w !== null ? { width: w } : {}), h !== null ? { height: h } : {}), fr !== null ? { frameRate: fr } : {}));
|
|
528
|
+
}, sidxInit !== null ? { init: sidxInit } : {}), w !== null ? { width: w } : {}), h !== null ? { height: h } : {}), fr !== null ? { frameRate: fr } : {}), videoRangeOf(representation, adaptationSet, (_attr21 = attr(representation, "codecs")) !== null && _attr21 !== void 0 ? _attr21 : asCodecs)));
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
const list = segmentListOf([
|
|
532
|
+
periodElement,
|
|
533
|
+
adaptationSet,
|
|
534
|
+
representation
|
|
535
|
+
], repBase, periodStart, (timescale, offset) => periodDuration !== null ? Math.round(offset + periodDuration * timescale) : null);
|
|
536
|
+
if (list === "invalid") return { error: manifestError(`bad SegmentList in '${id}'`) };
|
|
537
|
+
if (list !== null) {
|
|
538
|
+
var _attr22, _attr23;
|
|
539
|
+
const segments = list.segments.map((segment) => segment.duration === 0 && periodDuration !== null ? _objectSpread2(_objectSpread2({}, segment), {}, { duration: periodDuration }) : segment);
|
|
540
|
+
renditions.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
541
|
+
id,
|
|
542
|
+
bitrate: bandwidth,
|
|
543
|
+
codecs: (_attr22 = attr(representation, "codecs")) !== null && _attr22 !== void 0 ? _attr22 : asCodecs,
|
|
544
|
+
mimeType,
|
|
545
|
+
segments
|
|
546
|
+
}, list.init !== null ? { init: list.init } : {}), numberAttr(representation, "width") !== null ? { width: numberAttr(representation, "width") } : {}), numberAttr(representation, "height") !== null ? { height: numberAttr(representation, "height") } : {}), videoRangeOf(representation, adaptationSet, (_attr23 = attr(representation, "codecs")) !== null && _attr23 !== void 0 ? _attr23 : asCodecs)));
|
|
379
547
|
continue;
|
|
380
548
|
}
|
|
381
549
|
const template = mergeTemplates([
|
|
@@ -385,11 +553,11 @@ function parse(text, baseUrl) {
|
|
|
385
553
|
]);
|
|
386
554
|
if (template === null || template.media === null) {
|
|
387
555
|
if (contentTypeOf(adaptationSet, mimeType) === "text" && periodDuration !== null) {
|
|
388
|
-
var
|
|
556
|
+
var _attr24;
|
|
389
557
|
renditions.push({
|
|
390
558
|
id,
|
|
391
559
|
bitrate: bandwidth,
|
|
392
|
-
codecs: (
|
|
560
|
+
codecs: (_attr24 = attr(representation, "codecs")) !== null && _attr24 !== void 0 ? _attr24 : asCodecs,
|
|
393
561
|
mimeType,
|
|
394
562
|
segments: [{
|
|
395
563
|
seq: 0,
|
|
@@ -403,17 +571,11 @@ function parse(text, baseUrl) {
|
|
|
403
571
|
}
|
|
404
572
|
const periodEndUnits = periodDuration !== null ? Math.round(template.presentationTimeOffset + periodDuration * template.timescale) : null;
|
|
405
573
|
const timeline = template.timelineElement !== null ? parseTimeline(template.timelineElement, periodEndUnits) : null;
|
|
406
|
-
if (template.timelineElement !== null && timeline === null) return {
|
|
407
|
-
presentation: null,
|
|
408
|
-
error: manifestError(`bad SegmentTimeline in '${id}'`)
|
|
409
|
-
};
|
|
574
|
+
if (template.timelineElement !== null && timeline === null) return { error: manifestError(`bad SegmentTimeline in '${id}'`) };
|
|
410
575
|
let endSeq = null;
|
|
411
576
|
if (timeline !== null) endSeq = template.startNumber - 1 + timeline.reduce((sum, run) => sum + run.count, 0);
|
|
412
577
|
else if (template.duration !== null && periodDuration !== null) endSeq = template.startNumber - 1 + Math.ceil(periodDuration * template.timescale / template.duration);
|
|
413
|
-
else if (template.duration === null) return {
|
|
414
|
-
presentation: null,
|
|
415
|
-
error: manifestError(`no addressing for '${id}'`)
|
|
416
|
-
};
|
|
578
|
+
else if (template.duration === null) return { error: manifestError(`no addressing for '${id}'`) };
|
|
417
579
|
const segments = _objectSpread2({
|
|
418
580
|
kind: "indexed",
|
|
419
581
|
urlTemplate: resolveUrl(substituteIdentity(template.media, id, bandwidth), repBase),
|
|
@@ -428,28 +590,149 @@ function parse(text, baseUrl) {
|
|
|
428
590
|
const width = numberAttr(representation, "width");
|
|
429
591
|
const height = numberAttr(representation, "height");
|
|
430
592
|
const tiles = tileGridOf(representation, adaptationSet, width, height);
|
|
431
|
-
const playoutRate = trick ? (
|
|
432
|
-
renditions.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
593
|
+
const playoutRate = trick ? (_numberAttr15 = numberAttr(representation, "maxPlayoutRate")) !== null && _numberAttr15 !== void 0 ? _numberAttr15 : asPlayoutRate : null;
|
|
594
|
+
renditions.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
433
595
|
id,
|
|
434
596
|
bitrate: bandwidth,
|
|
435
|
-
codecs: (
|
|
597
|
+
codecs: (_attr25 = attr(representation, "codecs")) !== null && _attr25 !== void 0 ? _attr25 : asCodecs,
|
|
436
598
|
mimeType,
|
|
437
599
|
segments
|
|
438
|
-
}, init !== null ? { init } : {}), width !== null ? { width } : {}), height !== null ? { height } : {}), frameRate !== null ? { frameRate } : {}), tiles !== null ? { tiles } : {}), playoutRate !== null ? { maxPlayoutRate: playoutRate } : {}));
|
|
600
|
+
}, init !== null ? { init } : {}), width !== null ? { width } : {}), height !== null ? { height } : {}), frameRate !== null ? { frameRate } : {}), videoRangeOf(representation, adaptationSet, (_attr26 = attr(representation, "codecs")) !== null && _attr26 !== void 0 ? _attr26 : asCodecs)), tiles !== null ? { tiles } : {}), playoutRate !== null ? { maxPlayoutRate: playoutRate } : {}));
|
|
439
601
|
}
|
|
440
602
|
if (renditions.length === 0) continue;
|
|
441
603
|
const mimeType = (_trackMime2 = trackMime) !== null && _trackMime2 !== void 0 ? _trackMime2 : "video/mp4";
|
|
442
604
|
const contentType = contentTypeOf(adaptationSet, mimeType);
|
|
443
605
|
const characteristics = contentType === "audio" ? audioCharacteristics(adaptationSet) : [];
|
|
444
606
|
const forced = contentType === "text" && (roles.includes("forced-subtitle") || roles.includes("forced_subtitle"));
|
|
445
|
-
|
|
446
|
-
|
|
607
|
+
const label = (_children$6 = children(adaptationSet, "Label")[0]) === null || _children$6 === void 0 || (_children$6 = _children$6.textContent) === null || _children$6 === void 0 ? void 0 : _children$6.trim();
|
|
608
|
+
const trackId = attr(adaptationSet, "id") !== null ? `as-${attr(adaptationSet, "id")}` : `as-i${asIndex}`;
|
|
609
|
+
matching.set(trackId, {
|
|
610
|
+
asId: attr(adaptationSet, "id"),
|
|
611
|
+
follows: followsOf(adaptationSet)
|
|
612
|
+
});
|
|
613
|
+
tracks.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
614
|
+
id: trackId,
|
|
447
615
|
contentType,
|
|
448
|
-
mimeType
|
|
616
|
+
mimeType
|
|
617
|
+
}, label !== void 0 && label !== "" ? { name: label } : {}), {}, {
|
|
449
618
|
protection: protectionSchemes.length > 0 ? { schemes: protectionSchemes } : null,
|
|
450
619
|
renditions
|
|
451
620
|
}, lang !== null ? { lang } : {}), role !== null ? { role } : {}), roles.length > 0 ? { roles } : {}), characteristics.length > 0 ? { characteristics } : {}), forced ? { forced: true } : {}));
|
|
452
621
|
}
|
|
622
|
+
const hasVideo = tracks.some((t) => t.contentType === "video");
|
|
623
|
+
for (const adaptationSet of hasVideo ? adaptationSets : []) {
|
|
624
|
+
const channels = [...captionChannels(adaptationSet).map(([channel, lang]) => [
|
|
625
|
+
"608",
|
|
626
|
+
channel,
|
|
627
|
+
lang
|
|
628
|
+
]), ...captionServices(adaptationSet).map(([service, lang]) => [
|
|
629
|
+
"708",
|
|
630
|
+
service,
|
|
631
|
+
lang
|
|
632
|
+
])];
|
|
633
|
+
for (const [format, instreamId, lang] of channels) {
|
|
634
|
+
const id = `cea${format}:${instreamId}`;
|
|
635
|
+
if (format === "608" && !/^CC[1-4]$/.test(instreamId)) continue;
|
|
636
|
+
if (tracks.some((t) => t.id === id)) continue;
|
|
637
|
+
tracks.push(_objectSpread2(_objectSpread2({
|
|
638
|
+
id,
|
|
639
|
+
contentType: "text",
|
|
640
|
+
mimeType: `application/cea-${format}`,
|
|
641
|
+
protection: null
|
|
642
|
+
}, lang !== null ? { lang } : {}), {}, {
|
|
643
|
+
role: "caption",
|
|
644
|
+
instreamId,
|
|
645
|
+
renditions: []
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const events = eventsOf(periodElement, periodStart);
|
|
650
|
+
return {
|
|
651
|
+
id: (_attr27 = attr(periodElement, "id")) !== null && _attr27 !== void 0 ? _attr27 : `p${index}`,
|
|
652
|
+
start: periodStart,
|
|
653
|
+
duration: periodDuration,
|
|
654
|
+
tracks,
|
|
655
|
+
events,
|
|
656
|
+
matching
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
/** parse an MPD document into a Presentation. Never throws. */
|
|
660
|
+
function parse(text, baseUrl) {
|
|
661
|
+
var _flat$tracks, _flat$events;
|
|
662
|
+
let doc;
|
|
663
|
+
try {
|
|
664
|
+
doc = new DOMParser().parseFromString(text, "text/xml");
|
|
665
|
+
} catch (cause) {
|
|
666
|
+
return {
|
|
667
|
+
presentation: null,
|
|
668
|
+
error: _objectSpread2(_objectSpread2({}, manifestError("unparsable XML")), {}, { cause })
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
const mpd = doc.documentElement;
|
|
672
|
+
if (mpd === null || mpd.localName !== "MPD" || doc.getElementsByTagName("parsererror").length > 0) return {
|
|
673
|
+
presentation: null,
|
|
674
|
+
error: manifestError("not an MPD document")
|
|
675
|
+
};
|
|
676
|
+
const isLive = attr(mpd, "type") === "dynamic";
|
|
677
|
+
const mpdDuration = parseDuration(attr(mpd, "mediaPresentationDuration"));
|
|
678
|
+
const mpdBase = applyBaseUrl(mpd, baseUrl);
|
|
679
|
+
let live;
|
|
680
|
+
if (isLive) {
|
|
681
|
+
var _attr28, _attr29, _attr30;
|
|
682
|
+
const availabilityStart = Date.parse((_attr28 = attr(mpd, "availabilityStartTime")) !== null && _attr28 !== void 0 ? _attr28 : "");
|
|
683
|
+
const updatePeriod = parseDuration(attr(mpd, "minimumUpdatePeriod"));
|
|
684
|
+
const timeShiftDepth = parseDuration(attr(mpd, "timeShiftBufferDepth"));
|
|
685
|
+
const holdBack = parseDuration(attr(mpd, "suggestedPresentationDelay"));
|
|
686
|
+
const timing = children(mpd, "UTCTiming")[0];
|
|
687
|
+
live = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, Number.isFinite(availabilityStart) ? { availabilityStart: availabilityStart / 1e3 } : {}), updatePeriod !== null ? { updatePeriod } : {}), timeShiftDepth !== null ? { timeShiftDepth } : {}), holdBack !== null ? { holdBack } : {}), timing !== void 0 ? { timeServer: {
|
|
688
|
+
scheme: (_attr29 = attr(timing, "schemeIdUri")) !== null && _attr29 !== void 0 ? _attr29 : "",
|
|
689
|
+
value: (_attr30 = attr(timing, "value")) !== null && _attr30 !== void 0 ? _attr30 : ""
|
|
690
|
+
} } : {});
|
|
691
|
+
}
|
|
692
|
+
let steering;
|
|
693
|
+
const steeringElement = children(mpd, "ContentSteering")[0];
|
|
694
|
+
if (steeringElement !== void 0) {
|
|
695
|
+
var _steeringElement$text, _steeringElement$text2;
|
|
696
|
+
const serverUri = (_steeringElement$text = (_steeringElement$text2 = steeringElement.textContent) === null || _steeringElement$text2 === void 0 ? void 0 : _steeringElement$text2.trim()) !== null && _steeringElement$text !== void 0 ? _steeringElement$text : "";
|
|
697
|
+
if (serverUri !== "") {
|
|
698
|
+
const bases = {};
|
|
699
|
+
for (const base of children(mpd, "BaseURL")) {
|
|
700
|
+
var _base$textContent;
|
|
701
|
+
const location = attr(base, "serviceLocation");
|
|
702
|
+
const text = (_base$textContent = base.textContent) === null || _base$textContent === void 0 ? void 0 : _base$textContent.trim();
|
|
703
|
+
if (location !== null && text !== void 0 && text !== "") bases[location] = resolveUrl(text, baseUrl);
|
|
704
|
+
}
|
|
705
|
+
steering = _objectSpread2(_objectSpread2({ serverUri: resolveUrl(serverUri, baseUrl) }, attr(steeringElement, "defaultServiceLocation") !== null ? { defaultPathway: attr(steeringElement, "defaultServiceLocation") } : {}), Object.keys(bases).length > 0 ? { bases } : {});
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const periodElements = children(mpd, "Period");
|
|
709
|
+
if (periodElements.length === 0) return {
|
|
710
|
+
presentation: null,
|
|
711
|
+
error: {
|
|
712
|
+
category: "manifest",
|
|
713
|
+
code: "MANIFEST_EMPTY",
|
|
714
|
+
fatal: true,
|
|
715
|
+
recoverable: false,
|
|
716
|
+
context: { reason: "MPD with no Period" }
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
const spans = periodSpans(periodElements, mpdDuration);
|
|
720
|
+
const parsed = [];
|
|
721
|
+
for (let i = 0; i < periodElements.length; i += 1) {
|
|
722
|
+
if (i > 0 && isLive) break;
|
|
723
|
+
const result = parsePeriod(periodElements[i], spans[i], i, mpdBase, isLive);
|
|
724
|
+
if ("error" in result) return {
|
|
725
|
+
presentation: null,
|
|
726
|
+
error: result.error
|
|
727
|
+
};
|
|
728
|
+
parsed.push(result);
|
|
729
|
+
}
|
|
730
|
+
const flat = parsed.length > 1 ? flattenPeriods(parsed) : null;
|
|
731
|
+
const first = parsed[0];
|
|
732
|
+
const tracks = (_flat$tracks = flat === null || flat === void 0 ? void 0 : flat.tracks) !== null && _flat$tracks !== void 0 ? _flat$tracks : first.tracks;
|
|
733
|
+
const events = (_flat$events = flat === null || flat === void 0 ? void 0 : flat.events) !== null && _flat$events !== void 0 ? _flat$events : first.events;
|
|
734
|
+
const lastSpan = flat === null ? first : parsed[parsed.length - 1];
|
|
735
|
+
const total = flat === null ? first.duration : lastSpan.duration === null ? null : lastSpan.start + lastSpan.duration - first.start;
|
|
453
736
|
if (tracks.length === 0) return {
|
|
454
737
|
presentation: null,
|
|
455
738
|
error: {
|
|
@@ -460,19 +743,19 @@ function parse(text, baseUrl) {
|
|
|
460
743
|
context: { reason: "no playable adaptation set" }
|
|
461
744
|
}
|
|
462
745
|
};
|
|
463
|
-
return {
|
|
746
|
+
return _objectSpread2({
|
|
464
747
|
presentation: _objectSpread2(_objectSpread2(_objectSpread2({
|
|
465
748
|
id: baseUrl,
|
|
466
749
|
isLive
|
|
467
750
|
}, mpdDuration !== null ? { duration: mpdDuration } : {}), {}, {
|
|
468
751
|
periods: [_objectSpread2(_objectSpread2({
|
|
469
|
-
id:
|
|
470
|
-
start:
|
|
471
|
-
},
|
|
752
|
+
id: first.id,
|
|
753
|
+
start: first.start
|
|
754
|
+
}, total !== null ? { duration: total } : {}), {}, { tracks }, events.length > 0 ? { events } : {})],
|
|
472
755
|
couplings: []
|
|
473
756
|
}, live !== void 0 ? { live } : {}), steering !== void 0 ? { steering } : {}),
|
|
474
757
|
error: null
|
|
475
|
-
};
|
|
758
|
+
}, flat !== null && flat.warnings.length > 0 ? { warnings: flat.warnings } : {});
|
|
476
759
|
}
|
|
477
760
|
/**
|
|
478
761
|
* Turns a fetched sidx box into explicit byte-range segments. The first media
|