mattebox 0.14.0 → 0.16.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 +29 -21
- package/dist/cdn/mattebox.dash-drm.min.js +3 -3
- package/dist/cdn/mattebox.dash-ll.min.js +3 -0
- package/dist/cdn/mattebox.dash.min.js +3 -3
- package/dist/cdn/mattebox.dual-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ll.min.js +3 -0
- 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-ll.min.js +3 -0
- 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 -6
- package/dist/containers/fmp4/writer.d.ts +7 -1
- package/dist/containers/fmp4/writer.d.ts.map +1 -1
- package/dist/containers/fmp4/writer.js +2 -1
- package/dist/containers/fmp4/writer.js.map +1 -1
- package/dist/containers/mp4-box/index.d.ts +8 -0
- package/dist/containers/mp4-box/index.d.ts.map +1 -1
- package/dist/containers/mp4-box/index.js +27 -0
- package/dist/containers/mp4-box/index.js.map +1 -1
- package/dist/containers/ts-transmux/demux.d.ts +2 -0
- package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/demux.js +3 -1
- package/dist/containers/ts-transmux/demux.js.map +1 -1
- package/dist/containers/ts-transmux/h265.d.ts +51 -0
- package/dist/containers/ts-transmux/h265.d.ts.map +1 -0
- package/dist/containers/ts-transmux/h265.js +182 -0
- package/dist/containers/ts-transmux/h265.js.map +1 -0
- package/dist/containers/ts-transmux/transmux.d.ts +3 -2
- package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/transmux.js +35 -11
- package/dist/containers/ts-transmux/transmux.js.map +1 -1
- package/dist/eme/index.d.ts +1 -10
- package/dist/eme/index.d.ts.map +1 -1
- package/dist/eme/index.js +4 -2
- package/dist/eme/index.js.map +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/fmp4/writer.js +2 -1
- package/dist/es2015/containers/id3.js +1 -1
- package/dist/es2015/containers/mp4-box/index.js +24 -1
- package/dist/es2015/containers/scte35.js +1 -1
- package/dist/es2015/containers/ts-transmux/demux.js +3 -1
- package/dist/es2015/containers/ts-transmux/h264.js +1 -1
- package/dist/es2015/containers/ts-transmux/h265.js +175 -0
- package/dist/es2015/containers/ts-transmux/index.js +1 -1
- package/dist/es2015/containers/ts-transmux/runner.js +2 -2
- package/dist/es2015/containers/ts-transmux/transmux.js +39 -16
- package/dist/es2015/containers/webvtt.js +1 -1
- package/dist/es2015/containers/wvtt.js +1 -1
- package/dist/es2015/eme/index.js +7 -5
- package/dist/es2015/index.js +8 -4
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/characteristics.js +19 -1
- package/dist/es2015/kernel/context.js +7 -0
- package/dist/es2015/kernel/dry-run.js +1 -1
- package/dist/es2015/kernel/mse.js +1 -1
- package/dist/es2015/kernel/prepare.js +3 -3
- package/dist/es2015/kernel/presentation.js +10 -1
- package/dist/es2015/kernel/reducer.js +92 -33
- package/dist/es2015/kernel/refresh.js +2 -2
- package/dist/es2015/kernel/rendition-select.js +2 -2
- package/dist/es2015/kernel/scheduler.js +31 -6
- package/dist/es2015/kernel/timeline.js +1 -1
- package/dist/es2015/kernel/trace.js +1 -1
- package/dist/es2015/kernel/transport.js +154 -22
- package/dist/es2015/presets/dash-ll/index.js +15 -0
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/dual-ll/index.js +16 -0
- package/dist/es2015/presets/full/index.js +6 -4
- package/dist/es2015/presets/hls-ll/index.js +14 -0
- package/dist/es2015/presets/tiers.js +28 -3
- package/dist/es2015/protocols/dash-cmaf/index.js +13 -8
- package/dist/es2015/protocols/dash-cmaf/parse.js +129 -41
- package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +1 -1
- package/dist/es2015/protocols/dash-cmaf/periods.js +1 -1
- package/dist/es2015/protocols/dash-live/index.js +75 -21
- package/dist/es2015/protocols/dash-ll/index.js +42 -0
- package/dist/es2015/protocols/hls-cmaf/index.js +5 -5
- package/dist/es2015/protocols/hls-cmaf/lexer.js +7 -1
- package/dist/es2015/protocols/hls-cmaf/parse.js +90 -27
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +4 -3
- package/dist/es2015/protocols/hls-live/index.js +92 -18
- package/dist/es2015/protocols/hls-ll/index.js +30 -0
- package/dist/es2015/protocols/hls-ll/parse.js +240 -0
- package/dist/es2015/stages/abr/index.js +9 -2
- package/dist/es2015/stages/aes-128/index.js +1 -1
- 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 +7 -1
- package/dist/es2015/stages/codec-probe/index.js +1 -1
- package/dist/es2015/stages/content-steering/index.js +1 -1
- package/dist/es2015/stages/eme-core/index.js +193 -42
- package/dist/es2015/stages/eme-fairplay/index.js +1 -1
- package/dist/es2015/stages/hdr/index.js +1 -1
- package/dist/es2015/stages/live-catchup/index.js +221 -0
- package/dist/es2015/stages/qoe/index.js +1 -1
- package/dist/es2015/stages/recovery/index.js +2 -2
- package/dist/es2015/stages/rendition-names/index.js +1 -1
- package/dist/es2015/stages/text-cea608/decode.js +1 -1
- package/dist/es2015/stages/text-cea708/decode.js +2 -2
- package/dist/es2015/stages/text-cea708/index.js +1 -1
- package/dist/es2015/stages/text-ttml/images.js +60 -0
- package/dist/es2015/stages/text-ttml/index.js +22 -6
- package/dist/es2015/stages/text-ttml/parse.js +71 -5
- package/dist/es2015/stages/thumbnails/index.js +1 -1
- package/dist/es2015/stages/timed-metadata/index.js +1 -1
- package/dist/es2015/stages/trick-play/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/kernel/characteristics.d.ts +8 -1
- package/dist/kernel/characteristics.d.ts.map +1 -1
- package/dist/kernel/characteristics.js +23 -0
- package/dist/kernel/characteristics.js.map +1 -1
- package/dist/kernel/context.d.ts +4 -6
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/context.js +10 -0
- package/dist/kernel/context.js.map +1 -1
- package/dist/kernel/lifecycle.d.ts +2 -6
- package/dist/kernel/lifecycle.d.ts.map +1 -1
- package/dist/kernel/lifecycle.js.map +1 -1
- package/dist/kernel/prepare.d.ts +3 -0
- package/dist/kernel/prepare.d.ts.map +1 -1
- package/dist/kernel/prepare.js +2 -1
- package/dist/kernel/prepare.js.map +1 -1
- package/dist/kernel/presentation.d.ts +5 -0
- package/dist/kernel/presentation.d.ts.map +1 -1
- package/dist/kernel/presentation.js +9 -0
- package/dist/kernel/presentation.js.map +1 -1
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +108 -49
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/refresh.d.ts.map +1 -1
- package/dist/kernel/refresh.js +2 -0
- package/dist/kernel/refresh.js.map +1 -1
- package/dist/kernel/scheduler.d.ts.map +1 -1
- package/dist/kernel/scheduler.js +40 -3
- package/dist/kernel/scheduler.js.map +1 -1
- package/dist/kernel/transport.d.ts +34 -5
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +148 -11
- package/dist/kernel/transport.js.map +1 -1
- package/dist/presets/dash-ll/index.d.ts +4 -0
- package/dist/presets/dash-ll/index.d.ts.map +1 -0
- package/dist/presets/dash-ll/index.js +10 -0
- package/dist/presets/dash-ll/index.js.map +1 -0
- package/dist/presets/dual-ll/index.d.ts +4 -0
- package/dist/presets/dual-ll/index.d.ts.map +1 -0
- package/dist/presets/dual-ll/index.js +15 -0
- package/dist/presets/dual-ll/index.js.map +1 -0
- package/dist/presets/full/index.d.ts.map +1 -1
- package/dist/presets/full/index.js +6 -4
- package/dist/presets/full/index.js.map +1 -1
- package/dist/presets/hls-ll/index.d.ts +4 -0
- package/dist/presets/hls-ll/index.d.ts.map +1 -0
- package/dist/presets/hls-ll/index.js +9 -0
- package/dist/presets/hls-ll/index.js.map +1 -0
- package/dist/presets/tiers.d.ts +16 -0
- package/dist/presets/tiers.d.ts.map +1 -1
- package/dist/presets/tiers.js +25 -0
- package/dist/presets/tiers.js.map +1 -1
- package/dist/protocols/dash-cmaf/index.d.ts +29 -1
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +9 -4
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts +8 -2
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +121 -14
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/dash-live/index.d.ts +22 -0
- package/dist/protocols/dash-live/index.d.ts.map +1 -1
- package/dist/protocols/dash-live/index.js +77 -18
- package/dist/protocols/dash-live/index.js.map +1 -1
- package/dist/protocols/dash-ll/index.d.ts +27 -0
- package/dist/protocols/dash-ll/index.d.ts.map +1 -0
- package/dist/protocols/dash-ll/index.js +35 -0
- package/dist/protocols/dash-ll/index.js.map +1 -0
- package/dist/protocols/hls-cmaf/index.d.ts +23 -0
- package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/index.js +4 -4
- 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 +7 -0
- package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
- package/dist/protocols/hls-cmaf/parse.d.ts +28 -2
- package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/parse.js +106 -11
- package/dist/protocols/hls-cmaf/parse.js.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts +1 -1
- package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/unavailable.js +8 -2
- package/dist/protocols/hls-cmaf/unavailable.js.map +1 -1
- package/dist/protocols/hls-live/index.d.ts +65 -0
- package/dist/protocols/hls-live/index.d.ts.map +1 -1
- package/dist/protocols/hls-live/index.js +115 -16
- package/dist/protocols/hls-live/index.js.map +1 -1
- package/dist/protocols/hls-ll/index.d.ts +22 -0
- package/dist/protocols/hls-ll/index.d.ts.map +1 -0
- package/dist/protocols/hls-ll/index.js +32 -0
- package/dist/protocols/hls-ll/index.js.map +1 -0
- package/dist/protocols/hls-ll/parse.d.ts +45 -0
- package/dist/protocols/hls-ll/parse.d.ts.map +1 -0
- package/dist/protocols/hls-ll/parse.js +300 -0
- package/dist/protocols/hls-ll/parse.js.map +1 -0
- package/dist/stages/abr/index.d.ts.map +1 -1
- package/dist/stages/abr/index.js +6 -6
- package/dist/stages/abr/index.js.map +1 -1
- package/dist/stages/cmcd/index.d.ts.map +1 -1
- package/dist/stages/cmcd/index.js +12 -3
- package/dist/stages/cmcd/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts +67 -2
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +191 -40
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/live-catchup/index.d.ts +42 -0
- package/dist/stages/live-catchup/index.d.ts.map +1 -0
- package/dist/stages/live-catchup/index.js +217 -0
- package/dist/stages/live-catchup/index.js.map +1 -0
- package/dist/stages/recovery/index.d.ts.map +1 -1
- package/dist/stages/recovery/index.js +6 -2
- package/dist/stages/recovery/index.js.map +1 -1
- package/dist/stages/text-ttml/images.d.ts +10 -0
- package/dist/stages/text-ttml/images.d.ts.map +1 -0
- package/dist/stages/text-ttml/images.js +71 -0
- package/dist/stages/text-ttml/images.js.map +1 -0
- package/dist/stages/text-ttml/index.d.ts +13 -0
- package/dist/stages/text-ttml/index.d.ts.map +1 -1
- package/dist/stages/text-ttml/index.js +26 -6
- package/dist/stages/text-ttml/index.js.map +1 -1
- package/dist/stages/text-ttml/parse.d.ts +5 -2
- package/dist/stages/text-ttml/parse.d.ts.map +1 -1
- package/dist/stages/text-ttml/parse.js +74 -2
- package/dist/stages/text-ttml/parse.js.map +1 -1
- package/dist/types/ir.d.ts +43 -0
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +4 -0
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/kernel.js.map +1 -1
- package/dist/types/messages.d.ts +40 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/stage.d.ts +24 -5
- package/dist/types/stage.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
import { adtsFragment, parseAdts } from '../adts.js';
|
|
14
14
|
import { concat, sequenceNumberFor, writeInitSegment, writeMediaSegment, } from '../fmp4/writer.js';
|
|
15
15
|
import { ccTriplesFromSei } from '../sei.js';
|
|
16
|
-
import { demux, unrollTimestamps } from './demux.js';
|
|
16
|
+
import { demux, STREAM_TYPE, unrollTimestamps } from './demux.js';
|
|
17
17
|
import { accessUnitFromNals, NAL_TYPE, nalType, splitNalUnits, spsDimensions, toAccessUnit, } from './h264.js';
|
|
18
|
+
import { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNalType, hevcSpsInfo, } from './h265.js';
|
|
18
19
|
const VIDEO_TIMESCALE = 90000;
|
|
19
20
|
const VIDEO_TRACK_ID = 1;
|
|
20
21
|
const AUDIO_TRACK_ID = 2;
|
|
@@ -41,6 +42,18 @@ function timedTags(streams, presentationStart, anchor) {
|
|
|
41
42
|
}
|
|
42
43
|
return tags;
|
|
43
44
|
}
|
|
45
|
+
const AVC = {
|
|
46
|
+
type: nalType,
|
|
47
|
+
delimiter: NAL_TYPE.accessUnitDelimiter,
|
|
48
|
+
unit: accessUnitFromNals,
|
|
49
|
+
seiHeader: 1,
|
|
50
|
+
};
|
|
51
|
+
const HEVC = {
|
|
52
|
+
type: hevcNalType,
|
|
53
|
+
delimiter: HEVC_NAL_TYPE.accessUnitDelimiter,
|
|
54
|
+
unit: hevcAccessUnitFromNals,
|
|
55
|
+
seiHeader: 2,
|
|
56
|
+
};
|
|
44
57
|
/**
|
|
45
58
|
* Reframes video access units. Access units do not align with PES packet
|
|
46
59
|
* boundaries in the wild: a picture's tail spills into the next PES packet,
|
|
@@ -50,7 +63,7 @@ function timedTags(streams, presentationStart, anchor) {
|
|
|
50
63
|
* no delimiters falls back to one unit per PES, which is correct when the muxer
|
|
51
64
|
* did align them.
|
|
52
65
|
*/
|
|
53
|
-
function frameAccessUnits(packets) {
|
|
66
|
+
function frameAccessUnits(packets, syntax) {
|
|
54
67
|
let total = 0;
|
|
55
68
|
for (const p of packets)
|
|
56
69
|
total += p.data.byteLength;
|
|
@@ -63,9 +76,13 @@ function frameAccessUnits(packets) {
|
|
|
63
76
|
offset += p.data.byteLength;
|
|
64
77
|
}
|
|
65
78
|
const nals = splitNalUnits(es);
|
|
66
|
-
const hasAud = nals.some((n) =>
|
|
79
|
+
const hasAud = nals.some((n) => syntax.type(n) === syntax.delimiter);
|
|
67
80
|
if (!hasAud) {
|
|
68
|
-
return packets.map((p) => ({
|
|
81
|
+
return packets.map((p) => ({
|
|
82
|
+
unit: syntax === AVC ? toAccessUnit(p.data) : syntax.unit(splitNalUnits(p.data)),
|
|
83
|
+
pts: p.pts,
|
|
84
|
+
dts: p.dts,
|
|
85
|
+
}));
|
|
69
86
|
}
|
|
70
87
|
const framed = [];
|
|
71
88
|
let group = [];
|
|
@@ -80,11 +97,11 @@ function frameAccessUnits(packets) {
|
|
|
80
97
|
boundaryIndex += 1;
|
|
81
98
|
}
|
|
82
99
|
const b = boundaries[boundaryIndex];
|
|
83
|
-
framed.push({ unit:
|
|
100
|
+
framed.push({ unit: syntax.unit(group), pts: b.pts, dts: b.dts });
|
|
84
101
|
group = [];
|
|
85
102
|
};
|
|
86
103
|
for (const nal of nals) {
|
|
87
|
-
if (
|
|
104
|
+
if (syntax.type(nal) === syntax.delimiter && group.length > 0)
|
|
88
105
|
flush();
|
|
89
106
|
if (group.length === 0)
|
|
90
107
|
groupOffset = nal.byteOffset - es.byteOffset;
|
|
@@ -96,11 +113,16 @@ function frameAccessUnits(packets) {
|
|
|
96
113
|
function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
97
114
|
if (packets.length === 0)
|
|
98
115
|
return null;
|
|
99
|
-
const
|
|
116
|
+
const hevc = packets[0]?.streamType === STREAM_TYPE.h265;
|
|
117
|
+
const syntax = hevc ? HEVC : AVC;
|
|
118
|
+
const framed = frameAccessUnits(packets, syntax);
|
|
100
119
|
const units = framed.map((f) => f.unit);
|
|
120
|
+
let vps = null;
|
|
101
121
|
let sps = null;
|
|
102
122
|
let pps = null;
|
|
103
123
|
for (const unit of units) {
|
|
124
|
+
if (unit.vps != null)
|
|
125
|
+
vps = unit.vps;
|
|
104
126
|
if (unit.sps !== null)
|
|
105
127
|
sps = unit.sps;
|
|
106
128
|
if (unit.pps !== null)
|
|
@@ -112,7 +134,8 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
112
134
|
// Without either there is no honest init segment and the segment drops.
|
|
113
135
|
sps = sps ?? carried?.sps ?? null;
|
|
114
136
|
pps = pps ?? carried?.pps ?? null;
|
|
115
|
-
|
|
137
|
+
vps = vps ?? carried?.vps ?? null;
|
|
138
|
+
if (sps === null || pps === null || (hevc && vps === null))
|
|
116
139
|
return null;
|
|
117
140
|
const dts = unrollTimestamps(framed.map((f) => f.dts));
|
|
118
141
|
const pts = unrollTimestamps(framed.map((f) => f.pts));
|
|
@@ -126,7 +149,7 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
126
149
|
const unit = units[i];
|
|
127
150
|
if (unit.sei.length === 0)
|
|
128
151
|
continue;
|
|
129
|
-
const triples = unit.sei.flatMap((nal) => ccTriplesFromSei(nal));
|
|
152
|
+
const triples = unit.sei.flatMap((nal) => ccTriplesFromSei(nal, syntax.seiHeader));
|
|
130
153
|
if (triples.length === 0)
|
|
131
154
|
continue;
|
|
132
155
|
const time = presentationStart + (pts[i] - firstPts) / VIDEO_TIMESCALE;
|
|
@@ -150,7 +173,7 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
150
173
|
isKeyframe: units[i].isKeyframe,
|
|
151
174
|
});
|
|
152
175
|
}
|
|
153
|
-
const { width, height } = spsDimensions(sps);
|
|
176
|
+
const { width, height } = hevc ? hevcSpsInfo(sps) : spsDimensions(sps);
|
|
154
177
|
const config = {
|
|
155
178
|
id: VIDEO_TRACK_ID,
|
|
156
179
|
kind: 'video',
|
|
@@ -159,12 +182,13 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
159
182
|
pps,
|
|
160
183
|
width,
|
|
161
184
|
height,
|
|
185
|
+
...(vps !== null ? { hvcC: hevcDecoderConfiguration(vps, sps, pps) } : {}),
|
|
162
186
|
};
|
|
163
187
|
return {
|
|
164
188
|
config,
|
|
165
189
|
fragment: { trackId: VIDEO_TRACK_ID, baseMediaDecodeTime: base, samples },
|
|
166
190
|
captions,
|
|
167
|
-
parameterSets: { sps, pps },
|
|
191
|
+
parameterSets: vps !== null ? { sps, pps, vps } : { sps, pps },
|
|
168
192
|
};
|
|
169
193
|
}
|
|
170
194
|
function buildAudio(packets, presentationStart) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transmux.js","sourceRoot":"","sources":["../../../src/containers/ts-transmux/transmux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAEL,MAAM,EAEN,iBAAiB,EAIjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"transmux.js","sourceRoot":"","sources":["../../../src/containers/ts-transmux/transmux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAEL,MAAM,EAEN,iBAAiB,EAIjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KA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EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;QAC1B,kBAAkB,EAAE,KAAK;QACzB,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK,EAAE,QAAQ,IAAI,EAAE;QAC/B,QAAQ,EAAE,SAAS,CACjB,OAAO,EACP,iBAAiB,EACjB,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI,CACzE;QACD,YAAY;QACZ,aAAa,EAAE,KAAK,EAAE,aAAa,IAAI,IAAI;KAC5C,CAAC;AACJ,CAAC"}
|
package/dist/eme/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The engine's DRM on an element the engine does not drive. On Safari a
|
|
3
|
-
* player can play HLS natively with `video.src`; the element still fires
|
|
4
|
-
* `encrypted` and needs a license. `attachEme` runs the same `eme-core` and
|
|
5
|
-
* key-system stages the engine runs, on a small context of its own: the
|
|
6
|
-
* element, `fetch` for licenses and certificates, and a local event bus.
|
|
7
|
-
* Only the media route applies: init data comes from the element's
|
|
8
|
-
* `encrypted` event, since there is no manifest the engine has parsed.
|
|
9
|
-
*/
|
|
10
1
|
import { type DrmApi, type EmeOptions } from '../stages/eme-core/index.js';
|
|
11
2
|
import type { Listener, Stage, Unsubscribe } from '../types/stage.js';
|
|
12
|
-
export type { DrmApi, EmeOptions } from '../stages/eme-core/index.js';
|
|
3
|
+
export type { DrmApi, EmeOptions, LicenseContext, LicenseRequestDraft, LicenseResponseInfo, LicenseRetryOptions, } from '../stages/eme-core/index.js';
|
|
13
4
|
/** An outgoing license or certificate request; a hook may rewrite both fields. */
|
|
14
5
|
export interface EmeRequestDraft {
|
|
15
6
|
url: string;
|
package/dist/eme/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eme/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eme/index.ts"],"names":[],"mappings":"AAUA,OAAgB,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAA0B,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9F,YAAY,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAErC,kFAAkF;AAClF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC;IAC5E,4FAA4F;IAC5F,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IACvC,mFAAmF;IACnF,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC7C,mEAAmE;IACnE,MAAM,IAAI,IAAI,CAAC;CAChB;AAID,kGAAkG;AAClG,wBAAgB,SAAS,CACvB,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,gBAAqB,GAC7B,aAAa,CAoEf"}
|
package/dist/eme/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Only the media route applies: init data comes from the element's
|
|
8
8
|
* `encrypted` event, since there is no manifest the engine has parsed.
|
|
9
9
|
*/
|
|
10
|
+
import { fetchWithin } from '../kernel/transport.js';
|
|
10
11
|
import emeCore, {} from '../stages/eme-core/index.js';
|
|
11
12
|
const noop = () => { };
|
|
12
13
|
/** Starts DRM on the element. Call it before you set `src`, so no `encrypted` event is missed. */
|
|
@@ -23,11 +24,11 @@ export function attachEme(element, options = {}) {
|
|
|
23
24
|
request(url, init) {
|
|
24
25
|
const draft = { url, headers: { ...init.headers } };
|
|
25
26
|
requestHook?.(draft);
|
|
26
|
-
return fetch(draft.url, {
|
|
27
|
+
return fetchWithin((url, request) => fetch(url, request), draft.url, {
|
|
27
28
|
method: init.method ?? (init.body !== undefined ? 'POST' : 'GET'),
|
|
28
29
|
headers: draft.headers,
|
|
29
30
|
...(init.body !== undefined ? { body: init.body } : {}),
|
|
30
|
-
});
|
|
31
|
+
}, init.timeoutMs ?? null, init.signal);
|
|
31
32
|
},
|
|
32
33
|
emit(event, payload) {
|
|
33
34
|
for (const fn of [...(listeners.get(event) ?? [])])
|
|
@@ -46,6 +47,7 @@ export function attachEme(element, options = {}) {
|
|
|
46
47
|
registerSwitchPolicy: noop,
|
|
47
48
|
registerTypeProbe: noop,
|
|
48
49
|
registerTimeProbe: noop,
|
|
50
|
+
registerChunkSplitter: noop,
|
|
49
51
|
reduce: noop,
|
|
50
52
|
dispatch: noop,
|
|
51
53
|
addRequestHook: () => noop,
|
package/dist/eme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eme/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,OAAO,EAAE,EAAgC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eme/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;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,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO;QACL,GAAG,EAAE,GAAa;QAClB,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,MAAM;YACJ,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;gBAAE,QAAQ,EAAE,CAAC;YACjE,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -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.154.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.154.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.154.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.154.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.154.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.154.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) {
|
|
@@ -59,8 +59,9 @@ function avcC(config) {
|
|
|
59
59
|
const { sps, pps } = config;
|
|
60
60
|
return box("avcC", u8(1, (_sps$ = sps[1]) !== null && _sps$ !== void 0 ? _sps$ : 0, (_sps$2 = sps[2]) !== null && _sps$2 !== void 0 ? _sps$2 : 0, (_sps$3 = sps[3]) !== null && _sps$3 !== void 0 ? _sps$3 : 0), u8(255), u8(225), u16(sps.byteLength), sps, u8(1), u16(pps.byteLength), pps);
|
|
61
61
|
}
|
|
62
|
+
/** A visual sample entry (ISO/IEC 14496-12 §12.1.3): `avc1` with avcC, or `hvc1` with hvcC. */
|
|
62
63
|
function avc1(config) {
|
|
63
|
-
return box("avc1", u8(0, 0, 0, 0, 0, 0), u16(1), u16(0), u16(0), u32(0), u32(0), u32(0), u16(config.width), u16(config.height), u32(4718592), u32(4718592), u32(0), u16(1), /* @__PURE__ */ new Uint8Array(32), u16(24), u16(65535), avcC(config));
|
|
64
|
+
return box(config.hvcC !== void 0 ? "hvc1" : "avc1", u8(0, 0, 0, 0, 0, 0), u16(1), u16(0), u16(0), u32(0), u32(0), u32(0), u16(config.width), u16(config.height), u32(4718592), u32(4718592), u32(0), u16(1), /* @__PURE__ */ new Uint8Array(32), u16(24), u16(65535), config.hvcC !== void 0 ? box("hvcC", config.hvcC) : avcC(config));
|
|
64
65
|
}
|
|
65
66
|
function esds(config) {
|
|
66
67
|
const asc = u8(config.audioObjectType << 3 | config.samplingFrequencyIndex >> 1, (config.samplingFrequencyIndex & 1) << 7 | config.channelConfig << 3);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.154.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;
|
|
@@ -74,6 +74,29 @@ function walkBoxes(data, visit) {
|
|
|
74
74
|
const outcome = level(0, data.byteLength, "");
|
|
75
75
|
return { error: outcome === "stop" || outcome === null ? null : outcome };
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* The length of the complete CMAF chunks at the start of `data`: the end
|
|
79
|
+
* of the last whole `mdat` among its complete top-level boxes, 0 when none
|
|
80
|
+
* is complete yet. A chunk is one or more `moof` and `mdat` pairs
|
|
81
|
+
* (ISO/IEC 23000-19 §7.3.3), so the bytes up to an `mdat` end decode on
|
|
82
|
+
* their own.
|
|
83
|
+
*/
|
|
84
|
+
function completeChunks(data) {
|
|
85
|
+
const view = viewOf(data);
|
|
86
|
+
let offset = 0;
|
|
87
|
+
let ready = 0;
|
|
88
|
+
while (data.byteLength - offset >= 8) {
|
|
89
|
+
let size = view.getUint32(offset);
|
|
90
|
+
if (size === 1) {
|
|
91
|
+
if (data.byteLength - offset < 16) break;
|
|
92
|
+
size = Number(view.getBigUint64(offset + 8));
|
|
93
|
+
}
|
|
94
|
+
if (size < 8 || offset + size > data.byteLength) break;
|
|
95
|
+
offset += size;
|
|
96
|
+
if (fourcc(data, offset - size + 4) === "mdat") ready = offset;
|
|
97
|
+
}
|
|
98
|
+
return ready;
|
|
99
|
+
}
|
|
77
100
|
/** The first box matching a slash path such as 'moov/trak/mdia/minf/stbl/stsd'. */
|
|
78
101
|
function findBox(data, path) {
|
|
79
102
|
let found = null;
|
|
@@ -417,4 +440,4 @@ function decoderConfigBox(init) {
|
|
|
417
440
|
return null;
|
|
418
441
|
}
|
|
419
442
|
//#endregion
|
|
420
|
-
export { VISUAL_ENTRY_HEADER, decoderConfigBox, earliestDecodeTime, findBox, findBoxes, fourcc, fragmentSamples, fullBox, parseSidx, parseTfdt, sampleEntries, timedSamples, trackInfo, trackTimescales, trexDefaults, viewOf, walkBoxes };
|
|
443
|
+
export { VISUAL_ENTRY_HEADER, completeChunks, decoderConfigBox, earliestDecodeTime, findBox, findBoxes, fourcc, fragmentSamples, fullBox, parseSidx, parseTfdt, sampleEntries, timedSamples, trackInfo, trackTimescales, trexDefaults, viewOf, walkBoxes };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
//#region src/containers/scte35.ts
|
|
3
3
|
const TABLE_ID = 252;
|
|
4
4
|
const SPLICE_INSERT = 5;
|
|
@@ -12,6 +12,8 @@ import { looksLikeTransportStream } from "./sniff.js";
|
|
|
12
12
|
/** MPEG-TS stream_type values this transmuxer routes. */
|
|
13
13
|
const STREAM_TYPE = {
|
|
14
14
|
h264: 27,
|
|
15
|
+
/** ISO/IEC 13818-1 Table 2-34: HEVC video stream. */
|
|
16
|
+
h265: 36,
|
|
15
17
|
aacAdts: 15,
|
|
16
18
|
mp3a: 3,
|
|
17
19
|
mp3b: 4,
|
|
@@ -20,7 +22,7 @@ const STREAM_TYPE = {
|
|
|
20
22
|
privateData: 6
|
|
21
23
|
};
|
|
22
24
|
function kindOf(streamType) {
|
|
23
|
-
if (streamType === STREAM_TYPE.h264) return "video";
|
|
25
|
+
if (streamType === STREAM_TYPE.h264 || streamType === STREAM_TYPE.h265) return "video";
|
|
24
26
|
if (streamType === STREAM_TYPE.aacAdts || streamType === STREAM_TYPE.mp3a || streamType === STREAM_TYPE.mp3b || streamType === STREAM_TYPE.ac3) return "audio";
|
|
25
27
|
if (streamType === STREAM_TYPE.metadata) return "id3";
|
|
26
28
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js";
|
|
2
2
|
import { toRbsp } from "../sei.js";
|
|
3
3
|
//#region src/containers/ts-transmux/h264.ts
|
|
4
4
|
/**
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js";
|
|
2
|
+
import { toRbsp } from "../sei.js";
|
|
3
|
+
//#region src/containers/ts-transmux/h265.ts
|
|
4
|
+
/**
|
|
5
|
+
* H.265 Annex B to the hvc1 sample format. The NAL units split on start
|
|
6
|
+
* codes as in H.264 (splitNalUnits applies); the header is two bytes and
|
|
7
|
+
* the type sits in bits 1 to 6 of the first (ITU-T H.265 §7.3.1.2). The
|
|
8
|
+
* parameter sets (VPS, SPS, PPS) move into the hvcC box and out of the
|
|
9
|
+
* samples, which hls.js does as well. An IRAP picture (BLA, IDR or CRA,
|
|
10
|
+
* types 16 to 21, H.265 §7.4.2.2) is a sync sample.
|
|
11
|
+
*/
|
|
12
|
+
const HEVC_NAL_TYPE = {
|
|
13
|
+
irapFirst: 16,
|
|
14
|
+
irapLast: 21,
|
|
15
|
+
vps: 32,
|
|
16
|
+
sps: 33,
|
|
17
|
+
pps: 34,
|
|
18
|
+
accessUnitDelimiter: 35,
|
|
19
|
+
prefixSei: 39,
|
|
20
|
+
suffixSei: 40
|
|
21
|
+
};
|
|
22
|
+
function hevcNalType(nal) {
|
|
23
|
+
var _nal$;
|
|
24
|
+
return ((_nal$ = nal[0]) !== null && _nal$ !== void 0 ? _nal$ : 0) >> 1 & 63;
|
|
25
|
+
}
|
|
26
|
+
/** Builds one hvc1 sample from an access unit's NAL units, as the H.264 path does. */
|
|
27
|
+
function hevcAccessUnitFromNals(nals) {
|
|
28
|
+
let vps = null;
|
|
29
|
+
let sps = null;
|
|
30
|
+
let pps = null;
|
|
31
|
+
let isKeyframe = false;
|
|
32
|
+
const sampleNals = [];
|
|
33
|
+
const sei = [];
|
|
34
|
+
for (const nal of nals) {
|
|
35
|
+
const type = hevcNalType(nal);
|
|
36
|
+
if (type === HEVC_NAL_TYPE.vps) vps = nal;
|
|
37
|
+
else if (type === HEVC_NAL_TYPE.sps) sps = nal;
|
|
38
|
+
else if (type === HEVC_NAL_TYPE.pps) pps = nal;
|
|
39
|
+
else if (type === HEVC_NAL_TYPE.accessUnitDelimiter) continue;
|
|
40
|
+
else {
|
|
41
|
+
if (type >= HEVC_NAL_TYPE.irapFirst && type <= HEVC_NAL_TYPE.irapLast) isKeyframe = true;
|
|
42
|
+
if (type === HEVC_NAL_TYPE.prefixSei) sei.push(nal);
|
|
43
|
+
sampleNals.push(nal);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
let length = 0;
|
|
47
|
+
for (const nal of sampleNals) length += 4 + nal.byteLength;
|
|
48
|
+
const avcc = new Uint8Array(length);
|
|
49
|
+
const view = new DataView(avcc.buffer);
|
|
50
|
+
let offset = 0;
|
|
51
|
+
for (const nal of sampleNals) {
|
|
52
|
+
view.setUint32(offset, nal.byteLength);
|
|
53
|
+
avcc.set(nal, offset + 4);
|
|
54
|
+
offset += 4 + nal.byteLength;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
avcc,
|
|
58
|
+
isKeyframe,
|
|
59
|
+
vps,
|
|
60
|
+
sps,
|
|
61
|
+
pps,
|
|
62
|
+
sei
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Reads bits MSB first; reads past the end return zeroes, so a truncated SPS cannot loop. */
|
|
66
|
+
var Bits = class {
|
|
67
|
+
constructor(data) {
|
|
68
|
+
this.data = data;
|
|
69
|
+
_defineProperty(this, "position", 0);
|
|
70
|
+
}
|
|
71
|
+
read(count) {
|
|
72
|
+
let value = 0;
|
|
73
|
+
for (let i = 0; i < count; i += 1) {
|
|
74
|
+
var _this$data;
|
|
75
|
+
const byte = (_this$data = this.data[this.position >> 3]) !== null && _this$data !== void 0 ? _this$data : 0;
|
|
76
|
+
value = value * 2 + (byte >> 7 - (this.position & 7) & 1);
|
|
77
|
+
this.position += 1;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
skip(count) {
|
|
82
|
+
this.position += count;
|
|
83
|
+
}
|
|
84
|
+
/** Unsigned Exp-Golomb (H.265 §9.2), bounded at 32 leading zeroes. */
|
|
85
|
+
ue() {
|
|
86
|
+
let zeros = 0;
|
|
87
|
+
while (zeros < 32 && this.position < this.data.byteLength * 8 && this.read(1) === 0) zeros += 1;
|
|
88
|
+
return Math.pow(2, zeros) - 1 + this.read(zeros);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
/** Parses the fields of an SPS (H.265 §7.3.2.2.1) up to the bit depths. */
|
|
92
|
+
function hevcSpsInfo(sps) {
|
|
93
|
+
const rbsp = toRbsp(sps, 2);
|
|
94
|
+
const bits = new Bits(rbsp);
|
|
95
|
+
bits.skip(4);
|
|
96
|
+
const maxSubLayersMinus1 = bits.read(3);
|
|
97
|
+
const temporalIdNested = bits.read(1) === 1;
|
|
98
|
+
const profileTierLevel = rbsp.slice(1, 13);
|
|
99
|
+
bits.skip(96);
|
|
100
|
+
const profilePresent = [];
|
|
101
|
+
const levelPresent = [];
|
|
102
|
+
for (let i = 0; i < maxSubLayersMinus1; i += 1) {
|
|
103
|
+
profilePresent.push(bits.read(1) === 1);
|
|
104
|
+
levelPresent.push(bits.read(1) === 1);
|
|
105
|
+
}
|
|
106
|
+
if (maxSubLayersMinus1 > 0) bits.skip(2 * (8 - maxSubLayersMinus1));
|
|
107
|
+
for (let i = 0; i < maxSubLayersMinus1; i += 1) {
|
|
108
|
+
if (profilePresent[i]) bits.skip(88);
|
|
109
|
+
if (levelPresent[i]) bits.skip(8);
|
|
110
|
+
}
|
|
111
|
+
bits.ue();
|
|
112
|
+
const chromaFormat = bits.ue();
|
|
113
|
+
if (chromaFormat === 3) bits.skip(1);
|
|
114
|
+
let width = bits.ue();
|
|
115
|
+
let height = bits.ue();
|
|
116
|
+
if (bits.read(1) === 1) {
|
|
117
|
+
const subWidth = chromaFormat === 1 || chromaFormat === 2 ? 2 : 1;
|
|
118
|
+
const subHeight = chromaFormat === 1 ? 2 : 1;
|
|
119
|
+
width -= subWidth * (bits.ue() + bits.ue());
|
|
120
|
+
height -= subHeight * (bits.ue() + bits.ue());
|
|
121
|
+
}
|
|
122
|
+
const bitDepthLuma = bits.ue() + 8;
|
|
123
|
+
const bitDepthChroma = bits.ue() + 8;
|
|
124
|
+
return {
|
|
125
|
+
width: Math.max(0, width),
|
|
126
|
+
height: Math.max(0, height),
|
|
127
|
+
chromaFormat,
|
|
128
|
+
bitDepthLuma,
|
|
129
|
+
bitDepthChroma,
|
|
130
|
+
temporalLayers: maxSubLayersMinus1 + 1,
|
|
131
|
+
temporalIdNested,
|
|
132
|
+
profileTierLevel
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The HEVCDecoderConfigurationRecord (ISO/IEC 14496-15 §8.3.3.1.2), with
|
|
137
|
+
* one complete array each for the VPS, the SPS and the PPS, and 4-byte NAL
|
|
138
|
+
* lengths.
|
|
139
|
+
*/
|
|
140
|
+
function hevcDecoderConfiguration(vps, sps, pps) {
|
|
141
|
+
const info = hevcSpsInfo(sps);
|
|
142
|
+
const arrays = [
|
|
143
|
+
[HEVC_NAL_TYPE.vps, vps],
|
|
144
|
+
[HEVC_NAL_TYPE.sps, sps],
|
|
145
|
+
[HEVC_NAL_TYPE.pps, pps]
|
|
146
|
+
];
|
|
147
|
+
let length = 23;
|
|
148
|
+
for (const [, nal] of arrays) length += 5 + nal.byteLength;
|
|
149
|
+
const out = new Uint8Array(length);
|
|
150
|
+
out[0] = 1;
|
|
151
|
+
out.set(info.profileTierLevel, 1);
|
|
152
|
+
out[13] = 240;
|
|
153
|
+
out[14] = 0;
|
|
154
|
+
out[15] = 252;
|
|
155
|
+
out[16] = 252 | info.chromaFormat & 3;
|
|
156
|
+
out[17] = 248 | info.bitDepthLuma - 8 & 7;
|
|
157
|
+
out[18] = 248 | info.bitDepthChroma - 8 & 7;
|
|
158
|
+
out[19] = 0;
|
|
159
|
+
out[20] = 0;
|
|
160
|
+
out[21] = (info.temporalLayers & 7) << 3 | (info.temporalIdNested ? 4 : 0) | 3;
|
|
161
|
+
out[22] = arrays.length;
|
|
162
|
+
let offset = 23;
|
|
163
|
+
for (const [type, nal] of arrays) {
|
|
164
|
+
out[offset] = 128 | type;
|
|
165
|
+
out[offset + 1] = 0;
|
|
166
|
+
out[offset + 2] = 1;
|
|
167
|
+
out[offset + 3] = nal.byteLength >> 8;
|
|
168
|
+
out[offset + 4] = nal.byteLength & 255;
|
|
169
|
+
out.set(nal, offset + 5);
|
|
170
|
+
offset += 5 + nal.byteLength;
|
|
171
|
+
}
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNalType, hevcSpsInfo };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
|
|
2
2
|
import { looksLikeTransportStream } from "./sniff.js";
|
|
3
3
|
import { id3Events } from "../id3.js";
|
|
4
4
|
import { deliverMetadata, metadataWanted } from "../metadata.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
|
|
3
3
|
//#region src/containers/ts-transmux/runner.ts
|
|
4
4
|
function createTransmuxRunner(options, source) {
|
|
5
5
|
let worker = null;
|