UNPKG

dashjs

Version:

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.

1,203 lines (1,105 loc) 3.44 MB
/******/ var __webpack_modules__ = ({ /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_OBJECT.js": /*!**************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CMCD_OBJECT.js ***! \**************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMCD_OBJECT: function() { return /* binding */ CMCD_OBJECT; } /* harmony export */ }); /** * CMCD object header name. * * @group CMCD * * @beta */ const CMCD_OBJECT = 'CMCD-Object'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_PARAM.js": /*!*************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CMCD_PARAM.js ***! \*************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMCD_PARAM: function() { return /* binding */ CMCD_PARAM; } /* harmony export */ }); /** * CMCD parameter name. * * @group CMCD * * @beta */ const CMCD_PARAM = 'CMCD'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_REQUEST.js": /*!***************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CMCD_REQUEST.js ***! \***************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMCD_REQUEST: function() { return /* binding */ CMCD_REQUEST; } /* harmony export */ }); /** * CMCD request header name. * * @group CMCD * * @beta */ const CMCD_REQUEST = 'CMCD-Request'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_SESSION.js": /*!***************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CMCD_SESSION.js ***! \***************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMCD_SESSION: function() { return /* binding */ CMCD_SESSION; } /* harmony export */ }); /** * CMCD session header name. * * @group CMCD * * @beta */ const CMCD_SESSION = 'CMCD-Session'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_STATUS.js": /*!**************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CMCD_STATUS.js ***! \**************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMCD_STATUS: function() { return /* binding */ CMCD_STATUS; } /* harmony export */ }); /** * CMCD status header name. * * @group CMCD * * @beta */ const CMCD_STATUS = 'CMCD-Status'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdFormatters.js": /*!*****************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CmcdFormatters.js ***! \*****************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmcdFormatters: function() { return /* binding */ CmcdFormatters; } /* harmony export */ }); /* harmony import */ var _utils_urlToRelativePath_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/urlToRelativePath.js */ "./node_modules/@svta/common-media-library/dist/utils/urlToRelativePath.js"); const toRounded = value => Math.round(value); const toUrlSafe = (value, options) => { if (options === null || options === void 0 ? void 0 : options.baseUrl) { value = (0,_utils_urlToRelativePath_js__WEBPACK_IMPORTED_MODULE_0__.urlToRelativePath)(value, options.baseUrl); } return encodeURIComponent(value); }; const toHundred = value => toRounded(value / 100) * 100; /** * The default formatters for CMCD values. * * @group CMCD * * @beta */ const CmcdFormatters = { /** * Bitrate (kbps) rounded integer */ br: toRounded, /** * Duration (milliseconds) rounded integer */ d: toRounded, /** * Buffer Length (milliseconds) rounded nearest 100ms */ bl: toHundred, /** * Deadline (milliseconds) rounded nearest 100ms */ dl: toHundred, /** * Measured Throughput (kbps) rounded nearest 100kbps */ mtp: toHundred, /** * Next Object Request URL encoded */ nor: toUrlSafe, /** * Requested maximum throughput (kbps) rounded nearest 100kbps */ rtp: toHundred, /** * Top Bitrate (kbps) rounded integer */ tb: toRounded }; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderField.js": /*!******************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderField.js ***! \******************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmcdHeaderField: function() { return /* binding */ CmcdHeaderField; } /* harmony export */ }); /* harmony import */ var _CMCD_OBJECT_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CMCD_OBJECT.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_OBJECT.js"); /* harmony import */ var _CMCD_REQUEST_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CMCD_REQUEST.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_REQUEST.js"); /* harmony import */ var _CMCD_SESSION_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CMCD_SESSION.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_SESSION.js"); /* harmony import */ var _CMCD_STATUS_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CMCD_STATUS.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CMCD_STATUS.js"); /** * CMCD header fields. * * @group CMCD * * @enum * * @beta */ const CmcdHeaderField = { /** * keys whose values vary with the object being requested. */ OBJECT: _CMCD_OBJECT_js__WEBPACK_IMPORTED_MODULE_0__.CMCD_OBJECT, /** * keys whose values vary with each request. */ REQUEST: _CMCD_REQUEST_js__WEBPACK_IMPORTED_MODULE_1__.CMCD_REQUEST, /** * keys whose values are expected to be invariant over the life of the session. */ SESSION: _CMCD_SESSION_js__WEBPACK_IMPORTED_MODULE_2__.CMCD_SESSION, /** * keys whose values do not vary with every request or object. */ STATUS: _CMCD_STATUS_js__WEBPACK_IMPORTED_MODULE_3__.CMCD_STATUS }; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderMap.js": /*!****************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderMap.js ***! \****************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmcdHeaderMap: function() { return /* binding */ CmcdHeaderMap; } /* harmony export */ }); /* harmony import */ var _CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CmcdHeaderField.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderField.js"); /** * The map of CMCD header fields to official CMCD keys. * * @internal * * @group CMCD */ const CmcdHeaderMap = { [_CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__.CmcdHeaderField.OBJECT]: ['br', 'd', 'ot', 'tb'], [_CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__.CmcdHeaderField.REQUEST]: ['bl', 'dl', 'mtp', 'nor', 'nrr', 'su'], [_CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__.CmcdHeaderField.SESSION]: ['cid', 'pr', 'sf', 'sid', 'st', 'v'], [_CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__.CmcdHeaderField.STATUS]: ['bs', 'rtp'] }; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdObjectType.js": /*!*****************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CmcdObjectType.js ***! \*****************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmcdObjectType: function() { return /* binding */ CmcdObjectType; } /* harmony export */ }); /* harmony import */ var _cta_CmObjectType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cta/CmObjectType.js */ "./node_modules/@svta/common-media-library/dist/cta/CmObjectType.js"); /** * Common Media Client Data Object Type * * @group CMCD * * @beta * * @enum */ const CmcdObjectType = _cta_CmObjectType_js__WEBPACK_IMPORTED_MODULE_0__.CmObjectType; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdStreamType.js": /*!*****************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CmcdStreamType.js ***! \*****************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmcdStreamType: function() { return /* binding */ CmcdStreamType; } /* harmony export */ }); /* harmony import */ var _cta_CmStreamType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cta/CmStreamType.js */ "./node_modules/@svta/common-media-library/dist/cta/CmStreamType.js"); /** * Common Media Client Data Stream Type * * @group CMCD * * @enum * * @beta */ const CmcdStreamType = _cta_CmStreamType_js__WEBPACK_IMPORTED_MODULE_0__.CmStreamType; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdStreamingFormat.js": /*!**********************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/CmcdStreamingFormat.js ***! \**********************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmcdStreamingFormat: function() { return /* binding */ CmcdStreamingFormat; } /* harmony export */ }); /* harmony import */ var _cta_CmStreamingFormat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cta/CmStreamingFormat.js */ "./node_modules/@svta/common-media-library/dist/cta/CmStreamingFormat.js"); /** * Common Media Client Data Streaming Format * * @group CMCD * * @enum * * @beta */ const CmcdStreamingFormat = _cta_CmStreamingFormat_js__WEBPACK_IMPORTED_MODULE_0__.CmStreamingFormat; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/encodeCmcd.js": /*!*************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/encodeCmcd.js ***! \*************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ encodeCmcd: function() { return /* binding */ encodeCmcd; } /* harmony export */ }); /* harmony import */ var _structuredfield_encodeSfDict_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../structuredfield/encodeSfDict.js */ "./node_modules/@svta/common-media-library/dist/structuredfield/encodeSfDict.js"); /* harmony import */ var _utils_processCmcd_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/processCmcd.js */ "./node_modules/@svta/common-media-library/dist/cmcd/utils/processCmcd.js"); /** * Encode a CMCD object to a string. * * @param cmcd - The CMCD object to encode. * @param options - Options for encoding. * * @returns The encoded CMCD string. * * @group CMCD * * @beta */ function encodeCmcd(cmcd) { let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!cmcd) { return ''; } return (0,_structuredfield_encodeSfDict_js__WEBPACK_IMPORTED_MODULE_0__.encodeSfDict)((0,_utils_processCmcd_js__WEBPACK_IMPORTED_MODULE_1__.processCmcd)(cmcd, options), Object.assign({ whitespace: false }, options)); } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/toCmcdHeaders.js": /*!****************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/toCmcdHeaders.js ***! \****************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ toCmcdHeaders: function() { return /* binding */ toCmcdHeaders; } /* harmony export */ }); /* harmony import */ var _CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CmcdHeaderField.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderField.js"); /* harmony import */ var _CmcdHeaderMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CmcdHeaderMap.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdHeaderMap.js"); /* harmony import */ var _encodeCmcd_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encodeCmcd.js */ "./node_modules/@svta/common-media-library/dist/cmcd/encodeCmcd.js"); /** * Convert a CMCD data object to request headers * * @param cmcd - The CMCD data object to convert. * @param options - Options for encoding the CMCD object. * * @returns The CMCD header shards. * * @group CMCD * * @beta */ function toCmcdHeaders(cmcd) { let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; const result = {}; if (!cmcd) { return result; } const entries = Object.entries(cmcd); const headerMap = Object.entries(_CmcdHeaderMap_js__WEBPACK_IMPORTED_MODULE_1__.CmcdHeaderMap).concat(Object.entries((options === null || options === void 0 ? void 0 : options.customHeaderMap) || {})); const shards = entries.reduce((acc, entry) => { var _a, _b; const [key, value] = entry; const field = ((_a = headerMap.find(entry => entry[1].includes(key))) === null || _a === void 0 ? void 0 : _a[0]) || _CmcdHeaderField_js__WEBPACK_IMPORTED_MODULE_0__.CmcdHeaderField.REQUEST; (_b = acc[field]) !== null && _b !== void 0 ? _b : acc[field] = {}; acc[field][key] = value; return acc; }, {}); return Object.entries(shards).reduce((acc, _ref) => { let [field, value] = _ref; acc[field] = (0,_encodeCmcd_js__WEBPACK_IMPORTED_MODULE_2__.encodeCmcd)(value, options); return acc; }, result); } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmcd/utils/processCmcd.js": /*!********************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmcd/utils/processCmcd.js ***! \********************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ processCmcd: function() { return /* binding */ processCmcd; } /* harmony export */ }); /* harmony import */ var _cta_utils_isTokenField_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../cta/utils/isTokenField.js */ "./node_modules/@svta/common-media-library/dist/cta/utils/isTokenField.js"); /* harmony import */ var _cta_utils_isValid_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../cta/utils/isValid.js */ "./node_modules/@svta/common-media-library/dist/cta/utils/isValid.js"); /* harmony import */ var _structuredfield_SfToken_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../structuredfield/SfToken.js */ "./node_modules/@svta/common-media-library/dist/structuredfield/SfToken.js"); /* harmony import */ var _CmcdFormatters_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../CmcdFormatters.js */ "./node_modules/@svta/common-media-library/dist/cmcd/CmcdFormatters.js"); /** * Internal CMCD processing function. * * @param obj - The CMCD object to process. * @param map - The mapping function to use. * @param options - Options for encoding. * * @internal * * @group CMCD */ function processCmcd(obj, options) { const results = {}; if (obj == null || typeof obj !== 'object') { return results; } const keys = Object.keys(obj).sort(); const formatters = Object.assign({}, _CmcdFormatters_js__WEBPACK_IMPORTED_MODULE_3__.CmcdFormatters, options === null || options === void 0 ? void 0 : options.formatters); const filter = options === null || options === void 0 ? void 0 : options.filter; keys.forEach(key => { if (filter === null || filter === void 0 ? void 0 : filter(key)) { return; } let value = obj[key]; const formatter = formatters[key]; if (formatter) { value = formatter(value, options); } // Version should only be reported if not equal to 1. if (key === 'v' && value === 1) { return; } // Playback rate should only be sent if not equal to 1. if (key == 'pr' && value === 1) { return; } // ignore invalid values if (!(0,_cta_utils_isValid_js__WEBPACK_IMPORTED_MODULE_1__.isValid)(value)) { return; } if ((0,_cta_utils_isTokenField_js__WEBPACK_IMPORTED_MODULE_0__.isTokenField)(key) && typeof value === 'string') { value = new _structuredfield_SfToken_js__WEBPACK_IMPORTED_MODULE_2__.SfToken(value); } results[key] = value; }); return results; } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmsd/CMSD_DYNAMIC.js": /*!***************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmsd/CMSD_DYNAMIC.js ***! \***************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMSD_DYNAMIC: function() { return /* binding */ CMSD_DYNAMIC; } /* harmony export */ }); /** * CMSD dynamic header name. * * @group CMSD * * @beta */ const CMSD_DYNAMIC = 'CMSD-Dynamic'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmsd/CMSD_STATIC.js": /*!**************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmsd/CMSD_STATIC.js ***! \**************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CMSD_STATIC: function() { return /* binding */ CMSD_STATIC; } /* harmony export */ }); /** * CMSD static header name. * * @group CMSD * * @beta */ const CMSD_STATIC = 'CMSD-Static'; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmsd/CmsdObjectType.js": /*!*****************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmsd/CmsdObjectType.js ***! \*****************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CmsdObjectType: function() { return /* binding */ CmsdObjectType; } /* harmony export */ }); /* harmony import */ var _cta_CmObjectType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cta/CmObjectType.js */ "./node_modules/@svta/common-media-library/dist/cta/CmObjectType.js"); /** * Common Media Server Data Object Type * * @group CMSD * * @enum * * @beta */ const CmsdObjectType = _cta_CmObjectType_js__WEBPACK_IMPORTED_MODULE_0__.CmObjectType; /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmsd/decodeCmsdDynamic.js": /*!********************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmsd/decodeCmsdDynamic.js ***! \********************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ decodeCmsdDynamic: function() { return /* binding */ decodeCmsdDynamic; } /* harmony export */ }); /* harmony import */ var _structuredfield_decodeSfList_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../structuredfield/decodeSfList.js */ "./node_modules/@svta/common-media-library/dist/structuredfield/decodeSfList.js"); /** * Decode a CMSD dynamic string to an object. * * @param cmsd - The CMSD string to decode. * * @returns The decoded CMSD object. * * @group CMSD * * @beta */ function decodeCmsdDynamic(cmsd) { if (!cmsd) { return []; } const sfDict = (0,_structuredfield_decodeSfList_js__WEBPACK_IMPORTED_MODULE_0__.decodeSfList)(cmsd); return sfDict; } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cmsd/decodeCmsdStatic.js": /*!*******************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cmsd/decodeCmsdStatic.js ***! \*******************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ decodeCmsdStatic: function() { return /* binding */ decodeCmsdStatic; } /* harmony export */ }); /* harmony import */ var _cta_utils_symbolToStr_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cta/utils/symbolToStr.js */ "./node_modules/@svta/common-media-library/dist/cta/utils/symbolToStr.js"); /* harmony import */ var _structuredfield_decodeSfDict_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../structuredfield/decodeSfDict.js */ "./node_modules/@svta/common-media-library/dist/structuredfield/decodeSfDict.js"); /** * Decode a CMSD Static dict string to an object. * * @param cmsd - The CMSD string to decode. * * @returns The decoded CMSD object. * * @group CMSD * * @beta */ function decodeCmsdStatic(cmsd) { if (!cmsd) { return {}; } return Object.entries((0,_structuredfield_decodeSfDict_js__WEBPACK_IMPORTED_MODULE_1__.decodeSfDict)(cmsd)).reduce((acc, _ref) => { let [key, item] = _ref; const { value } = item; acc[key] = typeof value === 'symbol' ? (0,_cta_utils_symbolToStr_js__WEBPACK_IMPORTED_MODULE_0__.symbolToStr)(value) : value; return acc; }, {}); } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cta/608/CaptionScreen.js": /*!*******************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cta/608/CaptionScreen.js ***! \*******************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CaptionScreen: function() { return /* binding */ CaptionScreen; } /* harmony export */ }); /* harmony import */ var _CaptionsLogger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CaptionsLogger.js */ "./node_modules/@svta/common-media-library/dist/cta/608/CaptionsLogger.js"); /* harmony import */ var _Row_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Row.js */ "./node_modules/@svta/common-media-library/dist/cta/608/Row.js"); /* harmony import */ var _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/NR_ROWS.js */ "./node_modules/@svta/common-media-library/dist/cta/608/utils/NR_ROWS.js"); /* harmony import */ var _VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./VerboseLevel.js */ "./node_modules/@svta/common-media-library/dist/cta/608/VerboseLevel.js"); /** * * This code was ported from the dash.js project at: * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2 * * The original copyright appears below: * * The copyright in this software is being made available under the BSD License, * included below. This software may be subject to other third party and contributor * rights, including patent rights, and no such rights are granted under this license. * * Copyright (c) 2015-2016, DASH Industry Forum. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * 2. Neither the name of Dash Industry Forum nor the names of its * contributors may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * Keep a CTA-608 screen of 32x15 styled characters * * @group CTA-608 * @beta */ class CaptionScreen { constructor() { let logger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _CaptionsLogger_js__WEBPACK_IMPORTED_MODULE_0__.CaptionsLogger(); this.rows = []; this.currRow = _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS - 1; this.nrRollUpRows = null; this.lastOutputScreen = null; for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { this.rows.push(new _Row_js__WEBPACK_IMPORTED_MODULE_1__.Row(logger)); } this.logger = logger; } reset() { for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { this.rows[i].clear(); } this.currRow = _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS - 1; } equals(other) { let equal = true; for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { if (!this.rows[i].equals(other.rows[i])) { equal = false; break; } } return equal; } copy(other) { for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { this.rows[i].copy(other.rows[i]); } } isEmpty() { let empty = true; for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { if (!this.rows[i].isEmpty()) { empty = false; break; } } return empty; } backSpace() { const row = this.rows[this.currRow]; row.backSpace(); } clearToEndOfRow() { const row = this.rows[this.currRow]; row.clearToEndOfRow(); } /** * Insert a character (without styling) in the current row. */ insertChar(char) { const row = this.rows[this.currRow]; row.insertChar(char); } setPen(styles) { const row = this.rows[this.currRow]; row.setPenStyles(styles); } moveCursor(relPos) { const row = this.rows[this.currRow]; row.moveCursor(relPos); } setCursor(absPos) { this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__.VerboseLevel.INFO, 'setCursor: ' + absPos); const row = this.rows[this.currRow]; row.setCursor(absPos); } setPAC(pacData) { this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__.VerboseLevel.INFO, () => 'pacData = ' + JSON.stringify(pacData)); let newRow = pacData.row - 1; if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) { newRow = this.nrRollUpRows - 1; } // Make sure this only affects Roll-up Captions by checking this.nrRollUpRows if (this.nrRollUpRows && this.currRow !== newRow) { // clear all rows first for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { this.rows[i].clear(); } // Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location // topRowIndex - the start of rows to copy (inclusive index) const topRowIndex = this.currRow + 1 - this.nrRollUpRows; // We only copy if the last position was already shown. // We use the cueStartTime value to check this. const lastOutputScreen = this.lastOutputScreen; if (lastOutputScreen) { const prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime; const time = this.logger.time; if (prevLineTime !== null && time !== null && prevLineTime < time) { for (let i = 0; i < this.nrRollUpRows; i++) { this.rows[newRow - this.nrRollUpRows + i + 1].copy(lastOutputScreen.rows[topRowIndex + i]); } } } } this.currRow = newRow; const row = this.rows[this.currRow]; if (pacData.indent !== null) { const indent = pacData.indent; const prevPos = Math.max(indent - 1, 0); row.setCursor(pacData.indent); pacData.color = row.chars[prevPos].penState.foreground; } const styles = { foreground: pacData.color, underline: pacData.underline, italics: pacData.italics, background: 'black', flash: false }; this.setPen(styles); } /** * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility). */ setBkgData(bkgData) { this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__.VerboseLevel.INFO, () => 'bkgData = ' + JSON.stringify(bkgData)); this.backSpace(); this.setPen(bkgData); this.insertChar(0x20); // Space } setRollUpRows(nrRows) { this.nrRollUpRows = nrRows; } rollUp() { if (this.nrRollUpRows === null) { this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__.VerboseLevel.DEBUG, 'roll_up but nrRollUpRows not set yet'); return; // Not properly setup } this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__.VerboseLevel.TEXT, () => this.getDisplayText()); const topRowIndex = this.currRow + 1 - this.nrRollUpRows; const topRow = this.rows.splice(topRowIndex, 1)[0]; topRow.clear(); this.rows.splice(this.currRow, 0, topRow); this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_3__.VerboseLevel.INFO, 'Rolling up'); } /** * Get all non-empty rows with as unicode text. */ getDisplayText(asOneRow) { asOneRow = asOneRow || false; const displayText = []; let text = ''; let rowNr = -1; for (let i = 0; i < _utils_NR_ROWS_js__WEBPACK_IMPORTED_MODULE_2__.NR_ROWS; i++) { const rowText = this.rows[i].getTextString(); if (rowText) { rowNr = i + 1; if (asOneRow) { displayText.push('Row ' + rowNr + ": '" + rowText + "'"); } else { displayText.push(rowText.trim()); } } } if (displayText.length > 0) { if (asOneRow) { text = '[' + displayText.join(' | ') + ']'; } else { text = displayText.join('\n'); } } return text; } getTextAndFormat() { return this.rows; } } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cta/608/CaptionsLogger.js": /*!********************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cta/608/CaptionsLogger.js ***! \********************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CaptionsLogger: function() { return /* binding */ CaptionsLogger; } /* harmony export */ }); /* harmony import */ var _VerboseLevel_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./VerboseLevel.js */ "./node_modules/@svta/common-media-library/dist/cta/608/VerboseLevel.js"); /** * * This code was ported from the dash.js project at: * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2 * * The original copyright appears below: * * The copyright in this software is being made available under the BSD License, * included below. This software may be subject to other third party and contributor * rights, including patent rights, and no such rights are granted under this license. * * Copyright (c) 2015-2016, DASH Industry Forum. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * 2. Neither the name of Dash Industry Forum nor the names of its * contributors may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * CaptionsLogger. To be removed in the future. * * @group CTA-608 * @beta */ class CaptionsLogger { constructor() { this.time = null; this.verboseLevel = _VerboseLevel_js__WEBPACK_IMPORTED_MODULE_0__.VerboseLevel.ERROR; } log(severity, msg) { if (this.verboseLevel >= severity) { const m = typeof msg === 'function' ? msg() : msg; console.log(`${this.time} [${severity}] ${m}`); } } } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cta/608/Cta608Channel.js": /*!*******************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cta/608/Cta608Channel.js ***! \*******************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Cta608Channel: function() { return /* binding */ Cta608Channel; } /* harmony export */ }); /* harmony import */ var _CaptionScreen_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CaptionScreen.js */ "./node_modules/@svta/common-media-library/dist/cta/608/CaptionScreen.js"); /* harmony import */ var _CaptionsLogger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CaptionsLogger.js */ "./node_modules/@svta/common-media-library/dist/cta/608/CaptionsLogger.js"); /* harmony import */ var _VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./VerboseLevel.js */ "./node_modules/@svta/common-media-library/dist/cta/608/VerboseLevel.js"); /** * * This code was ported from the dash.js project at: * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2 * * The original copyright appears below: * * The copyright in this software is being made available under the BSD License, * included below. This software may be subject to other third party and contributor * rights, including patent rights, and no such rights are granted under this license. * * Copyright (c) 2015-2016, DASH Industry Forum. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * 2. Neither the name of Dash Industry Forum nor the names of its * contributors may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * CTA-608 Channel * * @group CTA-608 * @beta */ class Cta608Channel { constructor(channelNumber, outputFilter) { let logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new _CaptionsLogger_js__WEBPACK_IMPORTED_MODULE_1__.CaptionsLogger(); this.chNr = channelNumber; this.outputFilter = outputFilter; this.mode = null; this.displayedMemory = new _CaptionScreen_js__WEBPACK_IMPORTED_MODULE_0__.CaptionScreen(logger); this.nonDisplayedMemory = new _CaptionScreen_js__WEBPACK_IMPORTED_MODULE_0__.CaptionScreen(logger); this.lastOutputScreen = new _CaptionScreen_js__WEBPACK_IMPORTED_MODULE_0__.CaptionScreen(logger); this.writeScreen = this.displayedMemory; this.mode = null; this.cueStartTime = null; // Keeps track of where a cue started. this.logger = logger; this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'new Cea608Channel(' + this.chNr + ')'); } reset() { var _a, _b; this.mode = null; this.displayedMemory.reset(); this.nonDisplayedMemory.reset(); this.lastOutputScreen.reset(); (_b = (_a = this.outputFilter) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a); this.writeScreen = this.displayedMemory; this.mode = null; this.cueStartTime = null; } setPAC(pacData) { this.writeScreen.setPAC(pacData); } setBkgData(bkgData) { this.writeScreen.setBkgData(bkgData); } setMode(newMode) { if (newMode === this.mode) { return; } this.mode = newMode; this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, () => 'MODE=' + newMode); if (this.mode === 'MODE_POP-ON') { this.writeScreen = this.nonDisplayedMemory; } else { this.writeScreen = this.displayedMemory; this.writeScreen.reset(); } if (this.mode !== 'MODE_ROLL-UP') { this.displayedMemory.setRollUpRows(null); this.nonDisplayedMemory.setRollUpRows(null); } this.mode = newMode; } insertChars(chars) { for (let i = 0; i < chars.length; i++) { this.writeScreen.insertChar(chars[i]); } const screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP'; this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, () => screen + ': ' + this.writeScreen.getDisplayText(true)); if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') { this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.TEXT, () => 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true)); this.outputDataUpdate(); } } ccRCL() { // Resume Caption Loading (switch mode to Pop On) this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'RCL - Resume Caption Loading'); this.setMode('MODE_POP-ON'); } ccBS() { // BackSpace this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'BS - BackSpace'); if (this.mode === 'MODE_TEXT') { return; } this.writeScreen.backSpace(); if (this.writeScreen === this.displayedMemory) { this.outputDataUpdate(); } } ccAOF() { // Reserved (formerly Alarm Off) } ccAON() { // Reserved (formerly Alarm On) } ccDER() { // Delete to End of Row this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'DER- Delete to End of Row'); this.writeScreen.clearToEndOfRow(); this.outputDataUpdate(); } ccRU(nrRows) { // Roll-Up Captions-2,3,or 4 Rows this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'RU(' + nrRows + ') - Roll Up'); this.writeScreen = this.displayedMemory; this.setMode('MODE_ROLL-UP'); this.writeScreen.setRollUpRows(nrRows); } ccFON() { // Flash On this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'FON - Flash On'); this.writeScreen.setPen({ flash: true }); } ccRDC() { // Resume Direct Captioning (switch mode to PaintOn) this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'RDC - Resume Direct Captioning'); this.setMode('MODE_PAINT-ON'); } ccTR() { // Text Restart in text mode (not supported, however) this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'TR'); this.setMode('MODE_TEXT'); } ccRTD() { // Resume Text Display in Text mode (not supported, however) this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'RTD'); this.setMode('MODE_TEXT'); } ccEDM() { // Erase Displayed Memory this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'EDM - Erase Displayed Memory'); this.displayedMemory.reset(); this.outputDataUpdate(true); } ccCR() { // Carriage Return this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'CR - Carriage Return'); this.writeScreen.rollUp(); this.outputDataUpdate(true); } ccENM() { // Erase Non-Displayed Memory this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'ENM - Erase Non-displayed Memory'); this.nonDisplayedMemory.reset(); } ccEOC() { // End of Caption (Flip Memories) this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'EOC - End Of Caption'); if (this.mode === 'MODE_POP-ON') { const tmp = this.displayedMemory; this.displayedMemory = this.nonDisplayedMemory; this.nonDisplayedMemory = tmp; this.writeScreen = this.nonDisplayedMemory; this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.TEXT, () => 'DISP: ' + this.displayedMemory.getDisplayText()); } this.outputDataUpdate(true); } ccTO(nrCols) { // Tab Offset 1,2, or 3 columns this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'TO(' + nrCols + ') - Tab Offset'); this.writeScreen.moveCursor(nrCols); } ccMIDROW(secondByte) { // Parse MIDROW command const styles = { flash: false }; styles.underline = secondByte % 2 === 1; styles.italics = secondByte >= 0x2e; if (!styles.italics) { const colorIndex = Math.floor(secondByte / 2) - 0x10; const colors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta']; styles.foreground = colors[colorIndex]; } else { styles.foreground = 'white'; } this.logger.log(_VerboseLevel_js__WEBPACK_IMPORTED_MODULE_2__.VerboseLevel.INFO, 'MIDROW: ' + JSON.stringify(styles)); this.writeScreen.setPen(styles); } outputDataUpdate() { let dispatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; const time = this.logger.time; if (time === null) { return; } if (this.outputFilter) { if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) { // Start of a new cue this.cueStartTime = time; } else { if (!this.displayedMemory.equals(this.lastOutputScreen)) { this.outputFilter.newCue(this.cueStartTime, time, this.lastOutputScreen); if (dispatch && this.outputFilter.dispatchCue) { this.outputFilter.dispatchCue(); } this.cueStartTime = this.displayedMemory.isEmpty() ? null : time; } } this.lastOutputScreen.copy(this.displayedMemory); } } cueSplitAtTime(t) { if (this.outputFilter) { if (!this.displayedMemory.isEmpty()) { if (this.outputFilter.newCue) { this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory); } this.cueStartTime = t; } } } } /***/ }), /***/ "./node_modules/@svta/common-media-library/dist/cta/608/Cta608Parser.js": /*!******************************************************************************!*\ !*** ./node_modules/@svta/common-media-library/dist/cta/608/Cta608Parser.js ***! \******************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Cta608Parser: function() { return /* binding */ Cta608Parser; } /* harmony export */ }); /* harmony import */ var _CaptionsLogger_js__WEBPACK_IMPORTED_MODULE_0__