video_ack_required

This commit is contained in:
rustdesk 2022-02-05 01:55:23 +08:00
parent 9ff3bd74c9
commit b348b3fdc8
65 changed files with 1307 additions and 58 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re
import os import os
import glob import glob
from tabnanny import check from tabnanny import check
@ -30,6 +31,7 @@ def main():
check_if_retry[1] = False check_if_retry[1] = False
continue continue
if check_if_retry[1]: if check_if_retry[1]:
ln = removeComment(ln)
check_if_retry[0] += ln + '\n' check_if_retry[0] += ln + '\n'
if 'KEY_MAP' in ln: if 'KEY_MAP' in ln:
KEY_MAP[1] = True KEY_MAP[1] = True
@ -38,6 +40,7 @@ def main():
KEY_MAP[1] = False KEY_MAP[1] = False
continue continue
if KEY_MAP[1] and ln.startswith('('): if KEY_MAP[1] and ln.startswith('('):
ln = removeComment(ln)
toks = ln.split('", Key::') toks = ln.split('", Key::')
assert(len(toks) == 2) assert(len(toks) == 2)
a = toks[0][2:] a = toks[0][2:]
@ -56,5 +59,7 @@ def main():
print('export const ' + ln) print('export const ' + ln)
def removeComment(ln):
return re.sub('\s+\/\/.*$', '', ln)
main() main()

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" /> <link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="node_modules/ogv/dist/ogv.js"></script> <script src="ogvjs-1.8.6/ogv.js"></script>
<script src="./yuv-canvas-1.2.6.js"></script> <script src="./yuv-canvas-1.2.6.js"></script>
<title>Vite App</title> <title>Vite App</title>
</head> </head>

21
ogvjs-1.8.6/COPYING Normal file
View File

@ -0,0 +1,21 @@
ogv.js wrapper and player code
Copyright (c) 2013-2019 Brion Vibber and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,23 @@
Copyright © 2018-2019, VideoLAN and dav1d authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,28 @@
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,44 @@
Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
Jean-Marc Valin, Timothy B. Terriberry,
CSIRO, Gregory Maxwell, Mark Borgerding,
Erik de Castro Lopo
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Opus is subject to the royalty-free patent licenses which are
specified at:
Xiph.Org Foundation:
https://datatracker.ietf.org/ipr/1524/
Microsoft Corporation:
https://datatracker.ietf.org/ipr/1914/
Broadcom Corporation:
https://datatracker.ietf.org/ipr/1526/

View File

@ -0,0 +1,28 @@
Copyright (C) 2002-2009 Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,28 @@
Copyright (c) 2002-2018 Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,13 @@
Copyright © 2010 Mozilla Foundation
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -0,0 +1,31 @@
Copyright (c) 2010, The WebM Project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Google, nor the WebM Project, nor the names
of its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,23 @@
Additional IP Rights Grant (Patents)
------------------------------------
"These implementations" means the copyrightable works that implement the WebM
codecs distributed by Google as part of the WebM Project.
Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and otherwise
run, modify and propagate the contents of these implementations of WebM, where
such license applies only to those patent claims, both currently owned by
Google and acquired in the future, licensable by Google that are necessarily
infringed by these implementations of WebM. This grant does not include claims
that would be infringed only as a consequence of further modification of these
implementations. If you or your agent or exclusive licensee institute or order
or agree to the institution of patent litigation or any other patent
enforcement activity against any entity (including a cross-claim or
counterclaim in a lawsuit) alleging that any of these implementations of WebM
or any code incorporated within any of these implementations of WebM
constitute direct or contributory patent infringement, or inducement of
patent infringement, then any patent rights granted to you under this License
for these implementations of WebM shall terminate as of the date such
litigation is filed.

391
ogvjs-1.8.6/README.md Normal file
View File

