@supraio/client-daemon-js 0.0.0-jvmaster.366-jvdevelop.396 → 0.0.0-jvmaster.366-jvandroid.397
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 +2 -386
- 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 +2 -3
- package/screen.html +1 -1
- package/screen.js +2 -396
- package/screen.js.map +4 -4
- package/sdk.js +4 -398
- package/sdk.js.map +4 -4
- package/supra-client-daemon.js +93 -395
- package/supra-client-daemon.js.map +1 -1
- package/supra-client-daemon.wasm +0 -0
- package/supra-client-screen.js +430 -952
- package/supra-client-screen.js.map +1 -1
- package/supra-client-screen.wasm +0 -0
- package/samsung-wasm-decoder.html +0 -1
- package/samsung-wasm-decoder.html.mem +0 -0
- package/samsung-wasm-decoder.js +0 -22
- package/samsung-wasm-decoder.wasm +0 -0
- package/samsung-wasm-decoder.worker.js +0 -228
- package/screen/samsungwasmdecoder.d.ts +0 -8
|
Binary file
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
// Copyright 2015 The Emscripten Authors. All rights reserved.
|
|
2
|
-
// Emscripten is available under two separate licenses, the MIT license and the
|
|
3
|
-
// University of Illinois/NCSA Open Source License. Both these licenses can be
|
|
4
|
-
// found in the LICENSE file.
|
|
5
|
-
|
|
6
|
-
// Pthread Web Worker startup routine:
|
|
7
|
-
// This is the entry point file that is loaded first by each Web Worker
|
|
8
|
-
// that executes pthreads on the Emscripten application.
|
|
9
|
-
|
|
10
|
-
// Thread-local:
|
|
11
|
-
var threadInfoStruct = 0; // Info area for this thread in Emscripten HEAP (shared). If zero, this worker is not currently hosting an executing pthread.
|
|
12
|
-
var selfThreadId = 0; // The ID of this thread. 0 if not hosting a pthread.
|
|
13
|
-
var parentThreadId = 0; // The ID of the parent pthread that launched this thread.
|
|
14
|
-
|
|
15
|
-
var noExitRuntime;
|
|
16
|
-
|
|
17
|
-
// performance.now() is specced to return a wallclock time in msecs since that Web Worker/main thread launched. However for pthreads this can cause
|
|
18
|
-
// subtle problems in emscripten_get_now() as this essentially would measure time from pthread_create(), meaning that the clocks between each threads
|
|
19
|
-
// would be wildly out of sync. Therefore sync all pthreads to the clock on the main browser thread, so that different threads see a somewhat
|
|
20
|
-
// coherent clock across each of them (+/- 0.1msecs in testing)
|
|
21
|
-
var __performance_now_clock_drift = 0;
|
|
22
|
-
|
|
23
|
-
// Cannot use console.log or console.error in a web worker, since that would risk a browser deadlock! https://bugzilla.mozilla.org/show_bug.cgi?id=1049091
|
|
24
|
-
// Therefore implement custom logging facility for threads running in a worker, which queue the messages to main thread to print.
|
|
25
|
-
var Module = {};
|
|
26
|
-
|
|
27
|
-
// These modes need to assign to these variables because of how scoping works in them.
|
|
28
|
-
var PThread;
|
|
29
|
-
var HEAPU32;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
function threadPrintErr() {
|
|
33
|
-
var text = Array.prototype.slice.call(arguments).join(' ');
|
|
34
|
-
console.error(text);
|
|
35
|
-
console.error(new Error().stack);
|
|
36
|
-
}
|
|
37
|
-
function threadAlert() {
|
|
38
|
-
var text = Array.prototype.slice.call(arguments).join(' ');
|
|
39
|
-
postMessage({cmd: 'alert', text: text, threadId: selfThreadId});
|
|
40
|
-
}
|
|
41
|
-
var err = threadPrintErr;
|
|
42
|
-
this.alert = threadAlert;
|
|
43
|
-
|
|
44
|
-
// When using postMessage to send an object, it is processed by the structured clone algorithm.
|
|
45
|
-
// The prototype, and hence methods, on that object is then lost. This function adds back the lost prototype.
|
|
46
|
-
// This does not work with nested objects that has prototypes, but it suffices for WasmSourceMap and WasmOffsetConverter.
|
|
47
|
-
function resetPrototype(constructor, attrs) {
|
|
48
|
-
var object = Object.create(constructor.prototype);
|
|
49
|
-
for (var key in attrs) {
|
|
50
|
-
if (attrs.hasOwnProperty(key)) {
|
|
51
|
-
object[key] = attrs[key];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return object;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Module['instantiateWasm'] = function(info, receiveInstance) {
|
|
58
|
-
// Instantiate from the module posted from the main thread.
|
|
59
|
-
// We can just use sync instantiation in the worker.
|
|
60
|
-
var instance = new WebAssembly.Instance(Module['wasmModule'], info);
|
|
61
|
-
// We don't need the module anymore; new threads will be spawned from the main thread.
|
|
62
|
-
Module['wasmModule'] = null;
|
|
63
|
-
receiveInstance(instance); // The second 'module' parameter is intentionally null here, we don't need to keep a ref to the Module object from here.
|
|
64
|
-
return instance.exports;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.onmessage = function(e) {
|
|
69
|
-
try {
|
|
70
|
-
if (e.data.cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
|
|
71
|
-
// Initialize the thread-local field(s):
|
|
72
|
-
Module['tempDoublePtr'] = e.data.tempDoublePtr;
|
|
73
|
-
|
|
74
|
-
// Initialize the global "process"-wide fields:
|
|
75
|
-
Module['DYNAMIC_BASE'] = e.data.DYNAMIC_BASE;
|
|
76
|
-
Module['DYNAMICTOP_PTR'] = e.data.DYNAMICTOP_PTR;
|
|
77
|
-
|
|
78
|
-
// Module and memory were sent from main thread
|
|
79
|
-
Module['wasmModule'] = e.data.wasmModule;
|
|
80
|
-
Module['wasmMemory'] = e.data.wasmMemory;
|
|
81
|
-
Module['buffer'] = Module['wasmMemory'].buffer;
|
|
82
|
-
|
|
83
|
-
Module['ENVIRONMENT_IS_PTHREAD'] = true;
|
|
84
|
-
|
|
85
|
-
if (typeof e.data.urlOrBlob === 'string') {
|
|
86
|
-
importScripts(e.data.urlOrBlob);
|
|
87
|
-
} else {
|
|
88
|
-
var objectUrl = URL.createObjectURL(e.data.urlOrBlob);
|
|
89
|
-
importScripts(objectUrl);
|
|
90
|
-
URL.revokeObjectURL(objectUrl);
|
|
91
|
-
}
|
|
92
|
-
Module = SamsungWasmDecoderModule(Module);
|
|
93
|
-
PThread = Module['PThread'];
|
|
94
|
-
HEAPU32 = Module['HEAPU32'];
|
|
95
|
-
USE_HOST_BINDINGS = Module['USE_HOST_BINDINGS'];
|
|
96
|
-
FS = Module['FS'];
|
|
97
|
-
postMessage({ cmd: 'loaded' });
|
|
98
|
-
} else if (e.data.cmd === 'objectTransfer') {
|
|
99
|
-
PThread.receiveObjectTransfer(e.data);
|
|
100
|
-
} else if (e.data.cmd === 'run') { // This worker was idle, and now should start executing its pthread entry point.
|
|
101
|
-
__performance_now_clock_drift = performance.now() - e.data.time; // Sync up to the clock of the main thread.
|
|
102
|
-
threadInfoStruct = e.data.threadInfoStruct;
|
|
103
|
-
Module['__register_pthread_ptr'](threadInfoStruct, /*isMainBrowserThread=*/0, /*isMainRuntimeThread=*/0); // Pass the thread address inside the asm.js scope to store it for fast access that avoids the need for a FFI out.
|
|
104
|
-
selfThreadId = e.data.selfThreadId;
|
|
105
|
-
parentThreadId = e.data.parentThreadId;
|
|
106
|
-
// Establish the stack frame for this thread in global scope
|
|
107
|
-
var max = e.data.stackBase + e.data.stackSize;
|
|
108
|
-
var top = e.data.stackBase;
|
|
109
|
-
// Also call inside JS module to set up the stack frame for this pthread in JS module scope
|
|
110
|
-
Module['establishStackSpaceInJsModule'](top, max);
|
|
111
|
-
PThread.receiveObjectTransfer(e.data);
|
|
112
|
-
PThread.setThreadStatus(Module['_pthread_self'](), 1/*EM_THREAD_STATUS_RUNNING*/);
|
|
113
|
-
|
|
114
|
-
if (!USE_HOST_BINDINGS) {
|
|
115
|
-
// Close all socket streams opened by the previous thread.
|
|
116
|
-
for (let i = 3; i < FS.streams.length; i++) {
|
|
117
|
-
// No `if` as only socket streams can be opened on side threads.
|
|
118
|
-
FS.closeStream(i);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
try {
|
|
123
|
-
// pthread entry points are always of signature 'void *ThreadMain(void *arg)'
|
|
124
|
-
// Native codebases sometimes spawn threads with other thread entry point signatures,
|
|
125
|
-
// such as void ThreadMain(void *arg), void *ThreadMain(), or void ThreadMain().
|
|
126
|
-
// That is not acceptable per C/C++ specification, but x86 compiler ABI extensions
|
|
127
|
-
// enable that to work. If you find the following line to crash, either change the signature
|
|
128
|
-
// to "proper" void *ThreadMain(void *arg) form, or try linking with the Emscripten linker
|
|
129
|
-
// flag -s EMULATE_FUNCTION_POINTER_CASTS=1 to add in emulation for this x86 ABI extension.
|
|
130
|
-
var result = Module['dynCall_ii'](e.data.start_routine, e.data.arg);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} catch(e) {
|
|
134
|
-
if (e === 'Canceled!') {
|
|
135
|
-
PThread.threadCancel();
|
|
136
|
-
return;
|
|
137
|
-
} else if (e == 'unwind') {
|
|
138
|
-
return;
|
|
139
|
-
} else {
|
|
140
|
-
// If below two conditions are false then thread will be properly
|
|
141
|
-
// marked as exited by PThread.threadExit(result) without race condition
|
|
142
|
-
// with thread which may wait on futex (e.g. calling pthread_join()).
|
|
143
|
-
if (noExitRuntime || !(e instanceof Module['ExitStatus'])) {
|
|
144
|
-
Atomics.store(HEAPU32, (threadInfoStruct + 4 /*C_STRUCTS.pthread.threadExitCode*/ ) >> 2, (e instanceof Module['ExitStatus']) ? e.status : -2 /*A custom entry specific to Emscripten denoting that the thread crashed.*/);
|
|
145
|
-
Atomics.store(HEAPU32, (threadInfoStruct + 0 /*C_STRUCTS.pthread.threadStatus*/ ) >> 2, 1); // Mark the thread as no longer running.
|
|
146
|
-
Module['_emscripten_futex_wake'](threadInfoStruct + 0 /*C_STRUCTS.pthread.threadStatus*/, 0x7FFFFFFF/*INT_MAX*/); // Wake all threads waiting on this thread to finish.
|
|
147
|
-
if (!(e instanceof Module['ExitStatus'])) throw e;
|
|
148
|
-
} else {
|
|
149
|
-
// as we cought exception result is 'undefined'
|
|
150
|
-
result = e.status;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// The thread might have finished without calling pthread_exit(). If so, then perform the exit operation ourselves.
|
|
155
|
-
// (This is a no-op if explicit pthread_exit() had been called prior.)
|
|
156
|
-
if (!noExitRuntime) PThread.threadExit(result);
|
|
157
|
-
} else if (e.data.cmd === 'cancel') { // Main thread is asking for a pthread_cancel() on this thread.
|
|
158
|
-
if (threadInfoStruct) {
|
|
159
|
-
PThread.threadCancel();
|
|
160
|
-
}
|
|
161
|
-
} else if (e.data.target === 'setimmediate') {
|
|
162
|
-
// no-op
|
|
163
|
-
} else if (e.data.cmd === 'processThreadQueue') {
|
|
164
|
-
if (threadInfoStruct) { // If this thread is actually running?
|
|
165
|
-
Module['_emscripten_current_thread_process_queued_calls']();
|
|
166
|
-
}
|
|
167
|
-
} else {
|
|
168
|
-
err('worker.js received unknown command ' + e.data.cmd);
|
|
169
|
-
console.error(e.data);
|
|
170
|
-
}
|
|
171
|
-
} catch(e) {
|
|
172
|
-
console.error('worker.js onmessage() captured an uncaught exception: ' + e);
|
|
173
|
-
console.error(e.stack);
|
|
174
|
-
throw e;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// Node.js support
|
|
179
|
-
if (typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string') {
|
|
180
|
-
// Create as web-worker-like an environment as we can.
|
|
181
|
-
self = {
|
|
182
|
-
location: {
|
|
183
|
-
href: __filename
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
var onmessage = this.onmessage;
|
|
188
|
-
|
|
189
|
-
var nodeWorkerThreads = require('worker_threads');
|
|
190
|
-
|
|
191
|
-
Worker = nodeWorkerThreads.Worker;
|
|
192
|
-
|
|
193
|
-
var parentPort = nodeWorkerThreads.parentPort;
|
|
194
|
-
|
|
195
|
-
parentPort.on('message', function(data) {
|
|
196
|
-
onmessage({ data: data });
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
var nodeFS = require('fs');
|
|
200
|
-
|
|
201
|
-
var nodeRead = function(filename) {
|
|
202
|
-
return nodeFS.readFileSync(filename, 'utf8');
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
function globalEval(x) {
|
|
206
|
-
global.require = require;
|
|
207
|
-
global.Module = Module;
|
|
208
|
-
eval.call(null, x);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
importScripts = function(f) {
|
|
212
|
-
globalEval(nodeRead(f));
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
postMessage = function(msg) {
|
|
216
|
-
parentPort.postMessage(msg);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
if (typeof performance === 'undefined') {
|
|
220
|
-
performance = {
|
|
221
|
-
now: function() {
|
|
222
|
-
return Date.now();
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SamsungWasmDecoder } from '@signageos/samsung-wasm-decoder';
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
/** Make it global accessible for x264/samsungwasmdecoder/samsungwasmdecoder.go */
|
|
5
|
-
samsungWasmDecoder?: SamsungWasmDecoder;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function initSamsungWasmDecoder(): Promise<void>;
|