mattebox 0.10.0 → 0.12.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 +63 -27
- 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 +47 -6
- package/dist/es2015/kernel/prepare.js +2 -2
- package/dist/es2015/kernel/reducer.js +83 -26
- package/dist/es2015/kernel/refresh.js +2 -2
- package/dist/es2015/kernel/rendition-select.js +91 -16
- 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 +6 -3
- 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 +421 -121
- 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 +161 -39
- 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 +18 -7
- 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 +7 -5
- 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 +31 -7
- package/dist/es2015/stages/eme-fairplay/index.js +18 -9
- 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 +57 -6
- package/dist/es2015/stages/text-cea608/index.js +26 -93
- package/dist/es2015/stages/text-cea708/decode.js +379 -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 +30 -65
- 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 +62 -19
- 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 +47 -3
- package/dist/kernel/mse.js.map +1 -1
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +88 -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 +29 -1
- package/dist/kernel/rendition-select.d.ts.map +1 -1
- package/dist/kernel/rendition-select.js +99 -21
- 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 +2 -2
- package/dist/kernel/track-registry.d.ts.map +1 -1
- package/dist/kernel/track-registry.js +5 -3
- 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 +430 -94
- 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 +208 -24
- 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 +24 -8
- package/dist/stages/abr/index.js.map +1 -1
- package/dist/stages/alt-audio/index.d.ts +3 -1
- package/dist/stages/alt-audio/index.d.ts.map +1 -1
- package/dist/stages/alt-audio/index.js +8 -5
- 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 +14 -0
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +38 -5
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/eme-fairplay/index.d.ts +5 -0
- package/dist/stages/eme-fairplay/index.d.ts.map +1 -1
- package/dist/stages/eme-fairplay/index.js +17 -6
- package/dist/stages/eme-fairplay/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 +59 -6
- package/dist/stages/text-cea608/decode.js.map +1 -1
- package/dist/stages/text-cea608/index.d.ts +9 -9
- package/dist/stages/text-cea608/index.d.ts.map +1 -1
- package/dist/stages/text-cea608/index.js +31 -105
- 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 +410 -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 -13
- package/dist/stages/text-webvtt/index.d.ts.map +1 -1
- package/dist/stages/text-webvtt/index.js +21 -68
- 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 +8 -10
- package/dist/types/facade.d.ts.map +1 -1
- package/dist/types/ir.d.ts +90 -0
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +8 -0
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/messages.d.ts +10 -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 +10 -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,5 +1,5 @@
|
|
|
1
1
|
import toPropertyKey from "./toPropertyKey.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/defineProperty.js
|
|
3
3
|
function _defineProperty(e, r, t) {
|
|
4
4
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
5
|
value: t,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "./defineProperty.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/objectSpread2.js
|
|
3
3
|
function ownKeys(e, r) {
|
|
4
4
|
var t = Object.keys(e);
|
|
5
5
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/objectWithoutProperties.js
|
|
3
3
|
function _objectWithoutProperties(e, t) {
|
|
4
4
|
if (null == e) return {};
|
|
5
5
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPrimitive.js
|
|
3
3
|
function toPrimitive(t, r) {
|
|
4
4
|
if ("object" != _typeof(t) || !t) return t;
|
|
5
5
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _typeof from "./typeof.js";
|
|
2
2
|
import toPrimitive from "./toPrimitive.js";
|
|
3
|
-
//#region \0@oxc-project+runtime@0.
|
|
3
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPropertyKey.js
|
|
4
4
|
function toPropertyKey(t) {
|
|
5
5
|
var i = toPrimitive(t, "string");
|
|
6
6
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/typeof.js
|
|
2
2
|
function _typeof(o) {
|
|
3
3
|
"@babel/helpers - typeof";
|
|
4
4
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
//#region src/containers/captions.ts
|
|
2
|
-
|
|
2
|
+
const consumers = /* @__PURE__ */ new Set();
|
|
3
3
|
let lastFingerprint = "";
|
|
4
|
-
/** Registers
|
|
4
|
+
/** Registers a caption decoder. Returns an unregister for stage teardown. */
|
|
5
5
|
function registerCaptionConsumer(fn) {
|
|
6
|
-
|
|
6
|
+
consumers.add(fn);
|
|
7
7
|
lastFingerprint = "";
|
|
8
8
|
return () => {
|
|
9
|
-
|
|
9
|
+
consumers.delete(fn);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
/** True when a caption stage is loaded, so a SEI source should extract. */
|
|
13
13
|
function captionsWanted() {
|
|
14
|
-
return
|
|
14
|
+
return consumers.size > 0;
|
|
15
15
|
}
|
|
16
16
|
function fingerprint(packets) {
|
|
17
17
|
var _first$triples$, _last$triples$;
|
|
@@ -20,17 +20,17 @@ function fingerprint(packets) {
|
|
|
20
20
|
return `${packets.length}:${first === null || first === void 0 ? void 0 : first.time}:${first === null || first === void 0 || (_first$triples$ = first.triples[0]) === null || _first$triples$ === void 0 ? void 0 : _first$triples$.a}:${last === null || last === void 0 ? void 0 : last.time}:${last === null || last === void 0 || (_last$triples$ = last.triples[0]) === null || _last$triples$ === void 0 ? void 0 : _last$triples$.b}`;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Hands extracted caption packets to
|
|
23
|
+
* Hands extracted caption packets to every registered decoder. When both a
|
|
24
24
|
* ts-transmux and a nal-scan source are composed they extract the same SEI
|
|
25
25
|
* from the same segment back to back; an identical batch arriving twice in a
|
|
26
26
|
* row is dropped so the decoder never sees a caption doubled.
|
|
27
27
|
*/
|
|
28
28
|
function deliverCaptions(packets) {
|
|
29
|
-
if (packets.length === 0 ||
|
|
29
|
+
if (packets.length === 0 || consumers.size === 0) return;
|
|
30
30
|
const print = fingerprint(packets);
|
|
31
31
|
if (print === lastFingerprint) return;
|
|
32
32
|
lastFingerprint = print;
|
|
33
|
-
consumer(packets);
|
|
33
|
+
for (const consumer of consumers) consumer(packets);
|
|
34
34
|
}
|
|
35
35
|
//#endregion
|
|
36
36
|
export { captionsWanted, deliverCaptions, registerCaptionConsumer };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { typeString } from "../../kernel/mime.js";
|
|
2
2
|
import { findBoxes, fourcc, fullBox, sampleEntries, viewOf, walkBoxes } from "../mp4-box/index.js";
|
|
3
|
+
import { byteToHex } from "../../kernel/base64.js";
|
|
3
4
|
//#region src/containers/codec-probe/index.ts
|
|
4
5
|
/**
|
|
5
6
|
* Derives the exact codecs= string from an init segment's moov. Manifests
|
|
@@ -24,9 +25,6 @@ const AUDIO_FORMATS = /* @__PURE__ */ new Set([
|
|
|
24
25
|
]);
|
|
25
26
|
/** AudioSampleEntry fixed part (8 + 20 bytes) before its codec config child boxes. */
|
|
26
27
|
const AUDIO_ENTRY_HEADER = 28;
|
|
27
|
-
function hex(byte) {
|
|
28
|
-
return byte.toString(16).padStart(2, "0");
|
|
29
|
-
}
|
|
30
28
|
function childBox(entry, fixedOffset, type) {
|
|
31
29
|
for (const offset of [fixedOffset, fixedOffset + 16]) {
|
|
32
30
|
let at = offset;
|
|
@@ -44,7 +42,7 @@ function childBox(entry, fixedOffset, type) {
|
|
|
44
42
|
function avcCodec(format, entry) {
|
|
45
43
|
const config = childBox(entry, 78, "avcC");
|
|
46
44
|
if (config === null || config.byteLength < 4) return null;
|
|
47
|
-
return `${format}.${
|
|
45
|
+
return `${format}.${byteToHex(config[1])}${byteToHex(config[2])}${byteToHex(config[3])}`;
|
|
48
46
|
}
|
|
49
47
|
/** hvcC -> the full hvc1/hev1 form. ISO 14496-15 annex E. */
|
|
50
48
|
function hevcCodec(format, entry) {
|
|
@@ -101,7 +99,7 @@ function aacCodec(entry) {
|
|
|
101
99
|
const objectType = decoderConfig[0];
|
|
102
100
|
const specific = descriptor(decoderConfig.subarray(13), 5);
|
|
103
101
|
if (objectType === 64 && specific !== null && specific.byteLength >= 1) return `mp4a.40.${specific[0] >> 3 & 31}`;
|
|
104
|
-
return `mp4a.${
|
|
102
|
+
return `mp4a.${byteToHex(objectType)}`;
|
|
105
103
|
}
|
|
106
104
|
/** vpcC -> vp09.PP.LL.DD. VP9-in-ISOBMFF binding. */
|
|
107
105
|
function vp9Codec(entry) {
|
|
@@ -207,5 +205,106 @@ function reconcileCodecs(manifestContentType, probe) {
|
|
|
207
205
|
mismatch: normalize(manifestContentType) !== normalize(probe.mimeType)
|
|
208
206
|
};
|
|
209
207
|
}
|
|
208
|
+
/** Splits an RFC 6381 codec string into the parts a mismatch is judged on. */
|
|
209
|
+
function codecParts(codec) {
|
|
210
|
+
const [fourcc = "", ...rest] = codec.trim().toLowerCase().split(".");
|
|
211
|
+
switch (fourcc) {
|
|
212
|
+
case "avc1":
|
|
213
|
+
case "avc3":
|
|
214
|
+
var _rest$;
|
|
215
|
+
return {
|
|
216
|
+
kind: "video",
|
|
217
|
+
family: "avc",
|
|
218
|
+
profile: ((_rest$ = rest[0]) !== null && _rest$ !== void 0 ? _rest$ : "").slice(0, 2)
|
|
219
|
+
};
|
|
220
|
+
case "hvc1":
|
|
221
|
+
case "hev1":
|
|
222
|
+
var _rest$2;
|
|
223
|
+
return {
|
|
224
|
+
kind: "video",
|
|
225
|
+
family: "hevc",
|
|
226
|
+
profile: (_rest$2 = rest[0]) !== null && _rest$2 !== void 0 ? _rest$2 : ""
|
|
227
|
+
};
|
|
228
|
+
case "vp09":
|
|
229
|
+
var _rest$3, _rest$4;
|
|
230
|
+
return {
|
|
231
|
+
kind: "video",
|
|
232
|
+
family: "vp9",
|
|
233
|
+
profile: `${(_rest$3 = rest[0]) !== null && _rest$3 !== void 0 ? _rest$3 : ""}.${(_rest$4 = rest[2]) !== null && _rest$4 !== void 0 ? _rest$4 : ""}`
|
|
234
|
+
};
|
|
235
|
+
case "av01":
|
|
236
|
+
var _rest$5, _rest$6;
|
|
237
|
+
return {
|
|
238
|
+
kind: "video",
|
|
239
|
+
family: "av1",
|
|
240
|
+
profile: `${(_rest$5 = rest[0]) !== null && _rest$5 !== void 0 ? _rest$5 : ""}.${(_rest$6 = rest[2]) !== null && _rest$6 !== void 0 ? _rest$6 : ""}`
|
|
241
|
+
};
|
|
242
|
+
case "mp4a": {
|
|
243
|
+
var _rest$7, _rest$8;
|
|
244
|
+
const oti = (_rest$7 = rest[0]) !== null && _rest$7 !== void 0 ? _rest$7 : "";
|
|
245
|
+
if (oti === "a5") return {
|
|
246
|
+
kind: "audio",
|
|
247
|
+
family: "ac-3",
|
|
248
|
+
profile: ""
|
|
249
|
+
};
|
|
250
|
+
if (oti === "a6") return {
|
|
251
|
+
kind: "audio",
|
|
252
|
+
family: "ec-3",
|
|
253
|
+
profile: ""
|
|
254
|
+
};
|
|
255
|
+
if (oti === "69" || oti === "6b") return {
|
|
256
|
+
kind: "audio",
|
|
257
|
+
family: "mp3",
|
|
258
|
+
profile: ""
|
|
259
|
+
};
|
|
260
|
+
return {
|
|
261
|
+
kind: "audio",
|
|
262
|
+
family: `mp4a.${oti}`,
|
|
263
|
+
profile: (_rest$8 = rest[1]) !== null && _rest$8 !== void 0 ? _rest$8 : ""
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
case "ac-3":
|
|
267
|
+
case "ec-3":
|
|
268
|
+
case "opus":
|
|
269
|
+
case "flac": return {
|
|
270
|
+
kind: "audio",
|
|
271
|
+
family: fourcc,
|
|
272
|
+
profile: ""
|
|
273
|
+
};
|
|
274
|
+
default: return null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The first codec the init segment holds that the manifest declared as
|
|
279
|
+
* another codec or another profile, matched by kind: video against video,
|
|
280
|
+
* audio against audio. A level-only difference is no mismatch: browsers
|
|
281
|
+
* decode a stream whose declared level is off. A kind the manifest did not
|
|
282
|
+
* declare, or a codec this does not recognize, is left alone.
|
|
283
|
+
*/
|
|
284
|
+
function codecMismatch(declared, probed) {
|
|
285
|
+
const declaredCodecs = declared.split(",").map((codec) => codec.trim()).filter((codec) => codec !== "");
|
|
286
|
+
for (const probedCodec of probed) {
|
|
287
|
+
const actual = codecParts(probedCodec);
|
|
288
|
+
if (actual === null) continue;
|
|
289
|
+
const sameKind = declaredCodecs.filter((codec) => {
|
|
290
|
+
var _codecParts;
|
|
291
|
+
return ((_codecParts = codecParts(codec)) === null || _codecParts === void 0 ? void 0 : _codecParts.kind) === actual.kind;
|
|
292
|
+
});
|
|
293
|
+
if (sameKind.length === 0) continue;
|
|
294
|
+
const parts = sameKind.map((codec) => codecParts(codec));
|
|
295
|
+
if (!parts.some((p) => p.family === actual.family)) return {
|
|
296
|
+
kind: "family",
|
|
297
|
+
declared: sameKind[0],
|
|
298
|
+
probed: probedCodec
|
|
299
|
+
};
|
|
300
|
+
const index = parts.findIndex((p) => p.family === actual.family);
|
|
301
|
+
if (!parts.some((p) => p.family === actual.family && p.profile === actual.profile)) return {
|
|
302
|
+
kind: "profile",
|
|
303
|
+
declared: sameKind[index],
|
|
304
|
+
probed: probedCodec
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
210
309
|
//#endregion
|
|
211
|
-
export { probeInitSegment, reconcileCodecs };
|
|
310
|
+
export { codecMismatch, probeInitSegment, reconcileCodecs };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { fourcc, viewOf } from "./mp4-box/index.js";
|
|
2
|
+
//#region src/containers/emsg.ts
|
|
3
|
+
/**
|
|
4
|
+
* The DASH event message box (ISO/IEC 23009-1 §5.10.3.3), read from the top
|
|
5
|
+
* level of a media segment, where it sits before the moof. Version 0 times an
|
|
6
|
+
* event from the segment's earliest presentation time; version 1 places it
|
|
7
|
+
* on the track's media timeline, the same clock as tfdt.
|
|
8
|
+
*/
|
|
9
|
+
/** A null-terminated UTF-8 string at `at`, and the offset after its null. */
|
|
10
|
+
function cString(bytes, at) {
|
|
11
|
+
const end = bytes.indexOf(0, at);
|
|
12
|
+
if (end < 0) return null;
|
|
13
|
+
return [new TextDecoder().decode(bytes.subarray(at, end)), end + 1];
|
|
14
|
+
}
|
|
15
|
+
function parseEmsg(payload) {
|
|
16
|
+
if (payload.byteLength < 4) return null;
|
|
17
|
+
const view = viewOf(payload);
|
|
18
|
+
const version = payload[0];
|
|
19
|
+
let cursor = 4;
|
|
20
|
+
if (version === 0) {
|
|
21
|
+
const scheme = cString(payload, cursor);
|
|
22
|
+
if (scheme === null) return null;
|
|
23
|
+
const value = cString(payload, scheme[1]);
|
|
24
|
+
if (value === null || value[1] + 16 > payload.byteLength) return null;
|
|
25
|
+
cursor = value[1];
|
|
26
|
+
const duration = view.getUint32(cursor + 8);
|
|
27
|
+
return {
|
|
28
|
+
version,
|
|
29
|
+
scheme: scheme[0],
|
|
30
|
+
value: value[0],
|
|
31
|
+
timescale: view.getUint32(cursor),
|
|
32
|
+
time: view.getUint32(cursor + 4),
|
|
33
|
+
duration: duration === 4294967295 ? null : duration,
|
|
34
|
+
id: view.getUint32(cursor + 12),
|
|
35
|
+
data: payload.subarray(cursor + 16)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (version !== 1 || payload.byteLength < cursor + 20) return null;
|
|
39
|
+
const timescale = view.getUint32(cursor);
|
|
40
|
+
const time = view.getUint32(cursor + 4) * Math.pow(2, 32) + view.getUint32(cursor + 8);
|
|
41
|
+
const duration = view.getUint32(cursor + 12);
|
|
42
|
+
const id = view.getUint32(cursor + 16);
|
|
43
|
+
const scheme = cString(payload, cursor + 20);
|
|
44
|
+
if (scheme === null) return null;
|
|
45
|
+
const value = cString(payload, scheme[1]);
|
|
46
|
+
if (value === null) return null;
|
|
47
|
+
return {
|
|
48
|
+
version,
|
|
49
|
+
scheme: scheme[0],
|
|
50
|
+
value: value[0],
|
|
51
|
+
timescale,
|
|
52
|
+
time,
|
|
53
|
+
duration: duration === 4294967295 ? null : duration,
|
|
54
|
+
id,
|
|
55
|
+
data: payload.subarray(value[1])
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** The segment's top-level emsg boxes, up to its first moof. */
|
|
59
|
+
function readEmsg(segment) {
|
|
60
|
+
const out = [];
|
|
61
|
+
const view = viewOf(segment);
|
|
62
|
+
let offset = 0;
|
|
63
|
+
while (offset + 8 <= segment.byteLength) {
|
|
64
|
+
let size = view.getUint32(offset);
|
|
65
|
+
let header = 8;
|
|
66
|
+
if (size === 1 && offset + 16 <= segment.byteLength) {
|
|
67
|
+
size = view.getUint32(offset + 8) * Math.pow(2, 32) + view.getUint32(offset + 12);
|
|
68
|
+
header = 16;
|
|
69
|
+
} else if (size === 0) size = segment.byteLength - offset;
|
|
70
|
+
const type = fourcc(segment, offset + 4);
|
|
71
|
+
if (size < header || type === "moof" || type === "mdat") break;
|
|
72
|
+
if (type === "emsg") {
|
|
73
|
+
const box = parseEmsg(segment.subarray(offset + header, Math.min(offset + size, segment.byteLength)));
|
|
74
|
+
if (box !== null && box.timescale > 0) out.push(box);
|
|
75
|
+
}
|
|
76
|
+
offset += size;
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { readEmsg };
|
|
@@ -1,4 +1,4 @@
|
|
|
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 { fourcc } from "./mp4-box/index.js";
|
|
3
3
|
//#region src/containers/id3.ts
|
|
4
4
|
const HEADER_SIZE = 10;
|
|
@@ -48,7 +48,13 @@ function decodeTextFrame(frame) {
|
|
|
48
48
|
var _frame$data$;
|
|
49
49
|
const encoding = (_frame$data$ = frame.data[0]) !== null && _frame$data$ !== void 0 ? _frame$data$ : 0;
|
|
50
50
|
const body = frame.data.subarray(1);
|
|
51
|
-
|
|
51
|
+
const label = [
|
|
52
|
+
"latin1",
|
|
53
|
+
encoding === 2 || encoding === 1 && body[0] === 254 && body[1] === 255 ? "utf-16be" : "utf-16le",
|
|
54
|
+
"utf-16be",
|
|
55
|
+
"utf-8"
|
|
56
|
+
][encoding];
|
|
57
|
+
return new TextDecoder(label !== null && label !== void 0 ? label : "utf-8").decode(body).replace(/\0+$/, "");
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
54
60
|
* Turns an ID3 tag's frames into metadata cues at `presentationTime`. Text
|
|
@@ -58,15 +64,59 @@ function decodeTextFrame(frame) {
|
|
|
58
64
|
*/
|
|
59
65
|
function id3Cues(data, presentationTime, offset = 0) {
|
|
60
66
|
return parseId3Frames(data, offset).map((frame) => {
|
|
67
|
+
const text = frameText(frame);
|
|
61
68
|
return {
|
|
62
69
|
start: presentationTime,
|
|
63
70
|
end: presentationTime,
|
|
64
71
|
payload: _objectSpread2({
|
|
65
72
|
key: frame.id,
|
|
66
73
|
data: [...frame.data]
|
|
67
|
-
},
|
|
74
|
+
}, text !== void 0 ? text : {})
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A text frame's string: the T frames and WXXX. TXXX and WXXX hold a
|
|
80
|
+
* description, a null, then the value (ID3v2.4 §4.2.6, §4.3.2).
|
|
81
|
+
*/
|
|
82
|
+
function frameText(frame) {
|
|
83
|
+
if (!frame.id.startsWith("T") && frame.id !== "WXXX") return void 0;
|
|
84
|
+
const text = decodeTextFrame(frame).replace(/\uFEFF/g, "");
|
|
85
|
+
if (frame.id !== "TXXX" && frame.id !== "WXXX") return { value: text };
|
|
86
|
+
const split = text.indexOf("\0");
|
|
87
|
+
if (split < 0) return { value: text };
|
|
88
|
+
return {
|
|
89
|
+
value: text.slice(split + 1),
|
|
90
|
+
description: text.slice(0, split)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** An ID3 tag's frames as the page reads them: id, text when it is a text frame, bytes. */
|
|
94
|
+
function id3Frames(tag) {
|
|
95
|
+
return parseId3Frames(tag).map((frame) => _objectSpread2(_objectSpread2({ id: frame.id }, frameText(frame)), {}, { data: frame.data }));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* ID3 tags as timed-metadata records, one per tag. The id is the time in
|
|
99
|
+
* milliseconds and the tag's place among tags at that time, so a segment
|
|
100
|
+
* fetched again (a quality switch, a retry) yields the same ids.
|
|
101
|
+
*/
|
|
102
|
+
function id3Events(tags) {
|
|
103
|
+
const atTime = /* @__PURE__ */ new Map();
|
|
104
|
+
return tags.map(({ time, bytes }) => {
|
|
105
|
+
var _atTime$get;
|
|
106
|
+
const ms = Math.round(time * 1e3);
|
|
107
|
+
const index = (_atTime$get = atTime.get(ms)) !== null && _atTime$get !== void 0 ? _atTime$get : 0;
|
|
108
|
+
atTime.set(ms, index + 1);
|
|
109
|
+
return {
|
|
110
|
+
id: `id3@${ms}#${index}`,
|
|
111
|
+
source: "id3",
|
|
112
|
+
scheme: "id3",
|
|
113
|
+
start: time,
|
|
114
|
+
end: time,
|
|
115
|
+
attributes: {},
|
|
116
|
+
data: bytes,
|
|
117
|
+
frames: id3Frames(bytes)
|
|
68
118
|
};
|
|
69
119
|
});
|
|
70
120
|
}
|
|
71
121
|
//#endregion
|
|
72
|
-
export { id3Cues, id3TagLength, parseId3Frames };
|
|
122
|
+
export { id3Cues, id3Events, id3Frames, id3TagLength, parseId3Frames };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/containers/metadata.ts
|
|
2
|
+
let consumer = null;
|
|
3
|
+
/** Registers the metadata consumer. Returns an unregister for stage teardown. */
|
|
4
|
+
function registerMetadataConsumer(fn) {
|
|
5
|
+
consumer = fn;
|
|
6
|
+
return () => {
|
|
7
|
+
if (consumer === fn) consumer = null;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** True when a consumer is loaded, so a producer should extract. */
|
|
11
|
+
function metadataWanted() {
|
|
12
|
+
return consumer !== null;
|
|
13
|
+
}
|
|
14
|
+
/** Hands records to the consumer, if one is loaded. */
|
|
15
|
+
function deliverMetadata(events) {
|
|
16
|
+
if (events.length === 0 || consumer === null) return;
|
|
17
|
+
consumer(events);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { deliverMetadata, metadataWanted, registerMetadataConsumer };
|
|
@@ -372,6 +372,32 @@ function fragmentSamples(data, defaults = /* @__PURE__ */ new Map()) {
|
|
|
372
372
|
return out;
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
|
+
* The samples of a cue segment in fMP4 (stpp, wvtt), each placed on the
|
|
376
|
+
* presentation timeline. The segment's first decode time lands at `start`,
|
|
377
|
+
* the segment's presentation start, as the kernel lands media segments. A
|
|
378
|
+
* track without a known timescale is skipped.
|
|
379
|
+
*/
|
|
380
|
+
function timedSamples(segment, timescales, start) {
|
|
381
|
+
const out = [];
|
|
382
|
+
for (const fragment of fragmentSamples(segment)) {
|
|
383
|
+
const scale = timescales === null || timescales === void 0 ? void 0 : timescales.get(fragment.trackId);
|
|
384
|
+
const first = fragment.samples[0];
|
|
385
|
+
if (scale === void 0 || first === void 0) continue;
|
|
386
|
+
const shift = start - first.decodeTime / scale;
|
|
387
|
+
for (const sample of fragment.samples) {
|
|
388
|
+
if (sample.offset + sample.size > segment.byteLength) continue;
|
|
389
|
+
const at = (sample.decodeTime + sample.cts) / scale + shift;
|
|
390
|
+
out.push({
|
|
391
|
+
bytes: segment.subarray(sample.offset, sample.offset + sample.size),
|
|
392
|
+
start: at,
|
|
393
|
+
end: at + sample.duration / scale,
|
|
394
|
+
shift
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return out;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
375
401
|
* The first video track's decoder configuration box, or null for another
|
|
376
402
|
* codec or a protected (encv) entry. ISO/IEC 14496-15 §5.3.3 (avcC) and
|
|
377
403
|
* §8.3.3 (hvcC).
|
|
@@ -391,4 +417,4 @@ function decoderConfigBox(init) {
|
|
|
391
417
|
return null;
|
|
392
418
|
}
|
|
393
419
|
//#endregion
|
|
394
|
-
export { VISUAL_ENTRY_HEADER, decoderConfigBox, earliestDecodeTime, findBox, findBoxes, fourcc, fragmentSamples, fullBox, parseSidx, parseTfdt, sampleEntries, trackInfo, trackTimescales, trexDefaults, viewOf, walkBoxes };
|
|
420
|
+
export { VISUAL_ENTRY_HEADER, decoderConfigBox, earliestDecodeTime, findBox, findBoxes, fourcc, fragmentSamples, fullBox, parseSidx, parseTfdt, sampleEntries, timedSamples, trackInfo, trackTimescales, trexDefaults, viewOf, walkBoxes };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
//#region src/containers/scte35.ts
|
|
3
|
+
const TABLE_ID = 252;
|
|
4
|
+
const SPLICE_INSERT = 5;
|
|
5
|
+
const SEGMENTATION_DESCRIPTOR = 2;
|
|
6
|
+
const CLOCK = 9e4;
|
|
7
|
+
/** A 33-bit 90 kHz value whose top bit is the low bit of `at`'s byte, in seconds. */
|
|
8
|
+
function seconds33(bytes, at) {
|
|
9
|
+
var _bytes$at, _bytes, _bytes2, _bytes3, _bytes4;
|
|
10
|
+
const high = ((_bytes$at = bytes[at]) !== null && _bytes$at !== void 0 ? _bytes$at : 0) & 1;
|
|
11
|
+
const low = ((_bytes = bytes[at + 1]) !== null && _bytes !== void 0 ? _bytes : 0) * Math.pow(2, 24) + (((_bytes2 = bytes[at + 2]) !== null && _bytes2 !== void 0 ? _bytes2 : 0) << 16 | ((_bytes3 = bytes[at + 3]) !== null && _bytes3 !== void 0 ? _bytes3 : 0) << 8 | ((_bytes4 = bytes[at + 4]) !== null && _bytes4 !== void 0 ? _bytes4 : 0)) >>> 0;
|
|
12
|
+
return (high * Math.pow(2, 32) + low) / CLOCK;
|
|
13
|
+
}
|
|
14
|
+
function uint32(bytes, at) {
|
|
15
|
+
var _bytes$at2, _bytes5, _bytes6, _bytes7;
|
|
16
|
+
return (((_bytes$at2 = bytes[at]) !== null && _bytes$at2 !== void 0 ? _bytes$at2 : 0) << 24 | ((_bytes5 = bytes[at + 1]) !== null && _bytes5 !== void 0 ? _bytes5 : 0) << 16 | ((_bytes6 = bytes[at + 2]) !== null && _bytes6 !== void 0 ? _bytes6 : 0) << 8 | ((_bytes7 = bytes[at + 3]) !== null && _bytes7 !== void 0 ? _bytes7 : 0)) >>> 0;
|
|
17
|
+
}
|
|
18
|
+
/** The length of a splice_time() at `at`: five bytes with a time, one without (§9.4.1). */
|
|
19
|
+
function spliceTimeLength(bytes, at) {
|
|
20
|
+
var _bytes$at3;
|
|
21
|
+
return (((_bytes$at3 = bytes[at]) !== null && _bytes$at3 !== void 0 ? _bytes$at3 : 0) & 128) !== 0 ? 5 : 1;
|
|
22
|
+
}
|
|
23
|
+
/** splice_insert() (§9.7.3), from its first byte. */
|
|
24
|
+
function spliceInsert(bytes, at) {
|
|
25
|
+
var _bytes8, _bytes9;
|
|
26
|
+
const eventId = uint32(bytes, at);
|
|
27
|
+
const cancel = (((_bytes8 = bytes[at + 4]) !== null && _bytes8 !== void 0 ? _bytes8 : 0) & 128) !== 0;
|
|
28
|
+
if (cancel) return {
|
|
29
|
+
eventId,
|
|
30
|
+
cancel
|
|
31
|
+
};
|
|
32
|
+
const flags = (_bytes9 = bytes[at + 5]) !== null && _bytes9 !== void 0 ? _bytes9 : 0;
|
|
33
|
+
const outOfNetwork = (flags & 128) !== 0;
|
|
34
|
+
const programSplice = (flags & 64) !== 0;
|
|
35
|
+
const hasDuration = (flags & 32) !== 0;
|
|
36
|
+
const immediate = (flags & 16) !== 0;
|
|
37
|
+
let cursor = at + 6;
|
|
38
|
+
if (programSplice && !immediate) cursor += spliceTimeLength(bytes, cursor);
|
|
39
|
+
if (!programSplice) {
|
|
40
|
+
var _bytes$cursor;
|
|
41
|
+
const count = (_bytes$cursor = bytes[cursor]) !== null && _bytes$cursor !== void 0 ? _bytes$cursor : 0;
|
|
42
|
+
cursor += 1;
|
|
43
|
+
for (let i = 0; i < count; i += 1) {
|
|
44
|
+
cursor += 1;
|
|
45
|
+
if (!immediate) cursor += spliceTimeLength(bytes, cursor);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return _objectSpread2({
|
|
49
|
+
eventId,
|
|
50
|
+
cancel,
|
|
51
|
+
outOfNetwork
|
|
52
|
+
}, hasDuration ? { breakDuration: seconds33(bytes, cursor) } : {});
|
|
53
|
+
}
|
|
54
|
+
/** segmentation_descriptor() (§10.3.3), from the byte after its identifier. */
|
|
55
|
+
function segmentation(bytes, at, end) {
|
|
56
|
+
var _bytes10, _bytes11, _bytes$cursor2, _bytes13;
|
|
57
|
+
if (at + 5 > end) return null;
|
|
58
|
+
const eventId = uint32(bytes, at);
|
|
59
|
+
const cancel = (((_bytes10 = bytes[at + 4]) !== null && _bytes10 !== void 0 ? _bytes10 : 0) & 128) !== 0;
|
|
60
|
+
if (cancel) return {
|
|
61
|
+
eventId,
|
|
62
|
+
cancel
|
|
63
|
+
};
|
|
64
|
+
const flags = (_bytes11 = bytes[at + 5]) !== null && _bytes11 !== void 0 ? _bytes11 : 0;
|
|
65
|
+
const programSegmentation = (flags & 128) !== 0;
|
|
66
|
+
const hasDuration = (flags & 64) !== 0;
|
|
67
|
+
let cursor = at + 6;
|
|
68
|
+
if (!programSegmentation) cursor += 1 + ((_bytes$cursor2 = bytes[cursor]) !== null && _bytes$cursor2 !== void 0 ? _bytes$cursor2 : 0) * 6;
|
|
69
|
+
let duration;
|
|
70
|
+
if (hasDuration) {
|
|
71
|
+
var _bytes12;
|
|
72
|
+
duration = (uint32(bytes, cursor) * 256 + ((_bytes12 = bytes[cursor + 4]) !== null && _bytes12 !== void 0 ? _bytes12 : 0)) / CLOCK;
|
|
73
|
+
cursor += 5;
|
|
74
|
+
}
|
|
75
|
+
cursor += 2 + ((_bytes13 = bytes[cursor + 1]) !== null && _bytes13 !== void 0 ? _bytes13 : 0);
|
|
76
|
+
if (cursor >= end) return _objectSpread2({
|
|
77
|
+
eventId,
|
|
78
|
+
cancel
|
|
79
|
+
}, duration !== void 0 ? { duration } : {});
|
|
80
|
+
return _objectSpread2({
|
|
81
|
+
eventId,
|
|
82
|
+
cancel,
|
|
83
|
+
typeId: bytes[cursor]
|
|
84
|
+
}, duration !== void 0 ? { duration } : {});
|
|
85
|
+
}
|
|
86
|
+
/** The summary of a splice_info_section, or null when the bytes are not one. */
|
|
87
|
+
function scte35Summary(bytes) {
|
|
88
|
+
var _bytes$, _bytes$2, _bytes$3;
|
|
89
|
+
if (bytes.byteLength < 16 || bytes[0] !== TABLE_ID) return null;
|
|
90
|
+
if ((((_bytes$ = bytes[4]) !== null && _bytes$ !== void 0 ? _bytes$ : 0) & 128) !== 0) return null;
|
|
91
|
+
const commandLength = (((_bytes$2 = bytes[11]) !== null && _bytes$2 !== void 0 ? _bytes$2 : 0) & 15) << 8 | ((_bytes$3 = bytes[12]) !== null && _bytes$3 !== void 0 ? _bytes$3 : 0);
|
|
92
|
+
const commandType = bytes[13];
|
|
93
|
+
const command = commandType === SPLICE_INSERT ? spliceInsert(bytes, 14) : {};
|
|
94
|
+
const segmentations = [];
|
|
95
|
+
if (commandLength !== 4095) {
|
|
96
|
+
var _bytes$cursor3, _bytes14;
|
|
97
|
+
let cursor = 14 + commandLength;
|
|
98
|
+
const loopLength = ((_bytes$cursor3 = bytes[cursor]) !== null && _bytes$cursor3 !== void 0 ? _bytes$cursor3 : 0) << 8 | ((_bytes14 = bytes[cursor + 1]) !== null && _bytes14 !== void 0 ? _bytes14 : 0);
|
|
99
|
+
cursor += 2;
|
|
100
|
+
const loopEnd = Math.min(cursor + loopLength, bytes.byteLength);
|
|
101
|
+
while (cursor + 2 <= loopEnd) {
|
|
102
|
+
const tag = bytes[cursor];
|
|
103
|
+
const end = Math.min(cursor + 2 + bytes[cursor + 1], loopEnd);
|
|
104
|
+
if (tag === SEGMENTATION_DESCRIPTOR) {
|
|
105
|
+
const found = segmentation(bytes, cursor + 6, end);
|
|
106
|
+
if (found !== null) segmentations.push(found);
|
|
107
|
+
}
|
|
108
|
+
cursor = end;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return _objectSpread2(_objectSpread2({ commandType }, command), {}, { segmentations });
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { scte35Summary };
|