wvp-gb28181-project/web_src/static/js/jessibuca/index.js

3 lines
697 KiB
JavaScript
Raw Normal View History

!function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function e(t){return t&&t.__esModule?t.default:t}function r(t,e,r){Object.defineProperty(t,e,{get:r,enumerable:!0})}var i,n,o=!1;function s(){return o||(o=!0,n=t=>{var e=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n"),i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,e),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+t.getShaderInfoLog(i));var n=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+t.getShaderInfoLog(n));var o=t.createProgram();t.attachShader(o,i),t.attachShader(o,n),t.linkProgram(o),t.getProgramParameter(o,t.LINK_STATUS)||console.log("Program failed to compile: "+t.getProgramInfoLog(o)),t.useProgram(o);var s=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,s),t.bufferData(t.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),t.STATIC_DRAW);var a=t.getAttribLocation(o,"vertexPos");t.enableVertexAttribArray(a),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0);var h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),t.STATIC_DRAW);var u=t.getAttribLocation(o,"texturePos");function f(e,r){var i=t.createTexture();return t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.bindTexture(t.TEXTURE_2D,null),t.uniform1i(t.getUniformLocation(o,e),r),i}t.enableVertexAttribArray(u),t.vertexAttribPointer(u,2,t.FLOAT,!1,0,0);var l=f("ySampler",0),d=f("uSampler",1),c=f("vSampler",2);return function(e,r,i,n,o){t.viewport(0,0,e,r),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,l),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,e,r,0,t.LUMINANCE,t.UNSIGNED_BYTE,i),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,d),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,e/2,r/2,0,t.LUMINANCE,t.UNSIGNED_BYTE,n),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,c),t.texImage2D(t.TEXTURE_2D,0,t.LUMINANCE,e/2,r/2,0,t.LUMINANCE,t.UNSIGNED_BYTE,o),t.drawArrays(t.TRIANGLE_STRIP,0,4)}},r(i={},"default",(function(){return n}))),i}var a,h,u=!1;function f(){a={},s(),h=t=>{const e=document.createElement("canvas");e.style.position="absolute",e.style.top=0,e.style.left=0,t.$container.appendChild(e),t.$canvasElement=e,t.$container.style.overflow="hidden","absolute"!==t.$container.style.position&&(t.$container.style.position="relative");if(!t._supportOffscreen()){const e=(()=>{const e=t.$canvasElement;let r=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let n=0;for(;!r&&n<i.length;){const o=i[n];try{let i={preserveDrawingBuffer:!0};t._opt.contextOptions&&(i=Object.assign(i,t._opt.contextOptions)),r=e.getContext(o,i)}catch(t){r=null}r&&"function"==typeof r.getParameter||(r=null),++n}return r})();t._contextGLRender=s().default(e),t._contextGL=e}t._destroyContextGL=()=>{t._contextGL&&(t._contextGL=null),t._contextGLRender&&(t._contextGLRender=null),t._bitmaprenderer&&(t._bitmaprenderer=null)}},r(a,"default",(
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource>*/
(Jt={}).read=function(t,e,r,i,n){var o,s,a=8*n-i-1,h=(1<<a)-1,u=h>>1,f=-7,l=r?n-1:0,d=r?-1:1,c=t[e+l];for(l+=d,o=c&(1<<-f)-1,c>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=d,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+t[e+l],l+=d,f-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(c?-1:1);s+=Math.pow(2,i),o-=u}return(c?-1:1)*s*Math.pow(2,o-i)},Qt=function(t,e,r,i,n,o){var s,a,h,u=8*o-n-1,f=(1<<u)-1,l=f>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,c=i?0:o-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+l>=1?d/h:d*Math.pow(2,1-l))*h>=2&&(s++,h/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*h-1)*Math.pow(2,n),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,n),s=0));n>=8;t[r+c]=255&a,c+=p,a/=256,n-=8);for(s=s<<n|a,u+=n;u>0;t[r+c]=255&s,c+=p,s/=256,u-=8);t[r+c-p]|=128*m},Jt.write=Qt),Jt}var re,ie,ne,oe,se,ae,he,ue,fe,le=!1;function de(t){if(t>se)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,ce.prototype),e}function ce(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return ge(t)}return pe(t,e,r)}function pe(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!ce.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|Me(t,e),i=de(r),n=i.write(t,e);n!==r&&(i=i.slice(0,n));return i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Ke(t,Uint8Array)){var e=new Uint8Array(t);return be(e.buffer,e.byteOffset,e.byteLength)}return ve(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ke(t,ArrayBuffer)||t&&Ke(t.buffer,ArrayBuffer))return be(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Ke(t,SharedArrayBuffer)||t&&Ke(t.buffer,SharedArrayBuffer)))return be(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return ce.from(i,e,r);var n=function(t){if(ce.isBuffer(t)){var e=0|ye(t.length),r=de(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||We(t.length)?de(0):ve(t);if("Buffer"===t.type&&Array.isArray(t.data))return ve(t.data)}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return ce.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function me(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function ge(t){return me(t),de(t<0?0:0|ye(t))}function ve(t){for(var e=t.length<0?0:0|ye(t.length),r=de(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function be(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(i,ce.prototype),i}function ye(t){if(t>=se)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+se.toString(16)+" bytes");return 0|t}function we(t){return+t!=t&&(t=0),ce.alloc(+t)}function Me(t,e){if(ce.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ke(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Fe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le