@ -0,0 +1,391 @@
ogv.js
======
Media decoder and player for Ogg Vorbis/Opus/Theora and WebM VP8/VP9/AV1 video.
Based around libogg, libvorbis, libtheora, libopus, libvpx, libnestegg and dav1d compiled to JavaScript and WebAssembly with Emscripten.
## Updates
1.8.6 - 2022-01-12
* Bump to yuv-canvas
* Fix demo for removal of video-canvas mode
1.8.5 - 2022-01-11
* Remove unnecessary user-agent checks
* Remove flaky, obsolete support for faking CSS `object-fit`
* Remove experimental support for streaming `<canvas>` into `<video>`
1.8.4 - 2021-07-02
* Fix for fix for OGVLoader.base fix
1.8.3 - 2021-07-02
* Fixes for build with emscripten 2.0.25
* Fix for nextTick/setImmediate-style polyfill in front-end
* Provisional fix for OGVLoader.base not working with CDNs
* the fallback code for loading a non-local worker had been broken with WebAssembly for some time, sorry!
1.8.2 - errored out
1.8.1 - 2021-02-18
* Fixed OGVCompat APIs to correctly return false without WebAssembly and Web Audio
1.8.0 - 2021-02-09
* Dropping IE support and Flash audio backend
* Updated to stream-file 0.3.0
* Updated to audio-feeder 0.5.0
* The old IE 10/11 support _no longer works_ due to the Flash plugin being disabled, and so is being removed
* Drop es6-promise shim
* Now requires WebAssembly, which requires native Promise support
* Build & fixes
* Demo fixed (removed test files that are now offline)
* Builds with emscripten 2.0.13
* Requires latest meson from git pending a fix hitting release
1.7.0 - 2020-09-28
* Builds with emscripten's LLVM upstream backend
* Updated to build with emscripten 2.0.4
* Reduced amount of memory used between GC runs by reusing frame buffers
* Removed `memoryLimit` option
* JS, Wasm, and threaded Wasm builds now all use dynamic memory growth
* Updated dav1d
* Updated libvpx to 1.8.1
* Experimental SIMD builds of AV1 decoder optional, with `make SIMD=1`
* These work in Chrome with the "WebAssembly SIMD" flag enabled in chrome://flags/
* Significant speed boost when available.
* Available with and without multithreading.
* Must enable explicitly with `simd: true` in `options`.
* Experimental SIMD work for VP9 as well, incomplete.
1.6.1 - 2019-06-18
* playbackSpeed attribute now supported
* updated audio-feeder to 0.4.21;
* mono audio is now less loud, matching native playback better
* audio resampling now uses linear interpolation for upscaling
* fix for IE in bundling scenarios that use strict mode
* tempo change support thanks to a great patch from velochy!
* updated yuv-canvas to 1.2.6;
* fixes for capturing WebGL canvas as MediaStream
* fixes for seeks on low frame rate video
* updated emscripten toolchain to 1.38.36
* drop OUTLINING_LIMIT from AV1 JS build; doesn't work in newer emscripten and not really needed
1.6.0 - 2019-02-26
* experimental support for AV1 video in WebM
* update buildchain to emscripten 1.38.28
* fix a stray global
* starting to move to ES6 classes and modules
* building with babel for ES5/IE11 compat
* updated eslint
* updated yuv-canvas to 1.2.4; fixes for software GL rendering
* updated audio-feeder to 0.4.15; fixes for resampling and Flash perf
* retooled buffer copies
* sync fix for audio packets with discard padding
* clients can pass a custom `StreamFile` instance as `{stream:foo}` in options. This can be useful for custom streaming until MSE interfaces are ready.
* refactored WebM keyframe detection
* prefill the frame pipeline as well as the audio pipeline before starting audio
* removed BINARYEN_IGNORE_IMPLICIT_TRAPS=1 option which can cause intermittent breakages
* changed download streaming method to avoid data corruption problem on certain files
* fix for seek on very short WebM files
* fix for replay-after-end-of-playback in WebM
See more details and history in [CHANGES.md](https://github.com/brion/ogv.js/blob/master/CHANGES.md)
## Current status
Note that as of 2021 ogv.js works pretty nicely but may still have some packagine oddities with tools like webpack. It should work via CDNs again as of 1.8.2 if you can't or don't want to package locally, but this is not documented well yet. Improved documentation will come with the next major update & code cleanup!
Since August 2015, ogv.js can be seen in action [on Wikipedia and Wikimedia Commons](https://commons.wikimedia.org/wiki/Commons:Video) in Safari and IE/Edge where native Ogg and WebM playback is not available. (See [technical details on MediaWiki integration](https://www.mediawiki.org/wiki/Extension:TimedMediaHandler/ogv.js).)
See also a standalone demo with performance metrics at https://brionv.com/misc/ogv.js/demo/
* streaming: yes (with Range header)
* seeking: yes for Ogg and WebM (with Range header)
* color: yes
* audio: yes, with a/v sync (requires Web Audio or Flash)
* background threading: yes (video, audio decoders in Workers)
* [GPU accelerated drawing: yes (WebGL)](https://github.com/brion/ogv.js/wiki/GPU-acceleration)
* GPU accelerated decoding: no
* SIMD acceleration: no
* Web Assembly: yes (with asm.js fallback)
* multithreaded VP8, VP9, AV1: in development (set `options.threading` to `true`; requires flags to be enabled in Firefox 65 and Chrome 72, no support yet in Safari)
* controls: no (currently provided by demo or other UI harness)
Ogg and WebM files are fairly well supported.
## Goals
Long-form goal is to create a drop-in replacement for the HTML5 video and audio tags which can be used for basic playback of Ogg Theora and Vorbis or WebM media on browsers that don't support Ogg or WebM natively.
The API isn't quite complete, but works pretty well.
## Compatibility
ogv.js requires a fast JS engine with typed arrays, and Web Audio for audio playback.
The primary target browsers are (testing 360p/30fps and up):
* Safari 6.1-12 on Mac OS X 10.7-10.14
* Safari on iOS 10-11 64-bit
Older versions of Safari have flaky JIT compilers. IE 9 and below lack typed arrays, and IE 10/11 no longer support an audio channel since the Flash plugin was sunset.
(Note that Windows and Mac OS X can support Ogg and WebM by installing codecs or alternate browsers with built-in support, but this is not possible on iOS where all browsers are really Safari.)
Testing browsers (these support .ogv and .webm natively):
* Firefox 65
* Chrome 73
## Package installation
Pre-built releases of ogv.js are available as [.zip downloads from the GitHub releases page](https://github.com/brion/ogv.js/releases) and through the npm package manager.
You can load the `ogv.js` main entry point directly in a script tag, or bundle it through whatever build process you like. The other .js files must be made available for runtime loading, together in the same directory.
ogv.js will try to auto-detect the path to its resources based on the script element that loads ogv.js or ogv-support.js. If you load ogv.js through another bundler (such as browserify or MediaWiki's ResourceLoader) you may need to override this manually before instantiating players:
```
// Path to ogv-demuxer-ogg.js, ogv-worker-audio.js, etc
OGVLoader.base = '/path/to/resources';
```
To fetch from npm:
```
npm install ogv
```
The distribution-ready files will appear in 'node_modules/ogv/dist'.
To load the player library into your browserify or webpack project:
```
var ogv = require('ogv');
// Access public classes either as ogv.OGVPlayer or just OGVPlayer.
// Your build/lint tools may be happier with ogv.OGVPlayer!
ogv.OGVLoader.base = '/path/to/resources';
var player = new ogv.OGVPlayer();
```
## Usage
The `OGVPlayer` class implements a player, and supports a subset of the events, properties and methods from [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) and [HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).
```
// Create a new player with the constructor
var player = new OGVPlayer();
// Or with options
var player = new OGVPlayer({
debug: true,
debugFilter: /demuxer/
});
// Now treat it just like a video or audio element
containerElement.appendChild(player);
player.src = 'path/to/media.ogv';
player.play();
player.addEventListener('ended', function() {
// ta-da!
});
```
To check for compatibility before creating a player, include `ogv-support.js` and use the `OGVCompat` API:
```
if (OGVCompat.supported('OGVPlayer')) {
// go load the full player from ogv.js and instantiate stuff
}
```
This will check for typed arrays, web audio, blacklisted iOS versions, and super-slow/broken JIT compilers.
If you need a URL versioning/cache-buster parameter for dynamic loading of `ogv.js`, you can use the `OGVVersion` symbol provided by `ogv-support.js` or the even tinier `ogv-version.js`:
```
var script = document.createElement('script');
script.src = 'ogv.js?version=' + encodeURIComponent(OGVVersion);
document.querySelector('head').appendChild(script);
```
## Distribution notes
Entry points:
* `ogv.js` contains the main runtime classes, including OGVPlayer, OGVLoader, and OGVCompat.
* `ogv-support.js` contains the OGVCompat class and OGVVersion symbol, useful for checking for runtime support before loading the main `ogv.js`.
* `ogv-version.js` contains only the OGVVersion symbol.
These entry points may be loaded directly from a script element, or concatenated into a larger project, or otherwise loaded as you like.
Further code modules are loaded at runtime, which must be available with their defined names together in a directory. If the files are not hosted same-origin to the web page that includes them, you will need to set up appropriate CORS headers to allow loading of the worker JS modules.
Dynamically loaded assets:
* `ogv-worker-audio.js`, `ogv-worker-video.js`, and `*.worker.js` are Worker entry points, used to run video and audio decoders in the background.
* `ogv-demuxer-ogg-wasm.js/.wasm` are used in playing .ogg, .oga, and .ogv files.
* `ogv-demuxer-webm-wasm.js/.wasm` are used in playing .webm files.
* `ogv-decoder-audio-vorbis-wasm.js/.wasm` and `ogv-decoder-audio-opus-wasm.js/.wasm` are used in playing both Ogg and WebM files containing audio.
* `ogv-decoder-video-theora-wasm.js/.wasm` are used in playing .ogg and .ogv video files.
* `ogv-decoder-video-vp8-wasm.js/.wasm` and `ogv-decoder-video-vp9-wasm.js/.wasm` are used in playing .webm video files.
* `*-mt.js/.wasm` are the multithreaded versions of some of the above modules. They have additional support files.
If you know you will never use particular formats or codecs you can skip bundling them; for instance if you only need to play Ogg files you don't need `ogv-demuxer-webm-wasm.js` or `ogv-decoder-video-vp8-wasm.js` which are only used for WebM.
## Performance
(This section is somewhat out of date.)
As of 2015, for SD-or-less resolution basic Ogg Theora decoding speed is reliable on desktop and newer high-end mobile devices; current high-end desktops and laptops can even reach HD resolutions. Older and low-end mobile devices may have difficulty on any but audio and the lowest-resolution video files.
WebM VP8/VP9 is slower, but works pretty well at a resolution step below Theora.
AV1 is slower still, and tops out around 360p for single-threaded decoding on a fast desktop or iOS device.
*Low-res targets*
I've gotten acceptable performance for Vorbis audio and 160p/15fps Theora files on 32-bit iOS devices: iPhone 4s, iPod Touch 5th-gen and iPad 3. These have difficulty at 240p and above, and just won't keep up with higher resolutions.
Meanwhile, newer 64-bit iPhones and iPads are comparable to low-end laptops, and videos at 360p and often 480p play acceptably. Since 32-bit and 64-bit iOS devices have the same user-agent, a benchmark must be used to approximately test minimum CPU speed.
(On iOS, Safari performs significantly better than some alternative browsers that are unable to enable the JIT due to use of the old UIWebView API. Chrome 49 and Firefox for iOS are known to work using the newer WKWebView API internally. Again, a benchmark must be used to detect slow performance, as the browser remains otherwise compatible.)
Windows on 32-bit ARM platforms is similar... IE 11 on Windows RT 8.1 on a Surface tablet (NVidia Tegra 3) does not work (crashes IE), while Edge on Windows 10 Mobile works ok at low resolutions, having trouble starting around 240p.
In both cases, a native application looms as a possibly better alternative. See [OGVKit](https://github.com/brion/OGVKit) and [OgvRt](https://github.com/brion/OgvRT) projects for experiments in those directions.
Note that at these lower resolutions, Vorbis audio and Theora video decoding are about equally expensive operations -- dual-core phones and tablets should be able to eke out a little parallelism here thanks to audio and video being in separate Worker threads.
*WebGL drawing acceleration*
Accelerated YCbCr->RGB conversion and drawing is done using WebGL on supporting browsers, or through software CPU conversion if not. This is abstracted in the [yuv-canvas](https://github.com/brion/yuv-canvas) package, now separately installable.
It may be possible to do further acceleration of actual decoding operations using WebGL shaders, but this could be ... tricky. WebGL is also only available on the main thread, and there are no compute shaders yet so would have to use fragment shaders.
## Difficulties
*Threading*
Currently the video and audio codecs run in worker threads by default, while the demuxer and player logic run on the UI thread. This seems to work pretty well.
There is some overhead in extracting data out of each emscripten module's heap and in the thread-to-thread communications, but the parallelism and smoother main thread makes up for it.
*Streaming download*
Streaming buffering is done by chunking the requests at up to a megabyte each, using the HTTP Range header. For cross-site playback, this requires CORS setup to whitelist the Range header! Chunks are downloaded as ArrayBuffers, so a chunk must be loaded in full before demuxing or playback can start.
Old versions of [Safari have a bug with Range headers](https://bugs.webkit.org/show_bug.cgi?id=82672) which is worked around as necessary with a 'cache-busting' URL string parameter.
*Seeking*
Seeking is implemented via the HTTP Range: header.
For Ogg files with keyframe indices in a skeleton index, seeking is very fast. Otherwise, a bisection search is used to locate the target frame or audio position, which is very slow over the internet as it creates a lot of short-lived HTTP requests.
For WebM files with cues, efficient seeking is supported as well as of 1.1.2. WebM files without cues can be seeked in 1.5.5, but inefficiently via linear seek from the beginning. This is fine for small audio-only files, but might be improved for large files with a bisection in future.
As with chunked streaming, cross-site playback requires CORS support for the Range header.
*Audio output*
Audio output is handled through the [AudioFeeder](https://github.com/brion/audio-feeder) library, which encapsulates use of Web Audio API:
Firefox, Safari, Chrome, and Edge support the W3C Web Audio API.
IE is no longer supported; the workaround using Flash no longer works due to sunsetting of the Flash plugin.
A/V synchronization is performed on files with both audio and video, and seems to actually work. Yay!
Note that autoplay with audio doesn't work on iOS Safari due to limitations with starting audio playback from event handlers; if playback is started outside an event handler, the player will hang due to broken audio.
As of 1.1.1, muting before script-triggered playback allows things to work:
```
player = new OGVPlayer();
player.muted = true;
player.src = 'path/to/file-with-audio.ogv';
player.play();
```
You can then unmute the video in response to a touch or click handler. Alternately if audio is not required, do not include an audio track in the file.
*WebM*
WebM support was added in June 2015, with some major issues finally worked out in May 2016. Initial VP9 support was added in February 2017. It's pretty stable in production use at Wikipedia and is enabled by default as of October 2015.
Beware that performance of WebM VP8 is much slower than Ogg Theora, and VP9 is slightly slower still.
For best WebM decode speed, consider encoding VP8 with "profile 1" (simple deblocking filter) which will sacrifice quality modestly, mainly in high-motion scenes. When encoding with ffmpeg, this is the `-profile:v 1` option to the `libvpx` codec.
It is also recommended to use the `-slices` option for VP8, or `-tile-columns` for VP9, to maximize ability to use multithreaded decoding when available in the future.
*AV1*
WebM files containing the AV1 codec are supported as of 1.6.0 (February 2019) using the [dav1d](https://code.videolan.org/videolan/dav1d) decoder.
Currently this is experimental, and does not advertise support via `canPlayType`.
Performance is about 2-3x slower than VP8 or VP9, and may require bumping down a resolution step or two to maintain frame rate. There may be further optimizations that can be done to improve this a bit, but the best improvements will come from future improvements to WebAssembly multithreading and SIMD.
Currently AV1 in MP4 container is not supported.
## Upstream library notes
We've experimented with tremor (libivorbis), an integer-only variant of libvorbis. This actually does *not* decode faster, but does save about 200kb off our generated JavaScript, presumably thanks to not including an encoder in the library. However on slow devices like iPod Touch 5th-generation, it makes a significant negative impact on the decode time so we've gone back to libvorbis.
The Ogg Skeleton library (libskeleton) is a bit ... unfinished and is slightly modified here.
libvpx is slightly modified to work around emscripten threading limitations in the VP8 decoder.
## WebAssembly
WebAssembly (Wasm) builds are used exclusively as of 1.8.0, as Safari's Wasm support is pretty well established now and IE no longer works due to the Flash plugin deprecation.
## Multithreading
Experimental multithreaded VP8, VP9, and AV1 decoding up to 4 cores is in development, requiring emscripten 1.38.27 to build.
Multithreading is used only if `options.threading` is true. This requires browser support for the new `SharedArrayBuffer` and `Atomics` APIs, currently available in Firefox and Chrome with experimental flags enabled.
Threading currently requires WebAssembly; JavaScript builds are possible but perform poorly.
Speedups will only be noticeable when using the "slices" or "token partitions" option for VP8 encoding, or the "tile columns" option for VP9 encoding.
If you are making a slim build and will not use the `threading` option, you can leave out the `*-mt.*` files.
## Building JS components
Building ogv.js is known to work on Mac OS X and Linux (tested Fedora 29 and Ubuntu 18.10 with Meson manually updated).
1. You will need autoconf, automake, libtool, pkg-config, meson, ninja, and node (nodejs). These can be installed through Homebrew on Mac OS X, or through distribution-specific methods on Linux. For meson, you may need a newer version than your distro packages -- install it manually with `pip3` or from source.
2. Install [Emscripten](http://kripken.github.io/emscripten-site/docs/getting_started/Tutorial.html); currently building with 2.0.13.
3. `git submodule update --init`
4. Run `npm install` to install build utilities
5. Run `make js` to configure and build the libraries and the C wrapper
## Building the demo
If you did all the setup above, just run `make demo` or `make`. Look in build/demo/ and enjoy!
## License
libogg, libvorbis, libtheora, libopus, nestegg, libvpx, and dav1d are available under their respective licenses, and the JavaScript and C wrapper code in this repo is licensed under MIT.
Based on build scripts from https://github.com/devongovett/ogg.js
See [AUTHORS.md](https://github.com/brion/ogv.js/blob/master/AUTHORS.md) and/or the git history for a list of contributors.

View File

@ -0,0 +1,39 @@
var OGVDecoderAudioOpusW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderAudioOpusW) {
OGVDecoderAudioOpusW = OGVDecoderAudioOpusW || {};
var a;a||(a=typeof OGVDecoderAudioOpusW !== 'undefined' ? OGVDecoderAudioOpusW : {});var g=Object.assign,h,m;a.ready=new Promise(function(b,c){h=b;m=c});var n=a,p=g({},a),q="object"===typeof window,r="function"===typeof importScripts,t="",u,v,w,fs,x,y;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=r?require("path").dirname(t)+"/":__dirname+"/",y=function(){x||(fs=require("fs"),x=require("path"))},u=function(b,c){y();b=x.normalize(b);return fs.readFileSync(b,c?null:"utf8")},w=function(b){b=u(b,!0);b.buffer||(b=new Uint8Array(b));return b},v=function(b,c,e){y();b=x.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(q||r)r?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="",u=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(w=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),v=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var z=a.printErr||console.warn.bind(console);g(a,p);p=null;var A;a.wasmBinary&&(A=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&B("no native wasm support detected");
var C,D=!1,E,F;function G(){var b=C.buffer;E=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=F=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var H,I=[],J=[],K=[];function aa(){var b=a.preRun.shift();I.unshift(b)}var L=0,M=null,N=null;a.preloadedImages={};a.preloadedAudios={};
function B(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";z(b);D=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");m(b);throw b;}function O(){return P.startsWith("data:application/octet-stream;base64,")}var P;P="ogv-decoder-audio-opus-wasm.wasm";if(!O()){var Q=P;P=a.locateFile?a.locateFile(Q,t):t+Q}function R(){var b=P;try{if(b==P&&A)return new Uint8Array(A);if(w)return w(b);throw"both async and sync fetching of the wasm failed";}catch(c){B(c)}}
function ba(){if(!A&&(q||r)){if("function"===typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+P+"'";return b.arrayBuffer()}).catch(function(){return R()});if(v)return new Promise(function(b,c){v(P,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return R()})}
function S(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.s;"number"===typeof e?void 0===c.o?ca(e)():ca(e)(c.o):e(void 0===c.o?null:c.o)}}}var T=[];function ca(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=H.get(b));return c}
var da={a:function(b,c,e){F.copyWithin(b,c,c+e)},b:function(b){var c=F.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{C.grow(Math.min(2147483648,d)-E.byteLength+65535>>>16);G();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(b,c,e){var d=C.buffer,f=new Uint32Array(d,b,c),k=[];if(0!==b)for(b=0;b<c;b++){var l=f[b];d.slice?(l=d.slice(l,l+4*e),l=new Float32Array(l)):(l=
new Float32Array(d,l,e),l=new Float32Array(l));k.push(l)}a.audioBuffer=k},d:function(b,c){a.audioFormat={channels:b,rate:c};a.loadedMetadata=!0}};
(function(){function b(f){a.asm=f.exports;C=a.asm.e;G();H=a.asm.m;J.unshift(a.asm.f);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==M&&(clearInterval(M),M=null),N&&(f=N,N=null,f()))}function c(f){b(f.instance)}function e(f){return ba().then(function(k){return WebAssembly.instantiate(k,d)}).then(function(k){return k}).then(f,function(k){z("failed to asynchronously prepare wasm: "+k);B(k)})}var d={a:da};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return z("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return A||"function"!==typeof WebAssembly.instantiateStreaming||O()||P.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(k){z("wasm streaming compile failed: "+k);z("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(m);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};a._ogv_audio_decoder_init=function(){return(a._ogv_audio_decoder_init=a.asm.g).apply(null,arguments)};a._ogv_audio_decoder_process_header=function(){return(a._ogv_audio_decoder_process_header=a.asm.h).apply(null,arguments)};a._ogv_audio_decoder_process_audio=function(){return(a._ogv_audio_decoder_process_audio=a.asm.i).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.j).apply(null,arguments)};
a._free=function(){return(a._free=a.asm.k).apply(null,arguments)};a._ogv_audio_decoder_destroy=function(){return(a._ogv_audio_decoder_destroy=a.asm.l).apply(null,arguments)};var U;N=function ea(){U||V();U||(N=ea)};
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!D)){S(J);h(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();K.unshift(c)}S(K)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();S(I);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X;function fa(b){if(W&&X>=b)return W;W&&a._free(W);X=b;return W=a._malloc(X)}var Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!n.audioFormat;a.audioFormat=n.audioFormat||null;a.audioBuffer=null;a.cpuTime=0;
Object.defineProperty(a,"processing",{get:function(){return!1}});a.init=function(b){Z(function(){a._ogv_audio_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength,f=fa(d);(new Uint8Array(C.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_header(f,d)});c(e)};a.processAudio=function(b,c){var e=Z(function(){var d=b.byteLength,f=fa(d);(new Uint8Array(C.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_audio(f,d)});c(e)};
a.close=function(){};
return OGVDecoderAudioOpusW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderAudioOpusW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderAudioOpusW; });
else if (typeof exports === 'object')
exports["OGVDecoderAudioOpusW"] = OGVDecoderAudioOpusW;

Binary file not shown.

View File

@ -0,0 +1,40 @@
var OGVDecoderAudioVorbisW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderAudioVorbisW) {
OGVDecoderAudioVorbisW = OGVDecoderAudioVorbisW || {};
var b;b||(b=typeof OGVDecoderAudioVorbisW !== 'undefined' ? OGVDecoderAudioVorbisW : {});var g=Object.assign,h,m;b.ready=new Promise(function(a,c){h=a;m=c});var n=b,p=g({},b),q=(a,c)=>{throw c;},r="object"===typeof window,t="function"===typeof importScripts,u="",v,w,x,fs,y,z;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)u=t?require("path").dirname(u)+"/":__dirname+"/",z=function(){y||(fs=require("fs"),y=require("path"))},v=function(a,c){z();a=y.normalize(a);return fs.readFileSync(a,c?null:"utf8")},x=function(a){a=v(a,!0);a.buffer||(a=new Uint8Array(a));return a},w=function(a,c,e){z();a=y.normalize(a);fs.readFile(a,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(a){throw a;}),q=(a,c)=>{if(noExitRuntime||0<A)throw process.exitCode=a,c;c instanceof B||C("exiting due to exception: "+c);process.exit(a)},b.inspect=function(){return"[Emscripten Module object]"};else if(r||t)t?u=self.location.href:"undefined"!==typeof document&&document.currentScript&&(u=document.currentScript.src),_scriptDir&&(u=_scriptDir),0!==u.indexOf("blob:")?u=u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):u="",v=function(a){var c=new XMLHttpRequest;
c.open("GET",a,!1);c.send(null);return c.responseText},t&&(x=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(a,c,e){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};b.print||console.log.bind(console);var C=b.printErr||console.warn.bind(console);g(b,p);p=null;b.quit&&(q=b.quit);
var D;b.wasmBinary&&(D=b.wasmBinary);var noExitRuntime=b.noExitRuntime||!0;"object"!==typeof WebAssembly&&E("no native wasm support detected");var F,G=!1,H,I;function J(){var a=F.buffer;H=a;b.HEAP8=new Int8Array(a);b.HEAP16=new Int16Array(a);b.HEAP32=new Int32Array(a);b.HEAPU8=I=new Uint8Array(a);b.HEAPU16=new Uint16Array(a);b.HEAPU32=new Uint32Array(a);b.HEAPF32=new Float32Array(a);b.HEAPF64=new Float64Array(a)}var K,L=[],M=[],N=[],A=0;function aa(){var a=b.preRun.shift();L.unshift(a)}
var O=0,P=null,Q=null;b.preloadedImages={};b.preloadedAudios={};function E(a){if(b.onAbort)b.onAbort(a);a="Aborted("+a+")";C(a);G=!0;a=new WebAssembly.RuntimeError(a+". Build with -s ASSERTIONS=1 for more info.");m(a);throw a;}function ba(){return R.startsWith("data:application/octet-stream;base64,")}var R;R="ogv-decoder-audio-vorbis-wasm.wasm";if(!ba()){var ca=R;R=b.locateFile?b.locateFile(ca,u):u+ca}
function da(){var a=R;try{if(a==R&&D)return new Uint8Array(D);if(x)return x(a);throw"both async and sync fetching of the wasm failed";}catch(c){E(c)}}
function ea(){if(!D&&(r||t)){if("function"===typeof fetch&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+R+"'";return a.arrayBuffer()}).catch(function(){return da()});if(w)return new Promise(function(a,c){w(R,function(e){a(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return da()})}
function S(a){for(;0<a.length;){var c=a.shift();if("function"==typeof c)c(b);else{var e=c.s;"number"===typeof e?void 0===c.o?fa(e)():fa(e)(c.o):e(void 0===c.o?null:c.o)}}}var T=[];function fa(a){var c=T[a];c||(a>=T.length&&(T.length=a+1),T[a]=c=K.get(a));return c}
var ha={a:function(a,c,e){I.copyWithin(a,c,c+e)},b:function(a){var c=I.length;a>>>=0;if(2147483648<a)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{F.grow(Math.min(2147483648,d)-H.byteLength+65535>>>16);J();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(a){if(!(noExitRuntime||0<A)){if(b.onExit)b.onExit(a);G=!0}q(a,new B(a))},d:function(a,c,e){var d=F.buffer,f=new Uint32Array(d,a,c),k=[];if(0!==
a)for(a=0;a<c;a++){var l=f[a];d.slice?(l=d.slice(l,l+4*e),l=new Float32Array(l)):(l=new Float32Array(d,l,e),l=new Float32Array(l));k.push(l)}b.audioBuffer=k},e:function(a,c){b.audioFormat={channels:a,rate:c};b.loadedMetadata=!0}};
(function(){function a(f){b.asm=f.exports;F=b.asm.f;J();K=b.asm.n;M.unshift(b.asm.g);O--;b.monitorRunDependencies&&b.monitorRunDependencies(O);0==O&&(null!==P&&(clearInterval(P),P=null),Q&&(f=Q,Q=null,f()))}function c(f){a(f.instance)}function e(f){return ea().then(function(k){return WebAssembly.instantiate(k,d)}).then(function(k){return k}).then(f,function(k){C("failed to asynchronously prepare wasm: "+k);E(k)})}var d={a:ha};O++;b.monitorRunDependencies&&b.monitorRunDependencies(O);if(b.instantiateWasm)try{return b.instantiateWasm(d,
a)}catch(f){return C("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return D||"function"!==typeof WebAssembly.instantiateStreaming||ba()||R.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(R,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(k){C("wasm streaming compile failed: "+k);C("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(m);return{}})();
b.___wasm_call_ctors=function(){return(b.___wasm_call_ctors=b.asm.g).apply(null,arguments)};b._ogv_audio_decoder_init=function(){return(b._ogv_audio_decoder_init=b.asm.h).apply(null,arguments)};b._ogv_audio_decoder_process_header=function(){return(b._ogv_audio_decoder_process_header=b.asm.i).apply(null,arguments)};b._ogv_audio_decoder_process_audio=function(){return(b._ogv_audio_decoder_process_audio=b.asm.j).apply(null,arguments)};
b._ogv_audio_decoder_destroy=function(){return(b._ogv_audio_decoder_destroy=b.asm.k).apply(null,arguments)};b._malloc=function(){return(b._malloc=b.asm.l).apply(null,arguments)};b._free=function(){return(b._free=b.asm.m).apply(null,arguments)};var U;function B(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Q=function ia(){U||V();U||(Q=ia)};
function V(){function a(){if(!U&&(U=!0,b.calledRun=!0,!G)){S(M);h(b);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for("function"==typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;){var c=b.postRun.shift();N.unshift(c)}S(N)}}if(!(0<O)){if(b.preRun)for("function"==typeof b.preRun&&(b.preRun=[b.preRun]);b.preRun.length;)aa();S(L);0<O||(b.setStatus?(b.setStatus("Running..."),setTimeout(function(){setTimeout(function(){b.setStatus("")},1);a()},1)):a())}}b.run=V;
if(b.preInit)for("function"==typeof b.preInit&&(b.preInit=[b.preInit]);0<b.preInit.length;)b.preInit.pop()();V();var W,X;function ja(a){if(W&&X>=a)return W;W&&b._free(W);X=a;return W=b._malloc(X)}var Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(a){var c=Y();a=a();b.cpuTime+=Y()-c;return a}b.loadedMetadata=!!n.audioFormat;b.audioFormat=n.audioFormat||null;b.audioBuffer=null;b.cpuTime=0;
Object.defineProperty(b,"processing",{get:function(){return!1}});b.init=function(a){Z(function(){b._ogv_audio_decoder_init()});a()};b.processHeader=function(a,c){var e=Z(function(){var d=a.byteLength,f=ja(d);(new Uint8Array(F.buffer,f,d)).set(new Uint8Array(a));return b._ogv_audio_decoder_process_header(f,d)});c(e)};b.processAudio=function(a,c){var e=Z(function(){var d=a.byteLength,f=ja(d);(new Uint8Array(F.buffer,f,d)).set(new Uint8Array(a));return b._ogv_audio_decoder_process_audio(f,d)});c(e)};
b.close=function(){};
return OGVDecoderAudioVorbisW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderAudioVorbisW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderAudioVorbisW; });
else if (typeof exports === 'object')
exports["OGVDecoderAudioVorbisW"] = OGVDecoderAudioVorbisW;

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoAV1MTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoAV1SIMDMTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

View File

@ -0,0 +1,43 @@
var OGVDecoderVideoAV1SIMDW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoAV1SIMDW) {
OGVDecoderVideoAV1SIMDW = OGVDecoderVideoAV1SIMDW || {};
var a;a||(a=typeof OGVDecoderVideoAV1SIMDW !== 'undefined' ? OGVDecoderVideoAV1SIMDW : {});var aa=Object.assign,ba,q;a.ready=new Promise(function(b,c){ba=b;q=c});var ca=a,da=aa({},a),ea="object"===typeof window,r="function"===typeof importScripts,A="",fa,F,G,fs,I,ha;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)A=r?require("path").dirname(A)+"/":__dirname+"/",ha=function(){I||(fs=require("fs"),I=require("path"))},fa=function(b,c){ha();b=I.normalize(b);return fs.readFileSync(b,c?null:"utf8")},G=function(b){b=fa(b,!0);b.buffer||(b=new Uint8Array(b));return b},F=function(b,c,e){ha();b=I.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),
process.argv.slice(2),process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ea||r)r?A=self.location.href:"undefined"!==typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="",fa=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(G=function(b){var c=new XMLHttpRequest;
c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),F=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};var ia=a.print||console.log.bind(console),J=a.printErr||console.warn.bind(console);aa(a,da);da=null;var K;a.wasmBinary&&(K=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&M("no native wasm support detected");
var N,ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,la,O,P;function ma(){var b=N.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=P=new Int32Array(b);a.HEAPU8=O=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var na,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var Q=0,sa=null,R=null;a.preloadedImages={};a.preloadedAudios={};
function M(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";J(b);ja=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");q(b);throw b;}function ta(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-decoder-video-av1-simd-wasm.wasm";if(!ta()){var ua=S;S=a.locateFile?a.locateFile(ua,A):A+ua}function va(){var b=S;try{if(b==S&&K)return new Uint8Array(K);if(G)return G(b);throw"both async and sync fetching of the wasm failed";}catch(c){M(c)}}
function wa(){if(!K&&(ea||r)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return va()});if(F)return new Promise(function(b,c){F(S,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.B;"number"===typeof e?void 0===c.s?Ja(e)():Ja(e)(c.s):e(void 0===c.s?null:c.s)}}}var T=[];function Ja(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=na.get(b));return c}
var Ka=[null,[],[]],La={b:function(){M("")},d:function(b,c,e){O.copyWithin(b,c,c+e)},e:function(b){var c=O.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{N.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);ma();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},f:function(){return 0},c:function(){},a:function(b,c,e,d){for(var f=0,g=0;g<e;g++){var x=P[c>>2],u=P[c+4>>2];c+=8;for(var y=
0;y<u;y++){var n=O[x+y],w=Ka[b];if(0===n||10===n){n=1===b?ia:J;var l=w;for(var p=0,t=p+NaN,v=p;l[v]&&!(v>=t);)++v;if(16<v-p&&l.subarray&&ka)l=ka.decode(l.subarray(p,v));else{for(t="";p<v;){var h=l[p++];if(h&128){var B=l[p++]&63;if(192==(h&224))t+=String.fromCharCode((h&31)<<6|B);else{var U=l[p++]&63;h=224==(h&240)?(h&15)<<12|B<<6|U:(h&7)<<18|B<<12|U<<6|l[p++]&63;65536>h?t+=String.fromCharCode(h):(h-=65536,t+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else t+=String.fromCharCode(h)}l=t}n(l);w.length=
0}else w.push(n)}f+=u}P[d>>2]=f;return 0},g:function(b,c,e,d,f,g,x,u,y,n,w,l,p,t,v,h){function B(H,k,C,ya,za,Aa,Na,Oa,V){H.set(new Uint8Array(U,k,C*ya));var D,z;for(D=z=0;D<Aa;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;for(;D<Aa+Oa;D++,z+=C){for(k=0;k<za;k++)H[z+k]=V;for(k=za+Na;k<C;k++)H[z+k]=V}for(;D<ya;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;return H}var U=N.buffer,m=a.videoFormat,Ba=(p&-2)*y/x,Ca=(t&-2)*n/u,Da=w*y/x,Ea=l*n/u;w===m.cropWidth&&l===m.cropHeight&&(v=m.displayWidth,h=m.displayHeight);for(var Fa=
a.recycledFrames,E,Ga=u*c,Ha=n*d,Ia=n*g;0<Fa.length;){var L=Fa.shift();m=L.format;if(m.width===x&&m.height===u&&m.chromaWidth===y&&m.chromaHeight===n&&m.cropLeft===p&&m.cropTop===t&&m.cropWidth===w&&m.cropHeight===l&&m.displayWidth===v&&m.displayHeight===h&&L.y.bytes.length===Ga&&L.u.bytes.length===Ha&&L.v.bytes.length===Ia){E=L;break}}E||(E={format:{width:x,height:u,chromaWidth:y,chromaHeight:n,cropLeft:p,cropTop:t,cropWidth:w,cropHeight:l,displayWidth:v,displayHeight:h},y:{bytes:new Uint8Array(Ga),
stride:c},u:{bytes:new Uint8Array(Ha),stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});B(E.y.bytes,b,c,u,p,t,w,l,0);B(E.u.bytes,e,d,n,Ba,Ca,Da,Ea,128);B(E.v.bytes,f,g,n,Ba,Ca,Da,Ea,128);a.frameBuffer=E}};
(function(){function b(f){a.asm=f.exports;N=a.asm.h;ma();na=a.asm.p;pa.unshift(a.asm.i);Q--;a.monitorRunDependencies&&a.monitorRunDependencies(Q);0==Q&&(null!==sa&&(clearInterval(sa),sa=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);M(g)})}var d={a:La};Q++;a.monitorRunDependencies&&a.monitorRunDependencies(Q);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return K||"function"!==typeof WebAssembly.instantiateStreaming||ta()||S.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(q);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.i).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.k).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.l).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.n).apply(null,arguments)};a._free=function(){return(a._free=a.asm.o).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.q).apply(null,arguments)};var W;R=function Ma(){W||Pa();W||(R=Ma)};
function Pa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ja)){xa(pa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<Q)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<Q||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Pa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Pa();var X,Qa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Qa>=d||(X&&a._free(X),Qa=d,X=a._malloc(Qa));var f=X;(new Uint8Array(N.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.A=[];
a.processFrame=function(b,c){function e(u){a._free(g);c(u)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.A.push(e);var x=Z(function(){(new Uint8Array(N.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(x)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.A.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoAV1SIMDW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoAV1SIMDW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoAV1SIMDW; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoAV1SIMDW"] = OGVDecoderVideoAV1SIMDW;

Binary file not shown.

View File

@ -0,0 +1,43 @@
var OGVDecoderVideoAV1W = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoAV1W) {
OGVDecoderVideoAV1W = OGVDecoderVideoAV1W || {};
var a;a||(a=typeof OGVDecoderVideoAV1W !== 'undefined' ? OGVDecoderVideoAV1W : {});var aa=Object.assign,ba,q;a.ready=new Promise(function(b,c){ba=b;q=c});var ca=a,da=aa({},a),ea="object"===typeof window,r="function"===typeof importScripts,A="",fa,F,G,fs,I,ha;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)A=r?require("path").dirname(A)+"/":__dirname+"/",ha=function(){I||(fs=require("fs"),I=require("path"))},fa=function(b,c){ha();b=I.normalize(b);return fs.readFileSync(b,c?null:"utf8")},G=function(b){b=fa(b,!0);b.buffer||(b=new Uint8Array(b));return b},F=function(b,c,e){ha();b=I.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),
process.argv.slice(2),process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ea||r)r?A=self.location.href:"undefined"!==typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="",fa=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(G=function(b){var c=new XMLHttpRequest;
c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),F=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};var ia=a.print||console.log.bind(console),J=a.printErr||console.warn.bind(console);aa(a,da);da=null;var K;a.wasmBinary&&(K=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&M("no native wasm support detected");
var N,ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,la,O,P;function ma(){var b=N.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=P=new Int32Array(b);a.HEAPU8=O=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var na,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var Q=0,sa=null,R=null;a.preloadedImages={};a.preloadedAudios={};
function M(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";J(b);ja=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");q(b);throw b;}function ta(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-decoder-video-av1-wasm.wasm";if(!ta()){var ua=S;S=a.locateFile?a.locateFile(ua,A):A+ua}function va(){var b=S;try{if(b==S&&K)return new Uint8Array(K);if(G)return G(b);throw"both async and sync fetching of the wasm failed";}catch(c){M(c)}}
function wa(){if(!K&&(ea||r)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return va()});if(F)return new Promise(function(b,c){F(S,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.B;"number"===typeof e?void 0===c.s?Ja(e)():Ja(e)(c.s):e(void 0===c.s?null:c.s)}}}var T=[];function Ja(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=na.get(b));return c}
var Ka=[null,[],[]],La={f:function(){M("")},c:function(b,c,e){O.copyWithin(b,c,c+e)},d:function(b){var c=O.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{N.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);ma();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},e:function(){return 0},b:function(){},a:function(b,c,e,d){for(var f=0,g=0;g<e;g++){var x=P[c>>2],u=P[c+4>>2];c+=8;for(var y=
0;y<u;y++){var n=O[x+y],w=Ka[b];if(0===n||10===n){n=1===b?ia:J;var l=w;for(var p=0,t=p+NaN,v=p;l[v]&&!(v>=t);)++v;if(16<v-p&&l.subarray&&ka)l=ka.decode(l.subarray(p,v));else{for(t="";p<v;){var h=l[p++];if(h&128){var B=l[p++]&63;if(192==(h&224))t+=String.fromCharCode((h&31)<<6|B);else{var U=l[p++]&63;h=224==(h&240)?(h&15)<<12|B<<6|U:(h&7)<<18|B<<12|U<<6|l[p++]&63;65536>h?t+=String.fromCharCode(h):(h-=65536,t+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else t+=String.fromCharCode(h)}l=t}n(l);w.length=
0}else w.push(n)}f+=u}P[d>>2]=f;return 0},g:function(b,c,e,d,f,g,x,u,y,n,w,l,p,t,v,h){function B(H,k,C,ya,za,Aa,Na,Oa,V){H.set(new Uint8Array(U,k,C*ya));var D,z;for(D=z=0;D<Aa;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;for(;D<Aa+Oa;D++,z+=C){for(k=0;k<za;k++)H[z+k]=V;for(k=za+Na;k<C;k++)H[z+k]=V}for(;D<ya;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;return H}var U=N.buffer,m=a.videoFormat,Ba=(p&-2)*y/x,Ca=(t&-2)*n/u,Da=w*y/x,Ea=l*n/u;w===m.cropWidth&&l===m.cropHeight&&(v=m.displayWidth,h=m.displayHeight);for(var Fa=
a.recycledFrames,E,Ga=u*c,Ha=n*d,Ia=n*g;0<Fa.length;){var L=Fa.shift();m=L.format;if(m.width===x&&m.height===u&&m.chromaWidth===y&&m.chromaHeight===n&&m.cropLeft===p&&m.cropTop===t&&m.cropWidth===w&&m.cropHeight===l&&m.displayWidth===v&&m.displayHeight===h&&L.y.bytes.length===Ga&&L.u.bytes.length===Ha&&L.v.bytes.length===Ia){E=L;break}}E||(E={format:{width:x,height:u,chromaWidth:y,chromaHeight:n,cropLeft:p,cropTop:t,cropWidth:w,cropHeight:l,displayWidth:v,displayHeight:h},y:{bytes:new Uint8Array(Ga),
stride:c},u:{bytes:new Uint8Array(Ha),stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});B(E.y.bytes,b,c,u,p,t,w,l,0);B(E.u.bytes,e,d,n,Ba,Ca,Da,Ea,128);B(E.v.bytes,f,g,n,Ba,Ca,Da,Ea,128);a.frameBuffer=E}};
(function(){function b(f){a.asm=f.exports;N=a.asm.h;ma();na=a.asm.p;pa.unshift(a.asm.i);Q--;a.monitorRunDependencies&&a.monitorRunDependencies(Q);0==Q&&(null!==sa&&(clearInterval(sa),sa=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);M(g)})}var d={a:La};Q++;a.monitorRunDependencies&&a.monitorRunDependencies(Q);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return K||"function"!==typeof WebAssembly.instantiateStreaming||ta()||S.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(q);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.i).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.k).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.l).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.n).apply(null,arguments)};a._free=function(){return(a._free=a.asm.o).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.q).apply(null,arguments)};var W;R=function Ma(){W||Pa();W||(R=Ma)};
function Pa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ja)){xa(pa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<Q)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<Q||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Pa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Pa();var X,Qa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Qa>=d||(X&&a._free(X),Qa=d,X=a._malloc(Qa));var f=X;(new Uint8Array(N.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.A=[];
a.processFrame=function(b,c){function e(u){a._free(g);c(u)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.A.push(e);var x=Z(function(){(new Uint8Array(N.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(x)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.A.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoAV1W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoAV1W;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoAV1W; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoAV1W"] = OGVDecoderVideoAV1W;

Binary file not shown.

View File

@ -0,0 +1,42 @@
var OGVDecoderVideoTheoraW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoTheoraW) {
OGVDecoderVideoTheoraW = OGVDecoderVideoTheoraW || {};
var a;a||(a=typeof OGVDecoderVideoTheoraW !== 'undefined' ? OGVDecoderVideoTheoraW : {});var ca=Object.assign,da,l;a.ready=new Promise(function(b,c){da=b;l=c});var ea=a,fa=ca({},a),ha="object"===typeof window,m="function"===typeof importScripts,t="",y,B,C,fs,D,E;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=m?require("path").dirname(t)+"/":__dirname+"/",E=function(){D||(fs=require("fs"),D=require("path"))},y=function(b,c){E();b=D.normalize(b);return fs.readFileSync(b,c?null:"utf8")},C=function(b){b=y(b,!0);b.buffer||(b=new Uint8Array(b));return b},B=function(b,c,e){E();b=D.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ha||m)m?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="",y=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},m&&(C=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),B=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var H=a.printErr||console.warn.bind(console);ca(a,fa);fa=null;var I;a.wasmBinary&&(I=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&J("no native wasm support detected");
var K,ia=!1,ja,L;function ka(){var b=K.buffer;ja=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=L=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var la,ma=[],na=[],oa=[];function pa(){var b=a.preRun.shift();ma.unshift(b)}var P=0,Q=null,R=null;a.preloadedImages={};a.preloadedAudios={};
function J(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";H(b);ia=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function qa(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-decoder-video-theora-wasm.wasm";if(!qa()){var ra=S;S=a.locateFile?a.locateFile(ra,t):t+ra}function sa(){var b=S;try{if(b==S&&I)return new Uint8Array(I);if(C)return C(b);throw"both async and sync fetching of the wasm failed";}catch(c){J(c)}}
function ta(){if(!I&&(ha||m)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return sa()});if(B)return new Promise(function(b,c){B(S,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return sa()})}
function T(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.A;"number"===typeof e?void 0===c.o?ua(e)():ua(e)(c.o):e(void 0===c.o?null:c.o)}}}var U=[];function ua(b){var c=U[b];c||(b>=U.length&&(U.length=b+1),U[b]=c=la.get(b));return c}
var Ga={a:function(b,c,e){L.copyWithin(b,c,c+e)},b:function(b){var c=L.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{K.grow(Math.min(2147483648,d)-ja.byteLength+65535>>>16);ka();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},c:function(b,c,e,d,f,g,q,n,z,p,u,F,M,N,Z,aa){function ba(A,h,v,va,wa,xa,Ia,Ja,O){A.set(new Uint8Array(Ka,h,v*va));var w,r;for(w=r=0;w<xa;w++,r+=v)for(h=
0;h<v;h++)A[r+h]=O;for(;w<xa+Ja;w++,r+=v){for(h=0;h<wa;h++)A[r+h]=O;for(h=wa+Ia;h<v;h++)A[r+h]=O}for(;w<va;w++,r+=v)for(h=0;h<v;h++)A[r+h]=O;return A}var Ka=K.buffer,k=a.videoFormat,ya=(M&-2)*z/q,za=(N&-2)*p/n,Aa=u*z/q,Ba=F*p/n;u===k.cropWidth&&F===k.cropHeight&&(Z=k.displayWidth,aa=k.displayHeight);for(var Ca=a.recycledFrames,x,Da=n*c,Ea=p*d,Fa=p*g;0<Ca.length;){var G=Ca.shift();k=G.format;if(k.width===q&&k.height===n&&k.chromaWidth===z&&k.chromaHeight===p&&k.cropLeft===M&&k.cropTop===N&&k.cropWidth===
u&&k.cropHeight===F&&k.displayWidth===Z&&k.displayHeight===aa&&G.y.bytes.length===Da&&G.u.bytes.length===Ea&&G.v.bytes.length===Fa){x=G;break}}x||(x={format:{width:q,height:n,chromaWidth:z,chromaHeight:p,cropLeft:M,cropTop:N,cropWidth:u,cropHeight:F,displayWidth:Z,displayHeight:aa},y:{bytes:new Uint8Array(Da),stride:c},u:{bytes:new Uint8Array(Ea),stride:d},v:{bytes:new Uint8Array(Fa),stride:g}});ba(x.y.bytes,b,c,n,M,N,u,F,0);ba(x.u.bytes,e,d,p,ya,za,Aa,Ba,128);ba(x.v.bytes,f,g,p,ya,za,Aa,Ba,128);
a.frameBuffer=x},d:function(b,c,e,d,f,g,q,n,z,p,u){a.videoFormat={width:b,height:c,chromaWidth:e,chromaHeight:d,cropLeft:n,cropTop:z,cropWidth:g,cropHeight:q,displayWidth:p,displayHeight:u,fps:f};a.loadedMetadata=!0}};
(function(){function b(f){a.asm=f.exports;K=a.asm.e;ka();la=a.asm.n;na.unshift(a.asm.f);P--;a.monitorRunDependencies&&a.monitorRunDependencies(P);0==P&&(null!==Q&&(clearInterval(Q),Q=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function e(f){return ta().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){H("failed to asynchronously prepare wasm: "+g);J(g)})}var d={a:Ga};P++;a.monitorRunDependencies&&a.monitorRunDependencies(P);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return H("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return I||"function"!==typeof WebAssembly.instantiateStreaming||qa()||S.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){H("wasm streaming compile failed: "+g);H("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(l);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.g).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.h).apply(null,arguments)};a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.i).apply(null,arguments)};
a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.k).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.l).apply(null,arguments)};a._free=function(){return(a._free=a.asm.m).apply(null,arguments)};var V;R=function Ha(){V||La();V||(R=Ha)};
function La(){function b(){if(!V&&(V=!0,a.calledRun=!0,!ia)){T(na);da(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();oa.unshift(c)}T(oa)}}if(!(0<P)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)pa();T(ma);0<P||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=La;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();La();var W,Ma,X;"undefined"===typeof performance||"undefined"===typeof performance.now?X=Date.now:X=performance.now.bind(performance);function Y(b){var c=X();b=b();a.cpuTime+=X()-c;return b}a.loadedMetadata=!!ea.videoFormat;a.videoFormat=ea.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Y(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Y(function(){var d=b.byteLength;W&&Ma>=d||(W&&a._free(W),Ma=d,W=a._malloc(Ma));var f=W;(new Uint8Array(K.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.s=[];
a.processFrame=function(b,c){function e(n){a._free(g);c(n)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.s.push(e);var q=Y(function(){(new Uint8Array(K.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(q)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.s.push(function(){}),Y(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoTheoraW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoTheoraW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoTheoraW; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoTheoraW"] = OGVDecoderVideoTheoraW;

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP8MTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

View File

@ -0,0 +1,44 @@
var OGVDecoderVideoVP8W = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoVP8W) {
OGVDecoderVideoVP8W = OGVDecoderVideoVP8W || {};
var a;a||(a=typeof OGVDecoderVideoVP8W !== 'undefined' ? OGVDecoderVideoVP8W : {});var aa=Object.assign,ba,n;a.ready=new Promise(function(b,c){ba=b;n=c});var ca=a,ha=aa({},a),ia="object"===typeof window,p="function"===typeof importScripts,t="",x,y,A,fs,B,C;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=p?require("path").dirname(t)+"/":__dirname+"/",C=function(){B||(fs=require("fs"),B=require("path"))},x=function(b,c){C();b=B.normalize(b);return fs.readFileSync(b,c?null:"utf8")},A=function(b){b=x(b,!0);b.buffer||(b=new Uint8Array(b));return b},y=function(b,c,e){C();b=B.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ia||p)p?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="",x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(A=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),y=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var D=a.printErr||console.warn.bind(console);aa(a,ha);ha=null;var ja=0,E;a.wasmBinary&&(E=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&F("no native wasm support detected");
var G,ka=!1,la,ma;function na(){var b=G.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var oa,pa=[],qa=[],ra=[];function sa(){var b=a.preRun.shift();pa.unshift(b)}var K=0,ta=null,L=null;a.preloadedImages={};a.preloadedAudios={};
function F(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";D(b);ka=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ua(){return M.startsWith("data:application/octet-stream;base64,")}var M;M="ogv-decoder-video-vp8-wasm.wasm";if(!ua()){var va=M;M=a.locateFile?a.locateFile(va,t):t+va}function wa(){var b=M;try{if(b==M&&E)return new Uint8Array(E);if(A)return A(b);throw"both async and sync fetching of the wasm failed";}catch(c){F(c)}}
function xa(){if(!E&&(ia||p)){if("function"===typeof fetch&&!M.startsWith("file://"))return fetch(M,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+M+"'";return b.arrayBuffer()}).catch(function(){return wa()});if(y)return new Promise(function(b,c){y(M,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return wa()})}
function ya(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.C;"number"===typeof e?void 0===c.A?N(e)():N(e)(c.A):e(void 0===c.A?null:c.A)}}}var O=[];function N(b){var c=O[b];c||(b>=O.length&&(O.length=b+1),O[b]=c=oa.get(b));return c}
var Pa={g:function(){throw"longjmp";},e:function(b,c,e){ma.copyWithin(b,c,c+e)},f:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{G.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ka,i:La,j:Ma,h:Na,c:Oa,k:function(b,c,e,d,f,g,l,m,P,q,H,I,Q,R,da,ea){function fa(z,h,u,za,Aa,Ba,
Sa,Ta,S){z.set(new Uint8Array(Ua,h,u*za));var v,r;for(v=r=0;v<Ba;v++,r+=u)for(h=0;h<u;h++)z[r+h]=S;for(;v<Ba+Ta;v++,r+=u){for(h=0;h<Aa;h++)z[r+h]=S;for(h=Aa+Sa;h<u;h++)z[r+h]=S}for(;v<za;v++,r+=u)for(h=0;h<u;h++)z[r+h]=S;return z}var Ua=G.buffer,k=a.videoFormat,Ca=(Q&-2)*P/l,Da=(R&-2)*q/m,Ea=H*P/l,Fa=I*q/m;H===k.cropWidth&&I===k.cropHeight&&(da=k.displayWidth,ea=k.displayHeight);for(var Ga=a.recycledFrames,w,Ha=m*c,Ia=q*d,Ja=q*g;0<Ga.length;){var J=Ga.shift();k=J.format;if(k.width===l&&k.height===
m&&k.chromaWidth===P&&k.chromaHeight===q&&k.cropLeft===Q&&k.cropTop===R&&k.cropWidth===H&&k.cropHeight===I&&k.displayWidth===da&&k.displayHeight===ea&&J.y.bytes.length===Ha&&J.u.bytes.length===Ia&&J.v.bytes.length===Ja){w=J;break}}w||(w={format:{width:l,height:m,chromaWidth:P,chromaHeight:q,cropLeft:Q,cropTop:R,cropWidth:H,cropHeight:I,displayWidth:da,displayHeight:ea},y:{bytes:new Uint8Array(Ha),stride:c},u:{bytes:new Uint8Array(Ia),stride:d},v:{bytes:new Uint8Array(Ja),stride:g}});fa(w.y.bytes,
b,c,m,Q,R,H,I,0);fa(w.u.bytes,e,d,q,Ca,Da,Ea,Fa,128);fa(w.v.bytes,f,g,q,Ca,Da,Ea,Fa,128);a.frameBuffer=w},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;G=a.asm.l;na();oa=a.asm.s;qa.unshift(a.asm.m);K--;a.monitorRunDependencies&&a.monitorRunDependencies(K);0==K&&(null!==ta&&(clearInterval(ta),ta=null),L&&(f=L,L=null,f()))}function c(f){b(f.instance)}function e(f){return xa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);F(g)})}var d={a:Pa};K++;a.monitorRunDependencies&&a.monitorRunDependencies(K);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return D("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return E||"function"!==typeof WebAssembly.instantiateStreaming||ua()||M.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(M,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.n).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.o).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.p).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};
var T=a._setThrew=function(){return(T=a._setThrew=a.asm.v).apply(null,arguments)},U=a.stackSave=function(){return(U=a.stackSave=a.asm.w).apply(null,arguments)},V=a.stackRestore=function(){return(V=a.stackRestore=a.asm.x).apply(null,arguments)},Qa=a.dynCall_iiiij=function(){return(Qa=a.dynCall_iiiij=a.asm.y).apply(null,arguments)};function Oa(b,c,e,d,f){var g=U();try{N(b)(c,e,d,f)}catch(l){V(g);if(l!==l+0&&"longjmp"!==l)throw l;T(1,0)}}
function Ka(b,c,e){var d=U();try{return N(b)(c,e)}catch(f){V(d);if(f!==f+0&&"longjmp"!==f)throw f;T(1,0)}}function La(b,c,e,d){var f=U();try{return N(b)(c,e,d)}catch(g){V(f);if(g!==g+0&&"longjmp"!==g)throw g;T(1,0)}}function Na(b,c){var e=U();try{N(b)(c)}catch(d){V(e);if(d!==d+0&&"longjmp"!==d)throw d;T(1,0)}}function Ma(b,c,e,d,f,g){var l=U();try{return Qa(b,c,e,d,f,g)}catch(m){V(l);if(m!==m+0&&"longjmp"!==m)throw m;T(1,0)}}var W;L=function Ra(){W||Va();W||(L=Ra)};
function Va(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){ya(qa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ra.unshift(c)}ya(ra)}}if(!(0<K)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)sa();ya(pa);0<K||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Va;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Va();var X,Wa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Wa>=d||(X&&a._free(X),Wa=d,X=a._malloc(Wa));var f=X;(new Uint8Array(G.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.B=[];
a.processFrame=function(b,c){function e(m){a._free(g);c(m)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.B.push(e);var l=Z(function(){(new Uint8Array(G.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(l)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.B.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoVP8W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoVP8W;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoVP8W; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoVP8W"] = OGVDecoderVideoVP8W;

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP9MTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP9SIMDMTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

View File

@ -0,0 +1,45 @@
var OGVDecoderVideoVP9SIMDW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoVP9SIMDW) {
OGVDecoderVideoVP9SIMDW = OGVDecoderVideoVP9SIMDW || {};
var a;a||(a=typeof OGVDecoderVideoVP9SIMDW !== 'undefined' ? OGVDecoderVideoVP9SIMDW : {});var aa=Object.assign,ba,n;a.ready=new Promise(function(b,c){ba=b;n=c});var ca=a,ha=aa({},a),ia="object"===typeof window,p="function"===typeof importScripts,r="",v,w,x,fs,z,D;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)r=p?require("path").dirname(r)+"/":__dirname+"/",D=function(){z||(fs=require("fs"),z=require("path"))},v=function(b,c){D();b=z.normalize(b);return fs.readFileSync(b,c?null:"utf8")},x=function(b){b=v(b,!0);b.buffer||(b=new Uint8Array(b));return b},w=function(b,c,e){D();b=z.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ia||p)p?r=self.location.href:"undefined"!==typeof document&&document.currentScript&&(r=document.currentScript.src),_scriptDir&&(r=_scriptDir),0!==r.indexOf("blob:")?r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):r="",v=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var F=a.printErr||console.warn.bind(console);aa(a,ha);ha=null;var ja=0,G;a.wasmBinary&&(G=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&H("no native wasm support detected");
var I,ka=!1,la,ma;function na(){var b=I.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var oa,pa=[],qa=[],ra=[];function sa(){var b=a.preRun.shift();pa.unshift(b)}var L=0,ta=null,M=null;a.preloadedImages={};a.preloadedAudios={};
function H(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";F(b);ka=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ua(){return N.startsWith("data:application/octet-stream;base64,")}var N;N="ogv-decoder-video-vp9-simd-wasm.wasm";if(!ua()){var va=N;N=a.locateFile?a.locateFile(va,r):r+va}function wa(){var b=N;try{if(b==N&&G)return new Uint8Array(G);if(x)return x(b);throw"both async and sync fetching of the wasm failed";}catch(c){H(c)}}
function xa(){if(!G&&(ia||p)){if("function"===typeof fetch&&!N.startsWith("file://"))return fetch(N,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+N+"'";return b.arrayBuffer()}).catch(function(){return wa()});if(w)return new Promise(function(b,c){w(N,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return wa()})}
function ya(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.D;"number"===typeof e?void 0===c.B?O(e)():O(e)(c.B):e(void 0===c.B?null:c.B)}}}var P=[];function O(b){var c=P[b];c||(b>=P.length&&(P.length=b+1),P[b]=c=oa.get(b));return c}
var Sa={m:function(){throw"longjmp";},k:function(b,c,e){ma.copyWithin(b,c,c+e)},l:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{I.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ka,f:La,i:Ma,g:Na,e:Oa,c:Pa,j:Qa,h:Ra,n:function(b,c,e,d,f,g,h,k,q,t,u,J,Q,R,da,ea){function fa(E,
l,A,za,Aa,Ba,Ua,Va,S){E.set(new Uint8Array(Wa,l,A*za));var B,y;for(B=y=0;B<Ba;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;for(;B<Ba+Va;B++,y+=A){for(l=0;l<Aa;l++)E[y+l]=S;for(l=Aa+Ua;l<A;l++)E[y+l]=S}for(;B<za;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;return E}var Wa=I.buffer,m=a.videoFormat,Ca=(Q&-2)*q/h,Da=(R&-2)*t/k,Ea=u*q/h,Fa=J*t/k;u===m.cropWidth&&J===m.cropHeight&&(da=m.displayWidth,ea=m.displayHeight);for(var Ga=a.recycledFrames,C,Ha=k*c,Ia=t*d,Ja=t*g;0<Ga.length;){var K=Ga.shift();m=K.format;if(m.width===
h&&m.height===k&&m.chromaWidth===q&&m.chromaHeight===t&&m.cropLeft===Q&&m.cropTop===R&&m.cropWidth===u&&m.cropHeight===J&&m.displayWidth===da&&m.displayHeight===ea&&K.y.bytes.length===Ha&&K.u.bytes.length===Ia&&K.v.bytes.length===Ja){C=K;break}}C||(C={format:{width:h,height:k,chromaWidth:q,chromaHeight:t,cropLeft:Q,cropTop:R,cropWidth:u,cropHeight:J,displayWidth:da,displayHeight:ea},y:{bytes:new Uint8Array(Ha),stride:c},u:{bytes:new Uint8Array(Ia),stride:d},v:{bytes:new Uint8Array(Ja),stride:g}});
fa(C.y.bytes,b,c,k,Q,R,u,J,0);fa(C.u.bytes,e,d,t,Ca,Da,Ea,Fa,128);fa(C.v.bytes,f,g,t,Ca,Da,Ea,Fa,128);a.frameBuffer=C},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;I=a.asm.o;na();oa=a.asm.v;qa.unshift(a.asm.p);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==ta&&(clearInterval(ta),ta=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function e(f){return xa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){F("failed to asynchronously prepare wasm: "+g);H(g)})}var d={a:Sa};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return F("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return G||"function"!==typeof WebAssembly.instantiateStreaming||ua()||N.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){F("wasm streaming compile failed: "+g);F("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.p).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.r).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.s).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.t).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.u).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.w).apply(null,arguments)};a._free=function(){return(a._free=a.asm.x).apply(null,arguments)};
var T=a._setThrew=function(){return(T=a._setThrew=a.asm.y).apply(null,arguments)},U=a.stackSave=function(){return(U=a.stackSave=a.asm.z).apply(null,arguments)},V=a.stackRestore=function(){return(V=a.stackRestore=a.asm.A).apply(null,arguments)};function Ma(b,c,e,d,f){var g=U();try{return O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}function Pa(b,c,e,d,f){var g=U();try{O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}
function Ra(b,c,e,d,f,g,h,k,q){var t=U();try{O(b)(c,e,d,f,g,h,k,q)}catch(u){V(t);if(u!==u+0&&"longjmp"!==u)throw u;T(1,0)}}function Na(b,c,e,d,f,g){var h=U();try{return O(b)(c,e,d,f,g)}catch(k){V(h);if(k!==k+0&&"longjmp"!==k)throw k;T(1,0)}}function La(b,c,e,d){var f=U();try{return O(b)(c,e,d)}catch(g){V(f);if(g!==g+0&&"longjmp"!==g)throw g;T(1,0)}}function Qa(b,c,e,d,f,g,h){var k=U();try{O(b)(c,e,d,f,g,h)}catch(q){V(k);if(q!==q+0&&"longjmp"!==q)throw q;T(1,0)}}
function Ka(b,c,e){var d=U();try{return O(b)(c,e)}catch(f){V(d);if(f!==f+0&&"longjmp"!==f)throw f;T(1,0)}}function Oa(b,c){var e=U();try{O(b)(c)}catch(d){V(e);if(d!==d+0&&"longjmp"!==d)throw d;T(1,0)}}var W;M=function Ta(){W||Xa();W||(M=Ta)};
function Xa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){ya(qa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ra.unshift(c)}ya(ra)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)sa();ya(pa);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Xa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Xa();var X,Ya,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Ya>=d||(X&&a._free(X),Ya=d,X=a._malloc(Ya));var f=X;(new Uint8Array(I.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.C=[];
a.processFrame=function(b,c){function e(k){a._free(g);c(k)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.C.push(e);var h=Z(function(){(new Uint8Array(I.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(h)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.C.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoVP9SIMDW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoVP9SIMDW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoVP9SIMDW; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoVP9SIMDW"] = OGVDecoderVideoVP9SIMDW;

Binary file not shown.

View File

@ -0,0 +1,45 @@
var OGVDecoderVideoVP9W = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoVP9W) {
OGVDecoderVideoVP9W = OGVDecoderVideoVP9W || {};
var a;a||(a=typeof OGVDecoderVideoVP9W !== 'undefined' ? OGVDecoderVideoVP9W : {});var aa=Object.assign,ba,n;a.ready=new Promise(function(b,c){ba=b;n=c});var ca=a,ha=aa({},a),ia="object"===typeof window,p="function"===typeof importScripts,r="",v,w,x,fs,z,D;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)r=p?require("path").dirname(r)+"/":__dirname+"/",D=function(){z||(fs=require("fs"),z=require("path"))},v=function(b,c){D();b=z.normalize(b);return fs.readFileSync(b,c?null:"utf8")},x=function(b){b=v(b,!0);b.buffer||(b=new Uint8Array(b));return b},w=function(b,c,e){D();b=z.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ia||p)p?r=self.location.href:"undefined"!==typeof document&&document.currentScript&&(r=document.currentScript.src),_scriptDir&&(r=_scriptDir),0!==r.indexOf("blob:")?r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):r="",v=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var F=a.printErr||console.warn.bind(console);aa(a,ha);ha=null;var ja=0,G;a.wasmBinary&&(G=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&H("no native wasm support detected");
var I,ka=!1,la,ma;function na(){var b=I.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var oa,pa=[],qa=[],ra=[];function sa(){var b=a.preRun.shift();pa.unshift(b)}var L=0,ta=null,M=null;a.preloadedImages={};a.preloadedAudios={};
function H(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";F(b);ka=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ua(){return N.startsWith("data:application/octet-stream;base64,")}var N;N="ogv-decoder-video-vp9-wasm.wasm";if(!ua()){var va=N;N=a.locateFile?a.locateFile(va,r):r+va}function wa(){var b=N;try{if(b==N&&G)return new Uint8Array(G);if(x)return x(b);throw"both async and sync fetching of the wasm failed";}catch(c){H(c)}}
function xa(){if(!G&&(ia||p)){if("function"===typeof fetch&&!N.startsWith("file://"))return fetch(N,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+N+"'";return b.arrayBuffer()}).catch(function(){return wa()});if(w)return new Promise(function(b,c){w(N,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return wa()})}
function ya(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.D;"number"===typeof e?void 0===c.B?O(e)():O(e)(c.B):e(void 0===c.B?null:c.B)}}}var P=[];function O(b){var c=P[b];c||(b>=P.length&&(P.length=b+1),P[b]=c=oa.get(b));return c}
var Sa={m:function(){throw"longjmp";},k:function(b,c,e){ma.copyWithin(b,c,c+e)},l:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{I.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ka,f:La,i:Ma,g:Na,e:Oa,c:Pa,j:Qa,h:Ra,n:function(b,c,e,d,f,g,h,k,q,t,u,J,Q,R,da,ea){function fa(E,
l,A,za,Aa,Ba,Ua,Va,S){E.set(new Uint8Array(Wa,l,A*za));var B,y;for(B=y=0;B<Ba;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;for(;B<Ba+Va;B++,y+=A){for(l=0;l<Aa;l++)E[y+l]=S;for(l=Aa+Ua;l<A;l++)E[y+l]=S}for(;B<za;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;return E}var Wa=I.buffer,m=a.videoFormat,Ca=(Q&-2)*q/h,Da=(R&-2)*t/k,Ea=u*q/h,Fa=J*t/k;u===m.cropWidth&&J===m.cropHeight&&(da=m.displayWidth,ea=m.displayHeight);for(var Ga=a.recycledFrames,C,Ha=k*c,Ia=t*d,Ja=t*g;0<Ga.length;){var K=Ga.shift();m=K.format;if(m.width===
h&&m.height===k&&m.chromaWidth===q&&m.chromaHeight===t&&m.cropLeft===Q&&m.cropTop===R&&m.cropWidth===u&&m.cropHeight===J&&m.displayWidth===da&&m.displayHeight===ea&&K.y.bytes.length===Ha&&K.u.bytes.length===Ia&&K.v.bytes.length===Ja){C=K;break}}C||(C={format:{width:h,height:k,chromaWidth:q,chromaHeight:t,cropLeft:Q,cropTop:R,cropWidth:u,cropHeight:J,displayWidth:da,displayHeight:ea},y:{bytes:new Uint8Array(Ha),stride:c},u:{bytes:new Uint8Array(Ia),stride:d},v:{bytes:new Uint8Array(Ja),stride:g}});
fa(C.y.bytes,b,c,k,Q,R,u,J,0);fa(C.u.bytes,e,d,t,Ca,Da,Ea,Fa,128);fa(C.v.bytes,f,g,t,Ca,Da,Ea,Fa,128);a.frameBuffer=C},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;I=a.asm.o;na();oa=a.asm.v;qa.unshift(a.asm.p);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==ta&&(clearInterval(ta),ta=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function e(f){return xa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){F("failed to asynchronously prepare wasm: "+g);H(g)})}var d={a:Sa};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return F("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return G||"function"!==typeof WebAssembly.instantiateStreaming||ua()||N.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){F("wasm streaming compile failed: "+g);F("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.p).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.r).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.s).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.t).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.u).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.w).apply(null,arguments)};a._free=function(){return(a._free=a.asm.x).apply(null,arguments)};
var T=a._setThrew=function(){return(T=a._setThrew=a.asm.y).apply(null,arguments)},U=a.stackSave=function(){return(U=a.stackSave=a.asm.z).apply(null,arguments)},V=a.stackRestore=function(){return(V=a.stackRestore=a.asm.A).apply(null,arguments)};function Ma(b,c,e,d,f){var g=U();try{return O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}function Pa(b,c,e,d,f){var g=U();try{O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}
function Ra(b,c,e,d,f,g,h,k,q){var t=U();try{O(b)(c,e,d,f,g,h,k,q)}catch(u){V(t);if(u!==u+0&&"longjmp"!==u)throw u;T(1,0)}}function Na(b,c,e,d,f,g){var h=U();try{return O(b)(c,e,d,f,g)}catch(k){V(h);if(k!==k+0&&"longjmp"!==k)throw k;T(1,0)}}function La(b,c,e,d){var f=U();try{return O(b)(c,e,d)}catch(g){V(f);if(g!==g+0&&"longjmp"!==g)throw g;T(1,0)}}function Qa(b,c,e,d,f,g,h){var k=U();try{O(b)(c,e,d,f,g,h)}catch(q){V(k);if(q!==q+0&&"longjmp"!==q)throw q;T(1,0)}}
function Ka(b,c,e){var d=U();try{return O(b)(c,e)}catch(f){V(d);if(f!==f+0&&"longjmp"!==f)throw f;T(1,0)}}function Oa(b,c){var e=U();try{O(b)(c)}catch(d){V(e);if(d!==d+0&&"longjmp"!==d)throw d;T(1,0)}}var W;M=function Ta(){W||Xa();W||(M=Ta)};
function Xa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){ya(qa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ra.unshift(c)}ya(ra)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)sa();ya(pa);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Xa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Xa();var X,Ya,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Ya>=d||(X&&a._free(X),Ya=d,X=a._malloc(Ya));var f=X;(new Uint8Array(I.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.C=[];
a.processFrame=function(b,c){function e(k){a._free(g);c(k)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.C.push(e);var h=Z(function(){(new Uint8Array(I.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(h)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.C.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoVP9W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoVP9W;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoVP9W; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoVP9W"] = OGVDecoderVideoVP9W;

Binary file not shown.

View File

@ -0,0 +1,43 @@
var OGVDemuxerOggW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDemuxerOggW) {
OGVDemuxerOggW = OGVDemuxerOggW || {};
var a;a||(a=typeof OGVDemuxerOggW !== 'undefined' ? OGVDemuxerOggW : {});var h=Object.assign,k,l;a.ready=new Promise(function(b,c){k=b;l=c});var m=h({},a),n="object"===typeof window,p="function"===typeof importScripts,q="",r,t,u,fs,v,w;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)q=p?require("path").dirname(q)+"/":__dirname+"/",w=function(){v||(fs=require("fs"),v=require("path"))},r=function(b,c){w();b=v.normalize(b);return fs.readFileSync(b,c?null:"utf8")},u=function(b){b=r(b,!0);b.buffer||(b=new Uint8Array(b));return b},t=function(b,c,d){w();b=v.normalize(b);fs.readFile(b,function(e,f){e?d(e):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(n||p)p?q=self.location.href:"undefined"!==typeof document&&document.currentScript&&(q=document.currentScript.src),_scriptDir&&(q=_scriptDir),0!==q.indexOf("blob:")?q=q.substr(0,q.replace(/[?#].*/,"").lastIndexOf("/")+1):q="",r=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(u=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),t=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)};a.print||console.log.bind(console);var x=a.printErr||console.warn.bind(console);h(a,m);m=null;var y;a.wasmBinary&&(y=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");
var A,B=!1;"undefined"!==typeof TextDecoder&&new TextDecoder("utf8");var C,D,E;function F(){var b=A.buffer;C=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=E=new Int32Array(b);a.HEAPU8=D=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var G,H=[],I=[],J=[];function aa(){var b=a.preRun.shift();H.unshift(b)}var K=0,L=null,M=null;a.preloadedImages={};a.preloadedAudios={};
function z(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";x(b);B=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function N(){return O.startsWith("data:application/octet-stream;base64,")}var O;O="ogv-demuxer-ogg-wasm.wasm";if(!N()){var P=O;O=a.locateFile?a.locateFile(P,q):q+P}function Q(){var b=O;try{if(b==O&&y)return new Uint8Array(y);if(u)return u(b);throw"both async and sync fetching of the wasm failed";}catch(c){z(c)}}
function ba(){if(!y&&(n||p)){if("function"===typeof fetch&&!O.startsWith("file://"))return fetch(O,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+O+"'";return b.arrayBuffer()}).catch(function(){return Q()});if(t)return new Promise(function(b,c){t(O,function(d){b(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return Q()})}
function R(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.B;"number"===typeof d?void 0===c.v?S(d)():S(d)(c.v):d(void 0===c.v?null:c.v)}}}var T=[];function S(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=G.get(b));return c}
var ca={},da={d:function(b,c,d){D.copyWithin(b,c,c+d)},e:function(b){var c=D.length;b>>>=0;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0<e%65536&&(e+=65536-e%65536);a:{try{A.grow(Math.min(2147483648,e)-C.byteLength+65535>>>16);F();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},f:function(b,c,d,e){b=ca.C(b);c=ca.A(b,c,d);E[e>>2]=c;return 0},a:function(b,c,d,e){var f=A.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c):
(new Uint8Array(new Uint8Array(f,b,c))).buffer,timestamp:d,discardPadding:e})},c:function(b,c){function d(e){for(var f="",g=new Uint8Array(A.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},b:function(b,c,d,e,f){var g=A.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}};
(function(){function b(f){a.asm=f.exports;A=a.asm.g;F();G=a.asm.s;I.unshift(a.asm.h);K--;a.monitorRunDependencies&&a.monitorRunDependencies(K);0==K&&(null!==L&&(clearInterval(L),L=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function d(f){return ba().then(function(g){return WebAssembly.instantiate(g,e)}).then(function(g){return g}).then(f,function(g){x("failed to asynchronously prepare wasm: "+g);z(g)})}var e={a:da};K++;a.monitorRunDependencies&&a.monitorRunDependencies(K);if(a.instantiateWasm)try{return a.instantiateWasm(e,
b)}catch(f){return x("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||N()||O.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){x("wasm streaming compile failed: "+g);x("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(l);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.h).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.i).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.j).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.k).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.l).apply(null,arguments)};
a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.m).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.n).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.o).apply(null,arguments)};a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.p).apply(null,arguments)};
a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.q).apply(null,arguments)};a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};var U;M=function ea(){U||V();U||(M=ea)};
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!B)){R(I);k(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();J.unshift(c)}R(J)}}if(!(0<K)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();R(H);0<K||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();c=Y()-c;a.cpuTime+=c;return b}a.loadedMetadata=!1;a.videoCodec=null;a.audioCodec=null;a.duration=NaN;a.onseek=null;a.cpuTime=0;a.audioPackets=[];Object.defineProperty(a,"hasAudio",{get:function(){return a.loadedMetadata&&a.audioCodec}});
Object.defineProperty(a,"audioReady",{get:function(){return 0<a.audioPackets.length}});Object.defineProperty(a,"audioTimestamp",{get:function(){return 0<a.audioPackets.length?a.audioPackets[0].timestamp:-1}});a.videoPackets=[];Object.defineProperty(a,"hasVideo",{get:function(){return a.loadedMetadata&&a.videoCodec}});Object.defineProperty(a,"frameReady",{get:function(){return 0<a.videoPackets.length}});
Object.defineProperty(a,"frameTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].timestamp:-1}});Object.defineProperty(a,"keyframeTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].keyframeTimestamp:-1}});Object.defineProperty(a,"nextKeyframeTimestamp",{get:function(){for(var b=0;b<a.videoPackets.length;b++){var c=a.videoPackets[b];if(c.isKeyframe)return c.timestamp}return-1}});Object.defineProperty(a,"processing",{get:function(){return!1}});
Object.defineProperty(a,"seekable",{get:function(){return!!a._ogv_demuxer_seekable()}});a.init=function(b){Z(function(){a._ogv_demuxer_init()});b()};a.receiveInput=function(b,c){Z(function(){var d=b.byteLength;W&&X>=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(A.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)};
a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)};
a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){};
return OGVDemuxerOggW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDemuxerOggW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDemuxerOggW; });
else if (typeof exports === 'object')
exports["OGVDemuxerOggW"] = OGVDemuxerOggW;

Binary file not shown.

View File

@ -0,0 +1,46 @@
var OGVDemuxerWebMW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDemuxerWebMW) {
OGVDemuxerWebMW = OGVDemuxerWebMW || {};
var a;a||(a=typeof OGVDemuxerWebMW !== 'undefined' ? OGVDemuxerWebMW : {});var h=Object.assign,k,l;a.ready=new Promise(function(b,c){k=b;l=c});var m=h({},a),n="object"===typeof window,q="function"===typeof importScripts,r="",t,u,v,fs,w,A;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)r=q?require("path").dirname(r)+"/":__dirname+"/",A=function(){w||(fs=require("fs"),w=require("path"))},t=function(b,c){A();b=w.normalize(b);return fs.readFileSync(b,c?null:"utf8")},v=function(b){b=t(b,!0);b.buffer||(b=new Uint8Array(b));return b},u=function(b,c,d){A();b=w.normalize(b);fs.readFile(b,function(e,f){e?d(e):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(n||q)q?r=self.location.href:"undefined"!==typeof document&&document.currentScript&&(r=document.currentScript.src),_scriptDir&&(r=_scriptDir),0!==r.indexOf("blob:")?r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):r="",t=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},q&&(v=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),u=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)};var aa=a.print||console.log.bind(console),B=a.printErr||console.warn.bind(console);h(a,m);m=null;var C;a.wasmBinary&&(C=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&D("no native wasm support detected");
var E,F=!1,H="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function I(b,c,d){var e=c+d;for(d=c;b[d]&&!(d>=e);)++d;if(16<d-c&&b.subarray&&H)return H.decode(b.subarray(c,d));for(e="";c<d;){var f=b[c++];if(f&128){var g=b[c++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var p=b[c++]&63;f=224==(f&240)?(f&15)<<12|g<<6|p:(f&7)<<18|g<<12|p<<6|b[c++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function J(b){return b?I(K,b,void 0):""}var L,K,M;
function N(){var b=E.buffer;L=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=M=new Int32Array(b);a.HEAPU8=K=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var ba,ca=[],da=[],ea=[];function fa(){var b=a.preRun.shift();ca.unshift(b)}var O=0,P=null,Q=null;a.preloadedImages={};a.preloadedAudios={};
function D(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";B(b);F=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function ha(){return R.startsWith("data:application/octet-stream;base64,")}var R;R="ogv-demuxer-webm-wasm.wasm";if(!ha()){var ia=R;R=a.locateFile?a.locateFile(ia,r):r+ia}function ja(){var b=R;try{if(b==R&&C)return new Uint8Array(C);if(v)return v(b);throw"both async and sync fetching of the wasm failed";}catch(c){D(c)}}
function ka(){if(!C&&(n||q)){if("function"===typeof fetch&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+R+"'";return b.arrayBuffer()}).catch(function(){return ja()});if(u)return new Promise(function(b,c){u(R,function(d){b(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return ja()})}
function S(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.B;"number"===typeof d?void 0===c.A?la(d)():la(d)(c.A):d(void 0===c.A?null:c.A)}}}var T=[];function la(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=ba.get(b));return c}
var ma=[null,[],[]],na={a:function(b,c,d,e){D("Assertion failed: "+J(b)+", at: "+[c?J(c):"unknown filename",d,e?J(e):"unknown function"])},f:function(){D("")},d:function(b,c,d){K.copyWithin(b,c,c+d)},e:function(b){var c=K.length;b>>>=0;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);N();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},b:function(b,
c,d,e){for(var f=0,g=0;g<d;g++){var p=M[c>>2],G=M[c+4>>2];c+=8;for(var x=0;x<G;x++){var y=K[p+x],z=ma[b];0===y||10===y?((1===b?aa:B)(I(z,0)),z.length=0):z.push(y)}f+=G}M[e>>2]=f;return 0},c:function(b,c,d,e){var f=E.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c):(new Uint8Array(new Uint8Array(f,b,c))).buffer,timestamp:d,discardPadding:e})},j:function(b,c,d,e,f,g,p,G,x,y,z){a.videoFormat={width:b,height:c,chromaWidth:d,chromaHeight:e,cropLeft:G,cropTop:x,cropWidth:g,cropHeight:p,displayWidth:y,
displayHeight:z,fps:f}},h:function(b,c){function d(e){for(var f="",g=new Uint8Array(E.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},i:function(b,c){if(a.onseek)a.onseek(b+4294967296*c)},g:function(b,c,d,e,f){var g=E.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}};
(function(){function b(f){a.asm=f.exports;E=a.asm.k;N();ba=a.asm.w;da.unshift(a.asm.l);O--;a.monitorRunDependencies&&a.monitorRunDependencies(O);0==O&&(null!==P&&(clearInterval(P),P=null),Q&&(f=Q,Q=null,f()))}function c(f){b(f.instance)}function d(f){return ka().then(function(g){return WebAssembly.instantiate(g,e)}).then(function(g){return g}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);D(g)})}var e={a:na};O++;a.monitorRunDependencies&&a.monitorRunDependencies(O);if(a.instantiateWasm)try{return a.instantiateWasm(e,
b)}catch(f){return B("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return C||"function"!==typeof WebAssembly.instantiateStreaming||ha()||R.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(R,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(l);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.l).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.m).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.n).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.o).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.p).apply(null,arguments)};
a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.q).apply(null,arguments)};a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.r).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.s).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.t).apply(null,arguments)};
a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.u).apply(null,arguments)};a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.v).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.x).apply(null,arguments)};a._free=function(){return(a._free=a.asm.y).apply(null,arguments)};var U;Q=function oa(){U||V();U||(Q=oa)};
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!F)){S(da);k(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ea.unshift(c)}S(ea)}}if(!(0<O)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)fa();S(ca);0<O||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();c=Y()-c;a.cpuTime+=c;return b}a.loadedMetadata=!1;a.videoCodec=null;a.audioCodec=null;a.duration=NaN;a.onseek=null;a.cpuTime=0;a.audioPackets=[];Object.defineProperty(a,"hasAudio",{get:function(){return a.loadedMetadata&&a.audioCodec}});
Object.defineProperty(a,"audioReady",{get:function(){return 0<a.audioPackets.length}});Object.defineProperty(a,"audioTimestamp",{get:function(){return 0<a.audioPackets.length?a.audioPackets[0].timestamp:-1}});a.videoPackets=[];Object.defineProperty(a,"hasVideo",{get:function(){return a.loadedMetadata&&a.videoCodec}});Object.defineProperty(a,"frameReady",{get:function(){return 0<a.videoPackets.length}});
Object.defineProperty(a,"frameTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].timestamp:-1}});Object.defineProperty(a,"keyframeTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].keyframeTimestamp:-1}});Object.defineProperty(a,"nextKeyframeTimestamp",{get:function(){for(var b=0;b<a.videoPackets.length;b++){var c=a.videoPackets[b];if(c.isKeyframe)return c.timestamp}return-1}});Object.defineProperty(a,"processing",{get:function(){return!1}});
Object.defineProperty(a,"seekable",{get:function(){return!!a._ogv_demuxer_seekable()}});a.init=function(b){Z(function(){a._ogv_demuxer_init()});b()};a.receiveInput=function(b,c){Z(function(){var d=b.byteLength;W&&X>=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(E.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)};
a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)};
a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){};
return OGVDemuxerWebMW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDemuxerWebMW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDemuxerWebMW; });
else if (typeof exports === 'object')
exports["OGVDemuxerWebMW"] = OGVDemuxerWebMW;

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(()=>{var e={575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},913:e=>{function t(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},8:e=>{function t(o){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(o)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},523:(e,t,o)=>{"use strict";var r=o(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(o(575)),u=r(o(913)),s=new(function(){function e(){(0,n.default)(this,e)}return(0,u.default)(e,[{key:"hasTypedArrays",value:function(){return!!window.Uint32Array}},{key:"hasWebAssembly",value:function(){return!!window.WebAssembly}},{key:"hasWebAudio",value:function(){return!(!window.AudioContext&&!window.webkitAudioContext)}},{key:"hasFlash",value:function(){return!1}},{key:"hasAudio",value:function(){return this.hasWebAudio()}},{key:"isBlacklisted",value:function(e){return!1}},{key:"isSlow",value:function(){return!1}},{key:"isTooSlow",value:function(){return!1}},{key:"supported",value:function(e){return"OGVDecoder"===e?this.hasWebAssembly():"OGVPlayer"===e&&this.supported("OGVDecoder")&&this.hasAudio()}}]),e}());t.default=s}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}(()=>{"use strict";var e=o(318),t=e(o(8)),r=e(o(523));"object"===("undefined"==typeof window?"undefined":(0,t.default)(window))&&(window.OGVCompat=r.default,window.OGVVersion="1.8.6-20220111172545-1f60d9d")})()})();

View File

@ -0,0 +1 @@
(()=>{var e={318:e=>{e.exports=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},8:e=>{function _typeof(o){return e.exports=_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,_typeof(o)}e.exports=_typeof,e.exports.__esModule=!0,e.exports.default=e.exports}},o={};function __webpack_require__(t){var r=o[t];if(void 0!==r)return r.exports;var p=o[t]={exports:{}};return e[t](p,p.exports,__webpack_require__),p.exports}(()=>{"use strict";var e=__webpack_require__(318)(__webpack_require__(8)),o="1.8.6-20220111172545-1f60d9d";"object"===("undefined"==typeof window?"undefined":(0,e.default)(window))&&(window.OGVVersion=o)})()})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
ogvjs-1.8.6/ogv.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,6 @@
"fast-sha256": "^1.3.0", "fast-sha256": "^1.3.0",
"libsodium": "^0.7.9", "libsodium": "^0.7.9",
"libsodium-wrappers": "^0.7.9", "libsodium-wrappers": "^0.7.9",
"ogv": "^1.8.6",
"ts-proto": "^1.101.0", "ts-proto": "^1.101.0",
"zstddec": "^0.0.2" "zstddec": "^0.0.2"
} }

View File

@ -1,4 +1,5 @@
// example: https://github.com/rgov/js-theora-decoder/blob/main/index.html // example: https://github.com/rgov/js-theora-decoder/blob/main/index.html
// https://github.com/brion/ogv.js/releases, yarn add has no simd
// dev: copy decoder files from node/ogv/dist/* to project dir // dev: copy decoder files from node/ogv/dist/* to project dir
// dist: .... to dist // dist: .... to dist
/* /*
@ -20,8 +21,12 @@
*/ */
export function loadVp9(callback) { export function loadVp9(callback) {
// Multithreading is used only if `options.threading` is true.
// This requires browser support for the new `SharedArrayBuffer` and `Atomics` APIs,
// currently available in Firefox and Chrome with experimental flags enabled.
// 所有主流浏览器均默认于2018年1月5日禁用SharedArrayBuffer
window.OGVLoader.loadClass( window.OGVLoader.loadClass(
"OGVDecoderVideoVP9W", "OGVDecoderVideoVP9SIMDW",
(videoCodecClass) => { (videoCodecClass) => {
window.videoCodecClass = videoCodecClass; window.videoCodecClass = videoCodecClass;
videoCodecClass({ videoFormat: {} }).then((decoder) => { videoCodecClass({ videoFormat: {} }).then((decoder) => {
@ -30,7 +35,7 @@ export function loadVp9(callback) {
}) })
}) })
}, },
{ worker: true } { worker: true, threading: true }
); );
} }

View File

@ -45,12 +45,11 @@ export function translate(locale: string, text: string): string {
const zCode = "z".charCodeAt(0); const zCode = "z".charCodeAt(0);
const aCode = "a".charCodeAt(0); const aCode = "a".charCodeAt(0);
export function mapKey(name: string) { export function mapKey(name: string, isDesktop: Boolean) {
const tmp = KEY_MAP[name]; const tmp = KEY_MAP[name];
if (!tmp) return undefined;
if (tmp.length == 1) { if (tmp.length == 1) {
const chr = tmp.charCodeAt(0); const chr = tmp.charCodeAt(0);
if (chr > zCode || chr < aCode) if (!isDesktop && (chr > zCode || chr < aCode))
return KeyEvent.fromPartial({ unicode: chr }); return KeyEvent.fromPartial({ unicode: chr });
else return KeyEvent.fromPartial({ chr }); else return KeyEvent.fromPartial({ chr });
} }

View File

@ -27,12 +27,14 @@ export default class Connection {
_audioDecoder: any; _audioDecoder: any;
_password: Uint8Array | undefined; _password: Uint8Array | undefined;
_options: any; _options: any;
_videoTestSpeed: number[];
constructor() { constructor() {
this._msgbox = globals.msgbox; this._msgbox = globals.msgbox;
this._draw = globals.draw; this._draw = globals.draw;
this._msgs = []; this._msgs = [];
this._id = ""; this._id = "";
this._videoTestSpeed = [0, 0];
} }
async start(id: string) { async start(id: string) {
@ -58,7 +60,7 @@ export default class Connection {
this.loadVideoDecoder(); this.loadVideoDecoder();
this.loadAudioDecoder(); this.loadAudioDecoder();
const uri = getDefaultUri(); const uri = getDefaultUri();
const ws = new Websock(uri); const ws = new Websock(uri, true);
this._ws = ws; this._ws = ws;
this._id = id; this._id = id;
console.log( console.log(
@ -75,7 +77,7 @@ export default class Connection {
nat_type, nat_type,
}); });
ws.sendRendezvous({ punch_hole_request }); ws.sendRendezvous({ punch_hole_request });
const msg = ws.parseRendezvous(await ws.next()); const msg = (await ws.next()) as rendezvous.RendezvousMessage;
ws.close(); ws.close();
console.log(new Date() + ": Got relay response"); console.log(new Date() + ": Got relay response");
const phr = msg.punch_hole_response; const phr = msg.punch_hole_response;
@ -113,7 +115,7 @@ export default class Connection {
} }
const uuid = rr.uuid; const uuid = rr.uuid;
console.log(new Date() + ": Connecting to relay server: " + uri); console.log(new Date() + ": Connecting to relay server: " + uri);
const ws = new Websock(uri); const ws = new Websock(uri, false, this.handleVideoFrame.bind(this));
await ws.open(); await ws.open();
console.log(new Date() + ": Connected to relay server"); console.log(new Date() + ": Connected to relay server");
this._ws = ws; this._ws = ws;
@ -149,7 +151,7 @@ export default class Connection {
this._ws?.sendMessage({}); this._ws?.sendMessage({});
return; return;
} }
const msg = this._ws?.parseMessage(await this._ws?.next()); const msg = (await this._ws?.next()) as message.Message;
let signedId: any = msg?.signed_id; let signedId: any = msg?.signed_id;
if (!signedId) { if (!signedId) {
console.error("Handshake failed: invalid message type"); console.error("Handshake failed: invalid message type");
@ -198,7 +200,7 @@ export default class Connection {
async msgLoop() { async msgLoop() {
while (true) { while (true) {
const msg = this._ws?.parseMessage(await this._ws?.next()); const msg = (await this._ws?.next()) as message.Message;
if (msg?.hash) { if (msg?.hash) {
this._hash = msg?.hash; this._hash = msg?.hash;
if (!this._password) if (!this._password)
@ -251,6 +253,7 @@ export default class Connection {
draw(frame: any) { draw(frame: any) {
this._draw?.(frame); this._draw?.(frame);
globals.draw(frame);
} }
close() { close() {
@ -305,6 +308,7 @@ export default class Connection {
my_name: "web", // to-do my_name: "web", // to-do
password, password,
option: this.getOptionMessage(), option: this.getOptionMessage(),
video_ack_required: true,
}); });
this._ws?.sendMessage({ login_request }); this._ws?.sendMessage({ login_request });
} }
@ -341,6 +345,11 @@ export default class Connection {
return n > 0 ? msg : undefined; return n > 0 ? msg : undefined;
} }
sendVideoReceived() {
const misc = message.Misc.fromPartial({ video_received: true });
this._ws?.sendMessage({ misc });
}
handleVideoFrame(vf: message.VideoFrame) { handleVideoFrame(vf: message.VideoFrame) {
if (!this._firstFrame) { if (!this._firstFrame) {
this.msgbox("", "", ""); this.msgbox("", "", "");
@ -348,11 +357,28 @@ export default class Connection {
} }
if (vf.vp9s) { if (vf.vp9s) {
const dec = this._videoDecoder; const dec = this._videoDecoder;
// dec.sync(); var tm = new Date().getTime();
var i = 0;
const n = vf.vp9s?.frames.length;
vf.vp9s.frames.forEach((f) => { vf.vp9s.frames.forEach((f) => {
dec.processFrame(f.data.slice(0).buffer, (ok: any) => { dec.processFrame(f.data.slice(0).buffer, (ok: any) => {
if (ok && dec.frameBuffer) { i++;
if (i == n) this.sendVideoReceived();
if (ok && dec.frameBuffer && n == i) {
this.draw(dec.frameBuffer); this.draw(dec.frameBuffer);
const now = new Date().getTime();
var elapsed = now - tm;
this._videoTestSpeed[1] += elapsed;
this._videoTestSpeed[0] += 1;
if (this._videoTestSpeed[0] >= 30) {
console.log(
"video decoder: " +
parseInt(
"" + this._videoTestSpeed[1] / this._videoTestSpeed[0]
)
);
this._videoTestSpeed = [0, 0];
}
} }
}); });
}); });
@ -398,6 +424,8 @@ export default class Connection {
handleMisc(misc: message.Misc) { handleMisc(misc: message.Misc) {
if (misc.audio_format) { if (misc.audio_format) {
// //
} else if (misc.chat_message) {
globals.pushEvent("chat", misc.chat_message.text);
} else if (misc.permission_info) { } else if (misc.permission_info) {
const p = misc.permission_info; const p = misc.permission_info;
console.info("Change permission " + p.permission + " -> " + p.enabled); console.info("Change permission " + p.permission + " -> " + p.enabled);
@ -457,18 +485,18 @@ export default class Connection {
shift: Boolean, shift: Boolean,
command: Boolean command: Boolean
) { ) {
const key_event = mapKey(name); const key_event = mapKey(name, globals.isDesktop());
if (!key_event) return; if (!key_event) return;
if (alt && name == 'VK_MENU') { if (alt && name == "VK_MENU") {
alt = false; alt = false;
} }
if (ctrl && name == 'VK_CONTROL') { if (ctrl && name == "VK_CONTROL") {
ctrl = false; ctrl = false;
} }
if (shift && name == 'VK_SHIFT') { if (shift && name == "VK_SHIFT") {
shift = false; shift = false;
} }
if (command && name == 'Meta') { if (command && name == "Meta") {
command = false; command = false;
} }
key_event.down = down; key_event.down = down;
@ -583,7 +611,7 @@ export default class Connection {
} }
getImageQuality() { getImageQuality() {
return this.getOption('image-quality'); return this.getOption("image-quality");
} }
getImageQualityEnum( getImageQualityEnum(
@ -631,7 +659,7 @@ export default class Connection {
// @ts-ignore // @ts-ignore
async function testDelay() { async function testDelay() {
const ws = new Websock(getDefaultUri(false)); const ws = new Websock(getDefaultUri(false), true);
await ws.open(); await ws.open();
console.log(ws.latency()); console.log(ws.latency());
} }

View File

@ -684,12 +684,12 @@ export const KEY_MAP: any = {
"VK_RBRACKET": "]", "VK_RBRACKET": "]",
"VK_BACKSLASH": "\\", "VK_BACKSLASH": "\\",
"VK_MINUS": "-", "VK_MINUS": "-",
"VK_PLUS": "= // it is =, but sciter return VK_PLUS", "VK_PLUS": "=",
"VK_DIVIDE": "Divide // numpad", "VK_DIVIDE": "Divide",
"VK_MULTIPLY": "Multiply // numpad", "VK_MULTIPLY": "Multiply",
"VK_SUBTRACT": "Subtract // numpad", "VK_SUBTRACT": "Subtract",
"VK_ADD": "Add // numpad", "VK_ADD": "Add",
"VK_DECIMAL": "Decimal // numpad", "VK_DECIMAL": "Decimal",
"VK_F1": "F1", "VK_F1": "F1",
"VK_F2": "F2", "VK_F2": "F2",
"VK_F3": "F3", "VK_F3": "F3",

View File

@ -14,12 +14,15 @@ window.getRgba = () => {
currentFrame = undefined; currentFrame = undefined;
return tmp || null; return tmp || null;
} }
window.getLanguage = () => navigator.language;
window.isMobile = () => { window.isMobile = () => {
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4)); || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4));
} }
export function isDesktop() {
return !isMobile;
}
export function msgbox(type, title, text) { export function msgbox(type, title, text) {
if (!events) return; if (!events) return;
if (!type || (type == 'error' && !text)) return; if (!type || (type == 'error' && !text)) return;

View File

@ -642,6 +642,7 @@ export interface LoginRequest {
option: OptionMessage | undefined; option: OptionMessage | undefined;
file_transfer: FileTransfer | undefined; file_transfer: FileTransfer | undefined;
port_forward: PortForward | undefined; port_forward: PortForward | undefined;
video_ack_required: boolean;
} }
export interface ChatMessage { export interface ChatMessage {
@ -944,6 +945,7 @@ export interface Misc {
close_reason: string | undefined; close_reason: string | undefined;
refresh_video: boolean | undefined; refresh_video: boolean | undefined;
option_response: OptionResponse | undefined; option_response: OptionResponse | undefined;
video_received: boolean | undefined;
} }
export interface Message { export interface Message {
@ -1521,6 +1523,7 @@ function createBaseLoginRequest(): LoginRequest {
option: undefined, option: undefined,
file_transfer: undefined, file_transfer: undefined,
port_forward: undefined, port_forward: undefined,
video_ack_required: false,
}; };
} }
@ -1556,6 +1559,9 @@ export const LoginRequest = {
writer.uint32(66).fork() writer.uint32(66).fork()
).ldelim(); ).ldelim();
} }
if (message.video_ack_required === true) {
writer.uint32(72).bool(message.video_ack_required);
}
return writer; return writer;
}, },
@ -1587,6 +1593,9 @@ export const LoginRequest = {
case 8: case 8:
message.port_forward = PortForward.decode(reader, reader.uint32()); message.port_forward = PortForward.decode(reader, reader.uint32());
break; break;
case 9:
message.video_ack_required = reader.bool();
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;
@ -1612,6 +1621,9 @@ export const LoginRequest = {
port_forward: isSet(object.port_forward) port_forward: isSet(object.port_forward)
? PortForward.fromJSON(object.port_forward) ? PortForward.fromJSON(object.port_forward)
: undefined, : undefined,
video_ack_required: isSet(object.video_ack_required)
? Boolean(object.video_ack_required)
: false,
}; };
}, },
@ -1636,6 +1648,8 @@ export const LoginRequest = {
(obj.port_forward = message.port_forward (obj.port_forward = message.port_forward
? PortForward.toJSON(message.port_forward) ? PortForward.toJSON(message.port_forward)
: undefined); : undefined);
message.video_ack_required !== undefined &&
(obj.video_ack_required = message.video_ack_required);
return obj; return obj;
}, },
@ -1659,6 +1673,7 @@ export const LoginRequest = {
object.port_forward !== undefined && object.port_forward !== null object.port_forward !== undefined && object.port_forward !== null
? PortForward.fromPartial(object.port_forward) ? PortForward.fromPartial(object.port_forward)
: undefined; : undefined;
message.video_ack_required = object.video_ack_required ?? false;
return message; return message;
}, },
}; };
@ -4466,6 +4481,7 @@ function createBaseMisc(): Misc {
close_reason: undefined, close_reason: undefined,
refresh_video: undefined, refresh_video: undefined,
option_response: undefined, option_response: undefined,
video_received: undefined,
}; };
} }
@ -4510,6 +4526,9 @@ export const Misc = {
writer.uint32(90).fork() writer.uint32(90).fork()
).ldelim(); ).ldelim();
} }
if (message.video_received !== undefined) {
writer.uint32(96).bool(message.video_received);
}
return writer; return writer;
}, },
@ -4553,6 +4572,9 @@ export const Misc = {
reader.uint32() reader.uint32()
); );
break; break;
case 12:
message.video_received = reader.bool();
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;
@ -4587,6 +4609,9 @@ export const Misc = {
option_response: isSet(object.option_response) option_response: isSet(object.option_response)
? OptionResponse.fromJSON(object.option_response) ? OptionResponse.fromJSON(object.option_response)
: undefined, : undefined,
video_received: isSet(object.video_received)
? Boolean(object.video_received)
: undefined,
}; };
}, },
@ -4620,6 +4645,8 @@ export const Misc = {
(obj.option_response = message.option_response (obj.option_response = message.option_response
? OptionResponse.toJSON(message.option_response) ? OptionResponse.toJSON(message.option_response)
: undefined); : undefined);
message.video_received !== undefined &&
(obj.video_received = message.video_received);
return obj; return obj;
}, },
@ -4651,6 +4678,7 @@ export const Misc = {
object.option_response !== undefined && object.option_response !== null object.option_response !== undefined && object.option_response !== null
? OptionResponse.fromPartial(object.option_response) ? OptionResponse.fromPartial(object.option_response)
: undefined; : undefined;
message.video_received = object.video_received ?? undefined;
return message; return message;
}, },
}; };

View File

@ -51,6 +51,7 @@ if (app) {
const conn = globals.newConn(); const conn = globals.newConn();
conn.setMsgbox(msgbox); conn.setMsgbox(msgbox);
conn.setDraw((f) => { conn.setDraw((f) => {
globals.draw(f);
player.drawFrame(f); player.drawFrame(f);
}); });
document.querySelector('div#status').style.display = 'block'; document.querySelector('div#status').style.display = 'block';

View File

@ -7,13 +7,19 @@ type Keys = "message" | "open" | "close" | "error";
export default class Websock { export default class Websock {
_websocket: WebSocket; _websocket: WebSocket;
_eventHandlers: { [key in Keys]: Function }; _eventHandlers: { [key in Keys]: Function };
_buf: Uint8Array[]; _buf: (rendezvous.RendezvousMessage | message.Message)[];
_status: any; _status: any;
_latency: number; _latency: number;
_secretKey: [Uint8Array, number, number] | undefined; _secretKey: [Uint8Array, number, number] | undefined;
_uri: string; _uri: string;
_isRendezvous: boolean;
_videoCallback: ((v: message.VideoFrame) => void) | undefined;
constructor(uri: string) { constructor(
uri: string,
isRendezvous: boolean = true,
fn: ((v: message.VideoFrame) => void) | undefined = undefined
) {
this._eventHandlers = { this._eventHandlers = {
message: (_: any) => {}, message: (_: any) => {},
open: () => {}, open: () => {},
@ -27,6 +33,8 @@ export default class Websock {
this._websocket.onmessage = this._recv_message.bind(this); this._websocket.onmessage = this._recv_message.bind(this);
this._websocket.binaryType = "arraybuffer"; this._websocket.binaryType = "arraybuffer";
this._latency = new Date().getTime(); this._latency = new Date().getTime();
this._isRendezvous = isRendezvous;
this._videoCallback = fn;
} }
latency(): number { latency(): number {
@ -98,7 +106,7 @@ export default class Websock {
this._websocket.onclose = (e) => { this._websocket.onclose = (e) => {
if (this._status == "open") { if (this._status == "open") {
// e.code 1000 means that the connection was closed normally. // e.code 1000 means that the connection was closed normally.
reject('Reset by the peer'); reject("Reset by the peer");
} }
this._status = e; this._status = e;
console.error("WebSock.onclose: " + e); console.error("WebSock.onclose: " + e);
@ -112,14 +120,16 @@ export default class Websock {
this._status = e; this._status = e;
console.error("WebSock.onerror: " + e); console.error("WebSock.onerror: " + e);
this._eventHandlers.error(e); this._eventHandlers.error(e);
reject(e['data']); reject(e["data"]);
}; };
}); });
} }
async next(timeout = 12000): Promise<Uint8Array> { async next(
timeout = 12000
): Promise<rendezvous.RendezvousMessage | message.Message> {
const func = ( const func = (
resolve: (value: Uint8Array) => void, resolve: (value: rendezvous.RendezvousMessage | message.Message) => void,
reject: (reason: any) => void, reject: (reason: any) => void,
tm0: number tm0: number
) => { ) => {
@ -166,7 +176,16 @@ export default class Websock {
k[2] += 1; k[2] += 1;
bytes = globals.decrypt(bytes, k[2], k[0]); bytes = globals.decrypt(bytes, k[2], k[0]);
} }
this._buf.push(bytes); if (this._isRendezvous) {
this._buf.push(this.parseRendezvous(bytes));
} else {
const m = this.parseMessage(bytes);
if (this._videoCallback && m.video_frame) {
this._videoCallback(m.video_frame);
} else {
this._buf.push(m);
}
}
} }
this._eventHandlers.message(e.data); this._eventHandlers.message(e.data);
} }

View File

@ -2,13 +2,6 @@
# yarn lockfile v1 # yarn lockfile v1
"@babel/runtime@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa"
integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==
dependencies:
regenerator-runtime "^0.13.4"
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf"
@ -251,13 +244,6 @@ object-hash@^1.3.1:
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df"
integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==
ogv@^1.8.6:
version "1.8.6"
resolved "https://registry.yarnpkg.com/ogv/-/ogv-1.8.6.tgz#0e6fa1c166802e3a405b1b318d8eb27d2544cce9"
integrity sha512-YuvO37U7Hc0mIm/TyAbyn3qVDKgg+4b+ViU73qEGzEKVX8bdxEVH08SoYrGLTJ2b8Z1/IEx8Vdy0hO4CWhRMOA==
dependencies:
"@babel/runtime" "^7.16.7"
path-parse@^1.0.7: path-parse@^1.0.7:
version "1.0.7" version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
@ -301,11 +287,6 @@ protobufjs@^6.8.8:
"@types/node" ">=13.7.0" "@types/node" ">=13.7.0"
long "^4.0.0" long "^4.0.0"
regenerator-runtime@^0.13.4:
version "0.13.9"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52"
integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==
resolve@^1.20.0: resolve@^1.20.0:
version "1.21.0" version "1.21.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.21.0.tgz#b51adc97f3472e6a5cf4444d34bc9d6b9037591f" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.21.0.tgz#b51adc97f3472e6a5cf4444d34bc9d6b9037591f"

4
yuv.js
View File

@ -11,7 +11,6 @@ var yPtr, yPtrLen, uPtr, uPtrLen, vPtr, vPtrLen, outPtr, outPtrLen;
let testSpeed = [0, 0]; let testSpeed = [0, 0];
function I420ToARGB(yb) { function I420ToARGB(yb) {
if (!wasmExports) return; if (!wasmExports) return;
testSpeed[0] += 1;
var tm0 = new Date().getTime(); var tm0 = new Date().getTime();
var { malloc, free, memory } = wasmExports; var { malloc, free, memory } = wasmExports;
var HEAPU8 = new Uint8Array(memory.buffer); var HEAPU8 = new Uint8Array(memory.buffer);
@ -50,8 +49,9 @@ function I420ToARGB(yb) {
var res = wasmExports.yuv420_rgb24_std(w, h, yPtr, uPtr, vPtr, yb.y.stride, yb.v.stride, outPtr, w * 4, 1); var res = wasmExports.yuv420_rgb24_std(w, h, yPtr, uPtr, vPtr, yb.y.stride, yb.v.stride, outPtr, w * 4, 1);
var out = HEAPU8.slice(outPtr, outPtr + n); var out = HEAPU8.slice(outPtr, outPtr + n);
testSpeed[1] += new Date().getTime() - tm0; testSpeed[1] += new Date().getTime() - tm0;
testSpeed[0] += 1;
if (testSpeed[0] > 30) { if (testSpeed[0] > 30) {
console.log(testSpeed[1] / testSpeed[0]); console.log('yuv: ' + parseInt('' + testSpeed[1] / testSpeed[0]));
testSpeed = [0, 0]; testSpeed = [0, 0];
} }
return out; return out;

View File

@ -7,6 +7,9 @@
// //
#include <wasm_simd128.h> #include <wasm_simd128.h>
typedef __i64x2 __m128i;
#define _mm_load_si128 wasm_v128_load
#include <stdio.h> #include <stdio.h>