From 3a12382b95f20a02708997f1aa6278057c36676c Mon Sep 17 00:00:00 2001 From: Stefano Brilli Date: Sat, 22 Aug 2020 10:27:47 +0200 Subject: [PATCH] Add ALAC support to FFMpeg WASM library --- extra/build-js.sh | 3 +++ public/ffmpeg-core.js | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/extra/build-js.sh b/extra/build-js.sh index 12afe50..7cb7ab2 100644 --- a/extra/build-js.sh +++ b/extra/build-js.sh @@ -57,6 +57,7 @@ configure_ffmpeg() { --disable-bsfs \ --disable-parsers \ --enable-parser=aac \ + --enable-parser=alac \ --enable-parser=ac3 \ --enable-parser=mpegaudio \ --enable-parser=vorbis \ @@ -70,6 +71,7 @@ configure_ffmpeg() { --enable-rdft \ \ --disable-demuxers \ + --enable-demuxer=alac \ --enable-demuxer=ffmetadata \ --enable-demuxer=aiff \ --enable-demuxer=oma \ @@ -128,6 +130,7 @@ configure_ffmpeg() { --enable-muxer=pcm_u24le \ \ --disable-decoders \ + --enable-decoder=alac \ --enable-decoder=opus \ --enable-decoder=aac \ --enable-decoder=ac3 \ diff --git a/public/ffmpeg-core.js b/public/ffmpeg-core.js index c290fd4..8e2ddd8 100644 --- a/public/ffmpeg-core.js +++ b/public/ffmpeg-core.js @@ -17,9 +17,9 @@ function Ia(a){if("number"===typeof a){var b=!0;var c=a}else b=!1,c=a.length;var function La(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function z(a,b){return a?La(x,a,b):""} function v(a,b,c,d){if(!(0=k){var n=a.charCodeAt(++g);k=65536+((k&1023)<<10)|n&1023}if(127>=k){if(c>=d)break;b[c++]=k}else{if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f} function Ma(a){for(var b=0,c=0;c=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");function Na(a){0>2]=7167296; +function Sa(a){buffer=a;e.HEAP8=y=new Int8Array(a);e.HEAP16=Oa=new Int16Array(a);e.HEAP32=t=new Int32Array(a);e.HEAPU8=x=new Uint8Array(a);e.HEAPU16=Pa=new Uint16Array(a);e.HEAPU32=Qa=new Uint32Array(a);e.HEAPF32=A=new Float32Array(a);e.HEAPF64=Ra=new Float64Array(a)}var va=1925312,Ta=e.TOTAL_MEMORY||33554432;e.wasmMemory?Aa=e.wasmMemory:Aa=new WebAssembly.Memory({initial:Ta/65536});Aa&&(buffer=Aa.buffer);Ta=buffer.byteLength;Sa(buffer);t[va>>2]=7168384; function Ua(a){for(;0>2]=a;break;case 2:A[c>>2]=a;break;default:throw"internal emscriptenWebGLGetUniform() error, bad type: "+d;}else for(b=0;b>2]=a[b];break;case 2:A[c+4*b>>2]=a[b];break;default:throw"internal emscriptenWebGLGetUniform() error, bad type: "+d;}else Y(1281)} function pc(a,b,c,d){if(c)if(a=Z.getVertexAttrib(a,b),34975==b)t[c>>2]=a.name;else if("number"==typeof a||"boolean"==typeof a)switch(d){case 0:t[c>>2]=a;break;case 2:A[c>>2]=a;break;case 5:t[c>>2]=Math.fround(a);break;default:throw"internal emscriptenWebGLGetVertexAttrib() error, bad type: "+d;}else for(b=0;b>2]=a[b];break;case 2:A[c+4*b>>2]=a[b];break;case 5:t[c+4*b>>2]=Math.fround(a[b]);break;default:throw"internal emscriptenWebGLGetVertexAttrib() error, bad type: "+ d;}else Y(1281)}var qc={6402:1,6406:1,6407:3,6408:4,6409:1,6410:2,35904:3,35906:4},rc={5121:1,5123:2,5125:4,5126:4,32819:2,32820:2,33635:2,34042:4,36193:2};function sc(a,b,c,d,f){if(b=qc[b]*rc[a]){var g=dc;c=f+d*(c*b+g-1&-g);switch(a){case 5121:return x.subarray(f,c);case 5126:return A.subarray(f>>2,c>>2);case 5125:case 34042:return Qa.subarray(f>>2,c>>2);case 5123:case 33635:case 32819:case 32820:case 36193:return Pa.subarray(f>>1,c>>1);default:Y(1280)}}else Y(1280)} -function tc(a){if(0===a)return 0;a=z(a);if(!H.hasOwnProperty(a))return 0;tc.Qd&&uc(tc.Qd);a=H[a];var b=Ma(a)+1,c=Ja(b);c&&v(a,y,c,b);tc.Qd=c;return tc.Qd}var vc=(v("GMT",x,1924304,4),1924304); +function tc(a){if(0===a)return 0;a=z(a);if(!H.hasOwnProperty(a))return 0;tc.Qd&&uc(tc.Qd);a=H[a];var b=Ma(a)+1,c=Ja(b);c&&v(a,y,c,b);tc.Qd=c;return tc.Qd}var vc=(v("GMT",x,1925392,4),1925392); function wc(a,b){a=new Date(1E3*t[a>>2]);t[b>>2]=a.getUTCSeconds();t[b+4>>2]=a.getUTCMinutes();t[b+8>>2]=a.getUTCHours();t[b+12>>2]=a.getUTCDate();t[b+16>>2]=a.getUTCMonth();t[b+20>>2]=a.getUTCFullYear()-1900;t[b+24>>2]=a.getUTCDay();t[b+36>>2]=0;t[b+32>>2]=0;t[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0;t[b+40>>2]=vc;return b}function xc(a){return Math.pow(2,a)}function yc(a){return Math.log(a)/Math.LN2} function zc(){function a(a){return(a=a.toTimeString().match(/\(([A-Za-z ]+)\)$/))?a[1]:"GMT"}if(!Ac){Ac=!0;t[Bc()>>2]=60*(new Date).getTimezoneOffset();var b=(new Date).getFullYear(),c=new Date(b,0,1);b=new Date(b,6,1);t[Cc()>>2]=Number(c.getTimezoneOffset()!=b.getTimezoneOffset());var d=a(c),f=a(b);d=Ia(Eb(d));f=Ia(Eb(f));b.getTimezoneOffset()>2]=d,t[Dc()+4>>2]=f):(t[Dc()>>2]=f,t[Dc()+4>>2]=d)}}var Ac; function Gc(a,b){zc();a=new Date(1E3*t[a>>2]);t[b>>2]=a.getSeconds();t[b+4>>2]=a.getMinutes();t[b+8>>2]=a.getHours();t[b+12>>2]=a.getDate();t[b+16>>2]=a.getMonth();t[b+20>>2]=a.getFullYear()-1900;t[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);t[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;t[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;t[b+32>>2]=a;a=t[Dc()+(a?4:0)>>2]; @@ -156,7 +156,7 @@ b,c){Z.uniform2f(V[a],b,c)},Ib:function(a,b,c){if(256>=2*b)for(var d=hc[2*b-1],f 2];else f=A.subarray(d>>2,d+36*b>>2);Z.uniformMatrix3fv(V[a],!!c,f)},vb:function(a,b,c,d){if(256>=16*b)for(var f=hc[16*b-1],g=0;g<16*b;g+=16)f[g]=A[d+4*g>>2],f[g+1]=A[d+(4*g+4)>>2],f[g+2]=A[d+(4*g+8)>>2],f[g+3]=A[d+(4*g+12)>>2],f[g+4]=A[d+(4*g+16)>>2],f[g+5]=A[d+(4*g+20)>>2],f[g+6]=A[d+(4*g+24)>>2],f[g+7]=A[d+(4*g+28)>>2],f[g+8]=A[d+(4*g+32)>>2],f[g+9]=A[d+(4*g+36)>>2],f[g+10]=A[d+(4*g+40)>>2],f[g+11]=A[d+(4*g+44)>>2],f[g+12]=A[d+(4*g+48)>>2],f[g+13]=A[d+(4*g+52)>>2],f[g+14]=A[d+(4*g+56)>>2],f[g+ 15]=A[d+(4*g+60)>>2];else f=A.subarray(d>>2,d+64*b>>2);Z.uniformMatrix4fv(V[a],!!c,f)},ub:function(a){Z.useProgram(U[a])},tb:function(a){Z.validateProgram(U[a])},sb:function(a,b){Z.vertexAttrib1f(a,b)},rb:function(a,b){Z.vertexAttrib1f(a,A[b>>2])},qb:function(a,b,c){Z.vertexAttrib2f(a,b,c)},pb:function(a,b){Z.vertexAttrib2f(a,A[b>>2],A[b+4>>2])},ob:function(a,b,c,d){Z.vertexAttrib3f(a,b,c,d)},nb:function(a,b){Z.vertexAttrib3f(a,A[b>>2],A[b+4>>2],A[b+8>>2])},mb:function(a,b,c,d,f){Z.vertexAttrib4f(a, b,c,d,f)},lb:function(a,b){Z.vertexAttrib4f(a,A[b>>2],A[b+4>>2],A[b+8>>2],A[b+12>>2])},kb:function(a,b){Z.vertexAttribDivisor(a,b)},jb:function(a,b,c,d,f,g){Z.vertexAttribPointer(a,b,c,!!d,f,g)},hb:function(a,b,c,d){Z.viewport(a,b,c,d)},gb:function(a,b,c){x.set(x.subarray(b,b+c),a)},fb:function(a){if(2147418112=b?b=Na(2*b):b=Math.min(Na((3*b+2147483648)/4),2147418112);a:{try{Aa.grow(b-buffer.byteLength+65535>>16);Sa(Aa.buffer);var c=1;break a}catch(d){}c= -void 0}return c?!0:!1},eb:function(a){if(!za&&(Ca=!0,e.onExit))e.onExit(a);ea(a,new qa(a))},db:B,f:tc,cb:function(a){var b=Date.now();t[a>>2]=b/1E3|0;t[a+4>>2]=b%1E3*1E3|0;return 0},bb:function(a){return wc(a,1924256)},t:wc,i:xc,d:function(a){return xc(a)},c:function(a){return Math.log(a)/Math.LN10},m:yc,e:function(a){return yc(a)},_a:cb,s:function(a){return Gc(a,1924256)},r:Gc,Za:function(a){zc();var b=new Date(t[a+20>>2]+1900,t[a+16>>2],t[a+12>>2],t[a+8>>2],t[a+4>>2],t[a>>2],0),c=t[a+32>>2],d=b.getTimezoneOffset(), +void 0}return c?!0:!1},eb:function(a){if(!za&&(Ca=!0,e.onExit))e.onExit(a);ea(a,new qa(a))},db:B,f:tc,cb:function(a){var b=Date.now();t[a>>2]=b/1E3|0;t[a+4>>2]=b%1E3*1E3|0;return 0},bb:function(a){return wc(a,1925344)},t:wc,i:xc,d:function(a){return xc(a)},c:function(a){return Math.log(a)/Math.LN10},m:yc,e:function(a){return yc(a)},_a:cb,s:function(a){return Gc(a,1925344)},r:Gc,Za:function(a){zc();var b=new Date(t[a+20>>2]+1900,t[a+16>>2],t[a+12>>2],t[a+8>>2],t[a+4>>2],t[a>>2],0),c=t[a+32>>2],d=b.getTimezoneOffset(), f=new Date(b.getFullYear(),0,1),g=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),k=f.getTimezoneOffset(),n=Math.min(k,g);0>c?t[a+32>>2]=Number(g!=k&&n==d):0>2]=b.getDay();t[a+28>>2]=(b.getTime()-f.getTime())/864E5|0;return b.getTime()/1E3|0},q:function(a,b){if(0===a)return yb(28),-1;var c=t[a>>2];a=t[a+4>>2];if(0>a||999999999c)return yb(28),-1;0!==b&&(t[b>>2]=0,t[b+4>>2]=0);b=(1E6*c+a/1E3)/1E3;if((fa||h)&&self.performance&& self.performance.now)for(c=self.performance.now();self.performance.now()-ca?-1:0=k(n(new Date(a.getFullYear(),0,4)),a)?0>=k(b,a)?a.getFullYear()+1:a.getFullYear():a.getFullYear()-1}var u=t[d+40>>2];d={ig:t[d>>2],hg:t[d+4>>2],te:t[d+