@supraio/client-daemon-js 0.0.0-mzstream.318 → 0.0.0-mztizen7.391

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