rx-player 4.5.0-dev.2026031700 → 4.5.0-dev.2026033100
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/CHANGELOG.md +3 -1
- package/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.d.ts +16 -14
- package/dist/commonjs/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_compatibility_types.js +7 -4
- package/dist/commonjs/compat/browser_version.d.ts +2 -1
- package/dist/commonjs/compat/browser_version.d.ts.map +1 -1
- package/dist/commonjs/compat/browser_version.js +13 -0
- package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
- package/dist/commonjs/compat/disable_remote_playback_on_managed_media_source.js +1 -1
- package/dist/commonjs/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/commonjs/compat/is_codec_supported.js +4 -3
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
- package/dist/commonjs/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +45 -0
- package/dist/commonjs/core/entry/utils.js +3 -3
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +2 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +8 -6
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +4 -3
- package/dist/commonjs/initialize_worker.js +1 -1
- package/dist/commonjs/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/commonjs/main_thread/api/public_api.js +2 -2
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/commonjs/main_thread/init/utils/update_manifest_codec_support.js +24 -12
- package/dist/commonjs/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/adaptation.js +3 -1
- package/dist/commonjs/manifest/classes/representation.d.ts +6 -2
- package/dist/commonjs/manifest/classes/representation.d.ts.map +1 -1
- package/dist/commonjs/manifest/classes/representation.js +45 -23
- package/dist/commonjs/manifest/types.d.ts +14 -6
- package/dist/commonjs/manifest/types.d.ts.map +1 -1
- package/dist/commonjs/manifest/utils.js +4 -4
- package/dist/commonjs/mse/main_media_source_interface.d.ts.map +1 -1
- package/dist/commonjs/mse/main_media_source_interface.js +3 -2
- package/dist/commonjs/mse/worker_media_source_interface.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts +12 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/get_box.js +16 -0
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts +2 -1
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/commonjs/parsers/containers/isobmff/index.js +3 -1
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
- package/dist/commonjs/parsers/containers/isobmff/remove_dolby_vision_config_data.js +180 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
- package/dist/commonjs/transports/dash/segment_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/segment_parser.js +6 -0
- package/dist/commonjs/transports/dash/text_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/dash/text_parser.js +5 -1
- package/dist/commonjs/transports/local/text_parser.d.ts.map +1 -1
- package/dist/commonjs/transports/local/text_parser.js +5 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.d.ts.map +1 -1
- package/dist/commonjs/transports/metaplaylist/pipelines.js +2 -1
- package/dist/commonjs/transports/smooth/pipelines.js +3 -3
- package/dist/commonjs/transports/types.d.ts +28 -2
- package/dist/commonjs/transports/types.d.ts.map +1 -1
- package/dist/commonjs/transports/utils/parse_text_track.d.ts +9 -2
- package/dist/commonjs/transports/utils/parse_text_track.d.ts.map +1 -1
- package/dist/commonjs/transports/utils/parse_text_track.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/compat/browser_compatibility_types.d.ts +16 -14
- package/dist/es2017/compat/browser_compatibility_types.d.ts.map +1 -1
- package/dist/es2017/compat/browser_compatibility_types.js +7 -1
- package/dist/es2017/compat/browser_version.d.ts +2 -1
- package/dist/es2017/compat/browser_version.d.ts.map +1 -1
- package/dist/es2017/compat/browser_version.js +13 -1
- package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.d.ts.map +1 -1
- package/dist/es2017/compat/disable_remote_playback_on_managed_media_source.js +2 -2
- package/dist/es2017/compat/is_codec_supported.d.ts.map +1 -1
- package/dist/es2017/compat/is_codec_supported.js +2 -1
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts +26 -0
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.d.ts.map +1 -0
- package/dist/es2017/compat/should_patch_out_dolby_vision_config_data_from_mp4.js +42 -0
- package/dist/es2017/core/entry/utils.js +4 -4
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +2 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +2 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +3 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts.map +1 -1
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +2 -1
- package/dist/es2017/initialize_worker.js +1 -1
- package/dist/es2017/main_thread/api/debug/modules/segment_buffer_content.js +3 -3
- package/dist/es2017/main_thread/api/public_api.js +2 -2
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.d.ts.map +1 -1
- package/dist/es2017/main_thread/init/utils/update_manifest_codec_support.js +9 -7
- package/dist/es2017/manifest/classes/adaptation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/adaptation.js +3 -1
- package/dist/es2017/manifest/classes/representation.d.ts +6 -2
- package/dist/es2017/manifest/classes/representation.d.ts.map +1 -1
- package/dist/es2017/manifest/classes/representation.js +45 -23
- package/dist/es2017/manifest/types.d.ts +14 -6
- package/dist/es2017/manifest/types.d.ts.map +1 -1
- package/dist/es2017/manifest/utils.js +4 -4
- package/dist/es2017/mse/main_media_source_interface.d.ts.map +1 -1
- package/dist/es2017/mse/main_media_source_interface.js +2 -1
- package/dist/es2017/mse/worker_media_source_interface.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts +12 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/get_box.js +16 -1
- package/dist/es2017/parsers/containers/isobmff/index.d.ts +2 -1
- package/dist/es2017/parsers/containers/isobmff/index.d.ts.map +1 -1
- package/dist/es2017/parsers/containers/isobmff/index.js +2 -1
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts +13 -0
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.d.ts.map +1 -0
- package/dist/es2017/parsers/containers/isobmff/remove_dolby_vision_config_data.js +155 -0
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +4 -4
- package/dist/es2017/transports/dash/segment_parser.d.ts.map +1 -1
- package/dist/es2017/transports/dash/segment_parser.js +7 -1
- package/dist/es2017/transports/dash/text_parser.d.ts.map +1 -1
- package/dist/es2017/transports/dash/text_parser.js +5 -1
- package/dist/es2017/transports/local/text_parser.d.ts.map +1 -1
- package/dist/es2017/transports/local/text_parser.js +5 -1
- package/dist/es2017/transports/metaplaylist/pipelines.d.ts.map +1 -1
- package/dist/es2017/transports/metaplaylist/pipelines.js +2 -1
- package/dist/es2017/transports/smooth/pipelines.js +3 -3
- package/dist/es2017/transports/types.d.ts +28 -2
- package/dist/es2017/transports/types.d.ts.map +1 -1
- package/dist/es2017/transports/utils/parse_text_track.d.ts +9 -2
- package/dist/es2017/transports/utils/parse_text_track.d.ts.map +1 -1
- package/dist/es2017/transports/utils/parse_text_track.js +1 -1
- package/dist/worker.js +6 -6
- package/eslint.config.mjs +1 -14
- package/package.json +1 -1
- package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
- package/src/compat/__tests__/browser_compatibility_types.test.ts +15 -26
- package/src/compat/__tests__/browser_version.test.ts +57 -18
- package/src/compat/__tests__/clear_element_src.test.ts +20 -40
- package/src/compat/__tests__/is_codec_supported.test.ts +39 -44
- package/src/compat/__tests__/is_vtt_cue.test.ts +5 -8
- package/src/compat/__tests__/make_vtt_cue.test.ts +20 -31
- package/src/compat/__tests__/remove_cue.test.ts +8 -20
- package/src/compat/__tests__/should_patch_out_dolby_vision_config_data_from_mp4.test.ts +78 -0
- package/src/compat/browser_compatibility_types.ts +8 -1
- package/src/compat/browser_version.ts +17 -1
- package/src/compat/disable_remote_playback_on_managed_media_source.ts +2 -2
- package/src/compat/is_codec_supported.ts +2 -1
- package/src/compat/should_patch_out_dolby_vision_config_data_from_mp4.ts +50 -0
- package/src/core/adaptive/__tests__/adaptive_representation_selector.test.ts +68 -28
- package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +26 -84
- package/src/core/entry/__tests__/utils.test.ts +7 -1
- package/src/core/entry/utils.ts +4 -4
- package/src/core/fetchers/segment/segment_fetcher.ts +2 -1
- package/src/errors/__tests__/format_error.test.ts +23 -24
- package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +2 -1
- package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +106 -0
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/HDCPPolicy.test.ts +19 -42
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/decodingInfo.test.ts +33 -40
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/defaultCodecsFinder.test.ts +44 -68
- package/src/experimental/tools/mediaCapabilitiesProber/probers/__tests__/mediaContentType.test.ts +45 -80
- package/src/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.ts +3 -1
- package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.ts +2 -1
- package/src/features/__tests__/add_features.test.ts +12 -27
- package/src/initialize_worker.ts +1 -1
- package/src/main_thread/api/__tests__/option_utils.test.ts +38 -67
- package/src/main_thread/api/__tests__/public_api.test.ts +56 -138
- package/src/main_thread/api/debug/modules/segment_buffer_content.ts +3 -3
- package/src/main_thread/api/public_api.ts +2 -2
- package/src/main_thread/decrypt/__tests__/__global__/find_key_system.test.ts +46 -28
- package/src/main_thread/decrypt/__tests__/__global__/get_license.test.ts +40 -10
- package/src/main_thread/decrypt/__tests__/__global__/init_data.test.ts +112 -129
- package/src/main_thread/decrypt/__tests__/__global__/media_key_system_access.test.ts +282 -377
- package/src/main_thread/decrypt/__tests__/__global__/media_keys.test.ts +70 -63
- package/src/main_thread/decrypt/__tests__/__global__/server_certificate.test.ts +73 -54
- package/src/main_thread/decrypt/__tests__/__global__/utils.ts +43 -83
- package/src/main_thread/decrypt/__tests__/find_key_system.test.ts +36 -17
- package/src/main_thread/decrypt/utils/__tests__/clean_old_stored_persistent_info.test.ts +44 -48
- package/src/main_thread/init/utils/__tests__/are_same_stream_events.test.ts +7 -22
- package/src/main_thread/init/utils/__tests__/refresh_scheduled_events_list.test.ts +3 -6
- package/src/main_thread/init/utils/__tests__/update_manifest_codec_support.test.ts +42 -19
- package/src/main_thread/init/utils/update_manifest_codec_support.ts +8 -6
- package/src/manifest/classes/__tests__/adaptation.test.ts +69 -125
- package/src/manifest/classes/__tests__/manifest.test.ts +88 -95
- package/src/manifest/classes/__tests__/period.test.ts +167 -117
- package/src/manifest/classes/__tests__/representation.test.ts +84 -25
- package/src/manifest/classes/__tests__/update_periods.test.ts +96 -225
- package/src/manifest/classes/adaptation.ts +4 -1
- package/src/manifest/classes/representation.ts +59 -27
- package/src/manifest/types.ts +14 -6
- package/src/manifest/utils.ts +4 -4
- package/src/mse/__tests__/main_media_source_interface.test.ts +3 -1
- package/src/mse/__tests__/worker_media_source_interface.test.ts +608 -0
- package/src/mse/main_media_source_interface.ts +2 -1
- package/src/mse/worker_media_source_interface.ts +2 -2
- package/src/parsers/containers/isobmff/__tests__/get_box.test.ts +449 -0
- package/src/parsers/containers/isobmff/__tests__/remove_dolby_vision_config_data.test.ts +282 -0
- package/src/parsers/containers/isobmff/get_box.ts +17 -0
- package/src/parsers/containers/isobmff/index.ts +8 -1
- package/src/parsers/containers/isobmff/remove_dolby_vision_config_data.ts +179 -0
- package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +19 -25
- package/src/parsers/manifest/dash/common/__tests__/get_http_utc-timing_url.test.ts +7 -19
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/ContentProtection.test.ts +26 -37
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/Initialization.test.ts +24 -53
- package/src/parsers/manifest/dash/js-parser/node_parsers/__tests__/SegmentURL.test.ts +31 -78
- package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +6 -4
- package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +79 -87
- package/src/parsers/texttracks/ttml/__tests__/resolve_styles_inheritance.test.ts +20 -26
- package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts +2 -7
- package/src/parsers/texttracks/webvtt/__tests__/parse_cue_block.test.ts +33 -30
- package/src/parsers/texttracks/webvtt/__tests__/parse_style_block.test.ts +33 -100
- package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +16 -18
- package/src/parsers/texttracks/webvtt/html/__tests__/parse_webvtt_to_div.test.ts +73 -78
- package/src/parsers/texttracks/webvtt/html/__tests__/to_html.test.ts +36 -37
- package/src/transports/dash/segment_parser.ts +13 -0
- package/src/transports/dash/text_parser.ts +5 -1
- package/src/transports/local/text_parser.ts +5 -1
- package/src/transports/metaplaylist/pipelines.ts +2 -1
- package/src/transports/smooth/isobmff/__tests__/create_boxes.test.ts +150 -127
- package/src/transports/smooth/pipelines.ts +3 -3
- package/src/transports/types.ts +28 -2
- package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +49 -75
- package/src/transports/utils/parse_text_track.ts +10 -3
- package/src/utils/__tests__/object_assign.test.ts +2 -2
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
1
|
+
import { describe, beforeEach, it, expect, vi, afterEach } from "vitest";
|
|
2
2
|
import type { IStyleElements } from "../../parse_style_block";
|
|
3
|
-
import
|
|
3
|
+
import toHTML from "../to_html";
|
|
4
|
+
|
|
5
|
+
const mocks = vi.hoisted(() => {
|
|
6
|
+
return {
|
|
7
|
+
convertPayloadToHTML: vi.fn(),
|
|
8
|
+
};
|
|
9
|
+
});
|
|
10
|
+
vi.mock("../convert_payload_to_html", () => ({
|
|
11
|
+
default: mocks.convertPayloadToHTML,
|
|
12
|
+
}));
|
|
4
13
|
|
|
5
14
|
describe("parsers - webvtt - toHTML", () => {
|
|
6
15
|
beforeEach(() => {
|
|
7
16
|
vi.resetModules();
|
|
8
17
|
});
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
mocks.convertPayloadToHTML.mockReset();
|
|
20
|
+
});
|
|
9
21
|
|
|
10
|
-
it("should include payload HTML",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}));
|
|
22
|
+
it("should include payload HTML", () => {
|
|
23
|
+
mocks.convertPayloadToHTML.mockImplementation(() => [
|
|
24
|
+
document.createElement("b"),
|
|
25
|
+
document.createTextNode("Hello"),
|
|
26
|
+
]);
|
|
16
27
|
|
|
17
|
-
const toHTML = (await vi.importActual("../to_html")).default as typeof IToHtml;
|
|
18
28
|
const cueObject = {
|
|
19
29
|
start: 0,
|
|
20
30
|
end: 100,
|
|
@@ -46,14 +56,12 @@ describe("parsers - webvtt - toHTML", () => {
|
|
|
46
56
|
);
|
|
47
57
|
});
|
|
48
58
|
|
|
49
|
-
it("should include payload HTML and apply correclty style class element",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}));
|
|
59
|
+
it("should include payload HTML and apply correclty style class element", () => {
|
|
60
|
+
mocks.convertPayloadToHTML.mockImplementation(() => [
|
|
61
|
+
document.createElement("b"),
|
|
62
|
+
document.createTextNode("Hello"),
|
|
63
|
+
]);
|
|
55
64
|
|
|
56
|
-
const toHTML = (await vi.importActual("../to_html")).default as typeof IToHtml;
|
|
57
65
|
const cueObject = {
|
|
58
66
|
start: 0,
|
|
59
67
|
end: 100,
|
|
@@ -87,14 +95,12 @@ describe("parsers - webvtt - toHTML", () => {
|
|
|
87
95
|
);
|
|
88
96
|
});
|
|
89
97
|
|
|
90
|
-
it("should include payload HTML and apply correctly global style element",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}));
|
|
98
|
+
it("should include payload HTML and apply correctly global style element", () => {
|
|
99
|
+
mocks.convertPayloadToHTML.mockImplementation(() => [
|
|
100
|
+
document.createElement("b"),
|
|
101
|
+
document.createTextNode("Hello"),
|
|
102
|
+
]);
|
|
96
103
|
|
|
97
|
-
const toHTML = (await vi.importActual("../to_html")).default as typeof IToHtml;
|
|
98
104
|
const cueObject = {
|
|
99
105
|
start: 0,
|
|
100
106
|
end: 100,
|
|
@@ -127,14 +133,12 @@ describe("parsers - webvtt - toHTML", () => {
|
|
|
127
133
|
);
|
|
128
134
|
});
|
|
129
135
|
|
|
130
|
-
it("should apply both the global style element and a given class",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}));
|
|
136
|
+
it("should apply both the global style element and a given class", () => {
|
|
137
|
+
mocks.convertPayloadToHTML.mockImplementation(() => [
|
|
138
|
+
document.createElement("b"),
|
|
139
|
+
document.createTextNode("Hello"),
|
|
140
|
+
]);
|
|
136
141
|
|
|
137
|
-
const toHTML = (await vi.importActual("../to_html")).default as typeof IToHtml;
|
|
138
142
|
const cueObject = {
|
|
139
143
|
start: 0,
|
|
140
144
|
end: 100,
|
|
@@ -168,14 +172,9 @@ describe("parsers - webvtt - toHTML", () => {
|
|
|
168
172
|
);
|
|
169
173
|
});
|
|
170
174
|
|
|
171
|
-
it("should return default element if no payload",
|
|
172
|
-
|
|
173
|
-
default: () => {
|
|
174
|
-
return [];
|
|
175
|
-
},
|
|
176
|
-
}));
|
|
175
|
+
it("should return default element if no payload", () => {
|
|
176
|
+
mocks.convertPayloadToHTML.mockImplementation(() => []);
|
|
177
177
|
|
|
178
|
-
const toHTML = (await vi.importActual("../to_html")).default as typeof IToHtml;
|
|
179
178
|
const cueObject = {
|
|
180
179
|
start: 0,
|
|
181
180
|
end: 100,
|
|
@@ -14,10 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import shouldPatchOutDolbyVisionConfigDataFromMp4 from "../../compat/should_patch_out_dolby_vision_config_data_from_mp4";
|
|
18
|
+
import logger from "../../log";
|
|
17
19
|
import {
|
|
18
20
|
getMDHDTimescale,
|
|
19
21
|
getSegmentsFromSidx,
|
|
20
22
|
takePSSHOut,
|
|
23
|
+
removeDolbyVisionConfigData,
|
|
21
24
|
} from "../../parsers/containers/isobmff";
|
|
22
25
|
import {
|
|
23
26
|
getKeyIdFromInitSegment,
|
|
@@ -163,6 +166,16 @@ export default function generateAudioVideoSegmentParser({
|
|
|
163
166
|
if (containerType === "webm") {
|
|
164
167
|
segmentList = getSegmentsFromCues(chunkData, 0);
|
|
165
168
|
} else if (seemsToBeMP4) {
|
|
169
|
+
if (
|
|
170
|
+
shouldPatchOutDolbyVisionConfigDataFromMp4(
|
|
171
|
+
context.baseCodecs,
|
|
172
|
+
context.chosenCodec,
|
|
173
|
+
)
|
|
174
|
+
) {
|
|
175
|
+
logger.debug("dash", "patching out Dolby Vision metadata from segment");
|
|
176
|
+
removeDolbyVisionConfigData(chunkData);
|
|
177
|
+
}
|
|
178
|
+
|
|
166
179
|
segmentList = getSegmentsFromSidx(
|
|
167
180
|
chunkData,
|
|
168
181
|
Array.isArray(indexRange) ? indexRange[0] : 0,
|
|
@@ -106,7 +106,11 @@ function parseISOBMFFEmbeddedTextTrack(
|
|
|
106
106
|
}
|
|
107
107
|
const chunkInfos = getISOBMFFTimingInfos(chunkBytes, isChunked, segment, initTimescale);
|
|
108
108
|
const chunkData = getISOBMFFEmbeddedTextTrackData(
|
|
109
|
-
|
|
109
|
+
{
|
|
110
|
+
segment: context.segment,
|
|
111
|
+
codecs: context.chosenCodec,
|
|
112
|
+
language: context.language,
|
|
113
|
+
},
|
|
110
114
|
chunkBytes,
|
|
111
115
|
initTimescale,
|
|
112
116
|
chunkInfos,
|
|
@@ -76,7 +76,11 @@ function parseISOBMFFEmbeddedTextTrack(
|
|
|
76
76
|
}
|
|
77
77
|
const chunkInfos = getISOBMFFTimingInfos(chunkBytes, isChunked, segment, initTimescale);
|
|
78
78
|
const chunkData = getISOBMFFEmbeddedTextTrackData(
|
|
79
|
-
|
|
79
|
+
{
|
|
80
|
+
segment: context.segment,
|
|
81
|
+
codecs: context.chosenCodec,
|
|
82
|
+
language: context.language,
|
|
83
|
+
},
|
|
80
84
|
chunkBytes,
|
|
81
85
|
initTimescale,
|
|
82
86
|
chunkInfos,
|
|
@@ -64,7 +64,8 @@ function getOriginalContext(mplContext: ISegmentContext): ISegmentContext {
|
|
|
64
64
|
type: mplContext.type,
|
|
65
65
|
language: mplContext.language,
|
|
66
66
|
mimeType: mplContext.mimeType,
|
|
67
|
-
|
|
67
|
+
baseCodecs: mplContext.baseCodecs,
|
|
68
|
+
chosenCodec: mplContext.chosenCodec,
|
|
68
69
|
isLive,
|
|
69
70
|
periodStart,
|
|
70
71
|
periodEnd,
|
|
@@ -1,60 +1,129 @@
|
|
|
1
1
|
import { describe, beforeEach, it, expect, vi } from "vitest";
|
|
2
|
-
import
|
|
3
|
-
createFRMABox
|
|
4
|
-
createFreeBox
|
|
5
|
-
createHDLRBox
|
|
6
|
-
createMDHDBox
|
|
7
|
-
createSMHDBox
|
|
8
|
-
createVMHDBox
|
|
2
|
+
import {
|
|
3
|
+
createFRMABox,
|
|
4
|
+
createFreeBox,
|
|
5
|
+
createHDLRBox,
|
|
6
|
+
createMDHDBox,
|
|
7
|
+
createSMHDBox,
|
|
8
|
+
createVMHDBox,
|
|
9
9
|
} from "../create_boxes";
|
|
10
10
|
|
|
11
|
+
const mocks = vi.hoisted(() => {
|
|
12
|
+
return {
|
|
13
|
+
isobmff: {
|
|
14
|
+
createBox: vi.fn(),
|
|
15
|
+
},
|
|
16
|
+
byteParsing: {
|
|
17
|
+
itobe2: vi.fn(),
|
|
18
|
+
itobe4: vi.fn(),
|
|
19
|
+
itobe8: vi.fn(),
|
|
20
|
+
le2toi: vi.fn(),
|
|
21
|
+
be2toi: vi.fn(),
|
|
22
|
+
be3toi: vi.fn(),
|
|
23
|
+
be4toi: vi.fn(),
|
|
24
|
+
be8toi: vi.fn(),
|
|
25
|
+
concat: vi.fn(),
|
|
26
|
+
be4toiSigned: vi.fn(),
|
|
27
|
+
},
|
|
28
|
+
stringParsing: {
|
|
29
|
+
strToUtf8: vi.fn(),
|
|
30
|
+
bytesToHex: vi.fn(),
|
|
31
|
+
guidToUuid: vi.fn(),
|
|
32
|
+
utf16LEToStr: vi.fn(),
|
|
33
|
+
hexToBytes: vi.fn(),
|
|
34
|
+
readNullTerminatedString: vi.fn(),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
vi.mock("../../../../parsers/containers/isobmff", () => ({
|
|
39
|
+
createBox: mocks.isobmff.createBox,
|
|
40
|
+
}));
|
|
41
|
+
vi.mock("../../../../utils/byte_parsing", () => ({
|
|
42
|
+
itobe2: mocks.byteParsing.itobe2,
|
|
43
|
+
itobe4: mocks.byteParsing.itobe4,
|
|
44
|
+
itobe8: mocks.byteParsing.itobe8,
|
|
45
|
+
le2toi: mocks.byteParsing.le2toi,
|
|
46
|
+
be2toi: mocks.byteParsing.be2toi,
|
|
47
|
+
be3toi: mocks.byteParsing.be3toi,
|
|
48
|
+
be4toi: mocks.byteParsing.be4toi,
|
|
49
|
+
be8toi: mocks.byteParsing.be8toi,
|
|
50
|
+
concat: mocks.byteParsing.concat,
|
|
51
|
+
be4toiSigned: mocks.byteParsing.be4toiSigned,
|
|
52
|
+
}));
|
|
53
|
+
vi.mock("../../../../utils/string_parsing", () => ({
|
|
54
|
+
strToUtf8: mocks.stringParsing.strToUtf8,
|
|
55
|
+
bytesToHex: mocks.stringParsing.bytesToHex,
|
|
56
|
+
guidToUuid: mocks.stringParsing.guidToUuid,
|
|
57
|
+
utf16LEToStr: mocks.stringParsing.utf16LEToStr,
|
|
58
|
+
hexToBytes: mocks.stringParsing.hexToBytes,
|
|
59
|
+
readNullTerminatedString: mocks.stringParsing.readNullTerminatedString,
|
|
60
|
+
}));
|
|
61
|
+
|
|
11
62
|
describe("Smooth - ISOBMFF - boxes creation", () => {
|
|
12
|
-
beforeEach(() => {
|
|
63
|
+
beforeEach(async () => {
|
|
13
64
|
vi.resetModules();
|
|
65
|
+
|
|
66
|
+
const actualIsobmff = await vi.importActual("../../../../parsers/containers/isobmff");
|
|
67
|
+
const actualByteParsing = await vi.importActual("../../../../utils/byte_parsing");
|
|
68
|
+
const actualStringParsing = await vi.importActual("../../../../utils/string_parsing");
|
|
69
|
+
|
|
70
|
+
const isobmffKeys = Object.keys(mocks.isobmff) as Array<keyof typeof mocks.isobmff>;
|
|
71
|
+
isobmffKeys.forEach((key: keyof typeof mocks.isobmff) => {
|
|
72
|
+
mocks.isobmff[key].mockReset();
|
|
73
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
74
|
+
mocks.isobmff[key].mockImplementation(actualIsobmff[key] as (...args: any) => any);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const byteParsingKeys = Object.keys(mocks.byteParsing) as Array<
|
|
78
|
+
keyof typeof mocks.byteParsing
|
|
79
|
+
>;
|
|
80
|
+
byteParsingKeys.forEach((key: keyof typeof mocks.byteParsing) => {
|
|
81
|
+
mocks.byteParsing[key].mockReset();
|
|
82
|
+
mocks.byteParsing[key].mockImplementation(
|
|
83
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
84
|
+
actualByteParsing[key] as (...args: any) => any,
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const stringParsingKeys = Object.keys(mocks.stringParsing) as Array<
|
|
89
|
+
keyof typeof mocks.stringParsing
|
|
90
|
+
>;
|
|
91
|
+
stringParsingKeys.forEach((key: keyof typeof mocks.stringParsing) => {
|
|
92
|
+
mocks.stringParsing[key].mockReset();
|
|
93
|
+
mocks.stringParsing[key].mockImplementation(
|
|
94
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
95
|
+
actualStringParsing[key] as (...args: any) => any,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
14
98
|
});
|
|
15
99
|
|
|
16
100
|
describe("createVMHDBox", () => {
|
|
17
|
-
it("should create always the same vmhd box",
|
|
101
|
+
it("should create always the same vmhd box", () => {
|
|
18
102
|
const vmhdContent = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
19
103
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
20
|
-
|
|
21
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
22
|
-
return { createBox: mockCreateBox };
|
|
23
|
-
});
|
|
24
|
-
const createVMHDBox = (await vi.importActual("../create_boxes"))
|
|
25
|
-
.createVMHDBox as typeof ICreateVMHDBox;
|
|
104
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
26
105
|
expect(createVMHDBox()).toBe(box);
|
|
27
|
-
expect(
|
|
28
|
-
expect(
|
|
106
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
107
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("vmhd", vmhdContent);
|
|
29
108
|
});
|
|
30
109
|
});
|
|
31
110
|
|
|
32
111
|
describe("createFreeBox", () => {
|
|
33
|
-
it("should create box full of 0s",
|
|
112
|
+
it("should create box full of 0s", () => {
|
|
34
113
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
35
|
-
|
|
36
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
37
|
-
return { createBox: mockCreateBox };
|
|
38
|
-
});
|
|
39
|
-
const createFreeBox = (await vi.importActual("../create_boxes"))
|
|
40
|
-
.createFreeBox as typeof ICreateFreeBox;
|
|
114
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
41
115
|
expect(createFreeBox(8)).toBe(box);
|
|
42
|
-
expect(
|
|
43
|
-
expect(
|
|
116
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
117
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("free", new Uint8Array([]));
|
|
44
118
|
|
|
45
119
|
expect(createFreeBox(15)).toBe(box);
|
|
46
|
-
expect(
|
|
47
|
-
expect(
|
|
120
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(2);
|
|
121
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("free", new Uint8Array(7));
|
|
48
122
|
});
|
|
49
123
|
|
|
50
|
-
it("should throw when given a length below 8",
|
|
124
|
+
it("should throw when given a length below 8", () => {
|
|
51
125
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
52
|
-
|
|
53
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
54
|
-
return { createBox: mockCreateBox };
|
|
55
|
-
});
|
|
56
|
-
const createFreeBox = (await vi.importActual("../create_boxes"))
|
|
57
|
-
.createFreeBox as typeof ICreateFreeBox;
|
|
126
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
58
127
|
expect(() => createFreeBox(7)).toThrow();
|
|
59
128
|
expect(() => createFreeBox(6)).toThrow();
|
|
60
129
|
expect(() => createFreeBox(5)).toThrow();
|
|
@@ -63,47 +132,32 @@ describe("Smooth - ISOBMFF - boxes creation", () => {
|
|
|
63
132
|
expect(() => createFreeBox(2)).toThrow();
|
|
64
133
|
expect(() => createFreeBox(1)).toThrow();
|
|
65
134
|
expect(() => createFreeBox(0)).toThrow();
|
|
66
|
-
expect(
|
|
135
|
+
expect(mocks.isobmff.createBox).not.toHaveBeenCalled();
|
|
67
136
|
});
|
|
68
137
|
|
|
69
|
-
it("should throw when given a negative length",
|
|
138
|
+
it("should throw when given a negative length", () => {
|
|
70
139
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
71
|
-
|
|
72
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
73
|
-
return { createBox: mockCreateBox };
|
|
74
|
-
});
|
|
75
|
-
const createFreeBox = (await vi.importActual("../create_boxes"))
|
|
76
|
-
.createFreeBox as typeof ICreateFreeBox;
|
|
140
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
77
141
|
expect(() => createFreeBox(-1)).toThrow();
|
|
78
|
-
expect(
|
|
142
|
+
expect(mocks.isobmff.createBox).not.toHaveBeenCalled();
|
|
79
143
|
});
|
|
80
144
|
|
|
81
|
-
it("should throw when given a non-finite length",
|
|
145
|
+
it("should throw when given a non-finite length", () => {
|
|
82
146
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
83
|
-
|
|
84
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
85
|
-
return { createBox: mockCreateBox };
|
|
86
|
-
});
|
|
87
|
-
const createFreeBox = (await vi.importActual("../create_boxes"))
|
|
88
|
-
.createFreeBox as typeof ICreateFreeBox;
|
|
147
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
89
148
|
expect(() => createFreeBox(-Infinity)).toThrow();
|
|
90
149
|
expect(() => createFreeBox(+Infinity)).toThrow();
|
|
91
|
-
expect(
|
|
150
|
+
expect(mocks.isobmff.createBox).not.toHaveBeenCalled();
|
|
92
151
|
});
|
|
93
152
|
});
|
|
94
153
|
|
|
95
154
|
describe("createHDLRBox", () => {
|
|
96
|
-
it("should always create the same audio box",
|
|
155
|
+
it("should always create the same audio box", () => {
|
|
97
156
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
98
|
-
|
|
99
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
100
|
-
return { createBox: mockCreateBox };
|
|
101
|
-
});
|
|
102
|
-
const createHDLRBox = (await vi.importActual("../create_boxes"))
|
|
103
|
-
.createHDLRBox as typeof ICreateHDLRBox;
|
|
157
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
104
158
|
expect(createHDLRBox("audio")).toBe(box);
|
|
105
|
-
expect(
|
|
106
|
-
expect(
|
|
159
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
160
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith(
|
|
107
161
|
"hdlr",
|
|
108
162
|
new Uint8Array([
|
|
109
163
|
0,
|
|
@@ -147,17 +201,12 @@ describe("Smooth - ISOBMFF - boxes creation", () => {
|
|
|
147
201
|
);
|
|
148
202
|
});
|
|
149
203
|
|
|
150
|
-
it("should always create the same video box",
|
|
204
|
+
it("should always create the same video box", () => {
|
|
151
205
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
152
|
-
|
|
153
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
154
|
-
return { createBox: mockCreateBox };
|
|
155
|
-
});
|
|
156
|
-
const createHDLRBox = (await vi.importActual("../create_boxes"))
|
|
157
|
-
.createHDLRBox as typeof ICreateHDLRBox;
|
|
206
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
158
207
|
expect(createHDLRBox("video")).toBe(box);
|
|
159
|
-
expect(
|
|
160
|
-
expect(
|
|
208
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
209
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith(
|
|
161
210
|
"hdlr",
|
|
162
211
|
new Uint8Array([
|
|
163
212
|
0,
|
|
@@ -201,17 +250,12 @@ describe("Smooth - ISOBMFF - boxes creation", () => {
|
|
|
201
250
|
);
|
|
202
251
|
});
|
|
203
252
|
|
|
204
|
-
it("should always create the same hint box",
|
|
253
|
+
it("should always create the same hint box", () => {
|
|
205
254
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
206
|
-
|
|
207
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
208
|
-
return { createBox: mockCreateBox };
|
|
209
|
-
});
|
|
210
|
-
const createHDLRBox = (await vi.importActual("../create_boxes"))
|
|
211
|
-
.createHDLRBox as typeof ICreateHDLRBox;
|
|
255
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
212
256
|
expect(createHDLRBox("hint")).toBe(box);
|
|
213
|
-
expect(
|
|
214
|
-
expect(
|
|
257
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
258
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith(
|
|
215
259
|
"hdlr",
|
|
216
260
|
new Uint8Array([
|
|
217
261
|
0,
|
|
@@ -245,81 +289,60 @@ describe("Smooth - ISOBMFF - boxes creation", () => {
|
|
|
245
289
|
});
|
|
246
290
|
|
|
247
291
|
describe("createMDHDBox", () => {
|
|
248
|
-
it("should just integrate the timescale given",
|
|
292
|
+
it("should just integrate the timescale given", () => {
|
|
249
293
|
const translatedTimeScale = new Uint8Array([4, 3, 2, 1]);
|
|
250
294
|
const concatenated = new Uint8Array([9, 10, 11, 12]);
|
|
251
295
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
vi.doMock("../../../../utils/byte_parsing", () => {
|
|
256
|
-
return { itobe4: mockItobe4, concat: mockConcat };
|
|
257
|
-
});
|
|
258
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
259
|
-
return { createBox: mockCreateBox };
|
|
260
|
-
});
|
|
261
|
-
const createMDHDBox = (await vi.importActual("../create_boxes"))
|
|
262
|
-
.createMDHDBox as typeof ICreateMDHDBox;
|
|
296
|
+
mocks.byteParsing.itobe4.mockImplementation(() => translatedTimeScale);
|
|
297
|
+
mocks.byteParsing.concat.mockImplementation(() => concatenated);
|
|
298
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
263
299
|
|
|
264
300
|
expect(createMDHDBox(8)).toBe(box);
|
|
265
301
|
|
|
266
|
-
expect(
|
|
267
|
-
expect(
|
|
302
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
303
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("mdhd", concatenated);
|
|
268
304
|
|
|
269
|
-
expect(
|
|
270
|
-
expect(
|
|
305
|
+
expect(mocks.byteParsing.itobe4).toHaveBeenCalledTimes(1);
|
|
306
|
+
expect(mocks.byteParsing.itobe4).toHaveBeenCalledWith(8);
|
|
271
307
|
|
|
272
|
-
expect(
|
|
273
|
-
expect(
|
|
308
|
+
expect(mocks.byteParsing.concat).toHaveBeenCalledTimes(1);
|
|
309
|
+
expect(mocks.byteParsing.concat).toHaveBeenCalledWith(12, translatedTimeScale, 8);
|
|
274
310
|
|
|
275
311
|
expect(createMDHDBox(99)).toBe(box);
|
|
276
312
|
|
|
277
|
-
expect(
|
|
278
|
-
expect(
|
|
313
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(2);
|
|
314
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("mdhd", concatenated);
|
|
279
315
|
|
|
280
|
-
expect(
|
|
281
|
-
expect(
|
|
316
|
+
expect(mocks.byteParsing.itobe4).toHaveBeenCalledTimes(2);
|
|
317
|
+
expect(mocks.byteParsing.itobe4).toHaveBeenCalledWith(99);
|
|
282
318
|
|
|
283
|
-
expect(
|
|
284
|
-
expect(
|
|
319
|
+
expect(mocks.byteParsing.concat).toHaveBeenCalledTimes(2);
|
|
320
|
+
expect(mocks.byteParsing.concat).toHaveBeenCalledWith(12, translatedTimeScale, 8);
|
|
285
321
|
});
|
|
286
322
|
});
|
|
287
323
|
|
|
288
324
|
describe("createSMHDBox", () => {
|
|
289
|
-
it("should create always the same smhd box",
|
|
325
|
+
it("should create always the same smhd box", () => {
|
|
290
326
|
const smhdContent = new Uint8Array(8);
|
|
291
327
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
292
|
-
|
|
293
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
294
|
-
return { createBox: mockCreateBox };
|
|
295
|
-
});
|
|
296
|
-
const createSMHDBox = (await vi.importActual("../create_boxes"))
|
|
297
|
-
.createSMHDBox as typeof ICreateSMHDBox;
|
|
328
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
298
329
|
expect(createSMHDBox()).toBe(box);
|
|
299
|
-
expect(
|
|
300
|
-
expect(
|
|
330
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
331
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("smhd", smhdContent);
|
|
301
332
|
});
|
|
302
333
|
});
|
|
303
334
|
|
|
304
335
|
describe("createFRMABox", () => {
|
|
305
|
-
it("should just integrate the data format",
|
|
336
|
+
it("should just integrate the data format", () => {
|
|
306
337
|
const dataFormatToBytes = new Uint8Array([4, 3, 2, 1]);
|
|
307
338
|
const box = new Uint8Array([1, 2, 3, 4]);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
vi.doMock("../../../../utils/string_parsing", () => {
|
|
311
|
-
return { strToUtf8: mockStrToUtf8 };
|
|
312
|
-
});
|
|
313
|
-
vi.doMock("../../../../parsers/containers/isobmff", () => {
|
|
314
|
-
return { createBox: mockCreateBox };
|
|
315
|
-
});
|
|
316
|
-
const createFRMABox = (await vi.importActual("../create_boxes"))
|
|
317
|
-
.createFRMABox as typeof ICreateFRMABox;
|
|
339
|
+
mocks.stringParsing.strToUtf8.mockImplementation(() => dataFormatToBytes);
|
|
340
|
+
mocks.isobmff.createBox.mockImplementation(() => box);
|
|
318
341
|
expect(createFRMABox("foo")).toBe(box);
|
|
319
|
-
expect(
|
|
320
|
-
expect(
|
|
321
|
-
expect(
|
|
322
|
-
expect(
|
|
342
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledTimes(1);
|
|
343
|
+
expect(mocks.isobmff.createBox).toHaveBeenCalledWith("frma", dataFormatToBytes);
|
|
344
|
+
expect(mocks.stringParsing.strToUtf8).toHaveBeenCalledTimes(1);
|
|
345
|
+
expect(mocks.stringParsing.strToUtf8).toHaveBeenCalledWith("foo");
|
|
323
346
|
});
|
|
324
347
|
});
|
|
325
348
|
});
|
|
@@ -269,7 +269,7 @@ export default function (transportOptions: ITransportOptions): ITransportPipelin
|
|
|
269
269
|
):
|
|
270
270
|
| ISegmentParserParsedInitChunk<null>
|
|
271
271
|
| ISegmentParserParsedMediaChunk<ITextTrackSegmentData | null> {
|
|
272
|
-
const { segment, language, mimeType = "",
|
|
272
|
+
const { segment, language, mimeType = "", chosenCodec = "" } = context;
|
|
273
273
|
const isMP4 = isMP4EmbeddedTrack(context.mimeType);
|
|
274
274
|
const { data, isChunked } = loadedSegment;
|
|
275
275
|
let chunkSize: number | undefined;
|
|
@@ -339,7 +339,7 @@ export default function (transportOptions: ITransportOptions): ITransportPipelin
|
|
|
339
339
|
: segment.end;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
const lcCodec =
|
|
342
|
+
const lcCodec = chosenCodec.toLowerCase();
|
|
343
343
|
if (
|
|
344
344
|
mimeType === "application/ttml+xml+mp4" ||
|
|
345
345
|
lcCodec === "stpp" ||
|
|
@@ -382,7 +382,7 @@ export default function (transportOptions: ITransportOptions): ITransportPipelin
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
if (_sdType === undefined) {
|
|
385
|
-
const lcCodec =
|
|
385
|
+
const lcCodec = chosenCodec.toLowerCase();
|
|
386
386
|
if (lcCodec === "srt") {
|
|
387
387
|
_sdType = "srt";
|
|
388
388
|
} else {
|
package/src/transports/types.ts
CHANGED
|
@@ -556,8 +556,34 @@ export interface ISegmentContext {
|
|
|
556
556
|
periodEnd: number | undefined;
|
|
557
557
|
/** Mimetype of the corresponding Representation. */
|
|
558
558
|
mimeType?: string | undefined;
|
|
559
|
-
/**
|
|
560
|
-
|
|
559
|
+
/**
|
|
560
|
+
* An array of strings describing codecs that Representation relies on.
|
|
561
|
+
*
|
|
562
|
+
* If multiple elements are in this array, each element is a codec (or groups
|
|
563
|
+
* of codecs, e.g. for both audio and video) enhancing and backward compatible
|
|
564
|
+
* to the next element of that array.
|
|
565
|
+
*
|
|
566
|
+
* For example, a Dolby Vision video Representation could be retro-compatible
|
|
567
|
+
* with HDR10 decoders not handling Dolby Vision-specific metadata.
|
|
568
|
+
* In that scenario, we could have an array with two elements:
|
|
569
|
+
* 1. The Dolby Vision codec
|
|
570
|
+
* 2. The base HDR10 codec, hopefully with higher device compatibility.
|
|
571
|
+
*/
|
|
572
|
+
baseCodecs: string[];
|
|
573
|
+
/**
|
|
574
|
+
* `baseCodecs` can define multiple codecs linked to this `Representation`,
|
|
575
|
+
* e.g. Dolby Vision retro-compatible to a non-Dolby Vision HEVC-based
|
|
576
|
+
* codec).
|
|
577
|
+
*
|
|
578
|
+
* But on the current device, we'll generally want to announce a unique
|
|
579
|
+
* codec, after checking the one that is supported.
|
|
580
|
+
*
|
|
581
|
+
* This is what `chosenCodecs` is for: the actual codec to rely on.
|
|
582
|
+
*
|
|
583
|
+
* Set to `undefined` initially until we know which codec from `baseCodecs`
|
|
584
|
+
* is supported.
|
|
585
|
+
*/
|
|
586
|
+
chosenCodec: string | undefined;
|
|
561
587
|
/**
|
|
562
588
|
* Last published time for the Manifest file in which this segment has been
|
|
563
589
|
* defined.
|