@supraio/client-daemon-js 0.0.0-jvmaster.366-jvmaster.375 → 0.0.0-jvmaster.366-jvdevelop.396

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.
Binary file
@@ -0,0 +1,228 @@
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
+
@@ -0,0 +1,8 @@
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>;
package/screen.html CHANGED
@@ -5,6 +5,6 @@
5
5
  <link rel="stylesheet" href="screen.css"></link>
6
6
  </head>
7
7
  <body>
8
- <script type="text/javascript" src="screen.js?v=0.0.0-jvmaster.366-jvmaster.375"></script>
8
+ <script type="text/javascript" src="screen.js?v=0.0.0-jvmaster.366-jvdevelop.396"></script>
9
9
  </body>
10
10
  </html>
package/screen.js CHANGED
@@ -17592,6 +17592,387 @@
17592
17592
  }
17593
17593
  });
17594
17594
 
17595
+ // node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/videoDecoder.js
17596
+ var require_videoDecoder2 = __commonJS({
17597
+ "node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/videoDecoder.js"(exports) {
17598
+ "use strict";
17599
+ Object.defineProperty(exports, "__esModule", { value: true });
17600
+ exports.ResultStatus = void 0;
17601
+ var ResultStatus;
17602
+ (function(ResultStatus2) {
17603
+ ResultStatus2[ResultStatus2["Ok"] = 0] = "Ok";
17604
+ ResultStatus2[ResultStatus2["ErrorFailed"] = -2] = "ErrorFailed";
17605
+ ResultStatus2[ResultStatus2["ErrorBadArgument"] = -4] = "ErrorBadArgument";
17606
+ ResultStatus2[ResultStatus2["ErrorNoInit"] = -6] = "ErrorNoInit";
17607
+ })(ResultStatus || (exports.ResultStatus = ResultStatus = {}));
17608
+ }
17609
+ });
17610
+
17611
+ // node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmDecoder.js
17612
+ var require_wasmDecoder = __commonJS({
17613
+ "node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/wasmDecoder.js"(exports) {
17614
+ "use strict";
17615
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
17616
+ function adopt(value) {
17617
+ return value instanceof P ? value : new P(function(resolve) {
17618
+ resolve(value);
17619
+ });
17620
+ }
17621
+ return new (P || (P = Promise))(function(resolve, reject) {
17622
+ function fulfilled(value) {
17623
+ try {
17624
+ step(generator.next(value));
17625
+ } catch (e) {
17626
+ reject(e);
17627
+ }
17628
+ }
17629
+ function rejected(value) {
17630
+ try {
17631
+ step(generator["throw"](value));
17632
+ } catch (e) {
17633
+ reject(e);
17634
+ }
17635
+ }
17636
+ function step(result) {
17637
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
17638
+ }
17639
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17640
+ });
17641
+ };
17642
+ var __generator = exports && exports.__generator || function(thisArg, body) {
17643
+ var _ = { label: 0, sent: function() {
17644
+ if (t[0] & 1) throw t[1];
17645
+ return t[1];
17646
+ }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
17647
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
17648
+ return this;
17649
+ }), g;
17650
+ function verb(n) {
17651
+ return function(v) {
17652
+ return step([n, v]);
17653
+ };
17654
+ }
17655
+ function step(op) {
17656
+ if (f) throw new TypeError("Generator is already executing.");
17657
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17658
+ 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;
17659
+ if (y = 0, t) op = [op[0] & 2, t.value];
17660
+ switch (op[0]) {
17661
+ case 0:
17662
+ case 1:
17663
+ t = op;
17664
+ break;
17665
+ case 4:
17666
+ _.label++;
17667
+ return { value: op[1], done: false };
17668
+ case 5:
17669
+ _.label++;
17670
+ y = op[1];
17671
+ op = [0];
17672
+ continue;
17673
+ case 7:
17674
+ op = _.ops.pop();
17675
+ _.trys.pop();
17676
+ continue;
17677
+ default:
17678
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
17679
+ _ = 0;
17680
+ continue;
17681
+ }
17682
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
17683
+ _.label = op[1];
17684
+ break;
17685
+ }
17686
+ if (op[0] === 6 && _.label < t[1]) {
17687
+ _.label = t[1];
17688
+ t = op;
17689
+ break;
17690
+ }
17691
+ if (t && _.label < t[2]) {
17692
+ _.label = t[2];
17693
+ _.ops.push(op);
17694
+ break;
17695
+ }
17696
+ if (t[2]) _.ops.pop();
17697
+ _.trys.pop();
17698
+ continue;
17699
+ }
17700
+ op = body.call(thisArg, _);
17701
+ } catch (e) {
17702
+ op = [6, e];
17703
+ y = 0;
17704
+ } finally {
17705
+ f = t = 0;
17706
+ }
17707
+ if (op[0] & 5) throw op[1];
17708
+ return { value: op[0] ? op[1] : void 0, done: true };
17709
+ }
17710
+ };
17711
+ Object.defineProperty(exports, "__esModule", { value: true });
17712
+ exports.SamsungWasmDecoder = void 0;
17713
+ var videoDecoder_1 = require_videoDecoder2();
17714
+ function detectKeyFrameAnnexB(bytes) {
17715
+ if (bytes.length === 0)
17716
+ return false;
17717
+ var nalHeaderIndex = 0;
17718
+ if (bytes.length >= 4 && bytes[0] === 0 && bytes[1] === 0 && bytes[2] === 0 && bytes[3] === 1) {
17719
+ nalHeaderIndex = 4;
17720
+ } else if (bytes.length >= 3 && bytes[0] === 0 && bytes[1] === 0 && bytes[2] === 1) {
17721
+ nalHeaderIndex = 3;
17722
+ }
17723
+ if (nalHeaderIndex >= bytes.length)
17724
+ return false;
17725
+ var nalType = bytes[nalHeaderIndex] & 31;
17726
+ if (nalType === 5 || nalType === 7 || nalType === 8)
17727
+ return true;
17728
+ for (var i = nalHeaderIndex + 1; i + 4 < bytes.length; i++) {
17729
+ var is3 = bytes[i] === 0 && bytes[i + 1] === 0 && bytes[i + 2] === 1;
17730
+ var is4 = bytes[i] === 0 && bytes[i + 1] === 0 && bytes[i + 2] === 0 && bytes[i + 3] === 1;
17731
+ if (!is3 && !is4)
17732
+ continue;
17733
+ var idx = i + (is3 ? 3 : 4);
17734
+ if (idx >= bytes.length)
17735
+ return false;
17736
+ var nt = bytes[idx] & 31;
17737
+ if (nt === 5 || nt === 7 || nt === 8)
17738
+ return true;
17739
+ }
17740
+ return false;
17741
+ }
17742
+ function ensureVideoElement(videoElementId) {
17743
+ var el = document.getElementById(videoElementId);
17744
+ if (!el) {
17745
+ el = document.createElement("video");
17746
+ el.id = videoElementId;
17747
+ el.style.position = "absolute";
17748
+ el.style.top = "0";
17749
+ el.style.left = "0";
17750
+ el.style.width = "1920px";
17751
+ el.style.height = "1080px";
17752
+ el.style.backgroundColor = "#000";
17753
+ document.body.appendChild(el);
17754
+ }
17755
+ el.autoplay = true;
17756
+ el.muted = true;
17757
+ el.playsInline = true;
17758
+ return el;
17759
+ }
17760
+ var SamsungWasmDecoder2 = (
17761
+ /** @class */
17762
+ function() {
17763
+ function SamsungWasmDecoder3(videoElementId) {
17764
+ this.videoElementId = videoElementId;
17765
+ this.initialized = false;
17766
+ this.destroyed = false;
17767
+ this.native = null;
17768
+ this.decoderHandle = 0;
17769
+ this.ptsSeconds = 0;
17770
+ this.frameDurationSeconds = 1 / 60;
17771
+ this.videoElement = ensureVideoElement(videoElementId);
17772
+ }
17773
+ SamsungWasmDecoder3.prototype.destroy = function() {
17774
+ return __awaiter(this, void 0, void 0, function() {
17775
+ var _a, _b;
17776
+ return __generator(this, function(_c) {
17777
+ if (this.destroyed)
17778
+ return [
17779
+ 2
17780
+ /*return*/
17781
+ ];
17782
+ this.destroyed = true;
17783
+ try {
17784
+ (_b = (_a = this.native) === null || _a === void 0 ? void 0 : _a.ccall) === null || _b === void 0 ? void 0 : _b.call(_a, "swd_destroy", "void", ["number"], [this.decoderHandle]);
17785
+ } catch (_d) {
17786
+ }
17787
+ this.decoderHandle = 0;
17788
+ this.native = null;
17789
+ return [
17790
+ 2
17791
+ /*return*/
17792
+ ];
17793
+ });
17794
+ });
17795
+ };
17796
+ SamsungWasmDecoder3.prototype.initialize = function(args) {
17797
+ return __awaiter(this, void 0, void 0, function() {
17798
+ var width, height, mod, create, init, fpsNum, fpsDen, ok, isReady, maxWaitMs, pollIntervalMs, waited;
17799
+ var _a, _b, _c;
17800
+ return __generator(this, function(_d) {
17801
+ switch (_d.label) {
17802
+ case 0:
17803
+ if (this.destroyed) {
17804
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17805
+ }
17806
+ width = (_a = args.width) !== null && _a !== void 0 ? _a : window.screen.width;
17807
+ height = (_b = args.height) !== null && _b !== void 0 ? _b : window.screen.height;
17808
+ this.videoElement.width = width;
17809
+ this.videoElement.height = height;
17810
+ mod = (_c = window.SamsungWasmDecoderModule) === null || _c === void 0 ? void 0 : _c.call(window);
17811
+ if (!mod) {
17812
+ return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
17813
+ }
17814
+ return [4, new Promise(function(resolve) {
17815
+ mod.onRuntimeInitialized = function() {
17816
+ return resolve(null);
17817
+ };
17818
+ })];
17819
+ case 1:
17820
+ _d.sent();
17821
+ this.native = mod;
17822
+ create = mod.cwrap("swd_create", "number", ["string"]);
17823
+ init = mod.cwrap("swd_init_h264", "number", ["number", "number", "number", "number"]);
17824
+ this.decoderHandle = create(this.videoElementId);
17825
+ if (!this.decoderHandle) {
17826
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17827
+ }
17828
+ fpsNum = 60;
17829
+ fpsDen = 1;
17830
+ this.frameDurationSeconds = fpsDen / fpsNum;
17831
+ this.ptsSeconds = 0;
17832
+ ok = init(this.decoderHandle, width, height, fpsNum, fpsDen);
17833
+ if (ok !== 0) {
17834
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17835
+ }
17836
+ isReady = mod.cwrap("swd_is_ready", "number", ["number"]);
17837
+ maxWaitMs = 5e3;
17838
+ pollIntervalMs = 50;
17839
+ waited = 0;
17840
+ _d.label = 2;
17841
+ case 2:
17842
+ if (!(isReady(this.decoderHandle) === 0 && waited < maxWaitMs)) return [3, 4];
17843
+ return [4, new Promise(function(resolve) {
17844
+ return setTimeout(resolve, pollIntervalMs);
17845
+ })];
17846
+ case 3:
17847
+ _d.sent();
17848
+ waited += pollIntervalMs;
17849
+ return [3, 2];
17850
+ case 4:
17851
+ if (isReady(this.decoderHandle) === 0) {
17852
+ console.error("Decoder track did not open in time");
17853
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17854
+ }
17855
+ this.initialized = true;
17856
+ return [2, videoDecoder_1.ResultStatus.Ok];
17857
+ }
17858
+ });
17859
+ });
17860
+ };
17861
+ SamsungWasmDecoder3.prototype.decodeAndRender = function(data) {
17862
+ return __awaiter(this, void 0, void 0, function() {
17863
+ var bytes, isKey, ptr, append, ok;
17864
+ return __generator(this, function(_a) {
17865
+ if (!this.initialized || this.destroyed || !this.native) {
17866
+ return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
17867
+ }
17868
+ if (!(data instanceof ArrayBuffer)) {
17869
+ return [2, videoDecoder_1.ResultStatus.ErrorBadArgument];
17870
+ }
17871
+ bytes = new Uint8Array(data);
17872
+ isKey = detectKeyFrameAnnexB(bytes);
17873
+ ptr = this.native._malloc(bytes.length);
17874
+ this.native.HEAPU8.set(bytes, ptr);
17875
+ try {
17876
+ append = this.native.cwrap("swd_append", "number", [
17877
+ "number",
17878
+ "number",
17879
+ "number",
17880
+ "number",
17881
+ "number",
17882
+ "number"
17883
+ ]);
17884
+ ok = append(this.decoderHandle, ptr, bytes.length, isKey ? 1 : 0, this.ptsSeconds, this.frameDurationSeconds);
17885
+ if (ok === 0) {
17886
+ this.ptsSeconds += this.frameDurationSeconds;
17887
+ return [2, videoDecoder_1.ResultStatus.Ok];
17888
+ }
17889
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17890
+ } finally {
17891
+ this.native._free(ptr);
17892
+ }
17893
+ return [
17894
+ 2
17895
+ /*return*/
17896
+ ];
17897
+ });
17898
+ });
17899
+ };
17900
+ SamsungWasmDecoder3.prototype.flush = function() {
17901
+ return __awaiter(this, void 0, void 0, function() {
17902
+ var flush;
17903
+ return __generator(this, function(_a) {
17904
+ if (!this.native || !this.decoderHandle)
17905
+ return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
17906
+ try {
17907
+ flush = this.native.cwrap("swd_flush", "number", ["number"]);
17908
+ return [2, flush(this.decoderHandle) === 0 ? videoDecoder_1.ResultStatus.Ok : videoDecoder_1.ResultStatus.ErrorFailed];
17909
+ } catch (_b) {
17910
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17911
+ }
17912
+ return [
17913
+ 2
17914
+ /*return*/
17915
+ ];
17916
+ });
17917
+ });
17918
+ };
17919
+ SamsungWasmDecoder3.prototype.reset = function() {
17920
+ return __awaiter(this, void 0, void 0, function() {
17921
+ var reset, rc;
17922
+ return __generator(this, function(_a) {
17923
+ if (!this.native || !this.decoderHandle)
17924
+ return [2, videoDecoder_1.ResultStatus.ErrorNoInit];
17925
+ try {
17926
+ reset = this.native.cwrap("swd_reset", "number", ["number"]);
17927
+ rc = reset(this.decoderHandle);
17928
+ this.ptsSeconds = 0;
17929
+ return [2, rc === 0 ? videoDecoder_1.ResultStatus.Ok : videoDecoder_1.ResultStatus.ErrorFailed];
17930
+ } catch (_b) {
17931
+ return [2, videoDecoder_1.ResultStatus.ErrorFailed];
17932
+ }
17933
+ return [
17934
+ 2
17935
+ /*return*/
17936
+ ];
17937
+ });
17938
+ });
17939
+ };
17940
+ return SamsungWasmDecoder3;
17941
+ }()
17942
+ );
17943
+ exports.SamsungWasmDecoder = SamsungWasmDecoder2;
17944
+ }
17945
+ });
17946
+
17947
+ // node_modules/@signageos/samsung-wasm-decoder/dist/index.js
17948
+ var require_dist2 = __commonJS({
17949
+ "node_modules/@signageos/samsung-wasm-decoder/dist/index.js"(exports) {
17950
+ "use strict";
17951
+ Object.defineProperty(exports, "__esModule", { value: true });
17952
+ exports.SamsungWasmDecoder = exports.ResultStatus = void 0;
17953
+ exports.isSamsungWasmSupported = isSamsungWasmSupported2;
17954
+ exports.createSamsungWasmDecoder = createSamsungWasmDecoder2;
17955
+ var wasmDecoder_1 = require_wasmDecoder();
17956
+ Object.defineProperty(exports, "SamsungWasmDecoder", { enumerable: true, get: function() {
17957
+ return wasmDecoder_1.SamsungWasmDecoder;
17958
+ } });
17959
+ var videoDecoder_1 = require_videoDecoder2();
17960
+ Object.defineProperty(exports, "ResultStatus", { enumerable: true, get: function() {
17961
+ return videoDecoder_1.ResultStatus;
17962
+ } });
17963
+ function isSamsungWasmSupported2() {
17964
+ var _a;
17965
+ return typeof window.WebAssembly !== "undefined" && typeof ((_a = window.tizentvwasm) === null || _a === void 0 ? void 0 : _a.ElementaryMediaStreamSource) !== "undefined";
17966
+ }
17967
+ function createSamsungWasmDecoder2(options) {
17968
+ if (!isSamsungWasmSupported2()) {
17969
+ throw new Error("Samsung WASM decoder is not supported in this environment.");
17970
+ }
17971
+ return new wasmDecoder_1.SamsungWasmDecoder(options.videoElementId);
17972
+ }
17973
+ }
17974
+ });
17975
+
17595
17976
  // node_modules/querystring/decode.js
