@supraio/client-daemon-js 0.0.0-master.322 → 0.0.0-master.429
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/daemon.html +1 -1
- package/daemon.js +2843 -274
- package/daemon.js.map +4 -4
- package/nacl-decoder_armv7.nexe +0 -0
- package/nacl-decoder_i686.nexe +0 -0
- package/nacl-decoder_x86-64.nexe +0 -0
- package/package.json +3 -2
- package/samsung-wasm-decoder.js +22 -0
- package/samsung-wasm-decoder.js.mem +0 -0
- package/samsung-wasm-decoder.wasm +0 -0
- package/samsung-wasm-decoder.worker.js +228 -0
- package/screen/control.d.ts +72 -0
- package/screen/nacltcp.d.ts +9 -0
- package/screen/options.d.ts +14 -0
- package/screen/samsungwasmdecoder.d.ts +9 -0
- package/screen/samsungwasmtcp.d.ts +9 -0
- package/screen/workerFrameConnection.d.ts +18 -0
- package/screen.css +13 -0
- package/screen.html +1 -1
- package/screen.js +3075 -238
- package/screen.js.map +4 -4
- package/sdk.d.ts +2 -1
- package/sdk.js +3117 -240
- package/sdk.js.map +4 -4
- package/supra-client-daemon.js +49045 -47387
- package/supra-client-daemon.js.map +1 -1
- package/supra-client-daemon.wasm +0 -0
- package/supra-client-screen.js +110378 -107636
- package/supra-client-screen.js.map +1 -1
- package/supra-client-screen.wasm +0 -0
package/screen.js
CHANGED
|
@@ -16922,6 +16922,20 @@
|
|
|
16922
16922
|
JSToNaClMessageType2[JSToNaClMessageType2["Reset"] = 5] = "Reset";
|
|
16923
16923
|
JSToNaClMessageType2[JSToNaClMessageType2["RecyclePicture"] = 6] = "RecyclePicture";
|
|
16924
16924
|
JSToNaClMessageType2[JSToNaClMessageType2["DecodeAndRender"] = 7] = "DecodeAndRender";
|
|
16925
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPConnect"] = 16] = "TCPConnect";
|
|
16926
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPSend"] = 17] = "TCPSend";
|
|
16927
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPRecv"] = 18] = "TCPRecv";
|
|
16928
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPStreamWrite"] = 19] = "TCPStreamWrite";
|
|
16929
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPStreamRead"] = 20] = "TCPStreamRead";
|
|
16930
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPClose"] = 21] = "TCPClose";
|
|
16931
|
+
JSToNaClMessageType2[JSToNaClMessageType2["TCPIsConnected"] = 22] = "TCPIsConnected";
|
|
16932
|
+
JSToNaClMessageType2[JSToNaClMessageType2["CollectorCreate"] = 23] = "CollectorCreate";
|
|
16933
|
+
JSToNaClMessageType2[JSToNaClMessageType2["CollectorStart"] = 24] = "CollectorStart";
|
|
16934
|
+
JSToNaClMessageType2[JSToNaClMessageType2["CollectorStop"] = 25] = "CollectorStop";
|
|
16935
|
+
JSToNaClMessageType2[JSToNaClMessageType2["CollectorDestroy"] = 26] = "CollectorDestroy";
|
|
16936
|
+
JSToNaClMessageType2[JSToNaClMessageType2["CollectFrame"] = 27] = "CollectFrame";
|
|
16937
|
+
JSToNaClMessageType2[JSToNaClMessageType2["FrameRelease"] = 28] = "FrameRelease";
|
|
16938
|
+
JSToNaClMessageType2[JSToNaClMessageType2["DecodeAndRenderRef"] = 29] = "DecodeAndRenderRef";
|
|
16925
16939
|
})(JSToNaClMessageType || (exports.JSToNaClMessageType = JSToNaClMessageType = {}));
|
|
16926
16940
|
var NaClToJSMessageType;
|
|
16927
16941
|
(function(NaClToJSMessageType2) {
|
|
@@ -16932,6 +16946,20 @@
|
|
|
16932
16946
|
NaClToJSMessageType2[NaClToJSMessageType2["FlushResult"] = 4] = "FlushResult";
|
|
16933
16947
|
NaClToJSMessageType2[NaClToJSMessageType2["ResetResult"] = 5] = "ResetResult";
|
|
16934
16948
|
NaClToJSMessageType2[NaClToJSMessageType2["DecodeAndRenderResult"] = 7] = "DecodeAndRenderResult";
|
|
16949
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPConnect"] = 16] = "TCPConnect";
|
|
16950
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPSend"] = 17] = "TCPSend";
|
|
16951
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPRecv"] = 18] = "TCPRecv";
|
|
16952
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPStreamWrite"] = 19] = "TCPStreamWrite";
|
|
16953
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPStreamRead"] = 20] = "TCPStreamRead";
|
|
16954
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPClose"] = 21] = "TCPClose";
|
|
16955
|
+
NaClToJSMessageType2[NaClToJSMessageType2["TCPIsConnected"] = 22] = "TCPIsConnected";
|
|
16956
|
+
NaClToJSMessageType2[NaClToJSMessageType2["CollectorCreate"] = 23] = "CollectorCreate";
|
|
16957
|
+
NaClToJSMessageType2[NaClToJSMessageType2["CollectorStart"] = 24] = "CollectorStart";
|
|
16958
|
+
NaClToJSMessageType2[NaClToJSMessageType2["CollectorStop"] = 25] = "CollectorStop";
|
|
16959
|
+
NaClToJSMessageType2[NaClToJSMessageType2["CollectorDestroy"] = 26] = "CollectorDestroy";
|
|
16960
|
+
NaClToJSMessageType2[NaClToJSMessageType2["CollectFrame"] = 27] = "CollectFrame";
|
|
16961
|
+
NaClToJSMessageType2[NaClToJSMessageType2["FrameRelease"] = 28] = "FrameRelease";
|
|
16962
|
+
NaClToJSMessageType2[NaClToJSMessageType2["DecodeAndRenderRef"] = 29] = "DecodeAndRenderRef";
|
|
16935
16963
|
NaClToJSMessageType2[NaClToJSMessageType2["UnknownDataType"] = 254] = "UnknownDataType";
|
|
16936
16964
|
NaClToJSMessageType2[NaClToJSMessageType2["UnknownMessageType"] = 255] = "UnknownMessageType";
|
|
16937
16965
|
})(NaClToJSMessageType || (exports.NaClToJSMessageType = NaClToJSMessageType = {}));
|
|
@@ -17046,9 +17074,41 @@
|
|
|
17046
17074
|
/** @class */
|
|
17047
17075
|
function() {
|
|
17048
17076
|
function MessageSender2(naclModuleEl, messageListeners, timeoutMs) {
|
|
17077
|
+
var _this = this;
|
|
17049
17078
|
this.naclModuleEl = naclModuleEl;
|
|
17050
17079
|
this.messageListeners = messageListeners;
|
|
17051
17080
|
this.timeoutMs = timeoutMs;
|
|
17081
|
+
this.nextRequestId = 1;
|
|
17082
|
+
this.pendingRequests = /* @__PURE__ */ new Map();
|
|
17083
|
+
this.timedOutConnectRequests = /* @__PURE__ */ new Set();
|
|
17084
|
+
this.handleRequestMessage = function(message) {
|
|
17085
|
+
if (message.type < messages_1.NaClToJSMessageType.TCPConnect || message.type > messages_1.NaClToJSMessageType.DecodeAndRenderRef) {
|
|
17086
|
+
return;
|
|
17087
|
+
}
|
|
17088
|
+
if (message.payload.byteLength < 8) {
|
|
17089
|
+
return;
|
|
17090
|
+
}
|
|
17091
|
+
var view = new DataView(message.payload);
|
|
17092
|
+
var requestId = view.getUint32(0, true);
|
|
17093
|
+
var status = view.getInt32(4, true);
|
|
17094
|
+
var payload = message.payload.slice(8);
|
|
17095
|
+
var pending = _this.pendingRequests.get(requestId);
|
|
17096
|
+
if (!pending) {
|
|
17097
|
+
_this.handleLateResult(message.type, requestId, status, payload);
|
|
17098
|
+
return;
|
|
17099
|
+
}
|
|
17100
|
+
if (message.type !== pending.resultMessageType) {
|
|
17101
|
+
return;
|
|
17102
|
+
}
|
|
17103
|
+
window.clearTimeout(pending.timeoutHandler);
|
|
17104
|
+
_this.pendingRequests.delete(requestId);
|
|
17105
|
+
if (status !== 0) {
|
|
17106
|
+
pending.reject(new Error(_this.decodeErrorPayload(payload, status)));
|
|
17107
|
+
return;
|
|
17108
|
+
}
|
|
17109
|
+
pending.resolve({ requestId, status, payload });
|
|
17110
|
+
};
|
|
17111
|
+
this.messageListeners.add(this.handleRequestMessage);
|
|
17052
17112
|
}
|
|
17053
17113
|
MessageSender2.prototype.sendWithoutResult = function(message) {
|
|
17054
17114
|
this.naclModuleEl.postMessage((0, messageConvertor_1.convertMessageToArrayBuffer)(message));
|
|
@@ -17078,6 +17138,75 @@
|
|
|
17078
17138
|
});
|
|
17079
17139
|
});
|
|
17080
17140
|
};
|
|
17141
|
+
MessageSender2.prototype.sendWithRequestId = function(messageType_1, payload_1, resultMessageType_1) {
|
|
17142
|
+
return __awaiter(this, arguments, void 0, function(messageType, payload, resultMessageType, timeoutMs) {
|
|
17143
|
+
var requestId, payloadLength, requestPayload, requestView, message;
|
|
17144
|
+
var _this = this;
|
|
17145
|
+
var _a;
|
|
17146
|
+
if (timeoutMs === void 0) {
|
|
17147
|
+
timeoutMs = this.timeoutMs;
|
|
17148
|
+
}
|
|
17149
|
+
return __generator(this, function(_b) {
|
|
17150
|
+
requestId = this.nextRequestId++;
|
|
17151
|
+
if (this.nextRequestId > 4294967295) {
|
|
17152
|
+
this.nextRequestId = 1;
|
|
17153
|
+
}
|
|
17154
|
+
payloadLength = (_a = payload === null || payload === void 0 ? void 0 : payload.byteLength) !== null && _a !== void 0 ? _a : 0;
|
|
17155
|
+
requestPayload = new ArrayBuffer(4 + payloadLength);
|
|
17156
|
+
requestView = new DataView(requestPayload);
|
|
17157
|
+
requestView.setUint32(0, requestId, true);
|
|
17158
|
+
if (payload) {
|
|
17159
|
+
new Uint8Array(requestPayload, 4).set(new Uint8Array(payload));
|
|
17160
|
+
}
|
|
17161
|
+
message = {
|
|
17162
|
+
type: messageType,
|
|
17163
|
+
payload: requestPayload
|
|
17164
|
+
};
|
|
17165
|
+
return [2, new Promise(function(resolve, reject) {
|
|
17166
|
+
var timeoutHandler = window.setTimeout(function() {
|
|
17167
|
+
_this.pendingRequests.delete(requestId);
|
|
17168
|
+
if (messageType === messages_1.JSToNaClMessageType.TCPConnect) {
|
|
17169
|
+
_this.timedOutConnectRequests.add(requestId);
|
|
17170
|
+
}
|
|
17171
|
+
reject(new Error("Timeout of message ".concat(messages_1.JSToNaClMessageType[messageType])));
|
|
17172
|
+
}, timeoutMs);
|
|
17173
|
+
_this.pendingRequests.set(requestId, {
|
|
17174
|
+
resultMessageType,
|
|
17175
|
+
resolve,
|
|
17176
|
+
reject,
|
|
17177
|
+
timeoutHandler,
|
|
17178
|
+
sourceMessageType: messageType
|
|
17179
|
+
});
|
|
17180
|
+
_this.naclModuleEl.postMessage((0, messageConvertor_1.convertMessageToArrayBuffer)(message));
|
|
17181
|
+
})];
|
|
17182
|
+
});
|
|
17183
|
+
});
|
|
17184
|
+
};
|
|
17185
|
+
MessageSender2.prototype.handleLateResult = function(messageType, requestId, status, payload) {
|
|
17186
|
+
if (messageType === messages_1.NaClToJSMessageType.TCPConnect && status === 0 && this.timedOutConnectRequests.has(requestId) && payload.byteLength >= 4) {
|
|
17187
|
+
this.timedOutConnectRequests.delete(requestId);
|
|
17188
|
+
var handle = new DataView(payload).getUint32(0, true);
|
|
17189
|
+
var closePayload = new ArrayBuffer(4);
|
|
17190
|
+
new DataView(closePayload).setUint32(0, handle, true);
|
|
17191
|
+
void this.sendWithRequestId(messages_1.JSToNaClMessageType.TCPClose, closePayload, messages_1.NaClToJSMessageType.TCPClose).catch(function() {
|
|
17192
|
+
return void 0;
|
|
17193
|
+
});
|
|
17194
|
+
}
|
|
17195
|
+
};
|
|
17196
|
+
MessageSender2.prototype.decodeErrorPayload = function(payload, status) {
|
|
17197
|
+
if (payload.byteLength === 0) {
|
|
17198
|
+
return "NaCl request failed with status ".concat(status);
|
|
17199
|
+
}
|
|
17200
|
+
var bytes = new Uint8Array(payload);
|
|
17201
|
+
var message = "";
|
|
17202
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
17203
|
+
if (bytes[i] === 0) {
|
|
17204
|
+
break;
|
|
17205
|
+
}
|
|
17206
|
+
message += String.fromCharCode(bytes[i]);
|
|
17207
|
+
}
|
|
17208
|
+
return message || "NaCl request failed with status ".concat(status);
|
|
17209
|
+
};
|
|
17081
17210
|
return MessageSender2;
|
|
17082
17211
|
}()
|
|
17083
17212
|
);
|
|
@@ -17130,9 +17259,9 @@
|
|
|
17130
17259
|
}
|
|
17131
17260
|
});
|
|
17132
17261
|
|
|
17133
|
-
// node_modules/@signageos/nacl-decoder/dist/NaClDecoder/
|
|
17134
|
-
var
|
|
17135
|
-
"node_modules/@signageos/nacl-decoder/dist/NaClDecoder/
|
|
17262
|
+
// node_modules/@signageos/nacl-decoder/dist/NaClDecoder/naclTCP.js
|
|
17263
|
+
var require_naclTCP = __commonJS({
|
|
17264
|
+
"node_modules/@signageos/nacl-decoder/dist/NaClDecoder/naclTCP.js"(exports) {
|
|
17136
17265
|
"use strict";
|
|
17137
17266
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
17138
17267
|
function adopt(value) {
|
|
@@ -17230,265 +17359,872 @@
|
|
|
17230
17359
|
return { value: op[0] ? op[1] : void 0, done: true };
|
|
17231
17360
|
}
|
|
17232
17361
|
};
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
17244
|
-
} finally {
|
|
17245
|
-
if (e) throw e.error;
|
|
17362
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17363
|
+
exports.NaClTCPStream = exports.NaClTCPPacket = exports.NaClTCPStreamConnection = exports.NaClTCPPacketConnection = exports.NaClFrameCollector = void 0;
|
|
17364
|
+
var messages_1 = require_messages();
|
|
17365
|
+
var DEFAULT_MAX_PACKET_SIZE = 65535;
|
|
17366
|
+
var CONNECT_LATE_RESULT_GRACE_MS = 2e3;
|
|
17367
|
+
function parseHost(host) {
|
|
17368
|
+
if (host.startsWith("[")) {
|
|
17369
|
+
var end = host.indexOf("]");
|
|
17370
|
+
if (end < 0 || host[end + 1] !== ":") {
|
|
17371
|
+
throw new Error('Invalid host "'.concat(host, '". Expected "[IPv6]:port".'));
|
|
17246
17372
|
}
|
|
17373
|
+
return {
|
|
17374
|
+
hostname: host.slice(1, end),
|
|
17375
|
+
port: parsePort(host.slice(end + 2), host)
|
|
17376
|
+
};
|
|
17247
17377
|
}
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17252
|
-
|
|
17253
|
-
|
|
17254
|
-
|
|
17378
|
+
var separator = host.lastIndexOf(":");
|
|
17379
|
+
if (separator <= 0 || separator === host.length - 1) {
|
|
17380
|
+
throw new Error('Invalid host "'.concat(host, '". Expected "hostname:port".'));
|
|
17381
|
+
}
|
|
17382
|
+
var hostname = host.slice(0, separator);
|
|
17383
|
+
if (hostname.indexOf(":") >= 0) {
|
|
17384
|
+
throw new Error('Invalid host "'.concat(host, '". IPv6 literals must use "[IPv6]:port".'));
|
|
17385
|
+
}
|
|
17386
|
+
return {
|
|
17387
|
+
hostname,
|
|
17388
|
+
port: parsePort(host.slice(separator + 1), host)
|
|
17389
|
+
};
|
|
17390
|
+
}
|
|
17391
|
+
function parsePort(portValue, host) {
|
|
17392
|
+
if (!/^[0-9]+$/.test(portValue)) {
|
|
17393
|
+
throw new Error('Invalid port in host "'.concat(host, '".'));
|
|
17394
|
+
}
|
|
17395
|
+
var port = Number(portValue);
|
|
17396
|
+
if (port < 1 || port > 65535) {
|
|
17397
|
+
throw new Error('Port out of range in host "'.concat(host, '".'));
|
|
17398
|
+
}
|
|
17399
|
+
return port;
|
|
17400
|
+
}
|
|
17401
|
+
function createConnectPayload(mode, options) {
|
|
17402
|
+
var parsed = parseHost(options.host);
|
|
17403
|
+
var hostBytes = encodeAscii(parsed.hostname);
|
|
17404
|
+
if (hostBytes.byteLength > 255) {
|
|
17405
|
+
throw new Error('Host name is too long: "'.concat(parsed.hostname, '".'));
|
|
17406
|
+
}
|
|
17407
|
+
var payload = new ArrayBuffer(10 + hostBytes.byteLength);
|
|
17408
|
+
var view = new DataView(payload);
|
|
17409
|
+
view.setUint8(0, mode);
|
|
17410
|
+
view.setUint8(1, options.secure ? 1 : 0);
|
|
17411
|
+
view.setUint32(2, options.timeoutMs, true);
|
|
17412
|
+
view.setUint16(6, parsed.port, true);
|
|
17413
|
+
view.setUint16(8, hostBytes.byteLength, true);
|
|
17414
|
+
new Uint8Array(payload, 10).set(hostBytes);
|
|
17415
|
+
return payload;
|
|
17416
|
+
}
|
|
17417
|
+
function encodeAscii(value) {
|
|
17418
|
+
var bytes = new Uint8Array(value.length);
|
|
17419
|
+
for (var i = 0; i < value.length; i++) {
|
|
17420
|
+
var code = value.charCodeAt(i);
|
|
17421
|
+
if (code > 127) {
|
|
17422
|
+
throw new Error('Only ASCII host names are supported: "'.concat(value, '".'));
|
|
17255
17423
|
}
|
|
17424
|
+
bytes[i] = code;
|
|
17256
17425
|
}
|
|
17257
|
-
return
|
|
17258
|
-
}
|
|
17259
|
-
|
|
17260
|
-
|
|
17261
|
-
|
|
17262
|
-
|
|
17263
|
-
|
|
17426
|
+
return bytes;
|
|
17427
|
+
}
|
|
17428
|
+
function createHandlePayload(handle) {
|
|
17429
|
+
var payload = new ArrayBuffer(4);
|
|
17430
|
+
new DataView(payload).setUint32(0, handle, true);
|
|
17431
|
+
return payload;
|
|
17432
|
+
}
|
|
17433
|
+
function createHandleAndSizePayload(handle, size) {
|
|
17434
|
+
var payload = new ArrayBuffer(8);
|
|
17435
|
+
var view = new DataView(payload);
|
|
17436
|
+
view.setUint32(0, handle, true);
|
|
17437
|
+
view.setUint32(4, size, true);
|
|
17438
|
+
return payload;
|
|
17439
|
+
}
|
|
17440
|
+
function createHandleAndDataPayload(handle, data) {
|
|
17441
|
+
var payload = new ArrayBuffer(4 + data.byteLength);
|
|
17442
|
+
new DataView(payload).setUint32(0, handle, true);
|
|
17443
|
+
new Uint8Array(payload, 4).set(new Uint8Array(data));
|
|
17444
|
+
return payload;
|
|
17445
|
+
}
|
|
17446
|
+
var NaClFrameCollector = (
|
|
17264
17447
|
/** @class */
|
|
17265
17448
|
function() {
|
|
17266
|
-
function
|
|
17449
|
+
function NaClFrameCollector2(messageSender, collectorHandle) {
|
|
17267
17450
|
this.messageSender = messageSender;
|
|
17268
|
-
this.
|
|
17451
|
+
this.collectorHandle = collectorHandle;
|
|
17452
|
+
this.destroyed = false;
|
|
17269
17453
|
}
|
|
17270
|
-
|
|
17271
|
-
return
|
|
17272
|
-
return __generator(this, function(_a) {
|
|
17273
|
-
(0, module_1.removeNaClModule)(this.naclModuleEl);
|
|
17274
|
-
return [
|
|
17275
|
-
2
|
|
17276
|
-
/*return*/
|
|
17277
|
-
];
|
|
17278
|
-
});
|
|
17279
|
-
});
|
|
17454
|
+
NaClFrameCollector2.prototype.getHandle = function() {
|
|
17455
|
+
return this.collectorHandle;
|
|
17280
17456
|
};
|
|
17281
|
-
|
|
17457
|
+
NaClFrameCollector2.prototype.collectFrame = function(options) {
|
|
17282
17458
|
return __awaiter(this, void 0, void 0, function() {
|
|
17283
|
-
var
|
|
17459
|
+
var result, view;
|
|
17284
17460
|
var _a, _b;
|
|
17285
17461
|
return __generator(this, function(_c) {
|
|
17286
17462
|
switch (_c.label) {
|
|
17287
17463
|
case 0:
|
|
17288
|
-
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
args.profile,
|
|
17294
|
-
args.acceleration
|
|
17295
|
-
], __read(new Uint8Array(new Uint32Array([args.minPictureCount]).buffer)), false), __read(new Uint8Array(new Int32Array([width, height]).buffer)), false)).buffer
|
|
17296
|
-
};
|
|
17297
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.InitializeResult)];
|
|
17464
|
+
if (this.destroyed) {
|
|
17465
|
+
throw new Error("Frame collector destroyed");
|
|
17466
|
+
}
|
|
17467
|
+
(_a = options === null || options === void 0 ? void 0 : options.onStart) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
17468
|
+
_c.label = 1;
|
|
17298
17469
|
case 1:
|
|
17299
|
-
|
|
17300
|
-
|
|
17301
|
-
|
|
17470
|
+
_c.trys.push([1, , 3, 4]);
|
|
17471
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.CollectFrame, createHandlePayload(this.collectorHandle), messages_1.NaClToJSMessageType.CollectFrame, 2147483647)];
|
|
17472
|
+
case 2:
|
|
17473
|
+
result = _c.sent();
|
|
17474
|
+
view = new DataView(result.payload);
|
|
17475
|
+
return [2, {
|
|
17476
|
+
dataRef: view.getUint32(0, true),
|
|
17477
|
+
frameType: view.getUint8(4),
|
|
17478
|
+
timestamp: {
|
|
17479
|
+
lo: view.getUint32(5, true),
|
|
17480
|
+
hi: view.getUint32(9, true)
|
|
17481
|
+
}
|
|
17482
|
+
}];
|
|
17483
|
+
case 3:
|
|
17484
|
+
(_b = options === null || options === void 0 ? void 0 : options.onEnd) === null || _b === void 0 ? void 0 : _b.call(options);
|
|
17485
|
+
return [
|
|
17486
|
+
7
|
|
17487
|
+
/*endfinally*/
|
|
17488
|
+
];
|
|
17489
|
+
case 4:
|
|
17490
|
+
return [
|
|
17491
|
+
2
|
|
17492
|
+
/*return*/
|
|
17493
|
+
];
|
|
17302
17494
|
}
|
|
17303
17495
|
});
|
|
17304
17496
|
});
|
|
17305
17497
|
};
|
|
17306
|
-
|
|
17498
|
+
NaClFrameCollector2.prototype.destroy = function() {
|
|
17307
17499
|
return __awaiter(this, void 0, void 0, function() {
|
|
17308
|
-
var message, resultMessage, resultStatus;
|
|
17309
17500
|
return __generator(this, function(_a) {
|
|
17310
17501
|
switch (_a.label) {
|
|
17311
17502
|
case 0:
|
|
17312
|
-
if (
|
|
17313
|
-
|
|
17503
|
+
if (this.destroyed) {
|
|
17504
|
+
return [
|
|
17505
|
+
2
|
|
17506
|
+
/*return*/
|
|
17507
|
+
];
|
|
17508
|
+
}
|
|
17509
|
+
this.destroyed = true;
|
|
17510
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.CollectorDestroy, createHandlePayload(this.collectorHandle), messages_1.NaClToJSMessageType.CollectorDestroy)];
|
|
17511
|
+
case 1:
|
|
17512
|
+
_a.sent();
|
|
17513
|
+
return [
|
|
17514
|
+
2
|
|
17515
|
+
/*return*/
|
|
17516
|
+
];
|
|
17517
|
+
}
|
|
17518
|
+
});
|
|
17519
|
+
});
|
|
17520
|
+
};
|
|
17521
|
+
return NaClFrameCollector2;
|
|
17522
|
+
}()
|
|
17523
|
+
);
|
|
17524
|
+
exports.NaClFrameCollector = NaClFrameCollector;
|
|
17525
|
+
var NaClTCPPacketConnection = (
|
|
17526
|
+
/** @class */
|
|
17527
|
+
function() {
|
|
17528
|
+
function NaClTCPPacketConnection2(messageSender, handle, maxPacketSize) {
|
|
17529
|
+
this.messageSender = messageSender;
|
|
17530
|
+
this.handle = handle;
|
|
17531
|
+
this.maxPacketSize = maxPacketSize;
|
|
17532
|
+
this.frameCollector = null;
|
|
17533
|
+
this.frameCollectorStarted = false;
|
|
17534
|
+
}
|
|
17535
|
+
NaClTCPPacketConnection2.prototype.getHandle = function() {
|
|
17536
|
+
return this.handle;
|
|
17537
|
+
};
|
|
17538
|
+
NaClTCPPacketConnection2.prototype.isConnected = function() {
|
|
17539
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17540
|
+
var result;
|
|
17541
|
+
return __generator(this, function(_a) {
|
|
17542
|
+
switch (_a.label) {
|
|
17543
|
+
case 0:
|
|
17544
|
+
if (this.handle === 0) {
|
|
17545
|
+
return [2, false];
|
|
17314
17546
|
}
|
|
17315
|
-
|
|
17316
|
-
type: messages_1.JSToNaClMessageType.DecodeAndRender,
|
|
17317
|
-
payload: data
|
|
17318
|
-
};
|
|
17319
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.DecodeAndRenderResult)];
|
|
17547
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPIsConnected, createHandlePayload(this.handle), messages_1.NaClToJSMessageType.TCPIsConnected)];
|
|
17320
17548
|
case 1:
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
return [2, resultStatus];
|
|
17549
|
+
result = _a.sent();
|
|
17550
|
+
return [2, new Int8Array(result.payload)[0] === 1];
|
|
17324
17551
|
}
|
|
17325
17552
|
});
|
|
17326
17553
|
});
|
|
17327
17554
|
};
|
|
17328
|
-
|
|
17555
|
+
NaClTCPPacketConnection2.prototype.isConnecting = function() {
|
|
17329
17556
|
return __awaiter(this, void 0, void 0, function() {
|
|
17330
|
-
var
|
|
17557
|
+
var result;
|
|
17331
17558
|
return __generator(this, function(_a) {
|
|
17332
17559
|
switch (_a.label) {
|
|
17333
17560
|
case 0:
|
|
17334
|
-
if (
|
|
17335
|
-
|
|
17561
|
+
if (this.handle === 0) {
|
|
17562
|
+
return [2, false];
|
|
17336
17563
|
}
|
|
17337
|
-
|
|
17338
|
-
type: messages_1.JSToNaClMessageType.Decode,
|
|
17339
|
-
// TODO decodeId (not used in the NaCl module now)
|
|
17340
|
-
payload: args.data
|
|
17341
|
-
};
|
|
17342
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.DecodeResult)];
|
|
17564
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPIsConnected, createHandlePayload(this.handle), messages_1.NaClToJSMessageType.TCPIsConnected)];
|
|
17343
17565
|
case 1:
|
|
17344
|
-
|
|
17345
|
-
|
|
17346
|
-
return [2, resultStatus];
|
|
17566
|
+
result = _a.sent();
|
|
17567
|
+
return [2, new Int8Array(result.payload)[0] === -1];
|
|
17347
17568
|
}
|
|
17348
17569
|
});
|
|
17349
17570
|
});
|
|
17350
17571
|
};
|
|
17351
|
-
|
|
17572
|
+
NaClTCPPacketConnection2.prototype.send = function(data) {
|
|
17352
17573
|
return __awaiter(this, void 0, void 0, function() {
|
|
17353
|
-
var message, resultMessage, resultFirstUInt32Array, resultSecondInt32Array, picture;
|
|
17354
17574
|
return __generator(this, function(_a) {
|
|
17355
17575
|
switch (_a.label) {
|
|
17356
17576
|
case 0:
|
|
17357
|
-
|
|
17358
|
-
type: messages_1.JSToNaClMessageType.GetPicture
|
|
17359
|
-
};
|
|
17360
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.GetPictureResult)];
|
|
17577
|
+
return [4, this.ensureConnected()];
|
|
17361
17578
|
case 1:
|
|
17362
|
-
|
|
17363
|
-
|
|
17364
|
-
|
|
17365
|
-
|
|
17366
|
-
|
|
17367
|
-
|
|
17368
|
-
|
|
17369
|
-
|
|
17370
|
-
width: resultSecondInt32Array[0],
|
|
17371
|
-
height: resultSecondInt32Array[1]
|
|
17372
|
-
},
|
|
17373
|
-
visibleRect: {
|
|
17374
|
-
x: resultSecondInt32Array[2],
|
|
17375
|
-
y: resultSecondInt32Array[3],
|
|
17376
|
-
width: resultSecondInt32Array[4],
|
|
17377
|
-
height: resultSecondInt32Array[5]
|
|
17378
|
-
}
|
|
17379
|
-
};
|
|
17380
|
-
return [2, picture];
|
|
17579
|
+
_a.sent();
|
|
17580
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPSend, createHandleAndDataPayload(this.handle, data), messages_1.NaClToJSMessageType.TCPSend)];
|
|
17581
|
+
case 2:
|
|
17582
|
+
_a.sent();
|
|
17583
|
+
return [
|
|
17584
|
+
2
|
|
17585
|
+
/*return*/
|
|
17586
|
+
];
|
|
17381
17587
|
}
|
|
17382
17588
|
});
|
|
17383
17589
|
});
|
|
17384
17590
|
};
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
|
|
17396
|
-
|
|
17397
|
-
|
|
17398
|
-
|
|
17399
|
-
|
|
17400
|
-
|
|
17401
|
-
|
|
17402
|
-
|
|
17403
|
-
|
|
17591
|
+
NaClTCPPacketConnection2.prototype.recv = function() {
|
|
17592
|
+
return __awaiter(this, arguments, void 0, function(maxSize) {
|
|
17593
|
+
var result;
|
|
17594
|
+
if (maxSize === void 0) {
|
|
17595
|
+
maxSize = DEFAULT_MAX_PACKET_SIZE;
|
|
17596
|
+
}
|
|
17597
|
+
return __generator(this, function(_a) {
|
|
17598
|
+
switch (_a.label) {
|
|
17599
|
+
case 0:
|
|
17600
|
+
return [4, this.ensureConnected()];
|
|
17601
|
+
case 1:
|
|
17602
|
+
_a.sent();
|
|
17603
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPRecv, createHandleAndSizePayload(this.handle, maxSize), messages_1.NaClToJSMessageType.TCPRecv, 2147483647)];
|
|
17604
|
+
case 2:
|
|
17605
|
+
result = _a.sent();
|
|
17606
|
+
return [2, result.payload];
|
|
17607
|
+
}
|
|
17608
|
+
});
|
|
17609
|
+
});
|
|
17404
17610
|
};
|
|
17405
|
-
|
|
17611
|
+
NaClTCPPacketConnection2.prototype.collectFrame = function(options) {
|
|
17406
17612
|
return __awaiter(this, void 0, void 0, function() {
|
|
17407
|
-
var
|
|
17613
|
+
var createResult;
|
|
17408
17614
|
return __generator(this, function(_a) {
|
|
17409
17615
|
switch (_a.label) {
|
|
17410
17616
|
case 0:
|
|
17411
|
-
|
|
17412
|
-
type: messages_1.JSToNaClMessageType.Flush
|
|
17413
|
-
};
|
|
17414
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.FlushResult)];
|
|
17617
|
+
return [4, this.ensureConnected()];
|
|
17415
17618
|
case 1:
|
|
17416
|
-
|
|
17417
|
-
|
|
17418
|
-
return [
|
|
17619
|
+
_a.sent();
|
|
17620
|
+
if (!!this.frameCollector) return [3, 3];
|
|
17621
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.CollectorCreate, createHandleAndSizePayload(this.handle, this.maxPacketSize), messages_1.NaClToJSMessageType.CollectorCreate)];
|
|
17622
|
+
case 2:
|
|
17623
|
+
createResult = _a.sent();
|
|
17624
|
+
this.frameCollector = new NaClFrameCollector(this.messageSender, new DataView(createResult.payload).getUint32(0, true));
|
|
17625
|
+
_a.label = 3;
|
|
17626
|
+
case 3:
|
|
17627
|
+
if (!!this.frameCollectorStarted) return [3, 5];
|
|
17628
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.CollectorStart, createHandlePayload(this.frameCollector.getHandle()), messages_1.NaClToJSMessageType.CollectorStart)];
|
|
17629
|
+
case 4:
|
|
17630
|
+
_a.sent();
|
|
17631
|
+
this.frameCollectorStarted = true;
|
|
17632
|
+
_a.label = 5;
|
|
17633
|
+
case 5:
|
|
17634
|
+
return [2, this.frameCollector.collectFrame(options)];
|
|
17419
17635
|
}
|
|
17420
17636
|
});
|
|
17421
17637
|
});
|
|
17422
17638
|
};
|
|
17423
|
-
|
|
17639
|
+
NaClTCPPacketConnection2.prototype.close = function() {
|
|
17424
17640
|
return __awaiter(this, void 0, void 0, function() {
|
|
17425
|
-
var
|
|
17641
|
+
var handle;
|
|
17426
17642
|
return __generator(this, function(_a) {
|
|
17427
17643
|
switch (_a.label) {
|
|
17428
17644
|
case 0:
|
|
17429
|
-
|
|
17430
|
-
|
|
17431
|
-
};
|
|
17432
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.ResetResult)];
|
|
17645
|
+
if (!this.frameCollector) return [3, 2];
|
|
17646
|
+
return [4, this.frameCollector.destroy()];
|
|
17433
17647
|
case 1:
|
|
17434
|
-
|
|
17435
|
-
|
|
17436
|
-
|
|
17648
|
+
_a.sent();
|
|
17649
|
+
this.frameCollector = null;
|
|
17650
|
+
_a.label = 2;
|
|
17651
|
+
case 2:
|
|
17652
|
+
if (!(this.handle !== 0)) return [3, 4];
|
|
17653
|
+
handle = this.handle;
|
|
17654
|
+
this.handle = 0;
|
|
17655
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPClose, createHandlePayload(handle), messages_1.NaClToJSMessageType.TCPClose)];
|
|
17656
|
+
case 3:
|
|
17657
|
+
_a.sent();
|
|
17658
|
+
_a.label = 4;
|
|
17659
|
+
case 4:
|
|
17660
|
+
return [
|
|
17661
|
+
2
|
|
17662
|
+
/*return*/
|
|
17663
|
+
];
|
|
17437
17664
|
}
|
|
17438
17665
|
});
|
|
17439
17666
|
});
|
|
17440
17667
|
};
|
|
17441
|
-
|
|
17668
|
+
NaClTCPPacketConnection2.prototype.ensureConnected = function() {
|
|
17442
17669
|
return __awaiter(this, void 0, void 0, function() {
|
|
17443
|
-
var firstUint32Array, secondInt32Array, message, resultMessage, resultStatus;
|
|
17444
17670
|
return __generator(this, function(_a) {
|
|
17445
17671
|
switch (_a.label) {
|
|
17446
17672
|
case 0:
|
|
17447
|
-
|
|
17448
|
-
picture.decodeId,
|
|
17449
|
-
picture.textureId,
|
|
17450
|
-
picture.textureTarget
|
|
17451
|
-
]);
|
|
17452
|
-
secondInt32Array = new Int32Array([
|
|
17453
|
-
picture.textureSize.width,
|
|
17454
|
-
picture.textureSize.height,
|
|
17455
|
-
picture.visibleRect.x,
|
|
17456
|
-
picture.visibleRect.y,
|
|
17457
|
-
picture.visibleRect.width,
|
|
17458
|
-
picture.visibleRect.height
|
|
17459
|
-
]);
|
|
17460
|
-
message = {
|
|
17461
|
-
type: messages_1.JSToNaClMessageType.Render,
|
|
17462
|
-
payload: new Uint8Array(__spreadArray(__spreadArray([], __read(new Uint8Array(firstUint32Array.buffer)), false), __read(new Uint8Array(secondInt32Array.buffer)), false)).buffer
|
|
17463
|
-
};
|
|
17464
|
-
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.RenderResult)];
|
|
17673
|
+
return [4, this.isConnecting()];
|
|
17465
17674
|
case 1:
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17675
|
+
if (_a.sent()) {
|
|
17676
|
+
throw new Error("Connection is still in progress");
|
|
17677
|
+
}
|
|
17678
|
+
return [4, this.isConnected()];
|
|
17679
|
+
case 2:
|
|
17680
|
+
if (!_a.sent()) {
|
|
17681
|
+
throw new Error("Connection is not active");
|
|
17682
|
+
}
|
|
17683
|
+
return [
|
|
17684
|
+
2
|
|
17685
|
+
/*return*/
|
|
17686
|
+
];
|
|
17469
17687
|
}
|
|
17470
17688
|
});
|
|
17471
17689
|
});
|
|
17472
17690
|
};
|
|
17473
|
-
return
|
|
17691
|
+
return NaClTCPPacketConnection2;
|
|
17474
17692
|
}()
|
|
17475
17693
|
);
|
|
17476
|
-
exports.
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17694
|
+
exports.NaClTCPPacketConnection = NaClTCPPacketConnection;
|
|
17695
|
+
var NaClTCPStreamConnection = (
|
|
17696
|
+
/** @class */
|
|
17697
|
+
function() {
|
|
17698
|
+
function NaClTCPStreamConnection2(messageSender, handle) {
|
|
17699
|
+
this.messageSender = messageSender;
|
|
17700
|
+
this.handle = handle;
|
|
17701
|
+
}
|
|
17702
|
+
NaClTCPStreamConnection2.prototype.write = function(data) {
|
|
17703
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17704
|
+
return __generator(this, function(_a) {
|
|
17705
|
+
switch (_a.label) {
|
|
17706
|
+
case 0:
|
|
17707
|
+
return [4, this.ensureConnected()];
|
|
17708
|
+
case 1:
|
|
17709
|
+
_a.sent();
|
|
17710
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPStreamWrite, createHandleAndDataPayload(this.handle, data), messages_1.NaClToJSMessageType.TCPStreamWrite)];
|
|
17711
|
+
case 2:
|
|
17712
|
+
_a.sent();
|
|
17713
|
+
return [
|
|
17714
|
+
2
|
|
17715
|
+
/*return*/
|
|
17716
|
+
];
|
|
17717
|
+
}
|
|
17718
|
+
});
|
|
17719
|
+
});
|
|
17720
|
+
};
|
|
17721
|
+
NaClTCPStreamConnection2.prototype.read = function() {
|
|
17722
|
+
return __awaiter(this, arguments, void 0, function(maxSize) {
|
|
17723
|
+
var result;
|
|
17724
|
+
if (maxSize === void 0) {
|
|
17725
|
+
maxSize = DEFAULT_MAX_PACKET_SIZE;
|
|
17726
|
+
}
|
|
17727
|
+
return __generator(this, function(_a) {
|
|
17728
|
+
switch (_a.label) {
|
|
17729
|
+
case 0:
|
|
17730
|
+
return [4, this.ensureConnected()];
|
|
17731
|
+
case 1:
|
|
17732
|
+
_a.sent();
|
|
17733
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPStreamRead, createHandleAndSizePayload(this.handle, maxSize), messages_1.NaClToJSMessageType.TCPStreamRead, 2147483647)];
|
|
17734
|
+
case 2:
|
|
17735
|
+
result = _a.sent();
|
|
17736
|
+
return [2, result.payload];
|
|
17737
|
+
}
|
|
17738
|
+
});
|
|
17739
|
+
});
|
|
17740
|
+
};
|
|
17741
|
+
NaClTCPStreamConnection2.prototype.close = function() {
|
|
17742
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17743
|
+
var handle;
|
|
17744
|
+
return __generator(this, function(_a) {
|
|
17745
|
+
switch (_a.label) {
|
|
17746
|
+
case 0:
|
|
17747
|
+
if (!(this.handle !== 0)) return [3, 2];
|
|
17748
|
+
handle = this.handle;
|
|
17749
|
+
this.handle = 0;
|
|
17750
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPClose, createHandlePayload(handle), messages_1.NaClToJSMessageType.TCPClose)];
|
|
17751
|
+
case 1:
|
|
17752
|
+
_a.sent();
|
|
17753
|
+
_a.label = 2;
|
|
17754
|
+
case 2:
|
|
17755
|
+
return [
|
|
17756
|
+
2
|
|
17757
|
+
/*return*/
|
|
17758
|
+
];
|
|
17759
|
+
}
|
|
17760
|
+
});
|
|
17761
|
+
});
|
|
17762
|
+
};
|
|
17763
|
+
NaClTCPStreamConnection2.prototype.ensureConnected = function() {
|
|
17764
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17765
|
+
var result, state;
|
|
17766
|
+
return __generator(this, function(_a) {
|
|
17767
|
+
switch (_a.label) {
|
|
17768
|
+
case 0:
|
|
17769
|
+
if (this.handle === 0) {
|
|
17770
|
+
throw new Error("Connection is not active");
|
|
17771
|
+
}
|
|
17772
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPIsConnected, createHandlePayload(this.handle), messages_1.NaClToJSMessageType.TCPIsConnected)];
|
|
17773
|
+
case 1:
|
|
17774
|
+
result = _a.sent();
|
|
17775
|
+
state = new Int8Array(result.payload)[0];
|
|
17776
|
+
if (state === -1) {
|
|
17777
|
+
throw new Error("Connection is still in progress");
|
|
17778
|
+
}
|
|
17779
|
+
if (state !== 1) {
|
|
17780
|
+
throw new Error("Connection is not active");
|
|
17781
|
+
}
|
|
17782
|
+
return [
|
|
17783
|
+
2
|
|
17784
|
+
/*return*/
|
|
17785
|
+
];
|
|
17786
|
+
}
|
|
17787
|
+
});
|
|
17788
|
+
});
|
|
17789
|
+
};
|
|
17790
|
+
return NaClTCPStreamConnection2;
|
|
17791
|
+
}()
|
|
17792
|
+
);
|
|
17793
|
+
exports.NaClTCPStreamConnection = NaClTCPStreamConnection;
|
|
17794
|
+
var NaClTCPPacket2 = (
|
|
17795
|
+
/** @class */
|
|
17796
|
+
function() {
|
|
17797
|
+
function NaClTCPPacket3(messageSender) {
|
|
17798
|
+
this.messageSender = messageSender;
|
|
17799
|
+
}
|
|
17800
|
+
NaClTCPPacket3.prototype.connect = function(options) {
|
|
17801
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17802
|
+
var result;
|
|
17803
|
+
var _a;
|
|
17804
|
+
return __generator(this, function(_b) {
|
|
17805
|
+
switch (_b.label) {
|
|
17806
|
+
case 0:
|
|
17807
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPConnect, createConnectPayload(0, options), messages_1.NaClToJSMessageType.TCPConnect, options.timeoutMs + CONNECT_LATE_RESULT_GRACE_MS)];
|
|
17808
|
+
case 1:
|
|
17809
|
+
result = _b.sent();
|
|
17810
|
+
return [2, new NaClTCPPacketConnection(this.messageSender, new DataView(result.payload).getUint32(0, true), (_a = options.maxPacketSize) !== null && _a !== void 0 ? _a : DEFAULT_MAX_PACKET_SIZE)];
|
|
17811
|
+
}
|
|
17812
|
+
});
|
|
17813
|
+
});
|
|
17814
|
+
};
|
|
17815
|
+
return NaClTCPPacket3;
|
|
17816
|
+
}()
|
|
17817
|
+
);
|
|
17818
|
+
exports.NaClTCPPacket = NaClTCPPacket2;
|
|
17819
|
+
var NaClTCPStream2 = (
|
|
17820
|
+
/** @class */
|
|
17821
|
+
function() {
|
|
17822
|
+
function NaClTCPStream3(messageSender) {
|
|
17823
|
+
this.messageSender = messageSender;
|
|
17824
|
+
}
|
|
17825
|
+
NaClTCPStream3.prototype.connect = function(options) {
|
|
17826
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17827
|
+
var result;
|
|
17828
|
+
return __generator(this, function(_a) {
|
|
17829
|
+
switch (_a.label) {
|
|
17830
|
+
case 0:
|
|
17831
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.TCPConnect, createConnectPayload(1, options), messages_1.NaClToJSMessageType.TCPConnect, options.timeoutMs + CONNECT_LATE_RESULT_GRACE_MS)];
|
|
17832
|
+
case 1:
|
|
17833
|
+
result = _a.sent();
|
|
17834
|
+
return [2, new NaClTCPStreamConnection(this.messageSender, new DataView(result.payload).getUint32(0, true))];
|
|
17835
|
+
}
|
|
17836
|
+
});
|
|
17837
|
+
});
|
|
17838
|
+
};
|
|
17839
|
+
return NaClTCPStream3;
|
|
17840
|
+
}()
|
|
17841
|
+
);
|
|
17842
|
+
exports.NaClTCPStream = NaClTCPStream2;
|
|
17843
|
+
}
|
|
17844
|
+
});
|
|
17845
|
+
|
|
17846
|
+
// node_modules/@signageos/nacl-decoder/dist/NaClDecoder/naclDecoder.js
|
|
17847
|
+
var require_naclDecoder = __commonJS({
|
|
17848
|
+
"node_modules/@signageos/nacl-decoder/dist/NaClDecoder/naclDecoder.js"(exports) {
|
|
17849
|
+
"use strict";
|
|
17850
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
17851
|
+
function adopt(value) {
|
|
17852
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
17853
|
+
resolve(value);
|
|
17854
|
+
});
|
|
17855
|
+
}
|
|
17856
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
17857
|
+
function fulfilled(value) {
|
|
17858
|
+
try {
|
|
17859
|
+
step(generator.next(value));
|
|
17860
|
+
} catch (e) {
|
|
17861
|
+
reject(e);
|
|
17862
|
+
}
|
|
17863
|
+
}
|
|
17864
|
+
function rejected(value) {
|
|
17865
|
+
try {
|
|
17866
|
+
step(generator["throw"](value));
|
|
17867
|
+
} catch (e) {
|
|
17868
|
+
reject(e);
|
|
17869
|
+
}
|
|
17870
|
+
}
|
|
17871
|
+
function step(result) {
|
|
17872
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
17873
|
+
}
|
|
17874
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17875
|
+
});
|
|
17876
|
+
};
|
|
17877
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
17878
|
+
var _ = { label: 0, sent: function() {
|
|
17879
|
+
if (t[0] & 1) throw t[1];
|
|
17880
|
+
return t[1];
|
|
17881
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
17882
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
17883
|
+
return this;
|
|
17884
|
+
}), g;
|
|
17885
|
+
function verb(n) {
|
|
17886
|
+
return function(v) {
|
|
17887
|
+
return step([n, v]);
|
|
17888
|
+
};
|
|
17889
|
+
}
|
|
17890
|
+
function step(op) {
|
|
17891
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17892
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17893
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
17894
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
17895
|
+
switch (op[0]) {
|
|
17896
|
+
case 0:
|
|
17897
|
+
case 1:
|
|
17898
|
+
t = op;
|
|
17899
|
+
break;
|
|
17900
|
+
case 4:
|
|
17901
|
+
_.label++;
|
|
17902
|
+
return { value: op[1], done: false };
|
|
17903
|
+
case 5:
|
|
17904
|
+
_.label++;
|
|
17905
|
+
y = op[1];
|
|
17906
|
+
op = [0];
|
|
17907
|
+
continue;
|
|
17908
|
+
case 7:
|
|
17909
|
+
op = _.ops.pop();
|
|
17910
|
+
_.trys.pop();
|
|
17911
|
+
continue;
|
|
17912
|
+
default:
|
|
17913
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
17914
|
+
_ = 0;
|
|
17915
|
+
continue;
|
|
17916
|
+
}
|
|
17917
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
17918
|
+
_.label = op[1];
|
|
17919
|
+
break;
|
|
17920
|
+
}
|
|
17921
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
17922
|
+
_.label = t[1];
|
|
17923
|
+
t = op;
|
|
17924
|
+
break;
|
|
17925
|
+
}
|
|
17926
|
+
if (t && _.label < t[2]) {
|
|
17927
|
+
_.label = t[2];
|
|
17928
|
+
_.ops.push(op);
|
|
17929
|
+
break;
|
|
17930
|
+
}
|
|
17931
|
+
if (t[2]) _.ops.pop();
|
|
17932
|
+
_.trys.pop();
|
|
17933
|
+
continue;
|
|
17934
|
+
}
|
|
17935
|
+
op = body.call(thisArg, _);
|
|
17936
|
+
} catch (e) {
|
|
17937
|
+
op = [6, e];
|
|
17938
|
+
y = 0;
|
|
17939
|
+
} finally {
|
|
17940
|
+
f = t = 0;
|
|
17941
|
+
}
|
|
17942
|
+
if (op[0] & 5) throw op[1];
|
|
17943
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
17944
|
+
}
|
|
17945
|
+
};
|
|
17946
|
+
var __read = exports && exports.__read || function(o, n) {
|
|
17947
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
17948
|
+
if (!m) return o;
|
|
17949
|
+
var i = m.call(o), r, ar = [], e;
|
|
17950
|
+
try {
|
|
17951
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
17952
|
+
} catch (error) {
|
|
17953
|
+
e = { error };
|
|
17954
|
+
} finally {
|
|
17955
|
+
try {
|
|
17956
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
17957
|
+
} finally {
|
|
17958
|
+
if (e) throw e.error;
|
|
17959
|
+
}
|
|
17960
|
+
}
|
|
17961
|
+
return ar;
|
|
17962
|
+
};
|
|
17963
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
17964
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
17965
|
+
if (ar || !(i in from)) {
|
|
17966
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17967
|
+
ar[i] = from[i];
|
|
17968
|
+
}
|
|
17969
|
+
}
|
|
17970
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
17971
|
+
};
|
|
17972
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17973
|
+
exports.NaClDecoder = void 0;
|
|
17974
|
+
var messages_1 = require_messages();
|
|
17975
|
+
var module_1 = require_module();
|
|
17976
|
+
var naclTCP_1 = require_naclTCP();
|
|
17977
|
+
var NaClDecoder = (
|
|
17978
|
+
/** @class */
|
|
17979
|
+
function() {
|
|
17980
|
+
function NaClDecoder2(messageSender, naclModuleEl) {
|
|
17981
|
+
this.messageSender = messageSender;
|
|
17982
|
+
this.naclModuleEl = naclModuleEl;
|
|
17983
|
+
}
|
|
17984
|
+
NaClDecoder2.prototype.destroy = function() {
|
|
17985
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17986
|
+
return __generator(this, function(_a) {
|
|
17987
|
+
(0, module_1.removeNaClModule)(this.naclModuleEl);
|
|
17988
|
+
return [
|
|
17989
|
+
2
|
|
17990
|
+
/*return*/
|
|
17991
|
+
];
|
|
17992
|
+
});
|
|
17993
|
+
});
|
|
17994
|
+
};
|
|
17995
|
+
NaClDecoder2.prototype.initialize = function(args) {
|
|
17996
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
17997
|
+
var width, height, message, resultMessage, resultStatus;
|
|
17998
|
+
var _a, _b;
|
|
17999
|
+
return __generator(this, function(_c) {
|
|
18000
|
+
switch (_c.label) {
|
|
18001
|
+
case 0:
|
|
18002
|
+
width = (_a = args.graphics3DContext.width) !== null && _a !== void 0 ? _a : window.screen.width;
|
|
18003
|
+
height = (_b = args.graphics3DContext.height) !== null && _b !== void 0 ? _b : window.screen.height;
|
|
18004
|
+
message = {
|
|
18005
|
+
type: messages_1.JSToNaClMessageType.Initialize,
|
|
18006
|
+
payload: new Uint8Array(__spreadArray(__spreadArray([
|
|
18007
|
+
args.profile,
|
|
18008
|
+
args.acceleration
|
|
18009
|
+
], __read(new Uint8Array(new Uint32Array([args.minPictureCount]).buffer)), false), __read(new Uint8Array(new Int32Array([width, height]).buffer)), false)).buffer
|
|
18010
|
+
};
|
|
18011
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.InitializeResult)];
|
|
18012
|
+
case 1:
|
|
18013
|
+
resultMessage = _c.sent();
|
|
18014
|
+
resultStatus = new Int32Array(resultMessage.payload)[0];
|
|
18015
|
+
return [2, resultStatus];
|
|
18016
|
+
}
|
|
18017
|
+
});
|
|
18018
|
+
});
|
|
18019
|
+
};
|
|
18020
|
+
NaClDecoder2.prototype.decodeAndRender = function(data) {
|
|
18021
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18022
|
+
var message, resultMessage, resultStatus;
|
|
18023
|
+
return __generator(this, function(_a) {
|
|
18024
|
+
switch (_a.label) {
|
|
18025
|
+
case 0:
|
|
18026
|
+
if (!(data instanceof ArrayBuffer)) {
|
|
18027
|
+
throw new Error("Unexpected data type. Only ArrayBuffer is supported.");
|
|
18028
|
+
}
|
|
18029
|
+
message = {
|
|
18030
|
+
type: messages_1.JSToNaClMessageType.DecodeAndRender,
|
|
18031
|
+
payload: data
|
|
18032
|
+
};
|
|
18033
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.DecodeAndRenderResult)];
|
|
18034
|
+
case 1:
|
|
18035
|
+
resultMessage = _a.sent();
|
|
18036
|
+
resultStatus = new Int32Array(resultMessage.payload)[0];
|
|
18037
|
+
return [2, resultStatus];
|
|
18038
|
+
}
|
|
18039
|
+
});
|
|
18040
|
+
});
|
|
18041
|
+
};
|
|
18042
|
+
NaClDecoder2.prototype.decodeAndRenderRef = function(dataRef) {
|
|
18043
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18044
|
+
var payload, resultMessage;
|
|
18045
|
+
return __generator(this, function(_a) {
|
|
18046
|
+
switch (_a.label) {
|
|
18047
|
+
case 0:
|
|
18048
|
+
payload = new ArrayBuffer(4);
|
|
18049
|
+
new DataView(payload).setUint32(0, dataRef, true);
|
|
18050
|
+
return [4, this.messageSender.sendWithRequestId(messages_1.JSToNaClMessageType.DecodeAndRenderRef, payload, messages_1.NaClToJSMessageType.DecodeAndRenderRef)];
|
|
18051
|
+
case 1:
|
|
18052
|
+
resultMessage = _a.sent();
|
|
18053
|
+
return [2, resultMessage.status];
|
|
18054
|
+
}
|
|
18055
|
+
});
|
|
18056
|
+
});
|
|
18057
|
+
};
|
|
18058
|
+
NaClDecoder2.prototype.createTCP = function() {
|
|
18059
|
+
return {
|
|
18060
|
+
tcpPacket: new naclTCP_1.NaClTCPPacket(this.messageSender),
|
|
18061
|
+
tcpStream: new naclTCP_1.NaClTCPStream(this.messageSender)
|
|
18062
|
+
};
|
|
18063
|
+
};
|
|
18064
|
+
NaClDecoder2.prototype.decode = function(args) {
|
|
18065
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18066
|
+
var message, resultMessage, resultStatus;
|
|
18067
|
+
return __generator(this, function(_a) {
|
|
18068
|
+
switch (_a.label) {
|
|
18069
|
+
case 0:
|
|
18070
|
+
if (!(args.data instanceof ArrayBuffer)) {
|
|
18071
|
+
throw new Error("Unexpected data type. Only ArrayBuffer is supported.");
|
|
18072
|
+
}
|
|
18073
|
+
message = {
|
|
18074
|
+
type: messages_1.JSToNaClMessageType.Decode,
|
|
18075
|
+
// TODO decodeId (not used in the NaCl module now)
|
|
18076
|
+
payload: args.data
|
|
18077
|
+
};
|
|
18078
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.DecodeResult)];
|
|
18079
|
+
case 1:
|
|
18080
|
+
resultMessage = _a.sent();
|
|
18081
|
+
resultStatus = new Int32Array(resultMessage.payload)[0];
|
|
18082
|
+
return [2, resultStatus];
|
|
18083
|
+
}
|
|
18084
|
+
});
|
|
18085
|
+
});
|
|
18086
|
+
};
|
|
18087
|
+
NaClDecoder2.prototype.getPicture = function() {
|
|
18088
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18089
|
+
var message, resultMessage, resultFirstUInt32Array, resultSecondInt32Array, picture;
|
|
18090
|
+
return __generator(this, function(_a) {
|
|
18091
|
+
switch (_a.label) {
|
|
18092
|
+
case 0:
|
|
18093
|
+
message = {
|
|
18094
|
+
type: messages_1.JSToNaClMessageType.GetPicture
|
|
18095
|
+
};
|
|
18096
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.GetPictureResult)];
|
|
18097
|
+
case 1:
|
|
18098
|
+
resultMessage = _a.sent();
|
|
18099
|
+
resultFirstUInt32Array = new Uint32Array(resultMessage.payload.slice(0, 12));
|
|
18100
|
+
resultSecondInt32Array = new Int32Array(resultMessage.payload.slice(12, 36));
|
|
18101
|
+
picture = {
|
|
18102
|
+
decodeId: resultFirstUInt32Array[0],
|
|
18103
|
+
textureId: resultFirstUInt32Array[1],
|
|
18104
|
+
textureTarget: resultFirstUInt32Array[2],
|
|
18105
|
+
textureSize: {
|
|
18106
|
+
width: resultSecondInt32Array[0],
|
|
18107
|
+
height: resultSecondInt32Array[1]
|
|
18108
|
+
},
|
|
18109
|
+
visibleRect: {
|
|
18110
|
+
x: resultSecondInt32Array[2],
|
|
18111
|
+
y: resultSecondInt32Array[3],
|
|
18112
|
+
width: resultSecondInt32Array[4],
|
|
18113
|
+
height: resultSecondInt32Array[5]
|
|
18114
|
+
}
|
|
18115
|
+
};
|
|
18116
|
+
return [2, picture];
|
|
18117
|
+
}
|
|
18118
|
+
});
|
|
18119
|
+
});
|
|
18120
|
+
};
|
|
18121
|
+
NaClDecoder2.prototype.recyclePicture = function(picture) {
|
|
18122
|
+
var firstUint32Array = new Uint32Array([
|
|
18123
|
+
picture.decodeId,
|
|
18124
|
+
picture.textureId,
|
|
18125
|
+
picture.textureTarget
|
|
18126
|
+
]);
|
|
18127
|
+
var secondInt32Array = new Int32Array([
|
|
18128
|
+
picture.textureSize.width,
|
|
18129
|
+
picture.textureSize.height,
|
|
18130
|
+
picture.visibleRect.x,
|
|
18131
|
+
picture.visibleRect.y,
|
|
18132
|
+
picture.visibleRect.width,
|
|
18133
|
+
picture.visibleRect.height
|
|
18134
|
+
]);
|
|
18135
|
+
var message = {
|
|
18136
|
+
type: messages_1.JSToNaClMessageType.RecyclePicture,
|
|
18137
|
+
payload: new Uint8Array(__spreadArray(__spreadArray([], __read(new Uint8Array(firstUint32Array.buffer)), false), __read(new Uint8Array(secondInt32Array.buffer)), false)).buffer
|
|
18138
|
+
};
|
|
18139
|
+
this.messageSender.sendWithoutResult(message);
|
|
18140
|
+
};
|
|
18141
|
+
NaClDecoder2.prototype.flush = function() {
|
|
18142
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18143
|
+
var message, resultMessage, resultStatus;
|
|
18144
|
+
return __generator(this, function(_a) {
|
|
18145
|
+
switch (_a.label) {
|
|
18146
|
+
case 0:
|
|
18147
|
+
message = {
|
|
18148
|
+
type: messages_1.JSToNaClMessageType.Flush
|
|
18149
|
+
};
|
|
18150
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.FlushResult)];
|
|
18151
|
+
case 1:
|
|
18152
|
+
resultMessage = _a.sent();
|
|
18153
|
+
resultStatus = new Int32Array(resultMessage.payload)[0];
|
|
18154
|
+
return [2, resultStatus];
|
|
18155
|
+
}
|
|
18156
|
+
});
|
|
18157
|
+
});
|
|
18158
|
+
};
|
|
18159
|
+
NaClDecoder2.prototype.reset = function() {
|
|
18160
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18161
|
+
var message, resultMessage, resultStatus;
|
|
18162
|
+
return __generator(this, function(_a) {
|
|
18163
|
+
switch (_a.label) {
|
|
18164
|
+
case 0:
|
|
18165
|
+
message = {
|
|
18166
|
+
type: messages_1.JSToNaClMessageType.Reset
|
|
18167
|
+
};
|
|
18168
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.ResetResult)];
|
|
18169
|
+
case 1:
|
|
18170
|
+
resultMessage = _a.sent();
|
|
18171
|
+
resultStatus = new Int32Array(resultMessage.payload)[0];
|
|
18172
|
+
return [2, resultStatus];
|
|
18173
|
+
}
|
|
18174
|
+
});
|
|
18175
|
+
});
|
|
18176
|
+
};
|
|
18177
|
+
NaClDecoder2.prototype.render = function(picture) {
|
|
18178
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18179
|
+
var firstUint32Array, secondInt32Array, message, resultMessage, resultStatus;
|
|
18180
|
+
return __generator(this, function(_a) {
|
|
18181
|
+
switch (_a.label) {
|
|
18182
|
+
case 0:
|
|
18183
|
+
firstUint32Array = new Uint32Array([
|
|
18184
|
+
picture.decodeId,
|
|
18185
|
+
picture.textureId,
|
|
18186
|
+
picture.textureTarget
|
|
18187
|
+
]);
|
|
18188
|
+
secondInt32Array = new Int32Array([
|
|
18189
|
+
picture.textureSize.width,
|
|
18190
|
+
picture.textureSize.height,
|
|
18191
|
+
picture.visibleRect.x,
|
|
18192
|
+
picture.visibleRect.y,
|
|
18193
|
+
picture.visibleRect.width,
|
|
18194
|
+
picture.visibleRect.height
|
|
18195
|
+
]);
|
|
18196
|
+
message = {
|
|
18197
|
+
type: messages_1.JSToNaClMessageType.Render,
|
|
18198
|
+
payload: new Uint8Array(__spreadArray(__spreadArray([], __read(new Uint8Array(firstUint32Array.buffer)), false), __read(new Uint8Array(secondInt32Array.buffer)), false)).buffer
|
|
18199
|
+
};
|
|
18200
|
+
return [4, this.messageSender.sendWithResult(message, messages_1.NaClToJSMessageType.RenderResult)];
|
|
18201
|
+
case 1:
|
|
18202
|
+
resultMessage = _a.sent();
|
|
18203
|
+
resultStatus = new Int32Array(resultMessage.payload)[0];
|
|
18204
|
+
return [2, resultStatus];
|
|
18205
|
+
}
|
|
18206
|
+
});
|
|
18207
|
+
});
|
|
18208
|
+
};
|
|
18209
|
+
return NaClDecoder2;
|
|
18210
|
+
}()
|
|
18211
|
+
);
|
|
18212
|
+
exports.NaClDecoder = NaClDecoder;
|
|
18213
|
+
}
|
|
18214
|
+
});
|
|
18215
|
+
|
|
18216
|
+
// node_modules/@signageos/nacl-decoder/dist/NaClDecoder/videoDecoder.js
|
|
18217
|
+
var require_videoDecoder = __commonJS({
|
|
18218
|
+
"node_modules/@signageos/nacl-decoder/dist/NaClDecoder/videoDecoder.js"(exports) {
|
|
18219
|
+
"use strict";
|
|
18220
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18221
|
+
exports.ResultStatus = exports.GLTexture = exports.HWAcceleration = exports.VideoProfile = void 0;
|
|
18222
|
+
var VideoProfile;
|
|
18223
|
+
(function(VideoProfile2) {
|
|
18224
|
+
VideoProfile2[VideoProfile2["H264Baseline"] = 0] = "H264Baseline";
|
|
18225
|
+
VideoProfile2[VideoProfile2["H264Main"] = 1] = "H264Main";
|
|
18226
|
+
VideoProfile2[VideoProfile2["H264Extended"] = 2] = "H264Extended";
|
|
18227
|
+
VideoProfile2[VideoProfile2["H264High"] = 3] = "H264High";
|
|
17492
18228
|
VideoProfile2[VideoProfile2["H264High10Profile"] = 4] = "H264High10Profile";
|
|
17493
18229
|
VideoProfile2[VideoProfile2["H264High422Profile"] = 5] = "H264High422Profile";
|
|
17494
18230
|
VideoProfile2[VideoProfile2["H264High444PredictiveProfile"] = 6] = "H264High444PredictiveProfile";
|
|
@@ -17533,62 +18269,1859 @@
|
|
|
17533
18269
|
}
|
|
17534
18270
|
});
|
|
17535
18271
|
|
|
17536
|
-
// node_modules/@signageos/nacl-decoder/dist/index.js
|
|
17537
|
-
var require_dist = __commonJS({
|
|
17538
|
-
"node_modules/@signageos/nacl-decoder/dist/index.js"(exports) {
|
|
18272
|
+
// node_modules/@signageos/nacl-decoder/dist/index.js
|
|
18273
|
+
var require_dist = __commonJS({
|
|
18274
|
+
"node_modules/@signageos/nacl-decoder/dist/index.js"(exports) {
|
|
18275
|
+
"use strict";
|
|
18276
|
+
var __assign = exports && exports.__assign || function() {
|
|
18277
|
+
__assign = Object.assign || function(t) {
|
|
18278
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18279
|
+
s = arguments[i];
|
|
18280
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
18281
|
+
t[p] = s[p];
|
|
18282
|
+
}
|
|
18283
|
+
return t;
|
|
18284
|
+
};
|
|
18285
|
+
return __assign.apply(this, arguments);
|
|
18286
|
+
};
|
|
18287
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18288
|
+
exports.NaClTCPStreamConnection = exports.NaClTCPStream = exports.NaClTCPPacketConnection = exports.NaClTCPPacket = exports.NaClFrameCollector = exports.VideoProfile = exports.ResultStatus = exports.HWAcceleration = exports.NaClDecoder = void 0;
|
|
18289
|
+
exports.isNaClSupported = isNaClSupported3;
|
|
18290
|
+
exports.createNaClDecoder = createNaClDecoder2;
|
|
18291
|
+
exports.createNaClTCP = createNaClTCP2;
|
|
18292
|
+
var messageListeners_1 = require_messageListeners();
|
|
18293
|
+
var messageReceiver_1 = require_messageReceiver();
|
|
18294
|
+
var messageSender_1 = require_messageSender();
|
|
18295
|
+
var module_1 = require_module();
|
|
18296
|
+
var naclDecoder_1 = require_naclDecoder();
|
|
18297
|
+
Object.defineProperty(exports, "NaClDecoder", { enumerable: true, get: function() {
|
|
18298
|
+
return naclDecoder_1.NaClDecoder;
|
|
18299
|
+
} });
|
|
18300
|
+
var naclTCP_1 = require_naclTCP();
|
|
18301
|
+
Object.defineProperty(exports, "NaClFrameCollector", { enumerable: true, get: function() {
|
|
18302
|
+
return naclTCP_1.NaClFrameCollector;
|
|
18303
|
+
} });
|
|
18304
|
+
Object.defineProperty(exports, "NaClTCPPacket", { enumerable: true, get: function() {
|
|
18305
|
+
return naclTCP_1.NaClTCPPacket;
|
|
18306
|
+
} });
|
|
18307
|
+
Object.defineProperty(exports, "NaClTCPPacketConnection", { enumerable: true, get: function() {
|
|
18308
|
+
return naclTCP_1.NaClTCPPacketConnection;
|
|
18309
|
+
} });
|
|
18310
|
+
Object.defineProperty(exports, "NaClTCPStream", { enumerable: true, get: function() {
|
|
18311
|
+
return naclTCP_1.NaClTCPStream;
|
|
18312
|
+
} });
|
|
18313
|
+
Object.defineProperty(exports, "NaClTCPStreamConnection", { enumerable: true, get: function() {
|
|
18314
|
+
return naclTCP_1.NaClTCPStreamConnection;
|
|
18315
|
+
} });
|
|
18316
|
+
var videoDecoder_1 = require_videoDecoder();
|
|
18317
|
+
Object.defineProperty(exports, "HWAcceleration", { enumerable: true, get: function() {
|
|
18318
|
+
return videoDecoder_1.HWAcceleration;
|
|
18319
|
+
} });
|
|
18320
|
+
Object.defineProperty(exports, "ResultStatus", { enumerable: true, get: function() {
|
|
18321
|
+
return videoDecoder_1.ResultStatus;
|
|
18322
|
+
} });
|
|
18323
|
+
Object.defineProperty(exports, "VideoProfile", { enumerable: true, get: function() {
|
|
18324
|
+
return videoDecoder_1.VideoProfile;
|
|
18325
|
+
} });
|
|
18326
|
+
var DEFAULT_OPTIONS = {
|
|
18327
|
+
timeoutMs: 1e3
|
|
18328
|
+
};
|
|
18329
|
+
var naclRuntime = null;
|
|
18330
|
+
function isNaClSupported3() {
|
|
18331
|
+
return (
|
|
18332
|
+
// Keyed by mime type supported in older versions of Chrome that uses NaCl.
|
|
18333
|
+
navigator.mimeTypes["application/x-nacl"] !== void 0
|
|
18334
|
+
);
|
|
18335
|
+
}
|
|
18336
|
+
function createNaClDecoder2(options) {
|
|
18337
|
+
var requiredOptions = __assign(__assign({}, DEFAULT_OPTIONS), options);
|
|
18338
|
+
if (!isNaClSupported3()) {
|
|
18339
|
+
throw new Error("NaCl is not supported in this browser.");
|
|
18340
|
+
}
|
|
18341
|
+
var runtime = getNaClRuntime(requiredOptions.timeoutMs);
|
|
18342
|
+
return new naclDecoder_1.NaClDecoder(runtime.messageSender, runtime.naclModuleEl);
|
|
18343
|
+
}
|
|
18344
|
+
function createNaClTCP2(options) {
|
|
18345
|
+
var decoder = createNaClDecoder2(options);
|
|
18346
|
+
return decoder.createTCP();
|
|
18347
|
+
}
|
|
18348
|
+
function getNaClRuntime(timeoutMs) {
|
|
18349
|
+
if (naclRuntime) {
|
|
18350
|
+
return naclRuntime;
|
|
18351
|
+
}
|
|
18352
|
+
var messageListeners = (0, messageListeners_1.createMessageListeners)();
|
|
18353
|
+
var messageReceiver = new messageReceiver_1.MessageReceiver(messageListeners);
|
|
18354
|
+
var naclModuleEl = (0, module_1.createNaClModule)(messageReceiver.handleMessage.bind(messageReceiver));
|
|
18355
|
+
var messageSender = new messageSender_1.MessageSender(naclModuleEl, messageListeners, timeoutMs);
|
|
18356
|
+
naclRuntime = {
|
|
18357
|
+
messageSender,
|
|
18358
|
+
naclModuleEl
|
|
18359
|
+
};
|
|
18360
|
+
return naclRuntime;
|
|
18361
|
+
}
|
|
18362
|
+
}
|
|
18363
|
+
});
|
|
18364
|
+
|
|
18365
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/videoDecoder.js
|
|
18366
|
+
var require_videoDecoder2 = __commonJS({
|
|
18367
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/videoDecoder.js"(exports) {
|
|
18368
|
+
"use strict";
|
|
18369
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18370
|
+
exports.LatencyMode = exports.ResultStatus = void 0;
|
|
18371
|
+
var ResultStatus;
|
|
18372
|
+
(function(ResultStatus2) {
|
|
18373
|
+
ResultStatus2[ResultStatus2["Ok"] = 0] = "Ok";
|
|
18374
|
+
ResultStatus2[ResultStatus2["ErrorFailed"] = -2] = "ErrorFailed";
|
|
18375
|
+
ResultStatus2[ResultStatus2["ErrorBadArgument"] = -4] = "ErrorBadArgument";
|
|
18376
|
+
ResultStatus2[ResultStatus2["ErrorNoInit"] = -6] = "ErrorNoInit";
|
|
18377
|
+
})(ResultStatus || (exports.ResultStatus = ResultStatus = {}));
|
|
18378
|
+
var LatencyMode2;
|
|
18379
|
+
(function(LatencyMode3) {
|
|
18380
|
+
LatencyMode3[LatencyMode3["Normal"] = 0] = "Normal";
|
|
18381
|
+
LatencyMode3[LatencyMode3["Low"] = 1] = "Low";
|
|
18382
|
+
LatencyMode3[LatencyMode3["UltraLow"] = 2] = "UltraLow";
|
|
18383
|
+
})(LatencyMode2 || (exports.LatencyMode = LatencyMode2 = {}));
|
|
18384
|
+
}
|
|
18385
|
+
});
|
|
18386
|
+
|
|
18387
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/dom/script.js
|
|
18388
|
+
var require_script = __commonJS({
|
|
18389
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/dom/script.js"(exports) {
|
|
18390
|
+
"use strict";
|
|
18391
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
18392
|
+
function adopt(value) {
|
|
18393
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18394
|
+
resolve(value);
|
|
18395
|
+
});
|
|
18396
|
+
}
|
|
18397
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
18398
|
+
function fulfilled(value) {
|
|
18399
|
+
try {
|
|
18400
|
+
step(generator.next(value));
|
|
18401
|
+
} catch (e) {
|
|
18402
|
+
reject(e);
|
|
18403
|
+
}
|
|
18404
|
+
}
|
|
18405
|
+
function rejected(value) {
|
|
18406
|
+
try {
|
|
18407
|
+
step(generator["throw"](value));
|
|
18408
|
+
} catch (e) {
|
|
18409
|
+
reject(e);
|
|
18410
|
+
}
|
|
18411
|
+
}
|
|
18412
|
+
function step(result) {
|
|
18413
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
18414
|
+
}
|
|
18415
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18416
|
+
});
|
|
18417
|
+
};
|
|
18418
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
18419
|
+
var _ = { label: 0, sent: function() {
|
|
18420
|
+
if (t[0] & 1) throw t[1];
|
|
18421
|
+
return t[1];
|
|
18422
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
18423
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
18424
|
+
return this;
|
|
18425
|
+
}), g;
|
|
18426
|
+
function verb(n) {
|
|
18427
|
+
return function(v) {
|
|
18428
|
+
return step([n, v]);
|
|
18429
|
+
};
|
|
18430
|
+
}
|
|
18431
|
+
function step(op) {
|
|
18432
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18433
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18434
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18435
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
18436
|
+
switch (op[0]) {
|
|
18437
|
+
case 0:
|
|
18438
|
+
case 1:
|
|
18439
|
+
t = op;
|
|
18440
|
+
break;
|
|
18441
|
+
case 4:
|
|
18442
|
+
_.label++;
|
|
18443
|
+
return { value: op[1], done: false };
|
|
18444
|
+
case 5:
|
|
18445
|
+
_.label++;
|
|
18446
|
+
y = op[1];
|
|
18447
|
+
op = [0];
|
|
18448
|
+
continue;
|
|
18449
|
+
case 7:
|
|
18450
|
+
op = _.ops.pop();
|
|
18451
|
+
_.trys.pop();
|
|
18452
|
+
continue;
|
|
18453
|
+
default:
|
|
18454
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
18455
|
+
_ = 0;
|
|
18456
|
+
continue;
|
|
18457
|
+
}
|
|
18458
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
18459
|
+
_.label = op[1];
|
|
18460
|
+
break;
|
|
18461
|
+
}
|
|
18462
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
18463
|
+
_.label = t[1];
|
|
18464
|
+
t = op;
|
|
18465
|
+
break;
|
|
18466
|
+
}
|
|
18467
|
+
if (t && _.label < t[2]) {
|
|
18468
|
+
_.label = t[2];
|
|
18469
|
+
_.ops.push(op);
|
|
18470
|
+
break;
|
|
18471
|
+
}
|
|
18472
|
+
if (t[2]) _.ops.pop();
|
|
18473
|
+
_.trys.pop();
|
|
18474
|
+
continue;
|
|
18475
|
+
}
|
|
18476
|
+
op = body.call(thisArg, _);
|
|
18477
|
+
} catch (e) {
|
|
18478
|
+
op = [6, e];
|
|
18479
|
+
y = 0;
|
|
18480
|
+
} finally {
|
|
18481
|
+
f = t = 0;
|
|
18482
|
+
}
|
|
18483
|
+
if (op[0] & 5) throw op[1];
|
|
18484
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
18485
|
+
}
|
|
18486
|
+
};
|
|
18487
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18488
|
+
exports.injectScript = injectScript2;
|
|
18489
|
+
function injectScript2(url) {
|
|
18490
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18491
|
+
return __generator(this, function(_a) {
|
|
18492
|
+
return [2, new Promise(function(resolve, reject) {
|
|
18493
|
+
var scriptEl = document.createElement("script");
|
|
18494
|
+
scriptEl.src = url;
|
|
18495
|
+
document.head.appendChild(scriptEl);
|
|
18496
|
+
scriptEl.onerror = function(error) {
|
|
18497
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18498
|
+
return __generator(this, function(_a2) {
|
|
18499
|
+
reject(error);
|
|
18500
|
+
return [
|
|
18501
|
+
2
|
|
18502
|
+
/*return*/
|
|
18503
|
+
];
|
|
18504
|
+
});
|
|
18505
|
+
});
|
|
18506
|
+
};
|
|
18507
|
+
scriptEl.onload = function() {
|
|
18508
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18509
|
+
return __generator(this, function(_a2) {
|
|
18510
|
+
resolve();
|
|
18511
|
+
return [
|
|
18512
|
+
2
|
|
18513
|
+
/*return*/
|
|
18514
|
+
];
|
|
18515
|
+
});
|
|
18516
|
+
});
|
|
18517
|
+
};
|
|
18518
|
+
})];
|
|
18519
|
+
});
|
|
18520
|
+
});
|
|
18521
|
+
}
|
|
18522
|
+
}
|
|
18523
|
+
});
|
|
18524
|
+
|
|
18525
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmLoader.js
|
|
18526
|
+
var require_wasmLoader = __commonJS({
|
|
18527
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmLoader.js"(exports) {
|
|
18528
|
+
"use strict";
|
|
18529
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
18530
|
+
function adopt(value) {
|
|
18531
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18532
|
+
resolve(value);
|
|
18533
|
+
});
|
|
18534
|
+
}
|
|
18535
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
18536
|
+
function fulfilled(value) {
|
|
18537
|
+
try {
|
|
18538
|
+
step(generator.next(value));
|
|
18539
|
+
} catch (e) {
|
|
18540
|
+
reject(e);
|
|
18541
|
+
}
|
|
18542
|
+
}
|
|
18543
|
+
function rejected(value) {
|
|
18544
|
+
try {
|
|
18545
|
+
step(generator["throw"](value));
|
|
18546
|
+
} catch (e) {
|
|
18547
|
+
reject(e);
|
|
18548
|
+
}
|
|
18549
|
+
}
|
|
18550
|
+
function step(result) {
|
|
18551
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
18552
|
+
}
|
|
18553
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18554
|
+
});
|
|
18555
|
+
};
|
|
18556
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
18557
|
+
var _ = { label: 0, sent: function() {
|
|
18558
|
+
if (t[0] & 1) throw t[1];
|
|
18559
|
+
return t[1];
|
|
18560
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
18561
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
18562
|
+
return this;
|
|
18563
|
+
}), g;
|
|
18564
|
+
function verb(n) {
|
|
18565
|
+
return function(v) {
|
|
18566
|
+
return step([n, v]);
|
|
18567
|
+
};
|
|
18568
|
+
}
|
|
18569
|
+
function step(op) {
|
|
18570
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18571
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18572
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18573
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
18574
|
+
switch (op[0]) {
|
|
18575
|
+
case 0:
|
|
18576
|
+
case 1:
|
|
18577
|
+
t = op;
|
|
18578
|
+
break;
|
|
18579
|
+
case 4:
|
|
18580
|
+
_.label++;
|
|
18581
|
+
return { value: op[1], done: false };
|
|
18582
|
+
case 5:
|
|
18583
|
+
_.label++;
|
|
18584
|
+
y = op[1];
|
|
18585
|
+
op = [0];
|
|
18586
|
+
continue;
|
|
18587
|
+
case 7:
|
|
18588
|
+
op = _.ops.pop();
|
|
18589
|
+
_.trys.pop();
|
|
18590
|
+
continue;
|
|
18591
|
+
default:
|
|
18592
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
18593
|
+
_ = 0;
|
|
18594
|
+
continue;
|
|
18595
|
+
}
|
|
18596
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
18597
|
+
_.label = op[1];
|
|
18598
|
+
break;
|
|
18599
|
+
}
|
|
18600
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
18601
|
+
_.label = t[1];
|
|
18602
|
+
t = op;
|
|
18603
|
+
break;
|
|
18604
|
+
}
|
|
18605
|
+
if (t && _.label < t[2]) {
|
|
18606
|
+
_.label = t[2];
|
|
18607
|
+
_.ops.push(op);
|
|
18608
|
+
break;
|
|
18609
|
+
}
|
|
18610
|
+
if (t[2]) _.ops.pop();
|
|
18611
|
+
_.trys.pop();
|
|
18612
|
+
continue;
|
|
18613
|
+
}
|
|
18614
|
+
op = body.call(thisArg, _);
|
|
18615
|
+
} catch (e) {
|
|
18616
|
+
op = [6, e];
|
|
18617
|
+
y = 0;
|
|
18618
|
+
} finally {
|
|
18619
|
+
f = t = 0;
|
|
18620
|
+
}
|
|
18621
|
+
if (op[0] & 5) throw op[1];
|
|
18622
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
18623
|
+
}
|
|
18624
|
+
};
|
|
18625
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18626
|
+
exports.loadWasmModule = loadWasmModule;
|
|
18627
|
+
exports.ensureNativeModule = ensureNativeModule;
|
|
18628
|
+
exports.destroyNativeModule = destroyNativeModule;
|
|
18629
|
+
var script_1 = require_script();
|
|
18630
|
+
function loadWasmModule() {
|
|
18631
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18632
|
+
var memoryInitializer, memInitXHR;
|
|
18633
|
+
return __generator(this, function(_a) {
|
|
18634
|
+
switch (_a.label) {
|
|
18635
|
+
case 0:
|
|
18636
|
+
if (window.Module) {
|
|
18637
|
+
return [
|
|
18638
|
+
2
|
|
18639
|
+
/*return*/
|
|
18640
|
+
];
|
|
18641
|
+
}
|
|
18642
|
+
window.Module = {};
|
|
18643
|
+
memoryInitializer = "samsung-wasm-decoder.js.mem";
|
|
18644
|
+
if (window.Module.locateFile) {
|
|
18645
|
+
memoryInitializer = window.Module.locateFile(memoryInitializer, "");
|
|
18646
|
+
}
|
|
18647
|
+
window.Module.memoryInitializerRequestURL = memoryInitializer;
|
|
18648
|
+
memInitXHR = new XMLHttpRequest();
|
|
18649
|
+
window.Module.memoryInitializerRequest = memInitXHR;
|
|
18650
|
+
memInitXHR.open("GET", memoryInitializer, true);
|
|
18651
|
+
memInitXHR.responseType = "arraybuffer";
|
|
18652
|
+
memInitXHR.send(null);
|
|
18653
|
+
return [4, (0, script_1.injectScript)("samsung-wasm-decoder.js")];
|
|
18654
|
+
case 1:
|
|
18655
|
+
_a.sent();
|
|
18656
|
+
return [
|
|
18657
|
+
2
|
|
18658
|
+
/*return*/
|
|
18659
|
+
];
|
|
18660
|
+
}
|
|
18661
|
+
});
|
|
18662
|
+
});
|
|
18663
|
+
}
|
|
18664
|
+
var native;
|
|
18665
|
+
function ensureNativeModule() {
|
|
18666
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18667
|
+
var mod;
|
|
18668
|
+
var _a;
|
|
18669
|
+
return __generator(this, function(_b) {
|
|
18670
|
+
switch (_b.label) {
|
|
18671
|
+
case 0:
|
|
18672
|
+
if (native) {
|
|
18673
|
+
return [2, native];
|
|
18674
|
+
}
|
|
18675
|
+
mod = (_a = window.SamsungWasmDecoderModule) === null || _a === void 0 ? void 0 : _a.call(window);
|
|
18676
|
+
if (!mod) {
|
|
18677
|
+
throw new Error("Samsung Wasm Decoder native module not available");
|
|
18678
|
+
}
|
|
18679
|
+
delete mod.then;
|
|
18680
|
+
return [4, new Promise(function(resolve) {
|
|
18681
|
+
mod.onRuntimeInitialized = function() {
|
|
18682
|
+
return resolve(null);
|
|
18683
|
+
};
|
|
18684
|
+
})];
|
|
18685
|
+
case 1:
|
|
18686
|
+
_b.sent();
|
|
18687
|
+
native = mod;
|
|
18688
|
+
return [2, mod];
|
|
18689
|
+
}
|
|
18690
|
+
});
|
|
18691
|
+
});
|
|
18692
|
+
}
|
|
18693
|
+
function destroyNativeModule() {
|
|
18694
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18695
|
+
return __generator(this, function(_a) {
|
|
18696
|
+
native = void 0;
|
|
18697
|
+
return [
|
|
18698
|
+
2
|
|
18699
|
+
/*return*/
|
|
18700
|
+
];
|
|
18701
|
+
});
|
|
18702
|
+
});
|
|
18703
|
+
}
|
|
18704
|
+
}
|
|
18705
|
+
});
|
|
18706
|
+
|
|
18707
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmTCP.js
|
|
18708
|
+
var require_wasmTCP = __commonJS({
|
|
18709
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmTCP.js"(exports) {
|
|
18710
|
+
"use strict";
|
|
18711
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
18712
|
+
function adopt(value) {
|
|
18713
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18714
|
+
resolve(value);
|
|
18715
|
+
});
|
|
18716
|
+
}
|
|
18717
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
18718
|
+
function fulfilled(value) {
|
|
18719
|
+
try {
|
|
18720
|
+
step(generator.next(value));
|
|
18721
|
+
} catch (e) {
|
|
18722
|
+
reject(e);
|
|
18723
|
+
}
|
|
18724
|
+
}
|
|
18725
|
+
function rejected(value) {
|
|
18726
|
+
try {
|
|
18727
|
+
step(generator["throw"](value));
|
|
18728
|
+
} catch (e) {
|
|
18729
|
+
reject(e);
|
|
18730
|
+
}
|
|
18731
|
+
}
|
|
18732
|
+
function step(result) {
|
|
18733
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
18734
|
+
}
|
|
18735
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18736
|
+
});
|
|
18737
|
+
};
|
|
18738
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
18739
|
+
var _ = { label: 0, sent: function() {
|
|
18740
|
+
if (t[0] & 1) throw t[1];
|
|
18741
|
+
return t[1];
|
|
18742
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
18743
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
18744
|
+
return this;
|
|
18745
|
+
}), g;
|
|
18746
|
+
function verb(n) {
|
|
18747
|
+
return function(v) {
|
|
18748
|
+
return step([n, v]);
|
|
18749
|
+
};
|
|
18750
|
+
}
|
|
18751
|
+
function step(op) {
|
|
18752
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18753
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18754
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18755
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
18756
|
+
switch (op[0]) {
|
|
18757
|
+
case 0:
|
|
18758
|
+
case 1:
|
|
18759
|
+
t = op;
|
|
18760
|
+
break;
|
|
18761
|
+
case 4:
|
|
18762
|
+
_.label++;
|
|
18763
|
+
return { value: op[1], done: false };
|
|
18764
|
+
case 5:
|
|
18765
|
+
_.label++;
|
|
18766
|
+
y = op[1];
|
|
18767
|
+
op = [0];
|
|
18768
|
+
continue;
|
|
18769
|
+
case 7:
|
|
18770
|
+
op = _.ops.pop();
|
|
18771
|
+
_.trys.pop();
|
|
18772
|
+
continue;
|
|
18773
|
+
default:
|
|
18774
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
18775
|
+
_ = 0;
|
|
18776
|
+
continue;
|
|
18777
|
+
}
|
|
18778
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
18779
|
+
_.label = op[1];
|
|
18780
|
+
break;
|
|
18781
|
+
}
|
|
18782
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
18783
|
+
_.label = t[1];
|
|
18784
|
+
t = op;
|
|
18785
|
+
break;
|
|
18786
|
+
}
|
|
18787
|
+
if (t && _.label < t[2]) {
|
|
18788
|
+
_.label = t[2];
|
|
18789
|
+
_.ops.push(op);
|
|
18790
|
+
break;
|
|
18791
|
+
}
|
|
18792
|
+
if (t[2]) _.ops.pop();
|
|
18793
|
+
_.trys.pop();
|
|
18794
|
+
continue;
|
|
18795
|
+
}
|
|
18796
|
+
op = body.call(thisArg, _);
|
|
18797
|
+
} catch (e) {
|
|
18798
|
+
op = [6, e];
|
|
18799
|
+
y = 0;
|
|
18800
|
+
} finally {
|
|
18801
|
+
f = t = 0;
|
|
18802
|
+
}
|
|
18803
|
+
if (op[0] & 5) throw op[1];
|
|
18804
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
18805
|
+
}
|
|
18806
|
+
};
|
|
18807
|
+
var __values = exports && exports.__values || function(o) {
|
|
18808
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
18809
|
+
if (m) return m.call(o);
|
|
18810
|
+
if (o && typeof o.length === "number") return {
|
|
18811
|
+
next: function() {
|
|
18812
|
+
if (o && i >= o.length) o = void 0;
|
|
18813
|
+
return { value: o && o[i++], done: !o };
|
|
18814
|
+
}
|
|
18815
|
+
};
|
|
18816
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
18817
|
+
};
|
|
18818
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18819
|
+
exports.SamsungWasmTCPPacket = exports.SamsungWasmTCPStream = exports.SamsungWasmTCPStreamConnection = exports.SamsungWasmTCPPacketConnection = exports.SamsungWasmFrameCollector = void 0;
|
|
18820
|
+
var wasmLoader_1 = require_wasmLoader();
|
|
18821
|
+
function ensureCallbackStorage() {
|
|
18822
|
+
if (typeof window !== "undefined") {
|
|
18823
|
+
if (!window._swtConnectCallbacks) {
|
|
18824
|
+
window._swtConnectCallbacks = {};
|
|
18825
|
+
}
|
|
18826
|
+
if (!window._swtSendCallbacks) {
|
|
18827
|
+
window._swtSendCallbacks = {};
|
|
18828
|
+
}
|
|
18829
|
+
if (!window._swtRecvCallbacks) {
|
|
18830
|
+
window._swtRecvCallbacks = {};
|
|
18831
|
+
}
|
|
18832
|
+
if (!window._swtFrameCallbacks) {
|
|
18833
|
+
window._swtFrameCallbacks = {};
|
|
18834
|
+
}
|
|
18835
|
+
}
|
|
18836
|
+
}
|
|
18837
|
+
var SamsungWasmFrameCollector = (
|
|
18838
|
+
/** @class */
|
|
18839
|
+
function() {
|
|
18840
|
+
function SamsungWasmFrameCollector2(_connection, _maxPacketSize) {
|
|
18841
|
+
if (_maxPacketSize === void 0) {
|
|
18842
|
+
_maxPacketSize = 65535;
|
|
18843
|
+
}
|
|
18844
|
+
this._connection = _connection;
|
|
18845
|
+
this._maxPacketSize = _maxPacketSize;
|
|
18846
|
+
this._collectorHandle = 0;
|
|
18847
|
+
this._frameQueue = [];
|
|
18848
|
+
this._frameResolvers = [];
|
|
18849
|
+
this._error = null;
|
|
18850
|
+
}
|
|
18851
|
+
SamsungWasmFrameCollector2.prototype.initialize = function() {
|
|
18852
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18853
|
+
var native, swtFrameCollectorCreate;
|
|
18854
|
+
var _this = this;
|
|
18855
|
+
return __generator(this, function(_a) {
|
|
18856
|
+
switch (_a.label) {
|
|
18857
|
+
case 0:
|
|
18858
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
18859
|
+
case 1:
|
|
18860
|
+
native = _a.sent();
|
|
18861
|
+
ensureCallbackStorage();
|
|
18862
|
+
swtFrameCollectorCreate = native.cwrap("swt_frame_collector_create", "number", ["number", "number"]);
|
|
18863
|
+
this._collectorHandle = swtFrameCollectorCreate(this._connection.getHandle(), this._maxPacketSize);
|
|
18864
|
+
if (this._collectorHandle === 0) {
|
|
18865
|
+
throw new Error("Failed to create frame collector");
|
|
18866
|
+
}
|
|
18867
|
+
window._swtFrameCallbacks[this._collectorHandle] = {
|
|
18868
|
+
onFrame: function(frame) {
|
|
18869
|
+
return _this._handleFrame(frame);
|
|
18870
|
+
},
|
|
18871
|
+
onError: function(error) {
|
|
18872
|
+
return _this._handleError(error);
|
|
18873
|
+
}
|
|
18874
|
+
};
|
|
18875
|
+
return [
|
|
18876
|
+
2
|
|
18877
|
+
/*return*/
|
|
18878
|
+
];
|
|
18879
|
+
}
|
|
18880
|
+
});
|
|
18881
|
+
});
|
|
18882
|
+
};
|
|
18883
|
+
SamsungWasmFrameCollector2.prototype.start = function() {
|
|
18884
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18885
|
+
var native, swtFrameCollectorStart, result;
|
|
18886
|
+
return __generator(this, function(_a) {
|
|
18887
|
+
switch (_a.label) {
|
|
18888
|
+
case 0:
|
|
18889
|
+
if (this._collectorHandle === 0) {
|
|
18890
|
+
throw new Error("Frame collector not initialized");
|
|
18891
|
+
}
|
|
18892
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
18893
|
+
case 1:
|
|
18894
|
+
native = _a.sent();
|
|
18895
|
+
swtFrameCollectorStart = native.cwrap("swt_frame_collector_start", "number", ["number"]);
|
|
18896
|
+
result = swtFrameCollectorStart(this._collectorHandle);
|
|
18897
|
+
if (result < 0) {
|
|
18898
|
+
throw new Error("Failed to start frame collector: ".concat(result));
|
|
18899
|
+
}
|
|
18900
|
+
return [
|
|
18901
|
+
2
|
|
18902
|
+
/*return*/
|
|
18903
|
+
];
|
|
18904
|
+
}
|
|
18905
|
+
});
|
|
18906
|
+
});
|
|
18907
|
+
};
|
|
18908
|
+
SamsungWasmFrameCollector2.prototype.stop = function() {
|
|
18909
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18910
|
+
var native, swtFrameCollectorStop;
|
|
18911
|
+
return __generator(this, function(_a) {
|
|
18912
|
+
switch (_a.label) {
|
|
18913
|
+
case 0:
|
|
18914
|
+
if (this._collectorHandle === 0)
|
|
18915
|
+
return [
|
|
18916
|
+
2
|
|
18917
|
+
/*return*/
|
|
18918
|
+
];
|
|
18919
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
18920
|
+
case 1:
|
|
18921
|
+
native = _a.sent();
|
|
18922
|
+
swtFrameCollectorStop = native.cwrap("swt_frame_collector_stop", "void", ["number"]);
|
|
18923
|
+
swtFrameCollectorStop(this._collectorHandle);
|
|
18924
|
+
return [
|
|
18925
|
+
2
|
|
18926
|
+
/*return*/
|
|
18927
|
+
];
|
|
18928
|
+
}
|
|
18929
|
+
});
|
|
18930
|
+
});
|
|
18931
|
+
};
|
|
18932
|
+
SamsungWasmFrameCollector2.prototype.destroy = function() {
|
|
18933
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18934
|
+
var native, swtFrameCollectorDestroy, error, _a, _b, resolver;
|
|
18935
|
+
var e_1, _c;
|
|
18936
|
+
return __generator(this, function(_d) {
|
|
18937
|
+
switch (_d.label) {
|
|
18938
|
+
case 0:
|
|
18939
|
+
if (this._collectorHandle === 0)
|
|
18940
|
+
return [
|
|
18941
|
+
2
|
|
18942
|
+
/*return*/
|
|
18943
|
+
];
|
|
18944
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
18945
|
+
case 1:
|
|
18946
|
+
native = _d.sent();
|
|
18947
|
+
swtFrameCollectorDestroy = native.cwrap("swt_frame_collector_destroy", "void", ["number"]);
|
|
18948
|
+
if (window._swtFrameCallbacks) {
|
|
18949
|
+
delete window._swtFrameCallbacks[this._collectorHandle];
|
|
18950
|
+
}
|
|
18951
|
+
swtFrameCollectorDestroy(this._collectorHandle);
|
|
18952
|
+
this._collectorHandle = 0;
|
|
18953
|
+
error = new Error("Frame collector destroyed");
|
|
18954
|
+
try {
|
|
18955
|
+
for (_a = __values(this._frameResolvers), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
18956
|
+
resolver = _b.value;
|
|
18957
|
+
resolver.reject(error);
|
|
18958
|
+
}
|
|
18959
|
+
} catch (e_1_1) {
|
|
18960
|
+
e_1 = { error: e_1_1 };
|
|
18961
|
+
} finally {
|
|
18962
|
+
try {
|
|
18963
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
18964
|
+
} finally {
|
|
18965
|
+
if (e_1) throw e_1.error;
|
|
18966
|
+
}
|
|
18967
|
+
}
|
|
18968
|
+
this._frameResolvers = [];
|
|
18969
|
+
return [
|
|
18970
|
+
2
|
|
18971
|
+
/*return*/
|
|
18972
|
+
];
|
|
18973
|
+
}
|
|
18974
|
+
});
|
|
18975
|
+
});
|
|
18976
|
+
};
|
|
18977
|
+
SamsungWasmFrameCollector2.prototype.collectFrame = function(options) {
|
|
18978
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18979
|
+
var frame;
|
|
18980
|
+
var _this = this;
|
|
18981
|
+
var _a, _b;
|
|
18982
|
+
return __generator(this, function(_c) {
|
|
18983
|
+
if (this._error) {
|
|
18984
|
+
throw this._error;
|
|
18985
|
+
}
|
|
18986
|
+
if (this._frameQueue.length > 0) {
|
|
18987
|
+
frame = this._frameQueue.shift();
|
|
18988
|
+
(_a = options === null || options === void 0 ? void 0 : options.onStart) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
18989
|
+
(_b = options === null || options === void 0 ? void 0 : options.onEnd) === null || _b === void 0 ? void 0 : _b.call(options);
|
|
18990
|
+
return [2, frame];
|
|
18991
|
+
}
|
|
18992
|
+
return [2, new Promise(function(resolve, reject) {
|
|
18993
|
+
_this._frameResolvers.push({ resolve, reject, options });
|
|
18994
|
+
})];
|
|
18995
|
+
});
|
|
18996
|
+
});
|
|
18997
|
+
};
|
|
18998
|
+
SamsungWasmFrameCollector2.getFrameDataPointer = function(refId) {
|
|
18999
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19000
|
+
var native, swtFrameGetData;
|
|
19001
|
+
return __generator(this, function(_a) {
|
|
19002
|
+
switch (_a.label) {
|
|
19003
|
+
case 0:
|
|
19004
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19005
|
+
case 1:
|
|
19006
|
+
native = _a.sent();
|
|
19007
|
+
swtFrameGetData = native.cwrap("swt_frame_get_data", "number", [
|
|
19008
|
+
"number"
|
|
19009
|
+
]);
|
|
19010
|
+
return [2, swtFrameGetData(refId)];
|
|
19011
|
+
}
|
|
19012
|
+
});
|
|
19013
|
+
});
|
|
19014
|
+
};
|
|
19015
|
+
SamsungWasmFrameCollector2.getFrameSize = function(refId) {
|
|
19016
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19017
|
+
var native, swtFrameGetSize;
|
|
19018
|
+
return __generator(this, function(_a) {
|
|
19019
|
+
switch (_a.label) {
|
|
19020
|
+
case 0:
|
|
19021
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19022
|
+
case 1:
|
|
19023
|
+
native = _a.sent();
|
|
19024
|
+
swtFrameGetSize = native.cwrap("swt_frame_get_size", "number", [
|
|
19025
|
+
"number"
|
|
19026
|
+
]);
|
|
19027
|
+
return [2, swtFrameGetSize(refId)];
|
|
19028
|
+
}
|
|
19029
|
+
});
|
|
19030
|
+
});
|
|
19031
|
+
};
|
|
19032
|
+
SamsungWasmFrameCollector2.getFrameType = function(refId) {
|
|
19033
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19034
|
+
var native, swtFrameGetType;
|
|
19035
|
+
return __generator(this, function(_a) {
|
|
19036
|
+
switch (_a.label) {
|
|
19037
|
+
case 0:
|
|
19038
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19039
|
+
case 1:
|
|
19040
|
+
native = _a.sent();
|
|
19041
|
+
swtFrameGetType = native.cwrap("swt_frame_get_type", "number", [
|
|
19042
|
+
"number"
|
|
19043
|
+
]);
|
|
19044
|
+
return [2, swtFrameGetType(refId)];
|
|
19045
|
+
}
|
|
19046
|
+
});
|
|
19047
|
+
});
|
|
19048
|
+
};
|
|
19049
|
+
SamsungWasmFrameCollector2.getFrameTimestamp = function(refId) {
|
|
19050
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19051
|
+
var native, swtFrameGetTimestampLo, swtFrameGetTimestampHi, lo, hi;
|
|
19052
|
+
return __generator(this, function(_a) {
|
|
19053
|
+
switch (_a.label) {
|
|
19054
|
+
case 0:
|
|
19055
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19056
|
+
case 1:
|
|
19057
|
+
native = _a.sent();
|
|
19058
|
+
swtFrameGetTimestampLo = native.cwrap("swt_frame_get_timestamp_lo", "number", ["number"]);
|
|
19059
|
+
swtFrameGetTimestampHi = native.cwrap("swt_frame_get_timestamp_hi", "number", ["number"]);
|
|
19060
|
+
lo = swtFrameGetTimestampLo(refId);
|
|
19061
|
+
hi = swtFrameGetTimestampHi(refId);
|
|
19062
|
+
return [2, { lo, hi }];
|
|
19063
|
+
}
|
|
19064
|
+
});
|
|
19065
|
+
});
|
|
19066
|
+
};
|
|
19067
|
+
SamsungWasmFrameCollector2.releaseFrame = function(refId) {
|
|
19068
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19069
|
+
var native, swtFrameRelease;
|
|
19070
|
+
return __generator(this, function(_a) {
|
|
19071
|
+
switch (_a.label) {
|
|
19072
|
+
case 0:
|
|
19073
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19074
|
+
case 1:
|
|
19075
|
+
native = _a.sent();
|
|
19076
|
+
swtFrameRelease = native.cwrap("swt_frame_release", "void", [
|
|
19077
|
+
"number"
|
|
19078
|
+
]);
|
|
19079
|
+
swtFrameRelease(refId);
|
|
19080
|
+
return [
|
|
19081
|
+
2
|
|
19082
|
+
/*return*/
|
|
19083
|
+
];
|
|
19084
|
+
}
|
|
19085
|
+
});
|
|
19086
|
+
});
|
|
19087
|
+
};
|
|
19088
|
+
SamsungWasmFrameCollector2.prototype._handleFrame = function(frame) {
|
|
19089
|
+
var _a, _b, _c, _d;
|
|
19090
|
+
if (this._frameResolvers.length > 0) {
|
|
19091
|
+
var resolver = this._frameResolvers.shift();
|
|
19092
|
+
(_b = (_a = resolver.options) === null || _a === void 0 ? void 0 : _a.onStart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
19093
|
+
(_d = (_c = resolver.options) === null || _c === void 0 ? void 0 : _c.onEnd) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
19094
|
+
resolver.resolve(frame);
|
|
19095
|
+
} else {
|
|
19096
|
+
this._frameQueue.push(frame);
|
|
19097
|
+
}
|
|
19098
|
+
};
|
|
19099
|
+
SamsungWasmFrameCollector2.prototype._handleError = function(error) {
|
|
19100
|
+
var e_2, _a;
|
|
19101
|
+
this._error = error;
|
|
19102
|
+
try {
|
|
19103
|
+
for (var _b = __values(this._frameResolvers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
19104
|
+
var resolver = _c.value;
|
|
19105
|
+
resolver.reject(error);
|
|
19106
|
+
}
|
|
19107
|
+
} catch (e_2_1) {
|
|
19108
|
+
e_2 = { error: e_2_1 };
|
|
19109
|
+
} finally {
|
|
19110
|
+
try {
|
|
19111
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
19112
|
+
} finally {
|
|
19113
|
+
if (e_2) throw e_2.error;
|
|
19114
|
+
}
|
|
19115
|
+
}
|
|
19116
|
+
this._frameResolvers = [];
|
|
19117
|
+
};
|
|
19118
|
+
return SamsungWasmFrameCollector2;
|
|
19119
|
+
}()
|
|
19120
|
+
);
|
|
19121
|
+
exports.SamsungWasmFrameCollector = SamsungWasmFrameCollector;
|
|
19122
|
+
var SamsungWasmTCPPacketConnection = (
|
|
19123
|
+
/** @class */
|
|
19124
|
+
function() {
|
|
19125
|
+
function SamsungWasmTCPPacketConnection2(handle, _maxPacketSize) {
|
|
19126
|
+
if (_maxPacketSize === void 0) {
|
|
19127
|
+
_maxPacketSize = 65535;
|
|
19128
|
+
}
|
|
19129
|
+
this._maxPacketSize = _maxPacketSize;
|
|
19130
|
+
this._nextRequestId = 1;
|
|
19131
|
+
this._frameCollector = null;
|
|
19132
|
+
this._frameCollectorStarted = false;
|
|
19133
|
+
this._handle = handle;
|
|
19134
|
+
}
|
|
19135
|
+
SamsungWasmTCPPacketConnection2.prototype.getHandle = function() {
|
|
19136
|
+
return this._handle;
|
|
19137
|
+
};
|
|
19138
|
+
SamsungWasmTCPPacketConnection2.prototype.isConnected = function() {
|
|
19139
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19140
|
+
var native, swtIsConnected;
|
|
19141
|
+
return __generator(this, function(_a) {
|
|
19142
|
+
switch (_a.label) {
|
|
19143
|
+
case 0:
|
|
19144
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19145
|
+
case 1:
|
|
19146
|
+
native = _a.sent();
|
|
19147
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19148
|
+
"number"
|
|
19149
|
+
]);
|
|
19150
|
+
return [2, swtIsConnected(this._handle) === 1];
|
|
19151
|
+
}
|
|
19152
|
+
});
|
|
19153
|
+
});
|
|
19154
|
+
};
|
|
19155
|
+
SamsungWasmTCPPacketConnection2.prototype.isConnecting = function() {
|
|
19156
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19157
|
+
var native, swtIsConnected;
|
|
19158
|
+
return __generator(this, function(_a) {
|
|
19159
|
+
switch (_a.label) {
|
|
19160
|
+
case 0:
|
|
19161
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19162
|
+
case 1:
|
|
19163
|
+
native = _a.sent();
|
|
19164
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19165
|
+
"number"
|
|
19166
|
+
]);
|
|
19167
|
+
return [2, swtIsConnected(this._handle) === -1];
|
|
19168
|
+
}
|
|
19169
|
+
});
|
|
19170
|
+
});
|
|
19171
|
+
};
|
|
19172
|
+
SamsungWasmTCPPacketConnection2.prototype.send = function(data) {
|
|
19173
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19174
|
+
var native, swtIsConnected, connStatus, requestId, callbackKey, sendPromise, ptr, swtPacketSendAsync, result;
|
|
19175
|
+
return __generator(this, function(_a) {
|
|
19176
|
+
switch (_a.label) {
|
|
19177
|
+
case 0:
|
|
19178
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19179
|
+
case 1:
|
|
19180
|
+
native = _a.sent();
|
|
19181
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19182
|
+
"number"
|
|
19183
|
+
]);
|
|
19184
|
+
connStatus = swtIsConnected(this._handle);
|
|
19185
|
+
if (connStatus !== 1) {
|
|
19186
|
+
if (connStatus === -1) {
|
|
19187
|
+
throw new Error("Connection is still in progress");
|
|
19188
|
+
}
|
|
19189
|
+
throw new Error("Connection is not active");
|
|
19190
|
+
}
|
|
19191
|
+
ensureCallbackStorage();
|
|
19192
|
+
requestId = this._nextRequestId++;
|
|
19193
|
+
callbackKey = "".concat(this._handle, "_").concat(requestId);
|
|
19194
|
+
sendPromise = new Promise(function(resolve, reject) {
|
|
19195
|
+
window._swtSendCallbacks[callbackKey] = { resolve, reject };
|
|
19196
|
+
});
|
|
19197
|
+
ptr = native._malloc(data.byteLength);
|
|
19198
|
+
try {
|
|
19199
|
+
native.HEAPU8.set(new Uint8Array(data), ptr);
|
|
19200
|
+
swtPacketSendAsync = native.cwrap("swt_packet_send_async", "number", ["number", "number", "number", "number"]);
|
|
19201
|
+
result = swtPacketSendAsync(this._handle, ptr, data.byteLength, requestId);
|
|
19202
|
+
if (result !== 0) {
|
|
19203
|
+
delete window._swtSendCallbacks[callbackKey];
|
|
19204
|
+
throw new Error("Failed to start send operation, error code: ".concat(result));
|
|
19205
|
+
}
|
|
19206
|
+
} catch (e) {
|
|
19207
|
+
native._free(ptr);
|
|
19208
|
+
throw e;
|
|
19209
|
+
}
|
|
19210
|
+
native._free(ptr);
|
|
19211
|
+
return [2, sendPromise];
|
|
19212
|
+
}
|
|
19213
|
+
});
|
|
19214
|
+
});
|
|
19215
|
+
};
|
|
19216
|
+
SamsungWasmTCPPacketConnection2.prototype.recv = function() {
|
|
19217
|
+
return __awaiter(this, arguments, void 0, function(maxSize) {
|
|
19218
|
+
var native, swtIsConnected, connStatus, requestId, callbackKey, recvPromise, swtPacketRecvAsync, result;
|
|
19219
|
+
if (maxSize === void 0) {
|
|
19220
|
+
maxSize = 65535;
|
|
19221
|
+
}
|
|
19222
|
+
return __generator(this, function(_a) {
|
|
19223
|
+
switch (_a.label) {
|
|
19224
|
+
case 0:
|
|
19225
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19226
|
+
case 1:
|
|
19227
|
+
native = _a.sent();
|
|
19228
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19229
|
+
"number"
|
|
19230
|
+
]);
|
|
19231
|
+
connStatus = swtIsConnected(this._handle);
|
|
19232
|
+
if (connStatus !== 1) {
|
|
19233
|
+
if (connStatus === -1) {
|
|
19234
|
+
throw new Error("Connection is still in progress");
|
|
19235
|
+
}
|
|
19236
|
+
throw new Error("Connection is not active");
|
|
19237
|
+
}
|
|
19238
|
+
ensureCallbackStorage();
|
|
19239
|
+
requestId = this._nextRequestId++;
|
|
19240
|
+
callbackKey = "".concat(this._handle, "_").concat(requestId);
|
|
19241
|
+
recvPromise = new Promise(function(resolve, reject) {
|
|
19242
|
+
window._swtRecvCallbacks[callbackKey] = { resolve, reject };
|
|
19243
|
+
});
|
|
19244
|
+
swtPacketRecvAsync = native.cwrap("swt_packet_recv_async", "number", [
|
|
19245
|
+
"number",
|
|
19246
|
+
"number",
|
|
19247
|
+
"number"
|
|
19248
|
+
]);
|
|
19249
|
+
result = swtPacketRecvAsync(this._handle, maxSize, requestId);
|
|
19250
|
+
if (result !== 0) {
|
|
19251
|
+
delete window._swtRecvCallbacks[callbackKey];
|
|
19252
|
+
throw new Error("Failed to start recv operation, error code: ".concat(result));
|
|
19253
|
+
}
|
|
19254
|
+
return [2, recvPromise];
|
|
19255
|
+
}
|
|
19256
|
+
});
|
|
19257
|
+
});
|
|
19258
|
+
};
|
|
19259
|
+
SamsungWasmTCPPacketConnection2.prototype.collectFrame = function(options) {
|
|
19260
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19261
|
+
return __generator(this, function(_a) {
|
|
19262
|
+
switch (_a.label) {
|
|
19263
|
+
case 0:
|
|
19264
|
+
if (!!this._frameCollector) return [3, 2];
|
|
19265
|
+
this._frameCollector = new SamsungWasmFrameCollector(this, this._maxPacketSize);
|
|
19266
|
+
return [4, this._frameCollector.initialize()];
|
|
19267
|
+
case 1:
|
|
19268
|
+
_a.sent();
|
|
19269
|
+
_a.label = 2;
|
|
19270
|
+
case 2:
|
|
19271
|
+
if (!!this._frameCollectorStarted) return [3, 4];
|
|
19272
|
+
return [4, this._frameCollector.start()];
|
|
19273
|
+
case 3:
|
|
19274
|
+
_a.sent();
|
|
19275
|
+
this._frameCollectorStarted = true;
|
|
19276
|
+
_a.label = 4;
|
|
19277
|
+
case 4:
|
|
19278
|
+
return [2, this._frameCollector.collectFrame(options)];
|
|
19279
|
+
}
|
|
19280
|
+
});
|
|
19281
|
+
});
|
|
19282
|
+
};
|
|
19283
|
+
SamsungWasmTCPPacketConnection2.prototype.createFrameCollector = function() {
|
|
19284
|
+
return __awaiter(this, arguments, void 0, function(maxPacketSize) {
|
|
19285
|
+
var collector;
|
|
19286
|
+
if (maxPacketSize === void 0) {
|
|
19287
|
+
maxPacketSize = 65535;
|
|
19288
|
+
}
|
|
19289
|
+
return __generator(this, function(_a) {
|
|
19290
|
+
switch (_a.label) {
|
|
19291
|
+
case 0:
|
|
19292
|
+
collector = new SamsungWasmFrameCollector(this, maxPacketSize);
|
|
19293
|
+
return [4, collector.initialize()];
|
|
19294
|
+
case 1:
|
|
19295
|
+
_a.sent();
|
|
19296
|
+
return [2, collector];
|
|
19297
|
+
}
|
|
19298
|
+
});
|
|
19299
|
+
});
|
|
19300
|
+
};
|
|
19301
|
+
SamsungWasmTCPPacketConnection2.prototype.close = function() {
|
|
19302
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19303
|
+
var native, swtClose;
|
|
19304
|
+
return __generator(this, function(_a) {
|
|
19305
|
+
switch (_a.label) {
|
|
19306
|
+
case 0:
|
|
19307
|
+
if (!this._frameCollector) return [3, 3];
|
|
19308
|
+
return [4, this._frameCollector.stop()];
|
|
19309
|
+
case 1:
|
|
19310
|
+
_a.sent();
|
|
19311
|
+
return [4, this._frameCollector.destroy()];
|
|
19312
|
+
case 2:
|
|
19313
|
+
_a.sent();
|
|
19314
|
+
this._frameCollector = null;
|
|
19315
|
+
this._frameCollectorStarted = false;
|
|
19316
|
+
_a.label = 3;
|
|
19317
|
+
case 3:
|
|
19318
|
+
if (!(this._handle !== 0)) return [3, 5];
|
|
19319
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19320
|
+
case 4:
|
|
19321
|
+
native = _a.sent();
|
|
19322
|
+
swtClose = native.cwrap("swt_close", "void", [
|
|
19323
|
+
"number"
|
|
19324
|
+
]);
|
|
19325
|
+
swtClose(this._handle);
|
|
19326
|
+
this._handle = 0;
|
|
19327
|
+
_a.label = 5;
|
|
19328
|
+
case 5:
|
|
19329
|
+
return [
|
|
19330
|
+
2
|
|
19331
|
+
/*return*/
|
|
19332
|
+
];
|
|
19333
|
+
}
|
|
19334
|
+
});
|
|
19335
|
+
});
|
|
19336
|
+
};
|
|
19337
|
+
return SamsungWasmTCPPacketConnection2;
|
|
19338
|
+
}()
|
|
19339
|
+
);
|
|
19340
|
+
exports.SamsungWasmTCPPacketConnection = SamsungWasmTCPPacketConnection;
|
|
19341
|
+
var SamsungWasmTCPStreamConnection = (
|
|
19342
|
+
/** @class */
|
|
19343
|
+
function() {
|
|
19344
|
+
function SamsungWasmTCPStreamConnection2(handle) {
|
|
19345
|
+
this._nextRequestId = 1;
|
|
19346
|
+
this._handle = handle;
|
|
19347
|
+
}
|
|
19348
|
+
SamsungWasmTCPStreamConnection2.prototype.getHandle = function() {
|
|
19349
|
+
return this._handle;
|
|
19350
|
+
};
|
|
19351
|
+
SamsungWasmTCPStreamConnection2.prototype.isConnected = function() {
|
|
19352
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19353
|
+
var native, swtIsConnected;
|
|
19354
|
+
return __generator(this, function(_a) {
|
|
19355
|
+
switch (_a.label) {
|
|
19356
|
+
case 0:
|
|
19357
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19358
|
+
case 1:
|
|
19359
|
+
native = _a.sent();
|
|
19360
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19361
|
+
"number"
|
|
19362
|
+
]);
|
|
19363
|
+
return [2, swtIsConnected(this._handle) === 1];
|
|
19364
|
+
}
|
|
19365
|
+
});
|
|
19366
|
+
});
|
|
19367
|
+
};
|
|
19368
|
+
SamsungWasmTCPStreamConnection2.prototype.write = function(data) {
|
|
19369
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19370
|
+
var native, swtIsConnected, connStatus, requestId, callbackKey, sendPromise, ptr, swtStreamSendAsync, result;
|
|
19371
|
+
return __generator(this, function(_a) {
|
|
19372
|
+
switch (_a.label) {
|
|
19373
|
+
case 0:
|
|
19374
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19375
|
+
case 1:
|
|
19376
|
+
native = _a.sent();
|
|
19377
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19378
|
+
"number"
|
|
19379
|
+
]);
|
|
19380
|
+
connStatus = swtIsConnected(this._handle);
|
|
19381
|
+
if (connStatus !== 1) {
|
|
19382
|
+
if (connStatus === -1) {
|
|
19383
|
+
throw new Error("Connection is still in progress");
|
|
19384
|
+
}
|
|
19385
|
+
throw new Error("Connection is not active");
|
|
19386
|
+
}
|
|
19387
|
+
ensureCallbackStorage();
|
|
19388
|
+
requestId = this._nextRequestId++;
|
|
19389
|
+
callbackKey = "".concat(this._handle, "_").concat(requestId);
|
|
19390
|
+
sendPromise = new Promise(function(resolve, reject) {
|
|
19391
|
+
window._swtSendCallbacks[callbackKey] = { resolve, reject };
|
|
19392
|
+
});
|
|
19393
|
+
ptr = native._malloc(data.byteLength);
|
|
19394
|
+
try {
|
|
19395
|
+
native.HEAPU8.set(new Uint8Array(data), ptr);
|
|
19396
|
+
swtStreamSendAsync = native.cwrap("swt_stream_send_async", "number", ["number", "number", "number", "number"]);
|
|
19397
|
+
result = swtStreamSendAsync(this._handle, ptr, data.byteLength, requestId);
|
|
19398
|
+
if (result !== 0) {
|
|
19399
|
+
delete window._swtSendCallbacks[callbackKey];
|
|
19400
|
+
throw new Error("Failed to start stream write operation, error code: ".concat(result));
|
|
19401
|
+
}
|
|
19402
|
+
} catch (e) {
|
|
19403
|
+
native._free(ptr);
|
|
19404
|
+
throw e;
|
|
19405
|
+
}
|
|
19406
|
+
native._free(ptr);
|
|
19407
|
+
return [2, sendPromise];
|
|
19408
|
+
}
|
|
19409
|
+
});
|
|
19410
|
+
});
|
|
19411
|
+
};
|
|
19412
|
+
SamsungWasmTCPStreamConnection2.prototype.read = function() {
|
|
19413
|
+
return __awaiter(this, arguments, void 0, function(maxSize) {
|
|
19414
|
+
var native, swtIsConnected, connStatus, requestId, callbackKey, recvPromise, swtStreamRecvAsync, result;
|
|
19415
|
+
if (maxSize === void 0) {
|
|
19416
|
+
maxSize = 65535;
|
|
19417
|
+
}
|
|
19418
|
+
return __generator(this, function(_a) {
|
|
19419
|
+
switch (_a.label) {
|
|
19420
|
+
case 0:
|
|
19421
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19422
|
+
case 1:
|
|
19423
|
+
native = _a.sent();
|
|
19424
|
+
swtIsConnected = native.cwrap("swt_is_connected", "number", [
|
|
19425
|
+
"number"
|
|
19426
|
+
]);
|
|
19427
|
+
connStatus = swtIsConnected(this._handle);
|
|
19428
|
+
if (connStatus !== 1) {
|
|
19429
|
+
if (connStatus === -1) {
|
|
19430
|
+
throw new Error("Connection is still in progress");
|
|
19431
|
+
}
|
|
19432
|
+
throw new Error("Connection is not active");
|
|
19433
|
+
}
|
|
19434
|
+
ensureCallbackStorage();
|
|
19435
|
+
requestId = this._nextRequestId++;
|
|
19436
|
+
callbackKey = "".concat(this._handle, "_").concat(requestId);
|
|
19437
|
+
recvPromise = new Promise(function(resolve, reject) {
|
|
19438
|
+
window._swtRecvCallbacks[callbackKey] = { resolve, reject };
|
|
19439
|
+
});
|
|
19440
|
+
swtStreamRecvAsync = native.cwrap("swt_stream_recv_async", "number", [
|
|
19441
|
+
"number",
|
|
19442
|
+
"number",
|
|
19443
|
+
"number"
|
|
19444
|
+
]);
|
|
19445
|
+
result = swtStreamRecvAsync(this._handle, maxSize, requestId);
|
|
19446
|
+
if (result !== 0) {
|
|
19447
|
+
delete window._swtRecvCallbacks[callbackKey];
|
|
19448
|
+
throw new Error("Failed to start stream read operation, error code: ".concat(result));
|
|
19449
|
+
}
|
|
19450
|
+
return [2, recvPromise];
|
|
19451
|
+
}
|
|
19452
|
+
});
|
|
19453
|
+
});
|
|
19454
|
+
};
|
|
19455
|
+
SamsungWasmTCPStreamConnection2.prototype.close = function() {
|
|
19456
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19457
|
+
var native, swtClose;
|
|
19458
|
+
return __generator(this, function(_a) {
|
|
19459
|
+
switch (_a.label) {
|
|
19460
|
+
case 0:
|
|
19461
|
+
if (!(this._handle !== 0)) return [3, 2];
|
|
19462
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19463
|
+
case 1:
|
|
19464
|
+
native = _a.sent();
|
|
19465
|
+
swtClose = native.cwrap("swt_close", "void", [
|
|
19466
|
+
"number"
|
|
19467
|
+
]);
|
|
19468
|
+
swtClose(this._handle);
|
|
19469
|
+
this._handle = 0;
|
|
19470
|
+
_a.label = 2;
|
|
19471
|
+
case 2:
|
|
19472
|
+
return [
|
|
19473
|
+
2
|
|
19474
|
+
/*return*/
|
|
19475
|
+
];
|
|
19476
|
+
}
|
|
19477
|
+
});
|
|
19478
|
+
});
|
|
19479
|
+
};
|
|
19480
|
+
return SamsungWasmTCPStreamConnection2;
|
|
19481
|
+
}()
|
|
19482
|
+
);
|
|
19483
|
+
exports.SamsungWasmTCPStreamConnection = SamsungWasmTCPStreamConnection;
|
|
19484
|
+
var SamsungWasmTCPStream2 = (
|
|
19485
|
+
/** @class */
|
|
19486
|
+
function() {
|
|
19487
|
+
function SamsungWasmTCPStream3() {
|
|
19488
|
+
}
|
|
19489
|
+
SamsungWasmTCPStream3.prototype.connect = function(options) {
|
|
19490
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19491
|
+
var native, swtConnectAsync, handle, connectPromise, connectedHandle;
|
|
19492
|
+
return __generator(this, function(_a) {
|
|
19493
|
+
switch (_a.label) {
|
|
19494
|
+
case 0:
|
|
19495
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19496
|
+
case 1:
|
|
19497
|
+
native = _a.sent();
|
|
19498
|
+
ensureCallbackStorage();
|
|
19499
|
+
swtConnectAsync = native.cwrap("swt_connect_async", "number", [
|
|
19500
|
+
"string",
|
|
19501
|
+
"number",
|
|
19502
|
+
"number"
|
|
19503
|
+
]);
|
|
19504
|
+
connectPromise = new Promise(function(resolve, reject) {
|
|
19505
|
+
handle = swtConnectAsync(options.host, options.timeoutMs, options.secure ? 1 : 0);
|
|
19506
|
+
if (handle === 0) {
|
|
19507
|
+
reject(new Error("Failed to start connection to ".concat(options.host)));
|
|
19508
|
+
return;
|
|
19509
|
+
}
|
|
19510
|
+
window._swtConnectCallbacks[handle] = { resolve, reject };
|
|
19511
|
+
});
|
|
19512
|
+
return [4, connectPromise];
|
|
19513
|
+
case 2:
|
|
19514
|
+
connectedHandle = _a.sent();
|
|
19515
|
+
return [2, new SamsungWasmTCPStreamConnection(connectedHandle)];
|
|
19516
|
+
}
|
|
19517
|
+
});
|
|
19518
|
+
});
|
|
19519
|
+
};
|
|
19520
|
+
return SamsungWasmTCPStream3;
|
|
19521
|
+
}()
|
|
19522
|
+
);
|
|
19523
|
+
exports.SamsungWasmTCPStream = SamsungWasmTCPStream2;
|
|
19524
|
+
var SamsungWasmTCPPacket2 = (
|
|
19525
|
+
/** @class */
|
|
19526
|
+
function() {
|
|
19527
|
+
function SamsungWasmTCPPacket3() {
|
|
19528
|
+
}
|
|
19529
|
+
SamsungWasmTCPPacket3.prototype.connect = function(options) {
|
|
19530
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19531
|
+
var native, swtConnectAsync, handle, connectPromise, connectedHandle;
|
|
19532
|
+
var _a;
|
|
19533
|
+
return __generator(this, function(_b) {
|
|
19534
|
+
switch (_b.label) {
|
|
19535
|
+
case 0:
|
|
19536
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19537
|
+
case 1:
|
|
19538
|
+
native = _b.sent();
|
|
19539
|
+
ensureCallbackStorage();
|
|
19540
|
+
swtConnectAsync = native.cwrap("swt_connect_async", "number", [
|
|
19541
|
+
"string",
|
|
19542
|
+
"number",
|
|
19543
|
+
"number"
|
|
19544
|
+
]);
|
|
19545
|
+
connectPromise = new Promise(function(resolve, reject) {
|
|
19546
|
+
handle = swtConnectAsync(options.host, options.timeoutMs, options.secure ? 1 : 0);
|
|
19547
|
+
if (handle === 0) {
|
|
19548
|
+
reject(new Error("Failed to start connection to ".concat(options.host)));
|
|
19549
|
+
return;
|
|
19550
|
+
}
|
|
19551
|
+
window._swtConnectCallbacks[handle] = { resolve, reject };
|
|
19552
|
+
});
|
|
19553
|
+
return [4, connectPromise];
|
|
19554
|
+
case 2:
|
|
19555
|
+
connectedHandle = _b.sent();
|
|
19556
|
+
return [2, new SamsungWasmTCPPacketConnection(connectedHandle, (_a = options.maxPacketSize) !== null && _a !== void 0 ? _a : 65535)];
|
|
19557
|
+
}
|
|
19558
|
+
});
|
|
19559
|
+
});
|
|
19560
|
+
};
|
|
19561
|
+
return SamsungWasmTCPPacket3;
|
|
19562
|
+
}()
|
|
19563
|
+
);
|
|
19564
|
+
exports.SamsungWasmTCPPacket = SamsungWasmTCPPacket2;
|
|
19565
|
+
}
|
|
19566
|
+
});
|
|
19567
|
+
|
|
19568
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmDecoder.js
|
|
19569
|
+
var require_wasmDecoder = __commonJS({
|
|
19570
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmDecoder.js"(exports) {
|
|
19571
|
+
"use strict";
|
|
19572
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
19573
|
+
function adopt(value) {
|
|
19574
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
19575
|
+
resolve(value);
|
|
19576
|
+
});
|
|
19577
|
+
}
|
|
19578
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
19579
|
+
function fulfilled(value) {
|
|
19580
|
+
try {
|
|
19581
|
+
step(generator.next(value));
|
|
19582
|
+
} catch (e) {
|
|
19583
|
+
reject(e);
|
|
19584
|
+
}
|
|
19585
|
+
}
|
|
19586
|
+
function rejected(value) {
|
|
19587
|
+
try {
|
|
19588
|
+
step(generator["throw"](value));
|
|
19589
|
+
} catch (e) {
|
|
19590
|
+
reject(e);
|
|
19591
|
+
}
|
|
19592
|
+
}
|
|
19593
|
+
function step(result) {
|
|
19594
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
19595
|
+
}
|
|
19596
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19597
|
+
});
|
|
19598
|
+
};
|
|
19599
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
19600
|
+
var _ = { label: 0, sent: function() {
|
|
19601
|
+
if (t[0] & 1) throw t[1];
|
|
19602
|
+
return t[1];
|
|
19603
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
19604
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
19605
|
+
return this;
|
|
19606
|
+
}), g;
|
|
19607
|
+
function verb(n) {
|
|
19608
|
+
return function(v) {
|
|
19609
|
+
return step([n, v]);
|
|
19610
|
+
};
|
|
19611
|
+
}
|
|
19612
|
+
function step(op) {
|
|
19613
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
19614
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19615
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19616
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19617
|
+
switch (op[0]) {
|
|
19618
|
+
case 0:
|
|
19619
|
+
case 1:
|
|
19620
|
+
t = op;
|
|
19621
|
+
break;
|
|
19622
|
+
case 4:
|
|
19623
|
+
_.label++;
|
|
19624
|
+
return { value: op[1], done: false };
|
|
19625
|
+
case 5:
|
|
19626
|
+
_.label++;
|
|
19627
|
+
y = op[1];
|
|
19628
|
+
op = [0];
|
|
19629
|
+
continue;
|
|
19630
|
+
case 7:
|
|
19631
|
+
op = _.ops.pop();
|
|
19632
|
+
_.trys.pop();
|
|
19633
|
+
continue;
|
|
19634
|
+
default:
|
|
19635
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
19636
|
+
_ = 0;
|
|
19637
|
+
continue;
|
|
19638
|
+
}
|
|
19639
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
19640
|
+
_.label = op[1];
|
|
19641
|
+
break;
|
|
19642
|
+
}
|
|
19643
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
19644
|
+
_.label = t[1];
|
|
19645
|
+
t = op;
|
|
19646
|
+
break;
|
|
19647
|
+
}
|
|
19648
|
+
if (t && _.label < t[2]) {
|
|
19649
|
+
_.label = t[2];
|
|
19650
|
+
_.ops.push(op);
|
|
19651
|
+
break;
|
|
19652
|
+
}
|
|
19653
|
+
if (t[2]) _.ops.pop();
|
|
19654
|
+
_.trys.pop();
|
|
19655
|
+
continue;
|
|
19656
|
+
}
|
|
19657
|
+
op = body.call(thisArg, _);
|
|
19658
|
+
} catch (e) {
|
|
19659
|
+
op = [6, e];
|
|
19660
|
+
y = 0;
|
|
19661
|
+
} finally {
|
|
19662
|
+
f = t = 0;
|
|
19663
|
+
}
|
|
19664
|
+
if (op[0] & 5) throw op[1];
|
|
19665
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
19666
|
+
}
|
|
19667
|
+
};
|
|
19668
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19669
|
+
exports.SamsungWasmDecoder = void 0;
|
|
19670
|
+
var videoDecoder_1 = require_videoDecoder2();
|
|
19671
|
+
var wasmLoader_1 = require_wasmLoader();
|
|
19672
|
+
var wasmTCP_1 = require_wasmTCP();
|
|
19673
|
+
function detectKeyFrameAnnexB(bytes) {
|
|
19674
|
+
if (bytes.length === 0)
|
|
19675
|
+
return false;
|
|
19676
|
+
var nalHeaderIndex = 0;
|
|
19677
|
+
if (bytes.length >= 4 && bytes[0] === 0 && bytes[1] === 0 && bytes[2] === 0 && bytes[3] === 1) {
|
|
19678
|
+
nalHeaderIndex = 4;
|
|
19679
|
+
} else if (bytes.length >= 3 && bytes[0] === 0 && bytes[1] === 0 && bytes[2] === 1) {
|
|
19680
|
+
nalHeaderIndex = 3;
|
|
19681
|
+
}
|
|
19682
|
+
if (nalHeaderIndex >= bytes.length)
|
|
19683
|
+
return false;
|
|
19684
|
+
var nalType = bytes[nalHeaderIndex] & 31;
|
|
19685
|
+
if (nalType === 5 || nalType === 7 || nalType === 8)
|
|
19686
|
+
return true;
|
|
19687
|
+
for (var i = nalHeaderIndex + 1; i + 4 < bytes.length; i++) {
|
|
19688
|
+
var is3 = bytes[i] === 0 && bytes[i + 1] === 0 && bytes[i + 2] === 1;
|
|
19689
|
+
var is4 = bytes[i] === 0 && bytes[i + 1] === 0 && bytes[i + 2] === 0 && bytes[i + 3] === 1;
|
|
19690
|
+
if (!is3 && !is4)
|
|
19691
|
+
continue;
|
|
19692
|
+
var idx = i + (is3 ? 3 : 4);
|
|
19693
|
+
if (idx >= bytes.length)
|
|
19694
|
+
return false;
|
|
19695
|
+
var nt = bytes[idx] & 31;
|
|
19696
|
+
if (nt === 5 || nt === 7 || nt === 8)
|
|
19697
|
+
return true;
|
|
19698
|
+
}
|
|
19699
|
+
return false;
|
|
19700
|
+
}
|
|
19701
|
+
function ensureVideoElement(videoElementId) {
|
|
19702
|
+
var el = document.getElementById(videoElementId);
|
|
19703
|
+
if (!el) {
|
|
19704
|
+
el = document.createElement("video");
|
|
19705
|
+
el.id = videoElementId;
|
|
19706
|
+
el.style.position = "absolute";
|
|
19707
|
+
el.style.top = "0";
|
|
19708
|
+
el.style.left = "0";
|
|
19709
|
+
el.style.width = "1920px";
|
|
19710
|
+
el.style.height = "1080px";
|
|
19711
|
+
el.style.backgroundColor = "#000";
|
|
19712
|
+
document.body.appendChild(el);
|
|
19713
|
+
}
|
|
19714
|
+
el.autoplay = true;
|
|
19715
|
+
el.muted = true;
|
|
19716
|
+
el.playsInline = true;
|
|
19717
|
+
return el;
|
|
19718
|
+
}
|
|
19719
|
+
var SamsungWasmDecoder2 = (
|
|
19720
|
+
/** @class */
|
|
19721
|
+
function() {
|
|
19722
|
+
function SamsungWasmDecoder3(videoElementId) {
|
|
19723
|
+
this.videoElementId = videoElementId;
|
|
19724
|
+
this.initialized = false;
|
|
19725
|
+
this.destroyed = false;
|
|
19726
|
+
this.decoderHandle = 0;
|
|
19727
|
+
this.ptsSeconds = 0;
|
|
19728
|
+
this.frameDurationSeconds = 0;
|
|
19729
|
+
this.videoElement = ensureVideoElement(videoElementId);
|
|
19730
|
+
}
|
|
19731
|
+
SamsungWasmDecoder3.prototype.destroy = function() {
|
|
19732
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19733
|
+
var native;
|
|
19734
|
+
return __generator(this, function(_a) {
|
|
19735
|
+
switch (_a.label) {
|
|
19736
|
+
case 0:
|
|
19737
|
+
if (this.destroyed)
|
|
19738
|
+
return [
|
|
19739
|
+
2
|
|
19740
|
+
/*return*/
|
|
19741
|
+
];
|
|
19742
|
+
this.destroyed = true;
|
|
19743
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19744
|
+
case 1:
|
|
19745
|
+
native = _a.sent();
|
|
19746
|
+
try {
|
|
19747
|
+
native.ccall("swd_destroy", "void", ["number"], [this.decoderHandle]);
|
|
19748
|
+
} catch (_b) {
|
|
19749
|
+
}
|
|
19750
|
+
this.decoderHandle = 0;
|
|
19751
|
+
return [4, (0, wasmLoader_1.destroyNativeModule)()];
|
|
19752
|
+
case 2:
|
|
19753
|
+
_a.sent();
|
|
19754
|
+
return [
|
|
19755
|
+
2
|
|
19756
|
+
/*return*/
|
|
19757
|
+
];
|
|
19758
|
+
}
|
|
19759
|
+
});
|
|
19760
|
+
});
|
|
19761
|
+
};
|
|
19762
|
+
SamsungWasmDecoder3.prototype.initialize = function(args) {
|
|
19763
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19764
|
+
var width, height, native, latencyMode, create, init, fpsNum, fpsDen, ok, isReady, maxWaitMs, pollIntervalMs, waited;
|
|
19765
|
+
var _a, _b, _c;
|
|
19766
|
+
return __generator(this, function(_d) {
|
|
19767
|
+
switch (_d.label) {
|
|
19768
|
+
case 0:
|
|
19769
|
+
if (this.destroyed) {
|
|
19770
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19771
|
+
}
|
|
19772
|
+
width = (_a = args.width) !== null && _a !== void 0 ? _a : window.screen.width;
|
|
19773
|
+
height = (_b = args.height) !== null && _b !== void 0 ? _b : window.screen.height;
|
|
19774
|
+
this.videoElement.width = width;
|
|
19775
|
+
this.videoElement.height = height;
|
|
19776
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19777
|
+
case 1:
|
|
19778
|
+
native = _d.sent();
|
|
19779
|
+
latencyMode = (_c = args.latencyMode) !== null && _c !== void 0 ? _c : videoDecoder_1.LatencyMode.Low;
|
|
19780
|
+
create = native.cwrap("swd_create", "number", ["string", "number"]);
|
|
19781
|
+
init = native.cwrap("swd_init_h264", "number", [
|
|
19782
|
+
"number",
|
|
19783
|
+
"number",
|
|
19784
|
+
"number",
|
|
19785
|
+
"number"
|
|
19786
|
+
]);
|
|
19787
|
+
this.decoderHandle = create(this.videoElementId, latencyMode);
|
|
19788
|
+
if (!this.decoderHandle) {
|
|
19789
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19790
|
+
}
|
|
19791
|
+
fpsNum = 1;
|
|
19792
|
+
fpsDen = 1;
|
|
19793
|
+
this.frameDurationSeconds = fpsDen / fpsNum;
|
|
19794
|
+
this.ptsSeconds = 0;
|
|
19795
|
+
ok = init(this.decoderHandle, width, height, fpsNum, fpsDen);
|
|
19796
|
+
if (ok !== 0) {
|
|
19797
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19798
|
+
}
|
|
19799
|
+
isReady = native.cwrap("swd_is_ready", "number", ["number"]);
|
|
19800
|
+
maxWaitMs = 5e3;
|
|
19801
|
+
pollIntervalMs = 50;
|
|
19802
|
+
waited = 0;
|
|
19803
|
+
_d.label = 2;
|
|
19804
|
+
case 2:
|
|
19805
|
+
if (!(isReady(this.decoderHandle) === 0 && waited < maxWaitMs)) return [3, 4];
|
|
19806
|
+
return [4, new Promise(function(resolve) {
|
|
19807
|
+
return setTimeout(resolve, pollIntervalMs);
|
|
19808
|
+
})];
|
|
19809
|
+
case 3:
|
|
19810
|
+
_d.sent();
|
|
19811
|
+
waited += pollIntervalMs;
|
|
19812
|
+
return [3, 2];
|
|
19813
|
+
case 4:
|
|
19814
|
+
if (isReady(this.decoderHandle) === 0) {
|
|
19815
|
+
console.error("Decoder track did not open in time");
|
|
19816
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19817
|
+
}
|
|
19818
|
+
this.initialized = true;
|
|
19819
|
+
return [2, videoDecoder_1.ResultStatus.Ok];
|
|
19820
|
+
}
|
|
19821
|
+
});
|
|
19822
|
+
});
|
|
19823
|
+
};
|
|
19824
|
+
SamsungWasmDecoder3.prototype.decodeAndRender = function(data) {
|
|
19825
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19826
|
+
var bytes, isKey, native, ptr, append, ok;
|
|
19827
|
+
return __generator(this, function(_a) {
|
|
19828
|
+
switch (_a.label) {
|
|
19829
|
+
case 0:
|
|
19830
|
+
if (!this.initialized || this.destroyed) {
|
|
19831
|
+
return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
|
|
19832
|
+
}
|
|
19833
|
+
if (!(data instanceof ArrayBuffer)) {
|
|
19834
|
+
return [2, videoDecoder_1.ResultStatus.ErrorBadArgument];
|
|
19835
|
+
}
|
|
19836
|
+
bytes = new Uint8Array(data);
|
|
19837
|
+
isKey = detectKeyFrameAnnexB(bytes);
|
|
19838
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19839
|
+
case 1:
|
|
19840
|
+
native = _a.sent();
|
|
19841
|
+
ptr = native._malloc(bytes.length);
|
|
19842
|
+
native.HEAPU8.set(bytes, ptr);
|
|
19843
|
+
try {
|
|
19844
|
+
append = native.cwrap("swd_append", "number", [
|
|
19845
|
+
"number",
|
|
19846
|
+
"number",
|
|
19847
|
+
"number",
|
|
19848
|
+
"number",
|
|
19849
|
+
"number",
|
|
19850
|
+
"number"
|
|
19851
|
+
]);
|
|
19852
|
+
ok = append(this.decoderHandle, ptr, bytes.length, isKey ? 1 : 0, this.ptsSeconds, this.frameDurationSeconds);
|
|
19853
|
+
if (ok === 0) {
|
|
19854
|
+
this.ptsSeconds += this.frameDurationSeconds;
|
|
19855
|
+
return [2, videoDecoder_1.ResultStatus.Ok];
|
|
19856
|
+
}
|
|
19857
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19858
|
+
} finally {
|
|
19859
|
+
native._free(ptr);
|
|
19860
|
+
}
|
|
19861
|
+
return [
|
|
19862
|
+
2
|
|
19863
|
+
/*return*/
|
|
19864
|
+
];
|
|
19865
|
+
}
|
|
19866
|
+
});
|
|
19867
|
+
});
|
|
19868
|
+
};
|
|
19869
|
+
SamsungWasmDecoder3.prototype.decodeAndRenderRef = function(ref) {
|
|
19870
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19871
|
+
var ptr, size, native, isKey, append, ok;
|
|
19872
|
+
return __generator(this, function(_a) {
|
|
19873
|
+
switch (_a.label) {
|
|
19874
|
+
case 0:
|
|
19875
|
+
if (!this.initialized || this.destroyed) {
|
|
19876
|
+
return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
|
|
19877
|
+
}
|
|
19878
|
+
return [4, wasmTCP_1.SamsungWasmFrameCollector.getFrameDataPointer(ref)];
|
|
19879
|
+
case 1:
|
|
19880
|
+
ptr = _a.sent();
|
|
19881
|
+
return [4, wasmTCP_1.SamsungWasmFrameCollector.getFrameSize(ref)];
|
|
19882
|
+
case 2:
|
|
19883
|
+
size = _a.sent();
|
|
19884
|
+
if (ptr === 0 || size === 0) {
|
|
19885
|
+
return [2, videoDecoder_1.ResultStatus.ErrorBadArgument];
|
|
19886
|
+
}
|
|
19887
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19888
|
+
case 3:
|
|
19889
|
+
native = _a.sent();
|
|
19890
|
+
isKey = detectKeyFrameAnnexB(native.HEAPU8.subarray(ptr, ptr + size));
|
|
19891
|
+
_a.label = 4;
|
|
19892
|
+
case 4:
|
|
19893
|
+
_a.trys.push([4, , 5, 7]);
|
|
19894
|
+
append = native.cwrap("swd_append", "number", [
|
|
19895
|
+
"number",
|
|
19896
|
+
"number",
|
|
19897
|
+
"number",
|
|
19898
|
+
"number",
|
|
19899
|
+
"number",
|
|
19900
|
+
"number"
|
|
19901
|
+
]);
|
|
19902
|
+
ok = append(this.decoderHandle, ptr, size, isKey ? 1 : 0, this.ptsSeconds, this.frameDurationSeconds);
|
|
19903
|
+
if (ok === 0) {
|
|
19904
|
+
this.ptsSeconds += this.frameDurationSeconds;
|
|
19905
|
+
return [2, videoDecoder_1.ResultStatus.Ok];
|
|
19906
|
+
}
|
|
19907
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19908
|
+
case 5:
|
|
19909
|
+
return [4, wasmTCP_1.SamsungWasmFrameCollector.releaseFrame(ref)];
|
|
19910
|
+
case 6:
|
|
19911
|
+
_a.sent();
|
|
19912
|
+
return [
|
|
19913
|
+
7
|
|
19914
|
+
/*endfinally*/
|
|
19915
|
+
];
|
|
19916
|
+
case 7:
|
|
19917
|
+
return [
|
|
19918
|
+
2
|
|
19919
|
+
/*return*/
|
|
19920
|
+
];
|
|
19921
|
+
}
|
|
19922
|
+
});
|
|
19923
|
+
});
|
|
19924
|
+
};
|
|
19925
|
+
SamsungWasmDecoder3.prototype.flush = function() {
|
|
19926
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
19927
|
+
var native, flush;
|
|
19928
|
+
return __generator(this, function(_a) {
|
|
19929
|
+
switch (_a.label) {
|
|
19930
|
+
case 0:
|
|
19931
|
+
if (!this.decoderHandle)
|
|
19932
|
+
return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
|
|
19933
|
+
return [4, (0, wasmLoader_1.ensureNativeModule)()];
|
|
19934
|
+
case 1:
|
|
19935
|
+
native = _a.sent();
|
|
19936
|
+
try {
|
|
19937
|
+
flush = native.cwrap("swd_flush", "number", ["number"]);
|
|
19938
|
+
return [2, flush(this.decoderHandle) === 0 ? videoDecoder_1.ResultStatus.Ok : videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19939
|
+
} catch (_b) {
|
|
19940
|
+
return [2, videoDecoder_1.ResultStatus.ErrorFailed];
|
|
19941
|
+
}
|
|
19942
|
+
return [
|
|
19943
|
+
2
|
|
19944
|
+
/*return*/
|
|
19945
|
+
];
|
|
19946
|
+
}
|
|
19947
|
+
});
|
|
19948
|
+
});
|
|
19949
|
+
};
|
|
19950
|
+
return SamsungWasmDecoder3;
|
|
19951
|
+
}()
|
|
19952
|
+
);
|
|
19953
|
+
exports.SamsungWasmDecoder = SamsungWasmDecoder2;
|
|
19954
|
+
}
|
|
19955
|
+
});
|
|
19956
|
+
|
|
19957
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/index.js
|
|
19958
|
+
var require_dist2 = __commonJS({
|
|
19959
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/index.js"(exports) {
|
|
17539
19960
|
"use strict";
|
|
17540
|
-
var
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
19961
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
19962
|
+
function adopt(value) {
|
|
19963
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
19964
|
+
resolve(value);
|
|
19965
|
+
});
|
|
19966
|
+
}
|
|
19967
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
19968
|
+
function fulfilled(value) {
|
|
19969
|
+
try {
|
|
19970
|
+
step(generator.next(value));
|
|
19971
|
+
} catch (e) {
|
|
19972
|
+
reject(e);
|
|
19973
|
+
}
|
|
17546
19974
|
}
|
|
17547
|
-
|
|
17548
|
-
|
|
17549
|
-
|
|
19975
|
+
function rejected(value) {
|
|
19976
|
+
try {
|
|
19977
|
+
step(generator["throw"](value));
|
|
19978
|
+
} catch (e) {
|
|
19979
|
+
reject(e);
|
|
19980
|
+
}
|
|
19981
|
+
}
|
|
19982
|
+
function step(result) {
|
|
19983
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
19984
|
+
}
|
|
19985
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19986
|
+
});
|
|
19987
|
+
};
|
|
19988
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
19989
|
+
var _ = { label: 0, sent: function() {
|
|
19990
|
+
if (t[0] & 1) throw t[1];
|
|
19991
|
+
return t[1];
|
|
19992
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
19993
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
19994
|
+
return this;
|
|
19995
|
+
}), g;
|
|
19996
|
+
function verb(n) {
|
|
19997
|
+
return function(v) {
|
|
19998
|
+
return step([n, v]);
|
|
19999
|
+
};
|
|
20000
|
+
}
|
|
20001
|
+
function step(op) {
|
|
20002
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
20003
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20004
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20005
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20006
|
+
switch (op[0]) {
|
|
20007
|
+
case 0:
|
|
20008
|
+
case 1:
|
|
20009
|
+
t = op;
|
|
20010
|
+
break;
|
|
20011
|
+
case 4:
|
|
20012
|
+
_.label++;
|
|
20013
|
+
return { value: op[1], done: false };
|
|
20014
|
+
case 5:
|
|
20015
|
+
_.label++;
|
|
20016
|
+
y = op[1];
|
|
20017
|
+
op = [0];
|
|
20018
|
+
continue;
|
|
20019
|
+
case 7:
|
|
20020
|
+
op = _.ops.pop();
|
|
20021
|
+
_.trys.pop();
|
|
20022
|
+
continue;
|
|
20023
|
+
default:
|
|
20024
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
20025
|
+
_ = 0;
|
|
20026
|
+
continue;
|
|
20027
|
+
}
|
|
20028
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
20029
|
+
_.label = op[1];
|
|
20030
|
+
break;
|
|
20031
|
+
}
|
|
20032
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
20033
|
+
_.label = t[1];
|
|
20034
|
+
t = op;
|
|
20035
|
+
break;
|
|
20036
|
+
}
|
|
20037
|
+
if (t && _.label < t[2]) {
|
|
20038
|
+
_.label = t[2];
|
|
20039
|
+
_.ops.push(op);
|
|
20040
|
+
break;
|
|
20041
|
+
}
|
|
20042
|
+
if (t[2]) _.ops.pop();
|
|
20043
|
+
_.trys.pop();
|
|
20044
|
+
continue;
|
|
20045
|
+
}
|
|
20046
|
+
op = body.call(thisArg, _);
|
|
20047
|
+
} catch (e) {
|
|
20048
|
+
op = [6, e];
|
|
20049
|
+
y = 0;
|
|
20050
|
+
} finally {
|
|
20051
|
+
f = t = 0;
|
|
20052
|
+
}
|
|
20053
|
+
if (op[0] & 5) throw op[1];
|
|
20054
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
20055
|
+
}
|
|
17550
20056
|
};
|
|
17551
20057
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17552
|
-
exports.
|
|
17553
|
-
exports.
|
|
17554
|
-
exports.
|
|
17555
|
-
|
|
17556
|
-
var
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
var naclDecoder_1 = require_naclDecoder();
|
|
17560
|
-
Object.defineProperty(exports, "NaClDecoder", { enumerable: true, get: function() {
|
|
17561
|
-
return naclDecoder_1.NaClDecoder;
|
|
17562
|
-
} });
|
|
17563
|
-
var videoDecoder_1 = require_videoDecoder();
|
|
17564
|
-
Object.defineProperty(exports, "HWAcceleration", { enumerable: true, get: function() {
|
|
17565
|
-
return videoDecoder_1.HWAcceleration;
|
|
20058
|
+
exports.SamsungWasmTCPStreamConnection = exports.SamsungWasmTCPStream = exports.SamsungWasmTCPPacketConnection = exports.SamsungWasmTCPPacket = exports.SamsungWasmFrameCollector = exports.SamsungWasmDecoder = exports.ResultStatus = void 0;
|
|
20059
|
+
exports.isSamsungWasmSupported = isSamsungWasmSupported3;
|
|
20060
|
+
exports.createSamsungWasmDecoder = createSamsungWasmDecoder2;
|
|
20061
|
+
exports.createSamsungWasmTCP = createSamsungWasmTCP2;
|
|
20062
|
+
var wasmDecoder_1 = require_wasmDecoder();
|
|
20063
|
+
Object.defineProperty(exports, "SamsungWasmDecoder", { enumerable: true, get: function() {
|
|
20064
|
+
return wasmDecoder_1.SamsungWasmDecoder;
|
|
17566
20065
|
} });
|
|
20066
|
+
var videoDecoder_1 = require_videoDecoder2();
|
|
17567
20067
|
Object.defineProperty(exports, "ResultStatus", { enumerable: true, get: function() {
|
|
17568
20068
|
return videoDecoder_1.ResultStatus;
|
|
17569
20069
|
} });
|
|
17570
|
-
|
|
17571
|
-
|
|
20070
|
+
var wasmLoader_1 = require_wasmLoader();
|
|
20071
|
+
var wasmTCP_1 = require_wasmTCP();
|
|
20072
|
+
Object.defineProperty(exports, "SamsungWasmFrameCollector", { enumerable: true, get: function() {
|
|
20073
|
+
return wasmTCP_1.SamsungWasmFrameCollector;
|
|
17572
20074
|
} });
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
};
|
|
17576
|
-
function
|
|
17577
|
-
return
|
|
17578
|
-
|
|
17579
|
-
|
|
17580
|
-
|
|
20075
|
+
Object.defineProperty(exports, "SamsungWasmTCPPacket", { enumerable: true, get: function() {
|
|
20076
|
+
return wasmTCP_1.SamsungWasmTCPPacket;
|
|
20077
|
+
} });
|
|
20078
|
+
Object.defineProperty(exports, "SamsungWasmTCPPacketConnection", { enumerable: true, get: function() {
|
|
20079
|
+
return wasmTCP_1.SamsungWasmTCPPacketConnection;
|
|
20080
|
+
} });
|
|
20081
|
+
Object.defineProperty(exports, "SamsungWasmTCPStream", { enumerable: true, get: function() {
|
|
20082
|
+
return wasmTCP_1.SamsungWasmTCPStream;
|
|
20083
|
+
} });
|
|
20084
|
+
Object.defineProperty(exports, "SamsungWasmTCPStreamConnection", { enumerable: true, get: function() {
|
|
20085
|
+
return wasmTCP_1.SamsungWasmTCPStreamConnection;
|
|
20086
|
+
} });
|
|
20087
|
+
function isSamsungWasmSupported3() {
|
|
20088
|
+
var _a;
|
|
20089
|
+
return typeof window.WebAssembly !== "undefined" && typeof ((_a = window.tizentvwasm) === null || _a === void 0 ? void 0 : _a.ElementaryMediaStreamSource) !== "undefined";
|
|
17581
20090
|
}
|
|
17582
|
-
function
|
|
17583
|
-
|
|
17584
|
-
|
|
17585
|
-
|
|
17586
|
-
|
|
17587
|
-
|
|
17588
|
-
|
|
17589
|
-
|
|
17590
|
-
|
|
17591
|
-
|
|
20091
|
+
function createSamsungWasmDecoder2(options) {
|
|
20092
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
20093
|
+
return __generator(this, function(_a) {
|
|
20094
|
+
switch (_a.label) {
|
|
20095
|
+
case 0:
|
|
20096
|
+
if (!isSamsungWasmSupported3()) {
|
|
20097
|
+
throw new Error("Samsung WASM decoder is not supported in this environment.");
|
|
20098
|
+
}
|
|
20099
|
+
return [4, (0, wasmLoader_1.loadWasmModule)()];
|
|
20100
|
+
case 1:
|
|
20101
|
+
_a.sent();
|
|
20102
|
+
return [2, new wasmDecoder_1.SamsungWasmDecoder(options.videoElementId)];
|
|
20103
|
+
}
|
|
20104
|
+
});
|
|
20105
|
+
});
|
|
20106
|
+
}
|
|
20107
|
+
function createSamsungWasmTCP2() {
|
|
20108
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
20109
|
+
return __generator(this, function(_a) {
|
|
20110
|
+
switch (_a.label) {
|
|
20111
|
+
case 0:
|
|
20112
|
+
if (!isSamsungWasmSupported3()) {
|
|
20113
|
+
throw new Error("Samsung WASM TCP is not supported in this environment.");
|
|
20114
|
+
}
|
|
20115
|
+
return [4, (0, wasmLoader_1.loadWasmModule)()];
|
|
20116
|
+
case 1:
|
|
20117
|
+
_a.sent();
|
|
20118
|
+
return [2, {
|
|
20119
|
+
tcpPacket: new wasmTCP_1.SamsungWasmTCPPacket(),
|
|
20120
|
+
tcpStream: new wasmTCP_1.SamsungWasmTCPStream()
|
|
20121
|
+
}];
|
|
20122
|
+
}
|
|
20123
|
+
});
|
|
20124
|
+
});
|
|
17592
20125
|
}
|
|
17593
20126
|
}
|
|
17594
20127
|
});
|
|
@@ -18073,11 +20606,264 @@
|
|
|
18073
20606
|
}
|
|
18074
20607
|
}
|
|
18075
20608
|
|
|
18076
|
-
// screen/
|
|
20609
|
+
// screen/nacltcp.ts
|
|
18077
20610
|
var import_nacl_decoder = __toESM(require_dist());
|
|
18078
|
-
function
|
|
20611
|
+
async function initNaClTCP() {
|
|
18079
20612
|
if ((0, import_nacl_decoder.isNaClSupported)()) {
|
|
18080
|
-
|
|
20613
|
+
const { tcpPacket, tcpStream } = (0, import_nacl_decoder.createNaClTCP)();
|
|
20614
|
+
if (!window.naclTCPPacket) {
|
|
20615
|
+
window.naclTCPPacket = tcpPacket;
|
|
20616
|
+
}
|
|
20617
|
+
if (!window.naclTCPStream) {
|
|
20618
|
+
window.naclTCPStream = tcpStream;
|
|
20619
|
+
}
|
|
20620
|
+
}
|
|
20621
|
+
}
|
|
20622
|
+
|
|
20623
|
+
// screen/samsungwasmtcp.ts
|
|
20624
|
+
var import_samsung_wasm_decoder = __toESM(require_dist2());
|
|
20625
|
+
async function initSamsungWasmTCP() {
|
|
20626
|
+
if ((0, import_samsung_wasm_decoder.isSamsungWasmSupported)()) {
|
|
20627
|
+
const { tcpPacket, tcpStream } = await (0, import_samsung_wasm_decoder.createSamsungWasmTCP)();
|
|
20628
|
+
if (!window.samsungWasmTCPStream) {
|
|
20629
|
+
window.samsungWasmTCPStream = tcpStream;
|
|
20630
|
+
}
|
|
20631
|
+
if (!window.samsungWasmTCPPacket) {
|
|
20632
|
+
window.samsungWasmTCPPacket = tcpPacket;
|
|
20633
|
+
}
|
|
20634
|
+
}
|
|
20635
|
+
}
|
|
20636
|
+
|
|
20637
|
+
// screen/nacldecoder.ts
|
|
20638
|
+
var import_nacl_decoder2 = __toESM(require_dist());
|
|
20639
|
+
function initNaCLDecoder() {
|
|
20640
|
+
if ((0, import_nacl_decoder2.isNaClSupported)()) {
|
|
20641
|
+
window.createNaClDecoder = import_nacl_decoder2.createNaClDecoder;
|
|
20642
|
+
}
|
|
20643
|
+
}
|
|
20644
|
+
|
|
20645
|
+
// screen/workerFrameConnection.ts
|
|
20646
|
+
var workerScript = `
|
|
20647
|
+
var socket = null;
|
|
20648
|
+
var pendingRead = null;
|
|
20649
|
+
var latestFrame = null;
|
|
20650
|
+
var frames = {};
|
|
20651
|
+
var closed = false;
|
|
20652
|
+
var GENERAL_HEADER_SIZE = 6;
|
|
20653
|
+
var FIRST_HEADER_SIZE = GENERAL_HEADER_SIZE + 9;
|
|
20654
|
+
var MAX_PACKET_SIZE = 32768;
|
|
20655
|
+
var DATA_PART_SIZE = MAX_PACKET_SIZE - GENERAL_HEADER_SIZE;
|
|
20656
|
+
|
|
20657
|
+
function postError(id, error) {
|
|
20658
|
+
self.postMessage({ type: 'error', id: id, error: error && error.message ? error.message : String(error) });
|
|
20659
|
+
}
|
|
20660
|
+
|
|
20661
|
+
function resolveFrame() {
|
|
20662
|
+
if (!pendingRead || !latestFrame) {
|
|
20663
|
+
return;
|
|
20664
|
+
}
|
|
20665
|
+
var frame = latestFrame;
|
|
20666
|
+
var id = pendingRead;
|
|
20667
|
+
pendingRead = null;
|
|
20668
|
+
latestFrame = null;
|
|
20669
|
+
self.postMessage({
|
|
20670
|
+
type: 'frame',
|
|
20671
|
+
id: id,
|
|
20672
|
+
frameType: frame.frameType,
|
|
20673
|
+
timestamp: frame.timestamp,
|
|
20674
|
+
length: frame.length,
|
|
20675
|
+
data: frame.data
|
|
20676
|
+
}, [frame.data]);
|
|
20677
|
+
}
|
|
20678
|
+
|
|
20679
|
+
function u16(view, offset) {
|
|
20680
|
+
return view.getUint16(offset, false);
|
|
20681
|
+
}
|
|
20682
|
+
|
|
20683
|
+
function u64AsNumber(view, offset) {
|
|
20684
|
+
var hi = view.getUint32(offset, false);
|
|
20685
|
+
var lo = view.getUint32(offset + 4, false);
|
|
20686
|
+
return hi * 4294967296 + lo;
|
|
20687
|
+
}
|
|
20688
|
+
|
|
20689
|
+
function handlePacket(buffer) {
|
|
20690
|
+
var length = buffer.byteLength;
|
|
20691
|
+
if (length < GENERAL_HEADER_SIZE) {
|
|
20692
|
+
return;
|
|
20693
|
+
}
|
|
20694
|
+
var view = new DataView(buffer);
|
|
20695
|
+
var frameID = u16(view, 0);
|
|
20696
|
+
var seq = u16(view, 2);
|
|
20697
|
+
var total = u16(view, 4);
|
|
20698
|
+
var headerSize = GENERAL_HEADER_SIZE;
|
|
20699
|
+
var item = frames[frameID];
|
|
20700
|
+
if (!item || seq === 0 || item.total !== total) {
|
|
20701
|
+
item = {
|
|
20702
|
+
buffer: new Uint8Array(total * DATA_PART_SIZE),
|
|
20703
|
+
frameType: 0,
|
|
20704
|
+
timestamp: 0,
|
|
20705
|
+
total: total,
|
|
20706
|
+
received: 0
|
|
20707
|
+
};
|
|
20708
|
+
frames[frameID] = item;
|
|
20709
|
+
if (seq === 0) {
|
|
20710
|
+
if (length < FIRST_HEADER_SIZE) {
|
|
20711
|
+
delete frames[frameID];
|
|
20712
|
+
return;
|
|
20713
|
+
}
|
|
20714
|
+
item.frameType = view.getUint8(GENERAL_HEADER_SIZE);
|
|
20715
|
+
item.timestamp = u64AsNumber(view, GENERAL_HEADER_SIZE + 1);
|
|
20716
|
+
headerSize = FIRST_HEADER_SIZE;
|
|
20717
|
+
}
|
|
20718
|
+
}
|
|
20719
|
+
|
|
20720
|
+
var dataStartsAt = seq * DATA_PART_SIZE;
|
|
20721
|
+
if (seq > 0) {
|
|
20722
|
+
dataStartsAt -= FIRST_HEADER_SIZE - GENERAL_HEADER_SIZE;
|
|
20723
|
+
}
|
|
20724
|
+
var packetData = new Uint8Array(buffer, headerSize);
|
|
20725
|
+
item.buffer.set(packetData, dataStartsAt);
|
|
20726
|
+
item.received++;
|
|
20727
|
+
|
|
20728
|
+
if (seq + 1 === total) {
|
|
20729
|
+
delete frames[frameID];
|
|
20730
|
+
if (item.received !== item.total) {
|
|
20731
|
+
return;
|
|
20732
|
+
}
|
|
20733
|
+
var dataEndsAt = dataStartsAt + length - headerSize;
|
|
20734
|
+
latestFrame = {
|
|
20735
|
+
frameType: item.frameType,
|
|
20736
|
+
timestamp: item.timestamp,
|
|
20737
|
+
length: dataEndsAt,
|
|
20738
|
+
data: item.buffer.buffer
|
|
20739
|
+
};
|
|
20740
|
+
resolveFrame();
|
|
20741
|
+
}
|
|
20742
|
+
}
|
|
20743
|
+
|
|
20744
|
+
self.onmessage = function(event) {
|
|
20745
|
+
var message = event.data;
|
|
20746
|
+
try {
|
|
20747
|
+
if (message.type === 'open') {
|
|
20748
|
+
socket = new WebSocket(message.url);
|
|
20749
|
+
socket.binaryType = 'arraybuffer';
|
|
20750
|
+
socket.onopen = function() {
|
|
20751
|
+
self.postMessage({ type: 'open', id: message.id });
|
|
20752
|
+
};
|
|
20753
|
+
socket.onerror = function() {
|
|
20754
|
+
postError(null, 'WebSocket error');
|
|
20755
|
+
};
|
|
20756
|
+
socket.onclose = function() {
|
|
20757
|
+
closed = true;
|
|
20758
|
+
self.postMessage({ type: 'closed' });
|
|
20759
|
+
};
|
|
20760
|
+
socket.onmessage = function(socketEvent) {
|
|
20761
|
+
if (socketEvent.data instanceof ArrayBuffer) {
|
|
20762
|
+
handlePacket(socketEvent.data);
|
|
20763
|
+
}
|
|
20764
|
+
};
|
|
20765
|
+
} else if (message.type === 'read') {
|
|
20766
|
+
if (closed) {
|
|
20767
|
+
postError(message.id, 'WebSocket closed');
|
|
20768
|
+
return;
|
|
20769
|
+
}
|
|
20770
|
+
pendingRead = message.id;
|
|
20771
|
+
resolveFrame();
|
|
20772
|
+
} else if (message.type === 'write') {
|
|
20773
|
+
if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
20774
|
+
postError(message.id, 'WebSocket is not open');
|
|
20775
|
+
return;
|
|
20776
|
+
}
|
|
20777
|
+
socket.send(message.data);
|
|
20778
|
+
self.postMessage({ type: 'write', id: message.id, bytes: message.data.byteLength });
|
|
20779
|
+
} else if (message.type === 'close') {
|
|
20780
|
+
closed = true;
|
|
20781
|
+
if (socket) {
|
|
20782
|
+
socket.close(1000, 'Closed by client');
|
|
20783
|
+
}
|
|
20784
|
+
self.postMessage({ type: 'close', id: message.id });
|
|
20785
|
+
}
|
|
20786
|
+
} catch (error) {
|
|
20787
|
+
postError(message.id, error);
|
|
20788
|
+
}
|
|
20789
|
+
};
|
|
20790
|
+
`;
|
|
20791
|
+
function createWorker() {
|
|
20792
|
+
const blob = new Blob([workerScript], { type: "application/javascript" });
|
|
20793
|
+
return new Worker(URL.createObjectURL(blob));
|
|
20794
|
+
}
|
|
20795
|
+
var createSupraFrameWorkerConnection = (url) => {
|
|
20796
|
+
const worker = createWorker();
|
|
20797
|
+
let nextId = 1;
|
|
20798
|
+
const pending = /* @__PURE__ */ new Map();
|
|
20799
|
+
worker.onmessage = (event) => {
|
|
20800
|
+
const message = event.data;
|
|
20801
|
+
if (message.type === "closed") {
|
|
20802
|
+
pending.forEach(({ reject }) => reject(new Error("WebSocket worker closed")));
|
|
20803
|
+
pending.clear();
|
|
20804
|
+
return;
|
|
20805
|
+
}
|
|
20806
|
+
const request2 = pending.get(message.id);
|
|
20807
|
+
if (!request2) {
|
|
20808
|
+
return;
|
|
20809
|
+
}
|
|
20810
|
+
if (message.type === "error") {
|
|
20811
|
+
pending.delete(message.id);
|
|
20812
|
+
request2.reject(new Error(message.error));
|
|
20813
|
+
} else if (message.type === "open" || message.type === "close") {
|
|
20814
|
+
pending.delete(message.id);
|
|
20815
|
+
request2.resolve();
|
|
20816
|
+
} else if (message.type === "write") {
|
|
20817
|
+
pending.delete(message.id);
|
|
20818
|
+
request2.resolve(message.bytes);
|
|
20819
|
+
} else if (message.type === "frame") {
|
|
20820
|
+
pending.delete(message.id);
|
|
20821
|
+
request2.resolve({
|
|
20822
|
+
frameType: message.frameType,
|
|
20823
|
+
timestamp: message.timestamp,
|
|
20824
|
+
length: message.length,
|
|
20825
|
+
data: message.data
|
|
20826
|
+
});
|
|
20827
|
+
}
|
|
20828
|
+
};
|
|
20829
|
+
worker.onerror = (event) => {
|
|
20830
|
+
pending.forEach(({ reject }) => reject(new Error(event.message)));
|
|
20831
|
+
pending.clear();
|
|
20832
|
+
};
|
|
20833
|
+
function request(type, payload = {}, transfer) {
|
|
20834
|
+
const id = nextId++;
|
|
20835
|
+
const promise = new Promise((resolve, reject) => pending.set(id, { resolve, reject }));
|
|
20836
|
+
worker.postMessage({ ...payload, id, type }, transfer || []);
|
|
20837
|
+
return promise;
|
|
20838
|
+
}
|
|
20839
|
+
const ready = request("open", { url });
|
|
20840
|
+
ready.catch((error) => console.error("Cannot open screen worker WebSocket", error));
|
|
20841
|
+
return {
|
|
20842
|
+
collectFrame: () => ready.then(() => request("read")),
|
|
20843
|
+
write: (data) => ready.then(() => request("write", { data }, [data])),
|
|
20844
|
+
close: async () => {
|
|
20845
|
+
await ready.catch(() => void 0);
|
|
20846
|
+
await request("close");
|
|
20847
|
+
worker.terminate();
|
|
20848
|
+
}
|
|
20849
|
+
};
|
|
20850
|
+
};
|
|
20851
|
+
function initWorkerFrameConnection() {
|
|
20852
|
+
if (typeof Worker !== "undefined") {
|
|
20853
|
+
window.createSupraFrameWorkerConnection = createSupraFrameWorkerConnection;
|
|
20854
|
+
}
|
|
20855
|
+
}
|
|
20856
|
+
|
|
20857
|
+
// screen/samsungwasmdecoder.ts
|
|
20858
|
+
var import_samsung_wasm_decoder2 = __toESM(require_dist2());
|
|
20859
|
+
var import_videoDecoder = __toESM(require_videoDecoder2());
|
|
20860
|
+
async function initSamsungWasmDecoder(options) {
|
|
20861
|
+
if ((0, import_samsung_wasm_decoder2.isSamsungWasmSupported)()) {
|
|
20862
|
+
window.samsungWasmDecoder = await (0, import_samsung_wasm_decoder2.createSamsungWasmDecoder)({
|
|
20863
|
+
videoElementId: "samsung-wasm-video"
|
|
20864
|
+
});
|
|
20865
|
+
const latencyMode = options.interactive ? import_videoDecoder.LatencyMode.UltraLow : import_videoDecoder.LatencyMode.Low;
|
|
20866
|
+
await window.samsungWasmDecoder.initialize({ latencyMode });
|
|
18081
20867
|
}
|
|
18082
20868
|
}
|
|
18083
20869
|
|
|
@@ -18106,10 +20892,52 @@
|
|
|
18106
20892
|
if (typeof params.clientSecret !== "string") {
|
|
18107
20893
|
throw new Error(`Invalid clientSecret query param`);
|
|
18108
20894
|
}
|
|
18109
|
-
|
|
18110
|
-
|
|
20895
|
+
const options = {
|
|
20896
|
+
screenID: params.screenID,
|
|
20897
|
+
screenDriver: params.screenDriver,
|
|
20898
|
+
screenHost: params.screenHost,
|
|
20899
|
+
metadataDriver: params.metadataDriver,
|
|
20900
|
+
metadataHost: params.metadataHost,
|
|
20901
|
+
clientID: params.clientID,
|
|
20902
|
+
clientSecret: params.clientSecret,
|
|
20903
|
+
secure: params.secure !== "false",
|
|
20904
|
+
interactive: params.interactive === "true"
|
|
20905
|
+
};
|
|
20906
|
+
if (typeof params.forceScreenSize === "string") {
|
|
20907
|
+
const sizeParts = params.forceScreenSize.split("x");
|
|
20908
|
+
if (sizeParts.length !== 2) {
|
|
20909
|
+
throw new Error(`Invalid forceScreenSize query param`);
|
|
20910
|
+
}
|
|
20911
|
+
const width = Number(sizeParts[0]);
|
|
20912
|
+
const height = Number(sizeParts[1]);
|
|
20913
|
+
if (isNaN(width) || isNaN(height) || width <= 0 || height <= 0) {
|
|
20914
|
+
throw new Error(`Invalid forceScreenSize query param`);
|
|
20915
|
+
}
|
|
20916
|
+
options.forceScreenSize = { width, height };
|
|
20917
|
+
}
|
|
20918
|
+
const encodingPreferences = {};
|
|
20919
|
+
if (params.preferredPreset) {
|
|
20920
|
+
encodingPreferences.preferredPreset = params.preferredPreset;
|
|
20921
|
+
}
|
|
20922
|
+
if (params.preferredTune) {
|
|
20923
|
+
encodingPreferences.preferredTune = params.preferredTune;
|
|
20924
|
+
}
|
|
20925
|
+
if (params.preferredProfile) {
|
|
20926
|
+
encodingPreferences.preferredProfile = params.preferredProfile;
|
|
20927
|
+
}
|
|
20928
|
+
if (params.preferredQualityIndex) {
|
|
20929
|
+
encodingPreferences.preferredQualityIndex = Number(params.preferredQualityIndex);
|
|
20930
|
+
}
|
|
20931
|
+
if (params.preferredBitrateKbps) {
|
|
20932
|
+
encodingPreferences.preferredBitrateKbps = Number(params.preferredBitrateKbps);
|
|
20933
|
+
}
|
|
20934
|
+
if (Object.keys(encodingPreferences).length > 0) {
|
|
20935
|
+
options.encodingPreferences = encodingPreferences;
|
|
20936
|
+
}
|
|
20937
|
+
return options;
|
|
18111
20938
|
}
|
|
18112
20939
|
function getGoArgv(binFile, options) {
|
|
20940
|
+
const encodingPrefsJson = options.encodingPreferences ? JSON.stringify(options.encodingPreferences) : "";
|
|
18113
20941
|
return [
|
|
18114
20942
|
binFile,
|
|
18115
20943
|
options.screenID,
|
|
@@ -18119,15 +20947,21 @@
|
|
|
18119
20947
|
options.metadataHost,
|
|
18120
20948
|
options.clientID,
|
|
18121
20949
|
options.clientSecret,
|
|
18122
|
-
options.secure ? "1" : "0"
|
|
20950
|
+
options.secure ? "1" : "0",
|
|
20951
|
+
options.forceScreenSize ? `${options.forceScreenSize.width}x${options.forceScreenSize.height}` : "",
|
|
20952
|
+
encodingPrefsJson
|
|
18123
20953
|
];
|
|
18124
20954
|
}
|
|
18125
20955
|
|
|
18126
20956
|
// screen/plain.ts
|
|
18127
|
-
var SCREEN_JS_URL = "supra-client-screen.js?v=0.0.0-master.
|
|
20957
|
+
var SCREEN_JS_URL = "supra-client-screen.js?v=0.0.0-master.429";
|
|
18128
20958
|
async function startPlainScreen(options) {
|
|
18129
20959
|
options = options != null ? options : parseQueryOptions();
|
|
18130
20960
|
initNaCLDecoder();
|
|
20961
|
+
initWorkerFrameConnection();
|
|
20962
|
+
await initNaClTCP();
|
|
20963
|
+
await initSamsungWasmTCP();
|
|
20964
|
+
await initSamsungWasmDecoder(options);
|
|
18131
20965
|
const fs = await initBrowserFS();
|
|
18132
20966
|
window.fs = fs;
|
|
18133
20967
|
process.argv = ["go", ...getGoArgv(SCREEN_JS_URL, options)];
|
|
@@ -18150,9 +20984,12 @@
|
|
|
18150
20984
|
}
|
|
18151
20985
|
|
|
18152
20986
|
// screen/wasm.ts
|
|
18153
|
-
var SCREEN_WASM_URL = "supra-client-screen.wasm?v=0.0.0-master.
|
|
20987
|
+
var SCREEN_WASM_URL = "supra-client-screen.wasm?v=0.0.0-master.429";
|
|
18154
20988
|
async function startWasmScreen(options) {
|
|
18155
20989
|
options = options != null ? options : parseQueryOptions();
|
|
20990
|
+
initWorkerFrameConnection();
|
|
20991
|
+
await initSamsungWasmTCP();
|
|
20992
|
+
await initSamsungWasmDecoder(options);
|
|
18156
20993
|
await initH264Decoder();
|
|
18157
20994
|
await initGoEnvironment();
|
|
18158
20995
|
await startGoScreen(options);
|