hls.js 1.5.5-0.canary.9977 → 1.5.5-0.canary.9978

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.
@@ -431,7 +431,7 @@ function enableLogs(debugConfig, context, id) {
431
431
  // Some browsers don't allow to use bind on console object anyway
432
432
  // fallback to default if needed
433
433
  try {
434
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.5-0.canary.9977"}`);
434
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.5-0.canary.9978"}`);
435
435
  } catch (e) {
436
436
  /* log fn threw an exception. All logger methods are no-ops. */
437
437
  return createLogger();
@@ -1035,7 +1035,7 @@ function getAesModeFromFullSegmentMethod(method) {
1035
1035
  // This file is inserted as a shim for modules which we do not want to include into the distro.
1036
1036
  // This replacement is done in the "alias" plugin of the rollup config.
1037
1037
  var empty = undefined;
1038
- var Cues = /*@__PURE__*/getDefaultExportFromCjs(empty);
1038
+ var HevcVideoParser = /*@__PURE__*/getDefaultExportFromCjs(empty);
1039
1039
 
1040
1040
  function sliceUint8(array, start, end) {
1041
1041
  // @ts-expect-error This polyfills IE11 usage of Uint8Array slice.
@@ -9517,7 +9517,7 @@ const hlsDefaultConfig = _objectSpread2(_objectSpread2({
9517
9517
  });
9518
9518
  function timelineConfig() {
9519
9519
  return {
9520
- cueHandler: Cues,
9520
+ cueHandler: HevcVideoParser,
9521
9521
  // used by timeline-controller
9522
9522
  enableWebVTT: false,
9523
9523
  // used by timeline-controller
@@ -14648,599 +14648,6 @@ class AvcVideoParser extends BaseVideoParser {
14648
14648
  }
14649
14649
  }
14650
14650
 
14651
- class HevcVideoParser extends BaseVideoParser {
14652
- constructor(...args) {
14653
- super(...args);
14654
- this.initVPS = null;
14655
- }
14656
- parsePES(track, textTrack, pes, last, duration) {
14657
- const units = this.parseNALu(track, pes.data);
14658
- let VideoSample = this.VideoSample;
14659
- let push;
14660
- let spsfound = false;
14661
- // free pes.data to save up some memory
14662
- pes.data = null;
14663
-
14664
- // if new NAL units found and last sample still there, let's push ...
14665
- // this helps parsing streams with missing AUD (only do this if AUD never found)
14666
- if (VideoSample && units.length && !track.audFound) {
14667
- this.pushAccessUnit(VideoSample, track);
14668
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
14669
- }
14670
- units.forEach(unit => {
14671
- var _VideoSample2;
14672
- switch (unit.type) {
14673
- // NON-IDR, NON RANDOM ACCESS SLICE
14674
- case 0:
14675
- case 1:
14676
- case 2:
14677
- case 3:
14678
- case 4:
14679
- case 5:
14680
- case 6:
14681
- case 7:
14682
- case 8:
14683
- case 9:
14684
- if (!VideoSample) {
14685
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
14686
- }
14687
- VideoSample.frame = true;
14688
- push = true;
14689
- break;
14690
-
14691
- // CRA, BLA (random access picture)
14692
- case 16:
14693
- case 17:
14694
- case 18:
14695
- case 21:
14696
- push = true;
14697
- if (spsfound) {
14698
- var _VideoSample;
14699
- // handle PES not starting with AUD
14700
- // if we have frame data already, that cannot belong to the same frame, so force a push
14701
- if ((_VideoSample = VideoSample) != null && _VideoSample.frame && !VideoSample.key) {
14702
- this.pushAccessUnit(VideoSample, track);
14703
- VideoSample = this.VideoSample = null;
14704
- }
14705
- }
14706
- if (!VideoSample) {
14707
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
14708
- }
14709
- VideoSample.key = true;
14710
- VideoSample.frame = true;
14711
- break;
14712
-
14713
- // IDR
14714
- case 19:
14715
- case 20:
14716
- push = true;
14717
- // handle PES not starting with AUD
14718
- // if we have frame data already, that cannot belong to the same frame, so force a push
14719
- if ((_VideoSample2 = VideoSample) != null && _VideoSample2.frame && !VideoSample.key) {
14720
- this.pushAccessUnit(VideoSample, track);
14721
- VideoSample = this.VideoSample = null;
14722
- }
14723
- if (!VideoSample) {
14724
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
14725
- }
14726
- VideoSample.key = true;
14727
- VideoSample.frame = true;
14728
- break;
14729
-
14730
- // SEI
14731
- case 39:
14732
- push = true;
14733
- parseSEIMessageFromNALu(unit.data, 2,
14734
- // NALu header size
14735
- pes.pts, textTrack.samples);
14736
- break;
14737
-
14738
- // VPS
14739
- case 32:
14740
- push = true;
14741
- if (!track.vps) {
14742
- const config = this.readVPS(unit.data);
14743
- track.params = _objectSpread2({}, config);
14744
- this.initVPS = unit.data;
14745
- }
14746
- track.vps = [unit.data];
14747
- break;
14748
-
14749
- // SPS
14750
- case 33:
14751
- push = true;
14752
- spsfound = true;
14753
- if (typeof track.params === 'object') {
14754
- if (track.vps !== undefined && track.vps[0] !== this.initVPS && track.sps !== undefined && !this.matchSPS(track.sps[0], unit.data)) {
14755
- this.initVPS = track.vps[0];
14756
- track.sps = track.pps = undefined;
14757
- }
14758
- if (!track.sps) {
14759
- const config = this.readSPS(unit.data);
14760
- track.width = config.width;
14761
- track.height = config.height;
14762
- track.pixelRatio = config.pixelRatio;
14763
- track.duration = duration;
14764
- track.codec = config.codecString;
14765
- track.sps = [];
14766
- for (const prop in config.params) {
14767
- track.params[prop] = config.params[prop];
14768
- }
14769
- }
14770
- if (track.vps !== undefined && track.vps[0] === this.initVPS) {
14771
- track.sps.push(unit.data);
14772
- }
14773
- }
14774
- if (!VideoSample) {
14775
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
14776
- }
14777
- VideoSample.key = true;
14778
- break;
14779
-
14780
- // PPS
14781
- case 34:
14782
- push = true;
14783
- if (typeof track.params === 'object') {
14784
- if (!track.pps) {
14785
- track.pps = [];
14786
- const config = this.readPPS(unit.data);
14787
- for (const prop in config) {
14788
- track.params[prop] = config[prop];
14789
- }
14790
- }
14791
- if (this.initVPS !== null || track.pps.length === 0) {
14792
- track.pps.push(unit.data);
14793
- }
14794
- }
14795
- break;
14796
-
14797
- // ACCESS UNIT DELIMITER
14798
- case 35:
14799
- push = true;
14800
- track.audFound = true;
14801
- if (VideoSample) {
14802
- this.pushAccessUnit(VideoSample, track);
14803
- }
14804
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
14805
- break;
14806
- default:
14807
- push = false;
14808
- if (VideoSample) {
14809
- VideoSample.debug += 'unknown or irrelevant NAL ' + unit.type + ' ';
14810
- }
14811
- break;
14812
- }
14813
- if (VideoSample && push) {
14814
- const units = VideoSample.units;
14815
- units.push(unit);
14816
- }
14817
- });
14818
- // if last PES packet, push samples
14819
- if (last && VideoSample) {
14820
- this.pushAccessUnit(VideoSample, track);
14821
- this.VideoSample = null;
14822
- }
14823
- }
14824
- getNALuType(data, offset) {
14825
- return (data[offset] & 0x7e) >>> 1;
14826
- }
14827
- ebsp2rbsp(arr) {
14828
- const dst = new Uint8Array(arr.byteLength);
14829
- let dstIdx = 0;
14830
- for (let i = 0; i < arr.byteLength; i++) {
14831
- if (i >= 2) {
14832
- // Unescape: Skip 0x03 after 00 00
14833
- if (arr[i] === 0x03 && arr[i - 1] === 0x00 && arr[i - 2] === 0x00) {
14834
- continue;
14835
- }
14836
- }
14837
- dst[dstIdx] = arr[i];
14838
- dstIdx++;
14839
- }
14840
- return new Uint8Array(dst.buffer, 0, dstIdx);
14841
- }
14842
- readVPS(vps) {
14843
- const eg = new ExpGolomb(vps);
14844
- // remove header
14845
- eg.readUByte();
14846
- eg.readUByte();
14847
- eg.readBits(4); // video_parameter_set_id
14848
- eg.skipBits(2);
14849
- eg.readBits(6); // max_layers_minus1
14850
- const max_sub_layers_minus1 = eg.readBits(3);
14851
- const temporal_id_nesting_flag = eg.readBoolean();
14852
- // ...vui fps can be here, but empty fps value is not critical for metadata
14853
-
14854
- return {
14855
- numTemporalLayers: max_sub_layers_minus1 + 1,
14856
- temporalIdNested: temporal_id_nesting_flag
14857
- };
14858
- }
14859
- readSPS(sps) {
14860
- const eg = new ExpGolomb(this.ebsp2rbsp(sps));
14861
- eg.readUByte();
14862
- eg.readUByte();
14863
- eg.readBits(4); //video_parameter_set_id
14864
- const max_sub_layers_minus1 = eg.readBits(3);
14865
- eg.readBoolean(); // temporal_id_nesting_flag
14866
-
14867
- // profile_tier_level
14868
- const general_profile_space = eg.readBits(2);
14869
- const general_tier_flag = eg.readBoolean();
14870
- const general_profile_idc = eg.readBits(5);
14871
- const general_profile_compatibility_flags_1 = eg.readUByte();
14872
- const general_profile_compatibility_flags_2 = eg.readUByte();
14873
- const general_profile_compatibility_flags_3 = eg.readUByte();
14874
- const general_profile_compatibility_flags_4 = eg.readUByte();
14875
- const general_constraint_indicator_flags_1 = eg.readUByte();
14876
- const general_constraint_indicator_flags_2 = eg.readUByte();
14877
- const general_constraint_indicator_flags_3 = eg.readUByte();
14878
- const general_constraint_indicator_flags_4 = eg.readUByte();
14879
- const general_constraint_indicator_flags_5 = eg.readUByte();
14880
- const general_constraint_indicator_flags_6 = eg.readUByte();
14881
- const general_level_idc = eg.readUByte();
14882
- const sub_layer_profile_present_flags = [];
14883
- const sub_layer_level_present_flags = [];
14884
- for (let i = 0; i < max_sub_layers_minus1; i++) {
14885
- sub_layer_profile_present_flags.push(eg.readBoolean());
14886
- sub_layer_level_present_flags.push(eg.readBoolean());
14887
- }
14888
- if (max_sub_layers_minus1 > 0) {
14889
- for (let i = max_sub_layers_minus1; i < 8; i++) {
14890
- eg.readBits(2);
14891
- }
14892
- }
14893
- for (let i = 0; i < max_sub_layers_minus1; i++) {
14894
- if (sub_layer_profile_present_flags[i]) {
14895
- eg.readUByte(); // sub_layer_profile_space, sub_layer_tier_flag, sub_layer_profile_idc
14896
- eg.readUByte();
14897
- eg.readUByte();
14898
- eg.readUByte();
14899
- eg.readUByte(); // sub_layer_profile_compatibility_flag
14900
- eg.readUByte();
14901
- eg.readUByte();
14902
- eg.readUByte();
14903
- eg.readUByte();
14904
- eg.readUByte();
14905
- eg.readUByte();
14906
- }
14907
- if (sub_layer_level_present_flags[i]) {
14908
- eg.readUByte();
14909
- }
14910
- }
14911
- eg.readUEG(); // seq_parameter_set_id
14912
- const chroma_format_idc = eg.readUEG();
14913
- if (chroma_format_idc == 3) {
14914
- eg.skipBits(1); //separate_colour_plane_flag
14915
- }
14916
- const pic_width_in_luma_samples = eg.readUEG();
14917
- const pic_height_in_luma_samples = eg.readUEG();
14918
- const conformance_window_flag = eg.readBoolean();
14919
- let pic_left_offset = 0,
14920
- pic_right_offset = 0,
14921
- pic_top_offset = 0,
14922
- pic_bottom_offset = 0;
14923
- if (conformance_window_flag) {
14924
- pic_left_offset += eg.readUEG();
14925
- pic_right_offset += eg.readUEG();
14926
- pic_top_offset += eg.readUEG();
14927
- pic_bottom_offset += eg.readUEG();
14928
- }
14929
- const bit_depth_luma_minus8 = eg.readUEG();
14930
- const bit_depth_chroma_minus8 = eg.readUEG();
14931
- const log2_max_pic_order_cnt_lsb_minus4 = eg.readUEG();
14932
- const sub_layer_ordering_info_present_flag = eg.readBoolean();
14933
- for (let i = sub_layer_ordering_info_present_flag ? 0 : max_sub_layers_minus1; i <= max_sub_layers_minus1; i++) {
14934
- eg.skipUEG(); // max_dec_pic_buffering_minus1[i]
14935
- eg.skipUEG(); // max_num_reorder_pics[i]
14936
- eg.skipUEG(); // max_latency_increase_plus1[i]
14937
- }
14938
- eg.skipUEG(); // log2_min_luma_coding_block_size_minus3
14939
- eg.skipUEG(); // log2_diff_max_min_luma_coding_block_size
14940
- eg.skipUEG(); // log2_min_transform_block_size_minus2
14941
- eg.skipUEG(); // log2_diff_max_min_transform_block_size
14942
- eg.skipUEG(); // max_transform_hierarchy_depth_inter
14943
- eg.skipUEG(); // max_transform_hierarchy_depth_intra
14944
- const scaling_list_enabled_flag = eg.readBoolean();
14945
- if (scaling_list_enabled_flag) {
14946
- const sps_scaling_list_data_present_flag = eg.readBoolean();
14947
- if (sps_scaling_list_data_present_flag) {
14948
- for (let sizeId = 0; sizeId < 4; sizeId++) {
14949
- for (let matrixId = 0; matrixId < (sizeId === 3 ? 2 : 6); matrixId++) {
14950
- const scaling_list_pred_mode_flag = eg.readBoolean();
14951
- if (!scaling_list_pred_mode_flag) {
14952
- eg.readUEG(); // scaling_list_pred_matrix_id_delta
14953
- } else {
14954
- const coefNum = Math.min(64, 1 << 4 + (sizeId << 1));
14955
- if (sizeId > 1) {
14956
- eg.readEG();
14957
- }
14958
- for (let i = 0; i < coefNum; i++) {
14959
- eg.readEG();
14960
- }
14961
- }
14962
- }
14963
- }
14964
- }
14965
- }
14966
- eg.readBoolean(); // amp_enabled_flag
14967
- eg.readBoolean(); // sample_adaptive_offset_enabled_flag
14968
- const pcm_enabled_flag = eg.readBoolean();
14969
- if (pcm_enabled_flag) {
14970
- eg.readUByte();
14971
- eg.skipUEG();
14972
- eg.skipUEG();
14973
- eg.readBoolean();
14974
- }
14975
- const num_short_term_ref_pic_sets = eg.readUEG();
14976
- let num_delta_pocs = 0;
14977
- for (let i = 0; i < num_short_term_ref_pic_sets; i++) {
14978
- let inter_ref_pic_set_prediction_flag = false;
14979
- if (i !== 0) {
14980
- inter_ref_pic_set_prediction_flag = eg.readBoolean();
14981
- }
14982
- if (inter_ref_pic_set_prediction_flag) {
14983
- if (i === num_short_term_ref_pic_sets) {
14984
- eg.readUEG();
14985
- }
14986
- eg.readBoolean();
14987
- eg.readUEG();
14988
- let next_num_delta_pocs = 0;
14989
- for (let j = 0; j <= num_delta_pocs; j++) {
14990
- const used_by_curr_pic_flag = eg.readBoolean();
14991
- let use_delta_flag = false;
14992
- if (!used_by_curr_pic_flag) {
14993
- use_delta_flag = eg.readBoolean();
14994
- }
14995
- if (used_by_curr_pic_flag || use_delta_flag) {
14996
- next_num_delta_pocs++;
14997
- }
14998
- }
14999
- num_delta_pocs = next_num_delta_pocs;
15000
- } else {
15001
- const num_negative_pics = eg.readUEG();
15002
- const num_positive_pics = eg.readUEG();
15003
- num_delta_pocs = num_negative_pics + num_positive_pics;
15004
- for (let j = 0; j < num_negative_pics; j++) {
15005
- eg.readUEG();
15006
- eg.readBoolean();
15007
- }
15008
- for (let j = 0; j < num_positive_pics; j++) {
15009
- eg.readUEG();
15010
- eg.readBoolean();
15011
- }
15012
- }
15013
- }
15014
- const long_term_ref_pics_present_flag = eg.readBoolean();
15015
- if (long_term_ref_pics_present_flag) {
15016
- const num_long_term_ref_pics_sps = eg.readUEG();
15017
- for (let i = 0; i < num_long_term_ref_pics_sps; i++) {
15018
- for (let j = 0; j < log2_max_pic_order_cnt_lsb_minus4 + 4; j++) {
15019
- eg.readBits(1);
15020
- }
15021
- eg.readBits(1);
15022
- }
15023
- }
15024
- let min_spatial_segmentation_idc = 0;
15025
- let sar_width = 1,
15026
- sar_height = 1;
15027
- let fps_fixed = true,
15028
- fps_den = 1,
15029
- fps_num = 0;
15030
- eg.readBoolean(); // sps_temporal_mvp_enabled_flag
15031
- eg.readBoolean(); // strong_intra_smoothing_enabled_flag
15032
- let default_display_window_flag = false;
15033
- const vui_parameters_present_flag = eg.readBoolean();
15034
- if (vui_parameters_present_flag) {
15035
- const aspect_ratio_info_present_flag = eg.readBoolean();
15036
- if (aspect_ratio_info_present_flag) {
15037
- const aspect_ratio_idc = eg.readUByte();
15038
- const sar_width_table = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2];
15039
- const sar_height_table = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];
15040
- if (aspect_ratio_idc > 0 && aspect_ratio_idc < 16) {
15041
- sar_width = sar_width_table[aspect_ratio_idc - 1];
15042
- sar_height = sar_height_table[aspect_ratio_idc - 1];
15043
- } else if (aspect_ratio_idc === 255) {
15044
- sar_width = eg.readBits(16);
15045
- sar_height = eg.readBits(16);
15046
- }
15047
- }
15048
- const overscan_info_present_flag = eg.readBoolean();
15049
- if (overscan_info_present_flag) {
15050
- eg.readBoolean();
15051
- }
15052
- const video_signal_type_present_flag = eg.readBoolean();
15053
- if (video_signal_type_present_flag) {
15054
- eg.readBits(3);
15055
- eg.readBoolean();
15056
- const colour_description_present_flag = eg.readBoolean();
15057
- if (colour_description_present_flag) {
15058
- eg.readUByte();
15059
- eg.readUByte();
15060
- eg.readUByte();
15061
- }
15062
- }
15063
- const chroma_loc_info_present_flag = eg.readBoolean();
15064
- if (chroma_loc_info_present_flag) {
15065
- eg.readUEG();
15066
- eg.readUEG();
15067
- }
15068
- eg.readBoolean(); // neutral_chroma_indication_flag
15069
- eg.readBoolean(); // field_seq_flag
15070
- eg.readBoolean(); // frame_field_info_present_flag
15071
- default_display_window_flag = eg.readBoolean();
15072
- if (default_display_window_flag) {
15073
- pic_left_offset += eg.readUEG();
15074
- pic_right_offset += eg.readUEG();
15075
- pic_top_offset += eg.readUEG();
15076
- pic_bottom_offset += eg.readUEG();
15077
- }
15078
- const vui_timing_info_present_flag = eg.readBoolean();
15079
- if (vui_timing_info_present_flag) {
15080
- fps_den = eg.readBits(32);
15081
- fps_num = eg.readBits(32);
15082
- const vui_poc_proportional_to_timing_flag = eg.readBoolean();
15083
- if (vui_poc_proportional_to_timing_flag) {
15084
- eg.readUEG();
15085
- }
15086
- const vui_hrd_parameters_present_flag = eg.readBoolean();
15087
- if (vui_hrd_parameters_present_flag) {
15088
- //const commonInfPresentFlag = true;
15089
- //if (commonInfPresentFlag) {
15090
- const nal_hrd_parameters_present_flag = eg.readBoolean();
15091
- const vcl_hrd_parameters_present_flag = eg.readBoolean();
15092
- let sub_pic_hrd_params_present_flag = false;
15093
- if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag) {
15094
- sub_pic_hrd_params_present_flag = eg.readBoolean();
15095
- if (sub_pic_hrd_params_present_flag) {
15096
- eg.readUByte();
15097
- eg.readBits(5);
15098
- eg.readBoolean();
15099
- eg.readBits(5);
15100
- }
15101
- eg.readBits(4); // bit_rate_scale
15102
- eg.readBits(4); // cpb_size_scale
15103
- if (sub_pic_hrd_params_present_flag) {
15104
- eg.readBits(4);
15105
- }
15106
- eg.readBits(5);
15107
- eg.readBits(5);
15108
- eg.readBits(5);
15109
- }
15110
- //}
15111
- for (let i = 0; i <= max_sub_layers_minus1; i++) {
15112
- fps_fixed = eg.readBoolean(); // fixed_pic_rate_general_flag
15113
- const fixed_pic_rate_within_cvs_flag = fps_fixed || eg.readBoolean();
15114
- let low_delay_hrd_flag = false;
15115
- if (fixed_pic_rate_within_cvs_flag) {
15116
- eg.readEG();
15117
- } else {
15118
- low_delay_hrd_flag = eg.readBoolean();
15119
- }
15120
- const cpb_cnt = low_delay_hrd_flag ? 1 : eg.readUEG() + 1;
15121
- if (nal_hrd_parameters_present_flag) {
15122
- for (let j = 0; j < cpb_cnt; j++) {
15123
- eg.readUEG();
15124
- eg.readUEG();
15125
- if (sub_pic_hrd_params_present_flag) {
15126
- eg.readUEG();
15127
- eg.readUEG();
15128
- }
15129
- eg.skipBits(1);
15130
- }
15131
- }
15132
- if (vcl_hrd_parameters_present_flag) {
15133
- for (let j = 0; j < cpb_cnt; j++) {
15134
- eg.readUEG();
15135
- eg.readUEG();
15136
- if (sub_pic_hrd_params_present_flag) {
15137
- eg.readUEG();
15138
- eg.readUEG();
15139
- }
15140
- eg.skipBits(1);
15141
- }
15142
- }
15143
- }
15144
- }
15145
- }
15146
- const bitstream_restriction_flag = eg.readBoolean();
15147
- if (bitstream_restriction_flag) {
15148
- eg.readBoolean(); // tiles_fixed_structure_flag
15149
- eg.readBoolean(); // motion_vectors_over_pic_boundaries_flag
15150
- eg.readBoolean(); // restricted_ref_pic_lists_flag
15151
- min_spatial_segmentation_idc = eg.readUEG();
15152
- }
15153
- }
15154
- let width = pic_width_in_luma_samples,
15155
- height = pic_height_in_luma_samples;
15156
- if (conformance_window_flag || default_display_window_flag) {
15157
- let chroma_scale_w = 1,
15158
- chroma_scale_h = 1;
15159
- if (chroma_format_idc === 1) {
15160
- // YUV 420
15161
- chroma_scale_w = chroma_scale_h = 2;
15162
- } else if (chroma_format_idc == 2) {
15163
- // YUV 422
15164
- chroma_scale_w = 2;
15165
- }
15166
- width = pic_width_in_luma_samples - chroma_scale_w * pic_right_offset - chroma_scale_w * pic_left_offset;
15167
- height = pic_height_in_luma_samples - chroma_scale_h * pic_bottom_offset - chroma_scale_h * pic_top_offset;
15168
- }
15169
- const profile_space_string = general_profile_space ? ['A', 'B', 'C'][general_profile_space] : '';
15170
- const profile_compatibility_buf = general_profile_compatibility_flags_1 << 24 | general_profile_compatibility_flags_2 << 16 | general_profile_compatibility_flags_3 << 8 | general_profile_compatibility_flags_4;
15171
- let profile_compatibility_rev = 0;
15172
- for (let i = 0; i < 32; i++) {
15173
- profile_compatibility_rev = (profile_compatibility_rev | (profile_compatibility_buf >> i & 1) << 31 - i) >>> 0; // reverse bit position (and cast as UInt32)
15174
- }
15175
- let profile_compatibility_flags_string = profile_compatibility_rev.toString(16);
15176
- if (general_profile_idc === 1 && profile_compatibility_flags_string === '2') {
15177
- profile_compatibility_flags_string = '6';
15178
- }
15179
- const tier_flag_string = general_tier_flag ? 'H' : 'L';
15180
- return {
15181
- codecString: `hvc1.${profile_space_string}${general_profile_idc}.${profile_compatibility_flags_string}.${tier_flag_string}${general_level_idc}.B0`,
15182
- params: {
15183
- general_tier_flag,
15184
- general_profile_idc,
15185
- general_profile_space,
15186
- general_profile_compatibility_flags: [general_profile_compatibility_flags_1, general_profile_compatibility_flags_2, general_profile_compatibility_flags_3, general_profile_compatibility_flags_4],
15187
- general_constraint_indicator_flags: [general_constraint_indicator_flags_1, general_constraint_indicator_flags_2, general_constraint_indicator_flags_3, general_constraint_indicator_flags_4, general_constraint_indicator_flags_5, general_constraint_indicator_flags_6],
15188
- general_level_idc,
15189
- bit_depth: bit_depth_luma_minus8 + 8,
15190
- bit_depth_luma_minus8,
15191
- bit_depth_chroma_minus8,
15192
- min_spatial_segmentation_idc,
15193
- chroma_format_idc: chroma_format_idc,
15194
- frame_rate: {
15195
- fixed: fps_fixed,
15196
- fps: fps_num / fps_den
15197
- }
15198
- },
15199
- width,
15200
- height,
15201
- pixelRatio: [sar_width, sar_height]
15202
- };
15203
- }
15204
- readPPS(pps) {
15205
- const eg = new ExpGolomb(this.ebsp2rbsp(pps));
15206
- eg.readUByte();
15207
- eg.readUByte();
15208
- eg.skipUEG(); // pic_parameter_set_id
15209
- eg.skipUEG(); // seq_parameter_set_id
15210
- eg.skipBits(2); // dependent_slice_segments_enabled_flag, output_flag_present_flag
15211
- eg.skipBits(3); // num_extra_slice_header_bits
15212
- eg.skipBits(2); // sign_data_hiding_enabled_flag, cabac_init_present_flag
15213
- eg.skipUEG();
15214
- eg.skipUEG();
15215
- eg.skipEG(); // init_qp_minus26
15216
- eg.skipBits(2); // constrained_intra_pred_flag, transform_skip_enabled_flag
15217
- const cu_qp_delta_enabled_flag = eg.readBoolean();
15218
- if (cu_qp_delta_enabled_flag) {
15219
- eg.skipUEG();
15220
- }
15221
- eg.skipEG(); // cb_qp_offset
15222
- eg.skipEG(); // cr_qp_offset
15223
- eg.skipBits(4); // pps_slice_chroma_qp_offsets_present_flag, weighted_pred_flag, weighted_bipred_flag, transquant_bypass_enabled_flag
15224
- const tiles_enabled_flag = eg.readBoolean();
15225
- const entropy_coding_sync_enabled_flag = eg.readBoolean();
15226
- let parallelismType = 1; // slice-based parallel decoding
15227
- if (entropy_coding_sync_enabled_flag && tiles_enabled_flag) {
15228
- parallelismType = 0; // mixed-type parallel decoding
15229
- } else if (entropy_coding_sync_enabled_flag) {
15230
- parallelismType = 3; // wavefront-based parallel decoding
15231
- } else if (tiles_enabled_flag) {
15232
- parallelismType = 2; // tile-based parallel decoding
15233
- }
15234
- return {
15235
- parallelismType
15236
- };
15237
- }
15238
- matchSPS(sps1, sps2) {
15239
- // compare without headers and VPS related params
15240
- return String.fromCharCode.apply(null, sps1).substr(3) === String.fromCharCode.apply(null, sps2).substr(3);
15241
- }
15242
- }
15243
-
15244
14651
  /**
15245
14652
  * SAMPLE-AES decrypter
15246
14653
  */
@@ -15539,9 +14946,6 @@ class TSDemuxer {
15539
14946
  case 'avc':
15540
14947
  this.videoParser = new AvcVideoParser();
15541
14948
  break;
15542
- case 'hevc':
15543
- this.videoParser = new HevcVideoParser();
15544
- break;
15545
14949
  }
15546
14950
  }
15547
14951
  if (this.videoParser !== null) {
@@ -15713,9 +15117,6 @@ class TSDemuxer {
15713
15117
  case 'avc':
15714
15118
  this.videoParser = new AvcVideoParser();
15715
15119
  break;
15716
- case 'hevc':
15717
- this.videoParser = new HevcVideoParser();
15718
- break;
15719
15120
  }
15720
15121
  }
15721
15122
  if (this.videoParser !== null) {
@@ -16025,10 +15426,8 @@ function parsePMT(data, offset, typeSupported, isSampleAes) {
16025
15426
  break;
16026
15427
  case 0x24:
16027
15428
  // ITU-T Rec. H.265 and ISO/IEC 23008-2 (HEVC)
16028
- if (result.videoPid === -1) {
16029
- result.videoPid = pid;
16030
- result.segmentVideoCodec = 'hevc';
16031
- logger.log('HEVC in M2TS found');
15429
+ {
15430
+ logger.warn('Unsupported HEVC in M2TS found');
16032
15431
  }
16033
15432
  break;
16034
15433
  }
@@ -20524,7 +19923,7 @@ class Hls {
20524
19923
  * Get the video-dev/hls.js package version.
20525
19924
  */
20526
19925
  static get version() {
20527
- return "1.5.5-0.canary.9977";
19926
+ return "1.5.5-0.canary.9978";
20528
19927
  }
20529
19928
 
20530
19929
  /**
@@ -21338,5 +20737,5 @@ var KeySystemFormats = empty.KeySystemFormats;
21338
20737
  var KeySystems = empty.KeySystems;
21339
20738
  var SubtitleStreamController = empty.SubtitleStreamController;
21340
20739
  var TimelineController = empty.TimelineController;
21341
- export { AbrController, AttrList, Cues as AudioStreamController, Cues as AudioTrackController, BasePlaylistController, BaseSegment, BaseStreamController, BufferController, Cues as CMCDController, CapLevelController, ChunkMetadata, ContentSteeringController, DateRange, Cues as EMEController, ErrorActionFlags, ErrorController, ErrorDetails, ErrorTypes, Events, FPSController, Fragment, Hls, HlsSkip, HlsUrlParameters, KeySystemFormats, KeySystems, Level, LevelDetails, LevelKey, LoadStats, MetadataSchema, NetworkErrorAction, Part, PlaylistLevelType, SubtitleStreamController, Cues as SubtitleTrackController, TimelineController, Hls as default, getMediaSource, isMSESupported, isSupported };
20740
+ export { AbrController, AttrList, HevcVideoParser as AudioStreamController, HevcVideoParser as AudioTrackController, BasePlaylistController, BaseSegment, BaseStreamController, BufferController, HevcVideoParser as CMCDController, CapLevelController, ChunkMetadata, ContentSteeringController, DateRange, HevcVideoParser as EMEController, ErrorActionFlags, ErrorController, ErrorDetails, ErrorTypes, Events, FPSController, Fragment, Hls, HlsSkip, HlsUrlParameters, KeySystemFormats, KeySystems, Level, LevelDetails, LevelKey, LoadStats, MetadataSchema, NetworkErrorAction, Part, PlaylistLevelType, SubtitleStreamController, HevcVideoParser as SubtitleTrackController, TimelineController, Hls as default, getMediaSource, isMSESupported, isSupported };
21342
20741
  //# sourceMappingURL=hls.light.mjs.map