41 lines
8 KiB
JavaScript
41 lines
8 KiB
JavaScript
|
|
||
|
var OGVDecoderAudioVorbisW = (function() {
|
||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||
|
return (
|
||
|
function(OGVDecoderAudioVorbisW) {
|
||
|
OGVDecoderAudioVorbisW = OGVDecoderAudioVorbisW || {};
|
||
|
|
||
|
|
||
|
var a;a||(a=typeof OGVDecoderAudioVorbisW !== 'undefined' ? OGVDecoderAudioVorbisW : {});var g,h;a.ready=new Promise(function(b,c){g=b;h=c});var m=a,n={},p;for(p in a)a.hasOwnProperty(p)&&(n[p]=a[p]);function q(b,c){throw c;}var r="object"===typeof window,t="function"===typeof importScripts,u="",v,w,x,y,z;
|
||
|
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)u=t?require("path").dirname(u)+"/":__dirname+"/",v=function(b,c){y||(y=require("fs"));z||(z=require("path"));b=z.normalize(b);return y.readFileSync(b,c?null:"utf8")},x=function(b){b=v(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||A("Assertion failed: undefined");return b},w=function(b,c,e){y||(y=require("fs"));z||(z=require("path"));b=z.normalize(b);y.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",A),q=function(b,c){if(noExitRuntime||0<B)throw process.exitCode=b,c;process.exit(b)},a.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.lastIndexOf("/")+1):u="",v=function(b){var c=new XMLHttpRequest;
|
||
|
c.open("GET",b,!1);c.send(null);return c.responseText},t&&(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 C=a.printErr||console.warn.bind(console);
|
||
|
for(p in n)n.hasOwnProperty(p)&&(a[p]=n[p]);n=null;a.quit&&(q=a.quit);var D;a.wasmBinary&&(D=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,F=!1,G,H;function I(){var b=E.buffer;G=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=H=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}
|
||
|
var J,K=[],L=[],M=[],B=0;function aa(){var b=a.preRun.shift();K.unshift(b)}var N=0,O=null,P=null;a.preloadedImages={};a.preloadedAudios={};function A(b){if(a.onAbort)a.onAbort(b);C(b);F=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");h(b);throw b;}function Q(){return R.startsWith("data:application/octet-stream;base64,")}var R;R="ogv-decoder-audio-vorbis-wasm.wasm";if(!Q()){var S=R;R=a.locateFile?a.locateFile(S,u):u+S}
|
||
|
function ba(){var b=R;try{if(b==R&&D)return new Uint8Array(D);if(x)return x(b);throw"both async and sync fetching of the wasm failed";}catch(c){A(c)}}
|
||
|
function ca(){if(!D&&(r||t)){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 ba()});if(w)return new Promise(function(b,c){w(R,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return ba()})}
|
||
|
function T(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?J.get(e)():J.get(e)(c.o):e(void 0===c.o?null:c.o)}}}
|
||
|
var ea={a:function(b,c,e){H.copyWithin(b,c,c+e)},b:function(b){var c=H.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{E.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);I();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(b){if(!(noExitRuntime||0<B)){if(a.onExit)a.onExit(b);F=!0}q(b,new da(b))},d:function(b,c,e){var d=E.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},e:function(b,c){a.audioFormat={channels:b,rate:c};a.loadedMetadata=!0}};
|
||
|
(function(){function b(f){a.asm=f.exports;E=a.asm.f;I();J=a.asm.n;L.unshift(a.asm.g);N--;a.monitorRunDependencies&&a.monitorRunDependencies(N);0==N&&(null!==O&&(clearInterval(O),O=null),P&&(f=P,P=null,f()))}function c(f){b(f.instance)}function e(f){return ca().then(function(k){return WebAssembly.instantiate(k,d)}).then(f,function(k){C("failed to asynchronously prepare wasm: "+k);A(k)})}var d={a:ea};N++;a.monitorRunDependencies&&a.monitorRunDependencies(N);if(a.instantiateWasm)try{return a.instantiateWasm(d,
|
||
|
b)}catch(f){return C("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return D||"function"!==typeof WebAssembly.instantiateStreaming||Q()||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(h);return{}})();
|
||
|
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.g).apply(null,arguments)};a._ogv_audio_decoder_init=function(){return(a._ogv_audio_decoder_init=a.asm.h).apply(null,arguments)};a._ogv_audio_decoder_process_header=function(){return(a._ogv_audio_decoder_process_header=a.asm.i).apply(null,arguments)};a._ogv_audio_decoder_process_audio=function(){return(a._ogv_audio_decoder_process_audio=a.asm.j).apply(null,arguments)};
|
||
|
a._ogv_audio_decoder_destroy=function(){return(a._ogv_audio_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 U;function da(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}P=function fa(){U||V();U||(P=fa)};
|
||
|
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!F)){T(L);g(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();M.unshift(c)}T(M)}}if(!(0<N)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();T(K);0<N||(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 ha(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=!!m.audioFormat;a.audioFormat=m.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=ha(d);(new Uint8Array(E.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=ha(d);(new Uint8Array(E.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_audio(f,d)});c(e)};
|
||
|
a.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;
|