17596
17977
  var require_decode = __commonJS({
17597
17978
  "node_modules/querystring/decode.js"(exports, module) {
@@ -18080,6 +18461,17 @@
18080
18461
  }
18081
18462
  }
18082
18463
 
18464
+ // screen/samsungwasmdecoder.ts
18465
+ var import_samsung_wasm_decoder = __toESM(require_dist2());
18466
+ async function initSamsungWasmDecoder() {
18467
+ if ((0, import_samsung_wasm_decoder.isSamsungWasmSupported)()) {
18468
+ window.samsungWasmDecoder = (0, import_samsung_wasm_decoder.createSamsungWasmDecoder)({
18469
+ videoElementId: "samsung-wasm-video"
18470
+ });
18471
+ await window.samsungWasmDecoder.initialize({});
18472
+ }
18473
+ }
18474
+
18083
18475
  // screen/shared.ts
18084
18476
  var import_querystring = __toESM(require_querystring());
18085
18477
  function parseQueryOptions() {
@@ -18123,10 +18515,11 @@
18123
18515
  }
18124
18516
 
18125
18517
  // screen/plain.ts
18126
- var SCREEN_JS_URL = "supra-client-screen.js?v=0.0.0-jvmaster.366-jvmaster.375";
18518
+ var SCREEN_JS_URL = "supra-client-screen.js?v=0.0.0-jvmaster.366-jvdevelop.396";
18127
18519
  async function startPlainScreen(options) {
18128
18520
  options = options != null ? options : parseQueryOptions();
18129
18521
  initNaCLDecoder();
18522
+ await initSamsungWasmDecoder();
18130
18523
  const fs = await initBrowserFS();
18131
18524
  window.fs = fs;
18132
18525
  process.argv = ["go", ...getGoArgv(SCREEN_JS_URL, options)];
@@ -18148,9 +18541,10 @@
18148
18541
  }
18149
18542
 
18150
18543
  // screen/wasm.ts
18151
- var SCREEN_WASM_URL = "supra-client-screen.wasm?v=0.0.0-jvmaster.366-jvmaster.375";
18544
+ var SCREEN_WASM_URL = "supra-client-screen.wasm?v=0.0.0-jvmaster.366-jvdevelop.396";
18152
18545
  async function startWasmScreen(options) {
18153
18546
  options = options != null ? options : parseQueryOptions();
18547
+ await initSamsungWasmDecoder();
18154
18548
  await initH264Decoder();
18155
18549
  await initGoEnvironment();
18156
18550
  await startGoScreen(options);