@libmedia/avplayer 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/163.avplayer.js +1 -1
- package/dist/esm/182.avplayer.js +1 -1
- package/dist/esm/195.avplayer.js +1 -1
- package/dist/esm/199.avplayer.js +1 -1
- package/dist/esm/239.avplayer.js +1 -1
- package/dist/esm/248.avplayer.js +1 -1
- package/dist/esm/26.avplayer.js +1 -1
- package/dist/esm/261.avplayer.js +1 -1
- package/dist/esm/272.avplayer.js +1 -1
- package/dist/esm/325.avplayer.js +1 -1
- package/dist/esm/33.avplayer.js +1 -1
- package/dist/esm/384.avplayer.js +1 -1
- package/dist/esm/43.avplayer.js +1 -1
- package/dist/esm/462.avplayer.js +1 -1
- package/dist/esm/502.avplayer.js +1 -1
- package/dist/esm/573.avplayer.js +1 -1
- package/dist/esm/630.avplayer.js +1 -1
- package/dist/esm/641.avplayer.js +1 -1
- package/dist/esm/735.avplayer.js +1 -1
- package/dist/esm/747.avplayer.js +1 -1
- package/dist/esm/749.avplayer.js +1 -1
- package/dist/esm/790.avplayer.js +1 -1
- package/dist/esm/794.avplayer.js +1 -1
- package/dist/esm/850.avplayer.js +1 -1
- package/dist/esm/881.avplayer.js +1 -1
- package/dist/esm/932.avplayer.js +1 -1
- package/dist/esm/943.avplayer.js +1 -1
- package/dist/esm/956.avplayer.js +1 -1
- package/dist/esm/961.avplayer.js +1 -1
- package/dist/esm/97.avplayer.js +1 -1
- package/dist/esm/991.avplayer.js +1 -1
- package/dist/esm/avplayer.js +1 -1
- package/dist/umd/248.avplayer.js +1 -1
- package/dist/umd/26.avplayer.js +1 -1
- package/dist/umd/850.avplayer.js +1 -1
- package/dist/umd/881.avplayer.js +1 -1
- package/dist/umd/932.avplayer.js +1 -1
- package/dist/umd/961.avplayer.js +1 -1
- package/dist/umd/avplayer.js +1 -1
- package/package.json +12 -12
package/dist/esm/573.avplayer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __webpack_esm_id__=573;export const __webpack_esm_ids__=[573];export const __webpack_esm_modules__={3454:(e,t,a)=>{a.d(t,{Au:()=>y,He:()=>I,XC:()=>N,Y2:()=>u,hG:()=>A,oz:()=>g});var i=a(29688);const r=[44100,48e3,32e3,0],c=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],d=[0,1152,1152,384],o=[0,576,1152,384],s=[0,576,1152,384],l=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],p=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],f=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],h=[0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],m=[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1];function u(e,t){switch(e){case 0:return n[t];case 2:return c[t];case 3:return r[t]}return i.N_}function A(e,t){switch(e){case 0:return s[t];case 2:return o[t];case 3:return d[t]}return i.N_}function g(e,t,a){switch(t){case 1:switch(e){case 0:case 2:return m[a];case 3:return f[a]}break;case 2:switch(e){case 0:case 2:return m[a];case 3:return p[a]}case 3:switch(e){case 0:case 2:return h[a];case 3:return l[a]}}return i.N_}function y(e){switch(e){case 1:return 34;case 2:return 33;case 3:return 32}return i.N_}const I={32:"Layer1",33:"Layer2",34:"Layer3"};function N(e,t){if(t&&t.length>=4){const a=t[1]>>>3&3,i=(6&t[1])>>1,r=(12&t[2])>>>2,c=3&~(t[3]>>>6)?2:1,n=y(i),d=u(a,r);e.codecpar.profile=n,e.codecpar.sampleRate=d,e.codecpar.chLayout.nbChannels=c}}},4310:(e,t,a)=>{a.d(t,{Ui:()=>c,XC:()=>r});var i=a(54809);function r(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=6){const a=c(t);e.codecpar.profile=a.profile,e.codecpar.level=a.level}}function c(e){const t=new i.A(e.length);return t.appendBuffer(e.subarray(4)),{profile:t.readU(8),level:t.readU(8),bitDepth:t.readU(4),chromaSubsampling:t.readU(3),fullRangeFlag:t.readU1(),colorPrimaries:t.readU(8),colorTrc:t.readU(8),colorSpace:t.readU(8)}}},4345:(e,t,a)=>{function i(e,t){for(let a=0;a<e.length;a++)if(e[a].privData.uid===t)return e[a]}a.d(t,{A:()=>i})},9581:(e,t,a)=>{a.d(t,{Ui:()=>n,XC:()=>c,wN:()=>r});var i=a(54809);const r={0:"Profile0",1:"Profile1",2:"Profile2",3:"Profile3"};function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=6){const a=n(t);e.codecpar.profile=a.profile,e.codecpar.level=a.level}}function n(e){const t=new i.A(e.length);return t.appendBuffer(e),{profile:t.readU(8),level:t.readU(8),bitDepth:t.readU(4),chromaSubsampling:t.readU(3),fullRangeFlag:t.readU1(),colorPrimaries:t.readU(8),colorTrc:t.readU(8),colorSpace:t.readU(8)}}},16670:(e,t,a)=>{function i(e,t){for(let a=0;a<e.length;a++)if(e[a].privData.number===t)return e[a]}a.d(t,{A:()=>i})},17689:(e,t,a)=>{a.d(t,{Ij:()=>s,XC:()=>o,kt:()=>d});var i=a(98901),r=a(70704),c=a(99248);const n=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960];function d(e){let t=0,a=0,i=0;if(e.length<1)return 0;switch(t=e[0],a=n[t>>3],3&t){case 0:i=1;break;case 1:case 2:i=2;break;case 3:if(e.length<2)return 0;i=63&e[1]}return i*a}function o(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=19){const a=new r.A(t,!1);a.skip(9),e.codecpar.chLayout.nbChannels=a.readUint8(),e.codecpar.initialPadding=a.readUint16(),e.codecpar.sampleRate=a.readUint32(),e.codecpar.seekPreroll=Number((0,i.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function s(e){const t=new Uint8Array(19),a=new c.A(t,!1);return a.writeString("OpusHead"),a.writeUint8(1),a.writeUint8(e.chLayout.nbChannels),a.writeUint16(e.initialPadding),a.writeUint32(e.sampleRate),t}},25248:(e,t,a)=>{a.r(t),a.d(t,{default:()=>H});var i=a(19371),r=a(80209),c=a(54568),n=a(56238),d=a(6927),o=a(55982),s=a(49103),l=a(35734),p=a(85183),f=a(27228),h=a(4345),m=a(16670),u=a(78753),A=a(41050),g=a(35924),y=a(46564),I=a(46626),N=a(98901),x=a(29688),b=a(64347),B=a(99817),P=a(43963),S=a(47354),v=a(73448),R=a(20642),k=a(12062),D=a(3454),C=a(17689),_=a(9581),V=a(4310),w=a(25721),M=a(84777),U=a(27376),L=a(83796),E=a(23902),T=a(34117),z=a(41662),X=a(18528),G=a(72034),O=a(70704);const F="packages/avformat/src/formats/IMatroskaFormat.ts";function W(e){e<0&&(e=BigInt(0));const t=Math.round(Number(BigInt.asIntN(32,e%BigInt(1e3)))/10),a=Number(BigInt.asIntN(32,e/BigInt(1e3)%BigInt(60))),i=Number(BigInt.asIntN(32,e/BigInt(1e3)/BigInt(60)%BigInt(60))),r=Number(BigInt.asIntN(32,e/BigInt(1e3)/BigInt(3600)));return U.GP("%s:%02d:%02d.%02d",r,i,a,t)}class H extends l.A{constructor(){super(),(0,i.A)(this,"type",8),(0,i.A)(this,"context",void 0),(0,i.A)(this,"blockReader",void 0)}init(e){e.ioReader&&e.ioReader.setEndian(!0);const t={isLive:!0,firstCluster:-BigInt(1),segmentStart:-BigInt(1),header:{version:0,readVersion:0,maxIdLength:4,maxSizeLength:8,docType:"",docTypeVersion:0,docTypeReadVersion:0},seekHead:null,info:null,tracks:null,attachments:null,chapters:null,cues:null,tags:null,maxPts:x.Dh,currentCluster:{timeCode:BigInt(0),pos:-BigInt(1),block:{pos:-BigInt(1),size:-BigInt(1)},blockGroup:{block:null}},clusterIndexes:[],clusterIndexesPosMap:new Map};e.privateData=this.context=t}analyzeStreams(e){let t=x.Dh;const a="webm"===this.context.header.docType?p.Nk:p.eP;var i;if(this.context.tracks&&L.__(this.context.tracks.entry,(t=>{var i,c,n;const d=e.createStream();switch(d.privData=t,d.codecpar.codecId=a[t.codecId]||0,t.type){case 2:d.codecpar.codecType=1;break;case 1:d.codecpar.codecType=0,d.codecpar.flags|=4;break;case 17:d.codecpar.codecType=3;break;default:d.codecpar.codecType=-1}t.language&&(d.metadata.language=t.language),t.name&&(d.metadata.title=t.name),t.audio?("A_PCM/FLOAT/IEEE"===t.codecName?64===t.audio.bitDepth?d.codecpar.codecId=65559:32===t.audio.bitDepth&&(d.codecpar.codecId=65557):"A_PCM/INT/BIG"===t.codecName?16===t.audio.bitDepth?d.codecpar.codecId=65537:24===t.audio.bitDepth?d.codecpar.codecId=65549:32===t.audio.bitDepth&&(d.codecpar.codecId=65545):"A_PCM/INT/LIT"===t.codecName&&(8===t.audio.bitDepth?d.codecpar.codecId=65541:16===t.audio.bitDepth?d.codecpar.codecId=65536:24===t.audio.bitDepth?d.codecpar.codecId=65548:32===t.audio.bitDepth&&(d.codecpar.codecId=65544)),d.codecpar.chLayout.nbChannels=t.audio.channels,d.codecpar.sampleRate=0|t.audio.sampleRate,d.codecpar.bitsPerCodedSample=t.audio.bitDepth):t.video&&(d.codecpar.width=t.video.pixelWidth,d.codecpar.height=t.video.pixelHeight,t.video.color&&(M.ai(t.video.color.primaries)&&(d.codecpar.colorPrimaries=t.video.color.primaries),M.ai(t.video.color.transferCharacteristics)&&(d.codecpar.colorTrc=t.video.color.transferCharacteristics),M.ai(t.video.color.range)&&(d.codecpar.colorRange=t.video.color.range),M.ai(t.video.color.matrixCoefficients)&&(d.codecpar.colorSpace=t.video.color.matrixCoefficients)));let o=0;if("V_MS/VFW/FOURCC"===t.codecId&&(null===(i=t.codecPrivate)||void 0===i?void 0:i.size)>=40)d.codecpar.bitsPerCodedSample=t.codecPrivate.data[15]<<8|t.codecPrivate.data[14],d.codecpar.codecTag=t.codecPrivate.data[19]<<24|t.codecPrivate.data[18]<<16|t.codecPrivate.data[17]<<8|t.codecPrivate.data[16],d.codecpar.codecId=u.nz[d.codecpar.codecTag]||0,0===d.codecpar.codecId&&(d.codecpar.codecId,A.pj[d.codecpar.codecTag]),o=40;else if("V_QUICKTIME"===t.codecId&&(null===(c=t.codecPrivate)||void 0===c?void 0:c.size)>=21){const e=1===d.codecpar.codecType?A._B:A.pj;d.codecpar.codecTag=t.codecPrivate.data[3]<<24|t.codecPrivate.data[2]<<16|t.codecPrivate.data[1]<<8|t.codecPrivate.data[0];let a=e[d.codecpar.codecTag];if(a){const e=new Uint8Array(4),a=Number(BigInt.asIntN(32,t.codecPrivate.size));e[0]=a>>>24&255,e[1]=a>>>16&255,e[2]=a>>>8&255,e[3]=255&a,t.codecPrivate.size+=BigInt(4),t.codecPrivate.data=(0,X.A)(Uint8Array,[e,t.codecPrivate.data])}else d.codecpar.codecTag=t.codecPrivate.data[7]<<24|t.codecPrivate.data[6]<<16|t.codecPrivate.data[5]<<8|t.codecPrivate.data[4],a=e[d.codecpar.codecTag];d.codecpar.codecId=a||0}if(null!==(n=t.codecPrivate)&&void 0!==n&&n.data&&t.codecPrivate.size-BigInt(Math.floor(o))>0){let e=t.codecPrivate.data.subarray(o);if(94212===d.codecpar.codecId||94230===d.codecpar.codecId){t.ass={hasLayer:!1};let a,i=z.decode(e).split(/\r?\n/);for(let e=0;e<i.length;e++)if("[Events]"===i[e].trim()){i[e+1]&&/^Format:/.test(i[e+1])&&(a=i[e+1]),i=i.slice(0,e);break}if(a){a=a.replace(/^Format:/,"");const e=a.split(",").map((e=>e.trim())).filter((e=>"Start"!==e&&"End"!==e));t.ass.hasLayer="Layer"===e[0],t.ass.hasLayer?e.splice(1,0,"Start","End"):(e.unshift("End"),e.unshift("Start")),a=`Format: ${e.join(", ")}`}i.push("[Events]"),i.push(a||"Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),a||(t.ass.hasLayer=!0),e=z.encode(i.join("\n"))}if(d.codecpar.extradataSize=e.length,d.codecpar.extradata=(0,I.sY)(e.length),(0,r.lW)(d.codecpar.extradata,e.length,e),d.codecpar.extradata)switch(d.codecpar.codecId){case 27:{const e=(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize);R.XC(d,e),B.Bs(e)&&(d.codecpar.flags|=1);break}case 173:{const e=(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize);k.XC(d,e),B.Bs(e)&&(d.codecpar.flags|=1);break}case 196:{const e=(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize);w.XC(d,e),B.Bs(e)&&(d.codecpar.flags|=1);break}case 225:S.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 139:V.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 167:_.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86018:P.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86017:D.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86076:C.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86028:if(d.codecpar.extradataSize>v.ob){const e=new O.A((0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));if("fLaC"===e.readString(4))for(;e.remainingSize();){const t=e.readUint8(),a=e.readUint24(),i=-129&t;if(0===i){const t=e.readBuffer(a);(0,I.Eb)(d.codecpar.extradata),d.codecpar.extradata=(0,I.sY)(t.length),d.codecpar.extradataSize=t.length,(0,r.lW)(d.codecpar.extradata,t.length,t);break}e.skip(i)}}d.codecpar.extradataSize===v.ob&&v.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize))}else{let e;86018===d.codecpar.codecId&&(e=P.Ij(d.codecpar)),e&&(d.codecpar.extradataSize=e.length,d.codecpar.extradata=(0,I.sY)(d.codecpar.extradataSize),(0,r.lW)(d.codecpar.extradata,d.codecpar.extradataSize,e))}}this.context.info&&(d.timeBase.num=1,this.context.info.timestampScale?d.timeBase.den=1e3*x.SF/this.context.info.timestampScale|0:(d.timeBase.den=1e3,this.context.info.timestampScale=x.SF),this.context.info.duration&&(d.duration=BigInt(Math.floor(this.context.info.duration)))),(null==t.default||t.default)&&(d.disposition|=1),94226===d.codecpar.codecId&&("D_WEBVTT/CAPTIONS"===t.codecId?d.disposition|=65536:("D_WEBVTT/DESCRIPTIONS"===t.codecId||"D_WEBVTT/METADATA"===t.codecId)&&d.disposition),t.encodings&&L.__(t.encodings.entry,(e=>{e.compression&&(0,G.A)(e.compression.algo)&&(t.needDecompression=!0),e.encryption&&(0,G.A)(e.encryption.algo)&&(t.needDecryption=!0)}))})),this.context.attachments&&L.__(this.context.attachments.entry,(t=>{const a=e.createStream();if(a.codecpar.codecType=4,a.privData=t,t.name&&(a.metadata.title=t.name),t.mime&&(a.metadata.mime=t.mime),t.description&&(a.metadata.description=t.description),t.data)if(p.xz[t.mime]){a.codecpar.codecId=p.xz[t.mime],a.codecpar.codecType=0,a.disposition|=1024,a.attachedPic=(0,y._5)(),d.M[15](a.attachedPic+32,a.index);const e=(0,I.sY)(Number(BigInt.asUintN(32,t.data.size)));(0,r.lW)(e,Number(BigInt.asUintN(32,t.data.size)),t.data.data),(0,y.NX)(a.attachedPic,e,Number(BigInt.asIntN(32,t.data.size))),d.M[15](a.attachedPic+36,1|n.f[15](a.attachedPic+36))}else a.codecpar.extradataSize=Number(BigInt.asIntN(32,t.data.size)),a.codecpar.extradata=(0,I.sY)(a.codecpar.extradataSize),(0,r.lW)(a.codecpar.extradata,a.codecpar.extradataSize,t.data.data)})),this.context.tags&&L.__(this.context.tags.entry,(a=>{a.tag&&a.tag.forEach((i=>{const r=i.name;let c=i.string;if(a.target){if("DURATION"===r){let e=i.string.replaceAll("\0","").split("."),t=e[0].split(":");c=BigInt(+t[0])*BigInt(36e8)+BigInt(+t[1])*BigInt(6e7)+BigInt(+t[2])*BigInt(1e6)+BigInt(+e[1])/BigInt(1e3)}if(a.target.chapterUid)for(let t=0;t<e.chapters.length;t++){const i=e.chapters[t];i.id===a.target.chapterUid&&(i.metadata[r]=c)}else if(a.target.trackUid||a.target.attachUid){const i=(0,h.A)(e.streams,a.target.trackUid||a.target.attachUid);i&&("DURATION"===r?(i.duration=(0,N.k)(c,x.KR,i.timeBase),c>t&&(t=c)):i.metadata[r]=c)}else e.metadata[r]=c}else e.metadata[r]=c}))})),this.context.info&&(this.context.info.muxingApp&&(e.metadata.encoder=this.context.info.muxingApp),this.context.info.title&&(e.metadata.title=this.context.info.title),8===(null===(i=this.context.info.dateUTC)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.byteLength))){const t=new DataView(this.context.info.dateUTC.data.buffer).getBigUint64(0)/BigInt(1e6)+BigInt(9783072e5);e.metadata.creationTime=new Date(Number(t)).toISOString()}if(this.context.chapters&&(L.__(this.context.chapters.entry,(t=>{const a=t.atom;a&&L.__(a,(t=>{var a,i,r,c;e.chapters.push({id:t.uid,start:null!==(a=t.start)&&void 0!==a?a:x.Dh,end:null!==(i=t.end)&&void 0!==i?i:x.Dh,timeBase:{num:1,den:1e9},metadata:{title:(null===(r=t.display)||void 0===r?void 0:r.title)||"",language:(null===(c=t.display)||void 0===c?void 0:c.language)||""}})}))})),e.chapters.length)){for(let t=0;t<e.chapters.length-1;t++)e.chapters[t].end===x.Dh&&(e.chapters[t].end=e.chapters[t+1].start);e.chapters[e.chapters.length-1].end===x.Dh&&(e.chapters[e.chapters.length-1].end=(0,N.k)(t,x.KR,e.chapters[e.chapters.length-1].timeBase))}}async readHeader(e){if(440786851!==await(0,f.aL)(e,this.context.header.maxIdLength))return T.z3("not matroska format",F,618),g.LR;const t=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(this.context.header=E.X$(this.context.header,await(0,f.Pb)(e,t,f.jt)),408125543!==await(0,f.aL)(e,this.context.header.maxIdLength))return T.z3("not matroska format",F,627),g.LR;const a=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);this.context.segmentStart=e.ioReader.getPos();const i=e.ioReader.getPos()+a,r=new Set;let c=!1,n=!1;for(;e.ioReader.getPos()<i||!c||!n;){const t=e.ioReader.getPos(),a=await(0,f.aL)(e,this.context.header.maxIdLength);if(a===g.LR){await this.syncTopLevelElement(e,2);continue}const i=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(i!==BigInt(0|g.LR)){if(290298740===a)this.context.isLive=!1,this.context.seekHead=await(0,f.Pb)(e,i,f.Cr);else if(475249515===a)this.context.isLive=!1,this.context.cues=await(0,f.Pb)(e,i,f.eG);else if(272869232===a)this.context.isLive=!1,this.context.chapters=await(0,f.Pb)(e,i,f.Y0);else if(357149030===a)this.context.info=await(0,f.Pb)(e,i,f.qi);else if(307544935===a)this.context.tags=await(0,f.Pb)(e,i,f.hK);else if(423732329===a)this.context.attachments=await(0,f.Pb)(e,i,f.qp);else if(374648427===a)c=!0,this.context.tracks=await(0,f.Pb)(e,i,f.Wy);else if(524531317===a){if(n=!0,this.context.firstCluster=t,this.context.isLive||!this.context.seekHead||!(1&e.ioReader.flags))break;const a=this.context.seekHead.entry;let i=0;for(;i<a.length;i++)if(!r.has(a[i].id)){await e.ioReader.seek(a[i].pos+this.context.segmentStart);break}if(i===a.length)break}else await e.ioReader.skip(Number(BigInt.asIntN(32,i)));r.add(a)}else await this.syncTopLevelElement(e,2)}return this.context.firstCluster>0&&await e.ioReader.seek(this.context.firstCluster),this.analyzeStreams(e),0}parseAdditions(e,t,a){for(let n=0;n<t.entry.length;n++){var i;const d=t.entry[n];if(null!==(i=d.additional)&&void 0!==i&&i.size)if(4===d.additionalId&&T.R8("ITU_T_T35 not support now",F,721),94226===a.codecpar.codecId){const t=z.decode(d.additional.data).split("\n");if(t.length>=2){if(t[0]){const a=z.encode(t[0]),i=(0,I.sY)(a.length);(0,r.lW)(i,a.length,a),(0,y.Ow)(e,17,i,a.length)}if(t[1]){const a=z.encode(t[1]),i=(0,I.sY)(a.length);(0,r.lW)(i,a.length,a),(0,y.Ow)(e,16,i,a.length)}}}else{var c;const t=(0,I.sY)(d.additional.data.length+8);b.Cv(t,BigInt(null!==(c=d.additionalId)&&void 0!==c?c:1)),(0,r.lW)(t+8,d.additional.data.length,d.additional.data),(0,y.Ow)(e,15,t,d.additional.data.length+8),1!==d.additionalId||139!==a.codecpar.codecId&&167!==a.codecpar.codecId&&225!==a.codecpar.codecId||(a.codecpar.flags|=8)}}}processAss(e,t){const a=t.privData,i=z.decode((0,y.iI)(e)).split(",").map((e=>e.trim()));i.shift();const c=W((0,N.k)(n.f[17](e+8),(0,s.A)(e+72,o.Q),x.i0)),d=W((0,N.k)(n.f[17](e+8)+n.f[17](e+48),(0,s.A)(e+72,o.Q),x.i0));a.ass.hasLayer?i.splice(1,0,c,d):(i.unshift(d),i.unshift(c));const l=z.encode(`Dialogue: ${i.join(",")}`),p=(0,I.sY)(l.length);(0,r.lW)(p,l.length,l),(0,y.NX)(e,p,l.length)}async parseBlock(e,t){var a,i,o;const s=(null===(a=this.context.currentCluster.block)||void 0===a?void 0:a.data)||this.context.currentCluster.blockGroup.block.data;let l=null===(i=this.context.currentCluster.block)||void 0===i?void 0:i.pos;l<0&&(l=this.context.currentCluster.blockGroup.block.pos);let p,h=-1,u=BigInt(0);null!==(o=this.context.currentCluster.blockGroup)&&void 0!==o&&o.block&&(p=this.context.currentCluster.blockGroup.additions,h=this.context.currentCluster.blockGroup.reference?0===this.context.currentCluster.blockGroup.reference.length?1:0:1,this.context.currentCluster.blockGroup.duration&&(u=this.context.currentCluster.blockGroup.duration)),this.blockReader?this.blockReader.resetBuffer(s):this.blockReader=new O.A(s);const A=this.blockReader.getPos(),b=Number(BigInt.asUintN(32,await(0,f.Qb)(this.blockReader,8))),B=(0,m.A)(e.streams,b);if(!B)return T.z3(`invalid track number ${b}`,F,825),g.OY;const P=this.blockReader.readInt16(),S=this.blockReader.readUint8();-1===h&&(h=128&S?1:0);let v=0,R=[];switch(S>>>1&3){case 1:{v=this.blockReader.readUint8()+1;let e=0;for(let t=0;t<v-1;t++){let t=0;for(;;){const e=this.blockReader.readUint8();if(0===e)break;if(255!==e){t+=e;break}t+=255}e+=t,R.push(t)}R.push(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A))-e);break}case 3:{v=this.blockReader.readUint8()+1,R.push(await(0,f.Ag)(this.blockReader,4));let e=R[0];for(let t=1;t<v-1;t++){let a=await(0,f.pf)(this.blockReader,4)+R[t-1];e+=a,R.push(a)}R.push(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A))-e);break}case 2:v=this.blockReader.readUint8()+1;const e=(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A)))/v;for(let t=0;t<v;t++)R.push(e);break;case 0:v=1,R.push(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A)))}const k=B.privData,D=k.timeScale||1;if(k.needDecryption)throw new Error("not support encryption stream");let C=(this.context.currentCluster.timeCode+BigInt(Math.floor(P*D)))*BigInt(0|this.context.info.timestampScale);k.codecDelay&&(C-=k.codecDelay),C/=BigInt(1e3),C=(0,N.k)(C,x.KR,B.timeBase),u=BigInt(Math.floor(Number(BigInt.asIntN(32,u))*D))*BigInt(0|this.context.info.timestampScale),u/=BigInt(1e3),u=(0,N.k)(u,x.KR,B.timeBase);for(let a=0;a<v;a++){const i=0!==a?(0,y._5)():t;let o,s=R[a],f=0;if(k.needDecompression){const e=k.encodings.entry.find((e=>!!e.compression));3===e.compression.algo?(o=e.compression.settings.data,s+=o.length,f=o.length):T.h2(`not support compression stream, algo: ${e.compression.algo}`,F,935)}d.M[17](i+56,l+this.blockReader.getPos()),d.M[15](i+32,B.index),(0,r.Mr)(i+72,B.timeBase[c.o9],8),d.M[17](i+8,C),d.M[15](i+28,s),d.M[17](i+48,u);const m=(0,I.sY)(s);o&&(0,r.lW)(m,f,o),(0,r.lW)(m+f,R[a],this.blockReader.readBuffer(R[a])),(0,y.NX)(i,m,s),0!==B.codecpar.codecType?(d.M[15](i+36,1|n.f[15](i+36)),d.M[17](i+16,C)):(h&&d.M[15](i+36,1|n.f[15](i+36)),27!==B.codecpar.codecId&&173!==B.codecpar.codecId&&196!==B.codecpar.codecId||(1&B.codecpar.flags?d.M[15](i+36,64|n.f[15](i+36)):d.M[15](i+36,-65&n.f[15](i+36)))),p&&this.parseAdditions(i,p,B),94212!==B.codecpar.codecId&&94230!==B.codecpar.codecId||this.processAss(i,B),0!==a&&e.interval.packetBuffer.push(i),this.context.maxPts<C&&(this.context.maxPts=C)}return this.context.currentCluster.block={pos:-BigInt(1),size:-BigInt(1)},this.context.currentCluster.blockGroup={block:null},0}addClusterIndex(e){if(this.context.clusterIndexesPosMap.has(e.pos))return;const t=L.El(this.context.clusterIndexes,(t=>t.time<e.time?1:-1));t>-1?(this.context.clusterIndexesPosMap.set(e.pos,t),this.context.clusterIndexes.splice(t,0,e)):(this.context.clusterIndexesPosMap.set(e.pos,this.context.clusterIndexes.length),this.context.clusterIndexes.push(e))}async readAVPacket_(e,t){const a=e.ioReader.getPos(),i=await(0,f.aL)(e,this.context.header.maxIdLength);if(i===g.LR)return await this.syncTopLevelElement(e),this.readAVPacket_(e,t);const r=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(r===BigInt(g.LR))return await this.syncTopLevelElement(e),this.readAVPacket_(e,t);if(524531317===i){this.context.currentCluster.pos=a,this.context.currentCluster.timeCode=BigInt(0),await(0,f.Pb)(e,r,f.GZ,this.context.currentCluster,[163,160]),this.context.isLive||this.addClusterIndex({time:this.context.currentCluster.timeCode,pos:a});let i=await this.parseBlock(e,t);if(i===g.OY)return this.readAVPacket_(e,t);if(i<0)return i}else if(163===i){this.context.currentCluster.block={pos:e.ioReader.getPos(),size:r,data:await e.ioReader.readBuffer(Number(BigInt.asIntN(32,r)))};let a=await this.parseBlock(e,t);if(a===g.OY)return this.readAVPacket_(e,t);if(a<0)return a}else{if(160!==i)return 475249515===i||307544935===i||423732329===i||272869232===i||357149030===i||374648427===i||290298740===i?(await e.ioReader.skip(Number(BigInt.asIntN(32,r))),this.readAVPacket_(e,t)):(await this.syncTopLevelElement(e),this.readAVPacket_(e,t));{await(0,f.Pb)(e,r,f.Wg,this.context.currentCluster.blockGroup);let a=await this.parseBlock(e,t);if(a===g.OY)return this.readAVPacket_(e,t);if(a<0)return a}}return 0}async readAVPacket(e,t){try{return await this.readAVPacket_(e,t)}catch(t){return-1048576!==e.ioReader.error&&-1048572!==e.ioReader.error?(T.z3(`read packet error, ${t}`,F,1124),g.LR):e.ioReader.error}}async syncTopLevelElement(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,a=x.Dh;for(;;)try{if(8&e.ioReader.flags)break;const i=e.ioReader.getPos(),r=await e.ioReader.peekUint32();if(524531317===r||475249515===r||307544935===r||423732329===r||272869232===r||357149030===r||374648427===r||290298740===r){a=i;let r=0;await e.ioReader.skip(4);const c=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(c===BigInt(g.LR)){await e.ioReader.seek(i+BigInt(1));continue}for(await e.ioReader.skip(Number(BigInt.asIntN(32,c)));r<=t;){const t=await(0,f.aL)(e,this.context.header.maxIdLength),a=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(524531317!==t&&475249515!==t&&307544935!==t&&423732329!==t&&272869232!==t&&357149030!==t&&374648427!==t&&290298740!==t)break;r++,await e.ioReader.skip(Number(BigInt.asIntN(32,a)))}if(!(r<t))break;await e.ioReader.seek(a+BigInt(1)),a=x.Dh}else await e.ioReader.skip(1),a=x.Dh}catch(e){break}a!==x.Dh&&await e.ioReader.seek(a)}async seek(e,t,a,i){var r;const c=e.ioReader.getPos();if(2&i)return await e.ioReader.seek(a),c;const n=(0,N.k)(a,t.timeBase,x.KR);let d=x.Dh;if(null!==(r=this.context.cues)&&void 0!==r&&r.entry.length){const e=t.privData;for(let t=0;t<this.context.cues.entry.length;t++)if((this.context.cues.entry[t].time||BigInt(0))*BigInt(0|this.context.info.timestampScale)/BigInt(1e3)>n){const a=this.context.cues.entry[Math.max(t-1,0)].pos;if(a.length){const t=a.find((t=>t.track===e.number));if(t){d=t.pos+this.context.segmentStart;break}}}}if(d===x.Dh&&this.context.clusterIndexes.length){for(let e=0;e<this.context.clusterIndexes.length;e++)if(this.context.clusterIndexes[e].time*BigInt(0|this.context.info.timestampScale)/BigInt(1e3)>n){d=this.context.clusterIndexes[Math.max(e-1,0)].pos;break}d===x.Dh&&(d=this.context.clusterIndexes[this.context.clusterIndexes.length-1].pos)}return d!==x.Dh?(await e.ioReader.seek(d),c):BigInt(g.E$)}getAnalyzeStreamsCount(){return 0}}},27228:(e,t,a)=>{a.d(t,{Ag:()=>N,Cr:()=>s,GZ:()=>y,Pb:()=>v,Qb:()=>b,Wg:()=>g,Wy:()=>p,Y0:()=>h,aL:()=>S,eG:()=>m,hK:()=>A,jt:()=>I,pf:()=>x,qi:()=>l,qp:()=>f});var i=a(84777),r=a(83796),c=a(34117),n=a(35924);const d="packages/avformat/src/formats/matroska/imatroska.ts",o=BigInt(20971520),s={19899:{type:9,isArray:!0,filedName:"entry",child:{21419:{type:1,filedName:"id"},21420:{type:2,filedName:"pos"}}}},l={29604:{type:2,filedName:"segmentUUID"},2807729:{type:1,filedName:"timestampScale"},17545:{type:5,filedName:"duration"},31657:{type:7,filedName:"title"},19840:{type:7,filedName:"muxingApp"},22337:{type:7,filedName:"writingApp"},17505:{type:8,filedName:"dateUTC"}},p={174:{type:9,isArray:!0,filedName:"entry",child:{215:{type:1,filedName:"number"},29637:{type:1,filedName:"uid"},131:{type:1,filedName:"type"},21358:{type:7,filedName:"name"},136:{type:10,filedName:"default"},185:{type:10,filedName:"enabled"},2274716:{type:7,filedName:"language"},2306383:{type:6,filedName:"timeScale"},134:{type:7,filedName:"codecId"},2459272:{type:7,filedName:"codecName"},25506:{type:8,filedName:"codecPrivate"},225:{type:9,filedName:"audio",child:{181:{type:5,filedName:"sampleRate"},30901:{type:5,filedName:"outSampleRate"},25188:{type:1,filedName:"bitDepth"},159:{type:1,filedName:"channels"}}},224:{type:9,filedName:"video",child:{2327523:{type:1,filedName:"framerate"},21680:{type:1,filedName:"displayWidth"},21690:{type:1,filedName:"displayHeight"},176:{type:1,filedName:"pixelWidth"},186:{type:1,filedName:"pixelHeight"},3061028:{type:8,filedName:"colorSpace"},21440:{type:1,filedName:"alphaMode"},21936:{type:9,filedName:"color",child:{21937:{type:1,filedName:"matrixCoefficients"},21938:{type:1,filedName:"bitsPerChannel"},21941:{type:1,filedName:"cbSubHorz"},21942:{type:1,filedName:"cbSubVert"},21939:{type:1,filedName:"chromaSubHorz"},21940:{type:1,filedName:"chromaSubVert"},21943:{type:1,filedName:"chromaSitingHorz"},21944:{type:1,filedName:"chromaSitingVert"},21945:{type:1,filedName:"range"},21946:{type:1,filedName:"transferCharacteristics"},21947:{type:1,filedName:"primaries"},21948:{type:1,filedName:"maxCll"},21949:{type:1,filedName:"maxFall"},21968:{type:9,filedName:"masteringMeta",child:{21969:{type:5,filedName:"rx"},21970:{type:5,filedName:"ry"},21971:{type:5,filedName:"gx"},21972:{type:5,filedName:"gy"},21973:{type:5,filedName:"bx"},21974:{type:5,filedName:"by"},21975:{type:5,filedName:"whiteX"},21976:{type:5,filedName:"whiteY"},21978:{type:5,isArray:!0,filedName:"minLuminance"},21977:{type:5,filedName:"maxLuminance"}}}}},30320:{type:9,filedName:"projection",child:{30321:{type:1,filedName:"type"},30322:{type:8,filedName:"private"},30323:{type:5,filedName:"yaw"},30324:{type:5,filedName:"pitch"},30325:{type:5,filedName:"roll"}}},21682:{type:1,filedName:"displayUnit"},154:{type:1,filedName:"interlaced"},157:{type:1,filedName:"fieldOrder"},21432:{type:1,filedName:"stereoMode"},21683:{type:1,filedName:"aspectRatio"}}},226:{type:9,filedName:"operations",child:{227:{type:9,isArray:!0,filedName:"entry",child:{228:{type:9,isArray:!0,filedName:"planes",child:{230:{type:1,filedName:"type"},229:{type:1,filedName:"uid"}}}}}}},28032:{type:9,filedName:"encodings",child:{25152:{type:9,isArray:!0,filedName:"entry",child:{20530:{type:1,filedName:"scope"},20531:{type:1,filedName:"type"},20532:{type:9,filedName:"compression",child:{16980:{type:1,filedName:"algo"},16981:{type:8,filedName:"settings"}}},20533:{type:9,filedName:"encryption",child:{18401:{type:1,filedName:"algo"},18402:{type:8,filedName:"keyId"}}}}}}}}}},f={24999:{type:9,isArray:!0,filedName:"entry",child:{18094:{type:1,filedName:"uid"},18030:{type:7,filedName:"name"},18016:{type:7,filedName:"mime"},18046:{type:7,filedName:"description"},18012:{type:8,filedName:"data"}}}},h={17849:{type:9,isArray:!0,filedName:"entry",child:{182:{type:9,isArray:!0,filedName:"atom",child:{145:{type:2,filedName:"start"},146:{type:2,filedName:"end"},29636:{type:1,filedName:"uid"},128:{type:9,filedName:"display",child:{133:{type:7,filedName:"title"},17276:{type:7,filedName:"language"}}}}}}}},m={187:{type:9,isArray:!0,filedName:"entry",child:{179:{type:2,filedName:"time"},183:{type:9,isArray:!0,filedName:"pos",child:{247:{type:1,filedName:"track"},241:{type:2,filedName:"pos"}}}}}},u={17827:{type:7,filedName:"name"},17543:{type:7,filedName:"string"},17530:{type:7,filedName:"language"},17540:{type:1,filedName:"default"},17588:{type:1,filedName:"default"},26568:{type:9,filedName:"sub"}};u[26568].child=u;const A={29555:{type:9,isArray:!0,filedName:"entry",child:{26568:{type:9,filedName:"tag",child:u,isArray:!0},25536:{type:9,filedName:"target",child:{25546:{type:7,filedName:"type"},26826:{type:1,filedName:"typeValue"},25541:{type:1,filedName:"trackUid"},25540:{type:1,filedName:"chapterUid"},25542:{type:1,filedName:"attachUid"}}}}}},g={161:{type:8,filedName:"block"},30113:{type:9,filedName:"additions",child:{166:{type:9,isArray:!0,filedName:"entry",child:{238:{type:1,filedName:"additionalId"},165:{type:8,filedName:"additional"}}}}},155:{type:2,filedName:"duration"},30114:{type:4,filedName:"discardPadding"},251:{type:4,isArray:!0,filedName:"reference"},164:{type:10,filedName:"nonSimple"}},y={163:{type:8,filedName:"block"},160:{type:9,filedName:"blockGroup",child:g},231:{type:2,filedName:"timeCode"},167:{type:2,filedName:"pos"},171:{type:2,filedName:"prevSize"}},I={17030:{type:1,filedName:"version"},17143:{type:1,filedName:"readVersion"},17138:{type:1,filedName:"maxIdLength"},17139:{type:1,filedName:"maxSizeLength"},17026:{type:7,filedName:"docType"},17031:{type:1,filedName:"docTypeVersion"},17029:{type:1,filedName:"docTypeReadVersion"}};async function N(e,t){const a=e.getPos();let i=await e.readUint8();if(!i)return c.z3(`0x00 as pos ${a} invalid as first byte of an EBML number`,d,765),n.LR;let r=1;for(;!(128&i);)r++,i<<=1;if(i&=127,r>t)return c.z3(`Length ${r} indicated by an EBML number's first byte ${i.toString(16)} at pos ${a} exceeds max length ${t}.`,d,778),n.LR;let o=i>>>r-1;for(;--r;)o<<=8,o|=await e.readUint8();return o}async function x(e,t){const a=e.getPos();return await N(e,t)-((1<<7*Number(BigInt.asIntN(32,e.getPos()-a))-1)-1)}async function b(e,t){const a=e.getPos();let i=await e.readUint8(),r=1;if(!i)return c.z3(`0x00 as pos ${a} invalid as first byte of an EBML number`,d,812),BigInt(n.LR);for(;!(128&i);)r++,i<<=1;if(i&=127,r>t)return c.z3(`Length ${r} indicated by an EBML number's first byte ${i.toString(16)} at pos ${a} exceeds max length ${t}.`,d,823),BigInt(n.LR);let o=BigInt(Math.floor(i>>>r-1));for(;--r;){o<<=BigInt(8);const t=await e.readUint8();o|=BigInt(Math.floor(t))}return o}async function B(e,t){switch(t){case BigInt(0):return 0;case BigInt(1):return e.ioReader.readUint8();case BigInt(2):return e.ioReader.readUint16();case BigInt(3):return e.ioReader.readUint24();case BigInt(4):return e.ioReader.readUint32();case BigInt(8):return e.ioReader.readUint64()}let a=BigInt(0),i=0;for(;i++<t;){const t=await e.ioReader.readUint8();a=a<<BigInt(8)|BigInt.asUintN(64,BigInt(Math.floor(t)))}return a}async function P(e,t){switch(t){case BigInt(0):return 0;case BigInt(1):return e.ioReader.readInt8();case BigInt(2):return e.ioReader.readInt16();case BigInt(4):return e.ioReader.readInt32();case BigInt(8):return e.ioReader.readInt64()}let a=BigInt(0),i=0;for(;i++<t;){const t=await e.ioReader.readUint8();a=a<<BigInt(8)|BigInt.asUintN(64,BigInt(Math.floor(t)))}return t===BigInt(3)?Number(BigInt.asIntN(32,BigInt.asIntN(24,a))):BigInt.asIntN(64,a)}async function S(e,t){const a=e.ioReader.getPos();let i=await e.ioReader.peekUint8();if(!i)return c.z3(`0x00 as pos ${a} invalid as first byte of an EBML number`,d,908),n.LR;let r=1;for(;!(128&i);)r++,i<<=1;if(r>t)return c.z3(`Length ${r} indicated by an EBML number's first byte ${i.toString(16)} at pos ${a} exceeds max length ${t}.`,d,920),n.LR;let o=0;for(;r--;)o<<=8,o|=await e.ioReader.readUint8();return o}async function v(e,t,a){let c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return await async function(e,t,a){const i=e.privateData,r=e.ioReader.getPos();for(;e.ioReader.getPos()<r+t;){const t=await S(e,i.header.maxIdLength),r=await b(e.ioReader,i.header.maxSizeLength);if(e.ioReader.getPos(),!1===await a(t,r))return}}(e,t,(async(t,d)=>{if(a[t]){const r=a[t];let n;switch(r.type){case 1:n=await B(e,d);break;case 2:n=await B(e,d),i.ai(n)&&(n=BigInt(n));break;case 3:n=await P(e,d);break;case 4:n=await P(e,d),i.ai(n)&&(n=BigInt(n));break;case 6:case 5:n=await async function(e,t){return t===BigInt(4)?e.ioReader.readFloat():t===BigInt(8)?e.ioReader.readDouble():(await e.ioReader.skip(Number(BigInt.asIntN(32,t))),0)}(e,d);break;case 7:n=await e.ioReader.readString(Number(BigInt.asIntN(32,d))),n&&0===n.charCodeAt(n.length-1)&&(n=n.substring(0,n.length-1));break;case 10:n=!!await B(e,d);break;case 8:n={pos:e.ioReader.getPos(),size:d,data:d<o?await e.ioReader.readBuffer(Number(BigInt.asIntN(32,d))):null};break;case 9:n=r.child?await v(e,d,r.child):{};break;default:await e.ioReader.skip(Number(BigInt.asIntN(32,d)))}if(null!=n)if(r.isArray){const e=c[r.filedName]||[];e.push(n),c[r.filedName]=e}else c[r.filedName]=n}else await e.ioReader.skip(Number(BigInt.asIntN(32,d)));if(n.length&&r.zy(n,t))return!1})),c}},35734:(e,t,a)=>{a.d(t,{A:()=>r});var i=a(19371);class r{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},41050:(e,t,a)=>{a.d(t,{_B:()=>c,_r:()=>n,pj:()=>r});var i=a(75429);const r={[(0,i.A)("mp4v")]:12,[(0,i.A)("DIVX")]:12,[(0,i.A)("XVID")]:12,[(0,i.A)("3IV2")]:12,[(0,i.A)("vvc1")]:196,[(0,i.A)("vvi1")]:196,[(0,i.A)("hev1")]:173,[(0,i.A)("hvc1")]:173,[(0,i.A)("dvhe")]:173,[(0,i.A)("hev1")]:173,[(0,i.A)("avc1")]:27,[(0,i.A)("avc2")]:27,[(0,i.A)("avc3")]:27,[(0,i.A)("avc4")]:27,[(0,i.A)("ai5p")]:27,[(0,i.A)("ai5q")]:27,[(0,i.A)("ai52")]:27,[(0,i.A)("ai53")]:27,[(0,i.A)("ai55")]:27,[(0,i.A)("ai56")]:27,[(0,i.A)("ai1p")]:27,[(0,i.A)("ai1q")]:27,[(0,i.A)("ai12")]:27,[(0,i.A)("ai13")]:27,[(0,i.A)("ai15")]:27,[(0,i.A)("ai16")]:27,[(0,i.A)("AVin")]:27,[(0,i.A)("aivx")]:27,[(0,i.A)("rv64")]:27,[(0,i.A)("xalg")]:27,[(0,i.A)("avlg")]:27,[(0,i.A)("dva1")]:27,[(0,i.A)("dvav")]:27,[(0,i.A)("vp08")]:139,[(0,i.A)("vp09")]:167,[(0,i.A)("av01")]:225},c={[(0,i.A)("mp4a")]:86018,[(0,i.A)("ac-3")]:86019,[(0,i.A)("sac3")]:86019,[(0,i.A)("ac-4")]:86119,[(0,i.A)("dtsc")]:86020,[(0,i.A)("dtsh")]:86020,[(0,i.A)("dtsl")]:86020,[(0,i.A)("dtse")]:86020,[(0,i.A)("DTS ")]:86020,[(0,i.A)("ec-3")]:86056,[(0,i.A)(".mp3")]:86017,[(0,i.A)("mp3 ")]:86017,1836253269:86017,[(0,i.A)("spex")]:86051,[(0,i.A)("SPXN")]:86051,[(0,i.A)("fLaC")]:86028,[(0,i.A)("Opus")]:86076,[(0,i.A)("alaw")]:65543,[(0,i.A)("ulaw")]:65542,[(0,i.A)("fl32")]:65557,[(0,i.A)("fl64")]:65559,[(0,i.A)("twos")]:65537,[(0,i.A)("lpcm")]:65536,[(0,i.A)("sowt")]:65536,[(0,i.A)("in24")]:65548,[(0,i.A)("in32")]:65544,[(0,i.A)("sowt")]:65540,[(0,i.A)("raw ")]:65541,[(0,i.A)("NONE")]:65541},n={[(0,i.A)("text")]:94213,[(0,i.A)("tx3g")]:94213,[(0,i.A)("c608")]:94218}},43963:(e,t,a)=>{a.d(t,{Bq:()=>p,En:()=>o,Ij:()=>l,XC:()=>s,f7:()=>f,hY:()=>d,uF:()=>c});var i=a(29688),r=a(54809);const c={1:"Main",2:"LC",3:"SSR",4:"LTP",5:"HE",6:"SCALABLE",29:"HEv2",23:"LD",39:"ELD"},n={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12},d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,i.N_,i.N_,i.N_],o=[i.N_,1,2,3,4,5,6,7];function s(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t){const{profile:a,sampleRate:r,channels:c}=function(e){let t=i.N_,a=i.N_,r=i.N_;return e.length>=2&&(t=e[0]>>3&31,a=d[(7&e[0])<<1|e[1]>>7],r=o[e[1]>>3&15]),{profile:t,sampleRate:a,channels:r}}(t);e.codecpar.profile=a,e.codecpar.sampleRate=r,e.codecpar.chLayout.nbChannels=c,e.codecpar.frameSize=5===a?2048:1024,e.codecpar.format=8}}function l(e){const t=n[e.sampleRate],a=e.chLayout.nbChannels,r=e.profile===i.N_?2:e.profile,c=new Uint8Array(2);return c[0]=(31&r)<<3|(14&t)>>1,c[1]=(1&t)<<7|(15&a)<<3,c}function p(e){if(e.length<7)return-1;const t=e[0]<<4|e[1]>>4;if(4095!==t)return-1;const a=1&e[1],i=(192&e[2])>>>6,r=(60&e[2])>>>2,c=(1&e[2])<<2|(192&e[3])>>>6,n=(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5,s=3&e[6];let l=1===a?7:9,p=n-l;return{syncWord:t,profile:i+1,sampleRate:d[r],channels:o[c],aacFrameLength:n,numberOfRawDataBlocksInFrame:s,headerLength:l,framePayloadLength:p}}function f(e,t){function a(){const e=t.readU(2);let a=0;for(let i=0;i<=e;i++)a<<=8,a|=t.readU(8);return a}t||(t=new r.A).appendBuffer(e);const i=t.getPointer(),c={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},n=t.readU(11);if(695!==n)return-1;c.syncWord=n,c.muxLengthBytes=t.readU(13);const s=1===t.readU1();if(c.useSameStreamMux=s,!s){const e=1===t.readU1();if(e&&1===t.readU1())return-1;if(e&&a(),1!==t.readU1())return-1;if(0!==t.readU(6))return-1;if(0!==t.readU(4))return-1;if(0!==t.readU(3))return-1;let i=e?a():0;const r=t.readU(5);i-=5;const n=t.readU(4);i-=4;const s=t.readU(4);if(i-=4,t.readU(3),i-=3,i>0&&t.readU(i),0!==t.readU(3))return-1;if(t.readU(8),1===t.readU1())if(e)a();else{let e=0;for(;;){e<<=8;const a=1===t.readU1();if(e+=t.readU(8),!a)break}}1===t.readU1()&&t.readU(8),c.profile=r+1,c.sampleRate=d[n],c.channels=o[s]}let l=0;for(;;){const e=t.readU(8);if(l+=e,255!==e)break}return c.framePayloadLength=l,c.headerLength=t.getPointer()-i+(8===t.getBitLeft()?0:1),c}},47354:(e,t,a)=>{a.d(t,{Ui:()=>n,XC:()=>c,zk:()=>r});var i=a(54809);const r={0:"Main",1:"High",2:"Professional"};function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=4){const a=n(t);e.codecpar.profile=a.profile,e.codecpar.level=a.level}}function n(e){const t=new i.A(e.length);t.appendBuffer(e),t.readU1(),t.readU(7);const a=t.readU(3),r=t.readU(5),c=t.readU1();let n=t.readU1()?10:8;return t.readU1()&&(n=12),{profile:a,level:r,tier:c,bitDepth:n,monochrome:t.readU1(),chromaSubsamplingX:t.readU1(),chromaSubsamplingY:t.readU1(),chromaSamplePosition:t.readU(2)}}},73448:(e,t,a)=>{a.d(t,{DK:()=>d,XC:()=>s,Xr:()=>o,jA:()=>c,ob:()=>r,oe:()=>n});var i=a(70704);const r=34,c=8,n=[0,8,12,0,16,20,24,32],d=[0,88200,176400,192e3,8e3,16e3,22050,24e3,32e3,44100,48e3,96e3,0,0,0,0],o=[0,192,576,1152,2304,4608,0,0,256,512,1024,2048,4096,8192,16384,32768];function s(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length===r){const{bitsPerRawSample:a,sampleRate:r,channels:c}=function(e){const t=new i.A(e);t.skip(10);const a=t.readUint24();return{sampleRate:a>>4,channels:1+((15&a)>>>1),bitsPerRawSample:1+((1&a)<<4|(240&t.readUint8())>>>4)}}(t);e.codecpar.bitsPerRawSample=a,e.codecpar.sampleRate=r,e.codecpar.chLayout.nbChannels=c}}},75429:(e,t,a)=>{a.d(t,{A:()=>c});var i=a(34117);const r="packages/avformat/src/function/mktagle.ts";function c(e){4!==e.length&&i.R8(`tag length is not 4, tag: ${e}`,r,30);let t=0;for(let a=3;a>=0;a--)t=t<<8|e.charCodeAt(a);return t}},78753:(e,t,a)=>{a.d(t,{IC:()=>d,dd:()=>n,gi:()=>r,mO:()=>o,nz:()=>c,t6:()=>s});var i=a(75429);const r={1:65541,2:69638,3:65557,6:65543,7:65542,10:86052,16:69664,17:69633,23:69664,32:69646,34:86037,49:86046,50:86046,56:73728,66:86068,69:69643,20:69643,64:69643,80:86016,85:86017,87:73728,88:73729,97:69635,98:69634,100:69643,105:69633,117:86079,131:86069,255:86018,273:86068,304:86057,309:86106,352:86023,353:86024,354:86053,355:86054,357:86095,358:86096,384:86116,512:69644,533:86022,534:86022,624:86047,654:86111,655:69660,848:86114,1025:86043,1026:86074,1280:86081,1281:86081,5376:86046,5377:86037,5632:86018,5634:86065,8192:86019,8193:86020,8264:86085,8738:86069,27765:65542,28781:86018,16707:86018,16768:86116,22858:81922,29338:86069,33152:86116,41216:86068,41222:86018,41225:86051,61868:86028,65534:86112,21318:69645,22127:86021},c={[(0,i.A)("H261")]:3,[(0,i.A)("H263")]:4,[(0,i.A)("X263")]:4,[(0,i.A)("T263")]:4,[(0,i.A)("L263")]:4,[(0,i.A)("VX1K")]:4,[(0,i.A)("ZyGo")]:4,[(0,i.A)("M263")]:4,[(0,i.A)("lsvm")]:4,[(0,i.A)("I263")]:20,[(0,i.A)("U263")]:4,[(0,i.A)("VSM4")]:4,[(0,i.A)("H264")]:27,[(0,i.A)("h264")]:27,[(0,i.A)("X264")]:27,[(0,i.A)("x264")]:27,[(0,i.A)("avc1")]:27,[(0,i.A)("DAVC")]:27,[(0,i.A)("SMV2")]:27,[(0,i.A)("VSSH")]:27,[(0,i.A)("Q264")]:27,[(0,i.A)("V264")]:27,[(0,i.A)("GAVC")]:27,[(0,i.A)("UMSV")]:27,[(0,i.A)("tshd")]:27,[(0,i.A)("INMC")]:27,[(0,i.A)("FMP4")]:12,[(0,i.A)("DIVX")]:12,[(0,i.A)("DX50")]:12,[(0,i.A)("XVID")]:12,[(0,i.A)("MP4S")]:12,[(0,i.A)("M4S2")]:12,[(0,i.A)("DIVX")]:12,4:12,[(0,i.A)("ZMP4")]:12,[(0,i.A)("DIV1")]:12,[(0,i.A)("BLZ0")]:12,[(0,i.A)("mp4v")]:12,[(0,i.A)("UMP4")]:12,[(0,i.A)("WV1F")]:12,[(0,i.A)("SEDG")]:12,[(0,i.A)("RMP4")]:12,[(0,i.A)("3IV2")]:12,[(0,i.A)("WAWV")]:12,[(0,i.A)("FFDS")]:12,[(0,i.A)("FVFW")]:12,[(0,i.A)("DCOD")]:12,[(0,i.A)("MVXM")]:12,[(0,i.A)("PM4V")]:12,[(0,i.A)("SMP4")]:12,[(0,i.A)("DXGM")]:12,[(0,i.A)("VIDM")]:12,[(0,i.A)("M4T3")]:12,[(0,i.A)("GEOX")]:12,[(0,i.A)("G264")]:12,[(0,i.A)("HDX4")]:12,[(0,i.A)("DM4V")]:12,[(0,i.A)("DMK2")]:12,[(0,i.A)("DYM4")]:12,[(0,i.A)("DIGI")]:12,[(0,i.A)("EPHV")]:12,[(0,i.A)("EM4A")]:12,[(0,i.A)("M4CC")]:12,[(0,i.A)("SN40")]:12,[(0,i.A)("VSPX")]:12,[(0,i.A)("ULDX")]:12,[(0,i.A)("GEOV")]:12,[(0,i.A)("SIPP")]:12,[(0,i.A)("SM4V")]:12,[(0,i.A)("XVIX")]:12,[(0,i.A)("DreX")]:12,[(0,i.A)("QMP4")]:12,[(0,i.A)("PLV1")]:12,[(0,i.A)("GLV4")]:12,[(0,i.A)("GMP4")]:12,[(0,i.A)("MNM4")]:12,[(0,i.A)("GTM4")]:12,[(0,i.A)("MPG4")]:14,[(0,i.A)("MP41")]:14,[(0,i.A)("MP42")]:15,[(0,i.A)("DIV2")]:15,[(0,i.A)("MP43")]:16,[(0,i.A)("DIV3")]:16,[(0,i.A)("MPG3")]:16,[(0,i.A)("DIV5")]:16,[(0,i.A)("DIV6")]:16,[(0,i.A)("DIV4")]:16,[(0,i.A)("DVX3")]:16,[(0,i.A)("AP41")]:16,[(0,i.A)("COL1")]:16,[(0,i.A)("COL0")]:16,[(0,i.A)("WMV1")]:17,[(0,i.A)("WMV2")]:18,[(0,i.A)("GXVE")]:18,[(0,i.A)("dvsd")]:24,[(0,i.A)("dvhd")]:24,[(0,i.A)("dvh1")]:24,[(0,i.A)("dvsl")]:24,[(0,i.A)("dv25")]:24,[(0,i.A)("dv50")]:24,[(0,i.A)("cdvc")]:24,[(0,i.A)("CDVH")]:24,[(0,i.A)("CDV5")]:24,[(0,i.A)("dvc ")]:24,[(0,i.A)("dvcs")]:24,[(0,i.A)("dvh1")]:24,[(0,i.A)("dvis")]:24,[(0,i.A)("pdvc")]:24,[(0,i.A)("SL25")]:24,[(0,i.A)("SLDV")]:24,[(0,i.A)("AVd1")]:24,[(0,i.A)("mpg1")]:2,[(0,i.A)("mpg2")]:2,[(0,i.A)("MPEG")]:2,[(0,i.A)("PIM1")]:2,[(0,i.A)("PIM2")]:2,[(0,i.A)("VCR2")]:2,268435457:2,268435458:2,268435460:2,[(0,i.A)("DVR ")]:2,[(0,i.A)("MMES")]:2,[(0,i.A)("LMP2")]:2,[(0,i.A)("slif")]:2,[(0,i.A)("EM2V")]:2,[(0,i.A)("M701")]:2,[(0,i.A)("M702")]:2,[(0,i.A)("M703")]:2,[(0,i.A)("M704")]:2,[(0,i.A)("M705")]:2,[(0,i.A)("mpgv")]:2,[(0,i.A)("BW10")]:2,[(0,i.A)("XMPG")]:2,[(0,i.A)("MJPG")]:7,[(0,i.A)("RV40")]:69,[(0,i.A)("AV01")]:225,[(0,i.A)("VP80")]:139,[(0,i.A)("VP90")]:167,[(0,i.A)("HEVC")]:173,[(0,i.A)("H265")]:173},n="00001000800000AA00389B71",d="2107D3118644C8C1CA000000",o="0000000000001000800000AA",s={"2C806DE046DBCF11B4D100805F6CBBEA":86019,BFAA23E958CB7144A119FFFA01E4CE62:86055,D242E147BA368D4D88FC61654F8C836C:86104,AF87FBA7022DFB42A4D405CD93843BDD:86056,"2B806DE046DBCF11B4D100805F6CBBEA":86016,"82EC1F6ACADB1945BDE756D3B3EF981D":69673,"3AC1FA38811D4361A40DCE53CA607CD1":86112}},85183:(e,t,a)=>{a.d(t,{Nk:()=>r,eP:()=>i,xz:()=>c});const i={A_AAC:86018,A_AC3:86019,A_ALAC:86032,A_DTS:86020,A_EAC3:86056,A_FLAC:86028,A_MLP:86045,"A_MPEG/L2":86016,"A_MPEG/L1":86058,"A_MPEG/L3":86017,A_OPUS:86076,"A_OPUS/EXPERIMENTAL":86076,"A_PCM/FLOAT/IEEE":65557,"A_PCM/INT/BIG":65537,"A_PCM/INT/LIT":65536,"A_QUICKTIME/QDMC":86066,"A_QUICKTIME/QDM2":86035,"A_REAL/14_4":77824,"A_REAL/28_8":77825,"A_REAL/ATRC":86047,"A_REAL/COOK":86036,"A_REAL/SIPR":86057,A_TRUEHD:86060,A_TTA1:86038,A_VORBIS:86021,A_WAVPACK4:86041,"D_WEBVTT/SUBTITLES":94226,"D_WEBVTT/CAPTIONS":94226,"D_WEBVTT/DESCRIPTIONS":94226,"D_WEBVTT/METADATA":94226,"S_TEXT/UTF8":94225,"S_TEXT/ASCII":94210,"S_TEXT/ASS":94230,"S_TEXT/SSA":94230,"S_TEXT/WEBVTT":94226,S_ASS:94230,S_SSA:94230,S_VOBSUB:94208,S_DVBSUB:94209,"S_HDMV/PGS":94214,"S_HDMV/TEXTST":94231,V_AV1:225,V_DIRAC:116,V_FFV1:33,V_MJPEG:7,V_MPEG1:1,V_MPEG2:2,"V_MPEG4/ISO/ASP":12,"V_MPEG4/ISO/AP":12,"V_MPEG4/ISO/SP":12,"V_MPEG4/ISO/AVC":27,"V_MPEGH/ISO/HEVC":173,"V_MPEGH/ISO/VVC":196,"V_MPEG4/MS/V3":16,V_PRORES:147,"V_REAL/RV10":5,"V_REAL/RV20":6,"V_REAL/RV30":68,"V_REAL/RV40":69,V_SNOW:208,V_THEORA:30,V_UNCOMPRESSED:13,V_VP8:139,V_VP9:167},r={V_VP8:139,V_VP9:167,V_AV1:225,A_VORBIS:86021,A_OPUS:86076,"D_WEBVTT/SUBTITLES":94226,"D_WEBVTT/CAPTIONS":94226,"D_WEBVTT/DESCRIPTIONS":94226,"D_WEBVTT/METADATA":94226},c={"image/gif":97,"image/jpeg":7,"image/png":61,"image/tiff":96}},null:()=>{}};
|
|
1
|
+
"use strict";(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[573],{3454:(e,t,a)=>{a.d(t,{Au:()=>y,He:()=>I,XC:()=>N,Y2:()=>u,hG:()=>A,oz:()=>g});var i=a(29688);const r=[44100,48e3,32e3,0],c=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],d=[0,1152,1152,384],o=[0,576,1152,384],s=[0,576,1152,384],l=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],p=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],f=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],h=[0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],m=[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1];function u(e,t){switch(e){case 0:return n[t];case 2:return c[t];case 3:return r[t]}return i.N_}function A(e,t){switch(e){case 0:return s[t];case 2:return o[t];case 3:return d[t]}return i.N_}function g(e,t,a){switch(t){case 1:switch(e){case 0:case 2:return m[a];case 3:return f[a]}break;case 2:switch(e){case 0:case 2:return m[a];case 3:return p[a]}case 3:switch(e){case 0:case 2:return h[a];case 3:return l[a]}}return i.N_}function y(e){switch(e){case 1:return 34;case 2:return 33;case 3:return 32}return i.N_}const I={32:"Layer1",33:"Layer2",34:"Layer3"};function N(e,t){if(t&&t.length>=4){const a=t[1]>>>3&3,i=(6&t[1])>>1,r=(12&t[2])>>>2,c=3&~(t[3]>>>6)?2:1,n=y(i),d=u(a,r);e.codecpar.profile=n,e.codecpar.sampleRate=d,e.codecpar.chLayout.nbChannels=c}}},4310:(e,t,a)=>{a.d(t,{Ui:()=>c,XC:()=>r});var i=a(54809);function r(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=6){const a=c(t);e.codecpar.profile=a.profile,e.codecpar.level=a.level}}function c(e){const t=new i.A(e.length);return t.appendBuffer(e.subarray(4)),{profile:t.readU(8),level:t.readU(8),bitDepth:t.readU(4),chromaSubsampling:t.readU(3),fullRangeFlag:t.readU1(),colorPrimaries:t.readU(8),colorTrc:t.readU(8),colorSpace:t.readU(8)}}},4345:(e,t,a)=>{function i(e,t){for(let a=0;a<e.length;a++)if(e[a].privData.uid===t)return e[a]}a.d(t,{A:()=>i})},9581:(e,t,a)=>{a.d(t,{Ui:()=>n,XC:()=>c,wN:()=>r});var i=a(54809);const r={0:"Profile0",1:"Profile1",2:"Profile2",3:"Profile3"};function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=6){const a=n(t);e.codecpar.profile=a.profile,e.codecpar.level=a.level}}function n(e){const t=new i.A(e.length);return t.appendBuffer(e),{profile:t.readU(8),level:t.readU(8),bitDepth:t.readU(4),chromaSubsampling:t.readU(3),fullRangeFlag:t.readU1(),colorPrimaries:t.readU(8),colorTrc:t.readU(8),colorSpace:t.readU(8)}}},16670:(e,t,a)=>{function i(e,t){for(let a=0;a<e.length;a++)if(e[a].privData.number===t)return e[a]}a.d(t,{A:()=>i})},17689:(e,t,a)=>{a.d(t,{Ij:()=>s,XC:()=>o,kt:()=>d});var i=a(98901),r=a(70704),c=a(99248);const n=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960];function d(e){let t=0,a=0,i=0;if(e.length<1)return 0;switch(t=e[0],a=n[t>>3],3&t){case 0:i=1;break;case 1:case 2:i=2;break;case 3:if(e.length<2)return 0;i=63&e[1]}return i*a}function o(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=19){const a=new r.A(t,!1);a.skip(9),e.codecpar.chLayout.nbChannels=a.readUint8(),e.codecpar.initialPadding=a.readUint16(),e.codecpar.sampleRate=a.readUint32(),e.codecpar.seekPreroll=Number((0,i.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function s(e){const t=new Uint8Array(19),a=new c.A(t,!1);return a.writeString("OpusHead"),a.writeUint8(1),a.writeUint8(e.chLayout.nbChannels),a.writeUint16(e.initialPadding),a.writeUint32(e.sampleRate),t}},25248:(e,t,a)=>{a.r(t),a.d(t,{default:()=>H});var i=a(19371),r=a(80209),c=a(54568),n=a(56238),d=a(6927),o=a(55982),s=a(49103),l=a(35734),p=a(85183),f=a(27228),h=a(4345),m=a(16670),u=a(78753),A=a(41050),g=a(35924),y=a(46564),I=a(46626),N=a(98901),x=a(29688),b=a(64347),B=a(99817),P=a(43963),S=a(47354),v=a(73448),k=a(20642),R=a(12062),D=a(3454),C=a(17689),V=a(9581),w=a(4310),M=a(25721),U=a(84777),L=a(27376),_=a(83796),E=a(23902),T=a(34117),z=a(41662),X=a(18528),G=a(72034),O=a(70704);const F="packages/avformat/src/formats/IMatroskaFormat.ts";function W(e){e<0&&(e=BigInt(0));const t=Math.round(Number(BigInt.asIntN(32,e%BigInt(1e3)))/10),a=Number(BigInt.asIntN(32,e/BigInt(1e3)%BigInt(60))),i=Number(BigInt.asIntN(32,e/BigInt(1e3)/BigInt(60)%BigInt(60))),r=Number(BigInt.asIntN(32,e/BigInt(1e3)/BigInt(3600)));return L.GP("%s:%02d:%02d.%02d",r,i,a,t)}class H extends l.A{constructor(){super(),(0,i.A)(this,"type",8),(0,i.A)(this,"context",void 0),(0,i.A)(this,"blockReader",void 0)}init(e){e.ioReader&&e.ioReader.setEndian(!0);const t={isLive:!0,firstCluster:-BigInt(1),segmentStart:-BigInt(1),header:{version:0,readVersion:0,maxIdLength:4,maxSizeLength:8,docType:"",docTypeVersion:0,docTypeReadVersion:0},seekHead:null,info:null,tracks:null,attachments:null,chapters:null,cues:null,tags:null,maxPts:x.Dh,currentCluster:{timeCode:BigInt(0),pos:-BigInt(1),block:{pos:-BigInt(1),size:-BigInt(1)},blockGroup:{block:null}},clusterIndexes:[],clusterIndexesPosMap:new Map};e.privateData=this.context=t}analyzeStreams(e){let t=x.Dh;const a="webm"===this.context.header.docType?p.Nk:p.eP;var i;if(this.context.tracks&&_.__(this.context.tracks.entry,(t=>{var i,c,n;const d=e.createStream();switch(d.privData=t,d.codecpar.codecId=a[t.codecId]||0,t.type){case 2:d.codecpar.codecType=1;break;case 1:d.codecpar.codecType=0,d.codecpar.flags|=4;break;case 17:d.codecpar.codecType=3;break;default:d.codecpar.codecType=-1}t.language&&(d.metadata.language=t.language),t.name&&(d.metadata.title=t.name),t.audio?("A_PCM/FLOAT/IEEE"===t.codecName?64===t.audio.bitDepth?d.codecpar.codecId=65559:32===t.audio.bitDepth&&(d.codecpar.codecId=65557):"A_PCM/INT/BIG"===t.codecName?16===t.audio.bitDepth?d.codecpar.codecId=65537:24===t.audio.bitDepth?d.codecpar.codecId=65549:32===t.audio.bitDepth&&(d.codecpar.codecId=65545):"A_PCM/INT/LIT"===t.codecName&&(8===t.audio.bitDepth?d.codecpar.codecId=65541:16===t.audio.bitDepth?d.codecpar.codecId=65536:24===t.audio.bitDepth?d.codecpar.codecId=65548:32===t.audio.bitDepth&&(d.codecpar.codecId=65544)),d.codecpar.chLayout.nbChannels=t.audio.channels,d.codecpar.sampleRate=0|t.audio.sampleRate,d.codecpar.bitsPerCodedSample=t.audio.bitDepth):t.video&&(d.codecpar.width=t.video.pixelWidth,d.codecpar.height=t.video.pixelHeight,t.video.color&&(U.ai(t.video.color.primaries)&&(d.codecpar.colorPrimaries=t.video.color.primaries),U.ai(t.video.color.transferCharacteristics)&&(d.codecpar.colorTrc=t.video.color.transferCharacteristics),U.ai(t.video.color.range)&&(d.codecpar.colorRange=t.video.color.range),U.ai(t.video.color.matrixCoefficients)&&(d.codecpar.colorSpace=t.video.color.matrixCoefficients)));let o=0;if("V_MS/VFW/FOURCC"===t.codecId&&(null===(i=t.codecPrivate)||void 0===i?void 0:i.size)>=40)d.codecpar.bitsPerCodedSample=t.codecPrivate.data[15]<<8|t.codecPrivate.data[14],d.codecpar.codecTag=t.codecPrivate.data[19]<<24|t.codecPrivate.data[18]<<16|t.codecPrivate.data[17]<<8|t.codecPrivate.data[16],d.codecpar.codecId=u.nz[d.codecpar.codecTag]||0,0===d.codecpar.codecId&&(d.codecpar.codecId,A.pj[d.codecpar.codecTag]),o=40;else if("V_QUICKTIME"===t.codecId&&(null===(c=t.codecPrivate)||void 0===c?void 0:c.size)>=21){const e=1===d.codecpar.codecType?A._B:A.pj;d.codecpar.codecTag=t.codecPrivate.data[3]<<24|t.codecPrivate.data[2]<<16|t.codecPrivate.data[1]<<8|t.codecPrivate.data[0];let a=e[d.codecpar.codecTag];if(a){const e=new Uint8Array(4),a=Number(BigInt.asIntN(32,t.codecPrivate.size));e[0]=a>>>24&255,e[1]=a>>>16&255,e[2]=a>>>8&255,e[3]=255&a,t.codecPrivate.size+=BigInt(4),t.codecPrivate.data=(0,X.A)(Uint8Array,[e,t.codecPrivate.data])}else d.codecpar.codecTag=t.codecPrivate.data[7]<<24|t.codecPrivate.data[6]<<16|t.codecPrivate.data[5]<<8|t.codecPrivate.data[4],a=e[d.codecpar.codecTag];d.codecpar.codecId=a||0}if(null!==(n=t.codecPrivate)&&void 0!==n&&n.data&&t.codecPrivate.size-BigInt(Math.floor(o))>0){let e=t.codecPrivate.data.subarray(o);if(94212===d.codecpar.codecId||94230===d.codecpar.codecId){t.ass={hasLayer:!1};let a,i=z.decode(e).split(/\r?\n/);for(let e=0;e<i.length;e++)if("[Events]"===i[e].trim()){i[e+1]&&/^Format:/.test(i[e+1])&&(a=i[e+1]),i=i.slice(0,e);break}if(a){a=a.replace(/^Format:/,"");const e=a.split(",").map((e=>e.trim())).filter((e=>"Start"!==e&&"End"!==e));t.ass.hasLayer="Layer"===e[0],t.ass.hasLayer?e.splice(1,0,"Start","End"):(e.unshift("End"),e.unshift("Start")),a=`Format: ${e.join(", ")}`}i.push("[Events]"),i.push(a||"Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"),a||(t.ass.hasLayer=!0),e=z.encode(i.join("\n"))}if(d.codecpar.extradataSize=e.length,d.codecpar.extradata=(0,I.sY)(e.length),(0,r.lW)(d.codecpar.extradata,e.length,e),d.codecpar.extradata)switch(d.codecpar.codecId){case 27:{const e=(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize);k.XC(d,e),B.Bs(e)&&(d.codecpar.flags|=1);break}case 173:{const e=(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize);R.XC(d,e),B.Bs(e)&&(d.codecpar.flags|=1);break}case 196:{const e=(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize);M.XC(d,e),B.Bs(e)&&(d.codecpar.flags|=1);break}case 225:S.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 139:w.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 167:V.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86018:P.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86017:D.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86076:C.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));break;case 86028:if(d.codecpar.extradataSize>v.ob){const e=new O.A((0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize));if("fLaC"===e.readString(4))for(;e.remainingSize();){const t=e.readUint8(),a=e.readUint24(),i=-129&t;if(0===i){const t=e.readBuffer(a);(0,I.Eb)(d.codecpar.extradata),d.codecpar.extradata=(0,I.sY)(t.length),d.codecpar.extradataSize=t.length,(0,r.lW)(d.codecpar.extradata,t.length,t);break}e.skip(i)}}d.codecpar.extradataSize===v.ob&&v.XC(d,(0,r.s3)(d.codecpar.extradata,d.codecpar.extradataSize))}else{let e;86018===d.codecpar.codecId&&(e=P.Ij(d.codecpar)),e&&(d.codecpar.extradataSize=e.length,d.codecpar.extradata=(0,I.sY)(d.codecpar.extradataSize),(0,r.lW)(d.codecpar.extradata,d.codecpar.extradataSize,e))}}this.context.info&&(d.timeBase.num=1,this.context.info.timestampScale?d.timeBase.den=1e3*x.SF/this.context.info.timestampScale|0:(d.timeBase.den=1e3,this.context.info.timestampScale=x.SF),this.context.info.duration&&(d.duration=BigInt(Math.floor(this.context.info.duration)))),(null==t.default||t.default)&&(d.disposition|=1),94226===d.codecpar.codecId&&("D_WEBVTT/CAPTIONS"===t.codecId?d.disposition|=65536:("D_WEBVTT/DESCRIPTIONS"===t.codecId||"D_WEBVTT/METADATA"===t.codecId)&&d.disposition),t.encodings&&_.__(t.encodings.entry,(e=>{e.compression&&(0,G.A)(e.compression.algo)&&(t.needDecompression=!0),e.encryption&&(0,G.A)(e.encryption.algo)&&(t.needDecryption=!0)}))})),this.context.attachments&&_.__(this.context.attachments.entry,(t=>{const a=e.createStream();if(a.codecpar.codecType=4,a.privData=t,t.name&&(a.metadata.title=t.name),t.mime&&(a.metadata.mime=t.mime),t.description&&(a.metadata.description=t.description),t.data)if(p.xz[t.mime]){a.codecpar.codecId=p.xz[t.mime],a.codecpar.codecType=0,a.disposition|=1024,a.attachedPic=(0,y._5)(),d.M[15](a.attachedPic+32,a.index);const e=(0,I.sY)(Number(BigInt.asUintN(32,t.data.size)));(0,r.lW)(e,Number(BigInt.asUintN(32,t.data.size)),t.data.data),(0,y.NX)(a.attachedPic,e,Number(BigInt.asIntN(32,t.data.size))),d.M[15](a.attachedPic+36,1|n.f[15](a.attachedPic+36))}else a.codecpar.extradataSize=Number(BigInt.asIntN(32,t.data.size)),a.codecpar.extradata=(0,I.sY)(a.codecpar.extradataSize),(0,r.lW)(a.codecpar.extradata,a.codecpar.extradataSize,t.data.data)})),this.context.tags&&_.__(this.context.tags.entry,(a=>{a.tag&&a.tag.forEach((i=>{const r=i.name;let c=i.string;if(a.target){if("DURATION"===r){let e=i.string.replaceAll("\0","").split("."),t=e[0].split(":");c=BigInt(+t[0])*BigInt(36e8)+BigInt(+t[1])*BigInt(6e7)+BigInt(+t[2])*BigInt(1e6)+BigInt(+e[1])/BigInt(1e3)}if(a.target.chapterUid)for(let t=0;t<e.chapters.length;t++){const i=e.chapters[t];i.id===a.target.chapterUid&&(i.metadata[r]=c)}else if(a.target.trackUid||a.target.attachUid){const i=(0,h.A)(e.streams,a.target.trackUid||a.target.attachUid);i&&("DURATION"===r?(i.duration=(0,N.k)(c,x.KR,i.timeBase),c>t&&(t=c)):i.metadata[r]=c)}else e.metadata[r]=c}else e.metadata[r]=c}))})),this.context.info&&(this.context.info.muxingApp&&(e.metadata.encoder=this.context.info.muxingApp),this.context.info.title&&(e.metadata.title=this.context.info.title),8===(null===(i=this.context.info.dateUTC)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.byteLength))){const t=new DataView(this.context.info.dateUTC.data.buffer).getBigUint64(0)/BigInt(1e6)+BigInt(9783072e5);e.metadata.creationTime=new Date(Number(t)).toISOString()}if(this.context.chapters&&(_.__(this.context.chapters.entry,(t=>{const a=t.atom;a&&_.__(a,(t=>{var a,i,r,c;e.chapters.push({id:t.uid,start:null!==(a=t.start)&&void 0!==a?a:x.Dh,end:null!==(i=t.end)&&void 0!==i?i:x.Dh,timeBase:{num:1,den:1e9},metadata:{title:(null===(r=t.display)||void 0===r?void 0:r.title)||"",language:(null===(c=t.display)||void 0===c?void 0:c.language)||""}})}))})),e.chapters.length)){for(let t=0;t<e.chapters.length-1;t++)e.chapters[t].end===x.Dh&&(e.chapters[t].end=e.chapters[t+1].start);e.chapters[e.chapters.length-1].end===x.Dh&&(e.chapters[e.chapters.length-1].end=(0,N.k)(t,x.KR,e.chapters[e.chapters.length-1].timeBase))}}async readHeader(e){if(440786851!==await(0,f.aL)(e,this.context.header.maxIdLength))return T.z3("not matroska format",F,618),g.LR;const t=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(this.context.header=E.X$(this.context.header,await(0,f.Pb)(e,t,f.jt)),408125543!==await(0,f.aL)(e,this.context.header.maxIdLength))return T.z3("not matroska format",F,627),g.LR;const a=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);this.context.segmentStart=e.ioReader.getPos();const i=e.ioReader.getPos()+a,r=new Set;let c=!1,n=!1;for(;e.ioReader.getPos()<i||!c||!n;){const t=e.ioReader.getPos(),a=await(0,f.aL)(e,this.context.header.maxIdLength);if(a===g.LR){await this.syncTopLevelElement(e,2);continue}const i=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(i!==BigInt(0|g.LR)){if(290298740===a)this.context.isLive=!1,this.context.seekHead=await(0,f.Pb)(e,i,f.Cr);else if(475249515===a)this.context.isLive=!1,this.context.cues=await(0,f.Pb)(e,i,f.eG);else if(272869232===a)this.context.isLive=!1,this.context.chapters=await(0,f.Pb)(e,i,f.Y0);else if(357149030===a)this.context.info=await(0,f.Pb)(e,i,f.qi);else if(307544935===a)this.context.tags=await(0,f.Pb)(e,i,f.hK);else if(423732329===a)this.context.attachments=await(0,f.Pb)(e,i,f.qp);else if(374648427===a)c=!0,this.context.tracks=await(0,f.Pb)(e,i,f.Wy);else if(524531317===a){if(n=!0,this.context.firstCluster=t,this.context.isLive||!this.context.seekHead||!(1&e.ioReader.flags))break;const a=this.context.seekHead.entry;let i=0;for(;i<a.length;i++)if(!r.has(a[i].id)){await e.ioReader.seek(a[i].pos+this.context.segmentStart);break}if(i===a.length)break}else await e.ioReader.skip(Number(BigInt.asIntN(32,i)));r.add(a)}else await this.syncTopLevelElement(e,2)}return this.context.firstCluster>0&&await e.ioReader.seek(this.context.firstCluster),this.analyzeStreams(e),0}parseAdditions(e,t,a){for(let n=0;n<t.entry.length;n++){var i;const d=t.entry[n];if(null!==(i=d.additional)&&void 0!==i&&i.size)if(4===d.additionalId&&T.R8("ITU_T_T35 not support now",F,721),94226===a.codecpar.codecId){const t=z.decode(d.additional.data).split("\n");if(t.length>=2){if(t[0]){const a=z.encode(t[0]),i=(0,I.sY)(a.length);(0,r.lW)(i,a.length,a),(0,y.Ow)(e,17,i,a.length)}if(t[1]){const a=z.encode(t[1]),i=(0,I.sY)(a.length);(0,r.lW)(i,a.length,a),(0,y.Ow)(e,16,i,a.length)}}}else{var c;const t=(0,I.sY)(d.additional.data.length+8);b.Cv(t,BigInt(null!==(c=d.additionalId)&&void 0!==c?c:1)),(0,r.lW)(t+8,d.additional.data.length,d.additional.data),(0,y.Ow)(e,15,t,d.additional.data.length+8),1!==d.additionalId||139!==a.codecpar.codecId&&167!==a.codecpar.codecId&&225!==a.codecpar.codecId||(a.codecpar.flags|=8)}}}processAss(e,t){const a=t.privData,i=z.decode((0,y.iI)(e)).split(",").map((e=>e.trim()));i.shift();const c=W((0,N.k)(n.f[17](e+8),(0,s.A)(e+72,o.Q),x.i0)),d=W((0,N.k)(n.f[17](e+8)+n.f[17](e+48),(0,s.A)(e+72,o.Q),x.i0));a.ass.hasLayer?i.splice(1,0,c,d):(i.unshift(d),i.unshift(c));const l=z.encode(`Dialogue: ${i.join(",")}`),p=(0,I.sY)(l.length);(0,r.lW)(p,l.length,l),(0,y.NX)(e,p,l.length)}async parseBlock(e,t){var a,i,o;const s=(null===(a=this.context.currentCluster.block)||void 0===a?void 0:a.data)||this.context.currentCluster.blockGroup.block.data;let l=null===(i=this.context.currentCluster.block)||void 0===i?void 0:i.pos;l<0&&(l=this.context.currentCluster.blockGroup.block.pos);let p,h=-1,u=BigInt(0);null!==(o=this.context.currentCluster.blockGroup)&&void 0!==o&&o.block&&(p=this.context.currentCluster.blockGroup.additions,h=this.context.currentCluster.blockGroup.reference?0===this.context.currentCluster.blockGroup.reference.length?1:0:1,this.context.currentCluster.blockGroup.duration&&(u=this.context.currentCluster.blockGroup.duration)),this.blockReader?this.blockReader.resetBuffer(s):this.blockReader=new O.A(s);const A=this.blockReader.getPos(),b=Number(BigInt.asUintN(32,await(0,f.Qb)(this.blockReader,8))),B=(0,m.A)(e.streams,b);if(!B)return T.z3(`invalid track number ${b}`,F,825),g.OY;const P=this.blockReader.readInt16(),S=this.blockReader.readUint8();-1===h&&(h=128&S?1:0);let v=0,k=[];switch(S>>>1&3){case 1:{v=this.blockReader.readUint8()+1;let e=0;for(let t=0;t<v-1;t++){let t=0;for(;;){const e=this.blockReader.readUint8();if(0===e)break;if(255!==e){t+=e;break}t+=255}e+=t,k.push(t)}k.push(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A))-e);break}case 3:{v=this.blockReader.readUint8()+1,k.push(await(0,f.Ag)(this.blockReader,4));let e=k[0];for(let t=1;t<v-1;t++){let a=await(0,f.pf)(this.blockReader,4)+k[t-1];e+=a,k.push(a)}k.push(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A))-e);break}case 2:v=this.blockReader.readUint8()+1;const e=(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A)))/v;for(let t=0;t<v;t++)k.push(e);break;case 0:v=1,k.push(s.length-Number(BigInt.asIntN(32,this.blockReader.getPos()-A)))}const R=B.privData,D=R.timeScale||1;if(R.needDecryption)throw new Error("not support encryption stream");let C=(this.context.currentCluster.timeCode+BigInt(Math.floor(P*D)))*BigInt(0|this.context.info.timestampScale);R.codecDelay&&(C-=R.codecDelay),C/=BigInt(1e3),C=(0,N.k)(C,x.KR,B.timeBase),u=BigInt(Math.floor(Number(BigInt.asIntN(32,u))*D))*BigInt(0|this.context.info.timestampScale),u/=BigInt(1e3),u=(0,N.k)(u,x.KR,B.timeBase);for(let a=0;a<v;a++){const i=0!==a?(0,y._5)():t;let o,s=k[a],f=0;if(R.needDecompression){const e=R.encodings.entry.find((e=>!!e.compression));3===e.compression.algo?(o=e.compression.settings.data,s+=o.length,f=o.length):T.h2(`not support compression stream, algo: ${e.compression.algo}`,F,935)}d.M[17](i+56,l+this.blockReader.getPos()),d.M[15](i+32,B.index),(0,r.Mr)(i+72,B.timeBase[c.o9],8),d.M[17](i+8,C),d.M[15](i+28,s),d.M[17](i+48,u);const m=(0,I.sY)(s);o&&(0,r.lW)(m,f,o),(0,r.lW)(m+f,k[a],this.blockReader.readBuffer(k[a])),(0,y.NX)(i,m,s),0!==B.codecpar.codecType?(d.M[15](i+36,1|n.f[15](i+36)),d.M[17](i+16,C)):(h&&d.M[15](i+36,1|n.f[15](i+36)),27!==B.codecpar.codecId&&173!==B.codecpar.codecId&&196!==B.codecpar.codecId||(1&B.codecpar.flags?d.M[15](i+36,64|n.f[15](i+36)):d.M[15](i+36,-65&n.f[15](i+36)))),p&&this.parseAdditions(i,p,B),94212!==B.codecpar.codecId&&94230!==B.codecpar.codecId||this.processAss(i,B),0!==a&&e.interval.packetBuffer.push(i),this.context.maxPts<C&&(this.context.maxPts=C)}return this.context.currentCluster.block={pos:-BigInt(1),size:-BigInt(1)},this.context.currentCluster.blockGroup={block:null},0}addClusterIndex(e){if(this.context.clusterIndexesPosMap.has(e.pos))return;const t=_.El(this.context.clusterIndexes,(t=>t.time<e.time?1:-1));t>-1?(this.context.clusterIndexesPosMap.set(e.pos,t),this.context.clusterIndexes.splice(t,0,e)):(this.context.clusterIndexesPosMap.set(e.pos,this.context.clusterIndexes.length),this.context.clusterIndexes.push(e))}async readAVPacket_(e,t){const a=e.ioReader.getPos(),i=await(0,f.aL)(e,this.context.header.maxIdLength);if(i===g.LR)return await this.syncTopLevelElement(e),this.readAVPacket_(e,t);const r=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(r===BigInt(g.LR))return await this.syncTopLevelElement(e),this.readAVPacket_(e,t);if(524531317===i){this.context.currentCluster.pos=a,this.context.currentCluster.timeCode=BigInt(0),await(0,f.Pb)(e,r,f.GZ,this.context.currentCluster,[163,160]),this.context.isLive||this.addClusterIndex({time:this.context.currentCluster.timeCode,pos:a});let i=await this.parseBlock(e,t);if(i===g.OY)return this.readAVPacket_(e,t);if(i<0)return i}else if(163===i){this.context.currentCluster.block={pos:e.ioReader.getPos(),size:r,data:await e.ioReader.readBuffer(Number(BigInt.asIntN(32,r)))};let a=await this.parseBlock(e,t);if(a===g.OY)return this.readAVPacket_(e,t);if(a<0)return a}else{if(160!==i)return 475249515===i||307544935===i||423732329===i||272869232===i||357149030===i||374648427===i||290298740===i?(await e.ioReader.skip(Number(BigInt.asIntN(32,r))),this.readAVPacket_(e,t)):(await this.syncTopLevelElement(e),this.readAVPacket_(e,t));{await(0,f.Pb)(e,r,f.Wg,this.context.currentCluster.blockGroup);let a=await this.parseBlock(e,t);if(a===g.OY)return this.readAVPacket_(e,t);if(a<0)return a}}return 0}async readAVPacket(e,t){try{return await this.readAVPacket_(e,t)}catch(t){return-1048576!==e.ioReader.error&&-1048572!==e.ioReader.error?(T.z3(`read packet error, ${t}`,F,1124),g.LR):e.ioReader.error}}async syncTopLevelElement(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,a=x.Dh;for(;;)try{if(8&e.ioReader.flags)break;const i=e.ioReader.getPos(),r=await e.ioReader.peekUint32();if(524531317===r||475249515===r||307544935===r||423732329===r||272869232===r||357149030===r||374648427===r||290298740===r){a=i;let r=0;await e.ioReader.skip(4);const c=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(c===BigInt(g.LR)){await e.ioReader.seek(i+BigInt(1));continue}for(await e.ioReader.skip(Number(BigInt.asIntN(32,c)));r<=t;){const t=await(0,f.aL)(e,this.context.header.maxIdLength),a=await(0,f.Qb)(e.ioReader,this.context.header.maxSizeLength);if(524531317!==t&&475249515!==t&&307544935!==t&&423732329!==t&&272869232!==t&&357149030!==t&&374648427!==t&&290298740!==t)break;r++,await e.ioReader.skip(Number(BigInt.asIntN(32,a)))}if(!(r<t))break;await e.ioReader.seek(a+BigInt(1)),a=x.Dh}else await e.ioReader.skip(1),a=x.Dh}catch(e){break}a!==x.Dh&&await e.ioReader.seek(a)}async seek(e,t,a,i){var r;const c=e.ioReader.getPos();if(2&i)return await e.ioReader.seek(a),c;const n=(0,N.k)(a,t.timeBase,x.KR);let d=x.Dh;if(null!==(r=this.context.cues)&&void 0!==r&&r.entry.length){const e=t.privData;for(let t=0;t<this.context.cues.entry.length;t++)if((this.context.cues.entry[t].time||BigInt(0))*BigInt(0|this.context.info.timestampScale)/BigInt(1e3)>n){const a=this.context.cues.entry[Math.max(t-1,0)].pos;if(a.length){const t=a.find((t=>t.track===e.number));if(t){d=t.pos+this.context.segmentStart;break}}}}if(d===x.Dh&&this.context.clusterIndexes.length){for(let e=0;e<this.context.clusterIndexes.length;e++)if(this.context.clusterIndexes[e].time*BigInt(0|this.context.info.timestampScale)/BigInt(1e3)>n){d=this.context.clusterIndexes[Math.max(e-1,0)].pos;break}d===x.Dh&&(d=this.context.clusterIndexes[this.context.clusterIndexes.length-1].pos)}return d!==x.Dh?(await e.ioReader.seek(d),c):BigInt(g.E$)}getAnalyzeStreamsCount(){return 0}}},27228:(e,t,a)=>{a.d(t,{Ag:()=>N,Cr:()=>s,GZ:()=>y,Pb:()=>v,Qb:()=>b,Wg:()=>g,Wy:()=>p,Y0:()=>h,aL:()=>S,eG:()=>m,hK:()=>A,jt:()=>I,pf:()=>x,qi:()=>l,qp:()=>f});var i=a(84777),r=a(83796),c=a(34117),n=a(35924);const d="packages/avformat/src/formats/matroska/imatroska.ts",o=BigInt(20971520),s={19899:{type:9,isArray:!0,filedName:"entry",child:{21419:{type:1,filedName:"id"},21420:{type:2,filedName:"pos"}}}},l={29604:{type:2,filedName:"segmentUUID"},2807729:{type:1,filedName:"timestampScale"},17545:{type:5,filedName:"duration"},31657:{type:7,filedName:"title"},19840:{type:7,filedName:"muxingApp"},22337:{type:7,filedName:"writingApp"},17505:{type:8,filedName:"dateUTC"}},p={174:{type:9,isArray:!0,filedName:"entry",child:{215:{type:1,filedName:"number"},29637:{type:1,filedName:"uid"},131:{type:1,filedName:"type"},21358:{type:7,filedName:"name"},136:{type:10,filedName:"default"},185:{type:10,filedName:"enabled"},2274716:{type:7,filedName:"language"},2306383:{type:6,filedName:"timeScale"},134:{type:7,filedName:"codecId"},2459272:{type:7,filedName:"codecName"},25506:{type:8,filedName:"codecPrivate"},225:{type:9,filedName:"audio",child:{181:{type:5,filedName:"sampleRate"},30901:{type:5,filedName:"outSampleRate"},25188:{type:1,filedName:"bitDepth"},159:{type:1,filedName:"channels"}}},224:{type:9,filedName:"video",child:{2327523:{type:1,filedName:"framerate"},21680:{type:1,filedName:"displayWidth"},21690:{type:1,filedName:"displayHeight"},176:{type:1,filedName:"pixelWidth"},186:{type:1,filedName:"pixelHeight"},3061028:{type:8,filedName:"colorSpace"},21440:{type:1,filedName:"alphaMode"},21936:{type:9,filedName:"color",child:{21937:{type:1,filedName:"matrixCoefficients"},21938:{type:1,filedName:"bitsPerChannel"},21941:{type:1,filedName:"cbSubHorz"},21942:{type:1,filedName:"cbSubVert"},21939:{type:1,filedName:"chromaSubHorz"},21940:{type:1,filedName:"chromaSubVert"},21943:{type:1,filedName:"chromaSitingHorz"},21944:{type:1,filedName:"chromaSitingVert"},21945:{type:1,filedName:"range"},21946:{type:1,filedName:"transferCharacteristics"},21947:{type:1,filedName:"primaries"},21948:{type:1,filedName:"maxCll"},21949:{type:1,filedName:"maxFall"},21968:{type:9,filedName:"masteringMeta",child:{21969:{type:5,filedName:"rx"},21970:{type:5,filedName:"ry"},21971:{type:5,filedName:"gx"},21972:{type:5,filedName:"gy"},21973:{type:5,filedName:"bx"},21974:{type:5,filedName:"by"},21975:{type:5,filedName:"whiteX"},21976:{type:5,filedName:"whiteY"},21978:{type:5,isArray:!0,filedName:"minLuminance"},21977:{type:5,filedName:"maxLuminance"}}}}},30320:{type:9,filedName:"projection",child:{30321:{type:1,filedName:"type"},30322:{type:8,filedName:"private"},30323:{type:5,filedName:"yaw"},30324:{type:5,filedName:"pitch"},30325:{type:5,filedName:"roll"}}},21682:{type:1,filedName:"displayUnit"},154:{type:1,filedName:"interlaced"},157:{type:1,filedName:"fieldOrder"},21432:{type:1,filedName:"stereoMode"},21683:{type:1,filedName:"aspectRatio"}}},226:{type:9,filedName:"operations",child:{227:{type:9,isArray:!0,filedName:"entry",child:{228:{type:9,isArray:!0,filedName:"planes",child:{230:{type:1,filedName:"type"},229:{type:1,filedName:"uid"}}}}}}},28032:{type:9,filedName:"encodings",child:{25152:{type:9,isArray:!0,filedName:"entry",child:{20530:{type:1,filedName:"scope"},20531:{type:1,filedName:"type"},20532:{type:9,filedName:"compression",child:{16980:{type:1,filedName:"algo"},16981:{type:8,filedName:"settings"}}},20533:{type:9,filedName:"encryption",child:{18401:{type:1,filedName:"algo"},18402:{type:8,filedName:"keyId"}}}}}}}}}},f={24999:{type:9,isArray:!0,filedName:"entry",child:{18094:{type:1,filedName:"uid"},18030:{type:7,filedName:"name"},18016:{type:7,filedName:"mime"},18046:{type:7,filedName:"description"},18012:{type:8,filedName:"data"}}}},h={17849:{type:9,isArray:!0,filedName:"entry",child:{182:{type:9,isArray:!0,filedName:"atom",child:{145:{type:2,filedName:"start"},146:{type:2,filedName:"end"},29636:{type:1,filedName:"uid"},128:{type:9,filedName:"display",child:{133:{type:7,filedName:"title"},17276:{type:7,filedName:"language"}}}}}}}},m={187:{type:9,isArray:!0,filedName:"entry",child:{179:{type:2,filedName:"time"},183:{type:9,isArray:!0,filedName:"pos",child:{247:{type:1,filedName:"track"},241:{type:2,filedName:"pos"}}}}}},u={17827:{type:7,filedName:"name"},17543:{type:7,filedName:"string"},17530:{type:7,filedName:"language"},17540:{type:1,filedName:"default"},17588:{type:1,filedName:"default"},26568:{type:9,filedName:"sub"}};u[26568].child=u;const A={29555:{type:9,isArray:!0,filedName:"entry",child:{26568:{type:9,filedName:"tag",child:u,isArray:!0},25536:{type:9,filedName:"target",child:{25546:{type:7,filedName:"type"},26826:{type:1,filedName:"typeValue"},25541:{type:1,filedName:"trackUid"},25540:{type:1,filedName:"chapterUid"},25542:{type:1,filedName:"attachUid"}}}}}},g={161:{type:8,filedName:"block"},30113:{type:9,filedName:"additions",child:{166:{type:9,isArray:!0,filedName:"entry",child:{238:{type:1,filedName:"additionalId"},165:{type:8,filedName:"additional"}}}}},155:{type:2,filedName:"duration"},30114:{type:4,filedName:"discardPadding"},251:{type:4,isArray:!0,filedName:"reference"},164:{type:10,filedName:"nonSimple"}},y={163:{type:8,filedName:"block"},160:{type:9,filedName:"blockGroup",child:g},231:{type:2,filedName:"timeCode"},167:{type:2,filedName:"pos"},171:{type:2,filedName:"prevSize"}},I={17030:{type:1,filedName:"version"},17143:{type:1,filedName:"readVersion"},17138:{type:1,filedName:"maxIdLength"},17139:{type:1,filedName:"maxSizeLength"},17026:{type:7,filedName:"docType"},17031:{type:1,filedName:"docTypeVersion"},17029:{type:1,filedName:"docTypeReadVersion"}};async function N(e,t){const a=e.getPos();let i=await e.readUint8();if(!i)return c.z3(`0x00 as pos ${a} invalid as first byte of an EBML number`,d,765),n.LR;let r=1;for(;!(128&i);)r++,i<<=1;if(i&=127,r>t)return c.z3(`Length ${r} indicated by an EBML number's first byte ${i.toString(16)} at pos ${a} exceeds max length ${t}.`,d,778),n.LR;let o=i>>>r-1;for(;--r;)o<<=8,o|=await e.readUint8();return o}async function x(e,t){const a=e.getPos();return await N(e,t)-((1<<7*Number(BigInt.asIntN(32,e.getPos()-a))-1)-1)}async function b(e,t){const a=e.getPos();let i=await e.readUint8(),r=1;if(!i)return c.z3(`0x00 as pos ${a} invalid as first byte of an EBML number`,d,812),BigInt(n.LR);for(;!(128&i);)r++,i<<=1;if(i&=127,r>t)return c.z3(`Length ${r} indicated by an EBML number's first byte ${i.toString(16)} at pos ${a} exceeds max length ${t}.`,d,823),BigInt(n.LR);let o=BigInt(Math.floor(i>>>r-1));for(;--r;){o<<=BigInt(8);const t=await e.readUint8();o|=BigInt(Math.floor(t))}return o}async function B(e,t){switch(t){case BigInt(0):return 0;case BigInt(1):return e.ioReader.readUint8();case BigInt(2):return e.ioReader.readUint16();case BigInt(3):return e.ioReader.readUint24();case BigInt(4):return e.ioReader.readUint32();case BigInt(8):return e.ioReader.readUint64()}let a=BigInt(0),i=0;for(;i++<t;){const t=await e.ioReader.readUint8();a=a<<BigInt(8)|BigInt.asUintN(64,BigInt(Math.floor(t)))}return a}async function P(e,t){switch(t){case BigInt(0):return 0;case BigInt(1):return e.ioReader.readInt8();case BigInt(2):return e.ioReader.readInt16();case BigInt(4):return e.ioReader.readInt32();case BigInt(8):return e.ioReader.readInt64()}let a=BigInt(0),i=0;for(;i++<t;){const t=await e.ioReader.readUint8();a=a<<BigInt(8)|BigInt.asUintN(64,BigInt(Math.floor(t)))}return t===BigInt(3)?Number(BigInt.asIntN(32,BigInt.asIntN(24,a))):BigInt.asIntN(64,a)}async function S(e,t){const a=e.ioReader.getPos();let i=await e.ioReader.peekUint8();if(!i)return c.z3(`0x00 as pos ${a} invalid as first byte of an EBML number`,d,908),n.LR;let r=1;for(;!(128&i);)r++,i<<=1;if(r>t)return c.z3(`Length ${r} indicated by an EBML number's first byte ${i.toString(16)} at pos ${a} exceeds max length ${t}.`,d,920),n.LR;let o=0;for(;r--;)o<<=8,o|=await e.ioReader.readUint8();return o}async function v(e,t,a){let c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return await async function(e,t,a){const i=e.privateData,r=e.ioReader.getPos();for(;e.ioReader.getPos()<r+t;){const t=await S(e,i.header.maxIdLength),r=await b(e.ioReader,i.header.maxSizeLength);if(e.ioReader.getPos(),!1===await a(t,r))return}}(e,t,(async(t,d)=>{if(a[t]){const r=a[t];let n;switch(r.type){case 1:n=await B(e,d);break;case 2:n=await B(e,d),i.ai(n)&&(n=BigInt(n));break;case 3:n=await P(e,d);break;case 4:n=await P(e,d),i.ai(n)&&(n=BigInt(n));break;case 6:case 5:n=await async function(e,t){return t===BigInt(4)?e.ioReader.readFloat():t===BigInt(8)?e.ioReader.readDouble():(await e.ioReader.skip(Number(BigInt.asIntN(32,t))),0)}(e,d);break;case 7:n=await e.ioReader.readString(Number(BigInt.asIntN(32,d))),n&&0===n.charCodeAt(n.length-1)&&(n=n.substring(0,n.length-1));break;case 10:n=!!await B(e,d);break;case 8:n={pos:e.ioReader.getPos(),size:d,data:d<o?await e.ioReader.readBuffer(Number(BigInt.asIntN(32,d))):null};break;case 9:n=r.child?await v(e,d,r.child):{};break;default:await e.ioReader.skip(Number(BigInt.asIntN(32,d)))}if(null!=n)if(r.isArray){const e=c[r.filedName]||[];e.push(n),c[r.filedName]=e}else c[r.filedName]=n}else await e.ioReader.skip(Number(BigInt.asIntN(32,d)));if(n.length&&r.zy(n,t))return!1})),c}},35734:(e,t,a)=>{a.d(t,{A:()=>r});var i=a(19371);class r{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},41050:(e,t,a)=>{a.d(t,{_B:()=>c,_r:()=>n,pj:()=>r});var i=a(75429);const r={[(0,i.A)("mp4v")]:12,[(0,i.A)("DIVX")]:12,[(0,i.A)("XVID")]:12,[(0,i.A)("3IV2")]:12,[(0,i.A)("vvc1")]:196,[(0,i.A)("vvi1")]:196,[(0,i.A)("hev1")]:173,[(0,i.A)("hvc1")]:173,[(0,i.A)("dvhe")]:173,[(0,i.A)("hev1")]:173,[(0,i.A)("avc1")]:27,[(0,i.A)("avc2")]:27,[(0,i.A)("avc3")]:27,[(0,i.A)("avc4")]:27,[(0,i.A)("ai5p")]:27,[(0,i.A)("ai5q")]:27,[(0,i.A)("ai52")]:27,[(0,i.A)("ai53")]:27,[(0,i.A)("ai55")]:27,[(0,i.A)("ai56")]:27,[(0,i.A)("ai1p")]:27,[(0,i.A)("ai1q")]:27,[(0,i.A)("ai12")]:27,[(0,i.A)("ai13")]:27,[(0,i.A)("ai15")]:27,[(0,i.A)("ai16")]:27,[(0,i.A)("AVin")]:27,[(0,i.A)("aivx")]:27,[(0,i.A)("rv64")]:27,[(0,i.A)("xalg")]:27,[(0,i.A)("avlg")]:27,[(0,i.A)("dva1")]:27,[(0,i.A)("dvav")]:27,[(0,i.A)("vp08")]:139,[(0,i.A)("vp09")]:167,[(0,i.A)("av01")]:225},c={[(0,i.A)("mp4a")]:86018,[(0,i.A)("ac-3")]:86019,[(0,i.A)("sac3")]:86019,[(0,i.A)("ac-4")]:86119,[(0,i.A)("dtsc")]:86020,[(0,i.A)("dtsh")]:86020,[(0,i.A)("dtsl")]:86020,[(0,i.A)("dtse")]:86020,[(0,i.A)("DTS ")]:86020,[(0,i.A)("ec-3")]:86056,[(0,i.A)(".mp3")]:86017,[(0,i.A)("mp3 ")]:86017,1836253269:86017,[(0,i.A)("spex")]:86051,[(0,i.A)("SPXN")]:86051,[(0,i.A)("fLaC")]:86028,[(0,i.A)("Opus")]:86076,[(0,i.A)("alaw")]:65543,[(0,i.A)("ulaw")]:65542,[(0,i.A)("fl32")]:65557,[(0,i.A)("fl64")]:65559,[(0,i.A)("twos")]:65537,[(0,i.A)("lpcm")]:65536,[(0,i.A)("sowt")]:65536,[(0,i.A)("in24")]:65548,[(0,i.A)("in32")]:65544,[(0,i.A)("sowt")]:65540,[(0,i.A)("raw ")]:65541,[(0,i.A)("NONE")]:65541},n={[(0,i.A)("text")]:94213,[(0,i.A)("tx3g")]:94213,[(0,i.A)("c608")]:94218}},43963:(e,t,a)=>{a.d(t,{Bq:()=>p,En:()=>o,Ij:()=>l,XC:()=>s,f7:()=>f,hY:()=>d,uF:()=>c});var i=a(29688),r=a(54809);const c={1:"Main",2:"LC",3:"SSR",4:"LTP",5:"HE",6:"SCALABLE",29:"HEv2",23:"LD",39:"ELD"},n={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12},d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,i.N_,i.N_,i.N_],o=[i.N_,1,2,3,4,5,6,7];function s(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t){const{profile:a,sampleRate:r,channels:c}=function(e){let t=i.N_,a=i.N_,r=i.N_;return e.length>=2&&(t=e[0]>>3&31,a=d[(7&e[0])<<1|e[1]>>7],r=o[e[1]>>3&15]),{profile:t,sampleRate:a,channels:r}}(t);e.codecpar.profile=a,e.codecpar.sampleRate=r,e.codecpar.chLayout.nbChannels=c,e.codecpar.frameSize=5===a?2048:1024,e.codecpar.format=8}}function l(e){const t=n[e.sampleRate],a=e.chLayout.nbChannels,r=e.profile===i.N_?2:e.profile,c=new Uint8Array(2);return c[0]=(31&r)<<3|(14&t)>>1,c[1]=(1&t)<<7|(15&a)<<3,c}function p(e){if(e.length<7)return-1;const t=e[0]<<4|e[1]>>4;if(4095!==t)return-1;const a=1&e[1],i=(192&e[2])>>>6,r=(60&e[2])>>>2,c=(1&e[2])<<2|(192&e[3])>>>6,n=(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5,s=3&e[6];let l=1===a?7:9,p=n-l;return{syncWord:t,profile:i+1,sampleRate:d[r],channels:o[c],aacFrameLength:n,numberOfRawDataBlocksInFrame:s,headerLength:l,framePayloadLength:p}}function f(e,t){function a(){const e=t.readU(2);let a=0;for(let i=0;i<=e;i++)a<<=8,a|=t.readU(8);return a}t||(t=new r.A).appendBuffer(e);const i=t.getPointer(),c={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},n=t.readU(11);if(695!==n)return-1;c.syncWord=n,c.muxLengthBytes=t.readU(13);const s=1===t.readU1();if(c.useSameStreamMux=s,!s){const e=1===t.readU1();if(e&&1===t.readU1())return-1;if(e&&a(),1!==t.readU1())return-1;if(0!==t.readU(6))return-1;if(0!==t.readU(4))return-1;if(0!==t.readU(3))return-1;let i=e?a():0;const r=t.readU(5);i-=5;const n=t.readU(4);i-=4;const s=t.readU(4);if(i-=4,t.readU(3),i-=3,i>0&&t.readU(i),0!==t.readU(3))return-1;if(t.readU(8),1===t.readU1())if(e)a();else{let e=0;for(;;){e<<=8;const a=1===t.readU1();if(e+=t.readU(8),!a)break}}1===t.readU1()&&t.readU(8),c.profile=r+1,c.sampleRate=d[n],c.channels=o[s]}let l=0;for(;;){const e=t.readU(8);if(l+=e,255!==e)break}return c.framePayloadLength=l,c.headerLength=t.getPointer()-i+(8===t.getBitLeft()?0:1),c}},47354:(e,t,a)=>{a.d(t,{Ui:()=>n,XC:()=>c,zk:()=>r});var i=a(54809);const r={0:"Main",1:"High",2:"Professional"};function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=4){const a=n(t);e.codecpar.profile=a.profile,e.codecpar.level=a.level}}function n(e){const t=new i.A(e.length);t.appendBuffer(e),t.readU1(),t.readU(7);const a=t.readU(3),r=t.readU(5),c=t.readU1();let n=t.readU1()?10:8;return t.readU1()&&(n=12),{profile:a,level:r,tier:c,bitDepth:n,monochrome:t.readU1(),chromaSubsamplingX:t.readU1(),chromaSubsamplingY:t.readU1(),chromaSamplePosition:t.readU(2)}}},73448:(e,t,a)=>{a.d(t,{DK:()=>d,XC:()=>s,Xr:()=>o,jA:()=>c,ob:()=>r,oe:()=>n});var i=a(70704);const r=34,c=8,n=[0,8,12,0,16,20,24,32],d=[0,88200,176400,192e3,8e3,16e3,22050,24e3,32e3,44100,48e3,96e3,0,0,0,0],o=[0,192,576,1152,2304,4608,0,0,256,512,1024,2048,4096,8192,16384,32768];function s(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length===r){const{bitsPerRawSample:a,sampleRate:r,channels:c}=function(e){const t=new i.A(e);t.skip(10);const a=t.readUint24();return{sampleRate:a>>4,channels:1+((15&a)>>>1),bitsPerRawSample:1+((1&a)<<4|(240&t.readUint8())>>>4)}}(t);e.codecpar.bitsPerRawSample=a,e.codecpar.sampleRate=r,e.codecpar.chLayout.nbChannels=c}}},75429:(e,t,a)=>{a.d(t,{A:()=>c});var i=a(34117);const r="packages/avformat/src/function/mktagle.ts";function c(e){4!==e.length&&i.R8(`tag length is not 4, tag: ${e}`,r,30);let t=0;for(let a=3;a>=0;a--)t=t<<8|e.charCodeAt(a);return t}},78753:(e,t,a)=>{a.d(t,{IC:()=>d,dd:()=>n,gi:()=>r,mO:()=>o,nz:()=>c,t6:()=>s});var i=a(75429);const r={1:65541,2:69638,3:65557,6:65543,7:65542,10:86052,16:69664,17:69633,23:69664,32:69646,34:86037,49:86046,50:86046,56:73728,66:86068,69:69643,20:69643,64:69643,80:86016,85:86017,87:73728,88:73729,97:69635,98:69634,100:69643,105:69633,117:86079,131:86069,255:86018,273:86068,304:86057,309:86106,352:86023,353:86024,354:86053,355:86054,357:86095,358:86096,384:86116,512:69644,533:86022,534:86022,624:86047,654:86111,655:69660,848:86114,1025:86043,1026:86074,1280:86081,1281:86081,5376:86046,5377:86037,5632:86018,5634:86065,8192:86019,8193:86020,8264:86085,8738:86069,27765:65542,28781:86018,16707:86018,16768:86116,22858:81922,29338:86069,33152:86116,41216:86068,41222:86018,41225:86051,61868:86028,65534:86112,21318:69645,22127:86021},c={[(0,i.A)("H261")]:3,[(0,i.A)("H263")]:4,[(0,i.A)("X263")]:4,[(0,i.A)("T263")]:4,[(0,i.A)("L263")]:4,[(0,i.A)("VX1K")]:4,[(0,i.A)("ZyGo")]:4,[(0,i.A)("M263")]:4,[(0,i.A)("lsvm")]:4,[(0,i.A)("I263")]:20,[(0,i.A)("U263")]:4,[(0,i.A)("VSM4")]:4,[(0,i.A)("H264")]:27,[(0,i.A)("h264")]:27,[(0,i.A)("X264")]:27,[(0,i.A)("x264")]:27,[(0,i.A)("avc1")]:27,[(0,i.A)("DAVC")]:27,[(0,i.A)("SMV2")]:27,[(0,i.A)("VSSH")]:27,[(0,i.A)("Q264")]:27,[(0,i.A)("V264")]:27,[(0,i.A)("GAVC")]:27,[(0,i.A)("UMSV")]:27,[(0,i.A)("tshd")]:27,[(0,i.A)("INMC")]:27,[(0,i.A)("FMP4")]:12,[(0,i.A)("DIVX")]:12,[(0,i.A)("DX50")]:12,[(0,i.A)("XVID")]:12,[(0,i.A)("MP4S")]:12,[(0,i.A)("M4S2")]:12,[(0,i.A)("DIVX")]:12,4:12,[(0,i.A)("ZMP4")]:12,[(0,i.A)("DIV1")]:12,[(0,i.A)("BLZ0")]:12,[(0,i.A)("mp4v")]:12,[(0,i.A)("UMP4")]:12,[(0,i.A)("WV1F")]:12,[(0,i.A)("SEDG")]:12,[(0,i.A)("RMP4")]:12,[(0,i.A)("3IV2")]:12,[(0,i.A)("WAWV")]:12,[(0,i.A)("FFDS")]:12,[(0,i.A)("FVFW")]:12,[(0,i.A)("DCOD")]:12,[(0,i.A)("MVXM")]:12,[(0,i.A)("PM4V")]:12,[(0,i.A)("SMP4")]:12,[(0,i.A)("DXGM")]:12,[(0,i.A)("VIDM")]:12,[(0,i.A)("M4T3")]:12,[(0,i.A)("GEOX")]:12,[(0,i.A)("G264")]:12,[(0,i.A)("HDX4")]:12,[(0,i.A)("DM4V")]:12,[(0,i.A)("DMK2")]:12,[(0,i.A)("DYM4")]:12,[(0,i.A)("DIGI")]:12,[(0,i.A)("EPHV")]:12,[(0,i.A)("EM4A")]:12,[(0,i.A)("M4CC")]:12,[(0,i.A)("SN40")]:12,[(0,i.A)("VSPX")]:12,[(0,i.A)("ULDX")]:12,[(0,i.A)("GEOV")]:12,[(0,i.A)("SIPP")]:12,[(0,i.A)("SM4V")]:12,[(0,i.A)("XVIX")]:12,[(0,i.A)("DreX")]:12,[(0,i.A)("QMP4")]:12,[(0,i.A)("PLV1")]:12,[(0,i.A)("GLV4")]:12,[(0,i.A)("GMP4")]:12,[(0,i.A)("MNM4")]:12,[(0,i.A)("GTM4")]:12,[(0,i.A)("MPG4")]:14,[(0,i.A)("MP41")]:14,[(0,i.A)("MP42")]:15,[(0,i.A)("DIV2")]:15,[(0,i.A)("MP43")]:16,[(0,i.A)("DIV3")]:16,[(0,i.A)("MPG3")]:16,[(0,i.A)("DIV5")]:16,[(0,i.A)("DIV6")]:16,[(0,i.A)("DIV4")]:16,[(0,i.A)("DVX3")]:16,[(0,i.A)("AP41")]:16,[(0,i.A)("COL1")]:16,[(0,i.A)("COL0")]:16,[(0,i.A)("WMV1")]:17,[(0,i.A)("WMV2")]:18,[(0,i.A)("GXVE")]:18,[(0,i.A)("dvsd")]:24,[(0,i.A)("dvhd")]:24,[(0,i.A)("dvh1")]:24,[(0,i.A)("dvsl")]:24,[(0,i.A)("dv25")]:24,[(0,i.A)("dv50")]:24,[(0,i.A)("cdvc")]:24,[(0,i.A)("CDVH")]:24,[(0,i.A)("CDV5")]:24,[(0,i.A)("dvc ")]:24,[(0,i.A)("dvcs")]:24,[(0,i.A)("dvh1")]:24,[(0,i.A)("dvis")]:24,[(0,i.A)("pdvc")]:24,[(0,i.A)("SL25")]:24,[(0,i.A)("SLDV")]:24,[(0,i.A)("AVd1")]:24,[(0,i.A)("mpg1")]:2,[(0,i.A)("mpg2")]:2,[(0,i.A)("MPEG")]:2,[(0,i.A)("PIM1")]:2,[(0,i.A)("PIM2")]:2,[(0,i.A)("VCR2")]:2,268435457:2,268435458:2,268435460:2,[(0,i.A)("DVR ")]:2,[(0,i.A)("MMES")]:2,[(0,i.A)("LMP2")]:2,[(0,i.A)("slif")]:2,[(0,i.A)("EM2V")]:2,[(0,i.A)("M701")]:2,[(0,i.A)("M702")]:2,[(0,i.A)("M703")]:2,[(0,i.A)("M704")]:2,[(0,i.A)("M705")]:2,[(0,i.A)("mpgv")]:2,[(0,i.A)("BW10")]:2,[(0,i.A)("XMPG")]:2,[(0,i.A)("MJPG")]:7,[(0,i.A)("RV40")]:69,[(0,i.A)("AV01")]:225,[(0,i.A)("VP80")]:139,[(0,i.A)("VP90")]:167,[(0,i.A)("HEVC")]:173,[(0,i.A)("H265")]:173},n="00001000800000AA00389B71",d="2107D3118644C8C1CA000000",o="0000000000001000800000AA",s={"2C806DE046DBCF11B4D100805F6CBBEA":86019,BFAA23E958CB7144A119FFFA01E4CE62:86055,D242E147BA368D4D88FC61654F8C836C:86104,AF87FBA7022DFB42A4D405CD93843BDD:86056,"2B806DE046DBCF11B4D100805F6CBBEA":86016,"82EC1F6ACADB1945BDE756D3B3EF981D":69673,"3AC1FA38811D4361A40DCE53CA607CD1":86112}},85183:(e,t,a)=>{a.d(t,{Nk:()=>r,eP:()=>i,xz:()=>c});const i={A_AAC:86018,A_AC3:86019,A_ALAC:86032,A_DTS:86020,A_EAC3:86056,A_FLAC:86028,A_MLP:86045,"A_MPEG/L2":86016,"A_MPEG/L1":86058,"A_MPEG/L3":86017,A_OPUS:86076,"A_OPUS/EXPERIMENTAL":86076,"A_PCM/FLOAT/IEEE":65557,"A_PCM/INT/BIG":65537,"A_PCM/INT/LIT":65536,"A_QUICKTIME/QDMC":86066,"A_QUICKTIME/QDM2":86035,"A_REAL/14_4":77824,"A_REAL/28_8":77825,"A_REAL/ATRC":86047,"A_REAL/COOK":86036,"A_REAL/SIPR":86057,A_TRUEHD:86060,A_TTA1:86038,A_VORBIS:86021,A_WAVPACK4:86041,"D_WEBVTT/SUBTITLES":94226,"D_WEBVTT/CAPTIONS":94226,"D_WEBVTT/DESCRIPTIONS":94226,"D_WEBVTT/METADATA":94226,"S_TEXT/UTF8":94225,"S_TEXT/ASCII":94210,"S_TEXT/ASS":94230,"S_TEXT/SSA":94230,"S_TEXT/WEBVTT":94226,S_ASS:94230,S_SSA:94230,S_VOBSUB:94208,S_DVBSUB:94209,"S_HDMV/PGS":94214,"S_HDMV/TEXTST":94231,V_AV1:225,V_DIRAC:116,V_FFV1:33,V_MJPEG:7,V_MPEG1:1,V_MPEG2:2,"V_MPEG4/ISO/ASP":12,"V_MPEG4/ISO/AP":12,"V_MPEG4/ISO/SP":12,"V_MPEG4/ISO/AVC":27,"V_MPEGH/ISO/HEVC":173,"V_MPEGH/ISO/VVC":196,"V_MPEG4/MS/V3":16,V_PRORES:147,"V_REAL/RV10":5,"V_REAL/RV20":6,"V_REAL/RV30":68,"V_REAL/RV40":69,V_SNOW:208,V_THEORA:30,V_UNCOMPRESSED:13,V_VP8:139,V_VP9:167},r={V_VP8:139,V_VP9:167,V_AV1:225,A_VORBIS:86021,A_OPUS:86076,"D_WEBVTT/SUBTITLES":94226,"D_WEBVTT/CAPTIONS":94226,"D_WEBVTT/DESCRIPTIONS":94226,"D_WEBVTT/METADATA":94226},c={"image/gif":97,"image/jpeg":7,"image/png":61,"image/tiff":96}},null:()=>{}}]);
|
package/dist/esm/630.avplayer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const __webpack_esm_id__=630;export const __webpack_esm_ids__=[630];export const __webpack_esm_modules__={4688:(e,t,s)=>{s.d(t,{A:()=>i});class i{}},7308:(e,t,s)=>{s.d(t,{A:()=>h});var i=s(19371),r=s(56238),a=s(46564),n=s(29688),o=s(41662),l=s(61984),d=s(4688);class h extends d.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}findTimelineTag(e){const t=e.indexOf("<");if(t>=0){const s=e.indexOf(">",t);if(s>t&&/^(\d{2,}:)?\d{2}:\d{2}\.\d{1,3}$/.test(e.substring(t+1,s)))return{start:t,end:s}}return{start:-1,end:-1}}sendAVPacket(e){let t=o.decode((0,a.iI)(e)),s=r.f[17](e+8);const i=s+r.f[17](e+48),n=[];for(;;){const{start:i,end:a}=this.findTimelineTag(t);if(i<0)break;const o=l.j(t.substring(i+1,a));n.push(t.substring(0,i)),this.queue.push({context:n.join(""),pts:s,duration:o-s,timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),s=o,t=t.substring(a+1)}return n.push(t),this.queue.push({context:n.join(""),pts:s,duration:i-s,timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=n.qs,e.timeBase.num=1,e.rects.push({type:2,text:t.context,flags:0}),1}return 0}flush(){return 0}}},7761:(e,t,s)=>{s.d(t,{Q:()=>i});const i=["ReadOrder","Layer","Start","End","Style","Name","MarginL","MarginR","MarginV","Effect","Text"]},13003:(e,t,s)=>{s.d(t,{q:()=>o});var i=s(84777),r=s(83796),a=s(61984),n=s(64086);function o(e){const t=(0,n.A)(e,{aloneValueName:"context"});if(!t.tt)return{queue:[],head:{}};const s=[];function o(e){let t="";return r.__(e,(e=>{i.Yj(e)?t+=e:e.context?t+=`<${e.tagName}>${e.context}</${e.tagName}>`:t+=`<${e.tagName}/>`})),t}function l(e,t,n){let l=a.j(t||e.begin),d=e.context||"",h=e.region||"Default",u="";i.YO(d)&&(d=o(d)),i.YO(e.span)?r.__(e.span,(e=>{e.context&&(l===-BigInt(1)&&e.begin&&(l=a.j(e.begin)),!h&&e.region&&(h=e.region),i.Yj(e.context)?(d+=e.context,e.br&&(d+="<br>")):(d+=o(e.context),e.br&&(d+="<br>"))),e.end&&(u=e.end)})):e.span&&(e.span.context&&(l===-BigInt(1)&&e.span.begin&&(l=a.j(e.span.begin)),!h&&e.span.region&&(h=e.span.region),i.Yj(e.span.context)?d+=e.span.context:d+=o(e.span.context)),e.span.end&&(u=e.span.end)),s.push({context:d,pts:l,region:h,duration:e.dur?a.j(e.dur):a.j(n||e.end||u)-l})}function d(e,t,s){i.YO(e)?r.__(e,(e=>{l(e,t,s)})):l(e,t,s)}return t.tt.body&&t.tt.body.div&&(i.YO(t.tt.body.div)?r.__(t.tt.body.div,(e=>{e.p&&d(e.p,e.begin,e.end)})):t.tt.body.div.p&&d(t.tt.body.div.p,t.tt.body.div.begin,t.tt.body.end)),{queue:s,head:t.tt.head||{}}}},17630:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_,parseEvent:()=>q});var i=s(19371),r=s(64017),a=s(49103),n=s(56238),o=s(6927),l=s(98137),d=s(39718),h=s(13745),u=s(95867),c=s(99855),g=s(46564),p=s(98901),f=s(61457),v=s(29688),m=s(23902),b=s(34117),y=s(41662),A=s(61984),x=s(57595),w=s(80209),S=s(15716);const k="packages/avplayer/src/subtitle/SubtitleRender.ts",B=[{reg:/<i>/g,value:"{\\i1}"},{reg:/<\/i>/g,value:"{\\i0}"},{reg:/<b>/g,value:"{\\b1}"},{reg:/<\/b>/g,value:"{\\b0}"},{reg:/<u>/g,value:"{\\u1}"},{reg:/<\/u>/g,value:"{\\u0}"},{reg:/{/g,value:"\\{"},{reg:/}/g,value:"\\}"},{reg:/>/g,value:">"},{reg:/</g,value:"<"},{reg:/‎/g,value:""},{reg:/‏/g,value:""},{reg:/&/g,value:"&"},{reg:/ /g,value:"\\h"},{reg:/(<br\s*\/?>)|\n>/g,value:"\\N"}];function q(e,t){const[,s,i]=t.match(/^(\w+?)\s*:\s*(.*)/i);let r=0;switch(s){case"Comment":r=2;break;case"Dialogue":r=1;break;case"Command":r=6;break;case"Movie":r=5;break;case"Picture":r=3;break;case"Sound":r=4}const a=d._T(e,i),n={type:r};for(let t=0;t<a.length;t++){n[e[t]]=a[t];const s=e[t],i=a[t].trim();switch(s){case"Layer":case"MarginL":case"MarginR":case"MarginV":n[s]=+i;break;case"Start":case"End":n[s]=A.j(i);break;case"Effect":n[s]=(0,h.d)(i);break;case"Text":n[s]=(0,u.r)(i);break;default:n[s]=i}}return n}class _{constructor(e){(0,i.A)(this,"decoder",void 0),(0,i.A)(this,"loop",void 0),(0,i.A)(this,"demuxer2SubtitleRenderChannels",void 0),(0,i.A)(this,"leftPorts",void 0),(0,i.A)(this,"currentPort",void 0),(0,i.A)(this,"render",void 0),(0,i.A)(this,"queue",void 0),(0,i.A)(this,"ended",void 0),(0,i.A)(this,"options",void 0),(0,i.A)(this,"pulling",void 0),(0,i.A)(this,"formats",void 0),(0,i.A)(this,"avpacketPool",void 0),(0,i.A)(this,"delay",void 0),(0,i.A)(this,"enable",void 0),this.options=m.X$({},e),this.ended=!1,this.pulling=!1,this.queue=[],this.delay=BigInt(0),this.demuxer2SubtitleRenderChannels=new Map,this.leftPorts=new Map,e.avpacketList&&(this.avpacketPool=new f.A((0,a.A)(e.avpacketList,r.A),e.avpacketListMutex)),this.createDecoder(),this.render=new l.A(this.options.dom,{header:this.getAssHeader(this.options.codecpar),container:this.options.container,videoWidth:this.options.videoWidth,videoHeight:this.options.videoHeight}),this.loop=new x.A((()=>{!this.queue.length&&this.ended&&this.loop.stop(),this.queue.length<6&&!this.ended&&this.pull();const e=this.options.getCurrentTime()-this.delay;for(this.render.clear(e);this.queue.length;){const t=this.queue[0];if(t.Start>e)break;t.End>e&&this.render.render(t),this.queue.shift()}}),0,50,!1)}getAssHeader(e){let t="";if(94230===n.f[15](e+4)&&n.f[15](e+16)){t=y.decode((0,w.s3)(n.f[20](e+12),n.f[15](e+16)));const s=t.split(/\r?\n/);let i=!1;for(let e=0;e<s.length;e++){const t=s[e].trim();"[Events]"===t&&(i=!0),/^Format:/.test(t)&&i&&(this.formats=d.Bp(t.trim()))}}return t}createDecoder(){this.decoder&&this.decoder.close(),this.decoder=new c.A({onReceiveSubtitle:e=>{for(let t=0;t<e.rects.length;t++){const s=e.rects[t];if(3===s.type){const t=q(this.formats,s.text);null==t.Start&&(t.Start=e.pts),null==t.End&&(t.End=e.pts+e.duration),this.queue.push(t)}else 2===s.type?this.queue.push(this.webvtt2AssEvent(s.text,e.pts,e.pts+e.duration)):this.queue.push(this.text2AssEvent(s.text,e.pts,e.pts+e.duration))}}}),this.decoder.open(this.options.codecpar)}text2AssEvent(e,t,s){return{type:1,ReadOrder:0,Layer:0,Start:t,End:s,Style:"Default",Name:"",MarginL:0,MarginR:0,MarginV:0,Text:{raw:e,combined:e,parsed:[{tags:[],text:e,drawing:[]}]}}}webvtt2AssEvent(e,t,s){for(let t=0;t<B.length;t++)e=e.replace(B[t].reg,B[t].value);return this.text2AssEvent(e,t,s)}async pull(){if(this.pulling&&!this.ended)return;this.pulling=!0;const e=this.currentPort,t=await this.leftPorts.get(this.currentPort).request("pull");var s;if(-1048576===t)b.Yz("SubtitleRender end",k,378),null===(s=this.decoder)||void 0===s||s.flush(),this.ended=!0;else if(t<0)b.Yz(`SubtitleRender pull avpacket error, ret: ${t}`,k,383),this.ended=!0;else if(this.loop&&e===this.currentPort){o.M[17](t+8,(0,p.Mr)(n.f[17](t+8),t+72,v.i0)),o.M[17](t+48,(0,p.Mr)(n.f[17](t+48),t+72,v.i0));const e=this.decoder.decode(t);this.avpacketPool?this.avpacketPool.release(t):(0,g.Qe)(t),e<0&&(b.Yz(`SubtitleRender decode avpacket error, ret: ${t}`,k,397),this.ended=!0)}else this.avpacketPool?this.avpacketPool.release(t):(0,g.Qe)(t);this.pulling=!1}getDemuxerPort(e){if(this.demuxer2SubtitleRenderChannels.has(e))return this.demuxer2SubtitleRenderChannels.get(e).port1;const t=new MessageChannel,s=new S.Ay(t.port2);return this.demuxer2SubtitleRenderChannels.set(e,t),this.leftPorts.set(e,s),t.port1}start(){this.loop.isStarted()||this.loop.start(),this.ended=!1}stop(){this.loop.stop(),this.render.clearAll()}pause(){this.loop.stop()}reset(){this.queue.length=0,this.render.clearAll()}reopenDecoder(e){this.options.codecpar=e,this.createDecoder(),this.render.updateHeader(this.getAssHeader(e))}updateVideoResolution(e,t){e===this.options.videoWidth&&t===this.options.videoHeight||(this.render.updateVideoResolution(e,t),this.options.videoWidth=e,this.options.videoHeight=t)}setDemuxTask(e){this.currentPort!==e&&(this.pulling=!1),this.currentPort=e}destroy(){this.loop.destroy(),this.loop=null,this.leftPorts.clear(),this.demuxer2SubtitleRenderChannels.clear(),this.queue.length=0,this.render.destroy(),this.render=null,this.decoder.close(),this.decoder=null}setDelay(e){this.delay=e}getDelay(){return this.delay}}},23249:(e,t,s)=>{s.d(t,{A:()=>l});var i=s(19371),r=s(56238),a=s(46564),n=s(4688),o=s(41662);class l extends n.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){return this.queue.push({data:(0,a.iI)(e).slice(),pts:r.f[17](e+8),duration:r.f[17](e+48),timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();e.pts=t.pts,e.duration=t.duration,e.timeBase.den=t.timeBase.den,e.timeBase.num=t.timeBase.num;let s=o.decode(t.data);return/^\w+?\s*:/.test(s)||(s="Dialogue: "+s),e.rects.push({type:3,text:s,flags:0}),1}return 0}flush(){return 0}}},34990:(e,t,s)=>{s.d(t,{A:()=>d});var i=s(19371),r=s(56238),a=s(46564),n=s(4688),o=s(34117),l=s(41662);class d extends n.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){const t=(0,a.iI)(e).slice();if(t.length<2)return 0;const s=t[0]<<8|t[1];if(s+2>t.length)return o.R8(`invalid timed text data, need ${s+2} but got ${t.length}, ignore it`,"packages/avcodec/src/subtitle/decoder/TimedTextDecoder.ts",61),0;const i=l.decode(t.subarray(2,2+s));return this.queue.push({text:i,pts:r.f[17](e+8),duration:r.f[17](e+48),timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=t.timeBase.den,e.timeBase.num=t.timeBase.num,e.rects.push({type:1,text:t.text,flags:0}),1}return 0}flush(){return 0}}},39718:(e,t,s)=>{s.d(t,{Bp:()=>o,Ew:()=>d,_T:()=>l});var i=s(7761),r=s(34117),a=s(61984);const n="packages/avformat/src/formats/ass/iass.ts";function o(e){return function(e,t){const s=t.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/),i=[];for(let t=0;t<s.length;t++){const a=e.find((e=>e.toLowerCase()===s[t].toLowerCase()));a||r.R8(`not support ass field(${s[t]})`,n,37),i.push(a||s[t])}return i}(i.Q,e)}function l(e,t){let s=t.split(",");if(s.length>e.length){const t=s.slice(e.length-1).join(",");s=s.slice(0,e.length-1),s.push(t)}return s}function d(e,t,s,i){const[,,r]=t.match(/^(\w+?)\s*:\s*(.*)/i),n=l(e,r);return{start:a.j(n[s]),end:a.j(n[i])}}},61984:(e,t,s)=>{function i(e){if(!e)return-BigInt(1);let t=(e=e.trim()).split(":"),s=BigInt(0);if(3===t.length&&(s+=BigInt(+t.shift().trim())*BigInt(36e5)),s+=BigInt(+t.shift().trim())*BigInt(6e4),t=t.shift().trim().split("."),s+=BigInt(+t.shift().trim())*BigInt(1e3),t.length){let e=t[0].trim().length,i=BigInt(+t.shift().trim());1===e?i*=BigInt(100):2===e&&(i*=BigInt(10)),s+=i}return s}function r(e){if(!e)return-BigInt(1);let t=(e=e.trim()).split(":"),s=BigInt(0);if(3===t.length&&(s+=BigInt(+t.shift().trim())*BigInt(36e5)),s+=BigInt(+t.shift().trim())*BigInt(6e4),t=t.shift().trim().split(","),s+=BigInt(+t.shift().trim())*BigInt(1e3),t.length){let e=t[0].trim().length,i=BigInt(+t.shift().trim());1===e?i*=BigInt(100):2===e&&(i*=BigInt(10)),s+=i}return s}s.d(t,{j:()=>i,t:()=>r})},64086:(e,t,s)=>{s.d(t,{A:()=>n});var i=s(83796);const r={aloneValueName:"_@attribute"},a=[" ","/",'"',"'","<",">"];function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;e=(e=(e=(e=e.replace(/<!--[\s\S]*?-->/g,"")).replace(/[\n\t\r]/g,"")).replace(/>[ \t]+</g,"><")).replace(/<\?[^>]*\?>/g,"");const s=[];let n=0;function o(e,i){const r=s[s.length-1];r&&(e!==t.aloneValueName||null==r.obj[t.aloneValueName]?null==r.obj[e]?r.obj[e]=i:Array.isArray(r.obj[e])?r.obj[e].push(i):r.obj[e]=[r.obj[e],i]:r.obj[t.aloneValueName]=[r.obj[t.aloneValueName],{tagName:e,...i}])}function l(t){for(;n<e.length;){if(e[n]===t)return!0;n++}return!1}function d(){h();let t="";for(;n<e.length&&!i.zy(a,e[n]);)t+=e[n],n++;return t}function h(){for(;n<e.length&&/\s|\r|\n/.test(e[n]);)n++}const u=/\s/,c=/'/,g=/"/;function p(){if(n>=e.length)return!0;h();let t=u;'"'!==e[n]&&"'"!=e[n]||(t='"'===e[n]?g:c,n++);let s="";for(;n<e.length;){if(t.test(e[n])){n++;break}s+=e[n],n++}return s}function f(){h();let t="";for(;n<e.length&&"<"!==e[n];)t+=e[n],n++;return t}function v(){for(;"<"===e[n];){const t=n;if(n++,h(),"/"!==e[n]){n=t;break}if(n++,d()===s[s.length-1].tag){if(s.length>1){const e=s.pop();o(e.tag,e.obj)}l(">"),n++,h()}else s.pop(),l(">"),n++,h()}}return function i(){if(n>=e.length)return;let r=n;if(h(),"<"!==e[n])return n=r,o(t.aloneValueName,f()),v(),i();let a=l("<");if(!a)return;r=n,n++;const u=d();if(s.push({obj:{},tag:u,start:r}),function(){for(;h(),">"!==e[n]&&"/"!==e[n];){let e=d();if(!e)break;"="===e[e.length-1]?e=e.substring(0,e.length-1):(l("="),n++),o(e,p())}}(),h(),"/"===e[n]){if(n++,s.length>1){const e=s.pop();o(e.tag,e.obj)}return l(">"),n++,v(),i()}a=l(">"),a&&(n++,h(),"<"!==e[n]&&(o(t.aloneValueName,f()),h()),v(),i())}(),{[s[0].tag]:s[0].obj}}},65489:(e,t,s)=>{s.d(t,{A:()=>l});var i=s(19371),r=s(56238),a=s(46564),n=s(4688),o=s(41662);class l extends n.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){return this.queue.push({data:(0,a.iI)(e).slice(),pts:r.f[17](e+8),duration:r.f[17](e+48),timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=t.timeBase.den,e.timeBase.num=t.timeBase.num,e.rects.push({type:1,text:o.decode(t.data),flags:0}),1}return 0}flush(){return 0}}},68095:(e,t,s)=>{s.d(t,{A:()=>h});var i=s(19371),r=s(56238),a=s(46564),n=s(29688),o=s(13003),l=s(41662),d=s(4688);class h extends d.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){let t=l.decode((0,a.iI)(e));return t?(/<tt/.test(t.trim())?this.queue=this.queue.concat(o.q(t).queue):this.queue.push({pts:r.f[17](e+8),duration:r.f[17](e+48),context:t,region:"Default"}),0):0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=n.qs,e.timeBase.num=1,e.rects.push({type:2,text:t.context,flags:0}),1}return 0}flush(){return 0}}},98137:(e,t,s)=>{s.d(t,{A:()=>f});var i=s(19371),r=s(72039),a=s(65603),n=s(32925),o=s(19447),l=s(92937),d=s(12655),h=s(6956),u=s(23902),c=s(25625);const g='.ASS-box{font-family:Arial;overflow:hidden;pointer-events:none;position:absolute}.ASS-dialogue{font-size:0;width:max-content;position:absolute;z-index:0;transform:translate(calc(var(--ass-align-h)*-1),calc(var(--ass-align-v)*-1));span{display:inline-block}[data-text]{display:inline-block;color:var(--ass-fill-color);font-size:calc(var(--ass-scale)*var(--ass-real-fs)*1px);line-height:calc(var(--ass-scale)*var(--ass-tag-fs)*1px);letter-spacing:calc(var(--ass-scale)*var(--ass-tag-fsp)*1px);filter:blur(calc(var(--ass-scale-stroke)*var(--ass-tag-blur)*(1-round(up,sin(var(--ass-tag-xbord))*sin(var(--ass-tag-xbord))))*(1-round(up,sin(var(--ass-tag-ybord))*sin(var(--ass-tag-ybord))))*1px))}[data-is="br"]+[data-is="br"]{height:calc(var(--ass-scale)*var(--ass-tag-fs)*1px/2)}}.ASS-dialogue[data-wrap-style="0"],.ASS-dialogue[data-wrap-style="3"]{text-wrap:balance;white-space:pre-wrap}.ASS-dialogue[data-wrap-style="1"]{word-break:break-word;white-space:pre-wrap}.ASS-dialogue[data-wrap-style="2"]{word-break:normal;white-space:pre}.ASS-dialogue[data-border-style="1"]{position:relative;&::before,&::after{content:attr(data-text);position:absolute;top:0;left:0;z-index:-1;filter:blur(calc(var(--ass-scale-stroke)*var(--ass-tag-blur)*1px))}&::before{color:var(--ass-shadow-color);-webkit-text-stroke:calc(var(--ass-scale-stroke)*var(--ass-border-width)*1px) var(--ass-shadow-color);transform:translate(calc(var(--ass-scale-stroke)*var(--ass-tag-xshad)*1px),calc(var(--ass-scale-stroke)*var(--ass-tag-yshad)*1px))}&::after{color:var(--ass-border-color);-webkit-text-stroke:calc(var(--ass-scale-stroke)*var(--ass-border-width)*1px) var(--ass-border-color)}&[data-stroke="svg"]{color:#000;&::before,&::after{opacity:0}}}@container style(--ass-tag-xbord:0) and style(--ass-tag-ybord:0){.ASS-dialogue[data-border-style="1"]::after{display:none}}@container style(--ass-tag-xshad:0) and style(--ass-tag-yshad:0){.ASS-dialogue[data-border-style="1"]::before{display:none}}.ASS-dialogue[data-border-style="3"]{padding:calc(var(--ass-scale-stroke)*var(--ass-tag-xbord)*1px)calc(var(--ass-scale-stroke)*var(--ass-tag-ybord)*1px);position:relative;filter:blur(calc(var(--ass-scale-stroke)*var(--ass-tag-blur)*1px));&::before,&::after{content:"";width:100%;height:100%;position:absolute;z-index:-1}&::before{background-color:var(--ass-shadow-color);left:calc(var(--ass-scale-stroke)*var(--ass-tag-xshad)*1px);top:calc(var(--ass-scale-stroke)*var(--ass-tag-yshad)*1px)}&::after{background-color:var(--ass-border-color);left:0;top:0}}@container style(--ass-tag-xbord:0) and style(--ass-tag-ybord:0){.ASS-dialogue [data-border-style="3"]::after{background-color:transparent}}@container style(--ass-tag-xshad:0) and style(--ass-tag-yshad:0){.ASS-dialogue [data-border-style="3"]::before{background-color:transparent}}.ASS-dialogue[data-rotate]{transform:perspective(312.5px) rotateY(calc(var(--ass-tag-fry) * 1deg)) rotateX(calc(var(--ass-tag-frx) * 1deg)) rotateZ(calc(var(--ass-tag-frz) * -1deg));&[data-text]{transform-style:preserve-3d;word-break:normal;white-space:nowrap}}.ASS-dialogue[data-scale],.ASS-dialogue[data-skew]{display:inline-block;transform:scale(var(--ass-tag-fscx), var(--ass-tag-fscy)) skew(calc(var(--ass-tag-fax)*1rad),calc(var(--ass-tag-fay) * 1rad));transform-origin:var(--ass-align-h) var(--ass-align-v)}.ASS-fix-font-size{font-family:Arial;line-height:normal;width:0;height:0;position:absolute;visibility:hidden;overflow:hidden;span{position:absolute}}.ASS-clip-area{width:100%;height:100%;position:absolute;top:0;left:0}.ASS-effect-area{position:absolute;display:flex;width:100%;height:fit-content;overflow:hidden;mask-composite:intersect;&[data-effect="banner"]{flex-direction:column;height:100%}.ASS-dialogue{position:static;transform:none}}',p={Name:"Default",Fontname:"Arial",Fontsize:"16",PrimaryColour:"&Hffffff",SecondaryColour:"&Hffffff",OutlineColour:"&H0",BackColour:"&H0",Bold:"0",Italic:"0",Underline:"0",StrikeOut:"0",ScaleX:"100",ScaleY:"100",Spacing:"0",Angle:"0",BorderStyle:"1",Outline:"1",Shadow:"0",Alignment:"2",MarginL:"10",MarginR:"10",MarginV:"10",Encoding:"0"};class f{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:e.parentNode};if((0,i.A)(this,"store",void 0),(0,i.A)(this,"resampling_","video_height"),(0,i.A)(this,"resize_",void 0),(0,i.A)(this,"options",void 0),this.options=u.X$({},t),this.store={video:e,box:document.createElement("div"),svg:(0,n.An)("svg"),defs:(0,n.An)("defs"),observer:null,scale:1,width:0,height:0,scriptRes:{width:t.videoWidth||e.clientWidth,height:t.videoHeight||e.clientHeight},layoutRes:{width:t.videoWidth||e.clientWidth,height:t.videoHeight||e.clientHeight},resampledRes:{width:0,height:0},sbas:!0,styles:null,space:[],actives:[],delay:0,index:0,dialogues:[]},null==t.videoWidth&&(e.videoWidth=t.videoWidth),null==t.videoHeight&&(e.videoHeight=t.videoHeight),!t.container)throw new Error("Missing container.");this.resize_=(0,a.By)(this,this.store),this.updateHeader(t.header),r.Y&&t.container.append(r.Y);const{svg:s,defs:o,scriptRes:l,box:d}=this.store;s.setAttributeNS(null,"viewBox",`0 0 ${l.width} ${l.height}`),s.append(o),t.container.append(s),d.className="ASS-box",t.container.append(d),function(e){const t=e.getRootNode()||document;let s=t instanceof Document;!s&&"object"==typeof documentPictureInPicture&&documentPictureInPicture.window&&(s=t===documentPictureInPicture.window.document);const i=s?t.head:t;let r=i.querySelector("#ASS-global-style");r||(r=document.createElement("style"),r.type="text/css",r.id="ASS-global-style",r.append(document.createTextNode(g)),i.append(r)),document.head.querySelector("#ASS-global-style")||(r=document.createElement("style"),r.type="text/css",r.id="ASS-global-style",r.append(document.createTextNode(g)),document.head.append(r))}(t.container),this.resampling_=t.resampling||"video_height";const h=new ResizeObserver(this.resize.bind(this));return h.observe(e),this.store.observer=h,this}framing(e){const t=(0,o.U)(e,this.store);t.animations&&t.animations.forEach((e=>{e.currentTime=Number(this.store.video.currentTime)-1e3*t.start})),(0,n.MA)(t,"play"),t.__dialogue=e,this.store.actives.push(t)}updateHeader(e){if(e){const{info:t,width:s,height:i,styles:r}=(0,l.wE)(e,{defaultStyle:p});this.store.sbas=/yes/i.test(t.ScaledBorderAndShadow),this.store.layoutRes={width:+t.LayoutResX||this.options.videoWidth||this.store.video.clientWidth,height:+t.LayoutResY||this.options.videoHeight||this.store.video.clientHeight},this.store.scriptRes={width:s||this.store.layoutRes.width,height:i||this.store.layoutRes.height},this.store.styles=r}else this.store.styles=(0,h.W)({info:{WrapStyle:""},style:[],defaultStyle:p}),this.store.scriptRes={width:384,height:288};this.resize_(),this.options.header=e}updateVideoResolution(e,t){if(this.options.header){const{info:s,width:i,height:r}=(0,l.wE)(this.options.header,{defaultStyle:p});this.store.layoutRes={width:+s.LayoutResX||e||this.store.video.clientWidth,height:+s.LayoutResY||t||this.store.video.clientHeight},this.store.scriptRes={width:i||this.store.layoutRes.width,height:r||this.store.layoutRes.height}}else this.store.layoutRes={width:e,height:t}}render(e){if(1===e.type){var t;e.Start=Number(e.Start)/1e3,e.End=Number(e.End)/1e3;const s=(0,d.b)({styles:this.store.styles,dialogues:[e]})[0];u.X$(s,{effect:["banner","scroll up","scroll down"].includes(null===(t=s.effect)||void 0===t?void 0:t.name)?s.effect:null,d:`ASS-${(0,c.A)()}`,align:{h:(s.alignment+2)%3,v:Math.trunc((s.alignment-1)/3)}}),this.framing(s)}}clear(e){const t=Number(e)/1e3;for(let e=this.store.actives.length-1;e>=0;e-=1){const s=this.store.actives[e],{end:i}=s;i<t&&(s.$div.remove(),this.store.actives.splice(e,1))}}clearAll(){for(let e=this.store.actives.length-1;e>=0;e-=1)this.store.actives[e].$div.remove();this.store.actives.length=0,this.store.space.length=0}resize(){const e=this.store.actives.slice();this.resize_();for(let t=0;t<e.length;t++)this.framing(e[t].__dialogue)}destroy(){const{video:e,box:t,svg:s,observer:i}=this.store;return(0,a.IU)(this.store),r.Y&&r.Y.remove(),s.remove(),t.remove(),i.unobserve(e),this.store.styles={},this}show(){return this.store.box.style.visibility="visible",this}hide(){return this.store.box.style.visibility="hidden",this}get resampling(){return this.resampling_}set resampling(e){e!==this.resampling_&&/^(video|script)_(width|height)$/.test(e)&&(this.resampling_=e,this.resize())}}},99855:(e,t,s)=>{s.d(t,{A:()=>u});var i=s(19371),r=s(56238),a=s(35924),n=s(7308),o=s(23249),l=s(68095),d=s(34990),h=s(65489);class u{constructor(e){(0,i.A)(this,"options",void 0),(0,i.A)(this,"frame",void 0),(0,i.A)(this,"decoder",void 0),this.options=e}getAVFrame(){return this.frame?this.frame:this.frame={pts:BigInt(0),duration:BigInt(0),rects:[],timeBase:{den:1,num:1}}}outputAVFrame(){this.frame&&(this.options.onReceiveSubtitle&&this.options.onReceiveSubtitle(this.frame),this.frame=void 0)}receiveAVFrame(){return this.decoder.receiveAVFrame(this.getAVFrame())}async open(e){switch(r.f[15](e+4)){case 94226:this.decoder=new n.A;break;case 94232:this.decoder=new l.A;break;case 94210:case 94225:this.decoder=new h.A;break;case 94213:this.decoder=new d.A;break;case 94212:case 94230:this.decoder=new o.A;break;default:return a.r8}return 0}decode(e){let t=this.decoder.sendAVPacket(e);if(t)return t;for(;;){if(t=this.receiveAVFrame(),1!==t){if(t<0)return t;break}this.outputAVFrame()}return 0}async flush(){for(this.decoder.flush();;){if(this.receiveAVFrame()<1)return;this.outputAVFrame()}}close(){this.frame&&(this.frame=void 0)}}}};
|
|
1
|
+
"use strict";(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[630],{4688:(e,t,s)=>{s.d(t,{A:()=>i});class i{}},7308:(e,t,s)=>{s.d(t,{A:()=>h});var i=s(19371),r=s(56238),a=s(46564),n=s(29688),o=s(41662),l=s(61984),d=s(4688);class h extends d.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}findTimelineTag(e){const t=e.indexOf("<");if(t>=0){const s=e.indexOf(">",t);if(s>t&&/^(\d{2,}:)?\d{2}:\d{2}\.\d{1,3}$/.test(e.substring(t+1,s)))return{start:t,end:s}}return{start:-1,end:-1}}sendAVPacket(e){let t=o.decode((0,a.iI)(e)),s=r.f[17](e+8);const i=s+r.f[17](e+48),n=[];for(;;){const{start:i,end:a}=this.findTimelineTag(t);if(i<0)break;const o=l.j(t.substring(i+1,a));n.push(t.substring(0,i)),this.queue.push({context:n.join(""),pts:s,duration:o-s,timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),s=o,t=t.substring(a+1)}return n.push(t),this.queue.push({context:n.join(""),pts:s,duration:i-s,timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=n.qs,e.timeBase.num=1,e.rects.push({type:2,text:t.context,flags:0}),1}return 0}flush(){return 0}}},7761:(e,t,s)=>{s.d(t,{Q:()=>i});const i=["ReadOrder","Layer","Start","End","Style","Name","MarginL","MarginR","MarginV","Effect","Text"]},13003:(e,t,s)=>{s.d(t,{q:()=>o});var i=s(84777),r=s(83796),a=s(61984),n=s(64086);function o(e){const t=(0,n.A)(e,{aloneValueName:"context"});if(!t.tt)return{queue:[],head:{}};const s=[];function o(e){let t="";return r.__(e,(e=>{i.Yj(e)?t+=e:e.context?t+=`<${e.tagName}>${e.context}</${e.tagName}>`:t+=`<${e.tagName}/>`})),t}function l(e,t,n){let l=a.j(t||e.begin),d=e.context||"",h=e.region||"Default",u="";i.YO(d)&&(d=o(d)),i.YO(e.span)?r.__(e.span,(e=>{e.context&&(l===-BigInt(1)&&e.begin&&(l=a.j(e.begin)),!h&&e.region&&(h=e.region),i.Yj(e.context)?(d+=e.context,e.br&&(d+="<br>")):(d+=o(e.context),e.br&&(d+="<br>"))),e.end&&(u=e.end)})):e.span&&(e.span.context&&(l===-BigInt(1)&&e.span.begin&&(l=a.j(e.span.begin)),!h&&e.span.region&&(h=e.span.region),i.Yj(e.span.context)?d+=e.span.context:d+=o(e.span.context)),e.span.end&&(u=e.span.end)),s.push({context:d,pts:l,region:h,duration:e.dur?a.j(e.dur):a.j(n||e.end||u)-l})}function d(e,t,s){i.YO(e)?r.__(e,(e=>{l(e,t,s)})):l(e,t,s)}return t.tt.body&&t.tt.body.div&&(i.YO(t.tt.body.div)?r.__(t.tt.body.div,(e=>{e.p&&d(e.p,e.begin,e.end)})):t.tt.body.div.p&&d(t.tt.body.div.p,t.tt.body.div.begin,t.tt.body.end)),{queue:s,head:t.tt.head||{}}}},17630:(e,t,s)=>{s.r(t),s.d(t,{default:()=>R,parseEvent:()=>q});var i=s(19371),r=s(64017),a=s(49103),n=s(56238),o=s(6927),l=s(98137),d=s(39718),h=s(13745),u=s(95867),c=s(99855),g=s(46564),p=s(98901),f=s(61457),v=s(29688),m=s(23902),b=s(34117),y=s(41662),A=s(61984),x=s(57595),w=s(80209),S=s(15716);const k="packages/avplayer/src/subtitle/SubtitleRender.ts",B=[{reg:/<i>/g,value:"{\\i1}"},{reg:/<\/i>/g,value:"{\\i0}"},{reg:/<b>/g,value:"{\\b1}"},{reg:/<\/b>/g,value:"{\\b0}"},{reg:/<u>/g,value:"{\\u1}"},{reg:/<\/u>/g,value:"{\\u0}"},{reg:/{/g,value:"\\{"},{reg:/}/g,value:"\\}"},{reg:/>/g,value:">"},{reg:/</g,value:"<"},{reg:/‎/g,value:""},{reg:/‏/g,value:""},{reg:/&/g,value:"&"},{reg:/ /g,value:"\\h"},{reg:/(<br\s*\/?>)|\n>/g,value:"\\N"}];function q(e,t){const[,s,i]=t.match(/^(\w+?)\s*:\s*(.*)/i);let r=0;switch(s){case"Comment":r=2;break;case"Dialogue":r=1;break;case"Command":r=6;break;case"Movie":r=5;break;case"Picture":r=3;break;case"Sound":r=4}const a=d._T(e,i),n={type:r};for(let t=0;t<a.length;t++){n[e[t]]=a[t];const s=e[t],i=a[t].trim();switch(s){case"Layer":case"MarginL":case"MarginR":case"MarginV":n[s]=+i;break;case"Start":case"End":n[s]=A.j(i);break;case"Effect":n[s]=(0,h.d)(i);break;case"Text":n[s]=(0,u.r)(i);break;default:n[s]=i}}return n}class R{constructor(e){(0,i.A)(this,"decoder",void 0),(0,i.A)(this,"loop",void 0),(0,i.A)(this,"demuxer2SubtitleRenderChannels",void 0),(0,i.A)(this,"leftPorts",void 0),(0,i.A)(this,"currentPort",void 0),(0,i.A)(this,"render",void 0),(0,i.A)(this,"queue",void 0),(0,i.A)(this,"ended",void 0),(0,i.A)(this,"options",void 0),(0,i.A)(this,"pulling",void 0),(0,i.A)(this,"formats",void 0),(0,i.A)(this,"avpacketPool",void 0),(0,i.A)(this,"delay",void 0),(0,i.A)(this,"enable",void 0),this.options=m.X$({},e),this.ended=!1,this.pulling=!1,this.queue=[],this.delay=BigInt(0),this.demuxer2SubtitleRenderChannels=new Map,this.leftPorts=new Map,e.avpacketList&&(this.avpacketPool=new f.A((0,a.A)(e.avpacketList,r.A),e.avpacketListMutex)),this.createDecoder(),this.render=new l.A(this.options.dom,{header:this.getAssHeader(this.options.codecpar),container:this.options.container,videoWidth:this.options.videoWidth,videoHeight:this.options.videoHeight}),this.loop=new x.A((()=>{!this.queue.length&&this.ended&&this.loop.stop(),this.queue.length<6&&!this.ended&&this.pull();const e=this.options.getCurrentTime()-this.delay;for(this.render.clear(e);this.queue.length;){const t=this.queue[0];if(t.Start>e)break;t.End>e&&this.render.render(t),this.queue.shift()}}),0,50,!1)}getAssHeader(e){let t="";if(94230===n.f[15](e+4)&&n.f[15](e+16)){t=y.decode((0,w.s3)(n.f[20](e+12),n.f[15](e+16)));const s=t.split(/\r?\n/);let i=!1;for(let e=0;e<s.length;e++){const t=s[e].trim();"[Events]"===t&&(i=!0),/^Format:/.test(t)&&i&&(this.formats=d.Bp(t.trim()))}}return t}createDecoder(){this.decoder&&this.decoder.close(),this.decoder=new c.A({onReceiveSubtitle:e=>{for(let t=0;t<e.rects.length;t++){const s=e.rects[t];if(3===s.type){const t=q(this.formats,s.text);null==t.Start&&(t.Start=e.pts),null==t.End&&(t.End=e.pts+e.duration),this.queue.push(t)}else 2===s.type?this.queue.push(this.webvtt2AssEvent(s.text,e.pts,e.pts+e.duration)):this.queue.push(this.text2AssEvent(s.text,e.pts,e.pts+e.duration))}}}),this.decoder.open(this.options.codecpar)}text2AssEvent(e,t,s){return{type:1,ReadOrder:0,Layer:0,Start:t,End:s,Style:"Default",Name:"",MarginL:0,MarginR:0,MarginV:0,Text:{raw:e,combined:e,parsed:[{tags:[],text:e,drawing:[]}]}}}webvtt2AssEvent(e,t,s){for(let t=0;t<B.length;t++)e=e.replace(B[t].reg,B[t].value);return this.text2AssEvent(e,t,s)}async pull(){if(this.pulling&&!this.ended)return;this.pulling=!0;const e=this.currentPort,t=await this.leftPorts.get(this.currentPort).request("pull");var s;if(-1048576===t)b.Yz("SubtitleRender end",k,378),null===(s=this.decoder)||void 0===s||s.flush(),this.ended=!0;else if(t<0)b.Yz(`SubtitleRender pull avpacket error, ret: ${t}`,k,383),this.ended=!0;else if(this.loop&&e===this.currentPort){o.M[17](t+8,(0,p.Mr)(n.f[17](t+8),t+72,v.i0)),o.M[17](t+48,(0,p.Mr)(n.f[17](t+48),t+72,v.i0));const e=this.decoder.decode(t);this.avpacketPool?this.avpacketPool.release(t):(0,g.Qe)(t),e<0&&(b.Yz(`SubtitleRender decode avpacket error, ret: ${t}`,k,397),this.ended=!0)}else this.avpacketPool?this.avpacketPool.release(t):(0,g.Qe)(t);this.pulling=!1}getDemuxerPort(e){if(this.demuxer2SubtitleRenderChannels.has(e))return this.demuxer2SubtitleRenderChannels.get(e).port1;const t=new MessageChannel,s=new S.Ay(t.port2);return this.demuxer2SubtitleRenderChannels.set(e,t),this.leftPorts.set(e,s),t.port1}start(){this.loop.isStarted()||this.loop.start(),this.ended=!1}stop(){this.loop.stop(),this.render.clearAll()}pause(){this.loop.stop()}reset(){this.queue.length=0,this.render.clearAll()}reopenDecoder(e){this.options.codecpar=e,this.createDecoder(),this.render.updateHeader(this.getAssHeader(e))}updateVideoResolution(e,t){e===this.options.videoWidth&&t===this.options.videoHeight||(this.render.updateVideoResolution(e,t),this.options.videoWidth=e,this.options.videoHeight=t)}setDemuxTask(e){this.currentPort!==e&&(this.pulling=!1),this.currentPort=e}destroy(){this.loop.destroy(),this.loop=null,this.leftPorts.clear(),this.demuxer2SubtitleRenderChannels.clear(),this.queue.length=0,this.render.destroy(),this.render=null,this.decoder.close(),this.decoder=null}setDelay(e){this.delay=e}getDelay(){return this.delay}}},23249:(e,t,s)=>{s.d(t,{A:()=>l});var i=s(19371),r=s(56238),a=s(46564),n=s(4688),o=s(41662);class l extends n.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){return this.queue.push({data:(0,a.iI)(e).slice(),pts:r.f[17](e+8),duration:r.f[17](e+48),timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();e.pts=t.pts,e.duration=t.duration,e.timeBase.den=t.timeBase.den,e.timeBase.num=t.timeBase.num;let s=o.decode(t.data);return/^\w+?\s*:/.test(s)||(s="Dialogue: "+s),e.rects.push({type:3,text:s,flags:0}),1}return 0}flush(){return 0}}},34990:(e,t,s)=>{s.d(t,{A:()=>d});var i=s(19371),r=s(56238),a=s(46564),n=s(4688),o=s(34117),l=s(41662);class d extends n.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){const t=(0,a.iI)(e).slice();if(t.length<2)return 0;const s=t[0]<<8|t[1];if(s+2>t.length)return o.R8(`invalid timed text data, need ${s+2} but got ${t.length}, ignore it`,"packages/avcodec/src/subtitle/decoder/TimedTextDecoder.ts",61),0;const i=l.decode(t.subarray(2,2+s));return this.queue.push({text:i,pts:r.f[17](e+8),duration:r.f[17](e+48),timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=t.timeBase.den,e.timeBase.num=t.timeBase.num,e.rects.push({type:1,text:t.text,flags:0}),1}return 0}flush(){return 0}}},39718:(e,t,s)=>{s.d(t,{Bp:()=>o,Ew:()=>d,_T:()=>l});var i=s(7761),r=s(34117),a=s(61984);const n="packages/avformat/src/formats/ass/iass.ts";function o(e){return function(e,t){const s=t.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/),i=[];for(let t=0;t<s.length;t++){const a=e.find((e=>e.toLowerCase()===s[t].toLowerCase()));a||r.R8(`not support ass field(${s[t]})`,n,37),i.push(a||s[t])}return i}(i.Q,e)}function l(e,t){let s=t.split(",");if(s.length>e.length){const t=s.slice(e.length-1).join(",");s=s.slice(0,e.length-1),s.push(t)}return s}function d(e,t,s,i){const[,,r]=t.match(/^(\w+?)\s*:\s*(.*)/i),n=l(e,r);return{start:a.j(n[s]),end:a.j(n[i])}}},61984:(e,t,s)=>{function i(e){if(!e)return-BigInt(1);let t=(e=e.trim()).split(":"),s=BigInt(0);if(3===t.length&&(s+=BigInt(+t.shift().trim())*BigInt(36e5)),s+=BigInt(+t.shift().trim())*BigInt(6e4),t=t.shift().trim().split("."),s+=BigInt(+t.shift().trim())*BigInt(1e3),t.length){let e=t[0].trim().length,i=BigInt(+t.shift().trim());1===e?i*=BigInt(100):2===e&&(i*=BigInt(10)),s+=i}return s}function r(e){if(!e)return-BigInt(1);let t=(e=e.trim()).split(":"),s=BigInt(0);if(3===t.length&&(s+=BigInt(+t.shift().trim())*BigInt(36e5)),s+=BigInt(+t.shift().trim())*BigInt(6e4),t=t.shift().trim().split(","),s+=BigInt(+t.shift().trim())*BigInt(1e3),t.length){let e=t[0].trim().length,i=BigInt(+t.shift().trim());1===e?i*=BigInt(100):2===e&&(i*=BigInt(10)),s+=i}return s}s.d(t,{j:()=>i,t:()=>r})},64086:(e,t,s)=>{s.d(t,{A:()=>n});var i=s(83796);const r={aloneValueName:"_@attribute"},a=[" ","/",'"',"'","<",">"];function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;e=(e=(e=(e=e.replace(/<!--[\s\S]*?-->/g,"")).replace(/[\n\t\r]/g,"")).replace(/>[ \t]+</g,"><")).replace(/<\?[^>]*\?>/g,"");const s=[];let n=0;function o(e,i){const r=s[s.length-1];r&&(e!==t.aloneValueName||null==r.obj[t.aloneValueName]?null==r.obj[e]?r.obj[e]=i:Array.isArray(r.obj[e])?r.obj[e].push(i):r.obj[e]=[r.obj[e],i]:r.obj[t.aloneValueName]=[r.obj[t.aloneValueName],{tagName:e,...i}])}function l(t){for(;n<e.length;){if(e[n]===t)return!0;n++}return!1}function d(){h();let t="";for(;n<e.length&&!i.zy(a,e[n]);)t+=e[n],n++;return t}function h(){for(;n<e.length&&/\s|\r|\n/.test(e[n]);)n++}const u=/\s/,c=/'/,g=/"/;function p(){if(n>=e.length)return!0;h();let t=u;'"'!==e[n]&&"'"!=e[n]||(t='"'===e[n]?g:c,n++);let s="";for(;n<e.length;){if(t.test(e[n])){n++;break}s+=e[n],n++}return s}function f(){h();let t="";for(;n<e.length&&"<"!==e[n];)t+=e[n],n++;return t}function v(){for(;"<"===e[n];){const t=n;if(n++,h(),"/"!==e[n]){n=t;break}if(n++,d()===s[s.length-1].tag){if(s.length>1){const e=s.pop();o(e.tag,e.obj)}l(">"),n++,h()}else s.pop(),l(">"),n++,h()}}return function i(){if(n>=e.length)return;let r=n;if(h(),"<"!==e[n])return n=r,o(t.aloneValueName,f()),v(),i();let a=l("<");if(!a)return;r=n,n++;const u=d();if(s.push({obj:{},tag:u,start:r}),function(){for(;h(),">"!==e[n]&&"/"!==e[n];){let e=d();if(!e)break;"="===e[e.length-1]?e=e.substring(0,e.length-1):(l("="),n++),o(e,p())}}(),h(),"/"===e[n]){if(n++,s.length>1){const e=s.pop();o(e.tag,e.obj)}return l(">"),n++,v(),i()}a=l(">"),a&&(n++,h(),"<"!==e[n]&&(o(t.aloneValueName,f()),h()),v(),i())}(),{[s[0].tag]:s[0].obj}}},65489:(e,t,s)=>{s.d(t,{A:()=>l});var i=s(19371),r=s(56238),a=s(46564),n=s(4688),o=s(41662);class l extends n.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){return this.queue.push({data:(0,a.iI)(e).slice(),pts:r.f[17](e+8),duration:r.f[17](e+48),timeBase:{den:r.f[15](e+76),num:r.f[15](e+72)}}),0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=t.timeBase.den,e.timeBase.num=t.timeBase.num,e.rects.push({type:1,text:o.decode(t.data),flags:0}),1}return 0}flush(){return 0}}},68095:(e,t,s)=>{s.d(t,{A:()=>h});var i=s(19371),r=s(56238),a=s(46564),n=s(29688),o=s(13003),l=s(41662),d=s(4688);class h extends d.A{constructor(){super(),(0,i.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(e){let t=l.decode((0,a.iI)(e));return t?(/<tt/.test(t.trim())?this.queue=this.queue.concat(o.q(t).queue):this.queue.push({pts:r.f[17](e+8),duration:r.f[17](e+48),context:t,region:"Default"}),0):0}receiveAVFrame(e){if(this.queue.length){const t=this.queue.shift();return e.pts=t.pts,e.duration=t.duration,e.timeBase.den=n.qs,e.timeBase.num=1,e.rects.push({type:2,text:t.context,flags:0}),1}return 0}flush(){return 0}}},98137:(e,t,s)=>{s.d(t,{A:()=>f});var i=s(19371),r=s(72039),a=s(65603),n=s(32925),o=s(19447),l=s(92937),d=s(12655),h=s(6956),u=s(23902),c=s(25625);const g='.ASS-box{font-family:Arial;overflow:hidden;pointer-events:none;position:absolute}.ASS-dialogue{font-size:0;width:max-content;position:absolute;z-index:0;transform:translate(calc(var(--ass-align-h)*-1),calc(var(--ass-align-v)*-1));span{display:inline-block}[data-text]{display:inline-block;color:var(--ass-fill-color);font-size:calc(var(--ass-scale)*var(--ass-real-fs)*1px);line-height:calc(var(--ass-scale)*var(--ass-tag-fs)*1px);letter-spacing:calc(var(--ass-scale)*var(--ass-tag-fsp)*1px);filter:blur(calc(var(--ass-scale-stroke)*var(--ass-tag-blur)*(1-round(up,sin(var(--ass-tag-xbord))*sin(var(--ass-tag-xbord))))*(1-round(up,sin(var(--ass-tag-ybord))*sin(var(--ass-tag-ybord))))*1px))}[data-is="br"]+[data-is="br"]{height:calc(var(--ass-scale)*var(--ass-tag-fs)*1px/2)}}.ASS-dialogue[data-wrap-style="0"],.ASS-dialogue[data-wrap-style="3"]{text-wrap:balance;white-space:pre-wrap}.ASS-dialogue[data-wrap-style="1"]{word-break:break-word;white-space:pre-wrap}.ASS-dialogue[data-wrap-style="2"]{word-break:normal;white-space:pre}.ASS-dialogue[data-border-style="1"]{position:relative;&::before,&::after{content:attr(data-text);position:absolute;top:0;left:0;z-index:-1;filter:blur(calc(var(--ass-scale-stroke)*var(--ass-tag-blur)*1px))}&::before{color:var(--ass-shadow-color);-webkit-text-stroke:calc(var(--ass-scale-stroke)*var(--ass-border-width)*1px) var(--ass-shadow-color);transform:translate(calc(var(--ass-scale-stroke)*var(--ass-tag-xshad)*1px),calc(var(--ass-scale-stroke)*var(--ass-tag-yshad)*1px))}&::after{color:var(--ass-border-color);-webkit-text-stroke:calc(var(--ass-scale-stroke)*var(--ass-border-width)*1px) var(--ass-border-color)}&[data-stroke="svg"]{color:#000;&::before,&::after{opacity:0}}}@container style(--ass-tag-xbord:0) and style(--ass-tag-ybord:0){.ASS-dialogue[data-border-style="1"]::after{display:none}}@container style(--ass-tag-xshad:0) and style(--ass-tag-yshad:0){.ASS-dialogue[data-border-style="1"]::before{display:none}}.ASS-dialogue[data-border-style="3"]{padding:calc(var(--ass-scale-stroke)*var(--ass-tag-xbord)*1px)calc(var(--ass-scale-stroke)*var(--ass-tag-ybord)*1px);position:relative;filter:blur(calc(var(--ass-scale-stroke)*var(--ass-tag-blur)*1px));&::before,&::after{content:"";width:100%;height:100%;position:absolute;z-index:-1}&::before{background-color:var(--ass-shadow-color);left:calc(var(--ass-scale-stroke)*var(--ass-tag-xshad)*1px);top:calc(var(--ass-scale-stroke)*var(--ass-tag-yshad)*1px)}&::after{background-color:var(--ass-border-color);left:0;top:0}}@container style(--ass-tag-xbord:0) and style(--ass-tag-ybord:0){.ASS-dialogue [data-border-style="3"]::after{background-color:transparent}}@container style(--ass-tag-xshad:0) and style(--ass-tag-yshad:0){.ASS-dialogue [data-border-style="3"]::before{background-color:transparent}}.ASS-dialogue[data-rotate]{transform:perspective(312.5px) rotateY(calc(var(--ass-tag-fry) * 1deg)) rotateX(calc(var(--ass-tag-frx) * 1deg)) rotateZ(calc(var(--ass-tag-frz) * -1deg));&[data-text]{transform-style:preserve-3d;word-break:normal;white-space:nowrap}}.ASS-dialogue[data-scale],.ASS-dialogue[data-skew]{display:inline-block;transform:scale(var(--ass-tag-fscx), var(--ass-tag-fscy)) skew(calc(var(--ass-tag-fax)*1rad),calc(var(--ass-tag-fay) * 1rad));transform-origin:var(--ass-align-h) var(--ass-align-v)}.ASS-fix-font-size{font-family:Arial;line-height:normal;width:0;height:0;position:absolute;visibility:hidden;overflow:hidden;span{position:absolute}}.ASS-clip-area{width:100%;height:100%;position:absolute;top:0;left:0}.ASS-effect-area{position:absolute;display:flex;width:100%;height:fit-content;overflow:hidden;mask-composite:intersect;&[data-effect="banner"]{flex-direction:column;height:100%}.ASS-dialogue{position:static;transform:none}}',p={Name:"Default",Fontname:"Arial",Fontsize:"16",PrimaryColour:"&Hffffff",SecondaryColour:"&Hffffff",OutlineColour:"&H0",BackColour:"&H0",Bold:"0",Italic:"0",Underline:"0",StrikeOut:"0",ScaleX:"100",ScaleY:"100",Spacing:"0",Angle:"0",BorderStyle:"1",Outline:"1",Shadow:"0",Alignment:"2",MarginL:"10",MarginR:"10",MarginV:"10",Encoding:"0"};class f{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:e.parentNode};if((0,i.A)(this,"store",void 0),(0,i.A)(this,"resampling_","video_height"),(0,i.A)(this,"resize_",void 0),(0,i.A)(this,"options",void 0),this.options=u.X$({},t),this.store={video:e,box:document.createElement("div"),svg:(0,n.An)("svg"),defs:(0,n.An)("defs"),observer:null,scale:1,width:0,height:0,scriptRes:{width:t.videoWidth||e.clientWidth,height:t.videoHeight||e.clientHeight},layoutRes:{width:t.videoWidth||e.clientWidth,height:t.videoHeight||e.clientHeight},resampledRes:{width:0,height:0},sbas:!0,styles:null,space:[],actives:[],delay:0,index:0,dialogues:[]},null==t.videoWidth&&(e.videoWidth=t.videoWidth),null==t.videoHeight&&(e.videoHeight=t.videoHeight),!t.container)throw new Error("Missing container.");this.resize_=(0,a.By)(this,this.store),this.updateHeader(t.header),r.Y&&t.container.append(r.Y);const{svg:s,defs:o,scriptRes:l,box:d}=this.store;s.setAttributeNS(null,"viewBox",`0 0 ${l.width} ${l.height}`),s.append(o),t.container.append(s),d.className="ASS-box",t.container.append(d),function(e){const t=e.getRootNode()||document;let s=t instanceof Document;!s&&"object"==typeof documentPictureInPicture&&documentPictureInPicture.window&&(s=t===documentPictureInPicture.window.document);const i=s?t.head:t;let r=i.querySelector("#ASS-global-style");r||(r=document.createElement("style"),r.type="text/css",r.id="ASS-global-style",r.append(document.createTextNode(g)),i.append(r)),document.head.querySelector("#ASS-global-style")||(r=document.createElement("style"),r.type="text/css",r.id="ASS-global-style",r.append(document.createTextNode(g)),document.head.append(r))}(t.container),this.resampling_=t.resampling||"video_height";const h=new ResizeObserver(this.resize.bind(this));return h.observe(e),this.store.observer=h,this}framing(e){const t=(0,o.U)(e,this.store);t.animations&&t.animations.forEach((e=>{e.currentTime=Number(this.store.video.currentTime)-1e3*t.start})),(0,n.MA)(t,"play"),t.__dialogue=e,this.store.actives.push(t)}updateHeader(e){if(e){const{info:t,width:s,height:i,styles:r}=(0,l.wE)(e,{defaultStyle:p});this.store.sbas=/yes/i.test(t.ScaledBorderAndShadow),this.store.layoutRes={width:+t.LayoutResX||this.options.videoWidth||this.store.video.clientWidth,height:+t.LayoutResY||this.options.videoHeight||this.store.video.clientHeight},this.store.scriptRes={width:s||this.store.layoutRes.width,height:i||this.store.layoutRes.height},this.store.styles=r}else this.store.styles=(0,h.W)({info:{WrapStyle:""},style:[],defaultStyle:p}),this.store.scriptRes={width:384,height:288};this.resize_(),this.options.header=e}updateVideoResolution(e,t){if(this.options.header){const{info:s,width:i,height:r}=(0,l.wE)(this.options.header,{defaultStyle:p});this.store.layoutRes={width:+s.LayoutResX||e||this.store.video.clientWidth,height:+s.LayoutResY||t||this.store.video.clientHeight},this.store.scriptRes={width:i||this.store.layoutRes.width,height:r||this.store.layoutRes.height}}else this.store.layoutRes={width:e,height:t}}render(e){if(1===e.type){var t;e.Start=Number(e.Start)/1e3,e.End=Number(e.End)/1e3;const s=(0,d.b)({styles:this.store.styles,dialogues:[e]})[0];u.X$(s,{effect:["banner","scroll up","scroll down"].includes(null===(t=s.effect)||void 0===t?void 0:t.name)?s.effect:null,d:`ASS-${(0,c.A)()}`,align:{h:(s.alignment+2)%3,v:Math.trunc((s.alignment-1)/3)}}),this.framing(s)}}clear(e){const t=Number(e)/1e3;for(let e=this.store.actives.length-1;e>=0;e-=1){const s=this.store.actives[e],{end:i}=s;i<t&&(s.$div.remove(),this.store.actives.splice(e,1))}}clearAll(){for(let e=this.store.actives.length-1;e>=0;e-=1)this.store.actives[e].$div.remove();this.store.actives.length=0,this.store.space.length=0}resize(){const e=this.store.actives.slice();this.resize_();for(let t=0;t<e.length;t++)this.framing(e[t].__dialogue)}destroy(){const{video:e,box:t,svg:s,observer:i}=this.store;return(0,a.IU)(this.store),r.Y&&r.Y.remove(),s.remove(),t.remove(),i.unobserve(e),this.store.styles={},this}show(){return this.store.box.style.visibility="visible",this}hide(){return this.store.box.style.visibility="hidden",this}get resampling(){return this.resampling_}set resampling(e){e!==this.resampling_&&/^(video|script)_(width|height)$/.test(e)&&(this.resampling_=e,this.resize())}}},99855:(e,t,s)=>{s.d(t,{A:()=>u});var i=s(19371),r=s(56238),a=s(35924),n=s(7308),o=s(23249),l=s(68095),d=s(34990),h=s(65489);class u{constructor(e){(0,i.A)(this,"options",void 0),(0,i.A)(this,"frame",void 0),(0,i.A)(this,"decoder",void 0),this.options=e}getAVFrame(){return this.frame?this.frame:this.frame={pts:BigInt(0),duration:BigInt(0),rects:[],timeBase:{den:1,num:1}}}outputAVFrame(){this.frame&&(this.options.onReceiveSubtitle&&this.options.onReceiveSubtitle(this.frame),this.frame=void 0)}receiveAVFrame(){return this.decoder.receiveAVFrame(this.getAVFrame())}async open(e){switch(r.f[15](e+4)){case 94226:this.decoder=new n.A;break;case 94232:this.decoder=new l.A;break;case 94210:case 94225:this.decoder=new h.A;break;case 94213:this.decoder=new d.A;break;case 94212:case 94230:this.decoder=new o.A;break;default:return a.r8}return 0}decode(e){let t=this.decoder.sendAVPacket(e);if(t)return t;for(;;){if(t=this.receiveAVFrame(),1!==t){if(t<0)return t;break}this.outputAVFrame()}return 0}async flush(){for(this.decoder.flush();;){if(this.receiveAVFrame()<1)return;this.outputAVFrame()}}close(){this.frame&&(this.frame=void 0)}}}}]);
|
package/dist/esm/641.avplayer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[641],{35734:(e,t,r)=>{r.d(t,{A:()=>i});var a=r(19371);class i{constructor(){(0,a.A)(this,"type",-1),(0,a.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},38641:(e,t,r)=>{r.r(t),r.d(t,{IVFHeader:()=>f,default:()=>A});var a=r(19371),i=r(56238),d=r(6927),o=r(35734),s=r(80209),h=r(35924),n=r(46564),c=r(46626),m=r(29688),u=r(34117);const R="packages/avformat/src/formats/IIvfFormat.ts",w={VP80:139,VP90:167};class f{constructor(){(0,a.A)(this,"version",void 0),(0,a.A)(this,"length",void 0),(0,a.A)(this,"codec",void 0),(0,a.A)(this,"width",void 0),(0,a.A)(this,"height",void 0),(0,a.A)(this,"denominator",void 0),(0,a.A)(this,"numerator",void 0),(0,a.A)(this,"framesCount",void 0),this.version=0,this.length=32,this.codec="VP80",this.width=0,this.height=0,this.framesCount=0,this.denominator=1,this.numerator=0}}class A extends o.A{constructor(){super(),(0,a.A)(this,"type",5),(0,a.A)(this,"header",void 0),this.header=new f}init(e){e.ioReader&&e.ioReader.setEndian(!1)}async readHeader(e){try{if("DKIF"!==await e.ioReader.readString(4))return u.z3("the file format is not ivf",R,117),h.LR;this.header.version=await e.ioReader.readUint16(),await e.ioReader.skip(2),this.header.codec=await e.ioReader.readString(4),this.header.width=await e.ioReader.readUint16(),this.header.height=await e.ioReader.readUint16(),this.header.denominator=await e.ioReader.readUint32(),this.header.numerator=await e.ioReader.readUint32(),this.header.framesCount=await e.ioReader.readUint32(),await e.ioReader.skip(4);const t=e.createStream();return t.codecpar.codecType=0,t.codecpar.codecId=w[this.header.codec],t.timeBase.den=this.header.denominator,t.timeBase.num=this.header.numerator,t.codecpar.width=this.header.width,t.codecpar.height=this.header.height,t.nbFrames=BigInt(Math.floor(this.header.framesCount)),this.onStreamAdd&&this.onStreamAdd(t),0}catch(t){return u.z3(t.message,R,149),e.ioReader.error}}async readAVPacket(e,t){try{const r=e.getStreamByMediaType(0);if(!r)return h.LR;{const a=e.ioReader.getPos(),o=await e.ioReader.readUint32(),h=await e.ioReader.readUint64(),u=(0,c.sY)(o);(0,n.NX)(t,u,o),await e.ioReader.readBuffer(o,(0,s.JW)(u,o)),d.M[17](t+56,a),d.M[17](t+8,h),d.M[17](t+16,h),d.M[15](t+76,this.header.denominator),d.M[15](t+72,this.header.numerator),d.M[15](t+32,r.index),r.startTime===m.Dh&&(r.startTime=i.f[17](t+8)||i.f[17](t+16))}return 0}catch(t){return-1048576!==e.ioReader.error&&-1048572!==e.ioReader.error?(u.z3(`read packet error, ${t}`,R,188),h.LR):e.ioReader.error}}async seek(e,t,r,a){const i=e.ioReader.getPos();return 2&a?(await e.ioReader.seek(r),i):BigInt(h.E$)}getAnalyzeStreamsCount(){return 1}}}}]);
|