shaka-player 4.12.9 → 4.13.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/AUTHORS +1 -0
- package/CONTRIBUTORS +4 -0
- package/README.md +22 -21
- package/cspell.config.yaml +18 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +29 -24
- package/dist/locales.js +36 -36
- package/dist/shaka-player.compiled.d.ts +131 -36
- package/dist/shaka-player.compiled.debug.d.ts +131 -36
- package/dist/shaka-player.compiled.debug.externs.js +355 -107
- package/dist/shaka-player.compiled.debug.js +799 -742
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +355 -107
- package/dist/shaka-player.compiled.js +1456 -1423
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +165 -38
- package/dist/shaka-player.ui.debug.d.ts +165 -38
- package/dist/shaka-player.ui.debug.externs.js +394 -113
- package/dist/shaka-player.ui.debug.js +808 -738
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +394 -113
- package/dist/shaka-player.ui.js +1671 -1632
- package/dist/shaka-player.ui.map +4 -4
- package/eslint.config.mjs +343 -0
- package/externs/airplay.js +1 -1
- package/externs/audiotrack.js +1 -1
- package/externs/awesomplete.js +1 -1
- package/externs/cast-sdk-v2.js +2 -2
- package/externs/cmcd.js +16 -1
- package/externs/device_sensor_event.js +1 -1
- package/externs/ima.js +8 -8
- package/externs/isoboxer.js +31 -31
- package/externs/jwk_set.js +1 -1
- package/externs/lcevc.js +8 -8
- package/externs/mediakeys.js +1 -1
- package/externs/mediasession.js +3 -2
- package/externs/mediatailor.js +18 -18
- package/externs/pictureinpicture.js +41 -1
- package/externs/playstation.js +2 -2
- package/externs/prefixed_eme.js +1 -1
- package/externs/shaka/abortable.js +4 -4
- package/externs/shaka/abr_manager.js +1 -1
- package/externs/shaka/ads.js +45 -6
- package/externs/shaka/cea.js +2 -2
- package/externs/shaka/codecs.js +4 -4
- package/externs/shaka/drm_info.js +6 -6
- package/externs/shaka/error.js +5 -5
- package/externs/shaka/manifest.js +51 -56
- package/externs/shaka/manifest_parser.js +3 -9
- package/externs/shaka/net.js +23 -20
- package/externs/shaka/offline.js +37 -37
- package/externs/shaka/offline_compat_v1.js +10 -10
- package/externs/shaka/offline_compat_v2.js +10 -10
- package/externs/shaka/player.js +137 -108
- package/externs/shaka/text.js +3 -3
- package/externs/shaka/transmuxer.js +1 -1
- package/externs/videotrack.js +1 -1
- package/lib/abr/ewma.js +1 -1
- package/lib/abr/simple_abr_manager.js +70 -22
- package/lib/ads/ad_manager.js +43 -18
- package/lib/ads/ad_utils.js +160 -58
- package/lib/ads/ads_stats.js +1 -1
- package/lib/ads/client_side_ad_manager.js +2 -2
- package/lib/ads/interstitial_ad.js +16 -11
- package/lib/ads/interstitial_ad_manager.js +419 -72
- package/lib/ads/interstitial_static_ad.js +299 -0
- package/lib/ads/media_tailor_ad.js +1 -0
- package/lib/ads/media_tailor_ad_manager.js +37 -36
- package/lib/ads/server_side_ad_manager.js +7 -6
- package/lib/cast/cast_receiver.js +5 -3
- package/lib/cast/cast_sender.js +2 -2
- package/lib/cast/cast_utils.js +20 -13
- package/lib/cea/cea608_data_channel.js +53 -53
- package/lib/cea/cea708_service.js +34 -24
- package/lib/cea/cea708_window.js +5 -2
- package/lib/cea/cea_decoder.js +5 -7
- package/lib/cea/mp4_cea_parser.js +1 -1
- package/lib/cea/sei_processor.js +1 -1
- package/lib/dash/content_protection.js +62 -192
- package/lib/dash/dash_parser.js +98 -108
- package/lib/dash/mpd_utils.js +14 -13
- package/lib/dash/segment_base.js +5 -5
- package/lib/dash/segment_list.js +10 -10
- package/lib/dash/segment_template.js +14 -14
- package/lib/debug/log.js +2 -2
- package/lib/dependencies/all.js +2 -1
- package/lib/{media → drm}/drm_engine.js +274 -143
- package/lib/{util → drm}/drm_utils.js +20 -11
- package/lib/drm/playready.js +233 -0
- package/lib/hls/hls_classes.js +14 -14
- package/lib/hls/hls_parser.js +257 -196
- package/lib/hls/hls_utils.js +14 -14
- package/lib/hls/manifest_text_parser.js +10 -10
- package/lib/media/adaptation_set.js +6 -5
- package/lib/media/adaptation_set_criteria.js +51 -379
- package/lib/media/buffering_observer.js +5 -4
- package/lib/media/closed_caption_parser.js +2 -2
- package/lib/media/content_workarounds.js +2 -2
- package/lib/media/example_based_criteria.js +69 -0
- package/lib/media/manifest_filterer.js +8 -8
- package/lib/media/manifest_parser.js +2 -2
- package/lib/media/media_source_capabilities.js +20 -1
- package/lib/media/media_source_engine.js +71 -26
- package/lib/media/mp4_segment_index_parser.js +5 -5
- package/lib/media/playhead.js +2 -8
- package/lib/media/playhead_observer.js +1 -1
- package/lib/media/preference_based_criteria.js +333 -0
- package/lib/media/preload_manager.js +53 -37
- package/lib/media/presentation_timeline.js +2 -2
- package/lib/media/quality_observer.js +35 -35
- package/lib/media/region_observer.js +2 -2
- package/lib/media/region_timeline.js +3 -3
- package/lib/media/segment_index.js +14 -14
- package/lib/media/segment_prefetch.js +17 -13
- package/lib/media/segment_reference.js +7 -7
- package/lib/media/segment_utils.js +9 -9
- package/lib/media/streaming_engine.js +77 -38
- package/lib/media/time_ranges_utils.js +1 -1
- package/lib/media/video_wrapper.js +1 -1
- package/lib/media/webm_segment_index_parser.js +4 -4
- package/lib/mss/content_protection.js +17 -222
- package/lib/mss/mss_parser.js +23 -24
- package/lib/net/data_uri_plugin.js +1 -0
- package/lib/net/http_fetch_plugin.js +8 -7
- package/lib/net/http_plugin_utils.js +5 -2
- package/lib/net/http_xhr_plugin.js +4 -3
- package/lib/net/networking_engine.js +72 -17
- package/lib/net/networking_utils.js +5 -2
- package/lib/offline/download_info.js +5 -1
- package/lib/offline/download_manager.js +15 -4
- package/lib/offline/download_progress_estimator.js +1 -1
- package/lib/offline/indexeddb/base_storage_cell.js +9 -9
- package/lib/offline/indexeddb/db_connection.js +1 -1
- package/lib/offline/indexeddb/db_operation.js +2 -2
- package/lib/offline/indexeddb/eme_session_storage_cell.js +1 -1
- package/lib/offline/indexeddb/storage_mechanism.js +1 -1
- package/lib/offline/indexeddb/v1_storage_cell.js +3 -3
- package/lib/offline/indexeddb/v2_storage_cell.js +2 -2
- package/lib/offline/manifest_converter.js +11 -12
- package/lib/offline/offline_scheme.js +8 -4
- package/lib/offline/session_deleter.js +11 -11
- package/lib/offline/storage.js +137 -88
- package/lib/offline/storage_muxer.js +8 -8
- package/lib/offline/stored_content_utils.js +3 -3
- package/lib/offline/stream_bandwidth_estimator.js +1 -1
- package/lib/player.js +270 -207
- package/lib/polyfill/all.js +1 -1
- package/lib/polyfill/media_capabilities.js +5 -5
- package/lib/polyfill/patchedmediakeys_apple.js +6 -6
- package/lib/polyfill/patchedmediakeys_webkit.js +8 -8
- package/lib/polyfill/video_play_promise.js +0 -1
- package/lib/text/cue.js +3 -2
- package/lib/text/lrc_text_parser.js +1 -1
- package/lib/text/mp4_ttml_parser.js +1 -1
- package/lib/text/mp4_vtt_parser.js +3 -3
- package/lib/text/sbv_text_parser.js +1 -1
- package/lib/text/ssa_text_parser.js +3 -1
- package/lib/text/stub_text_displayer.js +5 -5
- package/lib/text/text_engine.js +5 -4
- package/lib/text/text_utils.js +4 -4
- package/lib/text/ttml_text_parser.js +21 -20
- package/lib/text/ui_text_displayer.js +13 -13
- package/lib/text/vtt_text_parser.js +10 -10
- package/lib/text/web_vtt_generator.js +2 -2
- package/lib/transmuxer/aac_transmuxer.js +2 -2
- package/lib/transmuxer/ac3_transmuxer.js +2 -2
- package/lib/transmuxer/adts.js +2 -0
- package/lib/transmuxer/ec3.js +3 -3
- package/lib/transmuxer/ec3_transmuxer.js +2 -2
- package/lib/transmuxer/h264.js +5 -5
- package/lib/transmuxer/h265.js +3 -3
- package/lib/transmuxer/mp3_transmuxer.js +2 -2
- package/lib/transmuxer/mpeg_audio.js +6 -6
- package/lib/transmuxer/mss_transmuxer.js +2 -0
- package/lib/transmuxer/transmuxer_engine.js +1 -1
- package/lib/transmuxer/ts_transmuxer.js +10 -10
- package/lib/util/abortable_operation.js +10 -10
- package/lib/util/array_utils.js +6 -6
- package/lib/util/cmcd_manager.js +149 -18
- package/lib/util/cmsd_manager.js +11 -11
- package/lib/util/config_utils.js +3 -3
- package/lib/util/content_steering_manager.js +17 -17
- package/lib/util/data_view_reader.js +3 -3
- package/lib/util/ebml_parser.js +1 -1
- package/lib/util/error.js +11 -6
- package/lib/util/event_manager.js +1 -1
- package/lib/util/exp_golomb.js +1 -1
- package/lib/util/fairplay_utils.js +6 -1
- package/lib/util/fake_event.js +3 -2
- package/lib/util/fake_event_target.js +1 -1
- package/lib/util/functional.js +8 -8
- package/lib/util/id3_utils.js +1 -1
- package/lib/util/iterables.js +6 -6
- package/lib/util/language_utils.js +17 -17
- package/lib/util/manifest_parser_utils.js +13 -13
- package/lib/util/map_utils.js +6 -6
- package/lib/util/media_ready_state_utils.js +1 -1
- package/lib/util/mime_utils.js +15 -4
- package/lib/util/mp4_box_parsers.js +5 -5
- package/lib/util/mp4_generator.js +31 -30
- package/lib/util/mp4_parser.js +2 -2
- package/lib/util/multi_map.js +5 -5
- package/lib/util/mutex.js +1 -1
- package/lib/util/networking.js +1 -1
- package/lib/util/object_utils.js +5 -1
- package/lib/util/operation_manager.js +1 -1
- package/lib/util/periods.js +24 -24
- package/lib/util/platform.js +8 -4
- package/lib/util/player_configuration.js +50 -17
- package/lib/util/pssh.js +34 -6
- package/lib/util/public_promise.js +2 -2
- package/lib/util/state_history.js +2 -2
- package/lib/util/stream_utils.js +138 -120
- package/lib/util/string_utils.js +4 -3
- package/lib/util/switch_history.js +2 -2
- package/lib/util/tXml.js +22 -17
- package/lib/util/text_parser.js +2 -2
- package/lib/util/timer.js +1 -1
- package/lib/util/ts_parser.js +22 -22
- package/lib/util/xml_utils.js +1 -0
- package/package.json +7 -4
- package/project-words.txt +485 -0
- package/shaka-player.uncompiled.js +1 -1
- package/third_party/closure-uri/uri.js +2 -2
- package/third_party/closure-uri/utils.js +2 -2
- package/third_party/language-mapping-list/language-mapping-list.js +1 -1
- package/ui/ad_statistics_button.js +9 -5
- package/ui/airplay_button.js +1 -0
- package/ui/audio_language_selection.js +2 -1
- package/ui/context_menu.js +2 -2
- package/ui/controls.js +7 -7
- package/ui/externs/ui.js +29 -21
- package/ui/externs/watermark.js +64 -0
- package/ui/fast_forward_button.js +1 -1
- package/ui/gl_matrix/matrix_4x4.js +11 -5
- package/ui/hidden_fast_forward_button.js +1 -1
- package/ui/hidden_seek_button.js +1 -1
- package/ui/language_utils.js +27 -26
- package/ui/less/buttons.less +2 -2
- package/ui/localization.js +21 -21
- package/ui/loop_button.js +2 -2
- package/ui/overflow_menu.js +2 -2
- package/ui/playback_rate_selection.js +1 -1
- package/ui/presentation_time.js +4 -1
- package/ui/range_element.js +2 -2
- package/ui/resolution_selection.js +42 -6
- package/ui/rewind_button.js +1 -1
- package/ui/seek_bar.js +5 -5
- package/ui/statistics_button.js +8 -4
- package/ui/text_selection.js +3 -2
- package/ui/ui.js +32 -2
- package/ui/vr_manager.js +3 -3
- package/ui/vr_utils.js +14 -14
- package/ui/vr_webgl.js +5 -5
- package/ui/watermark.js +313 -0
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -310
- package/lib/polyfill/patchedmediakeys_nop.js +0 -148
package/lib/cast/cast_utils.js
CHANGED
|
@@ -188,7 +188,7 @@ shaka.cast.CastUtils = class {
|
|
|
188
188
|
* @private
|
|
189
189
|
*/
|
|
190
190
|
static makeUint8Array_(obj) {
|
|
191
|
-
return new Uint8Array(/** @type {!Array
|
|
191
|
+
return new Uint8Array(/** @type {!Array<number>} */ (obj['entries']));
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
|
|
@@ -240,7 +240,7 @@ shaka.cast.CastUtils = class {
|
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* HTMLMediaElement events that are proxied while casting.
|
|
243
|
-
* @const {!Array
|
|
243
|
+
* @const {!Array<string>}
|
|
244
244
|
*/
|
|
245
245
|
shaka.cast.CastUtils.VideoEvents = [
|
|
246
246
|
'ended',
|
|
@@ -258,7 +258,7 @@ shaka.cast.CastUtils.VideoEvents = [
|
|
|
258
258
|
|
|
259
259
|
/**
|
|
260
260
|
* HTMLMediaElement attributes that are proxied while casting.
|
|
261
|
-
* @const {!Array
|
|
261
|
+
* @const {!Array<string>}
|
|
262
262
|
*/
|
|
263
263
|
shaka.cast.CastUtils.VideoAttributes = [
|
|
264
264
|
'buffered',
|
|
@@ -278,7 +278,7 @@ shaka.cast.CastUtils.VideoAttributes = [
|
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
280
|
* HTMLMediaElement attributes that are transferred when casting begins.
|
|
281
|
-
* @const {!Array
|
|
281
|
+
* @const {!Array<string>}
|
|
282
282
|
*/
|
|
283
283
|
shaka.cast.CastUtils.VideoInitStateAttributes = [
|
|
284
284
|
'loop',
|
|
@@ -288,7 +288,7 @@ shaka.cast.CastUtils.VideoInitStateAttributes = [
|
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
290
|
* HTMLMediaElement methods with no return value that are proxied while casting.
|
|
291
|
-
* @const {!Array
|
|
291
|
+
* @const {!Array<string>}
|
|
292
292
|
*/
|
|
293
293
|
shaka.cast.CastUtils.VideoVoidMethods = [
|
|
294
294
|
'pause',
|
|
@@ -300,7 +300,7 @@ shaka.cast.CastUtils.VideoVoidMethods = [
|
|
|
300
300
|
* Player getter methods that are proxied while casting.
|
|
301
301
|
* The key is the method, the value is the frequency of updates.
|
|
302
302
|
* Frequency 1 translates to every update; frequency 2 to every 2 updates, etc.
|
|
303
|
-
* @const {!Object
|
|
303
|
+
* @const {!Object<string, number>}
|
|
304
304
|
*/
|
|
305
305
|
shaka.cast.CastUtils.PlayerGetterMethods = {
|
|
306
306
|
// NOTE: The 'drmInfo' property is not proxied, as it is very large.
|
|
@@ -337,12 +337,13 @@ shaka.cast.CastUtils.PlayerGetterMethods = {
|
|
|
337
337
|
* Player getter methods with data large enough to be sent in their own update
|
|
338
338
|
* messages, to reduce the size of each message. The format of this is
|
|
339
339
|
* identical to PlayerGetterMethods.
|
|
340
|
-
* @const {!Object
|
|
340
|
+
* @const {!Object<string, number>}
|
|
341
341
|
*/
|
|
342
342
|
shaka.cast.CastUtils.LargePlayerGetterMethods = {
|
|
343
343
|
// NOTE: The 'getSharedConfiguration' property is not proxied as it would
|
|
344
344
|
// not be possible to share a reference.
|
|
345
345
|
'getConfiguration': 4,
|
|
346
|
+
'getConfigurationForLowLatency': 4,
|
|
346
347
|
'getStats': 5,
|
|
347
348
|
'getTextTracks': 2,
|
|
348
349
|
'getVariantTracks': 2,
|
|
@@ -354,7 +355,7 @@ shaka.cast.CastUtils.LargePlayerGetterMethods = {
|
|
|
354
355
|
* a livestream.
|
|
355
356
|
* The key is the method, the value is the frequency of updates.
|
|
356
357
|
* Frequency 1 translates to every update; frequency 2 to every 2 updates, etc.
|
|
357
|
-
* @const {!Object
|
|
358
|
+
* @const {!Object<string, number>}
|
|
358
359
|
*/
|
|
359
360
|
shaka.cast.CastUtils.PlayerGetterMethodsThatRequireLive = {
|
|
360
361
|
'getPlayheadTimeAsDate': 1,
|
|
@@ -366,17 +367,22 @@ shaka.cast.CastUtils.PlayerGetterMethodsThatRequireLive = {
|
|
|
366
367
|
/**
|
|
367
368
|
* Player getter and setter methods that are used to transfer state when casting
|
|
368
369
|
* begins.
|
|
369
|
-
* @const {!Array
|
|
370
|
+
* @const {!Array<!Array<string>>}
|
|
370
371
|
*/
|
|
371
372
|
shaka.cast.CastUtils.PlayerInitState = [
|
|
372
|
-
[
|
|
373
|
+
[
|
|
374
|
+
'getConfiguration',
|
|
375
|
+
'configure',
|
|
376
|
+
'getConfigurationForLowLatency',
|
|
377
|
+
'configurationForLowLatency',
|
|
378
|
+
],
|
|
373
379
|
];
|
|
374
380
|
|
|
375
381
|
|
|
376
382
|
/**
|
|
377
383
|
* Player getter and setter methods that are used to transfer state after
|
|
378
384
|
* load() is resolved.
|
|
379
|
-
* @const {!Array
|
|
385
|
+
* @const {!Array<!Array<string>>}
|
|
380
386
|
*/
|
|
381
387
|
shaka.cast.CastUtils.PlayerInitAfterLoadState = [
|
|
382
388
|
['isTextTrackVisible', 'setTextTrackVisibility'],
|
|
@@ -385,7 +391,7 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
|
|
|
385
391
|
|
|
386
392
|
/**
|
|
387
393
|
* Player methods with no return value that are proxied while casting.
|
|
388
|
-
* @const {!Array
|
|
394
|
+
* @const {!Array<string>}
|
|
389
395
|
*/
|
|
390
396
|
shaka.cast.CastUtils.PlayerVoidMethods = [
|
|
391
397
|
'addChaptersTrack',
|
|
@@ -393,6 +399,7 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
|
|
|
393
399
|
'addThumbnailsTrack',
|
|
394
400
|
'cancelTrickPlay',
|
|
395
401
|
'configure',
|
|
402
|
+
'configurationForLowLatency',
|
|
396
403
|
'getChapters',
|
|
397
404
|
'getChaptersTracks',
|
|
398
405
|
'resetConfiguration',
|
|
@@ -411,7 +418,7 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
|
|
|
411
418
|
|
|
412
419
|
/**
|
|
413
420
|
* Player methods returning a Promise that are proxied while casting.
|
|
414
|
-
* @const {!Array
|
|
421
|
+
* @const {!Array<string>}
|
|
415
422
|
*/
|
|
416
423
|
shaka.cast.CastUtils.PlayerPromiseMethods = [
|
|
417
424
|
'attach',
|
|
@@ -53,7 +53,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
53
53
|
* Points to current buffer.
|
|
54
54
|
* @private {!shaka.cea.Cea608Memory}
|
|
55
55
|
*/
|
|
56
|
-
this.
|
|
56
|
+
this.curBuf_ = this.nonDisplayedMemory_;
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* End time of the previous caption, serves as start time of next caption.
|
|
@@ -65,7 +65,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
65
65
|
* Last control pair, 16 bits representing byte 1 and byte 2
|
|
66
66
|
* @private {?number}
|
|
67
67
|
*/
|
|
68
|
-
this.
|
|
68
|
+
this.lastCp_ = null;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -73,8 +73,8 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
73
73
|
*/
|
|
74
74
|
reset() {
|
|
75
75
|
this.type_ = shaka.cea.Cea608DataChannel.CaptionType.NONE;
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
76
|
+
this.curBuf_ = this.nonDisplayedMemory_;
|
|
77
|
+
this.lastCp_ = null;
|
|
78
78
|
this.displayedMemory_.reset();
|
|
79
79
|
this.nonDisplayedMemory_.reset();
|
|
80
80
|
this.text_.reset();
|
|
@@ -99,7 +99,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
99
99
|
* @private
|
|
100
100
|
*/
|
|
101
101
|
pacToRow_(b1, b2) {
|
|
102
|
-
const
|
|
102
|
+
const ccRowTab = [
|
|
103
103
|
11, 11, // 0x00 or 0x01
|
|
104
104
|
1, 2, // 0x02 -> 0x03
|
|
105
105
|
3, 4, // 0x04 -> 0x05
|
|
@@ -109,7 +109,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
109
109
|
7, 8, // 0x0C -> 0x0D
|
|
110
110
|
9, 10, // 0x0E -> 0x0F
|
|
111
111
|
];
|
|
112
|
-
return
|
|
112
|
+
return ccRowTab[((b1 & 0x07) << 1) | ((b2 >> 5) & 0x01)];
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
/**
|
|
@@ -154,7 +154,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// Execute the PAC.
|
|
157
|
-
const buf = this.
|
|
157
|
+
const buf = this.curBuf_;
|
|
158
158
|
|
|
159
159
|
// Move entire scroll window to a new base in rollup mode.
|
|
160
160
|
if (this.type_ === shaka.cea.Cea608DataChannel.CaptionType.ROLLUP &&
|
|
@@ -188,12 +188,12 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
188
188
|
*/
|
|
189
189
|
controlMidrow_(b2) {
|
|
190
190
|
// Clear all pre-existing midrow style attributes.
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
191
|
+
this.curBuf_.setUnderline(false);
|
|
192
|
+
this.curBuf_.setItalics(false);
|
|
193
|
+
this.curBuf_.setTextColor(shaka.cea.CeaUtils.DEFAULT_TXT_COLOR);
|
|
194
194
|
|
|
195
195
|
// Mid-row attrs use a space.
|
|
196
|
-
this.
|
|
196
|
+
this.curBuf_.addChar(
|
|
197
197
|
shaka.cea.Cea608Memory.CharSet.BASIC_NORTH_AMERICAN, ' '.charCodeAt(0));
|
|
198
198
|
|
|
199
199
|
let textColor = shaka.cea.CeaUtils.DEFAULT_TXT_COLOR;
|
|
@@ -209,9 +209,9 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
209
209
|
italics = true;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
this.
|
|
213
|
-
this.
|
|
214
|
-
this.
|
|
212
|
+
this.curBuf_.setUnderline(underline);
|
|
213
|
+
this.curBuf_.setItalics(italics);
|
|
214
|
+
this.curBuf_.setTextColor(textColor);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
/**
|
|
@@ -226,7 +226,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
226
226
|
// If background provided, last 3 bits of b1 are |0|0|0|. Color is in b2.
|
|
227
227
|
backgroundColor = shaka.cea.Cea608DataChannel.BG_COLORS[(b2 & 0xe) >> 1];
|
|
228
228
|
}
|
|
229
|
-
this.
|
|
229
|
+
this.curBuf_.setBackgroundColor(backgroundColor);
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
@@ -302,7 +302,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
302
302
|
* @private
|
|
303
303
|
*/
|
|
304
304
|
controlCr_(pts) {
|
|
305
|
-
const buf = this.
|
|
305
|
+
const buf = this.curBuf_;
|
|
306
306
|
// Only rollup and text mode is affected, but we don't emit text mode.
|
|
307
307
|
if (this.type_ !== shaka.cea.Cea608DataChannel.CaptionType.ROLLUP) {
|
|
308
308
|
return null;
|
|
@@ -311,13 +311,13 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
311
311
|
const parsedClosedCaption = buf.forceEmit(this.prevEndTime_, pts);
|
|
312
312
|
|
|
313
313
|
// Calculate the top of the scroll window.
|
|
314
|
-
const
|
|
314
|
+
const topRow = (buf.getRow() - buf.getScrollSize()) + 1;
|
|
315
315
|
|
|
316
316
|
// Shift up the window one row higher.
|
|
317
|
-
buf.moveRows(
|
|
317
|
+
buf.moveRows(topRow - 1, topRow, buf.getScrollSize());
|
|
318
318
|
|
|
319
319
|
// Clear out anything that's outside of our current scroll window.
|
|
320
|
-
buf.resetRows(0,
|
|
320
|
+
buf.resetRows(0, topRow - 1);
|
|
321
321
|
buf.resetRows(buf.getRow(), shaka.cea.Cea608Memory.CC_ROWS - buf.getRow());
|
|
322
322
|
|
|
323
323
|
// Update the end time so the next caption emits starting at this time.
|
|
@@ -335,8 +335,8 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
335
335
|
* @private
|
|
336
336
|
*/
|
|
337
337
|
controlRu_(scrollSize, pts) {
|
|
338
|
-
this.
|
|
339
|
-
const buf = this.
|
|
338
|
+
this.curBuf_ = this.displayedMemory_; // Point to displayed memory
|
|
339
|
+
const buf = this.curBuf_;
|
|
340
340
|
let parsedClosedCaption = null;
|
|
341
341
|
|
|
342
342
|
// For any type except rollup and text mode, it should be emitted,
|
|
@@ -364,7 +364,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
364
364
|
* @private
|
|
365
365
|
*/
|
|
366
366
|
controlFon_() {
|
|
367
|
-
this.
|
|
367
|
+
this.curBuf_.addChar(
|
|
368
368
|
shaka.cea.Cea608Memory.CharSet.BASIC_NORTH_AMERICAN,
|
|
369
369
|
' '.charCodeAt(0));
|
|
370
370
|
}
|
|
@@ -399,10 +399,10 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
399
399
|
controlRdc_(pts) {
|
|
400
400
|
this.type_ = shaka.cea.Cea608DataChannel.CaptionType.PAINTON;
|
|
401
401
|
// Point to displayed memory.
|
|
402
|
-
this.
|
|
402
|
+
this.curBuf_ = this.displayedMemory_;
|
|
403
403
|
|
|
404
404
|
// No scroll window now.
|
|
405
|
-
this.
|
|
405
|
+
this.curBuf_.setScrollSize(0);
|
|
406
406
|
|
|
407
407
|
// The next paint-on caption needs this time as the start time.
|
|
408
408
|
this.prevEndTime_ = pts;
|
|
@@ -451,9 +451,9 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
451
451
|
*/
|
|
452
452
|
controlRcl_() {
|
|
453
453
|
this.type_ = shaka.cea.Cea608DataChannel.CaptionType.POPON;
|
|
454
|
-
this.
|
|
454
|
+
this.curBuf_ = this.nonDisplayedMemory_;
|
|
455
455
|
// No scroll window now
|
|
456
|
-
this.
|
|
456
|
+
this.curBuf_.setScrollSize(0);
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
|
|
@@ -462,7 +462,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
462
462
|
* @private
|
|
463
463
|
*/
|
|
464
464
|
controlBs_() {
|
|
465
|
-
this.
|
|
465
|
+
this.curBuf_.eraseChar();
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
/**
|
|
@@ -484,7 +484,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
484
484
|
controlRtd_() {
|
|
485
485
|
shaka.log.warnOnce('Cea608DataChannel',
|
|
486
486
|
'CEA-608 text mode entered, but is unsupported');
|
|
487
|
-
this.
|
|
487
|
+
this.curBuf_ = this.text_;
|
|
488
488
|
this.type_ = shaka.cea.Cea608DataChannel.CaptionType.TEXT;
|
|
489
489
|
}
|
|
490
490
|
|
|
@@ -494,9 +494,9 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
494
494
|
* @param {number} b2 Byte 2.
|
|
495
495
|
*/
|
|
496
496
|
handleBasicNorthAmericanChar(b1, b2) {
|
|
497
|
-
this.
|
|
497
|
+
this.curBuf_.addChar(
|
|
498
498
|
shaka.cea.Cea608Memory.CharSet.BASIC_NORTH_AMERICAN, b1);
|
|
499
|
-
this.
|
|
499
|
+
this.curBuf_.addChar(
|
|
500
500
|
shaka.cea.Cea608Memory.CharSet.BASIC_NORTH_AMERICAN, b2);
|
|
501
501
|
}
|
|
502
502
|
|
|
@@ -512,7 +512,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
512
512
|
shaka.cea.Cea608Memory.CharSet.PORTUGUESE_GERMAN:
|
|
513
513
|
shaka.cea.Cea608Memory.CharSet.SPANISH_FRENCH;
|
|
514
514
|
|
|
515
|
-
this.
|
|
515
|
+
this.curBuf_.addChar(charSet, b2);
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
/**
|
|
@@ -522,7 +522,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
522
522
|
* @private
|
|
523
523
|
*/
|
|
524
524
|
handleOffset_(offset) {
|
|
525
|
-
this.
|
|
525
|
+
this.curBuf_.setOffset(offset);
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
/**
|
|
@@ -540,13 +540,13 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
540
540
|
// seen in broadcast captures. If the very next frame has a duplicate
|
|
541
541
|
// control code, that duplicate is ignored. Note that this only applies
|
|
542
542
|
// to the very next frame, and only for one match.
|
|
543
|
-
if (this.
|
|
544
|
-
this.
|
|
543
|
+
if (this.lastCp_ === ((b1 << 8) | b2)) {
|
|
544
|
+
this.lastCp_ = null;
|
|
545
545
|
return null;
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
// Remember valid control code for checking in next frame!
|
|
549
|
-
this.
|
|
549
|
+
this.lastCp_ = (b1 << 8) | b2;
|
|
550
550
|
|
|
551
551
|
if (this.isPAC_(b1, b2)) {
|
|
552
552
|
this.controlPac_(b1, b2);
|
|
@@ -555,7 +555,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
555
555
|
} else if (this.isBackgroundAttribute_(b1, b2)) {
|
|
556
556
|
this.controlBackgroundAttribute_(b1, b2);
|
|
557
557
|
} else if (this.isSpecialNorthAmericanChar_(b1, b2)) {
|
|
558
|
-
this.
|
|
558
|
+
this.curBuf_.addChar(
|
|
559
559
|
shaka.cea.Cea608Memory.CharSet.SPECIAL_NORTH_AMERICAN, b2);
|
|
560
560
|
} else if (this.isExtendedWesternEuropeanChar_(b1, b2)) {
|
|
561
561
|
this.handleExtendedWesternEuropeanChar_(b1, b2);
|
|
@@ -794,21 +794,21 @@ shaka.cea.Cea608DataChannel.Style;
|
|
|
794
794
|
/**
|
|
795
795
|
* CEA closed captions packet.
|
|
796
796
|
* @typedef {{
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
797
|
+
* pts: number,
|
|
798
|
+
* type: number,
|
|
799
|
+
* ccData1: number,
|
|
800
|
+
* ccData2: number,
|
|
801
|
+
* order: number
|
|
802
|
+
* }}
|
|
803
|
+
*
|
|
804
|
+
* @property {number} pts
|
|
805
|
+
* Presentation timestamp (in second) at which this packet was received.
|
|
806
|
+
* @property {number} type
|
|
807
|
+
* Type of the packet. Either 0 or 1, representing the CEA-608 field.
|
|
808
|
+
* @property {number} ccData1 CEA-608 byte 1.
|
|
809
|
+
* @property {number} ccData2 CEA-608 byte 2.
|
|
810
|
+
* @property {number} order
|
|
811
|
+
* A number indicating the order this packet was received in a sequence
|
|
812
|
+
* of packets. Used to break ties in a stable sorting algorithm
|
|
813
|
+
*/
|
|
814
814
|
shaka.cea.Cea608DataChannel.Cea608Packet;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
// cspell:ignore PNSTY
|
|
8
|
+
|
|
7
9
|
goog.provide('shaka.cea.Cea708Service');
|
|
8
10
|
|
|
9
11
|
goog.require('shaka.cea.Cea708Window');
|
|
@@ -43,7 +45,7 @@ shaka.cea.Cea708Service = class {
|
|
|
43
45
|
/**
|
|
44
46
|
* Processes a CEA-708 control code.
|
|
45
47
|
* @param {!shaka.cea.DtvccPacket} dtvccPacket
|
|
46
|
-
* @return {
|
|
48
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
47
49
|
* @throws {!shaka.util.Error}
|
|
48
50
|
*/
|
|
49
51
|
handleCea708ControlCode(dtvccPacket) {
|
|
@@ -77,7 +79,7 @@ shaka.cea.Cea708Service = class {
|
|
|
77
79
|
this.handleG3_(controlCode & 0xff);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
return
|
|
82
|
+
return [];
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/**
|
|
@@ -156,13 +158,13 @@ shaka.cea.Cea708Service = class {
|
|
|
156
158
|
* @param {!shaka.cea.DtvccPacket} dtvccPacket
|
|
157
159
|
* @param {number} controlCode
|
|
158
160
|
* @param {number} pts
|
|
159
|
-
* @return {
|
|
161
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
160
162
|
* @private
|
|
161
163
|
*/
|
|
162
164
|
handleC0_(dtvccPacket, controlCode, pts) {
|
|
163
165
|
// All these commands pertain to the current window, so ensure it exists.
|
|
164
166
|
if (!this.currentWindow_) {
|
|
165
|
-
return
|
|
167
|
+
return [];
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
if (controlCode == 0x18) {
|
|
@@ -178,7 +180,7 @@ shaka.cea.Cea708Service = class {
|
|
|
178
180
|
// Takes a unicode hex string and creates a single character.
|
|
179
181
|
const char = String.fromCharCode(parseInt(unicode, 16));
|
|
180
182
|
this.currentWindow_.setCharacter(char);
|
|
181
|
-
return
|
|
183
|
+
return [];
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
const window = this.currentWindow_;
|
|
@@ -214,7 +216,7 @@ shaka.cea.Cea708Service = class {
|
|
|
214
216
|
window.setPenLocation(0, 0);
|
|
215
217
|
break;
|
|
216
218
|
}
|
|
217
|
-
return parsedClosedCaption;
|
|
219
|
+
return parsedClosedCaption ? [parsedClosedCaption] : [];
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
/**
|
|
@@ -223,7 +225,7 @@ shaka.cea.Cea708Service = class {
|
|
|
223
225
|
* @param {!shaka.cea.DtvccPacket} dtvccPacket
|
|
224
226
|
* @param {number} captionCommand
|
|
225
227
|
* @param {number} pts in seconds
|
|
226
|
-
* @return {
|
|
228
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
227
229
|
* @throws {!shaka.util.Error} a possible out-of-range buffer read.
|
|
228
230
|
* @private
|
|
229
231
|
*/
|
|
@@ -264,7 +266,7 @@ shaka.cea.Cea708Service = class {
|
|
|
264
266
|
const windowNum = (captionCommand & 0x0f) - 8;
|
|
265
267
|
this.defineWindow_(dtvccPacket, windowNum, pts);
|
|
266
268
|
}
|
|
267
|
-
return
|
|
269
|
+
return [];
|
|
268
270
|
}
|
|
269
271
|
|
|
270
272
|
/**
|
|
@@ -316,7 +318,7 @@ shaka.cea.Cea708Service = class {
|
|
|
316
318
|
/**
|
|
317
319
|
* Yields each non-null window specified in the 8-bit bitmap.
|
|
318
320
|
* @param {number} bitmap 8 bits corresponding to each of the 8 windows.
|
|
319
|
-
* @return {!Array
|
|
321
|
+
* @return {!Array<number>}
|
|
320
322
|
* @private
|
|
321
323
|
*/
|
|
322
324
|
getSpecifiedWindowIds_(bitmap) {
|
|
@@ -334,22 +336,26 @@ shaka.cea.Cea708Service = class {
|
|
|
334
336
|
/**
|
|
335
337
|
* @param {number} windowsBitmap
|
|
336
338
|
* @param {number} pts
|
|
337
|
-
* @return {
|
|
339
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
338
340
|
* @private
|
|
339
341
|
*/
|
|
340
342
|
clearWindows_(windowsBitmap, pts) {
|
|
341
|
-
|
|
343
|
+
const parsedClosedCaptions = [];
|
|
342
344
|
|
|
343
345
|
// Clears windows from the 8 bit bitmap.
|
|
344
346
|
for (const windowId of this.getSpecifiedWindowIds_(windowsBitmap)) {
|
|
345
347
|
// If window visible and being cleared, emit buffer and reset start time!
|
|
346
348
|
const window = this.windows_[windowId];
|
|
347
349
|
if (window.isVisible()) {
|
|
348
|
-
|
|
350
|
+
const newParsedClosedCaption =
|
|
351
|
+
window.forceEmit(pts, this.serviceNumber_);
|
|
352
|
+
if (newParsedClosedCaption) {
|
|
353
|
+
parsedClosedCaptions.push(newParsedClosedCaption);
|
|
354
|
+
}
|
|
349
355
|
}
|
|
350
356
|
window.resetMemory();
|
|
351
357
|
}
|
|
352
|
-
return
|
|
358
|
+
return parsedClosedCaptions;
|
|
353
359
|
}
|
|
354
360
|
|
|
355
361
|
/**
|
|
@@ -372,7 +378,7 @@ shaka.cea.Cea708Service = class {
|
|
|
372
378
|
/**
|
|
373
379
|
* @param {number} windowsBitmap
|
|
374
380
|
* @param {number} pts
|
|
375
|
-
* @return {
|
|
381
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
376
382
|
* @private
|
|
377
383
|
*/
|
|
378
384
|
hideWindows_(windowsBitmap, pts) {
|
|
@@ -387,13 +393,13 @@ shaka.cea.Cea708Service = class {
|
|
|
387
393
|
}
|
|
388
394
|
window.hide();
|
|
389
395
|
}
|
|
390
|
-
return parsedClosedCaption;
|
|
396
|
+
return parsedClosedCaption ? [parsedClosedCaption] : [];
|
|
391
397
|
}
|
|
392
398
|
|
|
393
399
|
/**
|
|
394
400
|
* @param {number} windowsBitmap
|
|
395
401
|
* @param {number} pts
|
|
396
|
-
* @return {
|
|
402
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
397
403
|
* @private
|
|
398
404
|
*/
|
|
399
405
|
toggleWindows_(windowsBitmap, pts) {
|
|
@@ -412,42 +418,46 @@ shaka.cea.Cea708Service = class {
|
|
|
412
418
|
|
|
413
419
|
window.toggle();
|
|
414
420
|
}
|
|
415
|
-
return parsedClosedCaption;
|
|
421
|
+
return parsedClosedCaption ? [parsedClosedCaption] : [];
|
|
416
422
|
}
|
|
417
423
|
|
|
418
424
|
/**
|
|
419
425
|
* @param {number} windowsBitmap
|
|
420
426
|
* @param {number} pts
|
|
421
|
-
* @return {
|
|
427
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
422
428
|
* @private
|
|
423
429
|
*/
|
|
424
430
|
deleteWindows_(windowsBitmap, pts) {
|
|
425
|
-
|
|
431
|
+
const parsedClosedCaptions = [];
|
|
426
432
|
// Deletes windows from the 8 bit bitmap.
|
|
427
433
|
for (const windowId of this.getSpecifiedWindowIds_(windowsBitmap)) {
|
|
428
434
|
const window = this.windows_[windowId];
|
|
429
435
|
if (window.isVisible()) {
|
|
430
436
|
// We are turning off the visibility, emit!
|
|
431
|
-
|
|
437
|
+
const newParsedClosedCaption =
|
|
438
|
+
window.forceEmit(pts, this.serviceNumber_);
|
|
439
|
+
if (newParsedClosedCaption) {
|
|
440
|
+
parsedClosedCaptions.push(newParsedClosedCaption);
|
|
441
|
+
}
|
|
432
442
|
}
|
|
433
443
|
// Delete the window from the list of windows
|
|
434
444
|
this.windows_[windowId] = null;
|
|
435
445
|
}
|
|
436
|
-
return
|
|
446
|
+
return parsedClosedCaptions;
|
|
437
447
|
}
|
|
438
448
|
|
|
439
449
|
/**
|
|
440
450
|
* Emits anything currently present in any of the windows, and then
|
|
441
451
|
* deletes all windows, cancels all delays, reinitializes the service.
|
|
442
452
|
* @param {number} pts
|
|
443
|
-
* @return {
|
|
453
|
+
* @return {!Array<shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
444
454
|
* @private
|
|
445
455
|
*/
|
|
446
456
|
reset_(pts) {
|
|
447
457
|
const allWindowsBitmap = 0xff; // All windows should be deleted.
|
|
448
|
-
const
|
|
458
|
+
const captions = this.deleteWindows_(allWindowsBitmap, pts);
|
|
449
459
|
this.clear();
|
|
450
|
-
return
|
|
460
|
+
return captions;
|
|
451
461
|
}
|
|
452
462
|
|
|
453
463
|
/**
|
package/lib/cea/cea708_window.js
CHANGED
|
@@ -18,6 +18,7 @@ goog.require('shaka.text.CueRegion');
|
|
|
18
18
|
shaka.cea.Cea708Window = class {
|
|
19
19
|
/**
|
|
20
20
|
* @param {number} windowNum
|
|
21
|
+
* @param {number} parentService
|
|
21
22
|
*/
|
|
22
23
|
constructor(windowNum, parentService) {
|
|
23
24
|
/**
|
|
@@ -229,6 +230,7 @@ shaka.cea.Cea708Window = class {
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
/**
|
|
233
|
+
* @return {boolean}
|
|
232
234
|
* @private
|
|
233
235
|
*/
|
|
234
236
|
isPenInBounds_() {
|
|
@@ -424,8 +426,9 @@ shaka.cea.Cea708Window = class {
|
|
|
424
426
|
// WebVTT's region viewport anchors are technically always in percentages.
|
|
425
427
|
// However, we don't know the aspect ratio of the video at this point,
|
|
426
428
|
// which determines how we interpret the horizontal anchor.
|
|
427
|
-
// So, we expose the
|
|
428
|
-
// values can be used
|
|
429
|
+
// So, we expose the additional flag to reflect whether these viewport
|
|
430
|
+
// anchor values can be used as is or should be converted
|
|
431
|
+
// to percentages.
|
|
429
432
|
region.viewportAnchorUnits = this.relativeToggle_ ?
|
|
430
433
|
shaka.text.CueRegion.units.PERCENTAGE : shaka.text.CueRegion.units.LINES;
|
|
431
434
|
|
package/lib/cea/cea_decoder.js
CHANGED
|
@@ -85,7 +85,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Set used to track available streams.
|
|
88
|
-
* @private {!Set
|
|
88
|
+
* @private {!Set<string>}
|
|
89
89
|
*/
|
|
90
90
|
this.streams_ = new Set();
|
|
91
91
|
|
|
@@ -221,7 +221,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
221
221
|
* @override
|
|
222
222
|
*/
|
|
223
223
|
decode() {
|
|
224
|
-
/** @type {!Array
|
|
224
|
+
/** @type {!Array<!shaka.extern.ICaptionDecoder.ClosedCaption>} */
|
|
225
225
|
const parsedClosedCaptions = [];
|
|
226
226
|
|
|
227
227
|
// In some versions of Chrome, and other browsers, the default sorting
|
|
@@ -346,7 +346,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
346
346
|
|
|
347
347
|
// First 3 bits are service number, next 5 are block size,
|
|
348
348
|
// representing the number of bytes coming in this block
|
|
349
|
-
// (
|
|
349
|
+
// (excluding a possible extended service block header byte)
|
|
350
350
|
let serviceNumber = (serviceBlockHeader & 0xe0) >> 5;
|
|
351
351
|
const blockSize = serviceBlockHeader & 0x1f;
|
|
352
352
|
|
|
@@ -371,10 +371,8 @@ shaka.cea.CeaDecoder = class {
|
|
|
371
371
|
|
|
372
372
|
// Execute this loop `blockSize` times, to decode the control codes.
|
|
373
373
|
while (dtvccPacket.getPosition() - startPos < blockSize) {
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
parsedClosedCaptions.push(closedCaption);
|
|
377
|
-
}
|
|
374
|
+
const closedCaptions = service.handleCea708ControlCode(dtvccPacket);
|
|
375
|
+
parsedClosedCaptions.push(...closedCaptions);
|
|
378
376
|
} // position < end of block
|
|
379
377
|
} // serviceNumber != 0
|
|
380
378
|
} // hasMoreData
|
|
@@ -403,7 +403,7 @@ shaka.cea.Mp4CeaParser.BitstreamFormat = {
|
|
|
403
403
|
H266: 3,
|
|
404
404
|
};
|
|
405
405
|
|
|
406
|
-
/** @private {Object
|
|
406
|
+
/** @private {Object<string, shaka.cea.Mp4CeaParser.BitstreamFormat>} */
|
|
407
407
|
shaka.cea.Mp4CeaParser.CodecBitstreamMap_ = {
|
|
408
408
|
// AVC
|
|
409
409
|
'avc1': shaka.cea.Mp4CeaParser.BitstreamFormat.H264,
|
package/lib/cea/sei_processor.js
CHANGED
|
@@ -14,7 +14,7 @@ shaka.cea.SeiProcessor = class {
|
|
|
14
14
|
/**
|
|
15
15
|
* Processes supplemental enhancement information data.
|
|
16
16
|
* @param {!Uint8Array} naluData NALU from which SEI data is to be processed.
|
|
17
|
-
* @return {!Array
|
|
17
|
+
* @return {!Array<!Uint8Array>}
|
|
18
18
|
*/
|
|
19
19
|
process(naluData) {
|
|
20
20
|
const seiPayloads = [];
|