shaka-player 4.3.9 → 4.4.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/.github/workflows/build-and-test.yaml +11 -18
- package/.github/workflows/compute-incremental-coverage.py +3 -0
- package/.github/workflows/release-please.yaml +7 -0
- package/.github/workflows/selenium-lab-tests.yaml +45 -10
- package/AUTHORS +9 -0
- package/CHANGELOG.md +295 -190
- package/CONTRIBUTORS +8 -0
- package/LICENSE +32 -0
- package/README.md +63 -10
- package/demo/autoTemplate.txt +40 -5
- package/demo/close_button.js +11 -0
- package/demo/common/asset.js +13 -1
- package/demo/common/assets.js +112 -28
- package/demo/common/message_ids.js +25 -1
- package/demo/config.js +69 -10
- package/demo/customWarning.txt +2 -2
- package/demo/index.html +3 -1
- package/demo/locales/en.json +26 -2
- package/demo/locales/source.json +105 -9
- package/demo/main.js +57 -9
- package/demo/search.js +3 -1
- package/demo/service_worker.js +3 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +132 -118
- package/dist/demo.compiled.debug.map +3 -3
- package/dist/demo.compiled.js +132 -118
- package/dist/demo.compiled.map +3 -3
- package/dist/deps.js +46 -28
- package/dist/locales.js +31 -31
- package/dist/receiver.compiled.debug.js +60 -52
- package/dist/receiver.compiled.debug.map +3 -3
- package/dist/receiver.compiled.js +60 -52
- package/dist/receiver.compiled.map +3 -3
- package/dist/shaka-player.compiled.d.ts +676 -391
- package/dist/shaka-player.compiled.debug.d.ts +676 -391
- package/dist/shaka-player.compiled.debug.externs.js +1188 -616
- package/dist/shaka-player.compiled.debug.js +1046 -700
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +1188 -616
- package/dist/shaka-player.compiled.js +1094 -933
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +677 -392
- package/dist/shaka-player.ui.debug.d.ts +677 -392
- package/dist/shaka-player.ui.debug.externs.js +1023 -451
- package/dist/shaka-player.ui.debug.js +1101 -738
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +1023 -451
- package/dist/shaka-player.ui.js +1244 -1071
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/ad_monetization.md +15 -1
- package/docs/tutorials/application-level-redirects.md +1 -1
- package/docs/tutorials/config.md +9 -5
- package/docs/tutorials/drm-config.md +61 -0
- package/docs/tutorials/fairplay.md +19 -4
- package/docs/tutorials/license-server-auth.md +4 -4
- package/docs/tutorials/license-wrapping.md +2 -2
- package/docs/tutorials/ui-customization.md +7 -3
- package/docs/tutorials/ui.md +7 -7
- package/docs/tutorials/upgrade.md +3 -0
- package/externs/ima.js +123 -2
- package/externs/isoboxer.js +217 -0
- package/externs/mediakeys.js +18 -0
- package/externs/mux.js +1 -105
- package/externs/pictureinpicture.js +48 -0
- package/externs/shaka/ads.js +61 -1
- package/externs/shaka/cea.js +110 -0
- package/externs/shaka/codecs.js +32 -0
- package/externs/shaka/manifest.js +101 -1
- package/externs/shaka/manifest_parser.js +0 -10
- package/externs/shaka/net.js +36 -7
- package/externs/shaka/offline.js +8 -1
- package/externs/shaka/player.js +220 -21
- package/externs/shaka/text.js +1 -382
- package/externs/shaka/transmuxer.js +59 -0
- package/karma.conf.js +15 -0
- package/lib/abr/simple_abr_manager.js +6 -3
- package/lib/ads/ad_manager.js +60 -2
- package/lib/ads/client_side_ad.js +86 -0
- package/lib/ads/client_side_ad_manager.js +93 -5
- package/lib/ads/server_side_ad.js +86 -0
- package/lib/ads/server_side_ad_manager.js +13 -0
- package/lib/cast/cast_utils.js +1 -0
- package/lib/cea/cea608_data_channel.js +24 -14
- package/lib/cea/cea608_memory.js +5 -2
- package/lib/cea/cea708_service.js +8 -9
- package/lib/cea/cea708_window.js +1 -2
- package/lib/cea/cea_decoder.js +23 -6
- package/lib/cea/cea_utils.js +25 -2
- package/lib/cea/dummy_caption_decoder.js +21 -0
- package/lib/cea/dummy_cea_parser.js +1 -3
- package/lib/cea/mp4_cea_parser.js +15 -10
- package/lib/cea/ts_cea_parser.js +69 -0
- package/lib/dash/content_protection.js +32 -2
- package/lib/dash/dash_parser.js +93 -31
- package/lib/dash/mpd_utils.js +6 -25
- package/lib/dash/segment_base.js +12 -14
- package/lib/dash/segment_list.js +10 -6
- package/lib/dash/segment_template.js +349 -32
- package/lib/dependencies/all.js +8 -0
- package/lib/hls/hls_classes.js +33 -8
- package/lib/hls/hls_parser.js +805 -191
- package/lib/hls/manifest_text_parser.js +4 -14
- package/lib/media/adaptation_set_criteria.js +43 -3
- package/lib/media/closed_caption_parser.js +74 -12
- package/lib/media/drm_engine.js +189 -49
- package/lib/media/gap_jumping_controller.js +1 -1
- package/lib/media/manifest_parser.js +34 -0
- package/lib/media/media_source_capabilities.js +10 -0
- package/lib/media/media_source_engine.js +475 -231
- package/lib/media/playhead.js +1 -1
- package/lib/media/presentation_timeline.js +62 -0
- package/lib/media/segment_index.js +50 -14
- package/lib/media/segment_prefetch.js +277 -0
- package/lib/media/segment_reference.js +70 -4
- package/lib/media/streaming_engine.js +258 -81
- package/lib/media/video_wrapper.js +15 -7
- package/lib/mss/content_protection.js +353 -0
- package/lib/mss/mss_parser.js +1081 -0
- package/lib/net/networking_engine.js +60 -10
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/manifest_converter.js +6 -0
- package/lib/offline/storage.js +2 -4
- package/lib/player.js +309 -105
- package/lib/polyfill/media_capabilities.js +43 -3
- package/lib/polyfill/patchedmediakeys_apple.js +5 -0
- package/lib/polyfill/patchedmediakeys_nop.js +5 -0
- package/lib/polyfill/patchedmediakeys_webkit.js +5 -0
- package/lib/text/cue.js +208 -130
- package/lib/text/lrc_text_parser.js +2 -2
- package/lib/text/mp4_vtt_parser.js +2 -2
- package/lib/text/sbv_text_parser.js +1 -1
- package/lib/text/simple_text_displayer.js +2 -1
- package/lib/text/srt_text_parser.js +9 -1
- package/lib/text/ssa_text_parser.js +2 -2
- package/lib/text/text_engine.js +3 -21
- package/lib/text/text_utils.js +71 -20
- package/lib/text/ui_text_displayer.js +14 -14
- package/lib/text/vtt_text_parser.js +22 -14
- package/lib/transmuxer/aac_transmuxer.js +224 -0
- package/lib/transmuxer/ac3.js +142 -0
- package/lib/transmuxer/ac3_transmuxer.js +212 -0
- package/lib/transmuxer/adts.js +232 -0
- package/lib/transmuxer/ec3.js +103 -0
- package/lib/transmuxer/ec3_transmuxer.js +212 -0
- package/lib/transmuxer/h264.js +324 -0
- package/lib/transmuxer/mp3_transmuxer.js +204 -0
- package/lib/transmuxer/mpeg_audio.js +196 -0
- package/lib/transmuxer/mpeg_ts_transmuxer.js +182 -0
- package/lib/transmuxer/mss_transmuxer.js +389 -0
- package/lib/{media/transmuxer.js → transmuxer/muxjs_transmuxer.js} +34 -80
- package/lib/transmuxer/transmuxer_engine.js +161 -0
- package/lib/transmuxer/ts_transmuxer.js +738 -0
- package/lib/util/cmcd_manager.js +131 -71
- package/lib/util/error.js +62 -26
- package/lib/util/exp_golomb.js +220 -0
- package/lib/util/fairplay_utils.js +64 -13
- package/lib/util/id3_utils.js +56 -3
- package/lib/util/language_utils.js +11 -8
- package/lib/util/manifest_parser_utils.js +3 -0
- package/lib/util/mime_utils.js +44 -7
- package/lib/util/mp4_box_parsers.js +233 -5
- package/lib/util/mp4_generator.js +1381 -0
- package/lib/util/periods.js +40 -34
- package/lib/util/platform.js +25 -3
- package/lib/util/player_configuration.js +38 -1
- package/lib/util/stream_utils.js +138 -27
- package/lib/util/text_parser.js +1 -1
- package/lib/util/ts_parser.js +470 -47
- package/lib/util/xml_utils.js +16 -3
- package/maintained-branches.md +2 -2
- package/package.json +4 -2
- package/roadmap.md +21 -6
- package/shaka-player.uncompiled.js +18 -0
- package/test/abr/simple_abr_manager_unit.js +32 -4
- package/test/ads/ad_manager_unit.js +18 -2
- package/test/cast/cast_utils_unit.js +7 -2
- package/test/cea/cea608_memory_unit.js +24 -0
- package/test/cea/cea_decoder_unit.js +33 -0
- package/test/dash/dash_parser_content_protection_unit.js +93 -3
- package/test/dash/dash_parser_live_unit.js +56 -13
- package/test/dash/dash_parser_manifest_unit.js +70 -2
- package/test/dash/dash_parser_segment_base_unit.js +14 -9
- package/test/dash/dash_parser_segment_template_unit.js +286 -6
- package/test/demo/demo_unit.js +5 -1
- package/test/hls/hls_live_unit.js +188 -28
- package/test/hls/hls_parser_unit.js +250 -109
- package/test/hls/manifest_text_parser_unit.js +18 -13
- package/test/media/adaptation_set_criteria_unit.js +46 -14
- package/test/media/adaptation_set_unit.js +2 -0
- package/test/media/drm_engine_integration.js +11 -8
- package/test/media/drm_engine_unit.js +220 -7
- package/test/media/media_source_engine_integration.js +122 -38
- package/test/media/media_source_engine_unit.js +133 -153
- package/test/media/playhead_unit.js +3 -0
- package/test/media/presentation_timeline_unit.js +51 -0
- package/test/media/segment_index_unit.js +52 -0
- package/test/media/segment_prefetch_unit.js +243 -0
- package/test/media/streaming_engine_integration.js +9 -3
- package/test/media/streaming_engine_unit.js +440 -59
- package/test/mss/mss_parser_content_protection_unit.js +49 -0
- package/test/mss/mss_parser_unit.js +472 -0
- package/test/mss/mss_player_integration.js +123 -0
- package/test/offline/manifest_convert_unit.js +9 -0
- package/test/offline/storage_integration.js +6 -1
- package/test/player_integration.js +4 -1
- package/test/player_unit.js +386 -133
- package/test/polyfill/media_capabilities_unit.js +18 -0
- package/test/test/assets/hls-raw-aac/fileSequence0.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence1.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence2.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence3.aac +0 -0
- package/test/test/assets/hls-raw-aac/manifest.m3u8 +4 -0
- package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +14 -0
- package/test/test/assets/hls-raw-ac3/fileSequence0.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence1.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence2.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence3.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence4.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence5.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence6.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence7.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/prog_index.m3u8 +31 -0
- package/test/test/assets/hls-raw-ec3/fileSequence0.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence1.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence2.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence3.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence4.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence5.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence6.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence7.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/prog_index.m3u8 +31 -0
- package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +13 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_0.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_1.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_2.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_3.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/playlist.m3u8 +4 -0
- package/test/test/assets/hls-ts-aac/playlist.m3u8 +23 -0
- package/test/test/assets/hls-ts-aac/segment_0.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_1.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_2.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_3.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_4.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_5.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_6.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_7.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0004.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0005.ts +0 -0
- package/test/test/assets/hls-ts-ac3/prog_index.m3u8 +19 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0004.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0005.ts +0 -0
- package/test/test/assets/hls-ts-ec3/prog_index.m3u8 +19 -0
- package/test/test/assets/hls-ts-h264/fileSequence0.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence1.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence2.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence3.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence4.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence5.ts +0 -0
- package/test/test/assets/hls-ts-h264/prog_index.m3u8 +25 -0
- package/test/test/assets/hls-ts-mp3/manifest.m3u8 +13 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_0.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_1.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_2.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_3.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8 +17 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_0_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_1_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_2_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_3_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_4_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_5_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8 +4 -0
- package/test/test/boot.js +7 -2
- package/test/test/util/fake_ad.js +99 -0
- package/test/test/util/fake_ad_manager.js +7 -1
- package/test/test/util/fake_networking_engine.js +41 -14
- package/test/test/util/fake_segment_prefetch.js +81 -0
- package/test/test/util/manifest_generator.js +19 -5
- package/test/test/util/mss_parser_util.js +115 -0
- package/test/test/util/offline_utils.js +1 -0
- package/test/test/util/simple_fakes.js +12 -3
- package/test/test/util/streaming_engine_util.js +14 -4
- package/test/test/util/ttml_utils.js +2 -2
- package/test/test/util/ui_utils.js +5 -1
- package/test/text/cue_integration.js +1 -1
- package/test/text/srt_text_parser_unit.js +78 -0
- package/test/text/text_engine_unit.js +17 -8
- package/test/text/ui_text_displayer_unit.js +4 -4
- package/test/text/vtt_text_parser_unit.js +59 -40
- package/test/text/web_vtt_generator_unit.js +9 -3
- package/test/{media/transmuxer_integration.js → transmuxer/muxjs_transmuxer_integration.js} +30 -33
- package/test/transmuxer/transmuxer_engine_integration.js +60 -0
- package/test/transmuxer/transmuxer_integration.js +296 -0
- package/test/util/cmcd_manager_unit.js +162 -13
- package/test/util/language_utils_unit.js +9 -2
- package/test/util/mp4_box_parsers_unit.js +39 -4
- package/test/util/periods_unit.js +34 -26
- package/test/util/stream_utils_unit.js +60 -107
- package/ui/controls.js +19 -1
- package/ui/controls.less +1 -0
- package/ui/externs/ui.js +13 -3
- package/ui/language_utils.js +15 -0
- package/ui/less/thumbnails.less +26 -0
- package/ui/locales/oc.json +42 -0
- package/ui/pip_button.js +83 -2
- package/ui/range_element.js +15 -0
- package/ui/resolution_selection.js +9 -2
- package/ui/seek_bar.js +230 -1
- package/ui/ui.js +5 -0
- package/lib/cea/i_caption_decoder.js +0 -51
- package/lib/cea/i_cea_parser.js +0 -68
package/lib/cea/cea_decoder.js
CHANGED
|
@@ -9,16 +9,17 @@ goog.provide('shaka.cea.CeaDecoder');
|
|
|
9
9
|
goog.require('shaka.cea.Cea608DataChannel');
|
|
10
10
|
goog.require('shaka.cea.Cea708Service');
|
|
11
11
|
goog.require('shaka.cea.DtvccPacketBuilder');
|
|
12
|
-
goog.require('shaka.cea.ICaptionDecoder');
|
|
13
12
|
goog.require('shaka.log');
|
|
13
|
+
goog.require('shaka.media.ClosedCaptionParser');
|
|
14
14
|
goog.require('shaka.util.DataViewReader');
|
|
15
15
|
goog.require('shaka.util.Error');
|
|
16
16
|
goog.requireType('shaka.cea.DtvccPacket');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* CEA-X08 captions decoder.
|
|
21
|
-
* @implements {shaka.
|
|
20
|
+
* CEA-X08 captions decoder.
|
|
21
|
+
* @implements {shaka.extern.ICaptionDecoder}
|
|
22
|
+
* @export
|
|
22
23
|
*/
|
|
23
24
|
shaka.cea.CeaDecoder = class {
|
|
24
25
|
/** */
|
|
@@ -77,6 +78,11 @@ shaka.cea.CeaDecoder = class {
|
|
|
77
78
|
*/
|
|
78
79
|
this.serviceNumberToService_ = new Map();
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @private {boolean}
|
|
83
|
+
*/
|
|
84
|
+
this.waitingForFirstPacket_ = true;
|
|
85
|
+
|
|
80
86
|
this.reset();
|
|
81
87
|
}
|
|
82
88
|
|
|
@@ -106,6 +112,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
106
112
|
for (const stream of this.cea608ModeToStream_.values()) {
|
|
107
113
|
stream.reset();
|
|
108
114
|
}
|
|
115
|
+
this.waitingForFirstPacket_ = true;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
/**
|
|
@@ -114,6 +121,13 @@ shaka.cea.CeaDecoder = class {
|
|
|
114
121
|
* @override
|
|
115
122
|
*/
|
|
116
123
|
extract(userDataSeiMessage, pts) {
|
|
124
|
+
if (this.waitingForFirstPacket_) {
|
|
125
|
+
for (const stream of this.cea608ModeToStream_.values()) {
|
|
126
|
+
stream.firstPts(pts);
|
|
127
|
+
}
|
|
128
|
+
this.waitingForFirstPacket_ = false;
|
|
129
|
+
}
|
|
130
|
+
|
|
117
131
|
const reader = new shaka.util.DataViewReader(
|
|
118
132
|
userDataSeiMessage, shaka.util.DataViewReader.Endianness.BIG_ENDIAN);
|
|
119
133
|
|
|
@@ -195,7 +209,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
195
209
|
* @override
|
|
196
210
|
*/
|
|
197
211
|
decode() {
|
|
198
|
-
/** @type {!Array.<!shaka.
|
|
212
|
+
/** @type {!Array.<!shaka.extern.ICaptionDecoder.ClosedCaption>} */
|
|
199
213
|
const parsedClosedCaptions = [];
|
|
200
214
|
|
|
201
215
|
// In some versions of Chrome, and other browsers, the default sorting
|
|
@@ -237,7 +251,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
237
251
|
/**
|
|
238
252
|
* Decodes a CEA-608 closed caption packet based on ANSI/CEA-608.
|
|
239
253
|
* @param {shaka.cea.Cea608DataChannel.Cea608Packet} ccPacket
|
|
240
|
-
* @return {?shaka.
|
|
254
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
241
255
|
* @private
|
|
242
256
|
*/
|
|
243
257
|
decodeCea608_(ccPacket) {
|
|
@@ -302,7 +316,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
302
316
|
/**
|
|
303
317
|
* Decodes a CEA-708 DTVCC packet based on ANSI/CTA-708-E.
|
|
304
318
|
* @param {shaka.cea.DtvccPacket} dtvccPacket
|
|
305
|
-
* @return {!Array<!shaka.
|
|
319
|
+
* @return {!Array<!shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
306
320
|
* @private
|
|
307
321
|
*/
|
|
308
322
|
decodeCea708_(dtvccPacket) {
|
|
@@ -402,3 +416,6 @@ shaka.cea.CeaDecoder.NTSC_CC_FIELD_2 = 1;
|
|
|
402
416
|
* @private @const {number}
|
|
403
417
|
*/
|
|
404
418
|
shaka.cea.CeaDecoder.USA_COUNTRY_CODE = 0xb5;
|
|
419
|
+
|
|
420
|
+
shaka.media.ClosedCaptionParser.registerDecoder(
|
|
421
|
+
() => new shaka.cea.CeaDecoder());
|
package/lib/cea/cea_utils.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
goog.provide('shaka.cea.CeaUtils');
|
|
8
8
|
goog.provide('shaka.cea.CeaUtils.StyledChar');
|
|
9
9
|
|
|
10
|
-
goog.require('shaka.cea.ICaptionDecoder');
|
|
11
10
|
goog.require('shaka.text.Cue');
|
|
12
11
|
|
|
13
12
|
|
|
@@ -19,7 +18,7 @@ shaka.cea.CeaUtils = class {
|
|
|
19
18
|
* @param {!Array<!Array<?shaka.cea.CeaUtils.StyledChar>>} memory
|
|
20
19
|
* @param {number} startTime Start time of the cue.
|
|
21
20
|
* @param {number} endTime End time of the cue.
|
|
22
|
-
* @return {?shaka.
|
|
21
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
23
22
|
*/
|
|
24
23
|
static getParsedCaption(topLevelCue, stream, memory, startTime, endTime) {
|
|
25
24
|
if (startTime >= endTime) {
|
|
@@ -270,3 +269,27 @@ shaka.cea.CeaUtils.DEFAULT_BG_COLOR = 'black';
|
|
|
270
269
|
* @const {string}
|
|
271
270
|
*/
|
|
272
271
|
shaka.cea.CeaUtils.DEFAULT_TXT_COLOR = 'white';
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* NALU type for Supplemental Enhancement Information (SEI) for H.264.
|
|
275
|
+
* @const {number}
|
|
276
|
+
*/
|
|
277
|
+
shaka.cea.CeaUtils.H264_NALU_TYPE_SEI = 0x06;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* NALU type for Supplemental Enhancement Information (SEI) for H.265.
|
|
281
|
+
* @const {number}
|
|
282
|
+
*/
|
|
283
|
+
shaka.cea.CeaUtils.H265_PREFIX_NALU_TYPE_SEI = 0x27;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* NALU type for Supplemental Enhancement Information (SEI) for H.265.
|
|
287
|
+
* @const {number}
|
|
288
|
+
*/
|
|
289
|
+
shaka.cea.CeaUtils.H265_SUFFIX_NALU_TYPE_SEI = 0x28;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Default timescale value for a track.
|
|
293
|
+
* @const {number}
|
|
294
|
+
*/
|
|
295
|
+
shaka.cea.CeaUtils.DEFAULT_TIMESCALE_VALUE = 90000;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! @license
|
|
2
|
+
* Shaka Player
|
|
3
|
+
* Copyright 2016 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
goog.provide('shaka.cea.DummyCaptionDecoder');
|
|
8
|
+
|
|
9
|
+
/** @implements {shaka.extern.ICaptionDecoder} */
|
|
10
|
+
shaka.cea.DummyCaptionDecoder = class {
|
|
11
|
+
/** @override */
|
|
12
|
+
extract(userDataSeiMessage, pts) {}
|
|
13
|
+
|
|
14
|
+
/** @override */
|
|
15
|
+
decode() {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** @override */
|
|
20
|
+
clear() {}
|
|
21
|
+
};
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
goog.provide('shaka.cea.Mp4CeaParser');
|
|
8
8
|
|
|
9
9
|
goog.require('goog.asserts');
|
|
10
|
-
goog.require('shaka.cea.
|
|
10
|
+
goog.require('shaka.cea.CeaUtils');
|
|
11
11
|
goog.require('shaka.cea.SeiProcessor');
|
|
12
12
|
goog.require('shaka.log');
|
|
13
|
+
goog.require('shaka.media.ClosedCaptionParser');
|
|
13
14
|
goog.require('shaka.util.DataViewReader');
|
|
14
15
|
goog.require('shaka.util.Error');
|
|
15
16
|
goog.require('shaka.util.Mp4Parser');
|
|
@@ -17,7 +18,8 @@ goog.require('shaka.util.Mp4BoxParsers');
|
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* MPEG4 stream parser used for extracting 708 closed captions data.
|
|
20
|
-
* @implements {shaka.
|
|
21
|
+
* @implements {shaka.extern.ICeaParser}
|
|
22
|
+
* @export
|
|
21
23
|
*/
|
|
22
24
|
shaka.cea.Mp4CeaParser = class {
|
|
23
25
|
/** */
|
|
@@ -157,7 +159,7 @@ shaka.cea.Mp4CeaParser = class {
|
|
|
157
159
|
return [];
|
|
158
160
|
}
|
|
159
161
|
|
|
160
|
-
/** @type {!Array<!shaka.
|
|
162
|
+
/** @type {!Array<!shaka.extern.ICeaParser.CaptionPacket>} **/
|
|
161
163
|
const captionPackets = [];
|
|
162
164
|
|
|
163
165
|
// Fields that are found in MOOF boxes
|
|
@@ -167,7 +169,7 @@ shaka.cea.Mp4CeaParser = class {
|
|
|
167
169
|
/** @type {!Array<shaka.util.ParsedTRUNBox>} */
|
|
168
170
|
let parsedTRUNs = [];
|
|
169
171
|
let baseMediaDecodeTime = null;
|
|
170
|
-
let timescale = shaka.cea.
|
|
172
|
+
let timescale = shaka.cea.CeaUtils.DEFAULT_TIMESCALE_VALUE;
|
|
171
173
|
|
|
172
174
|
new Mp4Parser()
|
|
173
175
|
.box('moof', (box) => {
|
|
@@ -214,7 +216,7 @@ shaka.cea.Mp4CeaParser = class {
|
|
|
214
216
|
box.version != null,
|
|
215
217
|
'TFDT is a full box and should have a valid version.');
|
|
216
218
|
|
|
217
|
-
const parsedTFDT = shaka.util.Mp4BoxParsers.
|
|
219
|
+
const parsedTFDT = shaka.util.Mp4BoxParsers.parseTFDTInaccurate(
|
|
218
220
|
box.reader, box.version);
|
|
219
221
|
|
|
220
222
|
baseMediaDecodeTime = parsedTFDT.baseMediaDecodeTime;
|
|
@@ -250,13 +252,13 @@ shaka.cea.Mp4CeaParser = class {
|
|
|
250
252
|
* @param {number} defaultSampleSize
|
|
251
253
|
* @param {number} offset
|
|
252
254
|
* @param {!Array<shaka.util.ParsedTRUNBox>} parsedTRUNs
|
|
253
|
-
* @param {!Array<!shaka.
|
|
255
|
+
* @param {!Array<!shaka.extern.ICeaParser.CaptionPacket>} captionPackets
|
|
254
256
|
* @private
|
|
255
257
|
*/
|
|
256
258
|
parseMdat_(reader, time, timescale, defaultSampleDuration,
|
|
257
259
|
defaultSampleSize, offset, parsedTRUNs, captionPackets) {
|
|
258
260
|
const BitstreamFormat = shaka.cea.Mp4CeaParser.BitstreamFormat;
|
|
259
|
-
const
|
|
261
|
+
const CeaUtils = shaka.cea.CeaUtils;
|
|
260
262
|
let sampleIndex = 0;
|
|
261
263
|
|
|
262
264
|
// The fields in each ParsedTRUNSample contained in the sampleData
|
|
@@ -288,7 +290,7 @@ shaka.cea.Mp4CeaParser = class {
|
|
|
288
290
|
switch (this.bitstreamFormat_) {
|
|
289
291
|
case BitstreamFormat.H264:
|
|
290
292
|
naluType = naluHeader & 0x1f;
|
|
291
|
-
isSeiMessage = naluType ==
|
|
293
|
+
isSeiMessage = naluType == CeaUtils.H264_NALU_TYPE_SEI;
|
|
292
294
|
break;
|
|
293
295
|
|
|
294
296
|
case BitstreamFormat.H265:
|
|
@@ -296,8 +298,8 @@ shaka.cea.Mp4CeaParser = class {
|
|
|
296
298
|
reader.skip(1);
|
|
297
299
|
naluType = (naluHeader >> 1) & 0x3f;
|
|
298
300
|
isSeiMessage =
|
|
299
|
-
naluType ==
|
|
300
|
-
naluType ==
|
|
301
|
+
naluType == CeaUtils.H265_PREFIX_NALU_TYPE_SEI ||
|
|
302
|
+
naluType == CeaUtils.H265_SUFFIX_NALU_TYPE_SEI;
|
|
301
303
|
break;
|
|
302
304
|
|
|
303
305
|
default:
|
|
@@ -376,3 +378,6 @@ shaka.cea.Mp4CeaParser.CodecBitstreamMap_ = {
|
|
|
376
378
|
'dvh1': shaka.cea.Mp4CeaParser.BitstreamFormat.H265,
|
|
377
379
|
'dvhe': shaka.cea.Mp4CeaParser.BitstreamFormat.H265,
|
|
378
380
|
};
|
|
381
|
+
|
|
382
|
+
shaka.media.ClosedCaptionParser.registerParser('video/mp4',
|
|
383
|
+
() => new shaka.cea.Mp4CeaParser());
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*! @license
|
|
2
|
+
* Shaka Player
|
|
3
|
+
* Copyright 2016 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
goog.provide('shaka.cea.TsCeaParser');
|
|
8
|
+
|
|
9
|
+
goog.require('shaka.cea.CeaUtils');
|
|
10
|
+
goog.require('shaka.cea.SeiProcessor');
|
|
11
|
+
goog.require('shaka.media.ClosedCaptionParser');
|
|
12
|
+
goog.require('shaka.util.BufferUtils');
|
|
13
|
+
goog.require('shaka.util.TsParser');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* MPEG TS CEA parser.
|
|
17
|
+
* @implements {shaka.extern.ICeaParser}
|
|
18
|
+
* @export
|
|
19
|
+
*/
|
|
20
|
+
shaka.cea.TsCeaParser = class {
|
|
21
|
+
/** */
|
|
22
|
+
constructor() {
|
|
23
|
+
/**
|
|
24
|
+
* SEI data processor.
|
|
25
|
+
* @private
|
|
26
|
+
* @const {!shaka.cea.SeiProcessor}
|
|
27
|
+
*/
|
|
28
|
+
this.seiProcessor_ = new shaka.cea.SeiProcessor();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @override
|
|
33
|
+
*/
|
|
34
|
+
init(initSegment) {
|
|
35
|
+
// TS hasn't init segment
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @override
|
|
40
|
+
*/
|
|
41
|
+
parse(mediaSegment) {
|
|
42
|
+
const CeaUtils = shaka.cea.CeaUtils;
|
|
43
|
+
|
|
44
|
+
/** @type {!Array<!shaka.extern.ICeaParser.CaptionPacket>} **/
|
|
45
|
+
const captionPackets = [];
|
|
46
|
+
|
|
47
|
+
const uint8ArrayData = shaka.util.BufferUtils.toUint8(mediaSegment);
|
|
48
|
+
if (!shaka.util.TsParser.probe(uint8ArrayData)) {
|
|
49
|
+
return captionPackets;
|
|
50
|
+
}
|
|
51
|
+
const tsParser = new shaka.util.TsParser().parse(uint8ArrayData);
|
|
52
|
+
const videoNalus = tsParser.getVideoNalus();
|
|
53
|
+
for (const nalu of videoNalus) {
|
|
54
|
+
if (nalu.type == CeaUtils.H264_NALU_TYPE_SEI &&
|
|
55
|
+
nalu.time != null) {
|
|
56
|
+
for (const packet of this.seiProcessor_.process(nalu.data)) {
|
|
57
|
+
captionPackets.push({
|
|
58
|
+
packet: packet,
|
|
59
|
+
pts: nalu.time,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return captionPackets;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
shaka.media.ClosedCaptionParser.registerParser('video/mp2t',
|
|
69
|
+
() => new shaka.cea.TsCeaParser());
|
|
@@ -166,12 +166,19 @@ shaka.dash.ContentProtection = class {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* Gets a Widevine license URL from a content protection element
|
|
169
|
-
* containing a custom `ms:laurl`
|
|
169
|
+
* containing a custom `ms:laurl` or 'dashif:Laurl' elements
|
|
170
170
|
*
|
|
171
171
|
* @param {shaka.dash.ContentProtection.Element} element
|
|
172
172
|
* @return {string}
|
|
173
173
|
*/
|
|
174
174
|
static getWidevineLicenseUrl(element) {
|
|
175
|
+
const dashIfLaurlNode = shaka.util.XmlUtils.findChildNS(
|
|
176
|
+
element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
|
|
177
|
+
'Laurl',
|
|
178
|
+
);
|
|
179
|
+
if (dashIfLaurlNode && dashIfLaurlNode.textContent) {
|
|
180
|
+
return dashIfLaurlNode.textContent;
|
|
181
|
+
}
|
|
175
182
|
const mslaurlNode = shaka.util.XmlUtils.findChildNS(
|
|
176
183
|
element.node, 'urn:microsoft', 'laurl');
|
|
177
184
|
if (mslaurlNode) {
|
|
@@ -182,12 +189,19 @@ shaka.dash.ContentProtection = class {
|
|
|
182
189
|
|
|
183
190
|
/**
|
|
184
191
|
* Gets a ClearKey license URL from a content protection element
|
|
185
|
-
* containing a custom `clearkey::Laurl`
|
|
192
|
+
* containing a custom `clearkey::Laurl` or 'dashif:Laurl' elements
|
|
186
193
|
*
|
|
187
194
|
* @param {shaka.dash.ContentProtection.Element} element
|
|
188
195
|
* @return {string}
|
|
189
196
|
*/
|
|
190
197
|
static getClearKeyLicenseUrl(element) {
|
|
198
|
+
const dashIfLaurlNode = shaka.util.XmlUtils.findChildNS(
|
|
199
|
+
element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
|
|
200
|
+
'Laurl',
|
|
201
|
+
);
|
|
202
|
+
if (dashIfLaurlNode && dashIfLaurlNode.textContent) {
|
|
203
|
+
return dashIfLaurlNode.textContent;
|
|
204
|
+
}
|
|
191
205
|
const clearKeyLaurlNode = shaka.util.XmlUtils.findChildNS(
|
|
192
206
|
element.node, shaka.dash.ContentProtection.ClearKeyNamespaceUri_,
|
|
193
207
|
'Laurl',
|
|
@@ -307,6 +321,14 @@ shaka.dash.ContentProtection = class {
|
|
|
307
321
|
* @return {string}
|
|
308
322
|
*/
|
|
309
323
|
static getPlayReadyLicenseUrl(element) {
|
|
324
|
+
const dashIfLaurlNode = shaka.util.XmlUtils.findChildNS(
|
|
325
|
+
element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
|
|
326
|
+
'Laurl',
|
|
327
|
+
);
|
|
328
|
+
if (dashIfLaurlNode && dashIfLaurlNode.textContent) {
|
|
329
|
+
return dashIfLaurlNode.textContent;
|
|
330
|
+
}
|
|
331
|
+
|
|
310
332
|
const proNode = shaka.util.XmlUtils.findChildNS(
|
|
311
333
|
element.node, 'urn:microsoft:playready', 'pro');
|
|
312
334
|
|
|
@@ -657,3 +679,11 @@ shaka.dash.ContentProtection.ClearKeyNamespaceUri_ =
|
|
|
657
679
|
*/
|
|
658
680
|
shaka.dash.ContentProtection.ClearKeySchemeUri_ =
|
|
659
681
|
'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e';
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* @const {string}
|
|
686
|
+
* @private
|
|
687
|
+
*/
|
|
688
|
+
shaka.dash.ContentProtection.DashIfNamespaceUri_ =
|
|
689
|
+
'https://dashif.org/CPS';
|