@vidispine/vdt-js 21.4.0-pre.2 → 22.1.0-pre.3
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/README.md +1 -1
- package/dist/index.es.js +1895 -2204
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1915 -2215
- package/dist/index.js.map +1 -1
- package/package.json +26 -20
package/dist/index.es.js
CHANGED
|
@@ -1,2502 +1,1967 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import parseFileSize from 'filesize';
|
|
5
|
+
import _typeof from '@babel/runtime/helpers/typeof';
|
|
6
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
7
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
8
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
9
|
|
|
4
|
-
|
|
5
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
symbols = symbols.filter(function (sym) {
|
|
9
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
var parseKeyValuePairType = function parseKeyValuePairType() {
|
|
15
|
+
var keyValuePairType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
var keyValuePairTypeReducer = function keyValuePairTypeReducer(a, _ref) {
|
|
18
|
+
var key = _ref.key,
|
|
19
|
+
value = _ref.value;
|
|
20
|
+
return _objectSpread$8(_objectSpread$8({}, a), {}, _defineProperty({}, key, value));
|
|
21
|
+
};
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
23
|
+
return keyValuePairType.reduce(keyValuePairTypeReducer, {});
|
|
24
|
+
};
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
var parseNowDate = function parseNowDate() {
|
|
27
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'NOW';
|
|
28
|
+
|
|
29
|
+
if (value.startsWith('NOW')) {
|
|
30
|
+
if (value === 'NOW') return new Date();
|
|
31
|
+
var sign = value[3];
|
|
32
|
+
var number = Number(value.match(/(\d+)/)[0]);
|
|
33
|
+
var unit = value.match(/(\d.*)/)[0].replace(/\d/g, '');
|
|
34
|
+
var nowDiff = new Date();
|
|
35
|
+
|
|
36
|
+
switch (unit) {
|
|
37
|
+
case 'HOUR':
|
|
38
|
+
case 'HOURS':
|
|
39
|
+
if (sign === '+') nowDiff.setHours(nowDiff.getHours() + number);
|
|
40
|
+
if (sign === '-') nowDiff.setHours(nowDiff.getHours() - number);
|
|
41
|
+
break;
|
|
42
|
+
|
|
43
|
+
case 'DAY':
|
|
44
|
+
case 'DAYS':
|
|
45
|
+
if (sign === '+') nowDiff.setDate(nowDiff.getDate() + number);
|
|
46
|
+
if (sign === '-') nowDiff.setDate(nowDiff.getDate() - number);
|
|
47
|
+
break;
|
|
48
|
+
|
|
49
|
+
case 'MONTH':
|
|
50
|
+
case 'MONTHS':
|
|
51
|
+
if (sign === '+') nowDiff.setMonth(nowDiff.getMonth() + number);
|
|
52
|
+
if (sign === '-') nowDiff.setMonth(nowDiff.getMonth() - number);
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
case 'YEAR':
|
|
56
|
+
case 'YEARS':
|
|
57
|
+
if (sign === '+') nowDiff.setFullYear(nowDiff.getFullYear() + number);
|
|
58
|
+
if (sign === '-') nowDiff.setFullYear(nowDiff.getFullYear() - number);
|
|
59
|
+
break;
|
|
33
60
|
}
|
|
61
|
+
|
|
62
|
+
return nowDiff;
|
|
34
63
|
}
|
|
35
64
|
|
|
36
|
-
return
|
|
37
|
-
}
|
|
65
|
+
return new Date(value);
|
|
66
|
+
};
|
|
38
67
|
|
|
39
|
-
|
|
40
|
-
"@babel/helpers - typeof";
|
|
68
|
+
var _CONSTANT_TIMEBASES;
|
|
41
69
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
var PAL = 'PAL';
|
|
71
|
+
var NTSC = 'NTSC';
|
|
72
|
+
var NTSC30 = 'NTSC30';
|
|
73
|
+
var CONSTANT_TIMEBASES = (_CONSTANT_TIMEBASES = {}, _defineProperty(_CONSTANT_TIMEBASES, PAL, {
|
|
74
|
+
denominator: 25,
|
|
75
|
+
numerator: 1
|
|
76
|
+
}), _defineProperty(_CONSTANT_TIMEBASES, NTSC, {
|
|
77
|
+
denominator: 30000,
|
|
78
|
+
numerator: 1001
|
|
79
|
+
}), _defineProperty(_CONSTANT_TIMEBASES, NTSC30, {
|
|
80
|
+
denominator: 30,
|
|
81
|
+
numerator: 1
|
|
82
|
+
}), _defineProperty(_CONSTANT_TIMEBASES, 29.97, {
|
|
83
|
+
denominator: 30000,
|
|
84
|
+
numerator: 1001
|
|
85
|
+
}), _defineProperty(_CONSTANT_TIMEBASES, 59.94, {
|
|
86
|
+
denominator: 60000,
|
|
87
|
+
numerator: 1001
|
|
88
|
+
}), _CONSTANT_TIMEBASES);
|
|
89
|
+
var FRAME_SEPARATORS = {
|
|
90
|
+
':': {
|
|
91
|
+
dropFrame: false,
|
|
92
|
+
field: 2
|
|
93
|
+
},
|
|
94
|
+
';': {
|
|
95
|
+
dropFrame: true,
|
|
96
|
+
field: 2
|
|
97
|
+
},
|
|
98
|
+
'.': {
|
|
99
|
+
dropFrame: false,
|
|
100
|
+
field: 1
|
|
101
|
+
},
|
|
102
|
+
',': {
|
|
103
|
+
dropFrame: true,
|
|
104
|
+
field: 1
|
|
50
105
|
}
|
|
106
|
+
};
|
|
51
107
|
|
|
52
|
-
|
|
53
|
-
}
|
|
108
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
54
109
|
|
|
55
|
-
function
|
|
56
|
-
if (!(instance instanceof Constructor)) {
|
|
57
|
-
throw new TypeError("Cannot call a class as a function");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
110
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
60
111
|
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
descriptor.configurable = true;
|
|
66
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
67
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
112
|
+
var splitSmpte = function splitSmpte(smpteText) {
|
|
113
|
+
var hasDropFrameSeparator = smpteText.match(/[^0-9:\-_]/);
|
|
114
|
+
var hhmmssff;
|
|
115
|
+
var frameOptions = {};
|
|
70
116
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return Constructor;
|
|
75
|
-
}
|
|
117
|
+
if (hasDropFrameSeparator) {
|
|
118
|
+
var _hasDropFrameSeparato = _slicedToArray(hasDropFrameSeparator, 1),
|
|
119
|
+
frameSeparator = _hasDropFrameSeparato[0];
|
|
76
120
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
121
|
+
var _smpteText$split = smpteText.split(frameSeparator),
|
|
122
|
+
_smpteText$split2 = _slicedToArray(_smpteText$split, 2),
|
|
123
|
+
hhmmss = _smpteText$split2[0],
|
|
124
|
+
splitFrames = _smpteText$split2[1];
|
|
125
|
+
|
|
126
|
+
hhmmssff = [].concat(_toConsumableArray(hhmmss.split(':')), [splitFrames]);
|
|
127
|
+
frameOptions = FRAME_SEPARATORS[frameSeparator] || {};
|
|
85
128
|
} else {
|
|
86
|
-
|
|
129
|
+
hhmmssff = smpteText.split(':');
|
|
87
130
|
}
|
|
88
131
|
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
93
|
-
if (source == null) return {};
|
|
94
|
-
var target = {};
|
|
95
|
-
var sourceKeys = Object.keys(source);
|
|
96
|
-
var key, i;
|
|
132
|
+
hhmmssff = hhmmssff.map(Number);
|
|
97
133
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
134
|
+
if (hhmmssff.length > 4 || hhmmssff.some(function (n) {
|
|
135
|
+
return Number.isNaN(n);
|
|
136
|
+
})) {
|
|
137
|
+
throw new Error('Invalid SMPTE timecode');
|
|
102
138
|
}
|
|
103
139
|
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function _objectWithoutProperties(source, excluded) {
|
|
108
|
-
if (source == null) return {};
|
|
140
|
+
return [hhmmssff, frameOptions];
|
|
141
|
+
};
|
|
109
142
|
|
|
110
|
-
|
|
143
|
+
var getDropFrames = function getDropFrames(roundedFrameRate) {
|
|
144
|
+
return roundedFrameRate === 60 ? 4 : 2;
|
|
145
|
+
};
|
|
111
146
|
|
|
112
|
-
|
|
147
|
+
var getRoundedFrameRate = function getRoundedFrameRate(timeBase) {
|
|
148
|
+
return Math.round(timeBase.denominator / timeBase.numerator);
|
|
149
|
+
};
|
|
113
150
|
|
|
114
|
-
|
|
115
|
-
|
|
151
|
+
var countSamples = function countSamples(hh, mm, ss, ff, _ref) {
|
|
152
|
+
var dropFrame = _ref.dropFrame,
|
|
153
|
+
roundedFrameRate = _ref.roundedFrameRate;
|
|
116
154
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
120
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
121
|
-
target[key] = source[key];
|
|
122
|
-
}
|
|
155
|
+
if (!dropFrame) {
|
|
156
|
+
return hh * 3600 * roundedFrameRate + mm * 60 * roundedFrameRate + ss * roundedFrameRate + ff;
|
|
123
157
|
}
|
|
124
158
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
function _slicedToArray(arr, i) {
|
|
129
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
130
|
-
}
|
|
159
|
+
if (![30, 60].includes(roundedFrameRate)) {
|
|
160
|
+
throw new Error('Cannot use dropframe with non NTSC timebase');
|
|
161
|
+
}
|
|
131
162
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
163
|
+
var dropFrames = getDropFrames(roundedFrameRate);
|
|
164
|
+
var shouldDropMinute = mm % 10 !== 0;
|
|
165
|
+
var shouldDropSecond = shouldDropMinute && ss === 0;
|
|
166
|
+
var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
|
|
167
|
+
var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
|
|
168
|
+
var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
|
|
135
169
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
170
|
+
if (shouldDropSecond && ff < dropFrames) {
|
|
171
|
+
throw new Error('Invalid ff');
|
|
172
|
+
}
|
|
139
173
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
174
|
+
var frameFrames = shouldDropSecond ? ff - dropFrames : ff;
|
|
175
|
+
return hourFrames + minuteFrames + secondFrames + frameFrames;
|
|
176
|
+
};
|
|
143
177
|
|
|
144
|
-
function
|
|
145
|
-
|
|
178
|
+
function countDroppedFrames(frames, roundedFrameRate) {
|
|
179
|
+
var dropFrames = getDropFrames(roundedFrameRate);
|
|
180
|
+
var oneMinuteUndroppedFrames = 60 * roundedFrameRate;
|
|
181
|
+
var oneMinuteDroppedFrames = 60 * roundedFrameRate - dropFrames;
|
|
182
|
+
var tenMinuteFrames = 10 * (oneMinuteUndroppedFrames - dropFrames) + dropFrames;
|
|
183
|
+
var tenMinuteChunks = Math.floor(frames / tenMinuteFrames);
|
|
184
|
+
var minuteRemainder = Math.max(0, frames % tenMinuteFrames - oneMinuteUndroppedFrames);
|
|
185
|
+
var oneMinuteChunks = Math.floor(minuteRemainder / oneMinuteDroppedFrames);
|
|
186
|
+
var frameRemainder = minuteRemainder % oneMinuteDroppedFrames;
|
|
187
|
+
var frameChunks = frameRemainder > 0 ? dropFrames : 0;
|
|
188
|
+
return tenMinuteChunks * 9 * dropFrames + oneMinuteChunks * dropFrames + frameChunks;
|
|
146
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* @class TimeBase
|
|
192
|
+
* @constructs formatTimeBaseText(timeBaseText: string)
|
|
193
|
+
*/
|
|
147
194
|
|
|
148
|
-
function _iterableToArrayLimit(arr, i) {
|
|
149
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
150
|
-
|
|
151
|
-
if (_i == null) return;
|
|
152
|
-
var _arr = [];
|
|
153
|
-
var _n = true;
|
|
154
|
-
var _d = false;
|
|
155
195
|
|
|
156
|
-
|
|
196
|
+
var TimeBase = /*#__PURE__*/function () {
|
|
197
|
+
function TimeBase() {
|
|
198
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
199
|
+
_ref2$numerator = _ref2.numerator,
|
|
200
|
+
numerator = _ref2$numerator === void 0 ? 1 : _ref2$numerator,
|
|
201
|
+
_ref2$denominator = _ref2.denominator,
|
|
202
|
+
denominator = _ref2$denominator === void 0 ? 1 : _ref2$denominator;
|
|
157
203
|
|
|
158
|
-
|
|
159
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
160
|
-
_arr.push(_s.value);
|
|
204
|
+
_classCallCheck(this, TimeBase);
|
|
161
205
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
} catch (err) {
|
|
165
|
-
_d = true;
|
|
166
|
-
_e = err;
|
|
167
|
-
} finally {
|
|
168
|
-
try {
|
|
169
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
170
|
-
} finally {
|
|
171
|
-
if (_d) throw _e;
|
|
172
|
-
}
|
|
206
|
+
this.numerator = Number(numerator);
|
|
207
|
+
this.denominator = Number(denominator);
|
|
173
208
|
}
|
|
174
209
|
|
|
175
|
-
|
|
176
|
-
|
|
210
|
+
_createClass(TimeBase, [{
|
|
211
|
+
key: "toJSON",
|
|
212
|
+
value: function toJSON() {
|
|
213
|
+
return {
|
|
214
|
+
denominator: this.denominator,
|
|
215
|
+
numerator: this.numerator
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "toConstant",
|
|
220
|
+
value: function toConstant() {
|
|
221
|
+
var _this = this;
|
|
177
222
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
184
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
185
|
-
}
|
|
223
|
+
var constant;
|
|
224
|
+
Object.entries(CONSTANT_TIMEBASES).find(function (thisTimeBase) {
|
|
225
|
+
var _thisTimeBase = _slicedToArray(thisTimeBase, 2),
|
|
226
|
+
thisTimeBaseText = _thisTimeBase[0],
|
|
227
|
+
thisTimeBaseType = _thisTimeBase[1];
|
|
186
228
|
|
|
187
|
-
|
|
188
|
-
|
|
229
|
+
var numerator = thisTimeBaseType.numerator,
|
|
230
|
+
denominator = thisTimeBaseType.denominator;
|
|
189
231
|
|
|
190
|
-
|
|
232
|
+
if (numerator === _this.numerator && denominator === _this.denominator) {
|
|
233
|
+
constant = thisTimeBaseText;
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
191
236
|
|
|
192
|
-
|
|
193
|
-
}
|
|
237
|
+
return false;
|
|
238
|
+
});
|
|
239
|
+
return constant;
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: "toText",
|
|
243
|
+
value: function toText() {
|
|
244
|
+
var useConstant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
194
245
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
246
|
+
if (useConstant) {
|
|
247
|
+
var _timeBaseText = this.toConstant();
|
|
198
248
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
249
|
+
if (_timeBaseText) return _timeBaseText;
|
|
250
|
+
}
|
|
202
251
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
_excluded3 = ["field", "group"],
|
|
206
|
-
_excluded4 = ["timespan"];
|
|
252
|
+
if (this.numerator > 1) {
|
|
253
|
+
var _timeBaseText2 = [this.denominator, this.numerator].join(':');
|
|
207
254
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var secondStart = _ref2.start;
|
|
255
|
+
return _timeBaseText2;
|
|
256
|
+
}
|
|
211
257
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
258
|
+
var timeBaseText = String(this.denominator);
|
|
259
|
+
return timeBaseText;
|
|
260
|
+
}
|
|
261
|
+
}, {
|
|
262
|
+
key: "toRate",
|
|
263
|
+
value: function toRate() {
|
|
264
|
+
var useConstant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
265
|
+
var round = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
215
266
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
second = _secondStart$split2[0];
|
|
267
|
+
if (useConstant) {
|
|
268
|
+
var _rate = this.toConstant();
|
|
219
269
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
270
|
+
if (_rate) return _rate;
|
|
271
|
+
}
|
|
223
272
|
|
|
224
|
-
|
|
225
|
-
return 1;
|
|
226
|
-
}
|
|
273
|
+
var rate = this.denominator / this.numerator;
|
|
227
274
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
var findTimespan = function findTimespan() {
|
|
232
|
-
var metadataType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
233
|
-
var start = arguments.length > 1 ? arguments[1] : undefined;
|
|
234
|
-
var end = arguments.length > 2 ? arguments[2] : undefined;
|
|
235
|
-
var _metadataType$timespa = metadataType.timespan,
|
|
236
|
-
timespanList = _metadataType$timespa === void 0 ? [] : _metadataType$timespa;
|
|
237
|
-
return timespanList.find(function (timespan) {
|
|
238
|
-
return timespan.start === start && timespan.end === end;
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
var parseValueList = function parseValueList() {
|
|
243
|
-
var valueList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
244
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
245
|
-
var _options$arrayOnSingl = options.arrayOnSingle,
|
|
246
|
-
arrayOnSingle = _options$arrayOnSingl === void 0 ? true : _options$arrayOnSingl,
|
|
247
|
-
_options$arrayOnSingl2 = options.arrayOnSingleValue,
|
|
248
|
-
arrayOnSingleValue = _options$arrayOnSingl2 === void 0 ? true : _options$arrayOnSingl2,
|
|
249
|
-
joinValue = options.joinValue,
|
|
250
|
-
includeAttributes = options.includeAttributes,
|
|
251
|
-
includeValueAttributes = options.includeValueAttributes;
|
|
252
|
-
if (includeAttributes || includeValueAttributes) return valueList;
|
|
253
|
-
var valueArray = [];
|
|
254
|
-
valueList.forEach(function (thisValue) {
|
|
255
|
-
if (thisValue.value) valueArray.push(thisValue.value);
|
|
256
|
-
});
|
|
257
|
-
if (joinValue) return valueArray.join(joinValue);
|
|
258
|
-
|
|
259
|
-
if ((arrayOnSingle === false || arrayOnSingleValue === false) && valueArray.length === 1) {
|
|
260
|
-
return valueArray[0];
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return valueArray;
|
|
264
|
-
};
|
|
275
|
+
if (Number.isInteger(rate)) {
|
|
276
|
+
return rate;
|
|
277
|
+
}
|
|
265
278
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
var includeAttributes = options.includeAttributes,
|
|
270
|
-
includeFieldAttributes = options.includeFieldAttributes;
|
|
279
|
+
return round ? rate.toFixed(2) : rate;
|
|
280
|
+
}
|
|
281
|
+
}]);
|
|
271
282
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
attributes = _objectWithoutProperties(field, _excluded);
|
|
283
|
+
return TimeBase;
|
|
284
|
+
}();
|
|
275
285
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return parsedValueList;
|
|
286
|
+
var isDropFrameTimeBase = function isDropFrameTimeBase(_ref3) {
|
|
287
|
+
var numerator = _ref3.numerator,
|
|
288
|
+
denominator = _ref3.denominator;
|
|
289
|
+
return numerator === 1001 && (denominator === 60000 || denominator === 30000);
|
|
281
290
|
};
|
|
282
291
|
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
includeValueAttributes = options.includeValueAttributes;
|
|
290
|
-
var output = {};
|
|
291
|
-
var fieldAsList = options.fieldAsList;
|
|
292
|
-
|
|
293
|
-
if (fieldAsList) {
|
|
294
|
-
return fieldList.map(function (thisField) {
|
|
295
|
-
return parseField(thisField, options);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
292
|
+
var TimeCode = /*#__PURE__*/function () {
|
|
293
|
+
function TimeCode() {
|
|
294
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
295
|
+
_ref4$samples = _ref4.samples,
|
|
296
|
+
samples = _ref4$samples === void 0 ? 0 : _ref4$samples,
|
|
297
|
+
timeBase = _ref4.timeBase;
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
300
|
+
dropFrame = _ref5.dropFrame,
|
|
301
|
+
_ref5$field = _ref5.field,
|
|
302
|
+
field = _ref5$field === void 0 ? 2 : _ref5$field;
|
|
302
303
|
|
|
303
|
-
|
|
304
|
-
if (includeAttributes || includeFieldAttributes) {
|
|
305
|
-
var currentValue = output[key].value;
|
|
306
|
-
var parsedValue = parsedField.value;
|
|
304
|
+
_classCallCheck(this, TimeCode);
|
|
307
305
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
306
|
+
if (typeof samples === 'number') {
|
|
307
|
+
this.samples = samples;
|
|
308
|
+
} else if (typeof samples === 'string') {
|
|
309
|
+
if (samples === '-INF') {
|
|
310
|
+
this.samples = -Infinity;
|
|
311
|
+
} else if (samples === '+INF') {
|
|
312
|
+
this.samples = Infinity;
|
|
313
313
|
} else {
|
|
314
|
-
|
|
315
|
-
var _parsedValue = parsedField;
|
|
316
|
-
|
|
317
|
-
if (joinValue) {
|
|
318
|
-
output[key] = [_currentValue, _parsedValue].join(joinValue);
|
|
319
|
-
} else {
|
|
320
|
-
output[key] = _parsedValue.concat(_currentValue);
|
|
321
|
-
}
|
|
314
|
+
this.samples = Number(samples);
|
|
322
315
|
}
|
|
323
316
|
} else {
|
|
324
|
-
|
|
317
|
+
throw new Error("samples is not number/string/-Inf/+Inf is: ".concat(samples));
|
|
325
318
|
}
|
|
326
|
-
});
|
|
327
|
-
return output;
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
var parseGroup = function parseGroup() {
|
|
331
|
-
var group = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
332
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
333
|
-
var includeAttributes = options.includeAttributes,
|
|
334
|
-
includeGroupAttributes = options.includeGroupAttributes,
|
|
335
|
-
flat = options.flat,
|
|
336
|
-
flatGroup = options.flatGroup,
|
|
337
|
-
groupAsList = options.groupAsList,
|
|
338
|
-
fieldAsList = options.fieldAsList;
|
|
339
|
-
|
|
340
|
-
var _group$field = group.field,
|
|
341
|
-
fieldList = _group$field === void 0 ? [] : _group$field,
|
|
342
|
-
_group$group = group.group,
|
|
343
|
-
groupList = _group$group === void 0 ? [] : _group$group,
|
|
344
|
-
attributes = _objectWithoutProperties(group, _excluded2);
|
|
345
319
|
|
|
346
|
-
|
|
347
|
-
|
|
320
|
+
this.timeBase = new TimeBase(timeBase);
|
|
321
|
+
this.dropFrame = dropFrame === undefined ? isDropFrameTimeBase(this.timeBase) : dropFrame;
|
|
322
|
+
this.field = field;
|
|
323
|
+
}
|
|
348
324
|
|
|
349
|
-
|
|
325
|
+
_createClass(TimeCode, [{
|
|
326
|
+
key: "add",
|
|
327
|
+
value: function add(val) {
|
|
328
|
+
var _val$timeBase = val.timeBase,
|
|
329
|
+
numerator = _val$timeBase.numerator,
|
|
330
|
+
denominator = _val$timeBase.denominator;
|
|
331
|
+
var conformedTimeCode = val;
|
|
350
332
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
333
|
+
if (numerator !== this.timeBase.numerator || denominator !== this.timeBase.denominator) {
|
|
334
|
+
conformedTimeCode = val.conformTimeBase(this.timeBase);
|
|
335
|
+
}
|
|
354
336
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
337
|
+
var _conformedTimeCode = conformedTimeCode,
|
|
338
|
+
samples = _conformedTimeCode.samples;
|
|
339
|
+
return new TimeCode({
|
|
340
|
+
samples: this.samples + samples,
|
|
341
|
+
timeBase: this.timeBase
|
|
359
342
|
});
|
|
360
|
-
} else {
|
|
361
|
-
Object.assign(output, parsedGroupList);
|
|
362
343
|
}
|
|
344
|
+
}, {
|
|
345
|
+
key: "subtract",
|
|
346
|
+
value: function subtract(val) {
|
|
347
|
+
var _val$timeBase2 = val.timeBase,
|
|
348
|
+
numerator = _val$timeBase2.numerator,
|
|
349
|
+
denominator = _val$timeBase2.denominator;
|
|
350
|
+
var conformedTimeCode = val;
|
|
363
351
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
352
|
+
if (numerator !== this.timeBase.numerator || denominator !== this.timeBase.denominator) {
|
|
353
|
+
conformedTimeCode = val.conformTimeBase(this.timeBase);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
var _conformedTimeCode2 = conformedTimeCode,
|
|
357
|
+
samples = _conformedTimeCode2.samples;
|
|
358
|
+
return new TimeCode({
|
|
359
|
+
samples: this.samples - samples,
|
|
360
|
+
timeBase: this.timeBase
|
|
367
361
|
});
|
|
368
|
-
} else {
|
|
369
|
-
Object.assign(output, parsedFieldList);
|
|
370
362
|
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
Object.assign(output, {
|
|
376
|
-
group: parsedGroupList
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return output;
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
var parseGroupList = function parseGroupList() {
|
|
384
|
-
var groupList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
385
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
386
|
-
var groupAsList = options.groupAsList;
|
|
387
|
-
|
|
388
|
-
if (groupAsList) {
|
|
389
|
-
return groupList.map(function (thisGroup) {
|
|
390
|
-
return parseGroup(thisGroup, options);
|
|
391
|
-
});
|
|
392
|
-
}
|
|
363
|
+
}, {
|
|
364
|
+
key: "conformTimeBase",
|
|
365
|
+
value: function conformTimeBase(conformTo) {
|
|
366
|
+
var timeBase = conformTo;
|
|
393
367
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
var parsedGroup = parseGroup(thisGroup, options);
|
|
368
|
+
if (conformTo instanceof TimeCode === false) {
|
|
369
|
+
timeBase = new TimeBase(conformTo);
|
|
370
|
+
}
|
|
398
371
|
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
output[key].field = _objectSpread2(_objectSpread2({}, currentField), parsedField);
|
|
406
|
-
output[key].group = _objectSpread2(_objectSpread2({}, currentGroup), parsedGroupList);
|
|
407
|
-
} else {
|
|
408
|
-
output[key] = parsedGroup;
|
|
372
|
+
var samples = Math.round(this.samples / (this.timeBase.toRate(false, false) / timeBase.toRate(false, false)));
|
|
373
|
+
var timeCode = {
|
|
374
|
+
samples: samples,
|
|
375
|
+
timeBase: timeBase
|
|
376
|
+
};
|
|
377
|
+
return new TimeCode(timeCode);
|
|
409
378
|
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
|
|
379
|
+
}, {
|
|
380
|
+
key: "toJSON",
|
|
381
|
+
value: function toJSON() {
|
|
382
|
+
return {
|
|
383
|
+
samples: this.samples,
|
|
384
|
+
timeBase: this.timeBase
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
}, {
|
|
388
|
+
key: "toText",
|
|
389
|
+
value: function toText() {
|
|
390
|
+
var timeCodeText = String(this.samples);
|
|
391
|
+
var timeBaseText = this.timeBase.toText();
|
|
413
392
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
var includeAttributes = options.includeAttributes,
|
|
418
|
-
includeTimespanAttributes = options.includeTimespanAttributes,
|
|
419
|
-
flat = options.flat,
|
|
420
|
-
flatTimespan = options.flatTimespan,
|
|
421
|
-
groupAsList = options.groupAsList,
|
|
422
|
-
fieldAsList = options.fieldAsList;
|
|
393
|
+
if (timeBaseText !== '1') {
|
|
394
|
+
timeCodeText = [this.samples, timeBaseText].join('@');
|
|
395
|
+
}
|
|
423
396
|
|
|
424
|
-
|
|
425
|
-
fieldList = _timespan$field === void 0 ? [] : _timespan$field,
|
|
426
|
-
_timespan$group = timespan.group,
|
|
427
|
-
groupList = _timespan$group === void 0 ? [] : _timespan$group,
|
|
428
|
-
attributes = _objectWithoutProperties(timespan, _excluded3);
|
|
429
|
-
|
|
430
|
-
var field = parseFieldList(fieldList, options);
|
|
431
|
-
var group = parseGroupList(groupList, options);
|
|
432
|
-
var output = {};
|
|
433
|
-
|
|
434
|
-
if (includeAttributes || includeTimespanAttributes) {
|
|
435
|
-
Object.assign(output, attributes);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (flat || flatTimespan) {
|
|
439
|
-
if (groupAsList) {
|
|
440
|
-
Object.assign(output, {
|
|
441
|
-
group: group
|
|
442
|
-
});
|
|
443
|
-
} else {
|
|
444
|
-
Object.assign(output, group);
|
|
397
|
+
return timeCodeText;
|
|
445
398
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
399
|
+
}, {
|
|
400
|
+
key: "toSeconds",
|
|
401
|
+
value: function toSeconds() {
|
|
402
|
+
var _this$timeBase = this.timeBase,
|
|
403
|
+
numerator = _this$timeBase.numerator,
|
|
404
|
+
denominator = _this$timeBase.denominator;
|
|
405
|
+
return this.samples * (numerator / denominator);
|
|
453
406
|
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
407
|
+
}, {
|
|
408
|
+
key: "toTime",
|
|
409
|
+
value: function toTime() {
|
|
410
|
+
var roundedFrameRate = getRoundedFrameRate(this.timeBase);
|
|
411
|
+
var totalSamples = this.samples + (this.dropFrame ? countDroppedFrames(this.samples + 1, roundedFrameRate) : 0);
|
|
412
|
+
var hours = Math.floor(totalSamples / (3600 * roundedFrameRate));
|
|
413
|
+
var minutes = Math.floor(totalSamples / (60 * roundedFrameRate)) % 60;
|
|
414
|
+
var seconds = Math.floor(totalSamples / roundedFrameRate) % 60;
|
|
415
|
+
var frames = totalSamples % roundedFrameRate;
|
|
416
|
+
var partialSeconds = frames / roundedFrameRate;
|
|
417
|
+
return {
|
|
418
|
+
hours: hours,
|
|
419
|
+
minutes: minutes,
|
|
420
|
+
seconds: seconds,
|
|
421
|
+
frames: frames,
|
|
422
|
+
partialSeconds: partialSeconds
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}, {
|
|
426
|
+
key: "toDuration",
|
|
427
|
+
value: function toDuration() {
|
|
428
|
+
var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
429
|
+
format = _ref6.format;
|
|
462
430
|
|
|
463
|
-
|
|
464
|
-
|
|
431
|
+
var _this$toTime = this.toTime(),
|
|
432
|
+
hours = _this$toTime.hours,
|
|
433
|
+
minutes = _this$toTime.minutes,
|
|
434
|
+
seconds = _this$toTime.seconds;
|
|
465
435
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
var timespanAsList = options.timespanAsList;
|
|
436
|
+
if (typeof format === 'string') {
|
|
437
|
+
if (format.toLowerCase() === 'hhmmss') {
|
|
438
|
+
return [hours.toFixed().padStart(2, '0'), minutes.toFixed().padStart(2, '0'), seconds.toFixed().padStart(2, '0')].join(':');
|
|
439
|
+
}
|
|
440
|
+
}
|
|
472
441
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
});
|
|
477
|
-
}
|
|
442
|
+
if (hours) {
|
|
443
|
+
return [hours.toFixed(), minutes.toFixed().padStart(2, '0'), seconds.toFixed().padStart(2, '0')].join(':');
|
|
444
|
+
}
|
|
478
445
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
end = thisTimespan.end;
|
|
483
|
-
var key = [start, end].join(joinTimespan || '_');
|
|
484
|
-
var parsedTimespan = parseTimespan(thisTimespan, options);
|
|
446
|
+
if (minutes >= 10) {
|
|
447
|
+
return [minutes.toFixed().padStart(2, '0'), seconds.toFixed().padStart(2, '0')].join(':');
|
|
448
|
+
}
|
|
485
449
|
|
|
486
|
-
|
|
487
|
-
output = _objectSpread2(_objectSpread2({}, output), parsedTimespan);
|
|
488
|
-
} else if (output[key]) {
|
|
489
|
-
var _output$key2 = output[key],
|
|
490
|
-
currentField = _output$key2.field,
|
|
491
|
-
currentGroup = _output$key2.group;
|
|
492
|
-
var parsedField = parsedTimespan.field,
|
|
493
|
-
parsedGroup = parsedTimespan.group;
|
|
494
|
-
output[key].field = _objectSpread2(_objectSpread2({}, currentField), parsedField);
|
|
495
|
-
output[key].group = _objectSpread2(_objectSpread2({}, currentGroup), parsedGroup);
|
|
496
|
-
} else {
|
|
497
|
-
output[key] = parsedTimespan;
|
|
450
|
+
return [minutes.toFixed(), seconds.toFixed().padStart(2, '0')].join(':');
|
|
498
451
|
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
* Parses MetadataType into key/value object.
|
|
504
|
-
* The attributes can be targeted for each sub-type.
|
|
505
|
-
* @param {Object} metadataType - The response from the API.
|
|
506
|
-
* @param {Object} options - Options which change how the metadataType is parsed.
|
|
507
|
-
* @param {Object} options.joinValue - String to join the values, eg ','.
|
|
508
|
-
* @param {Object} options.includeAttributes - include attributes on all objects.
|
|
509
|
-
* @param {Object} options.includeMetadataAttributes - include attributes on root.
|
|
510
|
-
* @param {Object} options.includeTimespanAttributes - include attributes on timespans.
|
|
511
|
-
* @param {Object} options.includeGroupAttributes - include attributes on groups.
|
|
512
|
-
* @param {Object} options.includeFieldAttributes - include attributes on fields.
|
|
513
|
-
* @param {Object} options.includeValueAttributes - include attributes on values.
|
|
514
|
-
* @param {Object} options.flat - Flatten to key/value (Note: keys may be overwritten).
|
|
515
|
-
* @param {Object} options.flatTimespan - Flatten timespan.
|
|
516
|
-
* @param {Object} options.flatGroup - Flatten group.
|
|
517
|
-
* @param {Object} options.sortTimespan - Sort timespan by start time.
|
|
518
|
-
* @param {Object} options.timespanAsList -Return timespans as list.
|
|
519
|
-
* @param {Object} options.groupAsList -Return groups as list.
|
|
520
|
-
* @param {Object} options.fieldAsList -Return fields as list.
|
|
521
|
-
*/
|
|
522
|
-
|
|
452
|
+
}, {
|
|
453
|
+
key: "toSmpte",
|
|
454
|
+
value: function toSmpte() {
|
|
455
|
+
var _this2 = this;
|
|
523
456
|
|
|
524
|
-
|
|
525
|
-
var metadataType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
526
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
527
|
-
var includeAttributes = options.includeAttributes,
|
|
528
|
-
includeMetadataAttributes = options.includeMetadataAttributes,
|
|
529
|
-
sortTimespan = options.sortTimespan;
|
|
457
|
+
if (this.samples === -Infinity) return '00:00:00:00';
|
|
530
458
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
459
|
+
var _this$toTime2 = this.toTime(),
|
|
460
|
+
hours = _this$toTime2.hours,
|
|
461
|
+
minutes = _this$toTime2.minutes,
|
|
462
|
+
seconds = _this$toTime2.seconds,
|
|
463
|
+
frames = _this$toTime2.frames;
|
|
534
464
|
|
|
535
|
-
|
|
536
|
-
var timespan = parseTimespanList(timespanList, options);
|
|
465
|
+
var hhmmss = [hours.toFixed().padStart(2, '0'), minutes.toFixed().padStart(2, '0'), seconds.toFixed().padStart(2, '0')].join(':');
|
|
537
466
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
467
|
+
var _Object$entries$find = Object.entries(FRAME_SEPARATORS).find(function (thisSeparator) {
|
|
468
|
+
var _thisSeparator = _slicedToArray(thisSeparator, 2),
|
|
469
|
+
_thisSeparator$ = _thisSeparator[1],
|
|
470
|
+
dropFrame = _thisSeparator$.dropFrame,
|
|
471
|
+
field = _thisSeparator$.field;
|
|
541
472
|
|
|
542
|
-
|
|
543
|
-
}
|
|
473
|
+
return dropFrame === _this2.dropFrame && field === _this2.field;
|
|
474
|
+
}),
|
|
475
|
+
_Object$entries$find2 = _slicedToArray(_Object$entries$find, 1),
|
|
476
|
+
_Object$entries$find3 = _Object$entries$find2[0],
|
|
477
|
+
frameSeparator = _Object$entries$find3 === void 0 ? ':' : _Object$entries$find3;
|
|
544
478
|
|
|
545
|
-
|
|
479
|
+
return [hhmmss, frames.toFixed().padStart(2, '0')].join(frameSeparator);
|
|
480
|
+
}
|
|
481
|
+
}, {
|
|
482
|
+
key: "toFraction",
|
|
483
|
+
value: function toFraction() {
|
|
484
|
+
return "".concat(this.samples, "@").concat(this.timeBase.denominator, ":").concat(this.timeBase.numerator);
|
|
485
|
+
}
|
|
486
|
+
}]);
|
|
546
487
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
488
|
+
return TimeCode;
|
|
489
|
+
}();
|
|
550
490
|
|
|
551
|
-
var
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
*
|
|
555
|
-
* @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
556
|
-
* @license BSD-3-Clause
|
|
557
|
-
* @version 6.4.0
|
|
558
|
-
*/
|
|
559
|
-
(function (global, factory) {
|
|
560
|
-
module.exports = factory() ;
|
|
561
|
-
})(commonjsGlobal, function () {
|
|
562
|
-
|
|
563
|
-
var b = /^(b|B)$/,
|
|
564
|
-
symbol = {
|
|
565
|
-
iec: {
|
|
566
|
-
bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"],
|
|
567
|
-
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
|
|
568
|
-
},
|
|
569
|
-
jedec: {
|
|
570
|
-
bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
|
|
571
|
-
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
|
572
|
-
}
|
|
573
|
-
},
|
|
574
|
-
fullform = {
|
|
575
|
-
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
|
|
576
|
-
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
|
|
577
|
-
},
|
|
578
|
-
roundingFuncs = {
|
|
579
|
-
floor: Math.floor,
|
|
580
|
-
ceil: Math.ceil
|
|
581
|
-
};
|
|
582
|
-
/**
|
|
583
|
-
* filesize
|
|
584
|
-
*
|
|
585
|
-
* @method filesize
|
|
586
|
-
* @param {Mixed} arg String, Int or Float to transform
|
|
587
|
-
* @param {Object} descriptor [Optional] Flags
|
|
588
|
-
* @return {String} Readable file size String
|
|
589
|
-
*/
|
|
590
|
-
|
|
591
|
-
function filesize(arg) {
|
|
592
|
-
var descriptor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
593
|
-
var result = [],
|
|
594
|
-
val = 0,
|
|
595
|
-
e,
|
|
596
|
-
base,
|
|
597
|
-
bits,
|
|
598
|
-
ceil,
|
|
599
|
-
full,
|
|
600
|
-
fullforms,
|
|
601
|
-
locale,
|
|
602
|
-
localeOptions,
|
|
603
|
-
neg,
|
|
604
|
-
num,
|
|
605
|
-
output,
|
|
606
|
-
pad,
|
|
607
|
-
round,
|
|
608
|
-
u,
|
|
609
|
-
unix,
|
|
610
|
-
separator,
|
|
611
|
-
spacer,
|
|
612
|
-
standard,
|
|
613
|
-
symbols,
|
|
614
|
-
roundingFunc,
|
|
615
|
-
precision;
|
|
616
|
-
|
|
617
|
-
if (isNaN(arg)) {
|
|
618
|
-
throw new TypeError("Invalid number");
|
|
619
|
-
}
|
|
491
|
+
var formatTimeBaseType = function formatTimeBaseType(timeBase) {
|
|
492
|
+
return new TimeBase(timeBase);
|
|
493
|
+
};
|
|
620
494
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
|
|
626
|
-
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
|
|
627
|
-
localeOptions = descriptor.localeOptions || {};
|
|
628
|
-
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
|
|
629
|
-
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
|
|
630
|
-
symbols = descriptor.symbols || {};
|
|
631
|
-
standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
|
|
632
|
-
output = descriptor.output || "string";
|
|
633
|
-
full = descriptor.fullform === true;
|
|
634
|
-
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
|
|
635
|
-
e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
|
|
636
|
-
roundingFunc = roundingFuncs[descriptor.roundingMethod] || Math.round;
|
|
637
|
-
num = Number(arg);
|
|
638
|
-
neg = num < 0;
|
|
639
|
-
ceil = base > 2 ? 1000 : 1024;
|
|
640
|
-
precision = isNaN(descriptor.precision) === false ? parseInt(descriptor.precision, 10) : 0; // Flipping a negative number to determine the size
|
|
641
|
-
|
|
642
|
-
if (neg) {
|
|
643
|
-
num = -num;
|
|
644
|
-
} // Determining the exponent
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
if (e === -1 || isNaN(e)) {
|
|
648
|
-
e = Math.floor(Math.log(num) / Math.log(ceil));
|
|
649
|
-
|
|
650
|
-
if (e < 0) {
|
|
651
|
-
e = 0;
|
|
652
|
-
}
|
|
653
|
-
} // Exceeding supported length, time to reduce & multiply
|
|
495
|
+
var formatTimeBaseText = function formatTimeBaseText(timeBaseText) {
|
|
496
|
+
if (timeBaseText === undefined) {
|
|
497
|
+
return formatTimeBaseType();
|
|
498
|
+
}
|
|
654
499
|
|
|
500
|
+
if (typeof timeBaseText === 'number') {
|
|
501
|
+
return formatTimeBaseType({
|
|
502
|
+
denominator: timeBaseText
|
|
503
|
+
});
|
|
504
|
+
}
|
|
655
505
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
506
|
+
if (timeBaseText.includes(':')) {
|
|
507
|
+
var _timeBaseText$split = timeBaseText.split(':'),
|
|
508
|
+
_timeBaseText$split2 = _slicedToArray(_timeBaseText$split, 2),
|
|
509
|
+
_denominator = _timeBaseText$split2[0],
|
|
510
|
+
numerator = _timeBaseText$split2[1];
|
|
660
511
|
|
|
661
|
-
|
|
662
|
-
|
|
512
|
+
return formatTimeBaseType({
|
|
513
|
+
denominator: _denominator,
|
|
514
|
+
numerator: numerator
|
|
515
|
+
});
|
|
516
|
+
}
|
|
663
517
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
518
|
+
if (Object.keys(CONSTANT_TIMEBASES).includes(timeBaseText)) {
|
|
519
|
+
return formatTimeBaseType(CONSTANT_TIMEBASES[timeBaseText]);
|
|
520
|
+
}
|
|
667
521
|
|
|
522
|
+
var denominator = Number(timeBaseText);
|
|
668
523
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
} else {
|
|
673
|
-
val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
|
|
524
|
+
if (Number.isNaN(denominator)) {
|
|
525
|
+
throw new Error("timeBaseText must be a number or ".concat(Object.keys(CONSTANT_TIMEBASES).join(','), " - is ").concat(timeBaseText));
|
|
526
|
+
}
|
|
674
527
|
|
|
675
|
-
|
|
676
|
-
|
|
528
|
+
return formatTimeBaseType({
|
|
529
|
+
denominator: denominator
|
|
530
|
+
});
|
|
531
|
+
};
|
|
677
532
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
533
|
+
var formatTimeBase = function formatTimeBase(timeBase) {
|
|
534
|
+
if (_typeof(timeBase) === 'object') {
|
|
535
|
+
return formatTimeBaseType(timeBase);
|
|
536
|
+
}
|
|
683
537
|
|
|
684
|
-
|
|
685
|
-
|
|
538
|
+
return formatTimeBaseText(timeBase);
|
|
539
|
+
};
|
|
686
540
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}
|
|
541
|
+
var formatTimeCodeType = function formatTimeCodeType(timeCode, options) {
|
|
542
|
+
return new TimeCode(timeCode, options);
|
|
543
|
+
};
|
|
691
544
|
|
|
692
|
-
|
|
545
|
+
var formatTimeCodeText = function formatTimeCodeText(timeCodeText, options) {
|
|
546
|
+
if (timeCodeText === undefined) {
|
|
547
|
+
var _timeCode = {
|
|
548
|
+
samples: 0
|
|
549
|
+
};
|
|
550
|
+
return formatTimeCodeType(_timeCode, options);
|
|
551
|
+
}
|
|
693
552
|
|
|
694
|
-
|
|
695
|
-
|
|
553
|
+
if (typeof timeCodeText === 'number') {
|
|
554
|
+
var _timeCode2 = {
|
|
555
|
+
samples: timeCodeText
|
|
556
|
+
};
|
|
557
|
+
return formatTimeCodeType(_timeCode2, options);
|
|
558
|
+
}
|
|
696
559
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
} // Decorating a 'diff'
|
|
560
|
+
if (timeCodeText.includes('@')) {
|
|
561
|
+
var _timeCodeText$split = timeCodeText.split('@'),
|
|
562
|
+
_timeCodeText$split2 = _slicedToArray(_timeCodeText$split, 2),
|
|
563
|
+
samplesString = _timeCodeText$split2[0],
|
|
564
|
+
timeBaseText = _timeCodeText$split2[1];
|
|
703
565
|
|
|
566
|
+
var _samples = Number(samplesString);
|
|
704
567
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
568
|
+
var timeBase = formatTimeBaseText(timeBaseText);
|
|
569
|
+
var _timeCode3 = {
|
|
570
|
+
samples: _samples,
|
|
571
|
+
timeBase: timeBase
|
|
572
|
+
};
|
|
573
|
+
return formatTimeCodeType(_timeCode3, options);
|
|
574
|
+
}
|
|
708
575
|
|
|
576
|
+
if (timeCodeText === '-INF') {
|
|
577
|
+
var _samples2 = -Infinity;
|
|
709
578
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
579
|
+
var _timeCode4 = {
|
|
580
|
+
samples: _samples2
|
|
581
|
+
};
|
|
582
|
+
return formatTimeCodeType(_timeCode4, options);
|
|
583
|
+
}
|
|
713
584
|
|
|
585
|
+
if (timeCodeText === '+INF') {
|
|
586
|
+
var _samples3 = Infinity;
|
|
587
|
+
var _timeCode5 = {
|
|
588
|
+
samples: _samples3
|
|
589
|
+
};
|
|
590
|
+
return formatTimeCodeType(_timeCode5, options);
|
|
591
|
+
}
|
|
714
592
|
|
|
715
|
-
|
|
593
|
+
var samples = Number(timeCodeText);
|
|
716
594
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
result[0] = result[0].toLocaleString(locale, localeOptions);
|
|
721
|
-
} else if (separator.length > 0) {
|
|
722
|
-
result[0] = result[0].toString().replace(".", separator);
|
|
723
|
-
}
|
|
595
|
+
if (Number.isNaN(samples)) {
|
|
596
|
+
throw new Error("timeBaseText must be a number or sample@timeBase - is ".concat(timeCodeText));
|
|
597
|
+
}
|
|
724
598
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
n = round - l;
|
|
731
|
-
result[0] = "".concat(tmp[0]).concat(x).concat(s.padEnd(l + n, "0"));
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
if (full) {
|
|
735
|
-
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
|
|
736
|
-
} // Returning Array, Object, or String (default)
|
|
599
|
+
var timeCode = {
|
|
600
|
+
samples: samples
|
|
601
|
+
};
|
|
602
|
+
return formatTimeCodeType(timeCode, options);
|
|
603
|
+
};
|
|
737
604
|
|
|
605
|
+
var formatSeconds = function formatSeconds(seconds, timeBase, options) {
|
|
606
|
+
if (Number.isNaN(Number(seconds))) {
|
|
607
|
+
throw new Error("seconds must be digits, is ".concat(seconds));
|
|
608
|
+
}
|
|
738
609
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
} : result.join(spacer);
|
|
745
|
-
} // Partial application for functional programming
|
|
610
|
+
var _ref7 = timeBase || {},
|
|
611
|
+
_ref7$denominator = _ref7.denominator,
|
|
612
|
+
denominator = _ref7$denominator === void 0 ? 1 : _ref7$denominator,
|
|
613
|
+
_ref7$numerator = _ref7.numerator,
|
|
614
|
+
numerator = _ref7$numerator === void 0 ? 1 : _ref7$numerator;
|
|
746
615
|
|
|
616
|
+
var samples = seconds * (denominator / numerator);
|
|
617
|
+
var timeCode = {
|
|
618
|
+
samples: samples,
|
|
619
|
+
timeBase: timeBase || {}
|
|
620
|
+
};
|
|
621
|
+
return new TimeCode(timeCode, options);
|
|
622
|
+
};
|
|
747
623
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
};
|
|
624
|
+
var formatSecondsPrecise = function formatSecondsPrecise(seconds, timeBase, options) {
|
|
625
|
+
if (Number.isNaN(Number(seconds))) {
|
|
626
|
+
throw new Error("seconds must be digits, is ".concat(seconds));
|
|
627
|
+
}
|
|
753
628
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
629
|
+
var _ref8 = timeBase || {},
|
|
630
|
+
_ref8$numerator = _ref8.numerator,
|
|
631
|
+
numerator = _ref8$numerator === void 0 ? 1 : _ref8$numerator;
|
|
757
632
|
|
|
758
|
-
var
|
|
633
|
+
var _ref9 = timeBase || {},
|
|
634
|
+
_ref9$denominator = _ref9.denominator,
|
|
635
|
+
denominator = _ref9$denominator === void 0 ? 1 : _ref9$denominator;
|
|
759
636
|
|
|
760
|
-
|
|
761
|
-
var
|
|
762
|
-
|
|
763
|
-
var CONSTANT_TIMEBASES = (_CONSTANT_TIMEBASES = {}, _defineProperty(_CONSTANT_TIMEBASES, PAL, {
|
|
764
|
-
denominator: 25,
|
|
765
|
-
numerator: 1
|
|
766
|
-
}), _defineProperty(_CONSTANT_TIMEBASES, NTSC, {
|
|
767
|
-
denominator: 30000,
|
|
768
|
-
numerator: 1001
|
|
769
|
-
}), _defineProperty(_CONSTANT_TIMEBASES, NTSC30, {
|
|
770
|
-
denominator: 30,
|
|
771
|
-
numerator: 1
|
|
772
|
-
}), _defineProperty(_CONSTANT_TIMEBASES, 29.97, {
|
|
773
|
-
denominator: 30000,
|
|
774
|
-
numerator: 1001
|
|
775
|
-
}), _defineProperty(_CONSTANT_TIMEBASES, 59.94, {
|
|
776
|
-
denominator: 60000,
|
|
777
|
-
numerator: 1001
|
|
778
|
-
}), _CONSTANT_TIMEBASES);
|
|
779
|
-
var FRAME_SEPARATORS = {
|
|
780
|
-
':': {
|
|
781
|
-
dropFrame: false,
|
|
782
|
-
field: 2
|
|
783
|
-
},
|
|
784
|
-
';': {
|
|
785
|
-
dropFrame: true,
|
|
786
|
-
field: 2
|
|
787
|
-
},
|
|
788
|
-
'.': {
|
|
789
|
-
dropFrame: false,
|
|
790
|
-
field: 1
|
|
791
|
-
},
|
|
792
|
-
',': {
|
|
793
|
-
dropFrame: true,
|
|
794
|
-
field: 1
|
|
637
|
+
if (!Number.isInteger(seconds)) {
|
|
638
|
+
var decimalPlaces = String(seconds).split('.')[1].length;
|
|
639
|
+
denominator *= Math.pow(10, decimalPlaces);
|
|
795
640
|
}
|
|
641
|
+
|
|
642
|
+
var samples = (seconds * (denominator / numerator)).toFixed();
|
|
643
|
+
var timeCode = {
|
|
644
|
+
samples: samples,
|
|
645
|
+
timeBase: {
|
|
646
|
+
denominator: denominator,
|
|
647
|
+
numerator: numerator
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
return new TimeCode(timeCode, options);
|
|
796
651
|
};
|
|
797
652
|
|
|
798
|
-
var
|
|
799
|
-
var
|
|
800
|
-
var hhmmssff;
|
|
801
|
-
var frameOptions = {};
|
|
653
|
+
var formatSmpte = function formatSmpte(smpteText, timeBaseText) {
|
|
654
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
802
655
|
|
|
803
|
-
if (
|
|
804
|
-
var
|
|
805
|
-
frameSeparator = _hasDropFrameSeparato[0];
|
|
656
|
+
if (smpteText === undefined) {
|
|
657
|
+
var _timeBase = formatTimeBase(timeBaseText);
|
|
806
658
|
|
|
807
|
-
var
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
659
|
+
var _timeCode6 = {
|
|
660
|
+
samples: 0,
|
|
661
|
+
timeBase: _timeBase
|
|
662
|
+
};
|
|
663
|
+
return formatTimeCodeType(_timeCode6);
|
|
664
|
+
}
|
|
811
665
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
} else {
|
|
815
|
-
hhmmssff = smpteText.split(':');
|
|
666
|
+
if (typeof smpteText !== 'string') {
|
|
667
|
+
throw new Error("smpteText must be a string, is ".concat(smpteText));
|
|
816
668
|
}
|
|
817
669
|
|
|
818
|
-
|
|
670
|
+
var _splitSmpte = splitSmpte(smpteText),
|
|
671
|
+
_splitSmpte2 = _slicedToArray(_splitSmpte, 2),
|
|
672
|
+
_splitSmpte2$ = _slicedToArray(_splitSmpte2[0], 4),
|
|
673
|
+
hh = _splitSmpte2$[0],
|
|
674
|
+
mm = _splitSmpte2$[1],
|
|
675
|
+
ss = _splitSmpte2$[2],
|
|
676
|
+
_splitSmpte2$$ = _splitSmpte2$[3],
|
|
677
|
+
ff = _splitSmpte2$$ === void 0 ? 0 : _splitSmpte2$$,
|
|
678
|
+
frameOptions = _splitSmpte2[1];
|
|
819
679
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
680
|
+
var _frameOptions$dropFra = frameOptions.dropFrame,
|
|
681
|
+
dropFrame = _frameOptions$dropFra === void 0 ? false : _frameOptions$dropFra;
|
|
682
|
+
var timeBase = formatTimeBase(timeBaseText);
|
|
683
|
+
var roundedFrameRate = getRoundedFrameRate(timeBase);
|
|
684
|
+
|
|
685
|
+
if (mm >= 60 || mm < 0 || ss >= 60 || ss < 0 || ff >= roundedFrameRate || ff < 0) {
|
|
686
|
+
throw new Error('Invalid mm, ss or ff');
|
|
824
687
|
}
|
|
825
688
|
|
|
826
|
-
|
|
689
|
+
var samples = countSamples(hh, mm, ss, ff, {
|
|
690
|
+
dropFrame: dropFrame,
|
|
691
|
+
roundedFrameRate: roundedFrameRate
|
|
692
|
+
});
|
|
693
|
+
var timeCode = {
|
|
694
|
+
samples: samples,
|
|
695
|
+
timeBase: timeBase
|
|
696
|
+
};
|
|
697
|
+
return formatTimeCodeType(timeCode, _objectSpread$7(_objectSpread$7({}, frameOptions), options));
|
|
827
698
|
};
|
|
828
699
|
|
|
829
|
-
var
|
|
830
|
-
|
|
700
|
+
var _excluded$4 = ["property"];
|
|
701
|
+
|
|
702
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
703
|
+
|
|
704
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
705
|
+
var sampleRateSymbols = {
|
|
706
|
+
kB: 'kHz',
|
|
707
|
+
B: 'Hz',
|
|
708
|
+
mB: 'mHz'
|
|
709
|
+
};
|
|
710
|
+
var bitRateSymbols = {
|
|
711
|
+
kB: 'kbps',
|
|
712
|
+
B: 'bps',
|
|
713
|
+
MB: 'mbps'
|
|
831
714
|
};
|
|
832
715
|
|
|
833
|
-
var
|
|
834
|
-
return
|
|
716
|
+
var gcd = function gcd(a, b) {
|
|
717
|
+
return b ? gcd(b, a % b) : a;
|
|
835
718
|
};
|
|
836
719
|
|
|
837
|
-
var
|
|
838
|
-
var
|
|
839
|
-
|
|
720
|
+
var parseAspectRatio = function parseAspectRatio(_ref) {
|
|
721
|
+
var width = _ref.width,
|
|
722
|
+
height = _ref.height;
|
|
723
|
+
var denominator = gcd(width, height);
|
|
724
|
+
var widthRatio = width / denominator;
|
|
725
|
+
var heightRatio = height / denominator;
|
|
840
726
|
|
|
841
|
-
if (
|
|
842
|
-
|
|
727
|
+
if (widthRatio > 21) {
|
|
728
|
+
heightRatio = 1;
|
|
729
|
+
widthRatio = (width / height).toFixed(2);
|
|
843
730
|
}
|
|
844
731
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}
|
|
732
|
+
return [widthRatio, heightRatio].join(':');
|
|
733
|
+
};
|
|
848
734
|
|
|
849
|
-
|
|
850
|
-
var
|
|
851
|
-
var shouldDropSecond = shouldDropMinute && ss === 0;
|
|
852
|
-
var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
|
|
853
|
-
var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
|
|
854
|
-
var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
|
|
735
|
+
var parseBaseMediaInfoType = function parseBaseMediaInfoType() {
|
|
736
|
+
var baseMediaInfoType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
855
737
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
}
|
|
738
|
+
var keyValuePairType = baseMediaInfoType.property,
|
|
739
|
+
props = _objectWithoutProperties(baseMediaInfoType, _excluded$4);
|
|
859
740
|
|
|
860
|
-
var
|
|
861
|
-
return
|
|
741
|
+
var parsedKeyValuePairType = parseKeyValuePairType(keyValuePairType);
|
|
742
|
+
return _objectSpread$6(_objectSpread$6({}, parsedKeyValuePairType), props);
|
|
862
743
|
};
|
|
863
744
|
|
|
864
|
-
function
|
|
865
|
-
var
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
var oneMinuteChunks = Math.floor(minuteRemainder / oneMinuteDroppedFrames);
|
|
872
|
-
var frameRemainder = minuteRemainder % oneMinuteDroppedFrames;
|
|
873
|
-
var frameChunks = frameRemainder > 0 ? dropFrames : 0;
|
|
874
|
-
return tenMinuteChunks * 9 * dropFrames + oneMinuteChunks * dropFrames + frameChunks;
|
|
875
|
-
}
|
|
745
|
+
var parseFileType = function parseFileType(fileType) {
|
|
746
|
+
var _fileType$uri = fileType.uri,
|
|
747
|
+
uriList = _fileType$uri === void 0 ? [] : _fileType$uri,
|
|
748
|
+
fileSizeBytes = fileType.size,
|
|
749
|
+
hash = fileType.hash,
|
|
750
|
+
path = fileType.path,
|
|
751
|
+
fileId = fileType.id;
|
|
876
752
|
|
|
877
|
-
var
|
|
878
|
-
|
|
879
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
880
|
-
_ref2$numerator = _ref2.numerator,
|
|
881
|
-
numerator = _ref2$numerator === void 0 ? 1 : _ref2$numerator,
|
|
882
|
-
_ref2$denominator = _ref2.denominator,
|
|
883
|
-
denominator = _ref2$denominator === void 0 ? 1 : _ref2$denominator;
|
|
753
|
+
var _uriList = _slicedToArray(uriList, 1),
|
|
754
|
+
uri = _uriList[0];
|
|
884
755
|
|
|
885
|
-
|
|
756
|
+
var fileSize = fileSizeBytes !== undefined ? parseFileSize(fileSizeBytes) : '';
|
|
757
|
+
var fileName = path ? path.split('/').pop() : undefined;
|
|
758
|
+
return {
|
|
759
|
+
uri: uri,
|
|
760
|
+
hash: hash,
|
|
761
|
+
fileSize: fileSize,
|
|
762
|
+
fileSizeBytes: fileSizeBytes,
|
|
763
|
+
path: path,
|
|
764
|
+
fileName: fileName,
|
|
765
|
+
fileId: fileId
|
|
766
|
+
};
|
|
767
|
+
};
|
|
886
768
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
769
|
+
var parseContainerComponent = function parseContainerComponent(containerComponent) {
|
|
770
|
+
var _containerComponent$m = containerComponent.mediaInfo,
|
|
771
|
+
mediaInfo = _containerComponent$m === void 0 ? {} : _containerComponent$m,
|
|
772
|
+
_containerComponent$m2 = containerComponent.metadata,
|
|
773
|
+
metadata = _containerComponent$m2 === void 0 ? [] : _containerComponent$m2,
|
|
774
|
+
fileList = containerComponent.file,
|
|
775
|
+
durationTimeCode = containerComponent.duration,
|
|
776
|
+
startTimestamp = containerComponent.startTimestamp,
|
|
777
|
+
startTimecode = containerComponent.startTimecode,
|
|
778
|
+
timeCodeTimeBase = containerComponent.timeCodeTimeBase;
|
|
779
|
+
var containerMetadata = parseKeyValuePairType(metadata);
|
|
780
|
+
var containerMediaInfo = parseBaseMediaInfoType(mediaInfo);
|
|
781
|
+
var containerFormat = containerMediaInfo.Format;
|
|
782
|
+
var videoFormat = containerMediaInfo.Video_Format_List,
|
|
783
|
+
audioFormat = containerMediaInfo.Audio_Format_List,
|
|
784
|
+
textFormat = containerMediaInfo.Text_Format_List;
|
|
890
785
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
return {
|
|
895
|
-
denominator: this.denominator,
|
|
896
|
-
numerator: this.numerator
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
}, {
|
|
900
|
-
key: "toConstant",
|
|
901
|
-
value: function toConstant() {
|
|
902
|
-
var _this = this;
|
|
786
|
+
if (containerFormat === undefined) {
|
|
787
|
+
var format = containerComponent.format;
|
|
788
|
+
containerFormat = format;
|
|
903
789
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
var _thisTimeBase = _slicedToArray(thisTimeBase, 2),
|
|
907
|
-
thisTimeBaseText = _thisTimeBase[0],
|
|
908
|
-
thisTimeBaseType = _thisTimeBase[1];
|
|
909
|
-
|
|
910
|
-
var numerator = thisTimeBaseType.numerator,
|
|
911
|
-
denominator = thisTimeBaseType.denominator;
|
|
790
|
+
if (format && format.includes(',')) {
|
|
791
|
+
var formatList = format.split(',');
|
|
912
792
|
|
|
913
|
-
|
|
914
|
-
constant = thisTimeBaseText;
|
|
915
|
-
return true;
|
|
916
|
-
}
|
|
793
|
+
var _formatList = _slicedToArray(formatList, 1);
|
|
917
794
|
|
|
918
|
-
|
|
919
|
-
});
|
|
920
|
-
return constant;
|
|
795
|
+
containerFormat = _formatList[0];
|
|
921
796
|
}
|
|
922
|
-
}
|
|
923
|
-
key: "toText",
|
|
924
|
-
value: function toText() {
|
|
925
|
-
var useConstant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
797
|
+
}
|
|
926
798
|
|
|
927
|
-
|
|
928
|
-
|
|
799
|
+
var parsedContainerComponent = {
|
|
800
|
+
containerFormat: containerFormat,
|
|
801
|
+
videoFormat: videoFormat,
|
|
802
|
+
audioFormat: audioFormat,
|
|
803
|
+
textFormat: textFormat,
|
|
804
|
+
containerMetadata: containerMetadata,
|
|
805
|
+
containerMediaInfo: containerMediaInfo
|
|
806
|
+
};
|
|
929
807
|
|
|
930
|
-
|
|
931
|
-
|
|
808
|
+
if (containerMetadata.componentOriginalFilename) {
|
|
809
|
+
parsedContainerComponent.originalFilename = containerMetadata.componentOriginalFilename;
|
|
810
|
+
}
|
|
932
811
|
|
|
933
|
-
|
|
934
|
-
|
|
812
|
+
if (durationTimeCode !== undefined && durationTimeCode.samples !== 0) {
|
|
813
|
+
parsedContainerComponent.durationTimeCode = formatTimeCodeType(durationTimeCode);
|
|
814
|
+
parsedContainerComponent.duration = parsedContainerComponent.durationTimeCode.toDuration();
|
|
815
|
+
}
|
|
935
816
|
|
|
936
|
-
|
|
937
|
-
|
|
817
|
+
if (startTimestamp) {
|
|
818
|
+
parsedContainerComponent.startTimestamp = formatTimeCodeType(startTimestamp);
|
|
819
|
+
}
|
|
938
820
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
var useConstant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
946
|
-
var round = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
821
|
+
if (startTimecode !== undefined && timeCodeTimeBase) {
|
|
822
|
+
parsedContainerComponent.startTimecode = formatTimeCodeType({
|
|
823
|
+
samples: startTimecode,
|
|
824
|
+
timeBase: timeCodeTimeBase
|
|
825
|
+
});
|
|
826
|
+
}
|
|
947
827
|
|
|
948
|
-
|
|
949
|
-
|
|
828
|
+
if (fileList) {
|
|
829
|
+
var _fileList = _slicedToArray(fileList, 1),
|
|
830
|
+
fileType = _fileList[0];
|
|
950
831
|
|
|
951
|
-
|
|
952
|
-
|
|
832
|
+
var parsedFileType = parseFileType(fileType);
|
|
833
|
+
parsedContainerComponent = _objectSpread$6(_objectSpread$6({}, parsedContainerComponent), parsedFileType);
|
|
834
|
+
}
|
|
953
835
|
|
|
954
|
-
|
|
836
|
+
return parsedContainerComponent;
|
|
837
|
+
};
|
|
955
838
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
839
|
+
var parseVideoComponent = function parseVideoComponent(videoComponent) {
|
|
840
|
+
var videoCodec = videoComponent.codec,
|
|
841
|
+
bitrate = videoComponent.bitrate,
|
|
842
|
+
fieldOrder = videoComponent.fieldOrder,
|
|
843
|
+
_videoComponent$resol = videoComponent.resolution,
|
|
844
|
+
resolution = _videoComponent$resol === void 0 ? {} : _videoComponent$resol,
|
|
845
|
+
_videoComponent$media = videoComponent.mediaInfo,
|
|
846
|
+
mediaInfo = _videoComponent$media === void 0 ? {} : _videoComponent$media,
|
|
847
|
+
_videoComponent$metad = videoComponent.metadata,
|
|
848
|
+
metadata = _videoComponent$metad === void 0 ? [] : _videoComponent$metad;
|
|
849
|
+
var videoMediaInfo = parseBaseMediaInfoType(mediaInfo);
|
|
850
|
+
var videoMetadata = parseKeyValuePairType(metadata);
|
|
851
|
+
var videoFormat = videoMediaInfo.Format,
|
|
852
|
+
timeBaseText = videoMediaInfo['Frame rate'],
|
|
853
|
+
colorSpace = videoMediaInfo['Color space'],
|
|
854
|
+
colorPrimaries = videoMediaInfo['Color primaries'],
|
|
855
|
+
chromaSubsampling = videoMediaInfo.Colorimetry;
|
|
856
|
+
var timeBase;
|
|
857
|
+
var averageFrameRate = videoComponent.averageFrameRate,
|
|
858
|
+
realBaseFrameRate = videoComponent.realBaseFrameRate;
|
|
959
859
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
860
|
+
if (realBaseFrameRate !== undefined) {
|
|
861
|
+
timeBase = {
|
|
862
|
+
numerator: realBaseFrameRate.denominator,
|
|
863
|
+
denominator: realBaseFrameRate.numerator
|
|
864
|
+
};
|
|
865
|
+
} else if (timeBaseText !== undefined) {
|
|
866
|
+
timeBase = formatTimeBaseText(timeBaseText);
|
|
867
|
+
} else if (averageFrameRate !== undefined) {
|
|
868
|
+
timeBase = {
|
|
869
|
+
numerator: averageFrameRate.denominator,
|
|
870
|
+
denominator: averageFrameRate.numerator
|
|
871
|
+
};
|
|
872
|
+
}
|
|
963
873
|
|
|
964
|
-
|
|
965
|
-
}();
|
|
874
|
+
var samples = videoMediaInfo['Frame count'];
|
|
966
875
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
};
|
|
876
|
+
if (samples === undefined) {
|
|
877
|
+
var numberOfPackets = videoComponent.numberOfPackets;
|
|
878
|
+
if (numberOfPackets !== undefined) samples = numberOfPackets;
|
|
879
|
+
}
|
|
972
880
|
|
|
973
|
-
var
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
_ref4$samples = _ref4.samples,
|
|
977
|
-
samples = _ref4$samples === void 0 ? 0 : _ref4$samples,
|
|
978
|
-
timeBase = _ref4.timeBase;
|
|
881
|
+
var timeCode;
|
|
882
|
+
var frameRate;
|
|
883
|
+
var smpte;
|
|
979
884
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
885
|
+
if (samples && timeBase) {
|
|
886
|
+
timeCode = formatTimeCodeType({
|
|
887
|
+
samples: samples,
|
|
888
|
+
timeBase: timeBase
|
|
889
|
+
});
|
|
890
|
+
frameRate = timeCode.timeBase.toRate(true);
|
|
891
|
+
smpte = timeCode.toSmpte(true);
|
|
892
|
+
}
|
|
984
893
|
|
|
985
|
-
|
|
894
|
+
var height = resolution.height,
|
|
895
|
+
width = resolution.width;
|
|
896
|
+
var aspectRatio = parseAspectRatio(resolution);
|
|
897
|
+
var dimension = "".concat(width, "x").concat(height);
|
|
898
|
+
var videoBitrate = bitrate ? parseFileSize(bitrate, {
|
|
899
|
+
bits: true
|
|
900
|
+
}) : undefined;
|
|
901
|
+
return {
|
|
902
|
+
videoFormat: videoFormat,
|
|
903
|
+
dimension: dimension,
|
|
904
|
+
frameRate: frameRate,
|
|
905
|
+
height: height,
|
|
906
|
+
width: width,
|
|
907
|
+
timeBase: timeBase,
|
|
908
|
+
timeCode: timeCode,
|
|
909
|
+
videoCodec: videoCodec,
|
|
910
|
+
smpte: smpte,
|
|
911
|
+
videoBitrate: videoBitrate,
|
|
912
|
+
fieldOrder: fieldOrder,
|
|
913
|
+
colorSpace: colorSpace,
|
|
914
|
+
chromaSubsampling: chromaSubsampling,
|
|
915
|
+
aspectRatio: aspectRatio,
|
|
916
|
+
colorPrimaries: colorPrimaries,
|
|
917
|
+
videoMetadata: videoMetadata,
|
|
918
|
+
videoMediaInfo: videoMediaInfo
|
|
919
|
+
};
|
|
920
|
+
};
|
|
986
921
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
922
|
+
var parseAudioComponent = function parseAudioComponent(audioComponent) {
|
|
923
|
+
var _audioComponent$timeB = audioComponent.timeBase,
|
|
924
|
+
timeBase = _audioComponent$timeB === void 0 ? {} : _audioComponent$timeB,
|
|
925
|
+
audioChannels = audioComponent.channelCount,
|
|
926
|
+
audioCodec = audioComponent.codec,
|
|
927
|
+
_audioComponent$media = audioComponent.mediaInfo,
|
|
928
|
+
mediaInfo = _audioComponent$media === void 0 ? {} : _audioComponent$media,
|
|
929
|
+
bitrate = audioComponent.bitrate,
|
|
930
|
+
_audioComponent$metad = audioComponent.metadata,
|
|
931
|
+
metadata = _audioComponent$metad === void 0 ? [] : _audioComponent$metad;
|
|
932
|
+
var audioMediaInfo = parseBaseMediaInfoType(mediaInfo);
|
|
933
|
+
var audioMetadata = parseKeyValuePairType(metadata);
|
|
934
|
+
var audioFormat = audioMediaInfo.Format,
|
|
935
|
+
audioBitDepth = audioMediaInfo.Resolution,
|
|
936
|
+
audioBitRateMode = audioMediaInfo.Bit_rate_mode;
|
|
937
|
+
var audioSamplerateSamples = timeBase.denominator ? timeBase.denominator / timeBase.numerator : undefined;
|
|
938
|
+
var audioSamplerate = audioSamplerateSamples ? parseFileSize(audioSamplerateSamples, {
|
|
939
|
+
base: 10,
|
|
940
|
+
round: 1,
|
|
941
|
+
symbols: sampleRateSymbols
|
|
942
|
+
}) : undefined;
|
|
943
|
+
var audioBitrate = bitrate ? parseFileSize(bitrate, {
|
|
944
|
+
base: 10,
|
|
945
|
+
round: 2,
|
|
946
|
+
symbols: bitRateSymbols
|
|
947
|
+
}) : undefined;
|
|
948
|
+
return {
|
|
949
|
+
audioFormat: audioFormat,
|
|
950
|
+
audioCodec: audioCodec,
|
|
951
|
+
audioSamplerate: audioSamplerate,
|
|
952
|
+
audioSamplerateSamples: audioSamplerateSamples,
|
|
953
|
+
audioBitDepth: audioBitDepth,
|
|
954
|
+
audioBitrate: audioBitrate,
|
|
955
|
+
audioBitRateMode: audioBitRateMode,
|
|
956
|
+
audioChannels: audioChannels,
|
|
957
|
+
audioMediaInfo: audioMediaInfo,
|
|
958
|
+
audioMetadata: audioMetadata
|
|
959
|
+
};
|
|
960
|
+
};
|
|
1000
961
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
962
|
+
var parseBinaryComponent = function parseBinaryComponent(binaryComponent) {
|
|
963
|
+
var fileList = binaryComponent.file,
|
|
964
|
+
_binaryComponent$medi = binaryComponent.mediaInfo,
|
|
965
|
+
mediaInfo = _binaryComponent$medi === void 0 ? {} : _binaryComponent$medi,
|
|
966
|
+
_binaryComponent$meta = binaryComponent.metadata,
|
|
967
|
+
metadata = _binaryComponent$meta === void 0 ? [] : _binaryComponent$meta;
|
|
968
|
+
var binaryMetadata = parseKeyValuePairType(metadata);
|
|
969
|
+
var binaryMediaInfo = parseBaseMediaInfoType(mediaInfo);
|
|
970
|
+
var parsedBinaryComponent = {
|
|
971
|
+
binaryMetadata: binaryMetadata,
|
|
972
|
+
binaryMediaInfo: binaryMediaInfo
|
|
973
|
+
};
|
|
1005
974
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
var _val$timeBase = val.timeBase,
|
|
1010
|
-
numerator = _val$timeBase.numerator,
|
|
1011
|
-
denominator = _val$timeBase.denominator;
|
|
1012
|
-
var conformedTimeCode = val;
|
|
975
|
+
if (fileList) {
|
|
976
|
+
var _fileList2 = _slicedToArray(fileList, 1),
|
|
977
|
+
fileType = _fileList2[0];
|
|
1013
978
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
979
|
+
var parsedFileType = parseFileType(fileType);
|
|
980
|
+
parsedBinaryComponent = _objectSpread$6(_objectSpread$6({}, parsedBinaryComponent), parsedFileType);
|
|
981
|
+
}
|
|
1017
982
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
return new TimeCode({
|
|
1021
|
-
samples: this.samples + samples,
|
|
1022
|
-
timeBase: this.timeBase
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
}, {
|
|
1026
|
-
key: "subtract",
|
|
1027
|
-
value: function subtract(val) {
|
|
1028
|
-
var _val$timeBase2 = val.timeBase,
|
|
1029
|
-
numerator = _val$timeBase2.numerator,
|
|
1030
|
-
denominator = _val$timeBase2.denominator;
|
|
1031
|
-
var conformedTimeCode = val;
|
|
983
|
+
return parsedBinaryComponent;
|
|
984
|
+
};
|
|
1032
985
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
986
|
+
var parseShapeType = function parseShapeType() {
|
|
987
|
+
var shapeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
988
|
+
var parsedShape = {};
|
|
989
|
+
var containerComponent = shapeType.containerComponent,
|
|
990
|
+
videoComponentList = shapeType.videoComponent,
|
|
991
|
+
audioComponentList = shapeType.audioComponent,
|
|
992
|
+
binaryComponentList = shapeType.binaryComponent,
|
|
993
|
+
_shapeType$mimeType = shapeType.mimeType,
|
|
994
|
+
mimeTypeList = _shapeType$mimeType === void 0 ? [] : _shapeType$mimeType,
|
|
995
|
+
_shapeType$tag = shapeType.tag,
|
|
996
|
+
tagList = _shapeType$tag === void 0 ? [] : _shapeType$tag;
|
|
1036
997
|
|
|
1037
|
-
|
|
1038
|
-
samples = _conformedTimeCode2.samples;
|
|
1039
|
-
return new TimeCode({
|
|
1040
|
-
samples: this.samples - samples,
|
|
1041
|
-
timeBase: this.timeBase
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
|
-
}, {
|
|
1045
|
-
key: "conformTimeBase",
|
|
1046
|
-
value: function conformTimeBase(conformTo) {
|
|
1047
|
-
var timeBase = conformTo;
|
|
998
|
+
var _tagList = _slicedToArray(tagList, 1);
|
|
1048
999
|
|
|
1049
|
-
|
|
1050
|
-
timeBase = new TimeBase(conformTo);
|
|
1051
|
-
}
|
|
1000
|
+
parsedShape.tag = _tagList[0];
|
|
1052
1001
|
|
|
1053
|
-
|
|
1054
|
-
var timeCode = {
|
|
1055
|
-
samples: samples,
|
|
1056
|
-
timeBase: timeBase
|
|
1057
|
-
};
|
|
1058
|
-
return new TimeCode(timeCode);
|
|
1059
|
-
}
|
|
1060
|
-
}, {
|
|
1061
|
-
key: "toJSON",
|
|
1062
|
-
value: function toJSON() {
|
|
1063
|
-
return {
|
|
1064
|
-
samples: this.samples,
|
|
1065
|
-
timeBase: this.timeBase
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
}, {
|
|
1069
|
-
key: "toText",
|
|
1070
|
-
value: function toText() {
|
|
1071
|
-
var timeCodeText = String(this.samples);
|
|
1072
|
-
var timeBaseText = this.timeBase.toText();
|
|
1002
|
+
var _mimeTypeList = _slicedToArray(mimeTypeList, 1);
|
|
1073
1003
|
|
|
1074
|
-
|
|
1075
|
-
timeCodeText = [this.samples, timeBaseText].join('@');
|
|
1076
|
-
}
|
|
1004
|
+
parsedShape.mimeType = _mimeTypeList[0];
|
|
1077
1005
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
value: function toSeconds() {
|
|
1083
|
-
var _this$timeBase = this.timeBase,
|
|
1084
|
-
numerator = _this$timeBase.numerator,
|
|
1085
|
-
denominator = _this$timeBase.denominator;
|
|
1086
|
-
return this.samples * (numerator / denominator);
|
|
1087
|
-
}
|
|
1088
|
-
}, {
|
|
1089
|
-
key: "toTime",
|
|
1090
|
-
value: function toTime() {
|
|
1091
|
-
var roundedFrameRate = getRoundedFrameRate(this.timeBase);
|
|
1092
|
-
var totalSamples = this.samples + (this.dropFrame ? countDroppedFrames(this.samples + 1, roundedFrameRate) : 0);
|
|
1093
|
-
var hours = Math.floor(totalSamples / (3600 * roundedFrameRate));
|
|
1094
|
-
var minutes = Math.floor(totalSamples / (60 * roundedFrameRate)) % 60;
|
|
1095
|
-
var seconds = Math.floor(totalSamples / roundedFrameRate) % 60;
|
|
1096
|
-
var frames = totalSamples % roundedFrameRate;
|
|
1097
|
-
var partialSeconds = frames / roundedFrameRate;
|
|
1098
|
-
return {
|
|
1099
|
-
hours: hours,
|
|
1100
|
-
minutes: minutes,
|
|
1101
|
-
seconds: seconds,
|
|
1102
|
-
frames: frames,
|
|
1103
|
-
partialSeconds: partialSeconds
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
}, {
|
|
1107
|
-
key: "toDuration",
|
|
1108
|
-
value: function toDuration() {
|
|
1109
|
-
var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1110
|
-
format = _ref6.format;
|
|
1006
|
+
if (containerComponent) {
|
|
1007
|
+
var parsedContainerComponent = parseContainerComponent(containerComponent);
|
|
1008
|
+
parsedShape = _objectSpread$6(_objectSpread$6({}, parsedShape), parsedContainerComponent);
|
|
1009
|
+
}
|
|
1111
1010
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
seconds = _this$toTime.seconds;
|
|
1011
|
+
if (videoComponentList) {
|
|
1012
|
+
var _videoComponentList = _slicedToArray(videoComponentList, 1),
|
|
1013
|
+
videoComponent = _videoComponentList[0];
|
|
1116
1014
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1015
|
+
var parsedVideoComponent = parseVideoComponent(videoComponent);
|
|
1016
|
+
parsedShape = _objectSpread$6(_objectSpread$6({}, parsedShape), parsedVideoComponent);
|
|
1017
|
+
}
|
|
1122
1018
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1019
|
+
if (audioComponentList) {
|
|
1020
|
+
var _audioComponentList = _slicedToArray(audioComponentList, 1),
|
|
1021
|
+
audioComponent = _audioComponentList[0];
|
|
1126
1022
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1023
|
+
var parsedAudioComponent = parseAudioComponent(audioComponent);
|
|
1024
|
+
parsedShape = _objectSpread$6(_objectSpread$6({}, parsedShape), parsedAudioComponent);
|
|
1025
|
+
}
|
|
1130
1026
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
key: "toSmpte",
|
|
1135
|
-
value: function toSmpte() {
|
|
1136
|
-
var _this2 = this;
|
|
1027
|
+
if (binaryComponentList) {
|
|
1028
|
+
var _binaryComponentList = _slicedToArray(binaryComponentList, 1),
|
|
1029
|
+
binaryComponent = _binaryComponentList[0];
|
|
1137
1030
|
|
|
1138
|
-
|
|
1031
|
+
var parsedBinaryComponent = parseBinaryComponent(binaryComponent);
|
|
1032
|
+
parsedShape = _objectSpread$6(_objectSpread$6({}, parsedShape), parsedBinaryComponent);
|
|
1033
|
+
}
|
|
1139
1034
|
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
minutes = _this$toTime2.minutes,
|
|
1143
|
-
seconds = _this$toTime2.seconds,
|
|
1144
|
-
frames = _this$toTime2.frames;
|
|
1035
|
+
return parsedShape;
|
|
1036
|
+
};
|
|
1145
1037
|
|
|
1146
|
-
|
|
1038
|
+
var _excluded$3 = ["Codec"],
|
|
1039
|
+
_excluded2$2 = ["Codec"];
|
|
1147
1040
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1041
|
+
var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetType) {
|
|
1042
|
+
var output = {};
|
|
1043
|
+
var description = transcodePresetType.description,
|
|
1044
|
+
_transcodePresetType$ = transcodePresetType.mediaconvert;
|
|
1045
|
+
_transcodePresetType$ = _transcodePresetType$ === void 0 ? {} : _transcodePresetType$;
|
|
1046
|
+
var _transcodePresetType$2 = _transcodePresetType$.outputSetting,
|
|
1047
|
+
outputSetting = _transcodePresetType$2 === void 0 ? [] : _transcodePresetType$2;
|
|
1048
|
+
output.description = description;
|
|
1049
|
+
if (outputSetting.length === 0) return output;
|
|
1050
|
+
var mc = JSON.parse(outputSetting[0]);
|
|
1051
|
+
var _mc$Settings = mc.Settings;
|
|
1052
|
+
_mc$Settings = _mc$Settings === void 0 ? {} : _mc$Settings;
|
|
1053
|
+
var ContainerSettings = _mc$Settings.ContainerSettings,
|
|
1054
|
+
VideoDescription = _mc$Settings.VideoDescription,
|
|
1055
|
+
AudioDescriptions = _mc$Settings.AudioDescriptions;
|
|
1056
|
+
output.containerFormat = ContainerSettings.Container;
|
|
1153
1057
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
_Object$entries$find3 = _Object$entries$find2[0],
|
|
1158
|
-
frameSeparator = _Object$entries$find3 === void 0 ? ':' : _Object$entries$find3;
|
|
1058
|
+
if (ContainerSettings) {
|
|
1059
|
+
output.containerFormat = ContainerSettings.Container;
|
|
1060
|
+
}
|
|
1159
1061
|
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
key: "toFraction",
|
|
1164
|
-
value: function toFraction() {
|
|
1165
|
-
return "".concat(this.samples, "@").concat(this.timeBase.denominator, ":").concat(this.timeBase.numerator);
|
|
1166
|
-
}
|
|
1167
|
-
}]);
|
|
1062
|
+
if (VideoDescription) {
|
|
1063
|
+
var _VideoDescription$Cod = VideoDescription.CodecSettings,
|
|
1064
|
+
CodecSettings = _VideoDescription$Cod === void 0 ? {} : _VideoDescription$Cod;
|
|
1168
1065
|
|
|
1169
|
-
|
|
1170
|
-
|
|
1066
|
+
var Codec = CodecSettings.Codec,
|
|
1067
|
+
otherSettings = _objectWithoutProperties(CodecSettings, _excluded$3);
|
|
1171
1068
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1069
|
+
output.videoFormat = Codec;
|
|
1070
|
+
var height = VideoDescription.Height,
|
|
1071
|
+
width = VideoDescription.Width;
|
|
1072
|
+
output.height = height;
|
|
1073
|
+
output.width = width;
|
|
1175
1074
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1075
|
+
if (height && width) {
|
|
1076
|
+
output.dimension = "".concat(width, "x").concat(height);
|
|
1077
|
+
output.aspectRatio = parseAspectRatio({
|
|
1078
|
+
height: height,
|
|
1079
|
+
width: width
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1180
1082
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
});
|
|
1185
|
-
}
|
|
1083
|
+
var _Object$values = Object.values(otherSettings),
|
|
1084
|
+
_Object$values2 = _slicedToArray(_Object$values, 1),
|
|
1085
|
+
codecSpecs = _Object$values2[0];
|
|
1186
1086
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1087
|
+
if (codecSpecs) {
|
|
1088
|
+
output.fieldOrder = codecSpecs.InterlaceMode;
|
|
1089
|
+
if (output.fieldOrder && output.fieldOrder.includes('TOP')) output.fieldOrder = 'interlaced';
|
|
1090
|
+
output.videoBitrate = codecSpecs.Bitrate;
|
|
1091
|
+
var numerator = codecSpecs.FramerateDenominator; // other way round to vs ¯\_(ツ)_/¯
|
|
1192
1092
|
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1093
|
+
var denominator = codecSpecs.FramerateNumerator;
|
|
1094
|
+
var timeBase = formatTimeBaseType({
|
|
1095
|
+
denominator: denominator,
|
|
1096
|
+
numerator: numerator
|
|
1097
|
+
});
|
|
1098
|
+
output.timeBase = timeBase;
|
|
1099
|
+
output.frameRate = timeBase.toRate(true);
|
|
1100
|
+
}
|
|
1197
1101
|
}
|
|
1198
1102
|
|
|
1199
|
-
if (
|
|
1200
|
-
|
|
1201
|
-
|
|
1103
|
+
if (AudioDescriptions && AudioDescriptions.length > 0) {
|
|
1104
|
+
var _AudioDescriptions$0$ = AudioDescriptions[0].CodecSettings,
|
|
1105
|
+
_CodecSettings = _AudioDescriptions$0$ === void 0 ? {} : _AudioDescriptions$0$;
|
|
1202
1106
|
|
|
1203
|
-
|
|
1107
|
+
var _Codec = _CodecSettings.Codec,
|
|
1108
|
+
_otherSettings = _objectWithoutProperties(_CodecSettings, _excluded2$2);
|
|
1204
1109
|
|
|
1205
|
-
|
|
1206
|
-
throw new Error("timeBaseText must be a number or ".concat(Object.keys(CONSTANT_TIMEBASES).join(','), " - is ").concat(timeBaseText));
|
|
1207
|
-
}
|
|
1110
|
+
output.audioFormat = _Codec;
|
|
1208
1111
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
};
|
|
1213
|
-
|
|
1214
|
-
var formatTimeBase = function formatTimeBase(timeBase) {
|
|
1215
|
-
if (_typeof(timeBase) === 'object') {
|
|
1216
|
-
return formatTimeBaseType(timeBase);
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
return formatTimeBaseText(timeBase);
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
|
-
var formatTimeCodeType = function formatTimeCodeType(timeCode, options) {
|
|
1223
|
-
return new TimeCode(timeCode, options);
|
|
1224
|
-
};
|
|
1225
|
-
|
|
1226
|
-
var formatTimeCodeText = function formatTimeCodeText(timeCodeText, options) {
|
|
1227
|
-
if (timeCodeText === undefined) {
|
|
1228
|
-
var _timeCode = {
|
|
1229
|
-
samples: 0
|
|
1230
|
-
};
|
|
1231
|
-
return formatTimeCodeType(_timeCode, options);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if (typeof timeCodeText === 'number') {
|
|
1235
|
-
var _timeCode2 = {
|
|
1236
|
-
samples: timeCodeText
|
|
1237
|
-
};
|
|
1238
|
-
return formatTimeCodeType(_timeCode2, options);
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
if (timeCodeText.includes('@')) {
|
|
1242
|
-
var _timeCodeText$split = timeCodeText.split('@'),
|
|
1243
|
-
_timeCodeText$split2 = _slicedToArray(_timeCodeText$split, 2),
|
|
1244
|
-
samplesString = _timeCodeText$split2[0],
|
|
1245
|
-
timeBaseText = _timeCodeText$split2[1];
|
|
1246
|
-
|
|
1247
|
-
var _samples = Number(samplesString);
|
|
1248
|
-
|
|
1249
|
-
var timeBase = formatTimeBaseText(timeBaseText);
|
|
1250
|
-
var _timeCode3 = {
|
|
1251
|
-
samples: _samples,
|
|
1252
|
-
timeBase: timeBase
|
|
1253
|
-
};
|
|
1254
|
-
return formatTimeCodeType(_timeCode3, options);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
if (timeCodeText === '-INF') {
|
|
1258
|
-
var _samples2 = -Infinity;
|
|
1259
|
-
|
|
1260
|
-
var _timeCode4 = {
|
|
1261
|
-
samples: _samples2
|
|
1262
|
-
};
|
|
1263
|
-
return formatTimeCodeType(_timeCode4, options);
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
if (timeCodeText === '+INF') {
|
|
1267
|
-
var _samples3 = Infinity;
|
|
1268
|
-
var _timeCode5 = {
|
|
1269
|
-
samples: _samples3
|
|
1270
|
-
};
|
|
1271
|
-
return formatTimeCodeType(_timeCode5, options);
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
var samples = Number(timeCodeText);
|
|
1275
|
-
|
|
1276
|
-
if (Number.isNaN(samples)) {
|
|
1277
|
-
throw new Error("timeBaseText must be a number or sample@timeBase - is ".concat(timeCodeText));
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
var timeCode = {
|
|
1281
|
-
samples: samples
|
|
1282
|
-
};
|
|
1283
|
-
return formatTimeCodeType(timeCode, options);
|
|
1284
|
-
};
|
|
1285
|
-
|
|
1286
|
-
var formatSeconds = function formatSeconds(seconds) {
|
|
1287
|
-
var timeBase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1288
|
-
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
1112
|
+
var _Object$values3 = Object.values(_otherSettings),
|
|
1113
|
+
_Object$values4 = _slicedToArray(_Object$values3, 1),
|
|
1114
|
+
_codecSpecs = _Object$values4[0];
|
|
1289
1115
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1116
|
+
if (_codecSpecs) {
|
|
1117
|
+
output.audioSamplerate = _codecSpecs.SampleRate;
|
|
1118
|
+
output.audioBitrate = _codecSpecs.Bitrate;
|
|
1119
|
+
output.audioBitRateMode = _codecSpecs.RateControlMode;
|
|
1120
|
+
}
|
|
1292
1121
|
}
|
|
1293
1122
|
|
|
1294
|
-
|
|
1295
|
-
denominator = _timeBase$denominator === void 0 ? 1 : _timeBase$denominator,
|
|
1296
|
-
_timeBase$numerator = timeBase.numerator,
|
|
1297
|
-
numerator = _timeBase$numerator === void 0 ? 1 : _timeBase$numerator;
|
|
1298
|
-
var samples = seconds * (denominator / numerator);
|
|
1299
|
-
var timeCode = {
|
|
1300
|
-
samples: samples,
|
|
1301
|
-
timeBase: timeBase
|
|
1302
|
-
};
|
|
1303
|
-
return new TimeCode(timeCode, options);
|
|
1123
|
+
return output;
|
|
1304
1124
|
};
|
|
1305
1125
|
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1308
|
-
var
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
var _timeBase$denominator2 = timeBase.denominator,
|
|
1317
|
-
denominator = _timeBase$denominator2 === void 0 ? 1 : _timeBase$denominator2;
|
|
1126
|
+
var parseTranscodePreset = function parseTranscodePreset(transcodePresetType) {
|
|
1127
|
+
var output = {};
|
|
1128
|
+
var description = transcodePresetType.description,
|
|
1129
|
+
format = transcodePresetType.format,
|
|
1130
|
+
audio = transcodePresetType.audio,
|
|
1131
|
+
video = transcodePresetType.video,
|
|
1132
|
+
mediaconvert = transcodePresetType.mediaconvert;
|
|
1133
|
+
if (mediaconvert) return parseMediaConvertPreset(transcodePresetType);
|
|
1134
|
+
output.description = description;
|
|
1135
|
+
output.containerFormat = format;
|
|
1318
1136
|
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
}
|
|
1137
|
+
if (video) {
|
|
1138
|
+
output.videoFormat = video.codec;
|
|
1139
|
+
output.videoBitrate = video.bitrate;
|
|
1323
1140
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
denominator: denominator,
|
|
1329
|
-
numerator: numerator
|
|
1141
|
+
if (video.framerate) {
|
|
1142
|
+
var timeBase = formatTimeBaseType(video.framerate);
|
|
1143
|
+
output.timeBase = timeBase;
|
|
1144
|
+
output.frameRate = timeBase.toRate(true);
|
|
1330
1145
|
}
|
|
1331
|
-
};
|
|
1332
|
-
return new TimeCode(timeCode, options);
|
|
1333
|
-
};
|
|
1334
|
-
|
|
1335
|
-
var formatSmpte = function formatSmpte(smpteText, timeBaseText) {
|
|
1336
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1337
|
-
|
|
1338
|
-
if (smpteText === undefined) {
|
|
1339
|
-
var _timeBase = formatTimeBase(timeBaseText);
|
|
1340
|
-
|
|
1341
|
-
var _timeCode6 = {
|
|
1342
|
-
samples: 0,
|
|
1343
|
-
timeBase: _timeBase
|
|
1344
|
-
};
|
|
1345
|
-
return formatTimeCodeType(_timeCode6);
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
if (typeof smpteText !== 'string') {
|
|
1349
|
-
throw new Error("smpteText must be a string, is ".concat(smpteText));
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
var _splitSmpte = splitSmpte(smpteText),
|
|
1353
|
-
_splitSmpte2 = _slicedToArray(_splitSmpte, 2),
|
|
1354
|
-
_splitSmpte2$ = _slicedToArray(_splitSmpte2[0], 4),
|
|
1355
|
-
hh = _splitSmpte2$[0],
|
|
1356
|
-
mm = _splitSmpte2$[1],
|
|
1357
|
-
ss = _splitSmpte2$[2],
|
|
1358
|
-
_splitSmpte2$$ = _splitSmpte2$[3],
|
|
1359
|
-
ff = _splitSmpte2$$ === void 0 ? 0 : _splitSmpte2$$,
|
|
1360
|
-
frameOptions = _splitSmpte2[1];
|
|
1361
1146
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1147
|
+
if (video.scaling) {
|
|
1148
|
+
var _video$scaling = video.scaling,
|
|
1149
|
+
height = _video$scaling.height,
|
|
1150
|
+
width = _video$scaling.width;
|
|
1151
|
+
output.height = height;
|
|
1152
|
+
output.width = width;
|
|
1366
1153
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1154
|
+
if (height && width) {
|
|
1155
|
+
output.dimension = "".concat(width, "x").concat(height);
|
|
1156
|
+
output.aspectRatio = parseAspectRatio({
|
|
1157
|
+
height: height,
|
|
1158
|
+
width: width
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1369
1162
|
}
|
|
1370
1163
|
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
samples: samples,
|
|
1377
|
-
timeBase: timeBase
|
|
1378
|
-
};
|
|
1379
|
-
return formatTimeCodeType(timeCode, _objectSpread2(_objectSpread2({}, frameOptions), options));
|
|
1380
|
-
};
|
|
1381
|
-
|
|
1382
|
-
var parseKeyValuePairType = function parseKeyValuePairType() {
|
|
1383
|
-
var keyValuePairType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1384
|
-
|
|
1385
|
-
var keyValuePairTypeReducer = function keyValuePairTypeReducer(a, _ref) {
|
|
1386
|
-
var key = _ref.key,
|
|
1387
|
-
value = _ref.value;
|
|
1388
|
-
return _objectSpread2(_objectSpread2({}, a), {}, _defineProperty({}, key, value));
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
|
-
return keyValuePairType.reduce(keyValuePairTypeReducer, {});
|
|
1392
|
-
};
|
|
1393
|
-
|
|
1394
|
-
var _excluded$1 = ["property"];
|
|
1395
|
-
var sampleRateSymbols = {
|
|
1396
|
-
kB: 'kHz',
|
|
1397
|
-
B: 'Hz',
|
|
1398
|
-
mB: 'mHz'
|
|
1399
|
-
};
|
|
1400
|
-
var bitRateSymbols = {
|
|
1401
|
-
kB: 'kbps',
|
|
1402
|
-
B: 'bps',
|
|
1403
|
-
MB: 'mbps'
|
|
1404
|
-
};
|
|
1405
|
-
|
|
1406
|
-
var gcd = function gcd(a, b) {
|
|
1407
|
-
return b ? gcd(b, a % b) : a;
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
var parseAspectRatio = function parseAspectRatio(_ref) {
|
|
1411
|
-
var width = _ref.width,
|
|
1412
|
-
height = _ref.height;
|
|
1413
|
-
var denominator = gcd(width, height);
|
|
1414
|
-
var widthRatio = width / denominator;
|
|
1415
|
-
var heightRatio = height / denominator;
|
|
1416
|
-
|
|
1417
|
-
if (widthRatio > 21) {
|
|
1418
|
-
heightRatio = 1;
|
|
1419
|
-
widthRatio = (width / height).toFixed(2);
|
|
1164
|
+
if (audio) {
|
|
1165
|
+
var audioFormat = audio.codec,
|
|
1166
|
+
channel = audio.channel;
|
|
1167
|
+
output.audioFormat = audioFormat;
|
|
1168
|
+
if (channel) output.audioChannels = channel.length;
|
|
1420
1169
|
}
|
|
1421
1170
|
|
|
1422
|
-
return
|
|
1171
|
+
return output;
|
|
1423
1172
|
};
|
|
1424
1173
|
|
|
1425
|
-
var
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
var
|
|
1432
|
-
|
|
1174
|
+
var PDF = 'PDF';
|
|
1175
|
+
var TEXT = 'TEXT';
|
|
1176
|
+
var MSWORD = 'MSWORD';
|
|
1177
|
+
var JSON$1 = 'JSON';
|
|
1178
|
+
var XML = 'XML';
|
|
1179
|
+
var getDocumentType = function getDocumentType() {
|
|
1180
|
+
var shape = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1181
|
+
var mimeType = shape.mimeType;
|
|
1182
|
+
if (!mimeType) return undefined;
|
|
1183
|
+
if (mimeType.endsWith('/pdf')) return PDF;
|
|
1184
|
+
if (mimeType.startsWith('text/')) return TEXT;
|
|
1185
|
+
if (mimeType.endsWith('/msword')) return MSWORD;
|
|
1186
|
+
if (mimeType.endsWith('/json')) return JSON$1;
|
|
1187
|
+
if (mimeType.endsWith('/xml')) return XML;
|
|
1188
|
+
return undefined;
|
|
1433
1189
|
};
|
|
1434
1190
|
|
|
1435
|
-
var
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1191
|
+
var ACCESSCONTROL_READ = '_accesscontrol_read';
|
|
1192
|
+
var ACCESSCONTROL_WRITE = '_accesscontrol_write';
|
|
1193
|
+
var ADMINISTRATOR = '_administrator';
|
|
1194
|
+
var AUTO_PROJECTION_READ = '_auto_projection_read';
|
|
1195
|
+
var AUTO_PROJECTION_WRITE = '_auto_projection_write';
|
|
1196
|
+
var COLLECTION_NOTIFICATION_READ = '_collection_notification_read';
|
|
1197
|
+
var COLLECTION_NOTIFICATION_WRITE = '_collection_notification_write';
|
|
1198
|
+
var COLLECTION_READ = '_collection_read';
|
|
1199
|
+
var COLLECTION_WRITE = '_collection_write';
|
|
1200
|
+
var DELETION_LOCK_NOTIFICATION_READ = '_deletion_lock_notification_read';
|
|
1201
|
+
var DELETION_LOCK_NOTIFICATION_WRITE = '_deletion_lock_notification_write';
|
|
1202
|
+
var DELETION_LOCK_READ = '_deletion_lock_read';
|
|
1203
|
+
var DELETION_LOCK_WRITE = '_deletion_lock_write';
|
|
1204
|
+
var DOCUMENT_NOTIFICATION_READ = '_document_notification_read';
|
|
1205
|
+
var DOCUMENT_NOTIFICATION_WRITE = '_document_notification_write';
|
|
1206
|
+
var DOCUMENT_READ = '_document_read';
|
|
1207
|
+
var DOCUMENT_WRITE = '_document_write';
|
|
1208
|
+
var ERROR_READ = '_error_read';
|
|
1209
|
+
var ERROR_WRITE = '_error_write';
|
|
1210
|
+
var EXPORT = '_export';
|
|
1211
|
+
var EXPORT_TEMPLATE_READ = '_export_template_read';
|
|
1212
|
+
var EXPORT_TEMPLATE_WRITE = '_export_template_write';
|
|
1213
|
+
var EXTERNAL_ID_READ = '_external_id_read';
|
|
1214
|
+
var EXTERNAL_ID_WRITE = '_external_id_write';
|
|
1215
|
+
var FILE_NOTIFICATION_READ = '_file_notification_read';
|
|
1216
|
+
var FILE_NOTIFICATION_WRITE = '_file_notification_write';
|
|
1217
|
+
var FILE_READ = '_file_read';
|
|
1218
|
+
var FILE_WRITE = '_file_write';
|
|
1219
|
+
var GROUP_READ = '_group_read';
|
|
1220
|
+
var GROUP_WRITE = '_group_write';
|
|
1221
|
+
var IMPORT_WRITE = '_import';
|
|
1222
|
+
var ITEM_ID_READ = '_item_id_read';
|
|
1223
|
+
var ITEM_ID_WRITE = '_item_id_write';
|
|
1224
|
+
var ITEM_NOTIFICATION_READ = '_item_notification_read';
|
|
1225
|
+
var ITEM_NOTIFICATION_WRITE = '_item_notification_write';
|
|
1226
|
+
var ITEM_WRITE = '_item_write';
|
|
1227
|
+
var ITEM_SEARCH = '_item_search';
|
|
1228
|
+
var ITEM_SHAPE_READ = '_item_shape_read';
|
|
1229
|
+
var ITEM_SHAPE_WRITE = '_item_shape_write';
|
|
1230
|
+
var ITEM_TIMELINE_READ = '_item_timeline_read';
|
|
1231
|
+
var ITEM_TIMELINE_WRITE = '_item_timeline_write';
|
|
1232
|
+
var ITEM_URI = '_item_uri';
|
|
1233
|
+
var JOB_NOTIFICATION_READ = '_job_notification_read';
|
|
1234
|
+
var JOB_NOTIFICATION_WRITE = '_job_notification_write';
|
|
1235
|
+
var JOB_READ = '_job_read';
|
|
1236
|
+
var JOB_WRITE = '_job_write';
|
|
1237
|
+
var LIBRARY_READ = '_library_read';
|
|
1238
|
+
var LIBRARY_WRITE = '_library_write';
|
|
1239
|
+
var LOCK_READ = '_lock_read';
|
|
1240
|
+
var LOCK_WRITE = '_lock_write';
|
|
1241
|
+
var LOG_READ = '_log_read';
|
|
1242
|
+
var METADATA_DATASET_READ = '_metadata_dataset_read';
|
|
1243
|
+
var METADATA_DATASET_WRITE = '_metadata_dataset_write';
|
|
1244
|
+
var METADATA_FIELD_GROUP_READ = '_metadata_field_group_read';
|
|
1245
|
+
var METADATA_FIELD_GROUP_WRITE = '_metadata_field_group_write';
|
|
1246
|
+
var METADATA_FIELD_READ = '_metadata_field_read';
|
|
1247
|
+
var METADATA_FIELD_WRITE = '_metadata_field_write';
|
|
1248
|
+
var METADATA_GLOBAL_READ = '_metadata_global_read';
|
|
1249
|
+
var METADATA_GLOBAL_WRITE = '_metadata_global_write';
|
|
1250
|
+
var METADATA_LOCK_READ = '_metadata_lock_read';
|
|
1251
|
+
var METADATA_LOCK_WRITE = '_metadata_lock_write';
|
|
1252
|
+
var METADATA_READ = '_metadata_read';
|
|
1253
|
+
var METADATA_SCHEMA_READ = '_metadata_schema_read';
|
|
1254
|
+
var METADATA_SCHEMA_WRITE = '_metadata_schema_write';
|
|
1255
|
+
var METADATA_WRITE = '_metadata_write';
|
|
1256
|
+
var OTIF_ANALYZE = '_otif_analyze';
|
|
1257
|
+
var OTIF_READ = '_otif_read';
|
|
1258
|
+
var OTIF_WRITE = '_otif_write';
|
|
1259
|
+
var PLACEHOLDER_NOTIFICATION_READ = '_placeholder_notification_read';
|
|
1260
|
+
var PLACEHOLDER_NOTIFICATION_WRITE = '_placeholder_notification_write';
|
|
1261
|
+
var PROJECTION_READ = '_projection_read';
|
|
1262
|
+
var PROJECTION_WRITE = '_projection_write';
|
|
1263
|
+
var QUOTA_NOTIFICATION_READ = '_quota_notification_read';
|
|
1264
|
+
var QUOTA_NOTIFICATION_WRITE = '_quota_notification_write';
|
|
1265
|
+
var QUOTA_READ = '_quota_read';
|
|
1266
|
+
var QUOTA_WRITE = '_quota_write';
|
|
1267
|
+
var RELATION_READ = '_relation_read';
|
|
1268
|
+
var RELATION_WRITE = '_relation_write';
|
|
1269
|
+
var RESOURCE_READ = '_resource_read';
|
|
1270
|
+
var RESOURCE_WRITE = '_resource_write';
|
|
1271
|
+
var RUN_AS = '_run_as';
|
|
1272
|
+
var SEARCH = '_search';
|
|
1273
|
+
var SEQUENCE_READ = '_sequence_read';
|
|
1274
|
+
var SEQUENCE_WRITE = '_sequence_write';
|
|
1275
|
+
var SHAPE_TAG_READ = '_shape_tag_read';
|
|
1276
|
+
var SHAPE_TAG_WRITE = '_shape_tag_write';
|
|
1277
|
+
var SITE_MANAGER = '_site_manager';
|
|
1278
|
+
var SITE_RULE_READ = '_site_rule_read';
|
|
1279
|
+
var SITE_RULE_WRITE = '_site_rule_write';
|
|
1280
|
+
var STORAGE_GROUP_READ = '_storage_group_read';
|
|
1281
|
+
var STORAGE_GROUP_WRITE = '_storage_group_write';
|
|
1282
|
+
var STORAGE_NOTIFICATION_READ = '_storage_notification_read';
|
|
1283
|
+
var STORAGE_NOTIFICATION_WRITE = '_storage_notification_write';
|
|
1284
|
+
var STORAGE_READ = '_storage_read';
|
|
1285
|
+
var STORAGE_RULE_READ = '_storage_rule_read';
|
|
1286
|
+
var STORAGE_RULE_WRITE = '_storage_rule_write';
|
|
1287
|
+
var STORAGE_WRITE = '_storage_write';
|
|
1288
|
+
var SUPER_ACCESS_USER = '_super_access_user';
|
|
1289
|
+
var TASKDEFINITION_READ = '_taskdefinition_read';
|
|
1290
|
+
var TASKDEFINITION_WRITE = '_taskdefinition_write';
|
|
1291
|
+
var THUMBNAIL_READ = '_thumbnail_read';
|
|
1292
|
+
var THUMBNAIL_WRITE = '_thumbnail_write';
|
|
1293
|
+
var TRANSCODER = '_transcoder';
|
|
1294
|
+
var TRANSFER_READ = '_transfer_read';
|
|
1295
|
+
var TRANSFER_WRITE = '_transfer_write';
|
|
1296
|
+
var USER = '_user';
|
|
1297
|
+
var VXA = '_vxa';
|
|
1298
|
+
var VXA_READ = '_vxa_read';
|
|
1458
1299
|
|
|
1459
|
-
var
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1300
|
+
var roles = /*#__PURE__*/Object.freeze({
|
|
1301
|
+
__proto__: null,
|
|
1302
|
+
ACCESSCONTROL_READ: ACCESSCONTROL_READ,
|
|
1303
|
+
ACCESSCONTROL_WRITE: ACCESSCONTROL_WRITE,
|
|
1304
|
+
ADMINISTRATOR: ADMINISTRATOR,
|
|
1305
|
+
AUTO_PROJECTION_READ: AUTO_PROJECTION_READ,
|
|
1306
|
+
AUTO_PROJECTION_WRITE: AUTO_PROJECTION_WRITE,
|
|
1307
|
+
COLLECTION_NOTIFICATION_READ: COLLECTION_NOTIFICATION_READ,
|
|
1308
|
+
COLLECTION_NOTIFICATION_WRITE: COLLECTION_NOTIFICATION_WRITE,
|
|
1309
|
+
COLLECTION_READ: COLLECTION_READ,
|
|
1310
|
+
COLLECTION_WRITE: COLLECTION_WRITE,
|
|
1311
|
+
DELETION_LOCK_NOTIFICATION_READ: DELETION_LOCK_NOTIFICATION_READ,
|
|
1312
|
+
DELETION_LOCK_NOTIFICATION_WRITE: DELETION_LOCK_NOTIFICATION_WRITE,
|
|
1313
|
+
DELETION_LOCK_READ: DELETION_LOCK_READ,
|
|
1314
|
+
DELETION_LOCK_WRITE: DELETION_LOCK_WRITE,
|
|
1315
|
+
DOCUMENT_NOTIFICATION_READ: DOCUMENT_NOTIFICATION_READ,
|
|
1316
|
+
DOCUMENT_NOTIFICATION_WRITE: DOCUMENT_NOTIFICATION_WRITE,
|
|
1317
|
+
DOCUMENT_READ: DOCUMENT_READ,
|
|
1318
|
+
DOCUMENT_WRITE: DOCUMENT_WRITE,
|
|
1319
|
+
ERROR_READ: ERROR_READ,
|
|
1320
|
+
ERROR_WRITE: ERROR_WRITE,
|
|
1321
|
+
EXPORT: EXPORT,
|
|
1322
|
+
EXPORT_TEMPLATE_READ: EXPORT_TEMPLATE_READ,
|
|
1323
|
+
EXPORT_TEMPLATE_WRITE: EXPORT_TEMPLATE_WRITE,
|
|
1324
|
+
EXTERNAL_ID_READ: EXTERNAL_ID_READ,
|
|
1325
|
+
EXTERNAL_ID_WRITE: EXTERNAL_ID_WRITE,
|
|
1326
|
+
FILE_NOTIFICATION_READ: FILE_NOTIFICATION_READ,
|
|
1327
|
+
FILE_NOTIFICATION_WRITE: FILE_NOTIFICATION_WRITE,
|
|
1328
|
+
FILE_READ: FILE_READ,
|
|
1329
|
+
FILE_WRITE: FILE_WRITE,
|
|
1330
|
+
GROUP_READ: GROUP_READ,
|
|
1331
|
+
GROUP_WRITE: GROUP_WRITE,
|
|
1332
|
+
IMPORT_WRITE: IMPORT_WRITE,
|
|
1333
|
+
ITEM_ID_READ: ITEM_ID_READ,
|
|
1334
|
+
ITEM_ID_WRITE: ITEM_ID_WRITE,
|
|
1335
|
+
ITEM_NOTIFICATION_READ: ITEM_NOTIFICATION_READ,
|
|
1336
|
+
ITEM_NOTIFICATION_WRITE: ITEM_NOTIFICATION_WRITE,
|
|
1337
|
+
ITEM_WRITE: ITEM_WRITE,
|
|
1338
|
+
ITEM_SEARCH: ITEM_SEARCH,
|
|
1339
|
+
ITEM_SHAPE_READ: ITEM_SHAPE_READ,
|
|
1340
|
+
ITEM_SHAPE_WRITE: ITEM_SHAPE_WRITE,
|
|
1341
|
+
ITEM_TIMELINE_READ: ITEM_TIMELINE_READ,
|
|
1342
|
+
ITEM_TIMELINE_WRITE: ITEM_TIMELINE_WRITE,
|
|
1343
|
+
ITEM_URI: ITEM_URI,
|
|
1344
|
+
JOB_NOTIFICATION_READ: JOB_NOTIFICATION_READ,
|
|
1345
|
+
JOB_NOTIFICATION_WRITE: JOB_NOTIFICATION_WRITE,
|
|
1346
|
+
JOB_READ: JOB_READ,
|
|
1347
|
+
JOB_WRITE: JOB_WRITE,
|
|
1348
|
+
LIBRARY_READ: LIBRARY_READ,
|
|
1349
|
+
LIBRARY_WRITE: LIBRARY_WRITE,
|
|
1350
|
+
LOCK_READ: LOCK_READ,
|
|
1351
|
+
LOCK_WRITE: LOCK_WRITE,
|
|
1352
|
+
LOG_READ: LOG_READ,
|
|
1353
|
+
METADATA_DATASET_READ: METADATA_DATASET_READ,
|
|
1354
|
+
METADATA_DATASET_WRITE: METADATA_DATASET_WRITE,
|
|
1355
|
+
METADATA_FIELD_GROUP_READ: METADATA_FIELD_GROUP_READ,
|
|
1356
|
+
METADATA_FIELD_GROUP_WRITE: METADATA_FIELD_GROUP_WRITE,
|
|
1357
|
+
METADATA_FIELD_READ: METADATA_FIELD_READ,
|
|
1358
|
+
METADATA_FIELD_WRITE: METADATA_FIELD_WRITE,
|
|
1359
|
+
METADATA_GLOBAL_READ: METADATA_GLOBAL_READ,
|
|
1360
|
+
METADATA_GLOBAL_WRITE: METADATA_GLOBAL_WRITE,
|
|
1361
|
+
METADATA_LOCK_READ: METADATA_LOCK_READ,
|
|
1362
|
+
METADATA_LOCK_WRITE: METADATA_LOCK_WRITE,
|
|
1363
|
+
METADATA_READ: METADATA_READ,
|
|
1364
|
+
METADATA_SCHEMA_READ: METADATA_SCHEMA_READ,
|
|
1365
|
+
METADATA_SCHEMA_WRITE: METADATA_SCHEMA_WRITE,
|
|
1366
|
+
METADATA_WRITE: METADATA_WRITE,
|
|
1367
|
+
OTIF_ANALYZE: OTIF_ANALYZE,
|
|
1368
|
+
OTIF_READ: OTIF_READ,
|
|
1369
|
+
OTIF_WRITE: OTIF_WRITE,
|
|
1370
|
+
PLACEHOLDER_NOTIFICATION_READ: PLACEHOLDER_NOTIFICATION_READ,
|
|
1371
|
+
PLACEHOLDER_NOTIFICATION_WRITE: PLACEHOLDER_NOTIFICATION_WRITE,
|
|
1372
|
+
PROJECTION_READ: PROJECTION_READ,
|
|
1373
|
+
PROJECTION_WRITE: PROJECTION_WRITE,
|
|
1374
|
+
QUOTA_NOTIFICATION_READ: QUOTA_NOTIFICATION_READ,
|
|
1375
|
+
QUOTA_NOTIFICATION_WRITE: QUOTA_NOTIFICATION_WRITE,
|
|
1376
|
+
QUOTA_READ: QUOTA_READ,
|
|
1377
|
+
QUOTA_WRITE: QUOTA_WRITE,
|
|
1378
|
+
RELATION_READ: RELATION_READ,
|
|
1379
|
+
RELATION_WRITE: RELATION_WRITE,
|
|
1380
|
+
RESOURCE_READ: RESOURCE_READ,
|
|
1381
|
+
RESOURCE_WRITE: RESOURCE_WRITE,
|
|
1382
|
+
RUN_AS: RUN_AS,
|
|
1383
|
+
SEARCH: SEARCH,
|
|
1384
|
+
SEQUENCE_READ: SEQUENCE_READ,
|
|
1385
|
+
SEQUENCE_WRITE: SEQUENCE_WRITE,
|
|
1386
|
+
SHAPE_TAG_READ: SHAPE_TAG_READ,
|
|
1387
|
+
SHAPE_TAG_WRITE: SHAPE_TAG_WRITE,
|
|
1388
|
+
SITE_MANAGER: SITE_MANAGER,
|
|
1389
|
+
SITE_RULE_READ: SITE_RULE_READ,
|
|
1390
|
+
SITE_RULE_WRITE: SITE_RULE_WRITE,
|
|
1391
|
+
STORAGE_GROUP_READ: STORAGE_GROUP_READ,
|
|
1392
|
+
STORAGE_GROUP_WRITE: STORAGE_GROUP_WRITE,
|
|
1393
|
+
STORAGE_NOTIFICATION_READ: STORAGE_NOTIFICATION_READ,
|
|
1394
|
+
STORAGE_NOTIFICATION_WRITE: STORAGE_NOTIFICATION_WRITE,
|
|
1395
|
+
STORAGE_READ: STORAGE_READ,
|
|
1396
|
+
STORAGE_RULE_READ: STORAGE_RULE_READ,
|
|
1397
|
+
STORAGE_RULE_WRITE: STORAGE_RULE_WRITE,
|
|
1398
|
+
STORAGE_WRITE: STORAGE_WRITE,
|
|
1399
|
+
SUPER_ACCESS_USER: SUPER_ACCESS_USER,
|
|
1400
|
+
TASKDEFINITION_READ: TASKDEFINITION_READ,
|
|
1401
|
+
TASKDEFINITION_WRITE: TASKDEFINITION_WRITE,
|
|
1402
|
+
THUMBNAIL_READ: THUMBNAIL_READ,
|
|
1403
|
+
THUMBNAIL_WRITE: THUMBNAIL_WRITE,
|
|
1404
|
+
TRANSCODER: TRANSCODER,
|
|
1405
|
+
TRANSFER_READ: TRANSFER_READ,
|
|
1406
|
+
TRANSFER_WRITE: TRANSFER_WRITE,
|
|
1407
|
+
USER: USER,
|
|
1408
|
+
VXA: VXA,
|
|
1409
|
+
VXA_READ: VXA_READ
|
|
1410
|
+
});
|
|
1475
1411
|
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
containerFormat = format;
|
|
1412
|
+
var _excluded$2 = ["groupName"],
|
|
1413
|
+
_excluded2$1 = ["start", "end"];
|
|
1479
1414
|
|
|
1480
|
-
|
|
1481
|
-
var formatList = format.split(',');
|
|
1415
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1482
1416
|
|
|
1483
|
-
|
|
1417
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1484
1418
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
containerFormat: containerFormat,
|
|
1491
|
-
videoFormat: videoFormat,
|
|
1492
|
-
audioFormat: audioFormat,
|
|
1493
|
-
textFormat: textFormat,
|
|
1494
|
-
containerMetadata: containerMetadata,
|
|
1495
|
-
containerMediaInfo: containerMediaInfo
|
|
1496
|
-
};
|
|
1497
|
-
|
|
1498
|
-
if (containerMetadata.componentOriginalFilename) {
|
|
1499
|
-
parsedContainerComponent.originalFilename = containerMetadata.componentOriginalFilename;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
if (durationTimeCode !== undefined && durationTimeCode.samples !== 0) {
|
|
1503
|
-
parsedContainerComponent.durationTimeCode = formatTimeCodeType(durationTimeCode);
|
|
1504
|
-
parsedContainerComponent.duration = parsedContainerComponent.durationTimeCode.toDuration();
|
|
1505
|
-
}
|
|
1419
|
+
var parseValueList$1 = function parseValueList(value) {
|
|
1420
|
+
if (value === undefined) return [];
|
|
1421
|
+
if (value === null) return [{
|
|
1422
|
+
value: ''
|
|
1423
|
+
}];
|
|
1506
1424
|
|
|
1507
|
-
if (
|
|
1508
|
-
|
|
1509
|
-
|
|
1425
|
+
if (Array.isArray(value)) {
|
|
1426
|
+
return value.map(function (valueOrObject) {
|
|
1427
|
+
if (_typeof(valueOrObject) === 'object') {
|
|
1428
|
+
return _objectSpread$5({
|
|
1429
|
+
value: valueOrObject.value || ''
|
|
1430
|
+
}, valueOrObject);
|
|
1431
|
+
}
|
|
1510
1432
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
timeBase: timeCodeTimeBase
|
|
1433
|
+
return {
|
|
1434
|
+
value: valueOrObject
|
|
1435
|
+
};
|
|
1515
1436
|
});
|
|
1516
1437
|
}
|
|
1517
1438
|
|
|
1518
|
-
if (
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
var parsedFileType = parseFileType(fileType);
|
|
1523
|
-
parsedContainerComponent = _objectSpread2(_objectSpread2({}, parsedContainerComponent), parsedFileType);
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
return parsedContainerComponent;
|
|
1439
|
+
if (value.value) return [value];
|
|
1440
|
+
return [{
|
|
1441
|
+
value: value
|
|
1442
|
+
}];
|
|
1527
1443
|
};
|
|
1528
1444
|
|
|
1529
|
-
var
|
|
1530
|
-
var
|
|
1531
|
-
bitrate = videoComponent.bitrate,
|
|
1532
|
-
fieldOrder = videoComponent.fieldOrder,
|
|
1533
|
-
_videoComponent$resol = videoComponent.resolution,
|
|
1534
|
-
resolution = _videoComponent$resol === void 0 ? {} : _videoComponent$resol,
|
|
1535
|
-
_videoComponent$media = videoComponent.mediaInfo,
|
|
1536
|
-
mediaInfo = _videoComponent$media === void 0 ? {} : _videoComponent$media,
|
|
1537
|
-
_videoComponent$metad = videoComponent.metadata,
|
|
1538
|
-
metadata = _videoComponent$metad === void 0 ? [] : _videoComponent$metad;
|
|
1539
|
-
var videoMediaInfo = parseBaseMediaInfoType(mediaInfo);
|
|
1540
|
-
var videoMetadata = parseKeyValuePairType(metadata);
|
|
1541
|
-
var videoFormat = videoMediaInfo.Format,
|
|
1542
|
-
timeBaseText = videoMediaInfo['Frame rate'],
|
|
1543
|
-
colorSpace = videoMediaInfo['Color space'],
|
|
1544
|
-
colorPrimaries = videoMediaInfo['Color primaries'],
|
|
1545
|
-
chromaSubsampling = videoMediaInfo.Colorimetry;
|
|
1546
|
-
var timeBase;
|
|
1547
|
-
var averageFrameRate = videoComponent.averageFrameRate,
|
|
1548
|
-
realBaseFrameRate = videoComponent.realBaseFrameRate;
|
|
1445
|
+
var parseValue = function parseValue() {
|
|
1446
|
+
var fieldValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1549
1447
|
|
|
1550
|
-
if (
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
} else if (averageFrameRate !== undefined) {
|
|
1558
|
-
timeBase = {
|
|
1559
|
-
numerator: averageFrameRate.denominator,
|
|
1560
|
-
denominator: averageFrameRate.numerator
|
|
1448
|
+
if (fieldValue && (fieldValue.value || fieldValue.name)) {
|
|
1449
|
+
var valueList = fieldValue.value,
|
|
1450
|
+
uuid = fieldValue.uuid;
|
|
1451
|
+
var value = parseValueList$1(valueList);
|
|
1452
|
+
return {
|
|
1453
|
+
value: value,
|
|
1454
|
+
uuid: uuid
|
|
1561
1455
|
};
|
|
1562
1456
|
}
|
|
1563
1457
|
|
|
1564
|
-
|
|
1458
|
+
return {
|
|
1459
|
+
value: parseValueList$1(fieldValue)
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
1565
1462
|
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1463
|
+
var parseField$1 = function parseField() {
|
|
1464
|
+
var field = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1465
|
+
var name = field.name,
|
|
1466
|
+
value = field.value;
|
|
1467
|
+
var parsedValue = parseValue(value);
|
|
1468
|
+
return _objectSpread$5({
|
|
1469
|
+
name: name
|
|
1470
|
+
}, parsedValue);
|
|
1471
|
+
};
|
|
1570
1472
|
|
|
1571
|
-
|
|
1572
|
-
var
|
|
1573
|
-
|
|
1473
|
+
var shouldBeField = function shouldBeField(_ref) {
|
|
1474
|
+
var name = _ref.name,
|
|
1475
|
+
value = _ref.value;
|
|
1476
|
+
return ['string', 'boolean', 'number'].includes(_typeof(value)) || name !== 'group' && Array.isArray(value) || value === null;
|
|
1477
|
+
};
|
|
1574
1478
|
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1479
|
+
var parseGroup$1 = function parseGroup() {
|
|
1480
|
+
var thisGroup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1481
|
+
var groupName = thisGroup.name,
|
|
1482
|
+
_thisGroup$value = thisGroup.value,
|
|
1483
|
+
groupsOrFields = _thisGroup$value === void 0 ? {} : _thisGroup$value; // eslint-disable-next-line no-use-before-define
|
|
1484
|
+
|
|
1485
|
+
var _parseGroupsOrFields = parseGroupsOrFields(groupsOrFields),
|
|
1486
|
+
field = _parseGroupsOrFields.field,
|
|
1487
|
+
group = _parseGroupsOrFields.group;
|
|
1583
1488
|
|
|
1584
|
-
var height = resolution.height,
|
|
1585
|
-
width = resolution.width;
|
|
1586
|
-
var aspectRatio = parseAspectRatio(resolution);
|
|
1587
|
-
var dimension = "".concat(width, "x").concat(height);
|
|
1588
|
-
var videoBitrate = bitrate ? filesize(bitrate, {
|
|
1589
|
-
bits: true
|
|
1590
|
-
}) : undefined;
|
|
1591
1489
|
return {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
height: height,
|
|
1596
|
-
width: width,
|
|
1597
|
-
timeBase: timeBase,
|
|
1598
|
-
timeCode: timeCode,
|
|
1599
|
-
videoCodec: videoCodec,
|
|
1600
|
-
smpte: smpte,
|
|
1601
|
-
videoBitrate: videoBitrate,
|
|
1602
|
-
fieldOrder: fieldOrder,
|
|
1603
|
-
colorSpace: colorSpace,
|
|
1604
|
-
chromaSubsampling: chromaSubsampling,
|
|
1605
|
-
aspectRatio: aspectRatio,
|
|
1606
|
-
colorPrimaries: colorPrimaries,
|
|
1607
|
-
videoMetadata: videoMetadata,
|
|
1608
|
-
videoMediaInfo: videoMediaInfo
|
|
1490
|
+
name: groupName,
|
|
1491
|
+
group: group,
|
|
1492
|
+
field: field
|
|
1609
1493
|
};
|
|
1610
1494
|
};
|
|
1611
1495
|
|
|
1612
|
-
var
|
|
1613
|
-
var
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1496
|
+
var parseGroupsOrFields = function parseGroupsOrFields(groupsOrFields) {
|
|
1497
|
+
var group = [];
|
|
1498
|
+
var field = [];
|
|
1499
|
+
Object.entries(groupsOrFields).forEach(function (_ref2) {
|
|
1500
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
1501
|
+
name = _ref3[0],
|
|
1502
|
+
value = _ref3[1];
|
|
1503
|
+
|
|
1504
|
+
if (shouldBeField({
|
|
1505
|
+
name: name,
|
|
1506
|
+
value: value
|
|
1507
|
+
})) {
|
|
1508
|
+
field.push(parseField$1({
|
|
1509
|
+
name: name,
|
|
1510
|
+
value: value
|
|
1511
|
+
}));
|
|
1512
|
+
} else if (Array.isArray(value)) {
|
|
1513
|
+
value.forEach(function (_ref4) {
|
|
1514
|
+
var groupName = _ref4.groupName,
|
|
1515
|
+
groupValue = _objectWithoutProperties(_ref4, _excluded$2);
|
|
1516
|
+
|
|
1517
|
+
group.push(parseGroup$1({
|
|
1518
|
+
name: groupName,
|
|
1519
|
+
value: groupValue
|
|
1520
|
+
}));
|
|
1521
|
+
});
|
|
1522
|
+
} else {
|
|
1523
|
+
group.push(parseGroup$1({
|
|
1524
|
+
name: name,
|
|
1525
|
+
value: value
|
|
1526
|
+
}));
|
|
1527
|
+
}
|
|
1528
|
+
});
|
|
1638
1529
|
return {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
audioSamplerate: audioSamplerate,
|
|
1642
|
-
audioSamplerateSamples: audioSamplerateSamples,
|
|
1643
|
-
audioBitDepth: audioBitDepth,
|
|
1644
|
-
audioBitrate: audioBitrate,
|
|
1645
|
-
audioBitRateMode: audioBitRateMode,
|
|
1646
|
-
audioChannels: audioChannels,
|
|
1647
|
-
audioMediaInfo: audioMediaInfo,
|
|
1648
|
-
audioMetadata: audioMetadata
|
|
1530
|
+
group: group,
|
|
1531
|
+
field: field
|
|
1649
1532
|
};
|
|
1650
1533
|
};
|
|
1651
1534
|
|
|
1652
|
-
var
|
|
1653
|
-
var
|
|
1654
|
-
_binaryComponent$medi = binaryComponent.mediaInfo,
|
|
1655
|
-
mediaInfo = _binaryComponent$medi === void 0 ? {} : _binaryComponent$medi,
|
|
1656
|
-
_binaryComponent$meta = binaryComponent.metadata,
|
|
1657
|
-
metadata = _binaryComponent$meta === void 0 ? [] : _binaryComponent$meta;
|
|
1658
|
-
var binaryMetadata = parseKeyValuePairType(metadata);
|
|
1659
|
-
var binaryMediaInfo = parseBaseMediaInfoType(mediaInfo);
|
|
1660
|
-
var parsedBinaryComponent = {
|
|
1661
|
-
binaryMetadata: binaryMetadata,
|
|
1662
|
-
binaryMediaInfo: binaryMediaInfo
|
|
1663
|
-
};
|
|
1535
|
+
var parseTimespan$1 = function parseTimespan() {
|
|
1536
|
+
var timespan = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1664
1537
|
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1538
|
+
var _ref5 = timespan || {},
|
|
1539
|
+
_ref5$start = _ref5.start,
|
|
1540
|
+
start = _ref5$start === void 0 ? '-INF' : _ref5$start,
|
|
1541
|
+
_ref5$end = _ref5.end,
|
|
1542
|
+
end = _ref5$end === void 0 ? '+INF' : _ref5$end,
|
|
1543
|
+
groupsOrFields = _objectWithoutProperties(_ref5, _excluded2$1);
|
|
1668
1544
|
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1545
|
+
var _parseGroupsOrFields2 = parseGroupsOrFields(groupsOrFields),
|
|
1546
|
+
group = _parseGroupsOrFields2.group,
|
|
1547
|
+
field = _parseGroupsOrFields2.field;
|
|
1672
1548
|
|
|
1673
|
-
return
|
|
1549
|
+
return {
|
|
1550
|
+
start: start,
|
|
1551
|
+
end: end,
|
|
1552
|
+
field: field,
|
|
1553
|
+
group: group
|
|
1554
|
+
};
|
|
1674
1555
|
};
|
|
1556
|
+
/**
|
|
1557
|
+
* Create a MetadataType object from a metadata object
|
|
1558
|
+
* @param {Object} metadata={} - object with metadata to create MetadataType object of
|
|
1559
|
+
* @returns {Object} MetadataType
|
|
1560
|
+
*/
|
|
1675
1561
|
|
|
1676
|
-
var parseShapeType = function parseShapeType() {
|
|
1677
|
-
var shapeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1678
|
-
var parsedShape = {};
|
|
1679
|
-
var containerComponent = shapeType.containerComponent,
|
|
1680
|
-
videoComponentList = shapeType.videoComponent,
|
|
1681
|
-
audioComponentList = shapeType.audioComponent,
|
|
1682
|
-
binaryComponentList = shapeType.binaryComponent,
|
|
1683
|
-
_shapeType$mimeType = shapeType.mimeType,
|
|
1684
|
-
mimeTypeList = _shapeType$mimeType === void 0 ? [] : _shapeType$mimeType,
|
|
1685
|
-
_shapeType$tag = shapeType.tag,
|
|
1686
|
-
tagList = _shapeType$tag === void 0 ? [] : _shapeType$tag;
|
|
1687
1562
|
|
|
1688
|
-
|
|
1563
|
+
var createMetadataType = function createMetadataType() {
|
|
1564
|
+
var metadata = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1565
|
+
var metadataType = {};
|
|
1689
1566
|
|
|
1690
|
-
|
|
1567
|
+
if (Array.isArray(metadata)) {
|
|
1568
|
+
metadataType.timespan = metadata.map(function (thisTimeSpan) {
|
|
1569
|
+
return parseTimespan$1(thisTimeSpan);
|
|
1570
|
+
});
|
|
1571
|
+
} else {
|
|
1572
|
+
var genericTimespan = parseTimespan$1(metadata);
|
|
1573
|
+
metadataType.timespan = [genericTimespan];
|
|
1574
|
+
}
|
|
1691
1575
|
|
|
1692
|
-
|
|
1576
|
+
return metadataType;
|
|
1577
|
+
};
|
|
1693
1578
|
|
|
1694
|
-
|
|
1579
|
+
var sortTimespanList = function sortTimespanList(timespan1, timespan2) {
|
|
1580
|
+
var firstStart = timespan1.start;
|
|
1581
|
+
var secondStart = timespan2.start;
|
|
1695
1582
|
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
}
|
|
1583
|
+
var _firstStart$split = firstStart.split('@'),
|
|
1584
|
+
_firstStart$split2 = _slicedToArray(_firstStart$split, 1),
|
|
1585
|
+
first = _firstStart$split2[0];
|
|
1700
1586
|
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1587
|
+
var _secondStart$split = secondStart.split('@'),
|
|
1588
|
+
_secondStart$split2 = _slicedToArray(_secondStart$split, 1),
|
|
1589
|
+
second = _secondStart$split2[0];
|
|
1704
1590
|
|
|
1705
|
-
|
|
1706
|
-
|
|
1591
|
+
if (Number(first) < Number(second)) {
|
|
1592
|
+
return -1;
|
|
1707
1593
|
}
|
|
1708
1594
|
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
audioComponent = _audioComponentList[0];
|
|
1712
|
-
|
|
1713
|
-
var parsedAudioComponent = parseAudioComponent(audioComponent);
|
|
1714
|
-
parsedShape = _objectSpread2(_objectSpread2({}, parsedShape), parsedAudioComponent);
|
|
1595
|
+
if (Number(first) > Number(second)) {
|
|
1596
|
+
return 1;
|
|
1715
1597
|
}
|
|
1716
1598
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
binaryComponent = _binaryComponentList[0];
|
|
1599
|
+
return 0;
|
|
1600
|
+
};
|
|
1720
1601
|
|
|
1721
|
-
|
|
1722
|
-
|
|
1602
|
+
var _excluded$1 = ["value"],
|
|
1603
|
+
_excluded2 = ["field", "group"],
|
|
1604
|
+
_excluded3 = ["field", "group"];
|
|
1605
|
+
|
|
1606
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1607
|
+
|
|
1608
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1609
|
+
|
|
1610
|
+
var parseValueList = function parseValueList() {
|
|
1611
|
+
var valueList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1612
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1613
|
+
var _options$arrayOnSingl = options.arrayOnSingle,
|
|
1614
|
+
arrayOnSingle = _options$arrayOnSingl === void 0 ? true : _options$arrayOnSingl,
|
|
1615
|
+
_options$arrayOnSingl2 = options.arrayOnSingleValue,
|
|
1616
|
+
arrayOnSingleValue = _options$arrayOnSingl2 === void 0 ? true : _options$arrayOnSingl2,
|
|
1617
|
+
joinValue = options.joinValue,
|
|
1618
|
+
includeAttributes = options.includeAttributes,
|
|
1619
|
+
includeValueAttributes = options.includeValueAttributes;
|
|
1620
|
+
if (includeAttributes || includeValueAttributes) return valueList;
|
|
1621
|
+
var valueArray = [];
|
|
1622
|
+
valueList.forEach(function (thisValue) {
|
|
1623
|
+
if (thisValue.value) valueArray.push(thisValue.value);
|
|
1624
|
+
});
|
|
1625
|
+
if (joinValue) return valueArray.join(joinValue);
|
|
1626
|
+
|
|
1627
|
+
if (arrayOnSingle === false || arrayOnSingleValue === false && valueArray.length === 1) {
|
|
1628
|
+
return valueArray[0];
|
|
1723
1629
|
}
|
|
1724
1630
|
|
|
1725
|
-
return
|
|
1631
|
+
return valueArray;
|
|
1726
1632
|
};
|
|
1727
1633
|
|
|
1728
|
-
var
|
|
1729
|
-
|
|
1634
|
+
var parseField = function parseField() {
|
|
1635
|
+
var field = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1636
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1637
|
+
var includeAttributes = options.includeAttributes,
|
|
1638
|
+
includeFieldAttributes = options.includeFieldAttributes;
|
|
1730
1639
|
|
|
1731
|
-
var
|
|
1640
|
+
var _field$value = field.value,
|
|
1641
|
+
value = _field$value === void 0 ? [] : _field$value,
|
|
1642
|
+
attributes = _objectWithoutProperties(field, _excluded$1);
|
|
1643
|
+
|
|
1644
|
+
var parsedValueList = parseValueList(value, options);
|
|
1645
|
+
if (includeAttributes || includeFieldAttributes) return _objectSpread$4(_objectSpread$4({}, attributes), {}, {
|
|
1646
|
+
value: parsedValueList
|
|
1647
|
+
});
|
|
1648
|
+
return parsedValueList;
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
var parseFieldList = function parseFieldList() {
|
|
1652
|
+
var fieldList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1653
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1654
|
+
var joinValue = options.joinValue,
|
|
1655
|
+
includeAttributes = options.includeAttributes,
|
|
1656
|
+
includeFieldAttributes = options.includeFieldAttributes,
|
|
1657
|
+
includeValueAttributes = options.includeValueAttributes;
|
|
1732
1658
|
var output = {};
|
|
1733
|
-
var
|
|
1734
|
-
_transcodePresetType$ = transcodePresetType.mediaconvert;
|
|
1735
|
-
_transcodePresetType$ = _transcodePresetType$ === void 0 ? {} : _transcodePresetType$;
|
|
1736
|
-
var _transcodePresetType$2 = _transcodePresetType$.outputSetting,
|
|
1737
|
-
outputSetting = _transcodePresetType$2 === void 0 ? [] : _transcodePresetType$2;
|
|
1738
|
-
output.description = description;
|
|
1739
|
-
if (outputSetting.length === 0) return output;
|
|
1740
|
-
var mc = JSON.parse(outputSetting[0]);
|
|
1741
|
-
var _mc$Settings = mc.Settings;
|
|
1742
|
-
_mc$Settings = _mc$Settings === void 0 ? {} : _mc$Settings;
|
|
1743
|
-
var ContainerSettings = _mc$Settings.ContainerSettings,
|
|
1744
|
-
VideoDescription = _mc$Settings.VideoDescription,
|
|
1745
|
-
AudioDescriptions = _mc$Settings.AudioDescriptions;
|
|
1746
|
-
output.containerFormat = ContainerSettings.Container;
|
|
1659
|
+
var fieldAsList = options.fieldAsList;
|
|
1747
1660
|
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1661
|
+
if (fieldAsList) {
|
|
1662
|
+
return fieldList.map(function (thisField) {
|
|
1663
|
+
return parseField(thisField, options);
|
|
1664
|
+
});
|
|
1750
1665
|
}
|
|
1751
1666
|
|
|
1752
|
-
|
|
1753
|
-
var
|
|
1754
|
-
|
|
1667
|
+
fieldList.forEach(function (thisField) {
|
|
1668
|
+
var key = thisField.name;
|
|
1669
|
+
var parsedField = parseField(thisField, options);
|
|
1755
1670
|
|
|
1756
|
-
|
|
1757
|
-
|
|
1671
|
+
if (output[key]) {
|
|
1672
|
+
if (includeAttributes || includeFieldAttributes) {
|
|
1673
|
+
var currentValue = output[key].value;
|
|
1674
|
+
var parsedValue = parsedField.value;
|
|
1758
1675
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1676
|
+
if (joinValue && !includeAttributes && !includeValueAttributes) {
|
|
1677
|
+
output[key].value = [currentValue, parsedValue].join(joinValue);
|
|
1678
|
+
} else {
|
|
1679
|
+
output[key].value = parsedValue.concat(currentValue);
|
|
1680
|
+
}
|
|
1681
|
+
} else {
|
|
1682
|
+
var _currentValue = output[key];
|
|
1683
|
+
var _parsedValue = parsedField;
|
|
1764
1684
|
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
}
|
|
1685
|
+
if (joinValue) {
|
|
1686
|
+
output[key] = [_currentValue, _parsedValue].join(joinValue);
|
|
1687
|
+
} else {
|
|
1688
|
+
output[key] = _parsedValue.concat(_currentValue);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
} else {
|
|
1692
|
+
output[key] = parsedField;
|
|
1771
1693
|
}
|
|
1694
|
+
});
|
|
1695
|
+
return output;
|
|
1696
|
+
};
|
|
1772
1697
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1698
|
+
var parseGroup = function parseGroup() {
|
|
1699
|
+
var group = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1700
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1701
|
+
var includeAttributes = options.includeAttributes,
|
|
1702
|
+
includeGroupAttributes = options.includeGroupAttributes,
|
|
1703
|
+
flat = options.flat,
|
|
1704
|
+
flatGroup = options.flatGroup,
|
|
1705
|
+
groupAsList = options.groupAsList,
|
|
1706
|
+
fieldAsList = options.fieldAsList;
|
|
1782
1707
|
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
output.timeBase = timeBase;
|
|
1789
|
-
output.frameRate = timeBase.toRate(true);
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1708
|
+
var _group$field = group.field,
|
|
1709
|
+
fieldList = _group$field === void 0 ? [] : _group$field,
|
|
1710
|
+
_group$group = group.group,
|
|
1711
|
+
groupList = _group$group === void 0 ? [] : _group$group,
|
|
1712
|
+
attributes = _objectWithoutProperties(group, _excluded2);
|
|
1792
1713
|
|
|
1793
|
-
|
|
1794
|
-
var _AudioDescriptions$0$ = AudioDescriptions[0].CodecSettings,
|
|
1795
|
-
_CodecSettings = _AudioDescriptions$0$ === void 0 ? {} : _AudioDescriptions$0$;
|
|
1714
|
+
var parsedFieldList = parseFieldList(fieldList, options); // eslint-disable-next-line no-use-before-define
|
|
1796
1715
|
|
|
1797
|
-
|
|
1798
|
-
|
|
1716
|
+
var parsedGroupList = parseGroupList(groupList, options);
|
|
1717
|
+
var output = {};
|
|
1799
1718
|
|
|
1800
|
-
|
|
1719
|
+
if (includeAttributes || includeGroupAttributes) {
|
|
1720
|
+
Object.assign(output, attributes);
|
|
1721
|
+
}
|
|
1801
1722
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1723
|
+
if (flat || flatGroup) {
|
|
1724
|
+
if (groupAsList) {
|
|
1725
|
+
Object.assign(output, {
|
|
1726
|
+
group: parsedGroupList
|
|
1727
|
+
});
|
|
1728
|
+
} else {
|
|
1729
|
+
Object.assign(output, parsedGroupList);
|
|
1730
|
+
}
|
|
1805
1731
|
|
|
1806
|
-
if (
|
|
1807
|
-
output
|
|
1808
|
-
|
|
1809
|
-
|
|
1732
|
+
if (fieldAsList) {
|
|
1733
|
+
Object.assign(output, {
|
|
1734
|
+
field: parsedFieldList
|
|
1735
|
+
});
|
|
1736
|
+
} else {
|
|
1737
|
+
Object.assign(output, parsedFieldList);
|
|
1810
1738
|
}
|
|
1739
|
+
} else {
|
|
1740
|
+
Object.assign(output, {
|
|
1741
|
+
field: parsedFieldList
|
|
1742
|
+
});
|
|
1743
|
+
Object.assign(output, {
|
|
1744
|
+
group: parsedGroupList
|
|
1745
|
+
});
|
|
1811
1746
|
}
|
|
1812
1747
|
|
|
1813
1748
|
return output;
|
|
1814
1749
|
};
|
|
1815
1750
|
|
|
1816
|
-
var
|
|
1817
|
-
var
|
|
1818
|
-
var
|
|
1819
|
-
|
|
1820
|
-
audio = transcodePresetType.audio,
|
|
1821
|
-
video = transcodePresetType.video,
|
|
1822
|
-
mediaconvert = transcodePresetType.mediaconvert;
|
|
1823
|
-
if (mediaconvert) return parseMediaConvertPreset(transcodePresetType);
|
|
1824
|
-
output.description = description;
|
|
1825
|
-
output.containerFormat = format;
|
|
1826
|
-
|
|
1827
|
-
if (video) {
|
|
1828
|
-
output.videoFormat = video.codec;
|
|
1829
|
-
output.videoBitrate = video.bitrate;
|
|
1751
|
+
var parseGroupList = function parseGroupList() {
|
|
1752
|
+
var groupList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1753
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1754
|
+
var groupAsList = options.groupAsList;
|
|
1830
1755
|
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1756
|
+
if (groupAsList) {
|
|
1757
|
+
return groupList.map(function (thisGroup) {
|
|
1758
|
+
return parseGroup(thisGroup, options);
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1836
1761
|
|
|
1837
|
-
if (video.scaling) {
|
|
1838
|
-
var _video$scaling = video.scaling,
|
|
1839
|
-
height = _video$scaling.height,
|
|
1840
|
-
width = _video$scaling.width;
|
|
1841
|
-
output.height = height;
|
|
1842
|
-
output.width = width;
|
|
1843
|
-
|
|
1844
|
-
if (height && width) {
|
|
1845
|
-
output.dimension = "".concat(width, "x").concat(height);
|
|
1846
|
-
output.aspectRatio = parseAspectRatio({
|
|
1847
|
-
height: height,
|
|
1848
|
-
width: width
|
|
1849
|
-
});
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
if (audio) {
|
|
1855
|
-
var audioFormat = audio.codec,
|
|
1856
|
-
channel = audio.channel;
|
|
1857
|
-
output.audioFormat = audioFormat;
|
|
1858
|
-
if (channel) output.audioChannels = channel.length;
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
return output;
|
|
1862
|
-
};
|
|
1863
|
-
|
|
1864
|
-
var parseFacetType = function parseFacetType() {
|
|
1865
|
-
var facetType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1866
1762
|
var output = {};
|
|
1763
|
+
groupList.forEach(function (thisGroup) {
|
|
1764
|
+
var key = thisGroup.name;
|
|
1765
|
+
var parsedGroup = parseGroup(thisGroup, options);
|
|
1867
1766
|
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1767
|
+
if (output[key]) {
|
|
1768
|
+
var _output$key = output[key],
|
|
1769
|
+
currentField = _output$key.field,
|
|
1770
|
+
currentGroup = _output$key.group;
|
|
1771
|
+
var parsedField = parsedGroup.field,
|
|
1772
|
+
parsedGroupList = parsedGroup.group;
|
|
1773
|
+
output[key].field = _objectSpread$4(_objectSpread$4({}, currentField), parsedField);
|
|
1774
|
+
output[key].group = _objectSpread$4(_objectSpread$4({}, currentGroup), parsedGroupList);
|
|
1775
|
+
} else {
|
|
1776
|
+
output[key] = parsedGroup;
|
|
1777
|
+
}
|
|
1879
1778
|
});
|
|
1880
1779
|
return output;
|
|
1881
|
-
};
|
|
1780
|
+
};
|
|
1781
|
+
/**
|
|
1782
|
+
* Parses timespan according to specified options.
|
|
1783
|
+
* The attributes can be targeted for each sub-type.
|
|
1784
|
+
* @param {Object} timespan={} - The timespan response from the API.
|
|
1785
|
+
* @param {Object} options={} - Options which change how the metadataType is parsed.
|
|
1786
|
+
* @param {string} options.joinValue=undefined - String to join the values, eg ','.
|
|
1787
|
+
* @param {boolean} options.includeAttributes=false - Include attributes on all objects.
|
|
1788
|
+
* @param {boolean} options.includeTimespanAttributes=false - Include attributes on timespans.
|
|
1789
|
+
* @param {boolean} options.includeGroupAttributes=false - Include attributes on groups.
|
|
1790
|
+
* @param {boolean} options.includeFieldAttributes=false - Include attributes on fields.
|
|
1791
|
+
* @param {boolean} options.includeValueAttributes=false - Include attributes on values.
|
|
1792
|
+
* @param {boolean} options.flat=false - Flatten to key/value (Note: keys may be overwritten).
|
|
1793
|
+
* @param {boolean} options.flatTimespan=false - Flatten timespan.
|
|
1794
|
+
* @param {boolean} options.flatGroup=false - Flatten group.
|
|
1795
|
+
* @param {boolean} options.groupAsList=false - Return groups as list.
|
|
1796
|
+
* @param {boolean} options.fieldAsList=false - Return fields as list.
|
|
1797
|
+
* @param {boolean} options.arrayOnSingle=true - Return fields as array even if single field.
|
|
1798
|
+
* @param {boolean} options.arrayOnSingleValue=true - Return fields as array even if single field value.
|
|
1799
|
+
* @returns {Object} Metadata object parsed according to options.
|
|
1800
|
+
*/
|
|
1882
1801
|
|
|
1883
|
-
/* Note that VS may calculate +/- unit in another way */
|
|
1884
|
-
var parseNowDate = function parseNowDate() {
|
|
1885
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'NOW';
|
|
1886
1802
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1803
|
+
var parseTimespan = function parseTimespan() {
|
|
1804
|
+
var timespan = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1805
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1806
|
+
var includeAttributes = options.includeAttributes,
|
|
1807
|
+
includeTimespanAttributes = options.includeTimespanAttributes,
|
|
1808
|
+
flat = options.flat,
|
|
1809
|
+
flatTimespan = options.flatTimespan,
|
|
1810
|
+
groupAsList = options.groupAsList,
|
|
1811
|
+
fieldAsList = options.fieldAsList;
|
|
1893
1812
|
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
break;
|
|
1813
|
+
var _timespan$field = timespan.field,
|
|
1814
|
+
fieldList = _timespan$field === void 0 ? [] : _timespan$field,
|
|
1815
|
+
_timespan$group = timespan.group,
|
|
1816
|
+
groupList = _timespan$group === void 0 ? [] : _timespan$group,
|
|
1817
|
+
attributes = _objectWithoutProperties(timespan, _excluded3);
|
|
1900
1818
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
if (sign === '-') nowDiff.setDate(nowDiff.getDate() - number);
|
|
1905
|
-
break;
|
|
1819
|
+
var field = parseFieldList(fieldList, options);
|
|
1820
|
+
var group = parseGroupList(groupList, options);
|
|
1821
|
+
var output = {};
|
|
1906
1822
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
if (sign === '-') nowDiff.setMonth(nowDiff.getMonth() - number);
|
|
1911
|
-
break;
|
|
1823
|
+
if (includeAttributes || includeTimespanAttributes) {
|
|
1824
|
+
Object.assign(output, attributes);
|
|
1825
|
+
}
|
|
1912
1826
|
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1827
|
+
if (flat || flatTimespan) {
|
|
1828
|
+
if (groupAsList) {
|
|
1829
|
+
Object.assign(output, {
|
|
1830
|
+
group: group
|
|
1831
|
+
});
|
|
1832
|
+
} else {
|
|
1833
|
+
Object.assign(output, group);
|
|
1918
1834
|
}
|
|
1919
1835
|
|
|
1920
|
-
|
|
1836
|
+
if (fieldAsList) {
|
|
1837
|
+
Object.assign(output, {
|
|
1838
|
+
field: field
|
|
1839
|
+
});
|
|
1840
|
+
} else {
|
|
1841
|
+
Object.assign(output, field);
|
|
1842
|
+
}
|
|
1843
|
+
} else {
|
|
1844
|
+
Object.assign(output, {
|
|
1845
|
+
field: field
|
|
1846
|
+
});
|
|
1847
|
+
Object.assign(output, {
|
|
1848
|
+
group: group
|
|
1849
|
+
});
|
|
1921
1850
|
}
|
|
1922
1851
|
|
|
1923
|
-
return
|
|
1852
|
+
return output;
|
|
1924
1853
|
};
|
|
1925
1854
|
|
|
1926
|
-
var
|
|
1927
|
-
var fieldList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1928
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1929
|
-
return fieldList.map(function (field) {
|
|
1930
|
-
return {
|
|
1931
|
-
field: field,
|
|
1932
|
-
name: field,
|
|
1933
|
-
count: options.count || true,
|
|
1934
|
-
exclude: fieldList
|
|
1935
|
-
};
|
|
1936
|
-
});
|
|
1937
|
-
}; // eslint-disable-next-line import/prefer-default-export
|
|
1938
|
-
|
|
1939
|
-
var _excluded$3 = ["groupName"],
|
|
1940
|
-
_excluded2$2 = ["start", "end"];
|
|
1855
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1941
1856
|
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1857
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1858
|
+
/**
|
|
1859
|
+
* Parses timespanList according to specified options.
|
|
1860
|
+
* The attributes can be targeted for each sub-type.
|
|
1861
|
+
* @param {Object[]} timespanList - The timespanList response from the API.
|
|
1862
|
+
* @param {Object} options - Options which change how the metadataType is parsed.
|
|
1863
|
+
* @param {string} options.joinValue - String to join the values, eg ','.
|
|
1864
|
+
* @param {boolean} options.includeAttributes - Include attributes on all objects.
|
|
1865
|
+
* @param {boolean} options.includeMetadataAttributes - Include attributes on root.
|
|
1866
|
+
* @param {boolean} options.includeTimespanAttributes - Include attributes on timespans.
|
|
1867
|
+
* @param {boolean} options.includeGroupAttributes - Include attributes on groups.
|
|
1868
|
+
* @param {boolean} options.includeFieldAttributes - Include attributes on fields.
|
|
1869
|
+
* @param {boolean} options.includeValueAttributes - Include attributes on values.
|
|
1870
|
+
* @param {boolean} options.flat - Flatten to key/value (Note: keys may be overwritten).
|
|
1871
|
+
* @param {boolean} options.flatTimespan - Flatten timespan.
|
|
1872
|
+
* @param {boolean} options.flatGroup - Flatten group.
|
|
1873
|
+
* @param {boolean} options.sortTimespan - Sort timespan by start time.
|
|
1874
|
+
* @param {boolean} options.timespanAsList - Return timespans as list.
|
|
1875
|
+
* @param {boolean} options.groupAsList - Return groups as list.
|
|
1876
|
+
* @param {boolean} options.fieldAsList - Return fields as list.
|
|
1877
|
+
* @param {boolean} options.arrayOnSingle=true - Return fields as array even if single field.
|
|
1878
|
+
* @param {boolean} options.arrayOnSingleValue=true - Return fields as array even if single field value.
|
|
1879
|
+
* @returns {Object} Metadata object parsed according to options.
|
|
1880
|
+
*/
|
|
1948
1881
|
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
}
|
|
1882
|
+
var parseTimespanList = function parseTimespanList() {
|
|
1883
|
+
var timespanList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1884
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1885
|
+
var joinTimespan = options.joinTimespan,
|
|
1886
|
+
flat = options.flat;
|
|
1887
|
+
var timespanAsList = options.timespanAsList;
|
|
1956
1888
|
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1889
|
+
if (timespanAsList) {
|
|
1890
|
+
return timespanList.map(function (thisTimespan) {
|
|
1891
|
+
return parseTimespan(thisTimespan, options);
|
|
1960
1892
|
});
|
|
1961
1893
|
}
|
|
1962
1894
|
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
var parseValue = function parseValue() {
|
|
1970
|
-
var fieldValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1971
|
-
|
|
1972
|
-
if (fieldValue && (fieldValue.value || fieldValue.name)) {
|
|
1973
|
-
var valueList = fieldValue.value,
|
|
1974
|
-
uuid = fieldValue.uuid;
|
|
1975
|
-
var value = parseValueList$1(valueList);
|
|
1976
|
-
return {
|
|
1977
|
-
value: value,
|
|
1978
|
-
uuid: uuid
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
return {
|
|
1983
|
-
value: parseValueList$1(fieldValue)
|
|
1984
|
-
};
|
|
1985
|
-
};
|
|
1986
|
-
|
|
1987
|
-
var parseField$1 = function parseField() {
|
|
1988
|
-
var field = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1989
|
-
var name = field.name,
|
|
1990
|
-
value = field.value;
|
|
1991
|
-
var parsedValue = parseValue(value);
|
|
1992
|
-
return _objectSpread2({
|
|
1993
|
-
name: name
|
|
1994
|
-
}, parsedValue);
|
|
1995
|
-
};
|
|
1996
|
-
|
|
1997
|
-
var shouldBeField = function shouldBeField(_ref) {
|
|
1998
|
-
var name = _ref.name,
|
|
1999
|
-
value = _ref.value;
|
|
2000
|
-
return ['string', 'boolean', 'number'].includes(_typeof(value)) || name !== 'group' && Array.isArray(value) || value === null;
|
|
2001
|
-
};
|
|
2002
|
-
|
|
2003
|
-
var parseGroup$1 = function parseGroup() {
|
|
2004
|
-
var thisGroup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2005
|
-
var groupName = thisGroup.name,
|
|
2006
|
-
_thisGroup$value = thisGroup.value,
|
|
2007
|
-
groupsOrFields = _thisGroup$value === void 0 ? {} : _thisGroup$value; // eslint-disable-next-line no-use-before-define
|
|
2008
|
-
|
|
2009
|
-
var _parseGroupsOrFields = parseGroupsOrFields(groupsOrFields),
|
|
2010
|
-
field = _parseGroupsOrFields.field,
|
|
2011
|
-
group = _parseGroupsOrFields.group;
|
|
2012
|
-
|
|
2013
|
-
return {
|
|
2014
|
-
name: groupName,
|
|
2015
|
-
group: group,
|
|
2016
|
-
field: field
|
|
2017
|
-
};
|
|
2018
|
-
};
|
|
2019
|
-
|
|
2020
|
-
var parseGroupsOrFields = function parseGroupsOrFields(groupsOrFields) {
|
|
2021
|
-
var group = [];
|
|
2022
|
-
var field = [];
|
|
2023
|
-
Object.entries(groupsOrFields).forEach(function (_ref2) {
|
|
2024
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2025
|
-
name = _ref3[0],
|
|
2026
|
-
value = _ref3[1];
|
|
2027
|
-
|
|
2028
|
-
if (shouldBeField({
|
|
2029
|
-
name: name,
|
|
2030
|
-
value: value
|
|
2031
|
-
})) {
|
|
2032
|
-
field.push(parseField$1({
|
|
2033
|
-
name: name,
|
|
2034
|
-
value: value
|
|
2035
|
-
}));
|
|
2036
|
-
} else if (Array.isArray(value)) {
|
|
2037
|
-
value.forEach(function (_ref4) {
|
|
2038
|
-
var groupName = _ref4.groupName,
|
|
2039
|
-
groupValue = _objectWithoutProperties(_ref4, _excluded$3);
|
|
1895
|
+
var output = {};
|
|
1896
|
+
timespanList.forEach(function (thisTimespan) {
|
|
1897
|
+
var start = thisTimespan.start,
|
|
1898
|
+
end = thisTimespan.end;
|
|
1899
|
+
var key = [start, end].join(joinTimespan || '_');
|
|
1900
|
+
var parsedTimespan = parseTimespan(thisTimespan, options);
|
|
2040
1901
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2055
|
-
return {
|
|
2056
|
-
group: group,
|
|
2057
|
-
field: field
|
|
2058
|
-
};
|
|
2059
|
-
};
|
|
2060
|
-
|
|
2061
|
-
var parseTimeSpan = function parseTimeSpan(timeSpan) {
|
|
2062
|
-
var _timeSpan$start = timeSpan.start,
|
|
2063
|
-
start = _timeSpan$start === void 0 ? '-INF' : _timeSpan$start,
|
|
2064
|
-
_timeSpan$end = timeSpan.end,
|
|
2065
|
-
end = _timeSpan$end === void 0 ? '+INF' : _timeSpan$end,
|
|
2066
|
-
groupsOrFields = _objectWithoutProperties(timeSpan, _excluded2$2);
|
|
2067
|
-
|
|
2068
|
-
var _parseGroupsOrFields2 = parseGroupsOrFields(groupsOrFields),
|
|
2069
|
-
group = _parseGroupsOrFields2.group,
|
|
2070
|
-
field = _parseGroupsOrFields2.field;
|
|
2071
|
-
|
|
2072
|
-
return {
|
|
2073
|
-
start: start,
|
|
2074
|
-
end: end,
|
|
2075
|
-
field: field,
|
|
2076
|
-
group: group
|
|
2077
|
-
};
|
|
2078
|
-
};
|
|
2079
|
-
|
|
2080
|
-
var createMetadataType = function createMetadataType() {
|
|
2081
|
-
var metadataType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2082
|
-
var newMetadataType = {};
|
|
2083
|
-
|
|
2084
|
-
if (Array.isArray(metadataType)) {
|
|
2085
|
-
newMetadataType.timespan = metadataType.map(function (thisTimeSpan) {
|
|
2086
|
-
return parseTimeSpan(thisTimeSpan);
|
|
2087
|
-
});
|
|
2088
|
-
} else {
|
|
2089
|
-
var genericTimespan = parseTimeSpan(metadataType);
|
|
2090
|
-
newMetadataType.timespan = [genericTimespan];
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
return newMetadataType;
|
|
2094
|
-
};
|
|
2095
|
-
|
|
2096
|
-
function timeToCueTime(_ref) {
|
|
2097
|
-
var _ref$hours = _ref.hours,
|
|
2098
|
-
hours = _ref$hours === void 0 ? 0 : _ref$hours,
|
|
2099
|
-
_ref$minutes = _ref.minutes,
|
|
2100
|
-
minutes = _ref$minutes === void 0 ? 0 : _ref$minutes,
|
|
2101
|
-
_ref$seconds = _ref.seconds,
|
|
2102
|
-
seconds = _ref$seconds === void 0 ? 0 : _ref$seconds,
|
|
2103
|
-
_ref$partialSeconds = _ref.partialSeconds,
|
|
2104
|
-
partialSeconds = _ref$partialSeconds === void 0 ? 0 : _ref$partialSeconds;
|
|
2105
|
-
var hourStr = hours.toFixed().padStart(2, '0');
|
|
2106
|
-
var minStr = minutes.toFixed().padStart(2, '0');
|
|
2107
|
-
var secondsStr = seconds.toFixed().padStart(2, '0');
|
|
2108
|
-
var partialStr = (partialSeconds * 10).toFixed().padStart(3, '0');
|
|
2109
|
-
return "".concat(hourStr, ":").concat(minStr, ":").concat(secondsStr, ".").concat(partialStr);
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
function metadataTypeToWebVtt(_ref2) {
|
|
2113
|
-
var metadataType = _ref2.metadataType,
|
|
2114
|
-
_ref2$subtitleGroup = _ref2.subtitleGroup,
|
|
2115
|
-
subtitleGroup = _ref2$subtitleGroup === void 0 ? 'stl_subtitle' : _ref2$subtitleGroup,
|
|
2116
|
-
_ref2$subtitleField = _ref2.subtitleField,
|
|
2117
|
-
subtitleField = _ref2$subtitleField === void 0 ? 'stl_text' : _ref2$subtitleField;
|
|
2118
|
-
var parseOptions = {
|
|
2119
|
-
includeTimespanAttributes: true,
|
|
2120
|
-
flatTimespan: true,
|
|
2121
|
-
flatGroup: true,
|
|
2122
|
-
joinValue: ','
|
|
2123
|
-
};
|
|
2124
|
-
|
|
2125
|
-
var _ref3 = metadataType || {},
|
|
2126
|
-
_ref3$timespan = _ref3.timespan,
|
|
2127
|
-
timespanList = _ref3$timespan === void 0 ? [] : _ref3$timespan;
|
|
2128
|
-
|
|
2129
|
-
if (timespanList.length === 0) return '';
|
|
2130
|
-
var sortedTimespans = timespanList.sort(sortTimespanList);
|
|
2131
|
-
var parsedTimespans = sortedTimespans.map(function (timespanType) {
|
|
2132
|
-
return parseTimespan(timespanType, parseOptions);
|
|
2133
|
-
});
|
|
2134
|
-
var vttCues = parsedTimespans.map(function (thisTimespan) {
|
|
2135
|
-
var startText = thisTimespan.start,
|
|
2136
|
-
endText = thisTimespan.end,
|
|
2137
|
-
_thisTimespan$subtitl = thisTimespan[subtitleGroup];
|
|
2138
|
-
_thisTimespan$subtitl = _thisTimespan$subtitl === void 0 ? {} : _thisTimespan$subtitl;
|
|
2139
|
-
var text = _thisTimespan$subtitl[subtitleField];
|
|
2140
|
-
if (!text) return '';
|
|
2141
|
-
var startTime = formatTimeCodeText(startText).toTime();
|
|
2142
|
-
var start = timeToCueTime(startTime);
|
|
2143
|
-
var endTime = formatTimeCodeText(endText).toTime();
|
|
2144
|
-
var end = timeToCueTime(endTime);
|
|
2145
|
-
return "".concat(start, " --> ").concat(end, " line:0%\r").concat(text, "\r");
|
|
2146
|
-
});
|
|
2147
|
-
return "WEBVTT\n\n\n".concat(vttCues.join('\n'));
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
var IMAGE_MIME_TYPES = ['image/apng', 'image/bmp', 'image/gif', 'image/jpeg', 'image/x-icon', 'image/png', 'image/svg+xml'];
|
|
2151
|
-
var VIDEO_MIME_TYPES = ['video/mp4'];
|
|
2152
|
-
var AUDIO_MIME_TYPES = ['audio/mp4', 'audio/mpeg', 'audio/x-aac', 'audio/aac', 'audio/x-wav', 'audio/wav', 'audio/accp', 'audio/ogg', 'audio/webm', 'audio/x-flac'];
|
|
2153
|
-
var DEFAULT_ALLOWED_MIME_TYPES = [].concat(VIDEO_MIME_TYPES, IMAGE_MIME_TYPES, AUDIO_MIME_TYPES);
|
|
2154
|
-
var DEFAULT_ALLOWED_METHODS = ['http', 'https'];
|
|
2155
|
-
var MP4_MIMETYPE = 'video/mp4';
|
|
2156
|
-
var QUICKTIME_MIMETYPE = 'video/quicktime';
|
|
2157
|
-
var M4V_MIMETYPE = 'video/x-m4v';
|
|
2158
|
-
var MP4_CONTAINER = 'MPEG-4';
|
|
2159
|
-
var MOV_CONTAINER = 'mov';
|
|
2160
|
-
var H264_CODEC = 'h264'; // Sort by tags in the order of previewShapeOrder, secondary alphabetical.
|
|
2161
|
-
// using reverse() so the first has highest index
|
|
2162
|
-
|
|
2163
|
-
var PREVIEW_SHAPE_ORDER = ['__mp4', '__mp3_160k', '__png', '__jpeg', '__gif', 'original'].reverse();
|
|
2164
|
-
|
|
2165
|
-
var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
|
|
2166
|
-
var firstEl = _ref.shape.tag;
|
|
2167
|
-
var secondEl = _ref2.shape.tag;
|
|
2168
|
-
|
|
2169
|
-
if (PREVIEW_SHAPE_ORDER.includes(firstEl) || PREVIEW_SHAPE_ORDER.includes(secondEl)) {
|
|
2170
|
-
return PREVIEW_SHAPE_ORDER.indexOf(secondEl) - PREVIEW_SHAPE_ORDER.indexOf(firstEl);
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
|
-
return firstEl.toLowerCase().localeCompare(secondEl.toLowerCase());
|
|
2174
|
-
};
|
|
2175
|
-
|
|
2176
|
-
var filterShapeSource = function filterShapeSource() {
|
|
2177
|
-
var itemType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2178
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2179
|
-
var _options$allowedMimeT = options.allowedMimeTypes,
|
|
2180
|
-
allowedMimeTypes = _options$allowedMimeT === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _options$allowedMimeT,
|
|
2181
|
-
_options$sortPriority = options.sortPriority,
|
|
2182
|
-
sortPriority = _options$sortPriority === void 0 ? defaultSortPriority : _options$sortPriority,
|
|
2183
|
-
_options$allowedMetho = options.allowedMethods,
|
|
2184
|
-
allowedMethods = _options$allowedMetho === void 0 ? DEFAULT_ALLOWED_METHODS : _options$allowedMetho,
|
|
2185
|
-
_options$sourceKey = options.sourceKey,
|
|
2186
|
-
sourceKey = _options$sourceKey === void 0 ? 'src' : _options$sourceKey,
|
|
2187
|
-
_options$mimeTypeKey = options.mimeTypeKey,
|
|
2188
|
-
mimeTypeKey = _options$mimeTypeKey === void 0 ? 'type' : _options$mimeTypeKey,
|
|
2189
|
-
_options$shapeKey = options.shapeKey,
|
|
2190
|
-
shapeKey = _options$shapeKey === void 0 ? 'shape' : _options$shapeKey;
|
|
2191
|
-
var _itemType$shape = itemType.shape,
|
|
2192
|
-
shapeList = _itemType$shape === void 0 ? [] : _itemType$shape;
|
|
2193
|
-
var parsedShapeList = shapeList.reduce(function (acc, shapeType) {
|
|
2194
|
-
var type;
|
|
2195
|
-
var src;
|
|
2196
|
-
var shape = parseShapeType(shapeType);
|
|
2197
|
-
var uri = shape.uri,
|
|
2198
|
-
mimeType = shape.mimeType,
|
|
2199
|
-
containerFormat = shape.containerFormat,
|
|
2200
|
-
videoCodec = shape.videoCodec;
|
|
2201
|
-
|
|
2202
|
-
if (mimeType) {
|
|
2203
|
-
type = mimeType;
|
|
2204
|
-
if ((mimeType === QUICKTIME_MIMETYPE || mimeType === M4V_MIMETYPE) && (containerFormat === MP4_CONTAINER || containerFormat === MOV_CONTAINER) && videoCodec === H264_CODEC) type = MP4_MIMETYPE;
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
if (uri) {
|
|
2208
|
-
if (allowedMethods) {
|
|
2209
|
-
var _uri$split = uri.split('://'),
|
|
2210
|
-
_uri$split2 = _slicedToArray(_uri$split, 1),
|
|
2211
|
-
thisMethod = _uri$split2[0];
|
|
2212
|
-
|
|
2213
|
-
if (allowedMethods.includes(thisMethod)) src = uri;
|
|
2214
|
-
} else {
|
|
2215
|
-
src = uri;
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
if (src && allowedMimeTypes.includes(type)) {
|
|
2220
|
-
var _acc$push;
|
|
2221
|
-
|
|
2222
|
-
acc.push((_acc$push = {}, _defineProperty(_acc$push, sourceKey, src), _defineProperty(_acc$push, mimeTypeKey, type), _defineProperty(_acc$push, shapeKey, shape), _acc$push));
|
|
1902
|
+
if (flat) {
|
|
1903
|
+
output = _objectSpread$3(_objectSpread$3({}, output), parsedTimespan);
|
|
1904
|
+
} else if (output[key]) {
|
|
1905
|
+
var _output$key = output[key],
|
|
1906
|
+
currentField = _output$key.field,
|
|
1907
|
+
currentGroup = _output$key.group;
|
|
1908
|
+
var parsedField = parsedTimespan.field,
|
|
1909
|
+
parsedGroup = parsedTimespan.group;
|
|
1910
|
+
output[key].field = _objectSpread$3(_objectSpread$3({}, currentField), parsedField);
|
|
1911
|
+
output[key].group = _objectSpread$3(_objectSpread$3({}, currentGroup), parsedGroup);
|
|
1912
|
+
} else {
|
|
1913
|
+
output[key] = parsedTimespan;
|
|
2223
1914
|
}
|
|
1915
|
+
});
|
|
1916
|
+
return output;
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
var _excluded = ["timespan"];
|
|
1920
|
+
/**
|
|
1921
|
+
* Parses MetadataType according to specified options.
|
|
1922
|
+
* The attributes can be targeted for each sub-type.
|
|
1923
|
+
* @param {Object} metadataType - The MetadataType response from the API.
|
|
1924
|
+
* @param {Object} options - Options which change how the metadataType is parsed.
|
|
1925
|
+
* @param {string} options.joinValue - String to join the values, eg ','.
|
|
1926
|
+
* @param {boolean} options.includeAttributes - Include attributes on all objects.
|
|
1927
|
+
* @param {boolean} options.includeMetadataAttributes - Include attributes on root.
|
|
1928
|
+
* @param {boolean} options.includeTimespanAttributes - Include attributes on timespans.
|
|
1929
|
+
* @param {boolean} options.includeGroupAttributes - Include attributes on groups.
|
|
1930
|
+
* @param {boolean} options.includeFieldAttributes - Include attributes on fields.
|
|
1931
|
+
* @param {boolean} options.includeValueAttributes - Include attributes on values.
|
|
1932
|
+
* @param {boolean} options.flat - Flatten to key/value (Note: keys may be overwritten).
|
|
1933
|
+
* @param {boolean} options.flatTimespan - Flatten timespan.
|
|
1934
|
+
* @param {boolean} options.flatGroup - Flatten group.
|
|
1935
|
+
* @param {boolean} options.sortTimespan - Sort timespan by start time.
|
|
1936
|
+
* @param {boolean} options.timespanAsList - Return timespans as list.
|
|
1937
|
+
* @param {boolean} options.groupAsList - Return groups as list.
|
|
1938
|
+
* @param {boolean} options.fieldAsList - Return fields as list.
|
|
1939
|
+
* @param {boolean} options.arrayOnSingle=true - Return fields as array even if single field.
|
|
1940
|
+
* @param {boolean} options.arrayOnSingleValue=true - Return fields as array even if single field value.
|
|
1941
|
+
* @returns {Object} Metadata object parsed according to options.
|
|
1942
|
+
*/
|
|
1943
|
+
|
|
1944
|
+
var parseMetadataType = function parseMetadataType() {
|
|
1945
|
+
var metadataType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1946
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1947
|
+
var includeAttributes = options.includeAttributes,
|
|
1948
|
+
includeMetadataAttributes = options.includeMetadataAttributes,
|
|
1949
|
+
sortTimespan = options.sortTimespan;
|
|
1950
|
+
|
|
1951
|
+
var _metadataType$timespa = metadataType.timespan,
|
|
1952
|
+
timespanList = _metadataType$timespa === void 0 ? [] : _metadataType$timespa,
|
|
1953
|
+
attributes = _objectWithoutProperties(metadataType, _excluded);
|
|
1954
|
+
|
|
1955
|
+
if (sortTimespan) timespanList.sort(sortTimespanList);
|
|
1956
|
+
var timespan = parseTimespanList(timespanList, options);
|
|
1957
|
+
|
|
1958
|
+
if (includeAttributes || includeMetadataAttributes) {
|
|
1959
|
+
Object.assign(timespan, attributes);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
return timespan;
|
|
1963
|
+
};
|
|
2224
1964
|
|
|
2225
|
-
return acc;
|
|
2226
|
-
}, []);
|
|
2227
|
-
if (typeof sortPriority === 'function') parsedShapeList.sort(defaultSortPriority);
|
|
2228
|
-
return parsedShapeList;
|
|
2229
|
-
};
|
|
2230
|
-
|
|
2231
|
-
var IMAGE = 'IMAGE';
|
|
2232
|
-
var AUDIO = 'AUDIO';
|
|
2233
|
-
var VIDEO = 'VIDEO';
|
|
2234
|
-
var DOCUMENT = 'DOCUMENT';
|
|
2235
|
-
|
|
2236
|
-
var getShapeMediaType = function getShapeMediaType() {
|
|
2237
|
-
var shape = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2238
|
-
var mimeType = shape.mimeType,
|
|
2239
|
-
videoCodec = shape.videoCodec,
|
|
2240
|
-
audioCodec = shape.audioCodec;
|
|
2241
|
-
if (!mimeType) return undefined;
|
|
2242
|
-
|
|
2243
|
-
if (mimeType.startsWith('audio/')) {
|
|
2244
|
-
if (audioCodec !== undefined) return AUDIO;
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
if (mimeType.startsWith('video/')) {
|
|
2248
|
-
if (videoCodec !== undefined) return VIDEO;
|
|
2249
|
-
if (audioCodec !== undefined) return AUDIO;
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
if (mimeType.startsWith('image/')) return IMAGE;
|
|
2253
|
-
if (mimeType.endsWith('/pdf')) return DOCUMENT;
|
|
2254
|
-
if (mimeType.startsWith('text/')) return DOCUMENT;
|
|
2255
|
-
if (mimeType.endsWith('/msword')) return DOCUMENT;
|
|
2256
|
-
if (mimeType.endsWith('/json')) return DOCUMENT;
|
|
2257
|
-
if (mimeType.endsWith('/xml')) return DOCUMENT;
|
|
2258
|
-
return undefined;
|
|
2259
|
-
};
|
|
2260
|
-
|
|
2261
|
-
var findNearestThumbnail = function findNearestThumbnail() {
|
|
2262
|
-
var itemType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2263
|
-
var timeCodeText = arguments.length > 1 ? arguments[1] : undefined;
|
|
2264
|
-
var tcSeconds = formatTimeCodeText(timeCodeText).toSeconds();
|
|
2265
|
-
var _itemType$thumbnails = itemType.thumbnails,
|
|
2266
|
-
thumbnails = _itemType$thumbnails === void 0 ? {} : _itemType$thumbnails;
|
|
2267
|
-
var _thumbnails$uri = thumbnails.uri,
|
|
2268
|
-
srcList = _thumbnails$uri === void 0 ? [] : _thumbnails$uri;
|
|
2269
|
-
var srcTcSeconds = srcList.map(function (url) {
|
|
2270
|
-
var tc = new URL(url).pathname.split('/').pop();
|
|
2271
|
-
return formatTimeCodeText(tc).toSeconds();
|
|
2272
|
-
});
|
|
2273
|
-
var nearestSrcIndex = srcTcSeconds.reduce(function (nearestIndex, curr, currIndex) {
|
|
2274
|
-
return Math.abs(curr - tcSeconds) < Math.abs(srcTcSeconds[nearestIndex] - tcSeconds) ? currIndex : nearestIndex;
|
|
2275
|
-
}, 0);
|
|
2276
|
-
return srcList[nearestSrcIndex];
|
|
2277
|
-
};
|
|
2278
|
-
|
|
2279
|
-
var ACCESSCONTROL_READ = '_accesscontrol_read';
|
|
2280
|
-
var ACCESSCONTROL_WRITE = '_accesscontrol_write';
|
|
2281
|
-
var ADMINISTRATOR = '_administrator';
|
|
2282
|
-
var AUTO_PROJECTION_READ = '_auto_projection_read';
|
|
2283
|
-
var AUTO_PROJECTION_WRITE = '_auto_projection_write';
|
|
2284
|
-
var COLLECTION_NOTIFICATION_READ = '_collection_notification_read';
|
|
2285
|
-
var COLLECTION_NOTIFICATION_WRITE = '_collection_notification_write';
|
|
2286
|
-
var COLLECTION_READ = '_collection_read';
|
|
2287
|
-
var COLLECTION_WRITE = '_collection_write';
|
|
2288
|
-
var DELETION_LOCK_NOTIFICATION_READ = '_deletion_lock_notification_read';
|
|
2289
|
-
var DELETION_LOCK_NOTIFICATION_WRITE = '_deletion_lock_notification_write';
|
|
2290
|
-
var DELETION_LOCK_READ = '_deletion_lock_read';
|
|
2291
|
-
var DELETION_LOCK_WRITE = '_deletion_lock_write';
|
|
2292
|
-
var DOCUMENT_NOTIFICATION_READ = '_document_notification_read';
|
|
2293
|
-
var DOCUMENT_NOTIFICATION_WRITE = '_document_notification_write';
|
|
2294
|
-
var DOCUMENT_READ = '_document_read';
|
|
2295
|
-
var DOCUMENT_WRITE = '_document_write';
|
|
2296
|
-
var ERROR_READ = '_error_read';
|
|
2297
|
-
var ERROR_WRITE = '_error_write';
|
|
2298
|
-
var EXPORT = '_export';
|
|
2299
|
-
var EXPORT_TEMPLATE_READ = '_export_template_read';
|
|
2300
|
-
var EXPORT_TEMPLATE_WRITE = '_export_template_write';
|
|
2301
|
-
var EXTERNAL_ID_READ = '_external_id_read';
|
|
2302
|
-
var EXTERNAL_ID_WRITE = '_external_id_write';
|
|
2303
|
-
var FILE_NOTIFICATION_READ = '_file_notification_read';
|
|
2304
|
-
var FILE_NOTIFICATION_WRITE = '_file_notification_write';
|
|
2305
|
-
var FILE_READ = '_file_read';
|
|
2306
|
-
var FILE_WRITE = '_file_write';
|
|
2307
|
-
var GROUP_READ = '_group_read';
|
|
2308
|
-
var GROUP_WRITE = '_group_write';
|
|
2309
|
-
var IMPORT_WRITE = '_import';
|
|
2310
|
-
var ITEM_ID_READ = '_item_id_read';
|
|
2311
|
-
var ITEM_ID_WRITE = '_item_id_write';
|
|
2312
|
-
var ITEM_NOTIFICATION_READ = '_item_notification_read';
|
|
2313
|
-
var ITEM_NOTIFICATION_WRITE = '_item_notification_write';
|
|
2314
|
-
var ITEM_WRITE = '_item_write';
|
|
2315
|
-
var ITEM_SEARCH = '_item_search';
|
|
2316
|
-
var ITEM_SHAPE_READ = '_item_shape_read';
|
|
2317
|
-
var ITEM_SHAPE_WRITE = '_item_shape_write';
|
|
2318
|
-
var ITEM_TIMELINE_READ = '_item_timeline_read';
|
|
2319
|
-
var ITEM_TIMELINE_WRITE = '_item_timeline_write';
|
|
2320
|
-
var ITEM_URI = '_item_uri';
|
|
2321
|
-
var JOB_NOTIFICATION_READ = '_job_notification_read';
|
|
2322
|
-
var JOB_NOTIFICATION_WRITE = '_job_notification_write';
|
|
2323
|
-
var JOB_READ = '_job_read';
|
|
2324
|
-
var JOB_WRITE = '_job_write';
|
|
2325
|
-
var LIBRARY_READ = '_library_read';
|
|
2326
|
-
var LIBRARY_WRITE = '_library_write';
|
|
2327
|
-
var LOCK_READ = '_lock_read';
|
|
2328
|
-
var LOCK_WRITE = '_lock_write';
|
|
2329
|
-
var LOG_READ = '_log_read';
|
|
2330
|
-
var METADATA_DATASET_READ = '_metadata_dataset_read';
|
|
2331
|
-
var METADATA_DATASET_WRITE = '_metadata_dataset_write';
|
|
2332
|
-
var METADATA_FIELD_GROUP_READ = '_metadata_field_group_read';
|
|
2333
|
-
var METADATA_FIELD_GROUP_WRITE = '_metadata_field_group_write';
|
|
2334
|
-
var METADATA_FIELD_READ = '_metadata_field_read';
|
|
2335
|
-
var METADATA_FIELD_WRITE = '_metadata_field_write';
|
|
2336
|
-
var METADATA_GLOBAL_READ = '_metadata_global_read';
|
|
2337
|
-
var METADATA_GLOBAL_WRITE = '_metadata_global_write';
|
|
2338
|
-
var METADATA_LOCK_READ = '_metadata_lock_read';
|
|
2339
|
-
var METADATA_LOCK_WRITE = '_metadata_lock_write';
|
|
2340
|
-
var METADATA_READ = '_metadata_read';
|
|
2341
|
-
var METADATA_SCHEMA_READ = '_metadata_schema_read';
|
|
2342
|
-
var METADATA_SCHEMA_WRITE = '_metadata_schema_write';
|
|
2343
|
-
var METADATA_WRITE = '_metadata_write';
|
|
2344
|
-
var OTIF_ANALYZE = '_otif_analyze';
|
|
2345
|
-
var OTIF_READ = '_otif_read';
|
|
2346
|
-
var OTIF_WRITE = '_otif_write';
|
|
2347
|
-
var PLACEHOLDER_NOTIFICATION_READ = '_placeholder_notification_read';
|
|
2348
|
-
var PLACEHOLDER_NOTIFICATION_WRITE = '_placeholder_notification_write';
|
|
2349
|
-
var PROJECTION_READ = '_projection_read';
|
|
2350
|
-
var PROJECTION_WRITE = '_projection_write';
|
|
2351
|
-
var QUOTA_NOTIFICATION_READ = '_quota_notification_read';
|
|
2352
|
-
var QUOTA_NOTIFICATION_WRITE = '_quota_notification_write';
|
|
2353
|
-
var QUOTA_READ = '_quota_read';
|
|
2354
|
-
var QUOTA_WRITE = '_quota_write';
|
|
2355
|
-
var RELATION_READ = '_relation_read';
|
|
2356
|
-
var RELATION_WRITE = '_relation_write';
|
|
2357
|
-
var RESOURCE_READ = '_resource_read';
|
|
2358
|
-
var RESOURCE_WRITE = '_resource_write';
|
|
2359
|
-
var RUN_AS = '_run_as';
|
|
2360
|
-
var SEARCH = '_search';
|
|
2361
|
-
var SEQUENCE_READ = '_sequence_read';
|
|
2362
|
-
var SEQUENCE_WRITE = '_sequence_write';
|
|
2363
|
-
var SHAPE_TAG_READ = '_shape_tag_read';
|
|
2364
|
-
var SHAPE_TAG_WRITE = '_shape_tag_write';
|
|
2365
|
-
var SITE_MANAGER = '_site_manager';
|
|
2366
|
-
var SITE_RULE_READ = '_site_rule_read';
|
|
2367
|
-
var SITE_RULE_WRITE = '_site_rule_write';
|
|
2368
|
-
var STORAGE_GROUP_READ = '_storage_group_read';
|
|
2369
|
-
var STORAGE_GROUP_WRITE = '_storage_group_write';
|
|
2370
|
-
var STORAGE_NOTIFICATION_READ = '_storage_notification_read';
|
|
2371
|
-
var STORAGE_NOTIFICATION_WRITE = '_storage_notification_write';
|
|
2372
|
-
var STORAGE_READ = '_storage_read';
|
|
2373
|
-
var STORAGE_RULE_READ = '_storage_rule_read';
|
|
2374
|
-
var STORAGE_RULE_WRITE = '_storage_rule_write';
|
|
2375
|
-
var STORAGE_WRITE = '_storage_write';
|
|
2376
|
-
var SUPER_ACCESS_USER = '_super_access_user';
|
|
2377
|
-
var TASKDEFINITION_READ = '_taskdefinition_read';
|
|
2378
|
-
var TASKDEFINITION_WRITE = '_taskdefinition_write';
|
|
2379
|
-
var THUMBNAIL_READ = '_thumbnail_read';
|
|
2380
|
-
var THUMBNAIL_WRITE = '_thumbnail_write';
|
|
2381
|
-
var TRANSCODER = '_transcoder';
|
|
2382
|
-
var TRANSFER_READ = '_transfer_read';
|
|
2383
|
-
var TRANSFER_WRITE = '_transfer_write';
|
|
2384
|
-
var USER = '_user';
|
|
2385
|
-
var VXA = '_vxa';
|
|
2386
|
-
var VXA_READ = '_vxa_read';
|
|
2387
|
-
|
|
2388
|
-
var roles = /*#__PURE__*/Object.freeze({
|
|
2389
|
-
__proto__: null,
|
|
2390
|
-
ACCESSCONTROL_READ: ACCESSCONTROL_READ,
|
|
2391
|
-
ACCESSCONTROL_WRITE: ACCESSCONTROL_WRITE,
|
|
2392
|
-
ADMINISTRATOR: ADMINISTRATOR,
|
|
2393
|
-
AUTO_PROJECTION_READ: AUTO_PROJECTION_READ,
|
|
2394
|
-
AUTO_PROJECTION_WRITE: AUTO_PROJECTION_WRITE,
|
|
2395
|
-
COLLECTION_NOTIFICATION_READ: COLLECTION_NOTIFICATION_READ,
|
|
2396
|
-
COLLECTION_NOTIFICATION_WRITE: COLLECTION_NOTIFICATION_WRITE,
|
|
2397
|
-
COLLECTION_READ: COLLECTION_READ,
|
|
2398
|
-
COLLECTION_WRITE: COLLECTION_WRITE,
|
|
2399
|
-
DELETION_LOCK_NOTIFICATION_READ: DELETION_LOCK_NOTIFICATION_READ,
|
|
2400
|
-
DELETION_LOCK_NOTIFICATION_WRITE: DELETION_LOCK_NOTIFICATION_WRITE,
|
|
2401
|
-
DELETION_LOCK_READ: DELETION_LOCK_READ,
|
|
2402
|
-
DELETION_LOCK_WRITE: DELETION_LOCK_WRITE,
|
|
2403
|
-
DOCUMENT_NOTIFICATION_READ: DOCUMENT_NOTIFICATION_READ,
|
|
2404
|
-
DOCUMENT_NOTIFICATION_WRITE: DOCUMENT_NOTIFICATION_WRITE,
|
|
2405
|
-
DOCUMENT_READ: DOCUMENT_READ,
|
|
2406
|
-
DOCUMENT_WRITE: DOCUMENT_WRITE,
|
|
2407
|
-
ERROR_READ: ERROR_READ,
|
|
2408
|
-
ERROR_WRITE: ERROR_WRITE,
|
|
2409
|
-
EXPORT: EXPORT,
|
|
2410
|
-
EXPORT_TEMPLATE_READ: EXPORT_TEMPLATE_READ,
|
|
2411
|
-
EXPORT_TEMPLATE_WRITE: EXPORT_TEMPLATE_WRITE,
|
|
2412
|
-
EXTERNAL_ID_READ: EXTERNAL_ID_READ,
|
|
2413
|
-
EXTERNAL_ID_WRITE: EXTERNAL_ID_WRITE,
|
|
2414
|
-
FILE_NOTIFICATION_READ: FILE_NOTIFICATION_READ,
|
|
2415
|
-
FILE_NOTIFICATION_WRITE: FILE_NOTIFICATION_WRITE,
|
|
2416
|
-
FILE_READ: FILE_READ,
|
|
2417
|
-
FILE_WRITE: FILE_WRITE,
|
|
2418
|
-
GROUP_READ: GROUP_READ,
|
|
2419
|
-
GROUP_WRITE: GROUP_WRITE,
|
|
2420
|
-
IMPORT_WRITE: IMPORT_WRITE,
|
|
2421
|
-
ITEM_ID_READ: ITEM_ID_READ,
|
|
2422
|
-
ITEM_ID_WRITE: ITEM_ID_WRITE,
|
|
2423
|
-
ITEM_NOTIFICATION_READ: ITEM_NOTIFICATION_READ,
|
|
2424
|
-
ITEM_NOTIFICATION_WRITE: ITEM_NOTIFICATION_WRITE,
|
|
2425
|
-
ITEM_WRITE: ITEM_WRITE,
|
|
2426
|
-
ITEM_SEARCH: ITEM_SEARCH,
|
|
2427
|
-
ITEM_SHAPE_READ: ITEM_SHAPE_READ,
|
|
2428
|
-
ITEM_SHAPE_WRITE: ITEM_SHAPE_WRITE,
|
|
2429
|
-
ITEM_TIMELINE_READ: ITEM_TIMELINE_READ,
|
|
2430
|
-
ITEM_TIMELINE_WRITE: ITEM_TIMELINE_WRITE,
|
|
2431
|
-
ITEM_URI: ITEM_URI,
|
|
2432
|
-
JOB_NOTIFICATION_READ: JOB_NOTIFICATION_READ,
|
|
2433
|
-
JOB_NOTIFICATION_WRITE: JOB_NOTIFICATION_WRITE,
|
|
2434
|
-
JOB_READ: JOB_READ,
|
|
2435
|
-
JOB_WRITE: JOB_WRITE,
|
|
2436
|
-
LIBRARY_READ: LIBRARY_READ,
|
|
2437
|
-
LIBRARY_WRITE: LIBRARY_WRITE,
|
|
2438
|
-
LOCK_READ: LOCK_READ,
|
|
2439
|
-
LOCK_WRITE: LOCK_WRITE,
|
|
2440
|
-
LOG_READ: LOG_READ,
|
|
2441
|
-
METADATA_DATASET_READ: METADATA_DATASET_READ,
|
|
2442
|
-
METADATA_DATASET_WRITE: METADATA_DATASET_WRITE,
|
|
2443
|
-
METADATA_FIELD_GROUP_READ: METADATA_FIELD_GROUP_READ,
|
|
2444
|
-
METADATA_FIELD_GROUP_WRITE: METADATA_FIELD_GROUP_WRITE,
|
|
2445
|
-
METADATA_FIELD_READ: METADATA_FIELD_READ,
|
|
2446
|
-
METADATA_FIELD_WRITE: METADATA_FIELD_WRITE,
|
|
2447
|
-
METADATA_GLOBAL_READ: METADATA_GLOBAL_READ,
|
|
2448
|
-
METADATA_GLOBAL_WRITE: METADATA_GLOBAL_WRITE,
|
|
2449
|
-
METADATA_LOCK_READ: METADATA_LOCK_READ,
|
|
2450
|
-
METADATA_LOCK_WRITE: METADATA_LOCK_WRITE,
|
|
2451
|
-
METADATA_READ: METADATA_READ,
|
|
2452
|
-
METADATA_SCHEMA_READ: METADATA_SCHEMA_READ,
|
|
2453
|
-
METADATA_SCHEMA_WRITE: METADATA_SCHEMA_WRITE,
|
|
2454
|
-
METADATA_WRITE: METADATA_WRITE,
|
|
2455
|
-
OTIF_ANALYZE: OTIF_ANALYZE,
|
|
2456
|
-
OTIF_READ: OTIF_READ,
|
|
2457
|
-
OTIF_WRITE: OTIF_WRITE,
|
|
2458
|
-
PLACEHOLDER_NOTIFICATION_READ: PLACEHOLDER_NOTIFICATION_READ,
|
|
2459
|
-
PLACEHOLDER_NOTIFICATION_WRITE: PLACEHOLDER_NOTIFICATION_WRITE,
|
|
2460
|
-
PROJECTION_READ: PROJECTION_READ,
|
|
2461
|
-
PROJECTION_WRITE: PROJECTION_WRITE,
|
|
2462
|
-
QUOTA_NOTIFICATION_READ: QUOTA_NOTIFICATION_READ,
|
|
2463
|
-
QUOTA_NOTIFICATION_WRITE: QUOTA_NOTIFICATION_WRITE,
|
|
2464
|
-
QUOTA_READ: QUOTA_READ,
|
|
2465
|
-
QUOTA_WRITE: QUOTA_WRITE,
|
|
2466
|
-
RELATION_READ: RELATION_READ,
|
|
2467
|
-
RELATION_WRITE: RELATION_WRITE,
|
|
2468
|
-
RESOURCE_READ: RESOURCE_READ,
|
|
2469
|
-
RESOURCE_WRITE: RESOURCE_WRITE,
|
|
2470
|
-
RUN_AS: RUN_AS,
|
|
2471
|
-
SEARCH: SEARCH,
|
|
2472
|
-
SEQUENCE_READ: SEQUENCE_READ,
|
|
2473
|
-
SEQUENCE_WRITE: SEQUENCE_WRITE,
|
|
2474
|
-
SHAPE_TAG_READ: SHAPE_TAG_READ,
|
|
2475
|
-
SHAPE_TAG_WRITE: SHAPE_TAG_WRITE,
|
|
2476
|
-
SITE_MANAGER: SITE_MANAGER,
|
|
2477
|
-
SITE_RULE_READ: SITE_RULE_READ,
|
|
2478
|
-
SITE_RULE_WRITE: SITE_RULE_WRITE,
|
|
2479
|
-
STORAGE_GROUP_READ: STORAGE_GROUP_READ,
|
|
2480
|
-
STORAGE_GROUP_WRITE: STORAGE_GROUP_WRITE,
|
|
2481
|
-
STORAGE_NOTIFICATION_READ: STORAGE_NOTIFICATION_READ,
|
|
2482
|
-
STORAGE_NOTIFICATION_WRITE: STORAGE_NOTIFICATION_WRITE,
|
|
2483
|
-
STORAGE_READ: STORAGE_READ,
|
|
2484
|
-
STORAGE_RULE_READ: STORAGE_RULE_READ,
|
|
2485
|
-
STORAGE_RULE_WRITE: STORAGE_RULE_WRITE,
|
|
2486
|
-
STORAGE_WRITE: STORAGE_WRITE,
|
|
2487
|
-
SUPER_ACCESS_USER: SUPER_ACCESS_USER,
|
|
2488
|
-
TASKDEFINITION_READ: TASKDEFINITION_READ,
|
|
2489
|
-
TASKDEFINITION_WRITE: TASKDEFINITION_WRITE,
|
|
2490
|
-
THUMBNAIL_READ: THUMBNAIL_READ,
|
|
2491
|
-
THUMBNAIL_WRITE: THUMBNAIL_WRITE,
|
|
2492
|
-
TRANSCODER: TRANSCODER,
|
|
2493
|
-
TRANSFER_READ: TRANSFER_READ,
|
|
2494
|
-
TRANSFER_WRITE: TRANSFER_WRITE,
|
|
2495
|
-
USER: USER,
|
|
2496
|
-
VXA: VXA,
|
|
2497
|
-
VXA_READ: VXA_READ
|
|
2498
|
-
});
|
|
2499
|
-
|
|
2500
1965
|
var parseSimpleMetadataType = function parseSimpleMetadataType() {
|
|
2501
1966
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2502
1967
|
_ref$field = _ref.field,
|
|
@@ -2505,6 +1970,19 @@ var parseSimpleMetadataType = function parseSimpleMetadataType() {
|
|
|
2505
1970
|
return parseKeyValuePairType(field);
|
|
2506
1971
|
};
|
|
2507
1972
|
|
|
1973
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1974
|
+
|
|
1975
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* Parses highlight timespan responses from the api into key/value object.
|
|
1979
|
+
* The attributes can be targeted for each sub-type.
|
|
1980
|
+
* @param {Object[]} highlightTimespan - A timespan object from the api response.
|
|
1981
|
+
* @param {Object} options - Options which change how the timespans are parsed.
|
|
1982
|
+
* @param {boolean} options.arrayOnSingle=true - Return an array if there is a single value.
|
|
1983
|
+
* @param {boolean} options.timespanAsList=false - Return timespans as list.
|
|
1984
|
+
* @param {string} options.joinValue - String to join the values, eg ','.
|
|
1985
|
+
*/
|
|
2508
1986
|
var parseHighlightTimespan = function parseHighlightTimespan() {
|
|
2509
1987
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2510
1988
|
_ref$field = _ref.field,
|
|
@@ -2536,24 +2014,27 @@ var parseHighlightTimespan = function parseHighlightTimespan() {
|
|
|
2536
2014
|
fieldValue = _valueList[0];
|
|
2537
2015
|
} else if (joinValue) fieldValue = valueList.join(joinValue);else fieldValue = valueList;
|
|
2538
2016
|
|
|
2539
|
-
return
|
|
2017
|
+
return _objectSpread$2(_objectSpread$2({}, a), {}, _defineProperty({}, name, fieldValue));
|
|
2540
2018
|
}, initialValue);
|
|
2541
2019
|
return fieldList;
|
|
2542
2020
|
};
|
|
2021
|
+
|
|
2022
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2023
|
+
|
|
2024
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2543
2025
|
/**
|
|
2544
|
-
* Parses
|
|
2026
|
+
* Parses highlight timespans responses from the api into key/value object.
|
|
2545
2027
|
* The attributes can be targeted for each sub-type.
|
|
2546
|
-
* @param {Object} highlightTimespanList - A list of timespans.
|
|
2028
|
+
* @param {Object} highlightTimespanList - A list of timespans from the api response.
|
|
2547
2029
|
* @param {Object} options - Options which change how the timespans are parsed.
|
|
2548
|
-
* @param {
|
|
2549
|
-
* @param {
|
|
2550
|
-
* @param {
|
|
2551
|
-
* @param {
|
|
2552
|
-
* @param {
|
|
2553
|
-
* @param {
|
|
2030
|
+
* @param {boolean} options.arrayOnSingle=true - Return an array if there is a single value.
|
|
2031
|
+
* @param {string} options.joinValue - String to join the values, eg ','.
|
|
2032
|
+
* @param {boolean} options.timespanAsList=false - Return timespans as list.
|
|
2033
|
+
* @param {boolean} options.flat=false - Flatten to field-name/field-value (Note: field-values may be overwritten).
|
|
2034
|
+
* @param {boolean} options.flatTimespan=false - Flatten timespan to object with start/end as key.
|
|
2035
|
+
* @param {string} options.joinTimespan=_ - Character to join the start/end timecodes.
|
|
2554
2036
|
*/
|
|
2555
2037
|
|
|
2556
|
-
|
|
2557
2038
|
var parseHighlightTimespanList = function parseHighlightTimespanList() {
|
|
2558
2039
|
var highlightTimespanList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2559
2040
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -2566,30 +2047,240 @@ var parseHighlightTimespanList = function parseHighlightTimespanList() {
|
|
|
2566
2047
|
return parseHighlightTimespan(timespan, opts);
|
|
2567
2048
|
});
|
|
2568
2049
|
if (flat === true || flatTimespan === true) return highlightTimespanList.reduce(function (a, timespan) {
|
|
2569
|
-
return
|
|
2050
|
+
return _objectSpread$1(_objectSpread$1({}, a), parseHighlightTimespan(timespan, opts));
|
|
2570
2051
|
}, {});
|
|
2571
2052
|
return highlightTimespanList.reduce(function (a, timespan) {
|
|
2572
|
-
return
|
|
2053
|
+
return _objectSpread$1(_objectSpread$1({}, a), {}, _defineProperty({}, [timespan.start, timespan.end].join(joinTimespan), parseHighlightTimespan(timespan, opts)));
|
|
2573
2054
|
}, {});
|
|
2574
2055
|
};
|
|
2575
2056
|
|
|
2576
|
-
|
|
2577
|
-
var
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2057
|
+
function timeToCueTime(_ref) {
|
|
2058
|
+
var _ref$hours = _ref.hours,
|
|
2059
|
+
hours = _ref$hours === void 0 ? 0 : _ref$hours,
|
|
2060
|
+
_ref$minutes = _ref.minutes,
|
|
2061
|
+
minutes = _ref$minutes === void 0 ? 0 : _ref$minutes,
|
|
2062
|
+
_ref$seconds = _ref.seconds,
|
|
2063
|
+
seconds = _ref$seconds === void 0 ? 0 : _ref$seconds,
|
|
2064
|
+
_ref$partialSeconds = _ref.partialSeconds,
|
|
2065
|
+
partialSeconds = _ref$partialSeconds === void 0 ? 0 : _ref$partialSeconds;
|
|
2066
|
+
var hourStr = hours.toFixed().padStart(2, '0');
|
|
2067
|
+
var minStr = minutes.toFixed().padStart(2, '0');
|
|
2068
|
+
var secondsStr = seconds.toFixed().padStart(2, '0');
|
|
2069
|
+
var partialStr = (partialSeconds * 10).toFixed().padStart(3, '0');
|
|
2070
|
+
return "".concat(hourStr, ":").concat(minStr, ":").concat(secondsStr, ".").concat(partialStr);
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Convert subtitle groups to WebVtt subtitle format
|
|
2074
|
+
* @param {Object} input={}
|
|
2075
|
+
* @param {Object} input.metadataType - MetadataType response from API.
|
|
2076
|
+
* @param {string} input.subtitleGroup=stl_subtitle - Name of group containing subtitle field/text.
|
|
2077
|
+
* @param {string} input.subtitleField=stl_text - Name of field (text) to use for the subtitles.
|
|
2078
|
+
* @returns {string} WebVtt subtitles
|
|
2079
|
+
*/
|
|
2581
2080
|
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
var
|
|
2081
|
+
|
|
2082
|
+
function metadataTypeToWebVtt(_ref2) {
|
|
2083
|
+
var metadataType = _ref2.metadataType,
|
|
2084
|
+
_ref2$subtitleGroup = _ref2.subtitleGroup,
|
|
2085
|
+
subtitleGroup = _ref2$subtitleGroup === void 0 ? 'stl_subtitle' : _ref2$subtitleGroup,
|
|
2086
|
+
_ref2$subtitleField = _ref2.subtitleField,
|
|
2087
|
+
subtitleField = _ref2$subtitleField === void 0 ? 'stl_text' : _ref2$subtitleField;
|
|
2088
|
+
var parseOptions = {
|
|
2089
|
+
includeTimespanAttributes: true,
|
|
2090
|
+
flatTimespan: true,
|
|
2091
|
+
flatGroup: true,
|
|
2092
|
+
joinValue: ','
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
var _ref3 = metadataType || {},
|
|
2096
|
+
_ref3$timespan = _ref3.timespan,
|
|
2097
|
+
timespanList = _ref3$timespan === void 0 ? [] : _ref3$timespan;
|
|
2098
|
+
|
|
2099
|
+
if (timespanList.length === 0) return '';
|
|
2100
|
+
var sortedTimespans = timespanList.sort(sortTimespanList);
|
|
2101
|
+
var parsedTimespans = sortedTimespans.map(function (timespanType) {
|
|
2102
|
+
return parseTimespan(timespanType, parseOptions);
|
|
2103
|
+
});
|
|
2104
|
+
var vttCues = parsedTimespans.map(function (thisTimespan) {
|
|
2105
|
+
var startText = thisTimespan.start,
|
|
2106
|
+
endText = thisTimespan.end,
|
|
2107
|
+
_thisTimespan$subtitl = thisTimespan[subtitleGroup];
|
|
2108
|
+
_thisTimespan$subtitl = _thisTimespan$subtitl === void 0 ? {} : _thisTimespan$subtitl;
|
|
2109
|
+
var text = _thisTimespan$subtitl[subtitleField];
|
|
2110
|
+
if (!text) return '';
|
|
2111
|
+
var startTime = formatTimeCodeText(startText).toTime();
|
|
2112
|
+
var start = timeToCueTime(startTime);
|
|
2113
|
+
var endTime = formatTimeCodeText(endText).toTime();
|
|
2114
|
+
var end = timeToCueTime(endTime);
|
|
2115
|
+
return "".concat(start, " --> ").concat(end, " line:0%\r").concat(text, "\r");
|
|
2116
|
+
});
|
|
2117
|
+
return "WEBVTT\n\n\n".concat(vttCues.join('\n'));
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
var createFacetType = function createFacetType() {
|
|
2121
|
+
var fieldList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2122
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2123
|
+
return fieldList.map(function (field) {
|
|
2124
|
+
return {
|
|
2125
|
+
field: field,
|
|
2126
|
+
name: field,
|
|
2127
|
+
count: options.count || true,
|
|
2128
|
+
exclude: fieldList
|
|
2129
|
+
};
|
|
2130
|
+
});
|
|
2131
|
+
};
|
|
2132
|
+
|
|
2133
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2134
|
+
|
|
2135
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2136
|
+
|
|
2137
|
+
var parseFacetType = function parseFacetType() {
|
|
2138
|
+
var facetType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2139
|
+
var output = {};
|
|
2140
|
+
|
|
2141
|
+
var facetFieldReducer = function facetFieldReducer(a, _ref) {
|
|
2142
|
+
var fieldValue = _ref.fieldValue,
|
|
2143
|
+
value = _ref.value;
|
|
2144
|
+
return _objectSpread(_objectSpread({}, a), {}, _defineProperty({}, fieldValue, value));
|
|
2145
|
+
};
|
|
2146
|
+
|
|
2147
|
+
facetType.forEach(function (_ref2) {
|
|
2148
|
+
var name = _ref2.name,
|
|
2149
|
+
field = _ref2.field,
|
|
2150
|
+
count = _ref2.count;
|
|
2151
|
+
output[name || field] = count.reduce(facetFieldReducer, {});
|
|
2152
|
+
});
|
|
2153
|
+
return output;
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
var IMAGE_MIME_TYPES = ['image/apng', 'image/bmp', 'image/gif', 'image/jpeg', 'image/x-icon', 'image/png', 'image/svg+xml'];
|
|
2157
|
+
var VIDEO_MIME_TYPES = ['video/mp4'];
|
|
2158
|
+
var AUDIO_MIME_TYPES = ['audio/mp4', 'audio/mpeg', 'audio/x-aac', 'audio/aac', 'audio/x-wav', 'audio/wav', 'audio/accp', 'audio/ogg', 'audio/webm', 'audio/x-flac'];
|
|
2159
|
+
var DEFAULT_ALLOWED_MIME_TYPES = [].concat(VIDEO_MIME_TYPES, IMAGE_MIME_TYPES, AUDIO_MIME_TYPES);
|
|
2160
|
+
var DEFAULT_ALLOWED_METHODS = ['http', 'https'];
|
|
2161
|
+
var MP4_MIMETYPE = 'video/mp4';
|
|
2162
|
+
var QUICKTIME_MIMETYPE = 'video/quicktime';
|
|
2163
|
+
var M4V_MIMETYPE = 'video/x-m4v';
|
|
2164
|
+
var MP4_CONTAINER = 'MPEG-4';
|
|
2165
|
+
var MOV_CONTAINER = 'mov';
|
|
2166
|
+
var H264_CODEC = 'h264'; // Sort by tags in the order of previewShapeOrder, secondary alphabetical.
|
|
2167
|
+
// using reverse() so the first has highest index
|
|
2168
|
+
|
|
2169
|
+
var PREVIEW_SHAPE_ORDER = ['__mp4', '__mp3_160k', '__png', '__jpeg', '__gif', 'original'].reverse();
|
|
2170
|
+
|
|
2171
|
+
var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
|
|
2172
|
+
var firstEl = _ref.shape.tag;
|
|
2173
|
+
var secondEl = _ref2.shape.tag;
|
|
2174
|
+
|
|
2175
|
+
if (PREVIEW_SHAPE_ORDER.includes(firstEl) || PREVIEW_SHAPE_ORDER.includes(secondEl)) {
|
|
2176
|
+
return PREVIEW_SHAPE_ORDER.indexOf(secondEl) - PREVIEW_SHAPE_ORDER.indexOf(firstEl);
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
return firstEl.toLowerCase().localeCompare(secondEl.toLowerCase());
|
|
2180
|
+
};
|
|
2181
|
+
|
|
2182
|
+
var filterShapeSource = function filterShapeSource() {
|
|
2183
|
+
var itemType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2184
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2185
|
+
var _options$allowedMimeT = options.allowedMimeTypes,
|
|
2186
|
+
allowedMimeTypes = _options$allowedMimeT === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _options$allowedMimeT,
|
|
2187
|
+
_options$sortPriority = options.sortPriority,
|
|
2188
|
+
sortPriority = _options$sortPriority === void 0 ? defaultSortPriority : _options$sortPriority,
|
|
2189
|
+
_options$allowedMetho = options.allowedMethods,
|
|
2190
|
+
allowedMethods = _options$allowedMetho === void 0 ? DEFAULT_ALLOWED_METHODS : _options$allowedMetho,
|
|
2191
|
+
_options$sourceKey = options.sourceKey,
|
|
2192
|
+
sourceKey = _options$sourceKey === void 0 ? 'src' : _options$sourceKey,
|
|
2193
|
+
_options$mimeTypeKey = options.mimeTypeKey,
|
|
2194
|
+
mimeTypeKey = _options$mimeTypeKey === void 0 ? 'type' : _options$mimeTypeKey,
|
|
2195
|
+
_options$shapeKey = options.shapeKey,
|
|
2196
|
+
shapeKey = _options$shapeKey === void 0 ? 'shape' : _options$shapeKey;
|
|
2197
|
+
var _itemType$shape = itemType.shape,
|
|
2198
|
+
shapeList = _itemType$shape === void 0 ? [] : _itemType$shape;
|
|
2199
|
+
var parsedShapeList = shapeList.reduce(function (acc, shapeType) {
|
|
2200
|
+
var type;
|
|
2201
|
+
var src;
|
|
2202
|
+
var shape = parseShapeType(shapeType);
|
|
2203
|
+
var uri = shape.uri,
|
|
2204
|
+
mimeType = shape.mimeType,
|
|
2205
|
+
containerFormat = shape.containerFormat,
|
|
2206
|
+
videoCodec = shape.videoCodec;
|
|
2207
|
+
|
|
2208
|
+
if (mimeType) {
|
|
2209
|
+
type = mimeType;
|
|
2210
|
+
if ((mimeType === QUICKTIME_MIMETYPE || mimeType === M4V_MIMETYPE) && (containerFormat === MP4_CONTAINER || containerFormat === MOV_CONTAINER) && videoCodec === H264_CODEC) type = MP4_MIMETYPE;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
if (uri) {
|
|
2214
|
+
if (allowedMethods) {
|
|
2215
|
+
var _uri$split = uri.split('://'),
|
|
2216
|
+
_uri$split2 = _slicedToArray(_uri$split, 1),
|
|
2217
|
+
thisMethod = _uri$split2[0];
|
|
2218
|
+
|
|
2219
|
+
if (allowedMethods.includes(thisMethod)) src = uri;
|
|
2220
|
+
} else {
|
|
2221
|
+
src = uri;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
if (src && allowedMimeTypes.includes(type)) {
|
|
2226
|
+
var _acc$push;
|
|
2227
|
+
|
|
2228
|
+
acc.push((_acc$push = {}, _defineProperty(_acc$push, sourceKey, src), _defineProperty(_acc$push, mimeTypeKey, type), _defineProperty(_acc$push, shapeKey, shape), _acc$push));
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
return acc;
|
|
2232
|
+
}, []);
|
|
2233
|
+
if (typeof sortPriority === 'function') parsedShapeList.sort(defaultSortPriority);
|
|
2234
|
+
return parsedShapeList;
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2237
|
+
var IMAGE = 'IMAGE';
|
|
2238
|
+
var AUDIO = 'AUDIO';
|
|
2239
|
+
var VIDEO = 'VIDEO';
|
|
2240
|
+
var DOCUMENT = 'DOCUMENT';
|
|
2241
|
+
var getShapeMediaType = function getShapeMediaType() {
|
|
2242
|
+
var shapeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2243
|
+
var mimeType = shapeType.mimeType,
|
|
2244
|
+
videoCodec = shapeType.videoCodec,
|
|
2245
|
+
audioCodec = shapeType.audioCodec;
|
|
2585
2246
|
if (!mimeType) return undefined;
|
|
2586
|
-
|
|
2587
|
-
if (mimeType.startsWith('
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2247
|
+
|
|
2248
|
+
if (mimeType.startsWith('audio/')) {
|
|
2249
|
+
if (audioCodec !== undefined) return AUDIO;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
if (mimeType.startsWith('video/')) {
|
|
2253
|
+
if (videoCodec !== undefined) return VIDEO;
|
|
2254
|
+
if (audioCodec !== undefined) return AUDIO;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
if (mimeType.startsWith('image/')) return IMAGE;
|
|
2258
|
+
if (mimeType.endsWith('/pdf')) return DOCUMENT;
|
|
2259
|
+
if (mimeType.startsWith('text/')) return DOCUMENT;
|
|
2260
|
+
if (mimeType.endsWith('/msword')) return DOCUMENT;
|
|
2261
|
+
if (mimeType.endsWith('/json')) return DOCUMENT;
|
|
2262
|
+
if (mimeType.endsWith('/xml')) return DOCUMENT;
|
|
2591
2263
|
return undefined;
|
|
2592
2264
|
};
|
|
2593
2265
|
|
|
2594
|
-
|
|
2266
|
+
var findNearestThumbnail = function findNearestThumbnail(itemType, timeCodeText) {
|
|
2267
|
+
var tcSeconds = formatTimeCodeText(timeCodeText).toSeconds();
|
|
2268
|
+
|
|
2269
|
+
var _ref = itemType || {},
|
|
2270
|
+
_ref$thumbnails = _ref.thumbnails,
|
|
2271
|
+
thumbnails = _ref$thumbnails === void 0 ? {} : _ref$thumbnails;
|
|
2272
|
+
|
|
2273
|
+
var _thumbnails$uri = thumbnails.uri,
|
|
2274
|
+
srcList = _thumbnails$uri === void 0 ? [] : _thumbnails$uri;
|
|
2275
|
+
var srcTcSeconds = srcList.map(function (url) {
|
|
2276
|
+
var tc = new URL(url).pathname.split('/').pop();
|
|
2277
|
+
return formatTimeCodeText(tc).toSeconds();
|
|
2278
|
+
});
|
|
2279
|
+
var nearestSrcIndex = srcTcSeconds.reduce(function (nearestIndex, curr, currIndex) {
|
|
2280
|
+
return Math.abs(curr - tcSeconds) < Math.abs(srcTcSeconds[nearestIndex] - tcSeconds) ? currIndex : nearestIndex;
|
|
2281
|
+
}, 0);
|
|
2282
|
+
return srcList[nearestSrcIndex];
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
export { TimeBase, TimeCode, createFacetType, createMetadataType, filterShapeSource, findNearestThumbnail, formatSeconds, formatSecondsPrecise, formatSmpte, formatTimeBase, formatTimeBaseText, formatTimeBaseType, formatTimeCodeText, formatTimeCodeType, getDocumentType, getShapeMediaType, metadataTypeToWebVtt, parseAspectRatio, parseAudioComponent, parseBaseMediaInfoType, parseBinaryComponent, parseContainerComponent, parseFacetType, parseFileType, parseHighlightTimespan, parseHighlightTimespanList, parseKeyValuePairType, parseMediaConvertPreset, parseMetadataType, parseNowDate, parseShapeType, parseSimpleMetadataType, parseTimespan, parseTimespanList, parseTranscodePreset, parseVideoComponent, roles };
|
|
2595
2286
|
//# sourceMappingURL=index.es.js.map
|