rx-player 4.0.0-dev.202402213 → 4.0.0-dev.2024022300
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/VERSION +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/commonjs/core/main/worker/worker_main.js +8 -9
- package/dist/commonjs/features/features_object.js +1 -1
- package/dist/commonjs/features/list/dash.js +2 -2
- package/dist/commonjs/features/types.d.ts +8 -3
- package/dist/commonjs/main_thread/api/public_api.js +2 -7
- package/dist/commonjs/multithread_types.d.ts +1 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +4 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +11 -4
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +12 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +3 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -11
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +74 -3
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -1
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +3 -1
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/index.js +19 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +400 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +33 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +70 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +118 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +154 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +70 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +221 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +179 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +256 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +152 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +60 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +125 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +36 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +82 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +382 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +142 -0
- package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +5 -3
- package/dist/commonjs/public_types.d.ts +1 -1
- package/dist/commonjs/transports/dash/manifest_parser.js +33 -4
- package/dist/commonjs/utils/xml-parser.d.ts +70 -0
- package/dist/commonjs/utils/xml-parser.js +357 -0
- package/dist/es2017/__GENERATED_CODE/embedded_dash_wasm.js +1 -1
- package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
- package/dist/es2017/core/main/worker/worker_main.js +8 -9
- package/dist/es2017/features/features_object.js +1 -1
- package/dist/es2017/features/list/dash.js +2 -2
- package/dist/es2017/features/types.d.ts +8 -3
- package/dist/es2017/main_thread/api/public_api.js +2 -7
- package/dist/es2017/multithread_types.d.ts +1 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +4 -3
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +12 -5
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +13 -4
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +3 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -11
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +11 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +49 -2
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -1
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +3 -1
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/index.js +17 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/AdaptationSet.js +358 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/BaseURL.js +30 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentComponent.js +45 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/ContentProtection.js +77 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/EventStream.js +101 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Initialization.js +45 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/MPD.js +179 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Period.js +137 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/Representation.js +214 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentBase.js +111 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentList.js +41 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTemplate.js +84 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentTimeline.js +33 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/SegmentURL.js +57 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.d.ts +176 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/node_parsers/utils.js +310 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/fast-js-parser/parse_from_xml_string.js +114 -0
- package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +5 -3
- package/dist/es2017/public_types.d.ts +1 -1
- package/dist/es2017/transports/dash/manifest_parser.js +33 -4
- package/dist/es2017/utils/xml-parser.d.ts +70 -0
- package/dist/es2017/utils/xml-parser.js +322 -0
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.js +141 -65
- package/dist/rx-player.min.js +1 -1
- package/dist/worker.js +8 -3
- package/package.json +1 -1
- package/.vscode/settings.json +0 -9
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.js +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.d.ts +0 -0
- /package/dist/commonjs/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/index.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/AdaptationSet.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/BaseURL.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentComponent.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/ContentProtection.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/EventStream.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Initialization.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/MPD.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Period.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/Representation.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentBase.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentList.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTemplate.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentTimeline.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/SegmentURL.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/node_parsers/utils.js +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.d.ts +0 -0
- /package/dist/es2017/parsers/manifest/dash/{js-parser → native-parser}/parse_from_document.js +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
|
|
17
|
+
import parseBaseURL from "./BaseURL";
|
|
18
|
+
import parseContentProtection from "./ContentProtection";
|
|
19
|
+
import parseSegmentBase from "./SegmentBase";
|
|
20
|
+
import parseSegmentList from "./SegmentList";
|
|
21
|
+
import parseSegmentTemplate from "./SegmentTemplate";
|
|
22
|
+
import { MPDError, parseBoolean, parseMaybeDividedNumber, parseMPDFloat, parseMPDInteger, parseScheme, ValueParser, } from "./utils";
|
|
23
|
+
/**
|
|
24
|
+
* @param {Array.<Object | string>} representationChildren
|
|
25
|
+
* @returns {Object}
|
|
26
|
+
*/
|
|
27
|
+
function parseRepresentationChildren(representationChildren) {
|
|
28
|
+
const children = {
|
|
29
|
+
baseURLs: [],
|
|
30
|
+
};
|
|
31
|
+
const contentProtections = [];
|
|
32
|
+
let warnings = [];
|
|
33
|
+
for (let i = 0; i < representationChildren.length; i++) {
|
|
34
|
+
const currentElement = representationChildren[i];
|
|
35
|
+
if (typeof currentElement === "string") {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
switch (currentElement.tagName) {
|
|
39
|
+
case "BaseURL":
|
|
40
|
+
const [baseURLObj, baseURLWarnings] = parseBaseURL(currentElement);
|
|
41
|
+
if (baseURLObj !== undefined) {
|
|
42
|
+
children.baseURLs.push(baseURLObj);
|
|
43
|
+
}
|
|
44
|
+
warnings = warnings.concat(baseURLWarnings);
|
|
45
|
+
break;
|
|
46
|
+
case "InbandEventStream":
|
|
47
|
+
if (children.inbandEventStreams === undefined) {
|
|
48
|
+
children.inbandEventStreams = [];
|
|
49
|
+
}
|
|
50
|
+
children.inbandEventStreams.push(parseScheme(currentElement));
|
|
51
|
+
break;
|
|
52
|
+
case "SegmentBase":
|
|
53
|
+
const [segmentBase, segmentBaseWarnings] = parseSegmentBase(currentElement);
|
|
54
|
+
children.segmentBase = segmentBase;
|
|
55
|
+
if (segmentBaseWarnings.length > 0) {
|
|
56
|
+
warnings = warnings.concat(segmentBaseWarnings);
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
case "SegmentList":
|
|
60
|
+
const [segmentList, segmentListWarnings] = parseSegmentList(currentElement);
|
|
61
|
+
warnings = warnings.concat(segmentListWarnings);
|
|
62
|
+
children.segmentList = segmentList;
|
|
63
|
+
break;
|
|
64
|
+
case "SegmentTemplate":
|
|
65
|
+
const [segmentTemplate, segmentTemplateWarnings] = parseSegmentTemplate(currentElement);
|
|
66
|
+
warnings = warnings.concat(segmentTemplateWarnings);
|
|
67
|
+
children.segmentTemplate = segmentTemplate;
|
|
68
|
+
break;
|
|
69
|
+
case "ContentProtection":
|
|
70
|
+
const [contentProtection, contentProtectionWarnings] = parseContentProtection(currentElement);
|
|
71
|
+
if (contentProtectionWarnings.length > 0) {
|
|
72
|
+
warnings = warnings.concat(contentProtectionWarnings);
|
|
73
|
+
}
|
|
74
|
+
if (contentProtection !== undefined) {
|
|
75
|
+
contentProtections.push(contentProtection);
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
case "SupplementalProperty":
|
|
79
|
+
if (isNullOrUndefined(children.supplementalProperties)) {
|
|
80
|
+
children.supplementalProperties = [parseScheme(currentElement)];
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
children.supplementalProperties.push(parseScheme(currentElement));
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (contentProtections.length > 0) {
|
|
89
|
+
children.contentProtections = contentProtections;
|
|
90
|
+
}
|
|
91
|
+
return [children, warnings];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @param {Object} root
|
|
95
|
+
* @returns {Array}
|
|
96
|
+
*/
|
|
97
|
+
function parseRepresentationAttributes(root) {
|
|
98
|
+
const attributes = {};
|
|
99
|
+
const warnings = [];
|
|
100
|
+
const parseValue = ValueParser(attributes, warnings);
|
|
101
|
+
for (const attributeName of Object.keys(root.attributes)) {
|
|
102
|
+
const attributeVal = root.attributes[attributeName];
|
|
103
|
+
if (isNullOrUndefined(attributeVal)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
switch (attributeName) {
|
|
107
|
+
case "audioSamplingRate":
|
|
108
|
+
attributes.audioSamplingRate = attributeVal;
|
|
109
|
+
break;
|
|
110
|
+
case "bandwidth":
|
|
111
|
+
parseValue(attributeVal, {
|
|
112
|
+
asKey: "bitrate",
|
|
113
|
+
parser: parseMPDInteger,
|
|
114
|
+
dashName: "bandwidth",
|
|
115
|
+
});
|
|
116
|
+
break;
|
|
117
|
+
case "codecs":
|
|
118
|
+
attributes.codecs = attributeVal;
|
|
119
|
+
break;
|
|
120
|
+
case "codingDependency":
|
|
121
|
+
parseValue(attributeVal, {
|
|
122
|
+
asKey: "codingDependency",
|
|
123
|
+
parser: parseBoolean,
|
|
124
|
+
dashName: "codingDependency",
|
|
125
|
+
});
|
|
126
|
+
break;
|
|
127
|
+
case "frameRate":
|
|
128
|
+
parseValue(attributeVal, {
|
|
129
|
+
asKey: "frameRate",
|
|
130
|
+
parser: parseMaybeDividedNumber,
|
|
131
|
+
dashName: "frameRate",
|
|
132
|
+
});
|
|
133
|
+
break;
|
|
134
|
+
case "height":
|
|
135
|
+
parseValue(attributeVal, {
|
|
136
|
+
asKey: "height",
|
|
137
|
+
parser: parseMPDInteger,
|
|
138
|
+
dashName: "height",
|
|
139
|
+
});
|
|
140
|
+
break;
|
|
141
|
+
case "id":
|
|
142
|
+
attributes.id = attributeVal;
|
|
143
|
+
break;
|
|
144
|
+
case "maxPlayoutRate":
|
|
145
|
+
parseValue(attributeVal, {
|
|
146
|
+
asKey: "maxPlayoutRate",
|
|
147
|
+
parser: parseMPDFloat,
|
|
148
|
+
dashName: "maxPlayoutRate",
|
|
149
|
+
});
|
|
150
|
+
break;
|
|
151
|
+
case "maximumSAPPeriod":
|
|
152
|
+
parseValue(attributeVal, {
|
|
153
|
+
asKey: "maximumSAPPeriod",
|
|
154
|
+
parser: parseMPDFloat,
|
|
155
|
+
dashName: "maximumSAPPeriod",
|
|
156
|
+
});
|
|
157
|
+
break;
|
|
158
|
+
case "mimeType":
|
|
159
|
+
attributes.mimeType = attributeVal;
|
|
160
|
+
break;
|
|
161
|
+
case "profiles":
|
|
162
|
+
attributes.profiles = attributeVal;
|
|
163
|
+
break;
|
|
164
|
+
case "qualityRanking":
|
|
165
|
+
parseValue(attributeVal, {
|
|
166
|
+
asKey: "qualityRanking",
|
|
167
|
+
parser: parseMPDInteger,
|
|
168
|
+
dashName: "qualityRanking",
|
|
169
|
+
});
|
|
170
|
+
break;
|
|
171
|
+
case "scte214:supplementalCodecs":
|
|
172
|
+
attributes.supplementalCodecs = attributeVal;
|
|
173
|
+
break;
|
|
174
|
+
case "segmentProfiles":
|
|
175
|
+
attributes.segmentProfiles = attributeVal;
|
|
176
|
+
break;
|
|
177
|
+
case "width":
|
|
178
|
+
parseValue(attributeVal, {
|
|
179
|
+
asKey: "width",
|
|
180
|
+
parser: parseMPDInteger,
|
|
181
|
+
dashName: "width",
|
|
182
|
+
});
|
|
183
|
+
break;
|
|
184
|
+
case "availabilityTimeOffset":
|
|
185
|
+
parseValue(attributeVal, {
|
|
186
|
+
asKey: "availabilityTimeOffset",
|
|
187
|
+
parser: parseMPDFloat,
|
|
188
|
+
dashName: "availabilityTimeOffset",
|
|
189
|
+
});
|
|
190
|
+
break;
|
|
191
|
+
case "availabilityTimeComplete":
|
|
192
|
+
parseValue(attributeVal, {
|
|
193
|
+
asKey: "availabilityTimeComplete",
|
|
194
|
+
parser: parseBoolean,
|
|
195
|
+
dashName: "availabilityTimeComplete",
|
|
196
|
+
});
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (attributes.bitrate === undefined) {
|
|
201
|
+
warnings.push(new MPDError("No bitrate found on a Representation"));
|
|
202
|
+
}
|
|
203
|
+
return [attributes, warnings];
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @param {Object} representationElement
|
|
207
|
+
* @returns {Array}
|
|
208
|
+
*/
|
|
209
|
+
export function createRepresentationIntermediateRepresentation(representationElement) {
|
|
210
|
+
const [children, childrenWarnings] = parseRepresentationChildren(representationElement.children);
|
|
211
|
+
const [attributes, attrsWarnings] = parseRepresentationAttributes(representationElement);
|
|
212
|
+
const warnings = childrenWarnings.concat(attrsWarnings);
|
|
213
|
+
return [{ children, attributes }, warnings];
|
|
214
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ITNode } from "../../../../../utils/xml-parser";
|
|
17
|
+
import type { ISegmentBaseIntermediateRepresentation } from "../../node_parser_types";
|
|
18
|
+
/**
|
|
19
|
+
* Parse a SegmentBase element into a SegmentBase intermediate representation.
|
|
20
|
+
* @param {Object} root - The SegmentBase root element.
|
|
21
|
+
* @returns {Array}
|
|
22
|
+
*/
|
|
23
|
+
export default function parseSegmentBase(root: ITNode): [ISegmentBaseIntermediateRepresentation, Error[]];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
|
|
17
|
+
import parseInitialization from "./Initialization";
|
|
18
|
+
import { parseBoolean, parseByteRange, parseMPDFloat, parseMPDInteger, ValueParser, } from "./utils";
|
|
19
|
+
/**
|
|
20
|
+
* Parse a SegmentBase element into a SegmentBase intermediate representation.
|
|
21
|
+
* @param {Object} root - The SegmentBase root element.
|
|
22
|
+
* @returns {Array}
|
|
23
|
+
*/
|
|
24
|
+
export default function parseSegmentBase(root) {
|
|
25
|
+
const attributes = {};
|
|
26
|
+
let warnings = [];
|
|
27
|
+
const parseValue = ValueParser(attributes, warnings);
|
|
28
|
+
const segmentBaseChildren = root.children;
|
|
29
|
+
for (let i = 0; i < segmentBaseChildren.length; i++) {
|
|
30
|
+
const currentNode = segmentBaseChildren[i];
|
|
31
|
+
if (typeof currentNode !== "string") {
|
|
32
|
+
if (currentNode.tagName === "Initialization") {
|
|
33
|
+
const [initialization, initializationWarnings] = parseInitialization(currentNode);
|
|
34
|
+
attributes.initialization = initialization;
|
|
35
|
+
warnings = warnings.concat(initializationWarnings);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const attributeName of Object.keys(root.attributes)) {
|
|
40
|
+
const attributeVal = root.attributes[attributeName];
|
|
41
|
+
if (isNullOrUndefined(attributeVal)) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
switch (attributeName) {
|
|
45
|
+
case "timescale":
|
|
46
|
+
parseValue(attributeVal, {
|
|
47
|
+
asKey: "timescale",
|
|
48
|
+
parser: parseMPDInteger,
|
|
49
|
+
dashName: "timescale",
|
|
50
|
+
});
|
|
51
|
+
break;
|
|
52
|
+
case "presentationTimeOffset":
|
|
53
|
+
parseValue(attributeVal, {
|
|
54
|
+
asKey: "presentationTimeOffset",
|
|
55
|
+
parser: parseMPDFloat,
|
|
56
|
+
dashName: "presentationTimeOffset",
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
case "indexRange":
|
|
60
|
+
parseValue(attributeVal, {
|
|
61
|
+
asKey: "indexRange",
|
|
62
|
+
parser: parseByteRange,
|
|
63
|
+
dashName: "indexRange",
|
|
64
|
+
});
|
|
65
|
+
break;
|
|
66
|
+
case "indexRangeExact":
|
|
67
|
+
parseValue(attributeVal, {
|
|
68
|
+
asKey: "indexRangeExact",
|
|
69
|
+
parser: parseBoolean,
|
|
70
|
+
dashName: "indexRangeExact",
|
|
71
|
+
});
|
|
72
|
+
break;
|
|
73
|
+
case "availabilityTimeOffset":
|
|
74
|
+
parseValue(attributeVal, {
|
|
75
|
+
asKey: "availabilityTimeOffset",
|
|
76
|
+
parser: parseMPDFloat,
|
|
77
|
+
dashName: "availabilityTimeOffset",
|
|
78
|
+
});
|
|
79
|
+
break;
|
|
80
|
+
case "availabilityTimeComplete":
|
|
81
|
+
parseValue(attributeVal, {
|
|
82
|
+
asKey: "availabilityTimeComplete",
|
|
83
|
+
parser: parseBoolean,
|
|
84
|
+
dashName: "availabilityTimeComplete",
|
|
85
|
+
});
|
|
86
|
+
break;
|
|
87
|
+
case "duration":
|
|
88
|
+
parseValue(attributeVal, {
|
|
89
|
+
asKey: "duration",
|
|
90
|
+
parser: parseMPDInteger,
|
|
91
|
+
dashName: "duration",
|
|
92
|
+
});
|
|
93
|
+
break;
|
|
94
|
+
case "startNumber":
|
|
95
|
+
parseValue(attributeVal, {
|
|
96
|
+
asKey: "startNumber",
|
|
97
|
+
parser: parseMPDInteger,
|
|
98
|
+
dashName: "startNumber",
|
|
99
|
+
});
|
|
100
|
+
break;
|
|
101
|
+
case "endNumber":
|
|
102
|
+
parseValue(attributeVal, {
|
|
103
|
+
asKey: "endNumber",
|
|
104
|
+
parser: parseMPDInteger,
|
|
105
|
+
dashName: "endNumber",
|
|
106
|
+
});
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return [attributes, warnings];
|
|
111
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ITNode } from "../../../../../utils/xml-parser";
|
|
17
|
+
import type { ISegmentListIntermediateRepresentation } from "../../node_parser_types";
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} root
|
|
20
|
+
* @returns {Array}
|
|
21
|
+
*/
|
|
22
|
+
export default function parseSegmentList(root: ITNode): [ISegmentListIntermediateRepresentation, Error[]];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import objectAssign from "../../../../../utils/object_assign";
|
|
17
|
+
import parseSegmentBase from "./SegmentBase";
|
|
18
|
+
import parseSegmentURL from "./SegmentURL";
|
|
19
|
+
/**
|
|
20
|
+
* @param {Object} root
|
|
21
|
+
* @returns {Array}
|
|
22
|
+
*/
|
|
23
|
+
export default function parseSegmentList(root) {
|
|
24
|
+
const [base, baseWarnings] = parseSegmentBase(root);
|
|
25
|
+
let warnings = baseWarnings;
|
|
26
|
+
const list = [];
|
|
27
|
+
const segmentListChildren = root.children;
|
|
28
|
+
for (let i = 0; i < segmentListChildren.length; i++) {
|
|
29
|
+
const currentNode = segmentListChildren[i];
|
|
30
|
+
if (typeof currentNode === "string") {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (currentNode.tagName === "SegmentURL") {
|
|
34
|
+
const [segmentURL, segmentURLWarnings] = parseSegmentURL(currentNode);
|
|
35
|
+
list.push(segmentURL);
|
|
36
|
+
warnings = warnings.concat(segmentURLWarnings);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const ret = objectAssign(base, { list });
|
|
40
|
+
return [ret, warnings];
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ITNode } from "../../../../../utils/xml-parser";
|
|
17
|
+
import type { ISegmentTemplateIntermediateRepresentation } from "../../node_parser_types";
|
|
18
|
+
/**
|
|
19
|
+
* Parse a SegmentTemplate element into a SegmentTemplate intermediate
|
|
20
|
+
* representation.
|
|
21
|
+
* @param {Object} root - The SegmentTemplate root element.
|
|
22
|
+
* @returns {Array}
|
|
23
|
+
*/
|
|
24
|
+
export default function parseSegmentTemplate(root: ITNode): [ISegmentTemplateIntermediateRepresentation, Error[]];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
|
|
17
|
+
import objectAssign from "../../../../../utils/object_assign";
|
|
18
|
+
import parseSegmentBase from "./SegmentBase";
|
|
19
|
+
import createSegmentTimelineParser from "./SegmentTimeline";
|
|
20
|
+
import { parseBoolean, parseMPDFloat, ValueParser } from "./utils";
|
|
21
|
+
/**
|
|
22
|
+
* Parse a SegmentTemplate element into a SegmentTemplate intermediate
|
|
23
|
+
* representation.
|
|
24
|
+
* @param {Object} root - The SegmentTemplate root element.
|
|
25
|
+
* @returns {Array}
|
|
26
|
+
*/
|
|
27
|
+
export default function parseSegmentTemplate(root) {
|
|
28
|
+
const [base, segmentBaseWarnings] = parseSegmentBase(root);
|
|
29
|
+
const warnings = segmentBaseWarnings;
|
|
30
|
+
let timelineParser;
|
|
31
|
+
// First look for a possible SegmentTimeline
|
|
32
|
+
for (let i = 0; i < root.children.length; i++) {
|
|
33
|
+
const currentNode = root.children[i];
|
|
34
|
+
if (typeof currentNode !== "string" && currentNode.tagName === "SegmentTimeline") {
|
|
35
|
+
timelineParser = createSegmentTimelineParser(currentNode);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const ret = objectAssign({}, base, {
|
|
39
|
+
duration: base.duration,
|
|
40
|
+
timelineParser,
|
|
41
|
+
});
|
|
42
|
+
const parseValue = ValueParser(ret, warnings);
|
|
43
|
+
for (const attributeName of Object.keys(root.attributes)) {
|
|
44
|
+
const attributeVal = root.attributes[attributeName];
|
|
45
|
+
if (isNullOrUndefined(attributeVal)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
switch (attributeName) {
|
|
49
|
+
case "initialization":
|
|
50
|
+
if (isNullOrUndefined(ret.initialization)) {
|
|
51
|
+
ret.initialization = { media: attributeVal };
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case "index":
|
|
55
|
+
ret.index = attributeVal;
|
|
56
|
+
break;
|
|
57
|
+
case "availabilityTimeOffset":
|
|
58
|
+
parseValue(attributeVal, {
|
|
59
|
+
asKey: "availabilityTimeOffset",
|
|
60
|
+
parser: parseMPDFloat,
|
|
61
|
+
dashName: "availabilityTimeOffset",
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
case "availabilityTimeComplete":
|
|
65
|
+
parseValue(attributeVal, {
|
|
66
|
+
asKey: "availabilityTimeComplete",
|
|
67
|
+
parser: parseBoolean,
|
|
68
|
+
dashName: "availabilityTimeComplete",
|
|
69
|
+
});
|
|
70
|
+
break;
|
|
71
|
+
case "media":
|
|
72
|
+
ret.media = attributeVal;
|
|
73
|
+
break;
|
|
74
|
+
case "bitstreamSwitching":
|
|
75
|
+
parseValue(attributeVal, {
|
|
76
|
+
asKey: "bitstreamSwitching",
|
|
77
|
+
parser: parseBoolean,
|
|
78
|
+
dashName: "bitstreamSwitching",
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return [ret, warnings];
|
|
84
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ITNode } from "../../../../../utils/xml-parser";
|
|
17
|
+
import type { ITimelineParser } from "../../node_parser_types";
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} root
|
|
20
|
+
* @returns {Function}
|
|
21
|
+
*/
|
|
22
|
+
export default function createSegmentTimelineParser(root: ITNode): ITimelineParser;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} root
|
|
18
|
+
* @returns {Function}
|
|
19
|
+
*/
|
|
20
|
+
export default function createSegmentTimelineParser(root) {
|
|
21
|
+
const result = root.children;
|
|
22
|
+
return function () {
|
|
23
|
+
// In the great majority of cases, there's only `S` elements inside.
|
|
24
|
+
// However still clean-up just in rare occasions when that's not the case.
|
|
25
|
+
for (let i = result.length - 1; i >= 0; i--) {
|
|
26
|
+
const item = result[i];
|
|
27
|
+
if (typeof item === "string" || item.tagName !== "S") {
|
|
28
|
+
result.splice(i, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ITNode } from "../../../../../utils/xml-parser";
|
|
17
|
+
import type { ISegmentUrlIntermediateRepresentation } from "../../node_parser_types";
|
|
18
|
+
/**
|
|
19
|
+
* Parse a SegmentURL element into a SegmentURL intermediate
|
|
20
|
+
* representation.
|
|
21
|
+
* @param {Object} root - The SegmentURL root element.
|
|
22
|
+
* @returns {Array}
|
|
23
|
+
*/
|
|
24
|
+
export default function parseSegmentURL(root: ITNode): [ISegmentUrlIntermediateRepresentation, Error[]];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015 CANAL+ Group
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import isNullOrUndefined from "../../../../../utils/is_null_or_undefined";
|
|
17
|
+
import { parseByteRange, ValueParser } from "./utils";
|
|
18
|
+
/**
|
|
19
|
+
* Parse a SegmentURL element into a SegmentURL intermediate
|
|
20
|
+
* representation.
|
|
21
|
+
* @param {Object} root - The SegmentURL root element.
|
|
22
|
+
* @returns {Array}
|
|
23
|
+
*/
|
|
24
|
+
export default function parseSegmentURL(root) {
|
|
25
|
+
const parsedSegmentURL = {};
|
|
26
|
+
const warnings = [];
|
|
27
|
+
const parseValue = ValueParser(parsedSegmentURL, warnings);
|
|
28
|
+
for (const attributeName of Object.keys(root.attributes)) {
|
|
29
|
+
const attributeVal = root.attributes[attributeName];
|
|
30
|
+
if (isNullOrUndefined(attributeVal)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
switch (attributeName) {
|
|
34
|
+
case "media":
|
|
35
|
+
parsedSegmentURL.media = attributeVal;
|
|
36
|
+
break;
|
|
37
|
+
case "indexRange":
|
|
38
|
+
parseValue(attributeVal, {
|
|
39
|
+
asKey: "indexRange",
|
|
40
|
+
parser: parseByteRange,
|
|
41
|
+
dashName: "indexRange",
|
|
42
|
+
});
|
|
43
|
+
break;
|
|
44
|
+
case "index":
|
|
45
|
+
parsedSegmentURL.index = attributeVal;
|
|
46
|
+
break;
|
|
47
|
+
case "mediaRange":
|
|
48
|
+
parseValue(attributeVal, {
|
|
49
|
+
asKey: "mediaRange",
|
|
50
|
+
parser: parseByteRange,
|
|
51
|
+
dashName: "mediaRange",
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return [parsedSegmentURL, warnings];
|
|
57
|
+
}
|