Files
xzlz_jbWeb/jb/static/js/huaweiSDK/yuv-player.js

1 line
14 KiB
JavaScript
Raw Normal View History

2025-07-21 21:18:57 +08:00
;(()=>{!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).MSP_PLAYER=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function r(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=s()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&l(r,n.prototype),r},u.apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return u(e,arguments,a(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),l(i,e)},c(e)}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}var f=function(){function e(t){n(this,e),this.canvas=t,this.gl=t.getContext("webgl")||t.getContext("experimental-webgl"),this._init()}return r(e,[{key:"_init",value:function(){var e=this.gl;if(e){e.pixelStorei(e.UNPACK_ALIGNMENT,1);var t=this._compileShader("\n attribute lowp vec4 a_vertexPosition;\n attribute vec2 a_texturePosition;\n varying vec2 v_texCoord;\n void main() {\n gl_Position = a_vertexPosition;\n v_texCoord = a_texturePosition;\n }\n ",e.VERTEX_SHADER),n=this._compileShader("\n precision lowp float;\n uniform sampler2D samplerY;\n uniform sampler2D samplerU;\n uniform sampler2D samplerV;\n varying vec2 v_texCoord;\n void main() {\n float r,g,b,y,u,v,fYmul;\n y = texture2D(samplerY, v_texCoord).r;\n u = texture2D(samplerU, v_texCoord).r;\n v = texture2D(samplerV, v_texCoord).r;\n \n fYmul = y * 1.1643828125;\n r = fYmul + 1.59602734375 * v - 0.870787598;\n g = fYmul - 0.39176