绍兴公厕前端
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.

0 lines
1.2 KiB

3 years ago
  1. "use strict";function H264Decoder(){function a(){debug.log("Construct H264 Codec"),b=Module.cwrap("init_jsFFmpeg","void",[]),c=Module.cwrap("context_jsFFmpeg","number",["number"]),d=Module.cwrap("decode_video_jsFFmpeg","number",["number","array","number","number"]),e=Module.cwrap("get_width","number",["number"]),f=Module.cwrap("get_height","number",["number"]),g=Module.cwrap("close_jsFFmpeg","number",["number"]),b(),a.prototype.init(),a.prototype.setIsFirstFrame(!1)}var b=null,c=null,d=null,e=null,f=null,g=null,h=null,i=null,j=264,k=!1;return a.prototype={init:function(){debug.log("H264 Decoder init"),null!==h&&(g(h),h=null),h=c(j)},setOutputSize:function(a){var b=1.5*a,c=Module._malloc(b);i=new Uint8Array(Module.HEAPU8.buffer,c,b)},decode:function(b){var c=null,g=null,j=null,k=null,l=103==b[4]?"I":"P";c=Date.now(),d(h,b,b.length,i.byteOffset),g=Date.now()-c;var m=e(h),n=f(h);if(!a.prototype.isFirstFrame())return a.prototype.setIsFirstFrame(!0),j={firstFrame:!0};if(m>0&&n>0){var o=new Uint8Array(i);return j={data:o,bufferIdx:k,width:m,height:n,codecType:"h264",decodingTime:g,frameType:l}}},setIsFirstFrame:function(a){k=a},isFirstFrame:function(){return k}},new a}