You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
595 KiB
1 line
595 KiB
2 years ago
|
var WORKER_ENABLED=!!(window.URL&&window.Blob&&window.Worker);function __GET_FUNC_BODY__(A){return A.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function __GLUE_EXEC__(C){var Q=!1;try{Q=!!new SharedArrayBuffer(0)}catch(A){}var A="function"==typeof importScripts,I="__CODE_BRIDGE__"+ +new Date;(A?self:window)[I]={onHeader:function(A){C.postMessage({type:"header",data:A})},onMediaInfo:function(A){C.postMessage({type:"mediaInfo",data:A})},onAudioDataSize:function(A){C.audioBufferSize=A.size,C.audioBuffer=C._malloc(C.audioBufferSize),C._codecSetAudioBuffer(C.audioBuffer)},onAudioData:function(A){var B=A.timestamp;C.audioTimestamps.push(B);var I=C.HEAPU8.subarray(C.audioBuffer,C.audioBuffer+C.audioBufferSize),g=null;Q?(g=new Uint8Array(new SharedArrayBuffer(I.byteLength))).set(I):g=new Uint8Array(I),C._free(C.audioBuffer),C.audioBuffer=null,C.postMessage({type:"audio",data:{buffer:g.buffer,timestamp:B}},Q?void 0:[g.buffer])},onVideoDataSize:function(A){null==C.videoBuffer&&(C.videoBufferSize=A.size,C.videoBuffer=C._malloc(C.videoBufferSize),Q&&(C.videoSharedBuffer=new SharedArrayBuffer(A.size))),C._codecSetVideoBuffer(C.videoBuffer)},onVideoData:function(A){var B=A.timestamp;C.videoTimestamps.push(B);var I=C.HEAPU8.subarray(C.videoBuffer,C.videoBuffer+C.videoBufferSize),g=null;Q?(g=new Uint8Array(C.videoSharedBuffer)).set(I):g=new Uint8Array(I),C.postMessage({type:"video",data:{buffer:g.buffer,timestamp:B,width:A.width,height:A.height,stride0:A.stride0,stride1:A.stride1}},Q?void 0:[g.buffer])},onComplete:function(){C.postMessage({type:"complete"})}};var B={audioTimestamps:[],videoTimestamps:[],audioBufferSize:0,videoBufferSize:0,audioBuffer:null,videoBuffer:null,postMessage:A?postMessage.bind(self):function(){},onRuntimeInitialized:function(){C._codecInit();var A=(A=I.split("")).map(function(A){return A.charCodeAt(0)}).concat(0),B=C._malloc(A.length-1);C.HEAPU8.set(A,B),C._codecSetBridgeName(B),C.postMessage({type:"ready"})}};for(var g in C=C||{},B)B.hasOwnProperty(g)&&(C[g]=B[g]);C.onmessage=function(A){switch((I=A.data).type){case"decode":var B=new Uint8Array(I.buffer),I=C._malloc(B.length);C.HEAPU8.set(B,I);var g=+new Date;C.audioTimestamps=[],C.videoTimestamps=[],C._codecDecode(I,B.length);var Q=C.audioTimestamps,E=C.videoTimestamps;C.postMessage({type:"decode",data:{consume:new Date-g,duration:Math.max(0<Q.length?Q[Q.length-1]-Q[0]:0,0<E.length?E[E.length-1]-E[0]:0)}}),C._free(I);break;case"destroy":C.audioBuffer&&C._free(C.audioBuffer),C.videoBuffer&&C._free(C.videoBuffer),C._codecFree(),C.postMessage({type:"destroy"})}},A&&(self.onmessage=C.onmessage)}function __CODEC_EXEC__(A){var D,B,C=C||(void 0!==A?A:{}),I={};for(B in C)C.hasOwnProperty(B)&&(I[B]=C[B]);var o="./this.program",i=!1,w=!1,i="object"==typeof window,w="function"==typeof importScripts;if(C.ENVIRONMENT)throw Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var g,Q="";if(!i&&!w)throw Error("environment detection error");if(w?Q=self.location.href:document.currentScript&&(Q=document.currentScript.src),Q=0!==Q.indexOf("blob:")?Q.substr(0,Q.lastIndexOf("/")+1):"","object"!=typeof window&&"function"!=typeof importScripts)throw Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");w&&(g=function(B){try{var A=new XMLHttpRequest;return A.open("GET",B,!1),A.responseType="arraybuffer",A.send(null),new Uint8Array(A.response)}catch(A){if(B=YA(B))return B;throw A}});var E=C.print||console.log.bind(console),F=C.printErr||console.warn.bind(console);for(B in I)I.hasOwnProperty(B)&&(C[B]=I[B]);function G(A){c(q);var B=L[q>>2];return(A=B+A+15&-16)>sA()&&FB("failure to dynamicAlloc - memory growth etc. is not supported there, call malloc/sbrk directly"),L[q>>2]=A,B}function R(A){(y=y||{})[A]||(y[A]=1,F(A))}I=null,Object.getOwnPropertyDescriptor(C,"arguments")||Object.defineProperty(C,"arguments",{g
|