hls.js 1.5.13 → 1.5.14-0.canary.10415
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 +4 -3
- package/dist/hls-demo.js +41 -38
- package/dist/hls-demo.js.map +1 -1
- package/dist/hls.js +4211 -2666
- package/dist/hls.js.d.ts +179 -110
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +2841 -1921
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +2569 -1639
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +3572 -2017
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +38 -38
- package/src/config.ts +5 -2
- package/src/controller/abr-controller.ts +39 -25
- package/src/controller/audio-stream-controller.ts +156 -136
- package/src/controller/audio-track-controller.ts +1 -1
- package/src/controller/base-playlist-controller.ts +27 -10
- package/src/controller/base-stream-controller.ts +234 -89
- package/src/controller/buffer-controller.ts +250 -97
- package/src/controller/buffer-operation-queue.ts +16 -19
- package/src/controller/cap-level-controller.ts +3 -2
- package/src/controller/cmcd-controller.ts +51 -14
- package/src/controller/content-steering-controller.ts +29 -15
- package/src/controller/eme-controller.ts +10 -23
- package/src/controller/error-controller.ts +28 -22
- package/src/controller/fps-controller.ts +8 -3
- package/src/controller/fragment-finders.ts +44 -16
- package/src/controller/fragment-tracker.ts +58 -25
- package/src/controller/gap-controller.ts +43 -16
- package/src/controller/id3-track-controller.ts +45 -35
- package/src/controller/latency-controller.ts +18 -13
- package/src/controller/level-controller.ts +37 -19
- package/src/controller/stream-controller.ts +100 -83
- package/src/controller/subtitle-stream-controller.ts +35 -47
- package/src/controller/subtitle-track-controller.ts +5 -3
- package/src/controller/timeline-controller.ts +20 -22
- package/src/crypt/aes-crypto.ts +21 -2
- package/src/crypt/decrypter-aes-mode.ts +4 -0
- package/src/crypt/decrypter.ts +32 -16
- package/src/crypt/fast-aes-key.ts +28 -5
- package/src/demux/audio/aacdemuxer.ts +2 -2
- package/src/demux/audio/ac3-demuxer.ts +4 -3
- package/src/demux/audio/adts.ts +9 -4
- package/src/demux/audio/base-audio-demuxer.ts +16 -14
- package/src/demux/audio/mp3demuxer.ts +4 -3
- package/src/demux/audio/mpegaudio.ts +1 -1
- package/src/demux/mp4demuxer.ts +7 -7
- package/src/demux/sample-aes.ts +2 -0
- package/src/demux/transmuxer-interface.ts +8 -16
- package/src/demux/transmuxer-worker.ts +4 -4
- package/src/demux/transmuxer.ts +16 -3
- package/src/demux/tsdemuxer.ts +75 -38
- package/src/demux/video/avc-video-parser.ts +210 -121
- package/src/demux/video/base-video-parser.ts +135 -2
- package/src/demux/video/exp-golomb.ts +0 -208
- package/src/demux/video/hevc-video-parser.ts +749 -0
- package/src/events.ts +8 -1
- package/src/exports-named.ts +1 -1
- package/src/hls.ts +84 -47
- package/src/loader/date-range.ts +71 -5
- package/src/loader/fragment-loader.ts +23 -21
- package/src/loader/fragment.ts +8 -4
- package/src/loader/key-loader.ts +3 -1
- package/src/loader/level-details.ts +6 -6
- package/src/loader/level-key.ts +10 -9
- package/src/loader/m3u8-parser.ts +138 -144
- package/src/loader/playlist-loader.ts +5 -7
- package/src/remux/mp4-generator.ts +196 -1
- package/src/remux/mp4-remuxer.ts +32 -62
- package/src/remux/passthrough-remuxer.ts +1 -1
- package/src/task-loop.ts +5 -2
- package/src/types/component-api.ts +3 -1
- package/src/types/demuxer.ts +3 -0
- package/src/types/events.ts +19 -6
- package/src/types/fragment-tracker.ts +2 -2
- package/src/types/media-playlist.ts +9 -1
- package/src/types/remuxer.ts +1 -1
- package/src/utils/attr-list.ts +96 -9
- package/src/utils/buffer-helper.ts +12 -31
- package/src/utils/cea-608-parser.ts +1 -3
- package/src/utils/codecs.ts +34 -5
- package/src/utils/encryption-methods-util.ts +21 -0
- package/src/utils/fetch-loader.ts +1 -1
- package/src/utils/hash.ts +10 -0
- package/src/utils/hdr.ts +4 -7
- package/src/utils/imsc1-ttml-parser.ts +1 -1
- package/src/utils/keysystem-util.ts +1 -6
- package/src/utils/level-helper.ts +71 -44
- package/src/utils/logger.ts +58 -23
- package/src/utils/mp4-tools.ts +5 -3
- package/src/utils/rendition-helper.ts +100 -74
- package/src/utils/utf8-utils.ts +18 -0
- package/src/utils/variable-substitution.ts +0 -19
- package/src/utils/webvtt-parser.ts +2 -12
- package/src/demux/id3.ts +0 -411
- package/src/types/general.ts +0 -6
@@ -148,214 +148,6 @@ class ExpGolomb {
|
|
148
148
|
readUInt(): number {
|
149
149
|
return this.readBits(32);
|
150
150
|
}
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Advance the ExpGolomb decoder past a scaling list. The scaling
|
154
|
-
* list is optionally transmitted as part of a sequence parameter
|
155
|
-
* set and is not relevant to transmuxing.
|
156
|
-
* @param count the number of entries in this scaling list
|
157
|
-
* @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1
|
158
|
-
*/
|
159
|
-
skipScalingList(count: number): void {
|
160
|
-
let lastScale = 8;
|
161
|
-
let nextScale = 8;
|
162
|
-
let deltaScale;
|
163
|
-
for (let j = 0; j < count; j++) {
|
164
|
-
if (nextScale !== 0) {
|
165
|
-
deltaScale = this.readEG();
|
166
|
-
nextScale = (lastScale + deltaScale + 256) % 256;
|
167
|
-
}
|
168
|
-
lastScale = nextScale === 0 ? lastScale : nextScale;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Read a sequence parameter set and return some interesting video
|
174
|
-
* properties. A sequence parameter set is the H264 metadata that
|
175
|
-
* describes the properties of upcoming video frames.
|
176
|
-
* @returns an object with configuration parsed from the
|
177
|
-
* sequence parameter set, including the dimensions of the
|
178
|
-
* associated video frames.
|
179
|
-
*/
|
180
|
-
readSPS(): {
|
181
|
-
width: number;
|
182
|
-
height: number;
|
183
|
-
pixelRatio: [number, number];
|
184
|
-
} {
|
185
|
-
let frameCropLeftOffset = 0;
|
186
|
-
let frameCropRightOffset = 0;
|
187
|
-
let frameCropTopOffset = 0;
|
188
|
-
let frameCropBottomOffset = 0;
|
189
|
-
let numRefFramesInPicOrderCntCycle;
|
190
|
-
let scalingListCount;
|
191
|
-
let i;
|
192
|
-
const readUByte = this.readUByte.bind(this);
|
193
|
-
const readBits = this.readBits.bind(this);
|
194
|
-
const readUEG = this.readUEG.bind(this);
|
195
|
-
const readBoolean = this.readBoolean.bind(this);
|
196
|
-
const skipBits = this.skipBits.bind(this);
|
197
|
-
const skipEG = this.skipEG.bind(this);
|
198
|
-
const skipUEG = this.skipUEG.bind(this);
|
199
|
-
const skipScalingList = this.skipScalingList.bind(this);
|
200
|
-
|
201
|
-
readUByte();
|
202
|
-
const profileIdc = readUByte(); // profile_idc
|
203
|
-
readBits(5); // profileCompat constraint_set[0-4]_flag, u(5)
|
204
|
-
skipBits(3); // reserved_zero_3bits u(3),
|
205
|
-
readUByte(); // level_idc u(8)
|
206
|
-
skipUEG(); // seq_parameter_set_id
|
207
|
-
// some profiles have more optional data we don't need
|
208
|
-
if (
|
209
|
-
profileIdc === 100 ||
|
210
|
-
profileIdc === 110 ||
|
211
|
-
profileIdc === 122 ||
|
212
|
-
profileIdc === 244 ||
|
213
|
-
profileIdc === 44 ||
|
214
|
-
profileIdc === 83 ||
|
215
|
-
profileIdc === 86 ||
|
216
|
-
profileIdc === 118 ||
|
217
|
-
profileIdc === 128
|
218
|
-
) {
|
219
|
-
const chromaFormatIdc = readUEG();
|
220
|
-
if (chromaFormatIdc === 3) {
|
221
|
-
skipBits(1);
|
222
|
-
} // separate_colour_plane_flag
|
223
|
-
|
224
|
-
skipUEG(); // bit_depth_luma_minus8
|
225
|
-
skipUEG(); // bit_depth_chroma_minus8
|
226
|
-
skipBits(1); // qpprime_y_zero_transform_bypass_flag
|
227
|
-
if (readBoolean()) {
|
228
|
-
// seq_scaling_matrix_present_flag
|
229
|
-
scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
|
230
|
-
for (i = 0; i < scalingListCount; i++) {
|
231
|
-
if (readBoolean()) {
|
232
|
-
// seq_scaling_list_present_flag[ i ]
|
233
|
-
if (i < 6) {
|
234
|
-
skipScalingList(16);
|
235
|
-
} else {
|
236
|
-
skipScalingList(64);
|
237
|
-
}
|
238
|
-
}
|
239
|
-
}
|
240
|
-
}
|
241
|
-
}
|
242
|
-
skipUEG(); // log2_max_frame_num_minus4
|
243
|
-
const picOrderCntType = readUEG();
|
244
|
-
if (picOrderCntType === 0) {
|
245
|
-
readUEG(); // log2_max_pic_order_cnt_lsb_minus4
|
246
|
-
} else if (picOrderCntType === 1) {
|
247
|
-
skipBits(1); // delta_pic_order_always_zero_flag
|
248
|
-
skipEG(); // offset_for_non_ref_pic
|
249
|
-
skipEG(); // offset_for_top_to_bottom_field
|
250
|
-
numRefFramesInPicOrderCntCycle = readUEG();
|
251
|
-
for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {
|
252
|
-
skipEG();
|
253
|
-
} // offset_for_ref_frame[ i ]
|
254
|
-
}
|
255
|
-
skipUEG(); // max_num_ref_frames
|
256
|
-
skipBits(1); // gaps_in_frame_num_value_allowed_flag
|
257
|
-
const picWidthInMbsMinus1 = readUEG();
|
258
|
-
const picHeightInMapUnitsMinus1 = readUEG();
|
259
|
-
const frameMbsOnlyFlag = readBits(1);
|
260
|
-
if (frameMbsOnlyFlag === 0) {
|
261
|
-
skipBits(1);
|
262
|
-
} // mb_adaptive_frame_field_flag
|
263
|
-
|
264
|
-
skipBits(1); // direct_8x8_inference_flag
|
265
|
-
if (readBoolean()) {
|
266
|
-
// frame_cropping_flag
|
267
|
-
frameCropLeftOffset = readUEG();
|
268
|
-
frameCropRightOffset = readUEG();
|
269
|
-
frameCropTopOffset = readUEG();
|
270
|
-
frameCropBottomOffset = readUEG();
|
271
|
-
}
|
272
|
-
let pixelRatio: [number, number] = [1, 1];
|
273
|
-
if (readBoolean()) {
|
274
|
-
// vui_parameters_present_flag
|
275
|
-
if (readBoolean()) {
|
276
|
-
// aspect_ratio_info_present_flag
|
277
|
-
const aspectRatioIdc = readUByte();
|
278
|
-
switch (aspectRatioIdc) {
|
279
|
-
case 1:
|
280
|
-
pixelRatio = [1, 1];
|
281
|
-
break;
|
282
|
-
case 2:
|
283
|
-
pixelRatio = [12, 11];
|
284
|
-
break;
|
285
|
-
case 3:
|
286
|
-
pixelRatio = [10, 11];
|
287
|
-
break;
|
288
|
-
case 4:
|
289
|
-
pixelRatio = [16, 11];
|
290
|
-
break;
|
291
|
-
case 5:
|
292
|
-
pixelRatio = [40, 33];
|
293
|
-
break;
|
294
|
-
case 6:
|
295
|
-
pixelRatio = [24, 11];
|
296
|
-
break;
|
297
|
-
case 7:
|
298
|
-
pixelRatio = [20, 11];
|
299
|
-
break;
|
300
|
-
case 8:
|
301
|
-
pixelRatio = [32, 11];
|
302
|
-
break;
|
303
|
-
case 9:
|
304
|
-
pixelRatio = [80, 33];
|
305
|
-
break;
|
306
|
-
case 10:
|
307
|
-
pixelRatio = [18, 11];
|
308
|
-
break;
|
309
|
-
case 11:
|
310
|
-
pixelRatio = [15, 11];
|
311
|
-
break;
|
312
|
-
case 12:
|
313
|
-
pixelRatio = [64, 33];
|
314
|
-
break;
|
315
|
-
case 13:
|
316
|
-
pixelRatio = [160, 99];
|
317
|
-
break;
|
318
|
-
case 14:
|
319
|
-
pixelRatio = [4, 3];
|
320
|
-
break;
|
321
|
-
case 15:
|
322
|
-
pixelRatio = [3, 2];
|
323
|
-
break;
|
324
|
-
case 16:
|
325
|
-
pixelRatio = [2, 1];
|
326
|
-
break;
|
327
|
-
case 255: {
|
328
|
-
pixelRatio = [
|
329
|
-
(readUByte() << 8) | readUByte(),
|
330
|
-
(readUByte() << 8) | readUByte(),
|
331
|
-
];
|
332
|
-
break;
|
333
|
-
}
|
334
|
-
}
|
335
|
-
}
|
336
|
-
}
|
337
|
-
return {
|
338
|
-
width: Math.ceil(
|
339
|
-
(picWidthInMbsMinus1 + 1) * 16 -
|
340
|
-
frameCropLeftOffset * 2 -
|
341
|
-
frameCropRightOffset * 2,
|
342
|
-
),
|
343
|
-
height:
|
344
|
-
(2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 -
|
345
|
-
(frameMbsOnlyFlag ? 2 : 4) *
|
346
|
-
(frameCropTopOffset + frameCropBottomOffset),
|
347
|
-
pixelRatio: pixelRatio,
|
348
|
-
};
|
349
|
-
}
|
350
|
-
|
351
|
-
readSliceType() {
|
352
|
-
// skip NALu type
|
353
|
-
this.readUByte();
|
354
|
-
// discard first_mb_in_slice
|
355
|
-
this.readUEG();
|
356
|
-
// return slice_type
|
357
|
-
return this.readUEG();
|
358
|
-
}
|
359
151
|
}
|
360
152
|
|
361
153
|
export default ExpGolomb;
|