var JSMpeg={Player:null,VideoElement:null,BitBuffer:null,Source:{},Demuxer:{},Decoder:{},Renderer:{},AudioOutput:{},Now:function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;t',A.UNMUTE_BUTTON='',A}(),JSMpeg.Player=function(){var A=function(A,t){if(this.options=t||{},t.source?(this.source=new t.source(A,t),t.streaming=!!this.source.streaming):A.match(/^wss?:\/\//)?(this.source=new JSMpeg.Source.WebSocket(A,t),t.streaming=!0):!1!==t.progressive?(this.source=new JSMpeg.Source.AjaxProgressive(A,t),t.streaming=!1):(this.source=new JSMpeg.Source.Ajax(A,t),t.streaming=!1),this.maxAudioLag=t.maxAudioLag||.25,this.loop=!1!==t.loop,this.autoplay=!!t.autoplay||t.streaming,this.demuxer=new JSMpeg.Demuxer.TS(t),this.source.connect(this.demuxer),!t.disableWebAssembly&&JSMpeg.WASMModule.IsSupported()&&(this.wasmModule=JSMpeg.WASMModule.GetModule(),t.wasmModule=this.wasmModule),!1!==t.video&&(this.video=t.wasmModule?new JSMpeg.Decoder.MPEG1VideoWASM(t):new JSMpeg.Decoder.MPEG1Video(t),this.renderer=!t.disableGl&&JSMpeg.Renderer.WebGL.IsSupported()?new JSMpeg.Renderer.WebGL(t):new JSMpeg.Renderer.Canvas2D(t),this.demuxer.connect(JSMpeg.Demuxer.TS.STREAM.VIDEO_1,this.video),this.video.connect(this.renderer)),!1!==t.audio&&JSMpeg.AudioOutput.WebAudio.IsSupported()&&(this.audio=t.wasmModule?new JSMpeg.Decoder.MP2AudioWASM(t):new JSMpeg.Decoder.MP2Audio(t),this.audioOut=new JSMpeg.AudioOutput.WebAudio(t),this.demuxer.connect(JSMpeg.Demuxer.TS.STREAM.AUDIO_1,this.audio),this.audio.connect(this.audioOut)),Object.defineProperty(this,"currentTime",{get:this.getCurrentTime,set:this.setCurrentTime}),Object.defineProperty(this,"volume",{get:this.getVolume,set:this.setVolume}),this.paused=!0,this.unpauseOnShow=!1,!1!==t.pauseWhenHidden&&document.addEventListener("visibilitychange",this.showHide.bind(this)),this.wasmModule)if(this.wasmModule.ready)this.startLoading();else if(JSMpeg.WASM_BINARY_INLINED){var i=JSMpeg.Base64ToArrayBuffer(JSMpeg.WASM_BINARY_INLINED);this.wasmModule.loadFromBuffer(i,this.startLoading.bind(this))}else this.wasmModule.loadFromFile("jsmpeg.wasm",this.startLoading.bind(this));else this.startLoading()};return A.prototype.startLoading=function(){this.source.start(),this.autoplay&&this.play()},A.prototype.showHide=function(A){"hidden"===document.visibilityState?(this.unpauseOnShow=this.wantsToPlay,this.pause()):this.unpauseOnShow&&this.play()},A.prototype.play=function(A){this.animationId||(this.animationId=requestAnimationFrame(this.update.bind(this)),this.wantsToPlay=!0,this.paused=!1)},A.prototype.pause=function(A){this.paused||(cancelAnimationFrame(this.animationId),this.animationId=null,this.wantsToPlay=!1,this.isPlaying=!1,this.paused=!0,this.audio&&this.audio.canPlay&&(this.audioOut.stop(),this.seek(this.currentTime)),this.options.onPause&&this.options.onPause(this))},A.prototype.getVolume=function(){return this.audioOut?this.audioOut.volume:0},A.prototype.setVolume=function(A){this.audioOut&&(this.audioOut.volume=A)},A.prototype.stop=function(A){this.pause(),this.seek(0),this.video&&!1!==this.options.decodeFirstFrame&&this.video.decode()},A.prototype.destroy=function(){this.pause(),this.source.destroy(),this.video&&this.video.destroy(),this.renderer&&this.renderer.destroy(),this.audio&&this.audio.destroy(),this.audioOut&&this.audioOut.destroy()},A.prototype.seek=function(A){var t=this.audio&&this.audio.canPlay?this.audio.startTime:this.video.startTime;this.video&&this.video.seek(A+t),this.audio&&this.audio.seek(A+t),this.startTime=JSMpeg.Now()-A},A.prototype.getCurrentTime=function(){return this.audio&&this.audio.canPlay?this.audio.currentTime-this.audio.startTime:this.video.currentTime-this.video.startTime},A.prototype.setCurrentTime=function(A){this.seek(A)},A.prototype.update=function(){this.animationId=requestAnimationFrame(this.update.bind(this)),this.source.established?(this.isPlaying||(this.isPlaying=!0,this.startTime=JSMpeg.Now()-this.currentTime,this.options.onPlay&&this.options.onPlay(this)),this.options.streaming?this.updateForStreaming():this.updateForStaticFile()):this.renderer&&this.renderer.renderProgress(this.source.progress)},A.prototype.updateForStreaming=function(){if(this.video&&this.video.decode(),this.audio){var A=!1;do{this.audioOut.enqueuedTime>this.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},A.prototype.nextFrame=function(){return!(!this.source.established||!this.video)&&this.video.decode()},A.prototype.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*o&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.pause(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),JSMpeg.BitBuffer=function(){var A=function(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0};return A.prototype.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},A.prototype.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength=this.byteLength-t,this.index-=t<<3)},A.prototype.write=function(t){var i="object"==typeof t[0],e=0,o=this.bytes.length-this.byteLength;if(i){e=0;for(var g=0;go)if(this.mode===A.MODE.EXPAND){var I=Math.max(2*this.bytes.length,e-o);this.resize(I)}else this.evict(e);if(i)for(g=0;g>3;A>3;return A>=this.byteLength||0==this.bytes[A]&&0==this.bytes[A+1]&&1==this.bytes[A+2]},A.prototype.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),o=e>3]&255>>8-o<>g,t+=o,A-=o}return i},A.prototype.read=function(A){var t=this.peek(A);return this.index+=A,t},A.prototype.skip=function(A){return this.index+=A},A.prototype.rewind=function(A){this.index=Math.max(this.index-A,0)},A.prototype.has=function(A){return(this.byteLength<<3)-this.index>=A},A.MODE={EVICT:1,EXPAND:2},A}(),JSMpeg.Source.Ajax=function(){var A=function(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!1,this.completed=!1,this.established=!1,this.progress=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted};return A.prototype.connect=function(A){this.destination=A},A.prototype.start=function(){this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){this.request.readyState===this.request.DONE&&200===this.request.status&&this.onLoad(this.request.response)}.bind(this),this.request.onprogress=this.onProgress.bind(this),this.request.open("GET",this.url),this.request.responseType="arraybuffer",this.request.send()},A.prototype.resume=function(A){},A.prototype.destroy=function(){this.request.abort()},A.prototype.onProgress=function(A){this.progress=A.loaded/A.total},A.prototype.onLoad=function(A){this.established=!0,this.completed=!0,this.progress=1,this.onEstablishedCallback&&this.onEstablishedCallback(this),this.onCompletedCallback&&this.onCompletedCallback(this),this.destination&&this.destination.write(A)},A}(),JSMpeg.Source.Fetch=function(){var A=function(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted};return A.prototype.connect=function(A){this.destination=A},A.prototype.start=function(){var A={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,A).then(function(A){if(A.ok&&A.status>=200&&A.status<=299)return this.progress=1,this.established=!0,this.pump(A.body.getReader())}.bind(this)).catch((function(A){throw A}))},A.prototype.pump=function(A){return A.read().then(function(t){if(!t.done)return this.aborted?A.cancel():(this.destination&&this.destination.write(t.value.buffer),this.pump(A));this.completed=!0}.bind(this)).catch((function(A){throw A}))},A.prototype.resume=function(A){},A.prototype.abort=function(){this.aborted=!0},A}(),JSMpeg.Source.AjaxProgressive=function(){var A=function(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!1,this.completed=!1,this.established=!1,this.progress=0,this.fileSize=0,this.loadedSize=0,this.chunkSize=t.chunkSize||1048576,this.isLoading=!1,this.loadStartTime=0,this.throttled=!1!==t.throttled,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted};return A.prototype.connect=function(A){this.destination=A},A.prototype.start=function(){this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){this.request.readyState===this.request.DONE&&(this.fileSize=parseInt(this.request.getResponseHeader("Content-Length")),this.loadNextChunk())}.bind(this),this.request.onprogress=this.onProgress.bind(this),this.request.open("HEAD",this.url),this.request.send()},A.prototype.resume=function(A){!this.isLoading&&this.throttled&&(8*this.loadTime+2>A&&this.loadNextChunk())},A.prototype.destroy=function(){this.request.abort(),this.aborted=!0},A.prototype.loadNextChunk=function(){var A=this.loadedSize,t=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(A>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=JSMpeg.Now(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){this.request.readyState===this.request.DONE&&this.request.status>=200&&this.request.status<300?this.onChunkLoad(this.request.response):this.request.readyState===this.request.DONE&&this.loadFails++<3&&this.loadNextChunk()}.bind(this),0===A&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+A+"-"+t),this.request.setRequestHeader("Range","bytes="+A+"-"+t),this.request.responseType="arraybuffer",this.request.send()},A.prototype.onProgress=function(A){this.progress=A.loaded/A.total},A.prototype.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=JSMpeg.Now()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),JSMpeg.Source.WebSocket=function(){var A=function(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted};return A.prototype.connect=function(A){this.destination=A},A.prototype.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},A.prototype.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.socket=new WebSocket(this.url,this.options.protocols||null),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},A.prototype.resume=function(A){},A.prototype.onOpen=function(){this.progress=1},A.prototype.onClose=function(){this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout(function(){this.start()}.bind(this),1e3*this.reconnectInterval))},A.prototype.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),JSMpeg.Demuxer.TS=function(){var A=function(A){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0};return A.prototype.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},A.prototype.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new JSMpeg.BitBuffer(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new JSMpeg.BitBuffer(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},A.prototype.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3),t=(this.bits.read(1),this.bits.read(1)),i=(this.bits.read(1),this.bits.read(13)),e=(this.bits.read(2),this.bits.read(2)),o=(this.bits.read(4),this.pidsToStreamIds[i]);t&&o&&((h=this.pesPacketInfo[o])&&h.currentLength&&this.packetComplete(h));if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),o=this.bits.read(8),this.pidsToStreamIds[i]=o;var I=this.bits.read(16);this.bits.skip(8);var s=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),a=this.bits.index+(B<<3);if(h=this.pesPacketInfo[o]){var C=0;if(2&s){this.bits.skip(4);var Q=this.bits.read(3);this.bits.skip(1);var r=this.bits.read(15);this.bits.skip(1);var E=this.bits.read(15);this.bits.skip(1),C=(1073741824*Q+32768*r+E)/9e4,this.currentTime=C,-1===this.startTime&&(this.startTime=C)}var n=I?I-B-3:0;this.packetStart(h,C,n)}this.bits.index=a}var h;if(o)if(h=this.pesPacketInfo[o]){var d=this.bits.index>>3,c=!t&&2&e;(this.packetAddData(h,d,A)||this.guessVideoFrameEnd&&c)&&this.packetComplete(h)}}return this.bits.index=A<<3,!0},A.prototype.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},A.prototype.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},A.prototype.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},A.prototype.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255},A}(),JSMpeg.Decoder.Base=function(){var A=function(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})};return A.prototype.destroy=function(){},A.prototype.connect=function(A){this.destination=A},A.prototype.bufferGetIndex=function(){return this.bits.index},A.prototype.bufferSetIndex=function(A){this.bits.index=A},A.prototype.bufferWrite=function(A){return this.bits.write(A)},A.prototype.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},A.prototype.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bufferSetIndex(0),this.decodedTime=this.startTime)}},A.prototype.decode=function(){this.advanceDecodedTime(0)},A.prototype.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},A.prototype.getCurrentTime=function(){return this.decodedTime},A}(),JSMpeg.Decoder.MPEG1Video=function(){var A=function(A){JSMpeg.Decoder.Base.call(this,A),this.onDecodeCallback=A.onVideoDecode;var t=A.videoBufferSize||524288,i=A.streaming?JSMpeg.BitBuffer.MODE.EVICT:JSMpeg.BitBuffer.MODE.EXPAND;this.bits=new JSMpeg.BitBuffer(t,i),this.customIntraQuantMatrix=new Uint8Array(64),this.customNonIntraQuantMatrix=new Uint8Array(64),this.blockData=new Int32Array(64),this.currentFrame=0,this.decodeFirstFrame=!1!==A.decodeFirstFrame};return(A.prototype=Object.create(JSMpeg.Decoder.Base.prototype)).constructor=A,A.prototype.write=function(t,i){if(JSMpeg.Decoder.Base.prototype.write.call(this,t,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(A.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},A.prototype.decode=function(){var t=JSMpeg.Now();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(A.START.PICTURE)){this.bits.byteLength,this.bits.index;return!1}this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=JSMpeg.Now()-t;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},A.prototype.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},A.prototype.frameRate=30,A.prototype.decodeSequenceHeader=function(){var t=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=A.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),t===this.width&&i===this.height||(this.width=t,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(t,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[A.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(e=0;e<64;e++){var o=A.ZIG_ZAG[e];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},A.prototype.initBuffers=function(){this.intraQuantMatrix=A.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=A.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},A.prototype.currentY=null,A.prototype.currentCr=null,A.prototype.currentCb=null,A.prototype.pictureType=0,A.prototype.forwardY=null,A.prototype.forwardCr=null,A.prototype.forwardCb=null,A.prototype.fullPelForward=!1,A.prototype.forwardFCode=0,A.prototype.forwardRSize=0,A.prototype.forwardF=0,A.prototype.decodePicture=function(t){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=A.PICTURE_TYPE.B)){if(this.pictureType===A.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=A.START.SLICE_FIRST&&i<=A.START.SLICE_LAST;)this.decodeSlice(255&i),i=this.bits.findNextStartCode();if(-1!==i&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===A.PICTURE_TYPE.INTRA||this.pictureType===A.PICTURE_TYPE.PREDICTIVE){var e=this.forwardY,o=this.forwardY32,g=this.forwardCr,I=this.forwardCr32,s=this.forwardCb,B=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=e,this.currentY32=o,this.currentCr=g,this.currentCr32=I,this.currentCb=s,this.currentCb32=B}}},A.prototype.quantizerScale=0,A.prototype.sliceBegin=!1,A.prototype.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},A.prototype.macroblockAddress=0,A.prototype.mbRow=0,A.prototype.mbCol=0,A.prototype.macroblockType=0,A.prototype.macroblockIntra=!1,A.prototype.macroblockMotFw=!1,A.prototype.motionFwH=0,A.prototype.motionFwV=0,A.prototype.motionFwHPrev=0,A.prototype.motionFwVPrev=0,A.prototype.decodeMacroblock=function(){for(var t=0,i=this.readHuffman(A.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(A.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)t+=33,i=this.readHuffman(A.MACROBLOCK_ADDRESS_INCREMENT);if(t+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=t;else{if(this.macroblockAddress+t>=this.mbSize)return;for(t>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===A.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));t>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),t--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=A.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,0!=(16&this.macroblockType)&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var o=0!=(2&this.macroblockType)?this.readHuffman(A.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,g=0,I=32;g<6;g++)0!=(o&I)&&this.decodeBlock(g),I>>=1},A.prototype.decodeMotionVectors=function(){var t,i,e=0;this.macroblockMotFw?(0!==(t=this.readHuffman(A.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(t)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(t=this.readHuffman(A.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(t)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===A.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},A.prototype.copyMacroblock=function(A,t,i,e,o){var g,I,s,B,a,C,Q,r,E,n,h,d,c,p,u,l,D,w,y,f=this.currentY32,m=this.currentCb32,M=this.currentCr32;if(I=(g=this.codedWidth)-16,s=A>>1,B=t>>1,a=1==(1&A),C=1==(1&t),Q=((this.mbRow<<4)+B)*g+(this.mbCol<<4)+s,E=(r=this.mbRow*g+this.mbCol<<2)+(g<<2),a)if(C)for(;r>2&255,c|=(h=i[++Q]+i[Q+g])+d+2<<6&65280,c|=h+(d=i[++Q]+i[Q+g])+2<<14&16711680,h=i[++Q]+i[Q+g],Q++,c|=h+d+2<<22&4278190080,f[r++]=c;r+=I>>2,Q+=I-1}else for(;r>1&255,c|=(h=i[Q++])+d+1<<7&65280,c|=h+(d=i[Q++])+1<<15&16711680,c|=(h=i[Q++])+d+1<<23&4278190080,f[r++]=c;r+=I>>2,Q+=I-1}else if(C)for(;r>1&255,c|=i[++Q]+i[Q+g]+1<<7&65280,c|=i[++Q]+i[Q+g]+1<<15&16711680,c|=i[++Q]+i[Q+g]+1<<23&4278190080,Q++,f[r++]=c;r+=I>>2,Q+=I}else for(;r>2,Q+=I}if(I=(g=this.halfWidth)-8,s=A/2>>1,B=t/2>>1,a=1==(A/2&1),C=1==(t/2&1),Q=((this.mbRow<<3)+B)*g+(this.mbCol<<3)+s,E=(r=this.mbRow*g+this.mbCol<<1)+(g<<1),a)if(C)for(;r>2&255,y=D+(w=o[Q]+o[Q+g])+2>>2&255,l|=(p=e[++Q]+e[Q+g])+u+2<<6&65280,y|=(D=o[Q]+o[Q+g])+w+2<<6&65280,l|=p+(u=e[++Q]+e[Q+g])+2<<14&16711680,y|=D+(w=o[Q]+o[Q+g])+2<<14&16711680,p=e[++Q]+e[Q+g],D=o[Q]+o[Q+g],Q++,l|=p+u+2<<22&4278190080,y|=D+w+2<<22&4278190080,M[r]=l,m[r]=y,r++;r+=I>>2,Q+=I-1}else for(;r>1&255,y=D+(w=o[Q++])+1>>1&255,l|=(p=e[Q])+u+1<<7&65280,y|=(D=o[Q++])+w+1<<7&65280,l|=p+(u=e[Q])+1<<15&16711680,y|=D+(w=o[Q++])+1<<15&16711680,l|=(p=e[Q])+u+1<<23&4278190080,y|=(D=o[Q++])+w+1<<23&4278190080,M[r]=l,m[r]=y,r++;r+=I>>2,Q+=I-1}else if(C)for(;r>1&255,y=o[Q]+o[Q+g]+1>>1&255,l|=e[++Q]+e[Q+g]+1<<7&65280,y|=o[Q]+o[Q+g]+1<<7&65280,l|=e[++Q]+e[Q+g]+1<<15&16711680,y|=o[Q]+o[Q+g]+1<<15&16711680,l|=e[++Q]+e[Q+g]+1<<23&4278190080,y|=o[Q]+o[Q+g]+1<<23&4278190080,Q++,M[r]=l,m[r]=y,r++;r+=I>>2,Q+=I}else for(;r>2,Q+=I}},A.prototype.dcPredictorY=0,A.prototype.dcPredictorCr=0,A.prototype.dcPredictorCb=0,A.prototype.blockData=null,A.prototype.decodeBlock=function(t){var i,e=0;if(this.macroblockIntra){var o,g;if(t<4?(o=this.dcPredictorY,g=this.readHuffman(A.DCT_DC_SIZE_LUMINANCE)):(o=4===t?this.dcPredictorCr:this.dcPredictorCb,g=this.readHuffman(A.DCT_DC_SIZE_CHROMINANCE)),g>0){var I=this.bits.read(g);this.blockData[0]=0!=(I&1<0&&0===this.bits.read(1))break;65535===r?(Q=this.bits.read(6),0===(C=this.bits.read(8))?C=this.bits.read(8):128===C?C=this.bits.read(8)-256:C>128&&(C-=256)):(Q=r>>8,C=255&r,this.bits.read(1)&&(C=-C));var E=A.ZIG_ZAG[e+=Q];e++,C<<=1,this.macroblockIntra||(C+=C<0?-1:1),0==(1&(C=C*this.quantizerScale*i[E]>>4))&&(C-=C>0?1:-1),C>2047?C=2047:C<-2048&&(C=-2048),this.blockData[E]=C*A.PREMULTIPLIER_MATRIX[E]}t<4?(s=this.currentY,a=this.codedWidth-8,B=this.mbRow*this.codedWidth+this.mbCol<<4,0!=(1&t)&&(B+=8),0!=(2&t)&&(B+=this.codedWidth<<3)):(s=4===t?this.currentCb:this.currentCr,a=(this.codedWidth>>1)-8,B=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(A.CopyValueToDestination(this.blockData[0]+128>>8,s,B,a),this.blockData[0]=0):(A.IDCT(this.blockData),A.CopyBlockToDestination(this.blockData,s,B,a),JSMpeg.Fill(this.blockData,0)):1===e?(A.AddValueToDestination(this.blockData[0]+128>>8,s,B,a),this.blockData[0]=0):(A.IDCT(this.blockData),A.AddBlockToDestination(this.blockData,s,B,a),JSMpeg.Fill(this.blockData,0)),e=0},A.CopyBlockToDestination=function(A,t,i,e){for(var o=0;o<64;o+=8,i+=e+8)t[i+0]=A[o+0],t[i+1]=A[o+1],t[i+2]=A[o+2],t[i+3]=A[o+3],t[i+4]=A[o+4],t[i+5]=A[o+5],t[i+6]=A[o+6],t[i+7]=A[o+7]},A.AddBlockToDestination=function(A,t,i,e){for(var o=0;o<64;o+=8,i+=e+8)t[i+0]+=A[o+0],t[i+1]+=A[o+1],t[i+2]+=A[o+2],t[i+3]+=A[o+3],t[i+4]+=A[o+4],t[i+5]+=A[o+5],t[i+6]+=A[o+6],t[i+7]+=A[o+7]},A.CopyValueToDestination=function(A,t,i,e){for(var o=0;o<64;o+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},A.AddValueToDestination=function(A,t,i,e){for(var o=0;o<64;o+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},A.IDCT=function(A){for(var t,i,e,o,g,I,s,B,a,C,Q,r,E,n,h,d,c,p,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],I=A[8+u]+A[56+u],s=A[24+u]+A[40+u],a=(E=(473*(o=A[8+u]-A[56+u])-196*e+128>>8)-(g=I+s))-(362*(I-s)+128>>8),n=(C=(B=A[0+u])-t)+(Q=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(r=B+t)+i,d=C-Q,c=r-i,p=-a-(473*e+196*o+128>>8),A[0+u]=g+h,A[8+u]=E+n,A[16+u]=d-a,A[24+u]=c-p,A[32+u]=c+p,A[40+u]=a+d,A[48+u]=n-E,A[56+u]=h-g;for(u=0;u<64;u+=8)t=A[4+u],i=A[2+u]+A[6+u],e=A[5+u]-A[3+u],I=A[1+u]+A[7+u],s=A[3+u]+A[5+u],a=(E=(473*(o=A[1+u]-A[7+u])-196*e+128>>8)-(g=I+s))-(362*(I-s)+128>>8),n=(C=(B=A[0+u])-t)+(Q=(362*(A[2+u]-A[6+u])+128>>8)-i),h=(r=B+t)+i,d=C-Q,c=r-i,p=-a-(473*e+196*o+128>>8),A[0+u]=g+h+128>>8,A[1+u]=E+n+128>>8,A[2+u]=d-a+128>>8,A[3+u]=c-p+128>>8,A[4+u]=c+p+128>>8,A[5+u]=a+d+128>>8,A[6+u]=n-E+128>>8,A[7+u]=h-g+128>>8},A.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],A.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),A.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),A.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),A.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),A.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),A.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),A.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),A.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),A.MACROBLOCK_TYPE=[null,A.MACROBLOCK_TYPE_INTRA,A.MACROBLOCK_TYPE_PREDICTIVE,A.MACROBLOCK_TYPE_B],A.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),A.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),A.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),A.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),A.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),A.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},A.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178},A}(),JSMpeg.Decoder.MPEG1VideoWASM=function(){var A=function(A){JSMpeg.Decoder.Base.call(this,A),this.onDecodeCallback=A.onVideoDecode,this.module=A.wasmModule,this.bufferSize=A.videoBufferSize||524288,this.bufferMode=A.streaming?JSMpeg.BitBuffer.MODE.EVICT:JSMpeg.BitBuffer.MODE.EXPAND,this.decodeFirstFrame=!1!==A.decodeFirstFrame,this.hasSequenceHeader=!1};return(A.prototype=Object.create(JSMpeg.Decoder.Base.prototype)).constructor=A,A.prototype.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},A.prototype.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},A.prototype.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},A.prototype.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},A.prototype.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),I=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(o,g,I,!1)}this.advanceDecodedTime(1/this.frameRate);var s=JSMpeg.Now()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,s),!0},A}(),JSMpeg.Decoder.MP2Audio=function(){var A=function(t){JSMpeg.Decoder.Base.call(this,t),this.onDecodeCallback=t.onAudioDecode;var i=t.audioBufferSize||131072,e=t.streaming?JSMpeg.BitBuffer.MODE.EVICT:JSMpeg.BitBuffer.MODE.EXPAND;this.bits=new JSMpeg.BitBuffer(i,e),this.left=new Float32Array(1152),this.right=new Float32Array(1152),this.sampleRate=44100,this.D=new Float32Array(1024),this.D.set(A.SYNTHESIS_WINDOW,0),this.D.set(A.SYNTHESIS_WINDOW,512),this.V=[new Float32Array(1024),new Float32Array(1024)],this.U=new Int32Array(32),this.VPos=0,this.allocation=[new Array(32),new Array(32)],this.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],this.scaleFactor=[new Array(32),new Array(32)],this.sample=[new Array(32),new Array(32)];for(var o=0;o<2;o++)for(var g=0;g<32;g++)this.scaleFactor[o][g]=[0,0,0],this.sample[o][g]=[0,0,0]};return A.prototype=Object.create(JSMpeg.Decoder.Base.prototype),A.prototype.constructor=A,A.prototype.decode=function(){var A=JSMpeg.Now(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=JSMpeg.Now()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},A.prototype.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},A.prototype.decodeFrame=function(t,i){var e=this.bits.read(11),o=this.bits.read(2),g=this.bits.read(2),I=!this.bits.read(1);if(e!==A.FRAME_SYNC||o!==A.VERSION.MPEG_1||g!==A.LAYER.II)return 0;var s=this.bits.read(4)-1;if(s>13)return 0;var B=this.bits.read(2),a=A.SAMPLE_RATE[B];if(3===B)return 0;o===A.VERSION.MPEG_2&&(B+=4,s+=14);var C=this.bits.read(1),Q=(this.bits.read(1),this.bits.read(2)),r=0;Q===A.MODE.JOINT_STEREO?r=this.bits.read(2)+1<<2:(this.bits.skip(2),r=Q===A.MODE.MONO?0:32),this.bits.skip(4),I&&this.bits.skip(16);var E=144e3*A.BIT_RATE[s]/(a=A.SAMPLE_RATE[B])+C|0,n=0,h=0;if(o===A.VERSION.MPEG_2)n=2,h=30;else{var d=Q===A.MODE.MONO?0:1,c=A.QUANT_LUT_STEP_1[d][s];h=63&(n=A.QUANT_LUT_STEP_2[c][B]),n>>=6}r>h&&(r=h);for(var p=0;p>1),S=this.VPos%128>>1;S<1024;){for(var R=0;R<32;++R)this.U[R]+=this.D[M++]*this.V[l][S++];S+=96,M+=32}for(S=1120-S,M-=480;S<1024;){for(R=0;R<32;++R)this.U[R]+=this.D[M++]*this.V[l][S++];S+=96,M+=32}for(var G=0===l?t:i,F=0;F<32;F++)G[w+F]=this.U[F]/2147418112}w+=32}}return this.sampleRate=a,E},A.prototype.readAllocation=function(t,i){var e=A.QUANT_LUT_STEP_3[i][t],o=A.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return o?A.QUANT_TAB[o-1]:0},A.prototype.readSamples=function(t,i,e){var o=this.allocation[t][i],g=this.scaleFactor[t][i][e],I=this.sample[t][i],s=0;if(o){if(63===g)g=0;else{var B=g/3|0;g=A.SCALEFACTOR_BASE[g%3]+(1<>1)>>B}var a=o.levels;o.group?(s=this.bits.read(o.bits),I[0]=s%a,s=s/a|0,I[1]=s%a,I[2]=s/a|0):(I[0]=this.bits.read(o.bits),I[1]=this.bits.read(o.bits),I[2]=this.bits.read(o.bits));var C=65536/(a+1)|0;s=((a=(a+1>>1)-1)-I[0])*C,I[0]=s*(g>>12)+(s*(4095&g)+2048>>12)>>12,s=(a-I[1])*C,I[1]=s*(g>>12)+(s*(4095&g)+2048>>12)>>12,s=(a-I[2])*C,I[2]=s*(g>>12)+(s*(4095&g)+2048>>12)>>12}else I[0]=I[1]=I[2]=0},A.MatrixTransform=function(A,t,i,e){var o,g,I,s,B,a,C,Q,r,E,n,h,d,c,p,u,l,D,w,y,f,m,M,S,R,G,F,b,k,q,J,N,L;o=A[0][t]+A[31][t],g=.500602998235*(A[0][t]-A[31][t]),I=A[1][t]+A[30][t],s=.505470959898*(A[1][t]-A[30][t]),B=A[2][t]+A[29][t],a=.515447309923*(A[2][t]-A[29][t]),C=A[3][t]+A[28][t],Q=.53104259109*(A[3][t]-A[28][t]),r=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),n=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),p=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),l=A[8][t]+A[23][t],D=.744536271002*(A[8][t]-A[23][t]),w=A[9][t]+A[22][t],y=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],m=.972568237862*(A[10][t]-A[21][t]),M=A[11][t]+A[20][t],S=1.16943993343*(A[11][t]-A[20][t]),R=A[12][t]+A[19][t],G=1.48416461631*(A[12][t]-A[19][t]),F=A[13][t]+A[18][t],b=2.05778100995*(A[13][t]-A[18][t]),k=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),L=o+(J=A[15][t]+A[16][t]),J=.502419286188*(o-J),o=I+k,k=.52249861494*(I-k),I=B+F,F=.566944034816*(B-F),B=C+R,R=.64682178336*(C-R),C=r+M,M=.788154623451*(r-M),r=n+f,f=1.06067768599*(n-f),n=d+w,w=1.72244709824*(d-w),d=p+l,l=5.10114861869*(p-l),p=L+d,d=.509795579104*(L-d),L=o+n,o=.601344886935*(o-n),n=I+r,r=.899976223136*(I-r),I=B+C,C=2.56291544774*(B-C),B=p+I,p=.541196100146*(p-I),I=L+n,n=1.30656296488*(L-n),L=B+I,B=.707106781187*(B-I),I=p+n,I+=p=.707106781187*(p-n),n=d+C,d=.541196100146*(d-C),C=o+r,r=1.30656296488*(o-r),o=n+C,C=.707106781187*(n-C),n=d+r,o+=n+=d=.707106781187*(d-r),n+=C,C+=d,r=J+l,J=.509795579104*(J-l),l=k+w,k=.601344886935*(k-w),w=F+f,f=.899976223136*(F-f),F=R+M,M=2.56291544774*(R-M),R=r+F,r=.541196100146*(r-F),F=l+w,w=1.30656296488*(l-w),l=R+F,F=.707106781187*(R-F),R=r+w,w=.707106781187*(r-w),r=J+M,J=.541196100146*(J-M),M=k+f,f=1.30656296488*(k-f),k=r+M,M=.707106781187*(r-M),r=J+f,l+=k+=r+=J=.707106781187*(J-f),k+=R+=w,R+=r+=M,r+=F,F+=M+=J,M+=w,w+=J,f=g+(N=10.1900081235*(A[15][t]-A[16][t])),g=.502419286188*(g-N),N=s+q,s=.52249861494*(s-q),q=a+b,b=.566944034816*(a-b),a=Q+G,Q=.64682178336*(Q-G),G=E+S,E=.788154623451*(E-S),S=h+m,m=1.06067768599*(h-m),h=c+y,y=1.72244709824*(c-y),c=u+D,u=5.10114861869*(u-D),D=f+c,c=.509795579104*(f-c),f=N+h,N=.601344886935*(N-h),h=q+S,S=.899976223136*(q-S),q=a+G,G=2.56291544774*(a-G),a=D+q,D=.541196100146*(D-q),q=f+h,h=1.30656296488*(f-h),f=a+q,q=.707106781187*(a-q),a=D+h,h=.707106781187*(D-h),D=c+G,G=.541196100146*(c-G),c=N+S,S=1.30656296488*(N-S),N=D+c,c=.707106781187*(D-c),D=G+S,N+=D+=S=.707106781187*(G-S),D+=c,G=c+S,c=g+u,g=.509795579104*(g-u),u=s+y,s=.601344886935*(s-y),y=b+m,m=.899976223136*(b-m),b=Q+E,E=2.56291544774*(Q-E),Q=c+b,c=.541196100146*(c-b),b=u+y,y=1.30656296488*(u-y),u=Q+b,b=.707106781187*(Q-b),Q=c+y,y=.707106781187*(c-y),c=g+E,g=.541196100146*(g-E),E=s+m,m=1.30656296488*(s-m),s=c+E,E=.707106781187*(c-E),c=g+m,f+=u+=s+=c+=g=.707106781187*(g-m),u+=N,N+=s+=Q+=y,s+=a+=h,a+=Q+=c+=E,Q+=D,D+=c+=b,c+=q,q+=b+=E+=g,b+=G,G+=E+=y,E+=h,h+=y+=g,y+=S,S+=g,i[e+48]=-L,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-l,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-o,i[e+53]=i[e+43]=-N,i[e+54]=i[e+42]=-k,i[e+55]=i[e+41]=-s,i[e+56]=i[e+40]=-I,i[e+57]=i[e+39]=-a,i[e+58]=i[e+38]=-R,i[e+59]=i[e+37]=-Q,i[e+60]=i[e+36]=-n,i[e+61]=i[e+35]=-D,i[e+62]=i[e+34]=-r,i[e+63]=i[e+33]=-c,i[e+32]=-B,i[e+0]=B,i[e+31]=-q,i[e+1]=q,i[e+30]=-F,i[e+2]=F,i[e+29]=-b,i[e+3]=b,i[e+28]=-C,i[e+4]=C,i[e+27]=-G,i[e+5]=G,i[e+26]=-M,i[e+6]=M,i[e+25]=-E,i[e+7]=E,i[e+24]=-p,i[e+8]=p,i[e+23]=-h,i[e+9]=h,i[e+22]=-w,i[e+10]=w,i[e+21]=-y,i[e+11]=y,i[e+20]=-d,i[e+12]=d,i[e+19]=-S,i[e+13]=S,i[e+18]=-J,i[e+14]=J,i[e+17]=-g,i[e+15]=g,i[e+16]=0},A.FRAME_SYNC=2047,A.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},A.LAYER={III:1,II:2,I:3},A.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},A.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),A.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),A.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),A.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),A.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],A.QUANT_TAB={A:91,B:94,C:8,D:12},A.QUANT_LUT_STEP_2=[[A.QUANT_TAB.C,A.QUANT_TAB.C,A.QUANT_TAB.D],[A.QUANT_TAB.A,A.QUANT_TAB.A,A.QUANT_TAB.A],[A.QUANT_TAB.B,A.QUANT_TAB.A,A.QUANT_TAB.B]],A.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],A.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],A.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}],A}(),JSMpeg.Decoder.MP2AudioWASM=function(){var A=function(A){JSMpeg.Decoder.Base.call(this,A),this.onDecodeCallback=A.onAudioDecode,this.module=A.wasmModule,this.bufferSize=A.audioBufferSize||131072,this.bufferMode=A.streaming?JSMpeg.BitBuffer.MODE.EVICT:JSMpeg.BitBuffer.MODE.EXPAND,this.sampleRate=0};return(A.prototype=Object.create(JSMpeg.Decoder.Base.prototype)).constructor=A,A.prototype.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},A.prototype.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},A.prototype.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},A.prototype.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},A.prototype.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},A.prototype.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},A.prototype.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},A.prototype.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},A.prototype.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},A.prototype.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},A.prototype.render=function(A,t,i,e){if(this.enabled){var o=this.gl,g=this.width+15>>4<<4,I=this.height,s=g>>1,B=I>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),o.useProgram(this.program),this.updateTexture(o.TEXTURE0,this.textureY,g,I,A),this.updateTexture(o.TEXTURE1,this.textureCb,s,B,t),this.updateTexture(o.TEXTURE2,this.textureCr,s,B,i),o.drawArrays(o.TRIANGLE_STRIP,0,4)}},A.prototype.updateTexture=function(A,t,i,e,o){var g=this.gl;g.activeTexture(A),g.bindTexture(g.TEXTURE_2D,t),this.hasTextureData[A]?g.texSubImage2D(g.TEXTURE_2D,0,0,0,i,e,g.LUMINANCE,g.UNSIGNED_BYTE,o):(this.hasTextureData[A]=!0,g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,i,e,0,g.LUMINANCE,g.UNSIGNED_BYTE,o))},A.prototype.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")},A}(),JSMpeg.Renderer.Canvas2D=function(){var A=function(A){this.canvas=A.canvas||document.createElement("canvas"),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")};return A.prototype.destroy=function(){},A.prototype.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),JSMpeg.Fill(this.imageData.data,255)},A.prototype.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},A.prototype.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},A.prototype.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var o,g,I,s,B,a=this.width+15>>4<<4,C=a>>1,Q=0,r=a,E=a+(a-this.width),n=0,h=C-(this.width>>1),d=0,c=4*this.width,p=4*this.width,u=this.width>>1,l=this.height>>1,D=0;D>8)-179,s=(88*g>>8)-44+(183*o>>8)-91,B=g+(198*g>>8)-227;var y=A[Q++],f=A[Q++];e[d]=y+I,e[d+1]=y-s,e[d+2]=y+B,e[d+4]=f+I,e[d+5]=f-s,e[d+6]=f+B,d+=8;var m=A[r++],M=A[r++];e[c]=m+I,e[c+1]=m-s,e[c+2]=m+B,e[c+4]=M+I,e[c+5]=M-s,e[c+6]=M+B,c+=8}Q+=E,r+=E,d+=p,c+=p,n+=h}},A}(),JSMpeg.AudioOutput.WebAudio=function(){var A=function(t){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})};return A.prototype.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},A.prototype.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=JSMpeg.Now();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},A.prototype.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},A.prototype.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},A.prototype.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var o=t[i++];if(A+=(127&o)*e,e*=128,!(128&o))return A}},o=function(A){for(var e=0;e