@libmedia/avplayer-ui 0.2.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/COPYING.LGPLv3 +165 -0
- package/README.md +13 -0
- package/dist/esm/118.avplayer.js +1 -0
- package/dist/esm/217.avplayer.js +1 -0
- package/dist/esm/299.avplayer.js +1 -0
- package/dist/esm/331.avplayer.js +1 -0
- package/dist/esm/344.avplayer.js +1 -0
- package/dist/esm/433.avplayer.js +1 -0
- package/dist/esm/453.avplayer.js +1 -0
- package/dist/esm/487.avplayer.js +1 -0
- package/dist/esm/522.avplayer.js +1 -0
- package/dist/esm/531.avplayer.js +1 -0
- package/dist/esm/543.avplayer.js +1 -0
- package/dist/esm/576.avplayer.js +1 -0
- package/dist/esm/611.avplayer.js +1 -0
- package/dist/esm/634.avplayer.js +1 -0
- package/dist/esm/70.avplayer.js +1 -0
- package/dist/esm/791.avplayer.js +1 -0
- package/dist/esm/808.avplayer.js +1 -0
- package/dist/esm/839.avplayer.js +1 -0
- package/dist/esm/854.avplayer.js +1 -0
- package/dist/esm/855.avplayer.js +1 -0
- package/dist/esm/94.avplayer.js +1 -0
- package/dist/esm/941.avplayer.js +1 -0
- package/dist/esm/969.avplayer.js +1 -0
- package/dist/esm/avplayer.js +1 -0
- package/dist/types/AVPlayer.d.ts +23 -0
- package/dist/types/Keyboard.d.ts +63 -0
- package/dist/types/components/control/audioTrack/AudioTrack.d.ts +3 -0
- package/dist/types/components/control/fullscreen/Fullscreen.d.ts +3 -0
- package/dist/types/components/control/loop/Loop.d.ts +3 -0
- package/dist/types/components/control/pip/Pip.d.ts +3 -0
- package/dist/types/components/control/play/Play.d.ts +3 -0
- package/dist/types/components/control/playrate/Playrate.d.ts +3 -0
- package/dist/types/components/control/setting/Setting.d.ts +3 -0
- package/dist/types/components/control/subtitleTrack/SubtitleTrack.d.ts +3 -0
- package/dist/types/components/control/timer/Timer.d.ts +3 -0
- package/dist/types/components/control/videoTrack/VideoTrack.d.ts +3 -0
- package/dist/types/components/control/volume/Volume.d.ts +3 -0
- package/dist/types/components/folder/Folder.d.ts +3 -0
- package/dist/types/components/folder/Node.d.ts +6 -0
- package/dist/types/components/info/Info.d.ts +3 -0
- package/dist/types/components/loading/Loading.d.ts +3 -0
- package/dist/types/components/loadingTip/LoadingTip.d.ts +3 -0
- package/dist/types/components/pcmVisualization/PcmVisualization.d.ts +3 -0
- package/dist/types/components/progress/Progress.d.ts +3 -0
- package/dist/types/components/settings/Settings.d.ts +3 -0
- package/dist/types/i18n/chinese.d.ts +39 -0
- package/dist/types/i18n/english.d.ts +38 -0
- package/dist/types/i18n/getLanguage.d.ts +8 -0
- package/dist/umd/118.avplayer.js +1 -0
- package/dist/umd/217.avplayer.js +1 -0
- package/dist/umd/299.avplayer.js +1 -0
- package/dist/umd/331.avplayer.js +1 -0
- package/dist/umd/344.avplayer.js +1 -0
- package/dist/umd/433.avplayer.js +1 -0
- package/dist/umd/453.avplayer.js +1 -0
- package/dist/umd/487.avplayer.js +1 -0
- package/dist/umd/522.avplayer.js +1 -0
- package/dist/umd/531.avplayer.js +1 -0
- package/dist/umd/543.avplayer.js +1 -0
- package/dist/umd/576.avplayer.js +1 -0
- package/dist/umd/611.avplayer.js +1 -0
- package/dist/umd/634.avplayer.js +1 -0
- package/dist/umd/70.avplayer.js +1 -0
- package/dist/umd/791.avplayer.js +1 -0
- package/dist/umd/808.avplayer.js +1 -0
- package/dist/umd/839.avplayer.js +1 -0
- package/dist/umd/854.avplayer.js +1 -0
- package/dist/umd/855.avplayer.js +1 -0
- package/dist/umd/94.avplayer.js +1 -0
- package/dist/umd/941.avplayer.js +1 -0
- package/dist/umd/969.avplayer.js +1 -0
- package/dist/umd/avplayer.js +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[433],{70509:(t,e,i)=>{i.d(e,{A:()=>a});var s=i(134);class a{constructor(){(0,s.A)(this,"onFlush",void 0)}}},97801:(t,e,i)=>{i.d(e,{A:()=>T});var s=i(134),a=i(70509),r=i(13258),n=i(51678),o=i(13724),h=i(4624);const l="src/avnetwork/bsp/aes/AESDecryptPipe.ts",c=16;let d=!0;const u=new Uint8Array(c).fill(c);class T extends a.A{constructor(t=1048576){super(),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"aesSoftDecryptor",void 0),(0,s.A)(this,"aesWebDecryptor",void 0),(0,s.A)(this,"aesTargetDecryptor",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"ended",void 0),(0,s.A)(this,"iv",void 0),(0,s.A)(this,"key",void 0),this.size=t,this.pointer=0,this.endPointer=0,this.ended=!1,this.buffer=new Uint8Array(t),this.aesSoftDecryptor=new r.A,n.A.isSupport()&&d&&(this.aesWebDecryptor=new n.A),this.aesTargetDecryptor=this.aesWebDecryptor||this.aesSoftDecryptor}remainingLength(){return this.endPointer-this.pointer}async expandKey(t,e){this.key=t,this.iv=e,this.aesWebDecryptor&&await this.aesWebDecryptor.expandKey(t),this.aesSoftDecryptor.expandKey(t)}async flush_(t){for(;;){const e=await this.onFlush(t);if(-1048575!==e)return e;await new o.A(0)}}async flush(){if(this.size-this.remainingLength()<=0)return;this.pointer<this.endPointer?this.pointer&&(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer):this.endPointer=0,this.pointer=0;const t=await this.flush_(this.buffer.subarray(this.endPointer));if(t<0){if(-1048576===t)return void(this.ended=!0);h.h2(`AESPipe error, flush failed, ret: ${t}`,l,120)}this.endPointer+=t}removePadding(t){const e=t.length,i=e&&new DataView(t.buffer).getUint8(e-1);return i?t.subarray(0,e-i):t}async decrypt(t){let e,i=0;this.aesTargetDecryptor!==this.aesWebDecryptor||this.ended||(e=this.buffer.subarray(this.pointer+t,this.pointer+t+c).slice(),this.buffer.set((await this.aesWebDecryptor.encryptPadding(u,this.buffer.subarray(this.pointer+t-c,this.pointer+t))).subarray(0,c),this.pointer+t),i=c);try{const s=this.buffer.subarray(this.pointer,this.pointer+t+i),a=await this.aesTargetDecryptor.decrypt(s,this.iv);return this.iv=s.slice(s.length-c-i,s.length-i).buffer,e&&this.buffer.set(e,this.pointer+t),this.pointer+=t,new Uint8Array(a)}catch(i){if(this.aesTargetDecryptor=this.aesWebDecryptor)return h.R8("web aes decrypt failed, try to use soft decryptor",l,169),e&&this.buffer.set(e,this.pointer+t),this.aesTargetDecryptor=this.aesSoftDecryptor,d=!1,this.decrypt(t);h.h2("aes decrypt failed",l,179)}}async read(t){for(;!this.ended&&this.remainingLength()<48;)await this.flush();if(0===this.remainingLength())return-1048576;const e=Math.min(Math.floor((this.remainingLength()-(this.ended?0:32))/c)*c,t.length);let i=await this.decrypt(e);return this.ended&&this.aesTargetDecryptor===this.aesSoftDecryptor&&(i=this.removePadding(i)),t.set(i),i.length}}},15433:(t,e,i)=>{i.r(e),i.d(e,{default:()=>p});var s=i(134),a=i(80662),r=i.n(a),n=i(13724),o=i(82800),h=i(95335),l=i(8507),c=i(48182),d=i(77580),u=i(86932),T=i(4624),E=i(97801),f=i(67672);const A="src/avnetwork/ioLoader/HlsIOLoader.ts";class p extends o.A{constructor(...t){super(...t),(0,s.A)(this,"info",void 0),(0,s.A)(this,"range",void 0),(0,s.A)(this,"masterPlaylist",void 0),(0,s.A)(this,"mediaPlayList",void 0),(0,s.A)(this,"mediaPlayListIndex",void 0),(0,s.A)(this,"fetchedMap",void 0),(0,s.A)(this,"fetchedHistoryList",void 0),(0,s.A)(this,"mediaListUrl",void 0),(0,s.A)(this,"segmentIndex",void 0),(0,s.A)(this,"currentUri",void 0),(0,s.A)(this,"loader",void 0),(0,s.A)(this,"minBuffer",void 0),(0,s.A)(this,"keyMap",void 0),(0,s.A)(this,"currentIV",void 0),(0,s.A)(this,"currentKey",void 0),(0,s.A)(this,"aesDecryptPipe",void 0),(0,s.A)(this,"initLoaded",void 0)}getFetchParams(t="GET"){var e,i,s;const a={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};return null!==(e=this.info.httpOptions)&&void 0!==e&&e.headers&&h.__(this.info.httpOptions.headers,((t,e)=>{a.headers[e]=t})),null!==(i=this.info.httpOptions)&&void 0!==i&&i.credentials&&(a.credentials=this.info.httpOptions.credentials),null!==(s=this.info.httpOptions)&&void 0!==s&&s.referrerPolicy&&(a.referrerPolicy=this.info.httpOptions.referrerPolicy),a}async fetchMasterPlayList(){try{const e=await fetch(this.info.url,this.getFetchParams()),i=await e.text(),s=(0,c.A)(i);if(s.isMasterPlaylist)this.masterPlaylist=s;else{if(this.mediaPlayList=s,this.options.isLive&&(!this.mediaPlayList.segments||this.mediaPlayList.segments.length<2)){var t;let e=5;return null!==(t=this.mediaPlayList.segments)&&void 0!==t&&t.length&&(e=this.mediaPlayList.segments[0].duration*(2-this.mediaPlayList.segments.length)),T.R8(`wait for min buffer time, now segments: ${this.mediaPlayList.segments.length}`,A,119),await new n.A(e),this.fetchMasterPlayList()}this.minBuffer=this.mediaPlayList.duration||0,this.mediaPlayList.endlist&&(this.options.isLive=!1),this.mediaListUrl=this.info.url}return s}catch(t){if(this.retryCount<this.options.retryCount)return this.retryCount++,T.z3(`failed fetch m3u8 file, retry(${this.retryCount}/3)`,A,136),await new n.A(5),this.fetchMasterPlayList();this.status=3,T.h2("HLSLoader: exception, fetch slice error",A,142)}}async fetchMediaPlayList(){let t;if(this.masterPlaylist){const e=this.masterPlaylist.variants[this.mediaPlayListIndex];e||T.h2("no media playlist",A,154),t=e.uri}else t=this.mediaListUrl;/^https?/.test(t)||(t=l.ll(this.info.url,t)),this.mediaListUrl=t;try{const i=await fetch(t,this.getFetchParams()),s=await i.text();if(this.mediaPlayList=(0,c.A)(s),this.options.isLive&&(!this.mediaPlayList.segments||this.mediaPlayList.segments.length<2)){var e;let t=5;return null!==(e=this.mediaPlayList.segments)&&void 0!==e&&e.length&&(t=this.mediaPlayList.segments[0].duration*(2-this.mediaPlayList.segments.length)),T.R8(`wait for min buffer time, now segments: ${this.mediaPlayList.segments.length}`,A,178),await new n.A(t),this.fetchMediaPlayList()}return this.minBuffer=this.mediaPlayList.duration||0,this.mediaPlayList.endlist&&(this.options.isLive=!1),this.status=2,this.retryCount=0,this.mediaPlayList}catch(t){if(this.retryCount<this.options.retryCount)return this.retryCount++,T.z3(`failed fetch m3u8 file, retry(${this.retryCount}/3)`,A,197),await new n.A(this.options.retryInterval),this.fetchMasterPlayList();this.status=3,T.h2("HLSLoader: exception, fetch slice error",A,203)}}async open(t,e){return this.info=t,this.range=e,this.range.to||(this.range.to=-1),this.range.from=Math.max(this.range.from,0),this.mediaPlayListIndex=0,this.segmentIndex=0,this.fetchedMap=new(r()),this.fetchedHistoryList=[],this.status=1,this.retryCount=0,this.keyMap=new(r()),await this.fetchMasterPlayList(),!this.mediaPlayList&&this.masterPlaylist&&await this.fetchMediaPlayList(),this.initLoaded=!0,this.mediaPlayList.segments.length&&this.mediaPlayList.segments[0].map&&(this.initLoaded=!1),0}async checkNeedDecrypt(t,e){if(!t.key)return;const i=t.key.uri;if(this.keyMap.has(i)?this.currentKey=this.keyMap.get(i):(this.currentKey=await(await fetch((0,l.ll)(this.mediaListUrl,i),this.getFetchParams())).arrayBuffer(),this.keyMap.set(i,this.currentKey)),t.key.iv)this.currentIV=t.key.iv.buffer;else{const t=new Uint8Array(16);new DataView(t.buffer).setUint32(12,e,!1),this.currentIV=t.buffer}this.aesDecryptPipe=new E.A,this.aesDecryptPipe.onFlush=async t=>this.loader.read(t),await this.aesDecryptPipe.expandKey(this.currentKey,this.currentIV)}async read(t){let e=0;if(this.loader){if(e=this.aesDecryptPipe?await this.aesDecryptPipe.read(t):await this.loader.read(t),-1048576!==e)return e;if(this.initLoaded){if(this.options.isLive)this.fetchedMap.set(this.currentUri,!0),10===this.fetchedHistoryList.length&&this.fetchedMap.delete(this.fetchedHistoryList.shift()),this.fetchedHistoryList.push(this.currentUri),this.segmentIndex++;else if(this.segmentIndex++,this.segmentIndex>=this.mediaPlayList.segments.length)return T.pq("hls segments ended",A,299),this.status=4,-1048576}else this.initLoaded=!0;this.loader=null}if(this.options.isLive){const e=this.mediaPlayList.segments.filter((t=>!this.fetchedMap.get(t.uri)));if(!e.length){if(this.mediaPlayList.endlist)return this.status=4,-1048576;const e=(this.minBuffer-((0,u.A)()-this.mediaPlayList.timestamp)/1e3)/2;return e>0&&await new n.A(e),await this.fetchMediaPlayList(),this.read(t)}this.currentUri=e[0].uri,this.initLoaded&&await this.checkNeedDecrypt(e[0],this.segmentIndex),this.loader=new d.A(h.X$({},this.options,{disableSegment:!0,loop:!1}));const i=(0,l.ll)(this.mediaListUrl,this.initLoaded?this.currentUri:e[0].map.uri),s={from:0,to:-1},a=this.initLoaded?e[0].byterange:e[0].map.byterange;return a&&(s.from=a.offset,s.to=a.offset+a.length),await this.loader.open(h.X$({},this.info,{url:i}),s),this.aesDecryptPipe?this.aesDecryptPipe.read(t):this.loader.read(t)}{this.loader=new d.A(h.X$({},this.options,{disableSegment:!0,loop:!1}));let e=this.mediaPlayList.segments[this.segmentIndex];for(;!e.uri;)e=this.mediaPlayList.segments[++this.segmentIndex];this.initLoaded&&await this.checkNeedDecrypt(e,this.segmentIndex);const i=(0,l.ll)(this.mediaListUrl,this.initLoaded?e.uri:e.map.uri),s={from:0,to:-1},a=this.initLoaded?e.byterange:e.map.byterange;return a&&(s.from=a.offset,s.to=a.offset+a.length),await this.loader.open(h.X$({},this.info,{url:i}),s),this.aesDecryptPipe?this.aesDecryptPipe.read(t):this.loader.read(t)}}async seek(t){this.loader&&(await this.loader.abort(),this.loader=null);let e=0,i=Number(t),s=0;for(let t=0;t<this.mediaPlayList.segments.length;t++)if(f.ai(this.mediaPlayList.segments[t].duration)&&(e+=this.mediaPlayList.segments[t].duration,1e3*e>=i)){s=t;break}return this.segmentIndex=s,4===this.status&&(this.status=2),0}async size(){return BigInt(0)}async abort(){this.loader&&(await this.loader.abort(),this.loader=null)}async stop(){await this.abort(),this.status=0}getDuration(){return this.mediaPlayList.duration}getVideoList(){var t,e;return{list:null!==(t=null===(e=this.masterPlaylist)||void 0===e?void 0:e.variants.map((t=>{var e,i,s,a,r;return{width:null!==(e=null===(i=t.resolution)||void 0===i?void 0:i.width)&&void 0!==e?e:0,height:null!==(s=null===(a=t.resolution)||void 0===a?void 0:a.height)&&void 0!==s?s:0,frameRate:null!==(r=t.frameRate)&&void 0!==r?r:0,codecs:t.codecs}})))&&void 0!==t?t:[],selectedIndex:0}}selectVideo(t){this.mediaPlayListIndex=t,this.fetchMediaPlayList()}getMinBuffer(){return this.minBuffer}}},48182:(t,e,i)=>{i.d(e,{A:()=>L});var s=i(7210),a=i.n(s),r=i(43929),n=i.n(r),o=i(69736),h=i.n(o),l=i(80662),c=i.n(l),d=i(67756),u=i(64608),T=i(4624);const E="src/avprotocol/m3u8/parser.ts";function f(t){return d.Bq(t,'"')}function A(t){const e=d.gI(t,",");return{duration:d.Ro(e[0]),title:decodeURIComponent(escape(e[1]))}}function p(t){const e=d.gI(t,"@");return{length:d.Ro(e[0]),offset:e[1]?d.Ro(e[1]):-1}}function m(t){const e=d.gI(t,"x");return{width:d.Ro(e[0]),height:d.Ro(e[1])}}function y(t){const e="ALLOWED-CPC: Each entry must consit of KEYFORMAT and Content Protection Configuration",i=t.split(",");0===i.length&&T.z3(e,E,102);const s=[];for(const t of i){const[i,a]=d.gI(t,":");i&&a?s.push({format:i,cpcList:a.split("/")}):T.z3(e,E,108)}return s}function g(t){const e=d.m2(t);return 16!==e.length&&T.z3("IV must be a 128-bit unsigned integer",E,119),e}function X(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function S(t){const e={};for(const s of d.HG(t)){const[t,a]=d.gI(s,"="),r=f(a);switch(t){case"URI":e[t]=r;break;case"START-DATE":case"END-DATE":e[t]=new Date(r);break;case"IV":e[t]=g(r);break;case"BYTERANGE":e[t]=p(r);break;case"RESOLUTION":e[t]=m(r);break;case"ALLOWED-CPC":e[t]=y(r);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":case"CAN-BLOCK-RELOAD":case"INDEPENDENT":case"GAP":e[t]="YES"===r;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":case"CAN-SKIP-UNTIL":case"HOLD-BACK":case"PART-HOLD-BACK":case"PART-TARGET":case"BYTERANGE-START":case"BYTERANGE-LENGTH":case"LAST-MSN":case"LAST-PART":case"SKIPPED-SEGMENTS":case"SCORE":case"PROGRAM-ID":e[t]=d.Ro(r);break;default:t.startsWith("SCTE35-")?e[t]=d.m2(r):t.startsWith("X-")?e[t]=(i=a).startsWith('"')?f(i):i.startsWith("0x")||i.startsWith("0X")?d.m2(i):d.Ro(i):("VIDEO-RANGE"===t&&"SDR"!==r&&"HLG"!==r&&"PQ"!==r&&T.h2(`VIDEO-RANGE: unknown value "${r}"`,E,206),e[t]=r)}}var i;return e}function I(t,e,i){const s=function({attributes:t}){return new u.ru({type:t.TYPE,uri:t.URI,groupId:t["GROUP-ID"],language:t.LANGUAGE,assocLanguage:t["ASSOC-LANGUAGE"],name:t.NAME,isDefault:t.DEFAULT,autoselect:t.AUTOSELECT,forced:t.FORCED,instreamId:t["INSTREAM-ID"],characteristics:t.CHARACTERISTICS,channels:t.CHANNELS})}(e),a=t[d.Th(i)],r=function(t,e){let i=!1;for(const s of t){if(s.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";s.isDefault&&(i=!0)}return i&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(a,s);r&&T.h2(r,E,315),a.push(s),s.isDefault&&(t.currentRenditions[d.Th(i)]=a.length-1)}function N(t,e,i,s,a){const r=new u.KT({uri:i,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],score:e.SCORE,codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"],allowedCpc:e["ALLOWED-CPC"],videoRange:e["VIDEO-RANGE"],stableVariantId:e["STABLE-VARIANT-ID"],programId:e["PROGRAM-ID"]});for(const i of t)if("EXT-X-MEDIA"===i.name){const t=i.attributes,s=t.TYPE;if(s&&t["GROUP-ID"]||T.h2("EXT-X-MEDIA TYPE attribute is REQUIRED.",E,355),e[s]===t["GROUP-ID"]&&(I(r,i,s),"CLOSED-CAPTIONS"===s))for(const{instreamId:t}of r.closedCaptions)if(t&&t.startsWith("SERVICE")&&a.compatibleVersion<7){a.compatibleVersion=7;break}}return function(t,e,i){for(const s of["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"])"CLOSED-CAPTIONS"===s&&"NONE"===t[s]?(i.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[s]&&!e[d.Th(s)].some((e=>e.groupId===t[s]))&&T.h2(`${s} attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ${s}.`,E,330)}(e,r,a),r.isIFrameOnly=s,r}function v(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(let i=0;i<t.iv.length;i++)if(t.iv[i]!==e.iv[i])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function R(t,e,i,s,a,r,o){const l=new u.Y4({uri:e,mediaSequenceNumber:a,discontinuitySequence:r});let c=!1,d=!1;for(let e=i;e<=s;e++){const{name:i,value:s,attributes:a}=t[e];if("EXTINF"===i)!n()(s.duration)&&o.compatibleVersion<3&&(o.compatibleVersion=3),Math.round(s.duration)>o.targetDuration&&T.h2("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration",E,517),l.duration=s.duration,l.title=s.title;else if("EXT-X-BYTERANGE"===i)o.compatibleVersion<4&&(o.compatibleVersion=4),l.byterange=s;else if("EXT-X-DISCONTINUITY"===i)l.parts.length>0&&T.h2("EXT-X-DISCONTINUITY must appear before the first EXT-X-PART tag of the Parent Segment.",E,530),l.discontinuity=!0;else if("EXT-X-KEY"===i)l.parts.length>0&&T.h2("EXT-X-KEY must appear before the first EXT-X-PART tag of the Parent Segment.",E,536),"NONE"!==a.METHOD&&(X(o,a),l.key=new u.Uz({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS}));else if("EXT-X-MAP"===i)l.parts.length>0&&T.h2("EXT-X-MAP must appear before the first EXT-X-PART tag of the Parent Segment.",E,552),o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,l.map=new u.qP({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===i)l.programDateTime=s;else if("EXT-X-DATERANGE"===i){const t={};for(const e of h()(a))(e.startsWith("SCTE35-")||e.startsWith("X-"))&&(t[e]=a[e]);l.dateRange=new u.ad({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:t})}else if("EXT-X-CUE-OUT"===i)l.markers.push(new u.xC({type:"OUT",duration:a&&a.DURATION||s}));else if("EXT-X-CUE-IN"===i)l.markers.push(new u.xC({type:"IN"}));else if("EXT-X-CUE-OUT-CONT"===i||"EXT-X-CUE"===i||"EXT-OATCLS-SCTE35"===i||"EXT-X-ASSET"===i||"EXT-X-SCTE35"===i)l.markers.push(new u.xC({type:"RAW",tagName:i,value:s}));else if("EXT-X-PRELOAD-HINT"!==i||a.TYPE)if("EXT-X-PRELOAD-HINT"===i&&"PART"===a.TYPE&&d)T.h2("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.",E,612);else if("EXT-X-PART"!==i&&"EXT-X-PRELOAD-HINT"!==i||a.URI){if("EXT-X-PRELOAD-HINT"===i&&"MAP"===a.TYPE)c&&T.h2("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.",E,619),c=!0,o.hasMap=!0,l.map=new u.qP({hint:!0,uri:a.URI,byterange:{length:a["BYTERANGE-LENGTH"],offset:a["BYTERANGE-START"]||0}});else if("EXT-X-PART"===i||"EXT-X-PRELOAD-HINT"===i&&"PART"===a.TYPE){"EXT-X-PART"!==i||a.DURATION||T.h2("EXT-X-PART: DURATION attribute is mandatory",E,631),"EXT-X-PRELOAD-HINT"===i&&(d=!0);const t=new u.nw({hint:"EXT-X-PRELOAD-HINT"===i,uri:a.URI,byterange:"EXT-X-PART"===i?a.BYTERANGE:{length:a["BYTERANGE-LENGTH"],offset:a["BYTERANGE-START"]||0},duration:a.DURATION,independent:a.INDEPENDENT,gap:a.GAP});l.parts.push(t)}}else T.h2("EXT-X-PART / EXT-X-PRELOAD-HINT: URI attribute is mandatory",E,615);else T.h2("EXT-X-PRELOAD-HINT: TYPE attribute is mandatory",E,609)}return l}function P(t,e,i,s,a,r,n){const o=new u.Vd({uri:e,mediaSequenceNumber:a,discontinuitySequence:r});for(let e=i;e<=s;e++){const{name:i,attributes:s}=t[e];"EXTINF"===i?T.h2("A prefetch segment must not be advertised with an EXTINF tag.",E,663):"EXT-X-DISCONTINUITY"===i?T.h2("A prefetch segment must not be advertised with an EXT-X-DISCONTINUITY tag.",E,666):"EXT-X-PREFETCH-DISCONTINUITY"===i?o.discontinuity=!0:"EXT-X-KEY"===i?"NONE"!==s.METHOD&&(X(n,s),o.key=new u.Uz({method:s.METHOD,uri:s.URI,iv:s.IV,format:s.KEYFORMAT,formatVersion:s.KEYFORMATVERSIONS})):"EXT-X-MAP"===i&&T.h2("Prefetch segments must not be advertised with an EXT-X-MAP tag.",E,684)}return o}function D(t,e,i,s,a){const{discontinuity:r,key:n,map:o,byterange:h,uri:l}=e;if(r&&(e.discontinuitySequence=i+1),n||(e.key=s),o||(e.map=a),h&&-1===h.offset){const{segments:e}=t;if(e.length>0){const t=e[e.length-1];t.byterange&&t.uri===l?h.offset=t.byterange.offset+t.byterange.length:T.h2("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource",E,900)}else T.h2("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file",E,904)}return t.segments.push(e),[e.discontinuitySequence,e.key,e.map]}function b(t,e){const[i,s]=function(t){const e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),r=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-PREFETCH-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":case"EXT-X-CUE-OUT":case"EXT-X-CUE-IN":case"EXT-X-CUE-OUT-CONT":case"EXT-X-CUE":case"EXT-OATCLS-SCTE35":case"EXT-X-ASSET":case"EXT-X-SCTE35":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PREFETCH":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(i);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&T.h2("The file contains both media and master playlist tags.",E,1011));if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&T.h2("The file contains both media and master playlist tags.",E,1021)}}(r,e),"Unknown"===r)return null;"MediaPlaylist"===r&&"EXT-X-RENDITION-REPORT"!==i&&"EXT-X-PREFETCH"!==i&&(e.hash[i]&&T.h2("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist",E,1042),e.hash[i]=!0);const[n,o]=function(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-CUE-IN":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[d.Ro(e),null];case"EXT-X-CUE-OUT":return a()(Number(e))?[null,S(e)]:[d.Ro(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return[null,S(e)];case"EXTINF":return[A(e),null];case"EXT-X-BYTERANGE":return[p(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];default:return[e,null]}}(i,s);return{name:i,category:r,value:n,attributes:o}}function O(t,e){let i;return e.isMasterPlaylist?i=function(t,e){const i=new u.ts;let s=!1;for(const[a,{name:r,value:n,attributes:o}]of t.entries())if("EXT-X-VERSION"===r)i.version=n;else if("EXT-X-STREAM-INF"===r){const r=t[a+1];("string"!=typeof r||r.startsWith("#EXT"))&&T.h2("EXT-X-STREAM-INF must be followed by a URI line",E,417);const n=N(t,o,r,!1,e);n&&("number"==typeof n.score&&(s=!0,n.score<0&&T.h2("SCORE attribute on EXT-X-STREAM-INF must be positive decimal-floating-point number.",E,424)),i.variants.push(n))}else if("EXT-X-I-FRAME-STREAM-INF"===r){const s=N(t,o,o.URI,!0,e);s&&i.variants.push(s)}else if("EXT-X-SESSION-DATA"===r){const t=new u.pf({id:o["DATA-ID"],value:o.VALUE,uri:o.URI,language:o.LANGUAGE});i.sessionDataList.some((e=>e.id===t.id&&e.language===t.language))&&T.h2("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute.",E,444),i.sessionDataList.push(t)}else if("EXT-X-SESSION-KEY"===r){"NONE"===o.METHOD&&T.h2("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE",E,450);const t=new u.Uz({method:o.METHOD,uri:o.URI,iv:o.IV,format:o.KEYFORMAT,formatVersion:o.KEYFORMATVERSIONS});i.sessionKeyList.some((e=>v(e,t)))&&T.h2("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values.",E,460),X(e,o),i.sessionKeyList.push(t)}else"EXT-X-INDEPENDENT-SEGMENTS"===r?(i.independentSegments&&T.h2("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist",E,467),i.independentSegments=!0):"EXT-X-START"===r&&(i.start&&T.h2("EXT-X-START tag MUST NOT appear more than once in a Playlist",E,473),"number"!=typeof o["TIME-OFFSET"]&&T.h2("EXT-X-START: TIME-OFFSET attribute is REQUIRED",E,476),i.start={offset:o["TIME-OFFSET"],precise:o.PRECISE||!1});if(s)for(const t of i.variants)"number"!=typeof t.score&&T.h2("If any Variant Stream contains the SCORE attribute, then all Variant Streams in the Master Playlist SHOULD have a SCORE attribute",E,484);if(e.isClosedCaptionsNone)for(const t of i.variants)t.closedCaptions.length>0&&T.h2("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE",E,491);return i}(t,e):(i=function(t,e){const i=new u.tk;let s=-1,a=0,r=!1,n=!1,o=0,h=null,l=null,d=!1;for(const[c,f]of t.entries()){const{name:A,value:p,attributes:m,category:y}=f;if("Segment"!==y){if("EXT-X-VERSION"===A)void 0===i.version?i.version=p:T.h2("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.",E,716);else if("EXT-X-TARGETDURATION"===A)i.targetDuration=e.targetDuration=p;else if("EXT-X-MEDIA-SEQUENCE"===A)i.segments.length>0&&T.h2("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist.",E,724),i.mediaSequenceBase=a=p;else if("EXT-X-DISCONTINUITY-SEQUENCE"===A)i.segments.length>0&&T.h2("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist.",E,730),r&&T.h2("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag.",E,733),i.discontinuitySequenceBase=o=p;else if("EXT-X-ENDLIST"===A)i.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===A)i.playlistType=p;else if("EXT-X-I-FRAMES-ONLY"===A)e.compatibleVersion<4&&(e.compatibleVersion=4),i.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===A)i.independentSegments&&T.h2("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist",E,751),i.independentSegments=!0;else if("EXT-X-START"===A)i.start&&T.h2("EXT-X-START tag MUST NOT appear more than once in a Playlist",E,757),"number"!=typeof m["TIME-OFFSET"]&&T.h2("EXT-X-START: TIME-OFFSET attribute is REQUIRED",E,760),i.start={offset:m["TIME-OFFSET"],precise:m.PRECISE||!1};else if("EXT-X-SERVER-CONTROL"===A)m["CAN-BLOCK-RELOAD"]||T.h2("EXT-X-SERVER-CONTROL: CAN-BLOCK-RELOAD=YES is mandatory for Low-Latency HLS",E,766),i.lowLatencyCompatibility={canBlockReload:m["CAN-BLOCK-RELOAD"],canSkipUntil:m["CAN-SKIP-UNTIL"],holdBack:m["HOLD-BACK"],partHoldBack:m["PART-HOLD-BACK"]};else if("EXT-X-PART-INF"===A)m["PART-TARGET"]||T.h2("EXT-X-PART-INF: PART-TARGET attribute is mandatory",E,777),i.partTargetDuration=m["PART-TARGET"];else if("EXT-X-RENDITION-REPORT"===A)m.URI||T.h2("EXT-X-RENDITION-REPORT: URI attribute is mandatory",E,783),0===m.URI.search(/^[a-z]+:/)&&T.h2("EXT-X-RENDITION-REPORT: URI must be relative to the playlist uri",E,786),i.renditionReports.push(new u.h4({uri:m.URI,lastMSN:m["LAST-MSN"],lastPart:m["LAST-PART"]}));else if("EXT-X-SKIP"===A)m["SKIPPED-SEGMENTS"]||T.h2("EXT-X-SKIP: SKIPPED-SEGMENTS attribute is mandatory",E,796),e.compatibleVersion<9&&(e.compatibleVersion=9),i.skip=m["SKIPPED-SEGMENTS"],a+=i.skip;else if("EXT-X-PREFETCH"===A){const r=P(t,p,-1===s?c:s,c-1,a++,o,e);r&&(r.discontinuity&&(r.discontinuitySequence++,o=r.discontinuitySequence),r.key?h=r.key:r.key=h,i.prefetchSegments.push(r)),n=!0,s=-1}else if("string"==typeof f){-1===s&&T.h2("A URI line is not preceded by any segment tags",E,833),i.targetDuration||T.h2("The EXT-X-TARGETDURATION tag is REQUIRED",E,836),n&&T.h2("These segments must appear after all complete segments.",E,839);const r=R(t,f,s,c-1,a++,o,e);r&&([o,h,l]=D(i,r,o,h,l),!d&&r.parts.length>0&&(d=!0)),s=-1}}else-1===s&&(s=c),"EXT-X-DISCONTINUITY"===A&&(r=!0)}if(-1!==s){const r=R(t,"",s,t.length-1,a++,o,e);if(r){var f;const{parts:t}=r;!(t.length>0)||i.endlist||null!==(f=t[t.length-1])&&void 0!==f&&f.hint||T.h2("If the Playlist contains EXT-X-PART tags and does not contain an EXT-X-ENDLIST tag, the Playlist must contain an EXT-X-PRELOAD-HINT tag with a TYPE=PART attribute",E,856),D(i,r,h,l),!d&&r.parts.length>0&&(d=!0)}}return function(t){const e=new(c()),i=new(c());let s=!1,a=!1;for(let r=t.length-1;r>=0;r--){const{programDateTime:n,dateRange:o}=t[r];if(n&&(a=!0),o&&o.start){s=!0,o.endOnNext&&(o.end||o.duration)&&T.h2("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.",E,924);const t=o.start.getTime(),a=o.duration||0;o.end&&o.duration&&t+1e3*a!==o.end.getTime()&&T.h2("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION",E,930),o.endOnNext&&(o.end=e.get(o.classId)),e.set(o.classId,o.start);const r=o.end?o.end.getTime():o.start.getTime()+1e3*(o.duration||0),n=i.get(o.classId);if(n){for(const e of n)(e.start<=t&&e.end>t||e.start>=t&&e.start<r)&&T.h2("DATERANGE tags with the same CLASS should not overlap",E,942);n.push({start:t,end:r})}else o.classId&&i.set(o.classId,[{start:t,end:r}])}}s&&!a&&T.h2("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.",E,953)}(i.segments),i.lowLatencyCompatibility&&function({lowLatencyCompatibility:t,targetDuration:e,partTargetDuration:i,segments:s,renditionReports:a},r){const{canSkipUntil:n,holdBack:o,partHoldBack:h}=t;if(n<6*e&&T.h2("The Skip Boundary must be at least six times the EXT-X-TARGETDURATION.",E,960),o<3*e&&T.h2("HOLD-BACK must be at least three times the EXT-X-TARGETDURATION.",E,964),r){void 0===i&&T.h2("EXT-X-PART-INF is required if a Playlist contains one or more EXT-X-PART tags",E,968),void 0===h&&T.h2("EXT-X-PART: PART-HOLD-BACK attribute is mandatory",E,971),h<i&&T.h2("PART-HOLD-BACK must be at least PART-TARGET",E,974);for(const[t,{parts:e}]of s.entries()){e.length>0&&t<s.length-3&&T.h2("Remove EXT-X-PART tags from the Playlist after they are greater than three target durations from the end of the Playlist.",E,978);for(const[t,{duration:s}]of e.entries())void 0!==s&&(s>i&&T.h2("PART-TARGET is the maximum duration of any Partial Segment",E,985),t<e.length-1&&s<.85*i&&T.h2("All Partial Segments except the last part of a segment must have a duration of at least 85% of PART-TARGET",E,988))}}for(const t of a){const e=s[s.length-1];null!==t.lastMSN&&void 0!==t.lastMSN||(t.lastMSN=e.mediaSequenceNumber),(null===t.lastPart||void 0===t.lastPart)&&e.parts.length>0&&(t.lastPart=e.parts.length-1)}}(i,d),i.duration=i.segments.reduce(((t,e)=>"number"==typeof e.duration?t+e.duration:t),0),i}(t,e),!i.isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6)),e.compatibleVersion>1&&(!i.version||i.version<e.compatibleVersion)&&T.h2(`EXT-X-VERSION needs to be ${e.compatibleVersion} or higher.`,E,1092),i}function L(t){const e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},i=function(t,e){const i=[];for(const s of t.split("\n")){const t=s.trim();if(t)if(t.startsWith("#")){if(t.startsWith("#EXT")){const s=b(t,e);s&&i.push(s)}}else i.push(t)}return 0!==i.length&&"EXTM3U"===i[0].name||T.h2("The EXTM3U tag MUST be the first line.",E,1074),i}(t,e),s=O(i,e);return s.source=t,s}},64608:(t,e,i)=>{i.d(e,{KT:()=>n,Uz:()=>h,Vd:()=>m,Y4:()=>A,ad:()=>c,h4:()=>y,nw:()=>p,pf:()=>o,qP:()=>l,ru:()=>r,tk:()=>f,ts:()=>E,xC:()=>d});var s=i(134),a=i(86932);class r{constructor({type:t,uri:e,groupId:i,language:a,assocLanguage:r,name:n,isDefault:o,autoselect:h,forced:l,instreamId:c,characteristics:d,channels:u}){(0,s.A)(this,"type",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"groupId",void 0),(0,s.A)(this,"language",void 0),(0,s.A)(this,"assocLanguage",void 0),(0,s.A)(this,"name",void 0),(0,s.A)(this,"isDefault",void 0),(0,s.A)(this,"autoselect",void 0),(0,s.A)(this,"forced",void 0),(0,s.A)(this,"instreamId",void 0),(0,s.A)(this,"characteristics",void 0),(0,s.A)(this,"channels",void 0),this.type=t,this.uri=e,this.groupId=i,this.language=a,this.assocLanguage=r,this.name=n,this.isDefault=o,this.autoselect=h,this.forced=l,this.instreamId=c,this.characteristics=d,this.channels=u}}class n{constructor({uri:t,isIFrameOnly:e=!1,bandwidth:i,averageBandwidth:a,score:r,codecs:n,resolution:o,frameRate:h,hdcpLevel:l,allowedCpc:c,videoRange:d,stableVariantId:u,programId:T,audio:E=[],video:f=[],subtitles:A=[],closedCaptions:p=[],currentRenditions:m={audio:0,video:0,subtitles:0,closedCaptions:0}}){(0,s.A)(this,"uri",void 0),(0,s.A)(this,"isIFrameOnly",void 0),(0,s.A)(this,"bandwidth",void 0),(0,s.A)(this,"averageBandwidth",void 0),(0,s.A)(this,"score",void 0),(0,s.A)(this,"codecs",void 0),(0,s.A)(this,"resolution",void 0),(0,s.A)(this,"frameRate",void 0),(0,s.A)(this,"hdcpLevel",void 0),(0,s.A)(this,"allowedCpc",void 0),(0,s.A)(this,"videoRange",void 0),(0,s.A)(this,"stableVariantId",void 0),(0,s.A)(this,"programId",void 0),(0,s.A)(this,"audio",void 0),(0,s.A)(this,"video",void 0),(0,s.A)(this,"subtitles",void 0),(0,s.A)(this,"closedCaptions",void 0),(0,s.A)(this,"currentRenditions",void 0),this.uri=t,this.isIFrameOnly=e,this.bandwidth=i,this.averageBandwidth=a,this.score=r,this.codecs=n,this.resolution=o,this.frameRate=h,this.hdcpLevel=l,this.allowedCpc=c,this.videoRange=d,this.stableVariantId=u,this.programId=T,this.audio=E,this.video=f,this.subtitles=A,this.closedCaptions=p,this.currentRenditions=m}}class o{constructor({id:t,value:e,uri:i,language:a}){(0,s.A)(this,"id",void 0),(0,s.A)(this,"value",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"language",void 0),this.id=t,this.value=e,this.uri=i,this.language=a}}class h{constructor({method:t,uri:e,iv:i,format:a,formatVersion:r}){(0,s.A)(this,"method",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"iv",void 0),(0,s.A)(this,"format",void 0),(0,s.A)(this,"formatVersion",void 0),this.method=t,this.uri=e,this.iv=i,this.format=a,this.formatVersion=r}}class l{constructor({hint:t=!1,uri:e,mimeType:i,byterange:a}){(0,s.A)(this,"hint",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"mimeType",void 0),(0,s.A)(this,"byterange",void 0),this.hint=t,this.uri=e,this.mimeType=i,this.byterange=a}}class c{constructor({id:t,classId:e,start:i,end:a,duration:r,plannedDuration:n,endOnNext:o,attributes:h={}}){(0,s.A)(this,"id",void 0),(0,s.A)(this,"classId",void 0),(0,s.A)(this,"start",void 0),(0,s.A)(this,"end",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"plannedDuration",void 0),(0,s.A)(this,"endOnNext",void 0),(0,s.A)(this,"attributes",void 0),this.id=t,this.classId=e,this.start=i,this.end=a,this.duration=r,this.plannedDuration=n,this.endOnNext=o,this.attributes=h}}class d{constructor({type:t,duration:e,tagName:i,value:a}){(0,s.A)(this,"type",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"tagName",void 0),(0,s.A)(this,"value",void 0),this.type=t,this.duration=e,this.tagName=i,this.value=a}}class u{constructor(t){(0,s.A)(this,"type",void 0),this.type=t}}class T extends u{constructor({isMasterPlaylist:t,uri:e,version:i,independentSegments:a=!1,start:r,source:n}){super("playlist"),(0,s.A)(this,"isMasterPlaylist",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"independentSegments",void 0),(0,s.A)(this,"start",void 0),(0,s.A)(this,"source",void 0),this.isMasterPlaylist=t,this.uri=e,this.version=i,this.independentSegments=a,this.start=r,this.source=n}}class E extends T{constructor(t={}){super({...t,isMasterPlaylist:!0}),(0,s.A)(this,"variants",void 0),(0,s.A)(this,"currentVariant",void 0),(0,s.A)(this,"sessionDataList",void 0),(0,s.A)(this,"sessionKeyList",void 0);const{variants:e=[],currentVariant:i,sessionDataList:a=[],sessionKeyList:r=[]}=t;this.variants=e,this.currentVariant=i,this.sessionDataList=a,this.sessionKeyList=r}}class f extends T{constructor(t={}){super({...t,isMasterPlaylist:!1}),(0,s.A)(this,"targetDuration",void 0),(0,s.A)(this,"mediaSequenceBase",void 0),(0,s.A)(this,"discontinuitySequenceBase",void 0),(0,s.A)(this,"endlist",void 0),(0,s.A)(this,"playlistType",void 0),(0,s.A)(this,"isIFrame",void 0),(0,s.A)(this,"segments",void 0),(0,s.A)(this,"prefetchSegments",void 0),(0,s.A)(this,"lowLatencyCompatibility",void 0),(0,s.A)(this,"partTargetDuration",void 0),(0,s.A)(this,"renditionReports",void 0),(0,s.A)(this,"skip",void 0),(0,s.A)(this,"hash",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"timestamp",void 0);const{targetDuration:e,mediaSequenceBase:i=0,discontinuitySequenceBase:r=0,endlist:n=!1,playlistType:o,isIFrame:h,segments:l=[],prefetchSegments:c=[],lowLatencyCompatibility:d,partTargetDuration:u,renditionReports:T=[],skip:E=0,hash:f,duration:A=0}=t;this.targetDuration=e,this.mediaSequenceBase=i,this.discontinuitySequenceBase=r,this.endlist=n,this.playlistType=o,this.isIFrame=h,this.segments=l,this.prefetchSegments=c,this.lowLatencyCompatibility=d,this.partTargetDuration=u,this.renditionReports=T,this.skip=E,this.hash=f,this.duration=A,this.timestamp=(0,a.A)()}}class A extends u{constructor({uri:t,mimeType:e,data:i,duration:a,title:r,byterange:n,discontinuity:o,mediaSequenceNumber:h=0,discontinuitySequence:l=0,key:c,map:d,programDateTime:u,dateRange:T,markers:E=[],parts:f=[]}){super("segment"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"mimeType",void 0),(0,s.A)(this,"data",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"title",void 0),(0,s.A)(this,"byterange",void 0),(0,s.A)(this,"discontinuity",void 0),(0,s.A)(this,"mediaSequenceNumber",void 0),(0,s.A)(this,"discontinuitySequence",void 0),(0,s.A)(this,"key",void 0),(0,s.A)(this,"map",void 0),(0,s.A)(this,"programDateTime",void 0),(0,s.A)(this,"dateRange",void 0),(0,s.A)(this,"markers",void 0),(0,s.A)(this,"parts",void 0),this.uri=t,this.mimeType=e,this.data=i,this.duration=a,this.title=r,this.byterange=n,this.discontinuity=o,this.mediaSequenceNumber=h,this.discontinuitySequence=l,this.key=c,this.map=d,this.programDateTime=u,this.dateRange=T,this.markers=E,this.parts=f}}class p extends u{constructor({hint:t=!1,uri:e,duration:i,independent:a,byterange:r,gap:n}){super("part"),(0,s.A)(this,"hint",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"independent",void 0),(0,s.A)(this,"byterange",void 0),(0,s.A)(this,"gap",void 0),this.hint=t,this.uri=e,this.duration=i,this.independent=a,this.duration=i,this.byterange=r,this.gap=n}}class m extends u{constructor({uri:t,discontinuity:e,mediaSequenceNumber:i=0,discontinuitySequence:a=0,key:r}){super("prefetch"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"discontinuity",void 0),(0,s.A)(this,"mediaSequenceNumber",void 0),(0,s.A)(this,"discontinuitySequence",void 0),(0,s.A)(this,"key",void 0),this.uri=t,this.discontinuity=e,this.mediaSequenceNumber=i,this.discontinuitySequence=a,this.key=r}}class y{constructor({uri:t,lastMSN:e,lastPart:i}){(0,s.A)(this,"uri",void 0),(0,s.A)(this,"lastMSN",void 0),(0,s.A)(this,"lastPart",void 0),this.uri=t,this.lastMSN=e,this.lastPart=i}}},67756:(t,e,i)=>{i.d(e,{Bq:()=>u,HG:()=>T,Ro:()=>l,Th:()=>E,gI:()=>d,m2:()=>c});var s=i(99704),a=i.n(s),r=i(17735),n=i.n(r),o=i(7210),h=i.n(o);function l(t,e=10){if("number"==typeof t)return t;const i=10===e?a()(t):n()(t,e);return h()(i)?0:i}function c(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));const e=[];for(let i=0;i<t.length;i+=2)e.push(l(t.slice(i,i+2),16));return new Uint8Array(e)}function d(t,e,i=0){let s=-1;for(let a=0,r=0;a<t.length;a++)if(t[a]===e){if(r++===i)return[t.slice(0,a),t.slice(a+1)];s=a}return-1!==s?[t.slice(0,s),t.slice(s+1)]:[t]}function u(t,e=" "){return t?(t=t.trim()," "===e||(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1))),t):t}function T(t){const e=[];let i=!0,s=0;const a=[];for(let r=0;r<t.length;r++){const n=t[r];i&&","===n?(e.push(t.slice(s,r).trim()),s=r+1):'"'!==n&&"'"!==n||(i?(a.push(n),i=!1):n===a[a.length-1]?(a.pop(),i=!0):a.push(n))}return e.push(t.slice(s).trim()),e}function E(t){const e=[];let i=!1;for(const s of t)"-"!==s&&"_"!==s?i?(e.push(s.toUpperCase()),i=!1):e.push(s.toLowerCase()):i=!0;return e.join("")}},13258:(t,e,i)=>{i.d(e,{A:()=>a});var s=i(134);class a{constructor(t=0){(0,s.A)(this,"rcon",[0,1,2,4,8,16,32,64,128,27,54]),(0,s.A)(this,"subMix",[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]),(0,s.A)(this,"invSubMix",[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]),(0,s.A)(this,"sBox",new Uint32Array(256)),(0,s.A)(this,"invSBox",new Uint32Array(256)),(0,s.A)(this,"key",new Uint32Array(0)),(0,s.A)(this,"ksRows",0),(0,s.A)(this,"keySize",0),(0,s.A)(this,"keySchedule",void 0),(0,s.A)(this,"invKeySchedule",void 0),this.initTable()}uint8ArrayToUint32Array_(t){const e=new DataView(t),i=new Uint32Array(4);for(let t=0;t<4;t++)i[t]=e.getUint32(4*t);return i}initTable(){const t=this.sBox,e=this.invSBox,i=this.subMix,s=i[0],a=i[1],r=i[2],n=i[3],o=this.invSubMix,h=o[0],l=o[1],c=o[2],d=o[3],u=new Uint32Array(256);let T=0,E=0,f=0;for(f=0;f<256;f++)u[f]=f<128?f<<1:f<<1^283;for(f=0;f<256;f++){let i=E^E<<1^E<<2^E<<3^E<<4;i=i>>>8^255&i^99,t[T]=i,e[i]=T;const o=u[T],f=u[o],A=u[f];let p=257*u[i]^16843008*i;s[T]=p<<24|p>>>8,a[T]=p<<16|p>>>16,r[T]=p<<8|p>>>24,n[T]=p,p=16843009*A^65537*f^257*o^16843008*T,h[i]=p<<24|p>>>8,l[i]=p<<16|p>>>16,c[i]=p<<8|p>>>24,d[i]=p,T?(T=o^u[u[u[A^o]]],E^=u[u[E]]):T=E=1}}async expandKey(t){const e=this.uint8ArrayToUint32Array_(t);if(this.key){let t=!0,i=0;for(;i<e.length&&t;)t=e[i]===this.key[i],i++;if(t)return}this.key=e;const i=this.keySize=this.key.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);const s=this.ksRows=4*(i+6+1);let a,r;const n=this.keySchedule=new Uint32Array(s),o=this.invKeySchedule=new Uint32Array(s),h=this.sBox,l=this.rcon,c=this.invSubMix,d=c[0],u=c[1],T=c[2],E=c[3];let f,A;for(a=0;a<s;a++)a<i?f=n[a]=e[a]:(A=f,a%i==0?(A=A<<8|A>>>24,A=h[A>>>24]<<24|h[A>>>16&255]<<16|h[A>>>8&255]<<8|h[255&A],A^=l[a/i|0]<<24):i>6&&a%i==4&&(A=h[A>>>24]<<24|h[A>>>16&255]<<16|h[A>>>8&255]<<8|h[255&A]),n[a]=f=(n[a-i]^A)>>>0);for(r=0;r<s;r++)a=s-r,A=3&r?n[a]:n[a-4],o[r]=r<4||a<=4?A:d[h[A>>>24]]^u[h[A>>>16&255]]^T[h[A>>>8&255]]^E[h[255&A]],o[r]=o[r]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}async decrypt(t,e){const i=this.keySize+6,s=this.invKeySchedule,a=this.invSBox,r=this.invSubMix,n=r[0],o=r[1],h=r[2],l=r[3],c=this.uint8ArrayToUint32Array_(e);let d=c[0],u=c[1],T=c[2],E=c[3];const f=new Int32Array(t.buffer).subarray(t.byteOffset>>>2,(t.byteOffset>>>2)+(t.length>>>2)),A=new Int32Array(f.length);let p,m,y,g,X,S,I,N,v,R,P,D,b,O;const L=this.networkToHostOrderSwap;let M=0;for(;M<f.length;){for(v=L(f[M]),R=L(f[M+1]),P=L(f[M+2]),D=L(f[M+3]),X=v^s[0],S=D^s[1],I=P^s[2],N=R^s[3],b=4,O=1;O<i;O++)p=n[X>>>24]^o[S>>16&255]^h[I>>8&255]^l[255&N]^s[b],m=n[S>>>24]^o[I>>16&255]^h[N>>8&255]^l[255&X]^s[b+1],y=n[I>>>24]^o[N>>16&255]^h[X>>8&255]^l[255&S]^s[b+2],g=n[N>>>24]^o[X>>16&255]^h[S>>8&255]^l[255&I]^s[b+3],X=p,S=m,I=y,N=g,b+=4;p=a[X>>>24]<<24^a[S>>16&255]<<16^a[I>>8&255]<<8^a[255&N]^s[b],m=a[S>>>24]<<24^a[I>>16&255]<<16^a[N>>8&255]<<8^a[255&X]^s[b+1],y=a[I>>>24]<<24^a[N>>16&255]<<16^a[X>>8&255]<<8^a[255&S]^s[b+2],g=a[N>>>24]<<24^a[X>>16&255]<<16^a[S>>8&255]<<8^a[255&I]^s[b+3],A[M]=L(p^d),A[M+1]=L(g^u),A[M+2]=L(y^T),A[M+3]=L(m^E),d=v,u=R,T=P,E=D,M+=4}return A.buffer}}},51678:(t,e,i)=>{i.d(e,{A:()=>a});var s=i(134);class a{constructor(t=0){(0,s.A)(this,"subtle",void 0),(0,s.A)(this,"key",void 0),(0,s.A)(this,"mode",void 0),(0,s.A)(this,"keyBuffer",void 0),this.mode=t,this.subtle=crypto.subtle||crypto.webkitSubtle}getSubtleAlgoName(){switch(this.mode){case 0:return"AES-CBC";case 1:return"AES-CTR"}}async expandKey(t){let e=new Uint8Array(t);if(this.keyBuffer){let t=!0,i=0;for(;i<e.length&&t;)t=e[i]===this.keyBuffer[i],i++;if(t)return}this.keyBuffer=e,this.key=await this.subtle.importKey("raw",t,{name:this.getSubtleAlgoName()},!1,["encrypt","decrypt"])}async encryptPadding(t,e){return new Uint8Array(await crypto.subtle.encrypt({name:"AES-CBC",iv:e},this.key,t))}async decrypt(t,e){switch(this.mode){case 0:return this.subtle.decrypt({name:"AES-CBC",iv:e},this.key,t);case 1:return this.subtle.decrypt({name:"AES-CTR",counter:e,length:64},this.key,t)}}static isSupport(){return"object"==typeof(crypto.subtle||crypto.webkitSubtle)}}},6498:(t,e,i)=>{i.d(e,{A:()=>r});var s=i(67672),a=i(72739);function r(t,e){const i=[];return s.ai(t)&&(t+=""),t&&s.Yj(t)&&a.__(t.split(e),((t,e)=>{(t=t.trim())&&i.push(t)})),i}},8507:(t,e,i)=>{i.d(e,{ll:()=>f,mA:()=>n,qg:()=>o}),i(73146);var s=i(67672),a=i(6498),r=i(72739);function n(t,e="&"){const i={};if(s.Yj(t)&&t.indexOf("=")>=0){let s=t.charAt(0),n="?"===s||"#"===s?1:0;n>0&&(t=t.substr(n)),r.__((0,a.A)(t,e),(t=>{let e=t.split("=");if(2===e.length){var s;let t=null===(s=e[0])||void 0===s?void 0:s.trim();t&&(i[t]=decodeURIComponent(e[1]))}}))}return i}function o(t){const e=t,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],s=/:\/\/([^\/@]*@?)\[(\S+)\]/;let a="";s.test(t)&&(t=t.replace(s,((t,e,i)=>(a=i,`://${e||""}a.b`))));const r={},n=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);let o=14;for(;o--;){var h;r[i[o]]=null!==(h=n[o])&&void 0!==h?h:""}return a&&(r.host=a,r.source=e,r.authority=a+(r.port?":"+r.port:"")),{protocol:r.protocol,file:r.file,host:r.host,port:r.port,user:r.user,password:r.password,origin:`${r.protocol}://${r.authority}`,pathname:r.path,search:`?${r.query}`,hash:r.anchor?`#${r.anchor}`:""}}i(95335);const h=/(?:\/|^)\.(?=\/)/g,l=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,c=/^(?=([^\/?#]*))\1([^]*)$/,d=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;function u(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}function T(t){const e=d.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null}function E(t){for(t=t.split("").reverse().join("").replace(h,"");t.length!==(t=t.replace(l,"")).length;);return t.split("").reverse().join("")}function f(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;let e=T(t);if(!e)throw new Error("Error trying to parse base URL.");return e.path=E(e.path),u(e)}let s=T(e);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=E(s.path),u(s)):e;let a=T(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){let t=c.exec(a.path);a.netLoc=t[1],a.path=t[2]}a.netLoc&&!a.path&&(a.path="/");const r={scheme:a.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(r.netLoc=a.netLoc,"/"!==s.path[0]))if(s.path){let t=a.path,e=t.substring(0,t.lastIndexOf("/")+1)+s.path;r.path=E(e)}else r.path=a.path,s.params||(r.params=a.params,s.query||(r.query=a.query));return null===r.path&&(r.path=i.alwaysNormalize?E(s.path):s.path),u(r)}},85079:(t,e,i)=>{var s=i(46438),a=s.JSON||(s.JSON={stringify:JSON.stringify});t.exports=function(t){return a.stringify.apply(a,arguments)}},63342:(t,e,i)=>{i(5882),t.exports=i(46438).Number.isInteger},11837:(t,e,i)=>{i(21489),t.exports=i(46438).Number.isNaN},19737:(t,e,i)=>{i(56477),t.exports=i(46438).Number.parseFloat},58886:(t,e,i)=>{i(15706),t.exports=i(46438).Number.parseInt},25194:(t,e,i)=>{var s=i(24401),a=Math.floor;t.exports=function(t){return!s(t)&&isFinite(t)&&a(t)===t}},5882:(t,e,i)=>{var s=i(88535);s(s.S,"Number",{isInteger:i(25194)})},21489:(t,e,i)=>{var s=i(88535);s(s.S,"Number",{isNaN:function(t){return t!=t}})},56477:(t,e,i)=>{var s=i(88535),a=i(49709);s(s.S+s.F*(Number.parseFloat!=a),"Number",{parseFloat:a})},15706:(t,e,i)=>{var s=i(88535),a=i(15722);s(s.S+s.F*(Number.parseInt!=a),"Number",{parseInt:a})},73146:(t,e,i)=>{t.exports=i(85079)},43929:(t,e,i)=>{t.exports=i(63342)},7210:(t,e,i)=>{t.exports=i(11837)},99704:(t,e,i)=>{t.exports=i(19737)},17735:(t,e,i)=>{t.exports=i(58886)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[453],{18453:(e,t,a)=>{a.r(t),a.d(t,{default:()=>I});var i=a(134),r=a(50932),n=a(4624),o=a(9705),s=a(85947),c=a(14686),d=a(37837),f=a(71517),h=a(91375),m=a(37246),l=a(92647),u=a(77231),p=a(52071),x=a(72739),R=a(44328);const B="src/avformat/formats/IFlacFormat.ts",g=1024;class I extends s.A{constructor(){super(),(0,i.A)(this,"type",17),(0,i.A)(this,"context",void 0)}init(e){e.ioReader.setEndian(!0),this.context={streamInfo:{minimumBlockSize:0,maximumBlockSize:0,minimumFrameSize:0,maximumFrameSize:0,sampleRate:0,channels:0,bitPerSample:0,samples:BigInt(0),md5:""},frameInfo:{sampleRate:0,channels:0,bps:0,blocksize:0,chMode:0,frameOrSampleNum:BigInt(0),isVarSize:0},seekPoints:[],cueSheet:{catalogNumber:"",leadInSamples:BigInt(0),compactDisc:!1,tracks:[]},picture:{type:0,mimeType:"",description:"",width:0,height:0,colorDepth:0,indexedColor:0,data:null},cacheBuffer:null,cachePos:BigInt(0),bitReader:new m.A(16),fileSize:BigInt(0),firstFramePos:BigInt(0),isVarSize:-1}}async readHeader(e){if("fLaC"!==await e.ioReader.readString(4))return n.z3("the file format is not flac",B,116),o.LR;this.context.fileSize=await e.ioReader.fileSize();const t=e.createStream();for(t.codecpar.codecType=1,t.codecpar.codecId=86028;;){const a=await e.ioReader.readUint8(),i=await e.ioReader.readUint24(),r=-129&a;if(0===r){t.codecpar.extradata=(0,d.sY)(i),t.codecpar.extradataSize=i,(0,c.lW)(t.codecpar.extradata,i,await e.ioReader.peekBuffer(i)),this.context.streamInfo.minimumBlockSize=await e.ioReader.readUint16(),this.context.streamInfo.maximumBlockSize=await e.ioReader.readUint16(),this.context.streamInfo.minimumFrameSize=await e.ioReader.readUint24(),this.context.streamInfo.maximumFrameSize=await e.ioReader.readUint24();const a=await e.ioReader.readUint24();t.codecpar.sampleRate=a>>4,t.codecpar.chLayout.nbChannels=1+((15&a)>>>1),this.context.streamInfo.sampleRate=t.codecpar.sampleRate,this.context.streamInfo.channels=t.codecpar.chLayout.nbChannels;const r=await e.ioReader.readUint8();t.codecpar.bitsPerRawSample=1+((1&a)<<4|(240&r)>>>4),this.context.streamInfo.bitPerSample=t.codecpar.bitsPerRawSample;const n=await e.ioReader.readUint32(),o=BigInt(Math.floor(15&r))<<BigInt(32)|BigInt(Math.floor(n));this.context.streamInfo.samples=o,t.timeBase.den=t.codecpar.sampleRate,t.timeBase.num=1,t.duration=o,t.startTime=BigInt(0),this.context.streamInfo.md5=await e.ioReader.readString(16)}else if(2===r){const t=e.createStream();t.codecpar.codecType=2,t.codecpar.codecTag=await e.ioReader.readUint32(),t.codecpar.extradata=(0,d.sY)(i-4),t.codecpar.extradataSize=i-4,await e.ioReader.readBuffer(i-4,(0,c.JW)(t.codecpar.extradata,t.codecpar.extradataSize))}else if(3===r)for(let t=0;t<i/18;t++){const t=await e.ioReader.readUint64(),a=await e.ioReader.readUint64(),i=await e.ioReader.readUint16();this.context.seekPoints.push({pts:t,pos:a,samples:i})}else if(4===r){e.ioReader.setEndian(!1);const a=await e.ioReader.readUint32(),i=await e.ioReader.readString(a),r=await e.ioReader.readUint32(),n=[];for(let t=0;t<r;t++){const t=await e.ioReader.readUint32();n.push(await e.ioReader.readString(t))}t.metadata.vendor=i,t.metadata.comments=n,e.ioReader.setEndian(!0)}else if(5===r){this.context.cueSheet.catalogNumber=await e.ioReader.readString(128),this.context.cueSheet.leadInSamples=await e.ioReader.readUint64(),this.context.cueSheet.compactDisc=!!(await e.ioReader.readUint8()>>>7),await e.ioReader.skip(258);const t=await e.ioReader.readUint8();for(let a=0;a<t;a++){const t=await e.ioReader.readUint64(),a=await e.ioReader.readUint8(),i=await e.ioReader.readBuffer(12),r=await e.ioReader.readUint8();await e.ioReader.skip(13);const n=await e.ioReader.readUint8(),o=[];for(let t=0;t<n;t++)o.push({offset:await e.ioReader.readUint64(),point:await e.ioReader.readUint8()}),await e.ioReader.skip(3);this.context.cueSheet.tracks.push({offset:t,number:a,isrc:i,type:r>>>7,preEmphasisFlag:r>>>6&1,points:o})}}else if(6===r){this.context.picture.type=await e.ioReader.readUint32();let t=await e.ioReader.readUint32();this.context.picture.mimeType=await e.ioReader.readString(t),t=await e.ioReader.readUint32(),this.context.picture.description=await e.ioReader.readString(t),this.context.picture.width=await e.ioReader.readUint32(),this.context.picture.height=await e.ioReader.readUint32(),this.context.picture.colorDepth=await e.ioReader.readUint32(),this.context.picture.indexedColor=await e.ioReader.readUint32(),t=await e.ioReader.readUint32(),this.context.picture.data=await e.ioReader.readBuffer(t)}else await e.ioReader.skip(i);if(128&a)break}return this.context.firstFramePos=e.ioReader.getPos(),t.privData=this.context,0}async getNextFrame(e){const t=[];for(;;){if(e.ioReader.getPos()===this.context.fileSize){this.context.cacheBuffer&&(t.push(this.context.cacheBuffer),this.context.cacheBuffer=null);break}this.context.cacheBuffer?this.context.cacheBuffer.length<17&&(this.context.cacheBuffer=(0,l.A)(Uint8Array,[this.context.cacheBuffer,await e.ioReader.readBuffer(Math.min(g,Number(BigInt.asIntN(32,this.context.fileSize-e.ioReader.getPos()))))])):(this.context.cachePos=e.ioReader.getPos(),this.context.cacheBuffer=await e.ioReader.readBuffer(Math.min(g,Number(BigInt.asIntN(32,this.context.fileSize-e.ioReader.getPos())))));let a=t.length?0:2;const i=this.context.isVarSize<0?[248,249]:this.context.isVarSize?[249]:[248],r=this.context.cacheBuffer.length-2;for(;a<r;a++)if(255===this.context.cacheBuffer[a]&&x.zy(i,this.context.cacheBuffer[a+1])){a&&(t.push(this.context.cacheBuffer.subarray(0,a)),this.context.cacheBuffer=this.context.cacheBuffer.subarray(a),this.context.cachePos+=BigInt(Math.floor(a)));break}if(a===r){e.ioReader.getPos()===this.context.fileSize?(t.push(this.context.cacheBuffer),this.context.cachePos+=BigInt(Math.floor(this.context.cacheBuffer.length)),this.context.cacheBuffer=null):(t.push(this.context.cacheBuffer.subarray(0,a)),this.context.cachePos+=BigInt(Math.floor(a)),this.context.cacheBuffer=this.context.cacheBuffer.subarray(a));continue}this.context.cacheBuffer.length<16&&(this.context.cacheBuffer=(0,l.A)(Uint8Array,[this.context.cacheBuffer,await e.ioReader.readBuffer(Math.min(g,Number(BigInt.asIntN(32,this.context.fileSize-e.ioReader.getPos()))))])),this.context.bitReader.reset(),this.context.bitReader.appendBuffer(this.context.cacheBuffer.subarray(0,16));const n={};if(!((0,h.x)(this.context.bitReader,n,!0)<0||n.frameOrSampleNum-this.context.frameInfo.frameOrSampleNum!==BigInt(0|this.context.frameInfo.blocksize)&&n.frameOrSampleNum!==this.context.frameInfo.frameOrSampleNum+BigInt(1)))break;t.push(this.context.cacheBuffer.subarray(0,2)),this.context.cachePos+=BigInt(2),this.context.cacheBuffer=this.context.cacheBuffer.subarray(2)}return 1===t.length?t[0]:(0,l.A)(Uint8Array,t)}async readAVPacket(e,t){const a=e.streams.find((e=>e.codecpar.codecType=1));try{let i=e.ioReader.getPos();if(i===this.context.fileSize)return-1048576;if(this.context.bitReader.reset(),this.context.cacheBuffer?(i=this.context.cachePos,this.context.cacheBuffer.length<16&&(this.context.cacheBuffer=(0,l.A)(Uint8Array,[this.context.cacheBuffer,await e.ioReader.readBuffer(Math.min(g,Number(BigInt.asIntN(32,this.context.fileSize-e.ioReader.getPos()))))])),this.context.bitReader.appendBuffer(this.context.cacheBuffer.subarray(0,16))):this.context.bitReader.appendBuffer(await e.ioReader.peekBuffer(16)),(0,h.x)(this.context.bitReader,this.context.frameInfo)<0)return o.LR;const n=await this.getNextFrame(e),s=(0,d.sY)(n.length);return(0,c.lW)(s,n.length,n),(0,f.NX)(t,s,n.length),r.M[17](t+56,i),r.M[15](t+32,a.index),r.M[15](t+76,a.timeBase.den),r.M[15](t+72,a.timeBase.num),r.M[17](t+16,this.context.frameInfo.isVarSize?this.context.frameInfo.frameOrSampleNum:this.context.frameInfo.frameOrSampleNum*BigInt(0|this.context.frameInfo.blocksize)),r.M[17](t+8,this.context.frameInfo.isVarSize?this.context.frameInfo.frameOrSampleNum:this.context.frameInfo.frameOrSampleNum*BigInt(0|this.context.frameInfo.blocksize)),this.context.isVarSize<0&&(this.context.isVarSize=this.context.frameInfo.isVarSize),0}catch(t){return-1048576!==e.ioReader.error?(n.z3(`read packet error, ${t}`,B,413),o.LR):e.ioReader.error}}async syncFrame(e){let t=u.Dh;for(;;)try{const a=await e.ioReader.peekUint16();if((65529===a||65528===a)&&(t=e.ioReader.getPos(),this.context.bitReader.reset(),this.context.bitReader.appendBuffer(await e.ioReader.peekBuffer(16)),!(0,h.x)(this.context.bitReader,{},!0)))break;await e.ioReader.skip(1)}catch(e){break}t!==u.Dh&&await e.ioReader.seek(t)}async seek(e,t,a,i){const r=e.ioReader.getPos(),s=t.privData;if(2&i){const t=await e.ioReader.fileSize();return t<=BigInt(0)?BigInt(o.E$):(a<BigInt(0)?a=BigInt(0):a>t&&(a=t),await e.ioReader.seek(a),4&i||await this.syncFrame(e),r)}if(t&&t.sampleIndexes.length){let i=x.El(t.sampleIndexes,(e=>e.pts>a?-1:1));if(i>0&&(0,R.k)(a-t.sampleIndexes[i-1].pts,t.timeBase,u.i0)<BigInt(5e3))return n.Yz(`seek in sampleIndexes, found index: ${i}, pts: ${t.sampleIndexes[i-1].pts}, pos: ${t.sampleIndexes[i-1].pos}`,B,481),await e.ioReader.seek(t.sampleIndexes[i-1].pos),s.cacheBuffer=null,r}if(s.seekPoints.length){let t=0;for(let e=0;e<s.seekPoints.length;e++){if(s.seekPoints[e].pts===a){t=e;break}if(s.seekPoints[e].pts>a){t=Math.max(e-1,0);break}}const i=s.seekPoints[t];return n.Yz(`seek in seekPoints, found index: ${t}, pts: ${i.pts}, pos: ${i.pos+s.firstFramePos}`,B,501),await e.ioReader.seek(i.pos+s.firstFramePos),s.cacheBuffer=null,r}n.Yz("not found any keyframe index, try to seek in bytes",B,507);const c=await(0,p.A)(e,t,a,s.firstFramePos,this.readAVPacket.bind(this),this.syncFrame.bind(this));return c>0&&(s.cacheBuffer=null),c}getAnalyzeStreamsCount(){return 1}}},85947:(e,t,a)=>{a.d(t,{A:()=>r});var i=a(134);class r{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},42774:(e,t,a)=>{a.d(t,{DK:()=>n,Xr:()=>o,jA:()=>i,oe:()=>r});const i=8,r=[0,8,12,0,16,20,24,32],n=[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]},91375:(e,t,a)=>{a.d(t,{x:()=>c});var i=a(9705),r=a(4624),n=a(42774),o=a(13188);const s="src/avformat/formats/flac/iflac.ts";function c(e,t,a=!1){const c=e.getPointer();if(32764!=(32767&e.readU(15)))return!a&&r.z3("invalid sync code",s,57),i.LR;t.isVarSize=e.readU1();const d=e.readU(4),f=e.readU(4);if(t.chMode=e.readU(4),t.chMode<n.jA)t.channels=t.chMode+1,t.chMode=0;else{if(!(t.chMode<n.jA+3))return!a&&r.z3(`invalid channel mode: ${t.chMode}`,s,76),i.LR;t.channels=2,t.chMode-=n.jA-1}const h=e.readU(3);if(3===h)return!a&&r.z3(`invalid sample size code: ${h}`,s,82),i.LR;if(t.bps=n.oe[h],e.readU1())return!a&&r.z3("broken stream, invalid padding",s,88),i.LR;if(t.frameOrSampleNum=function(e){let t=BigInt(Math.floor(e.readU(8))),a=(t&BigInt(128))>>BigInt(1);if((t&BigInt(192))===BigInt(128)||t>=BigInt(254))return-BigInt(1);for(;t&a;){const i=BigInt(Math.floor(e.readU(8)))-BigInt(128);if(i>>BigInt(6))return-BigInt(1);t=(t<<BigInt(6))+i,a<<=BigInt(5)}return t&=(a<<BigInt(1))-BigInt(1),t}(e),t.frameOrSampleNum<0)return!a&&r.z3("sample/frame number invalid",s,95),i.LR;if(0===d)return!a&&r.z3("reserved blocksize code: 0",s,100),i.LR;if(t.blocksize=6===d?e.readU(8)+1:7===d?e.readU(16)+1:n.Xr[d],f<12)t.sampleRate=n.DK[f];else if(12===f)t.sampleRate=1e3*e.readU(8);else if(13===f)t.sampleRate=e.readU(16);else{if(14!==f)return!a&&r.z3(`illegal sample rate code ${f}`,s,126),i.LR;t.sampleRate=10*e.readU(16)}return(0,o.A)(e.getBuffer().subarray(c,e.getPointer()))!==e.readU(8)?(!a&&r.z3("header crc mismatch",s,133),i.LR):0}},2187:(e,t,a)=>{a.d(t,{d:()=>o});var i=a(72739),r=a(44328),n=a(77231);function o(e,t,a){let o=BigInt(0);return i.__(e,(e=>{o+=e.codecpar.bitrate*(0,r.k)(t,a,n.i0)/BigInt(8e3)})),o}},52071:(e,t,a)=>{a.d(t,{A:()=>l});var i=a(63939),r=a(9599),n=a(29170),o=a(77231),s=a(44328),c=a(2187),d=a(71517),f=a(9705),h=a(4624);const m="src/avformat/function/seekInBytes.ts";async function l(e,t,a,l,u,p){const x=e.ioReader.getPos(),R=await e.ioReader.fileSize();let B=o.Dh,g=a;t.startTime!==o.Dh?g-=t.startTime:g-=t.firstDTS;const I=(0,s.k)(a,t.timeBase,o.i0);if(I<BigInt(1e4))return h.Yz(`seek pts is earlier then 10s, seek to first packet pos(${l}) directly`,m,64),await e.ioReader.seek(l),x;let w=(0,c.d)(e.streams,g,t.timeBase);const k=R-(0,c.d)(e.streams,BigInt(1e4),o.i0),S=(0,c.d)(e.streams,BigInt(1e4),o.i0);if(w>k&&(w=k),w<l)return await e.ioReader.seek(l),x;const b=(0,d._5)();let z=R,U=BigInt(0);for(;;){if(z-U<S){B=U;break}if(await e.ioReader.seek(w),await p(e),8&e.ioReader.flags)break;const t=e.ioReader.getPos();if(!(await u(e,b)>=0)){B=o.Dh;break}{const e=(0,s.k)(i.f[17](b+8),(0,n.A)(b+72,r.P),o.i0),a=e-I;if(h.Yz(`try to seek to pos: ${w}, got packet pts: ${i.f[17](b+8)}(${e}ms), diff: ${a}ms`,m,102),a<=BigInt(0)&&-a<BigInt(1e4)){B=t;break}a>BigInt(0)?(z=w,w=U+z>>BigInt(1)):(U=w,w=U+z>>BigInt(1))}if(8&e.ioReader.flags)break}return(0,d.Qe)(b),B!==o.Dh?(h.Yz(`finally seek to pos ${B}`,m,133),await e.ioReader.seek(B),await p(e),x):(await e.ioReader.seek(x),8&e.ioReader.flags?BigInt(f.LT):BigInt(f.E$))}},13188:(e,t,a)=>{function i(e,t=0){for(let a=0;a<e.length;a++){t^=e[a];for(let e=0;e<8;e++)128&t?t=t<<1^7:t<<=1}return 255&t}a.d(t,{A:()=>i})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[487],{85947:(t,e,s)=>{s.d(e,{A:()=>h});var i=s(134);class h{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(t){}}},85487:(t,e,s)=>{s.r(e),s.d(e,{default:()=>v});var i=s(134),h=s(63939),r=s(50932),a=s(9705),n=s(85947),o=s(14686),u=s(37837),d=s(71517),c=s(95335),p=s(92647),l=s(67659),f=s(77231),g=s(37246),b=s(23991),A=s(37805);const y={framerate:{num:30,den:1}};class v extends n.A{constructor(t={}){super(),(0,i.A)(this,"type",12),(0,i.A)(this,"options",void 0),(0,i.A)(this,"currentDts",void 0),(0,i.A)(this,"currentPts",void 0),(0,i.A)(this,"step",void 0),(0,i.A)(this,"slices",void 0),(0,i.A)(this,"naluPos",void 0),(0,i.A)(this,"queue",void 0),(0,i.A)(this,"bitReader",void 0),(0,i.A)(this,"sliceType",void 0),(0,i.A)(this,"poc",void 0),(0,i.A)(this,"pocTid0",void 0),(0,i.A)(this,"sps",void 0),(0,i.A)(this,"pps",void 0),(0,i.A)(this,"naluReader",void 0),this.options=c.X$({},y,t)}init(t){t.ioReader&&t.ioReader.setEndian(!1),this.slices=[],this.queue=[],this.bitReader=new g.A(50),this.naluReader=new A.A}async destroy(t){if(this.queue.length){for(let t=0;t<this.queue.length;t++)(0,d.Qe)(this.queue[t].avpacket);this.queue.length=0}}isFrameNalu(t){return(t[1===t[2]?3:4]>>>1&63)<32}async readNaluFrame(t){let e=!1;const s=this.slices;for(this.slices=[],s.length&&(e=this.isFrameNalu(s[0]));;){const i=await this.naluReader.read(t.ioReader);if(!i)return s;const h=i[1===i[2]?3:4]>>>1&63;if(this.isFrameNalu(i))if(e){if(i[1===i[2]?5:6]>>>7)return this.slices.push(i),s;s.push(i)}else s.push(i),e=!0;else{if(e&&(35===h||33===h||34===h||32===h))return this.slices.push(i),s;s.push(i)}}}async readHeader(t){const e=t.createStream();for(e.codecpar.codecType=0,e.codecpar.codecId=173,e.timeBase.den=f.SF,e.timeBase.num=1,e.codecpar.bitFormat=2,this.currentDts=BigInt(0),this.currentPts=BigInt(0),this.naluPos=BigInt(0),this.poc=0,this.pocTid0=0,this.step=BigInt(Math.floor(f.SF/this.options.framerate.num*this.options.framerate.den));;){const s=await this.readNaluFrame(t);if(!s.length)return-1048576;const i=(0,p.A)(Uint8Array,s),a=l.S1(i);if(a){e.codecpar.extradata=(0,u.sY)(a.length),(0,o.lW)(e.codecpar.extradata,a.length,a),e.codecpar.extradataSize=a.length,l.XC(e,a);const{spss:s,ppss:n}=l.HL(a);this.sps=l.wf(s[0]),this.pps=l.ZU(n[0]);const c=(0,d._5)(),p=(0,u.sY)(i.length);(0,o.lW)(p,i.length,i),(0,d.NX)(c,p,i.length),r.M[17](c+56,this.naluPos),this.naluPos+=BigInt(Math.floor(i.length)),r.M[17](c+16,this.currentDts),this.currentDts+=this.step,r.M[17](c+8,this.currentPts),this.currentPts+=this.step,r.M[15](c+32,e.index),r.M[15](c+36,1|h.f[15](c+36)),r.M[15](c+72,e.timeBase.num),r.M[15](c+76,e.timeBase.den),r.M[15](c+80,2),t.interval.packetBuffer.push(c);break}this.naluPos+=BigInt(Math.floor(i.length))}return 0}async readAVPacket_(t,e){const s=t.getStreamByMediaType(0),i=await this.readNaluFrame(t);if(!i.length)return-1048576;this.sliceType=-1;let a=!1,n=!0;i.forEach((t=>{const e=(1===t[2]?t[3]:t[4])>>>1&63,s=7&(1===t[2]?t[4]:t[5]);if(33===e&&(this.sps=l.wf(t)),34===e&&(this.pps=l.ZU(t)),19!==e&&20!==e||(a=!0),e<32&&n){n=!1,this.bitReader.reset(),this.bitReader.appendBuffer(t.subarray(1===t[2]?5:6,50));const i=this.bitReader.readU1();if(e>=16&&e<=23&&(a=!0,this.bitReader.readU1()),b.xb(this.bitReader),!i){this.pps.dependent_slice_segment_flag&&this.bitReader.readU1();const t=Math.ceil(Math.log2(this.sps.ctb_width*this.sps.ctb_height));this.bitReader.readU(t)}for(let t=0;t<this.pps.num_extra_slice_header_bits;t++)this.bitReader.readU1();if(this.sliceType=b.xb(this.bitReader),this.pps.output_flag_present_flag&&this.bitReader.readU1(),this.sps.separate_colour_plane_flag&&this.bitReader.readU(2),19===e||20===e)this.poc=0;else{const t=this.bitReader.readU(this.sps.log2_max_poc_lsb);let s=1<<this.sps.log2_max_poc_lsb,i=this.pocTid0%s,h=this.pocTid0-i,r=0;r=t<i&&i-t>=s/2?h+s:t>i&&t-i>s/2?h-s:h,16!=e&&17!=e&&18!=e||(r=0),this.poc=r+t}0==s&&0!=e&&2!=e&&4!=e&&6!=e&&8!=e&&7!=e&&9!=e&&(this.pocTid0=this.poc)}}));const c=(0,p.A)(Uint8Array,i),f=(0,u.sY)(c.length);return(0,o.lW)(f,c.length,c),(0,d.NX)(e,f,c.length),r.M[17](e+56,this.naluPos),this.naluPos+=BigInt(Math.floor(c.length)),r.M[17](e+16,this.currentDts),this.currentDts+=this.step,r.M[15](e+32,s.index),r.M[15](e+72,s.timeBase.num),r.M[15](e+76,s.timeBase.den),r.M[15](e+80,2),a&&r.M[15](e+36,1|h.f[15](e+36)),0}async readAVPacket(t,e){let s=this.queue.length;const i=()=>{this.queue.length>1&&this.queue.sort(((t,e)=>t.poc-e.poc>0?1:-1));for(let t=0;t<this.queue.length;t++)r.M[17](this.queue[t].avpacket+8,this.currentPts),this.currentPts+=this.step;this.queue.length>1&&this.queue.sort(((t,e)=>h.f[17](t.avpacket+16)-h.f[17](e.avpacket+16)>BigInt(0)?1:-1)),this.queue.length&&((0,d.rN)(e,this.queue[0].avpacket),(0,d.Qe)(this.queue[0].avpacket));for(let e=1;e<this.queue.length;e++)t.interval.packetBuffer.push(this.queue[e].avpacket);this.queue.length=0};for(;;){const e=(0,d._5)();let r=await this.readAVPacket_(t,e);if(r<0)return(0,d.Qe)(e),this.queue.length?(i(),0):r;if(1&h.f[15](e+36)||1===this.sliceType||2===this.sliceType){if(1===s||1&h.f[15](e+36)&&this.queue.length)return i(),this.queue.push({avpacket:e,poc:this.poc}),0;this.queue.push({avpacket:e,poc:this.poc}),s++}else this.queue.push({avpacket:e,poc:this.poc})}}async seek(t,e,s,i){return BigInt(a.E$)}getAnalyzeStreamsCount(){return 1}}},37805:(t,e,s)=>{s.d(e,{A:()=>a});var i=s(134),h=s(60264),r=s(92647);class a{constructor(){(0,i.A)(this,"buffer",void 0),(0,i.A)(this,"pos",void 0),(0,i.A)(this,"end",void 0),(0,i.A)(this,"ended",void 0),this.buffer=new Uint8Array(102400),this.pos=0,this.end=0,this.ended=!1}async read(t){if(this.ended&&this.pos>=this.end)return;const e=[];if(this.pos<this.end-4){let t=h.Ky(this.buffer.subarray(this.pos,this.end-4),3);if(t.offset>-1){const e=this.buffer.slice(this.pos,this.pos+t.offset);return this.pos+=t.offset,e}e.push(this.buffer.slice(this.pos,this.end-4)),this.buffer.copyWithin(0,this.end-4,this.end),this.pos=0,this.end=4}for(;;){if(!this.ended&&this.end<this.buffer.length)try{const e=await t.readToBuffer(this.buffer.length-this.end,this.buffer.subarray(this.end));this.end+=e}catch(t){if(this.ended=!0,this.pos>=this.end)return e.length?(0,r.A)(Uint8Array,e):null}let s=h.Ky(this.buffer.subarray(this.pos,this.end-4),e.length?0:3);if(s.offset>-1)return e.push(this.buffer.slice(this.pos,this.pos+s.offset)),this.pos+=s.offset,(0,r.A)(Uint8Array,e);if(this.ended)return e.push(this.buffer.slice(this.pos,this.end)),this.pos=this.end=0,(0,r.A)(Uint8Array,e);e.push(this.buffer.slice(this.pos,this.end-4)),this.buffer.copyWithin(0,this.end-4,this.end),this.pos=0,this.end=4}}reset(){this.pos=0,this.end=0,this.ended=!1}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[522],{64436:(e,t,a)=>{a.d(t,{A:()=>o});var s=a(134),r=a(63939),n=(a(77162),a(37837)),i=a(71766);class o{constructor(){(0,s.A)(this,"inCodecpar",void 0),(0,s.A)(this,"inTimeBase",void 0),(0,s.A)(this,"outCodecpar",void 0)}init(e,t){return this.inCodecpar=(0,n.Gy)(168),(0,i.Yi)(this.inCodecpar,e),this.inTimeBase={den:r.f[15](t+4),num:r.f[15](t)},0}destroy(){this.inCodecpar&&((0,i.dn)(this.inCodecpar),this.inCodecpar=0)}}},51113:(e,t,a)=>{a.d(t,{A:()=>y});var s=a(134),r=a(63939),n=a(50932),i=a(64436),o=a(14686),c=a(4624),d=a(9705),l=a(77231),u=a(44328),p=a(37837),h=a(71517),f=a(87518),m=a(92647),g=a(67672);class y extends i.A{constructor(...e){super(...e),(0,s.A)(this,"caches",void 0),(0,s.A)(this,"cache",void 0),(0,s.A)(this,"lastDts",void 0)}init(e,t){return super.init(e,t),this.caches=[],0}sendAVPacket(e){let t=0,a=this.lastDts||r.f[17](e+16)||r.f[17](e+8),s=(0,o.s3)(r.f[20](e+24),r.f[15](e+28)).slice(),n=!1,i=!!this.cache;for(i&&(s=(0,m.A)(Uint8Array,[this.cache,s]),this.cache=null);t<s.length;){if(t>s.length-10)return this.cache=s.subarray(t),this.lastDts=a,0;const o=f.R(s.subarray(t));if(g.ai(o))return c.z3("parse ac3 header failed","src/avformat/bsf/ac3/Ac32RawFilter.ts",84),d.LR;const p={dts:a,buffer:null,duration:l.N_};let h=o.frameSize;if(p.buffer=s.subarray(t,t+h),t+h>s.length)return this.cache=s.subarray(t),this.lastDts=a,0;const m=(0,u.k)(BigInt(1536/o.sampleRate*l.SF),l.KR,this.inTimeBase);p.duration=Number(m),this.caches.push(p),t+=h,a+=m,!n&&i&&(n=!0,a=r.f[17](e+16)||r.f[17](e+8))}return this.lastDts=BigInt(0),0}receiveAVPacket(e){if(this.caches.length){(0,h.Up)(e);const t=this.caches.shift(),a=(0,p.sY)(t.buffer.length);return(0,o.lW)(a,t.buffer.length,t.buffer),(0,h.NX)(e,a,t.buffer.length),n.M[17](e+16,t.dts),n.M[17](e+8,t.dts),n.M[17](e+48,BigInt(Math.floor(t.duration))),n.M[15](e+36,1|r.f[15](e+36)),0}return d.LT}reset(){return this.cache=null,this.lastDts=BigInt(0),0}}},56397:(e,t,a)=>{a.d(t,{A:()=>y});var s=a(134),r=a(63939),n=a(50932),i=a(64436),o=a(14686),c=a(4624),d=a(9705),l=a(77231),u=a(44328),p=a(37837),h=a(71517),f=a(75294),m=a(64093),g=a(92647);class y extends i.A{constructor(...e){super(...e),(0,s.A)(this,"frameHeader",void 0),(0,s.A)(this,"caches",void 0),(0,s.A)(this,"cache",void 0),(0,s.A)(this,"lastDts",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.frameHeader=new f.Vz,0}sendAVPacket(e){let t=0,a=this.lastDts||r.f[17](e+16)||r.f[17](e+8),s=(0,o.s3)(r.f[20](e+24),r.f[15](e+28)).slice(),n=!1,i=!!this.cache;for(i&&(s=(0,g.A)(Uint8Array,[this.cache,s]),this.cache=null);t<s.length;){const o=s[t]<<4|s[t+1]>>4&14;if(4094!==o)return c.z3(`found syncWord not 0xFFE, got: 0x${o.toString(16)}`,"src/avformat/bsf/mp3/Mp32RawFilter.ts",82),d.LR;const p=s[1]>>>3&3,h=(12&s[2])>>>2,g={dts:a,buffer:null,extradata:null,duration:l.N_},y=m.Y2(p,h);f.qg(this.frameHeader,s[t]<<24|s[t+1]<<16|s[t+2]<<8|s[t+3]);let v=f.CM(this.frameHeader,y);if(g.buffer=s.subarray(t,t+v),t+v>s.length){this.cache=s.subarray(t),this.lastDts=a;break}const A=(0,u.k)(BigInt(Math.floor(v/y*l.SF)),l.KR,this.inTimeBase);g.duration=Number(A),this.caches.push(g),t+=v,a+=A,!n&&i&&(n=!0,a=r.f[17](e+16)||r.f[17](e+8))}return this.lastDts=BigInt(0),0}receiveAVPacket(e){if(this.caches.length){(0,h.Up)(e);const t=this.caches.shift(),a=(0,p.sY)(t.buffer.length);return(0,o.lW)(a,t.buffer.length,t.buffer),(0,h.NX)(e,a,t.buffer.length),n.M[17](e+16,t.dts),n.M[17](e+8,t.dts),n.M[17](e+48,BigInt(Math.floor(t.duration))),n.M[15](e+36,1|r.f[15](e+36)),0}return d.LT}reset(){return this.cache=null,this.lastDts=BigInt(0),0}}},85947:(e,t,a)=>{a.d(t,{A:()=>r});var s=a(134);class r{constructor(){(0,s.A)(this,"type",-1),(0,s.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},50522:(e,t,a)=>{a.r(t),a.d(t,{default:()=>R});var s=a(134),r=a(73146),n=a.n(r),i=a(14686),o=a(61499),c=a(63939),d=a(50932),l=(a(9599),a(47958),a(4624)),u=a(9705),p=a(85947),h=a(37837),f=a(71517),m=a(89222),g=a(47860),y=a(41654),v=a(72739),A=a(64093),x=a(15012),k=a(48416),b=a(38183),S=a(60264),I=a(44328),w=a(77231),T=a(90764),P=a(79940),M=a(52575),q=a(39342),B=a(56397),U=a(30725),C=a(51113);const z="src/avformat/formats/IRtspFormat.ts";class R extends p.A{constructor(e){super(),(0,s.A)(this,"type",6),(0,s.A)(this,"rtspSession",void 0),(0,s.A)(this,"options",void 0),(0,s.A)(this,"context",void 0),(0,s.A)(this,"cacheAVPacket",void 0),this.options=e}init(e){e.ioReader&&e.ioReader.setEndian(!0),this.rtspSession=new m.A(this.options.uri,e.ioReader,e.ioWriter),this.context={sessionId:"",canOutputPacket:!0},this.cacheAVPacket=0}async readHeader(e){try{let t=await this.rtspSession.options();if(200!==t.statusCode)return u.LR;if(t=await this.rtspSession.describe(),200!==t.statusCode)return l.z3(`describe failed, ${n()(t)}`,z,139),u.LR;const a=g.q(t.content);let s=1,r=0;for(let i=0;i<a.media.length;i++){if(!a.media[i].rtp.length)continue;const c=e.createStream(),d=x.fm.find((e=>e.payload===a.media[i].rtp[0].payload));if(d)c.codecpar.codecType=d.codecType,c.codecpar.codecId=d.codecId,1===d.codecType?(c.codecpar.sampleRate=a.media[i].rtp[0].rate||d.rate,c.codecpar.chLayout.nbChannels=a.media[i].rtp[0].encoding||d.encoding,c.timeBase.num=1,c.timeBase.den=c.codecpar.sampleRate):(c.timeBase.num=1,c.timeBase.den=a.media[i].rtp[0].rate||d.rate);else{"audio"===a.media[i].type?c.codecpar.codecType=1:"video"===a.media[i].type&&(c.codecpar.codecType=0);const e=a.media[i].rtp[0].codec;let t=x.xl[e]||0;c.codecpar.codecId=t,1===c.codecpar.codecType?(c.codecpar.sampleRate=a.media[i].rtp[0].rate,c.codecpar.chLayout.nbChannels=a.media[i].rtp[0].encoding,c.timeBase.num=1,c.timeBase.den=c.codecpar.sampleRate):0===c.codecpar.codecType&&(c.timeBase.num=1,c.timeBase.den=a.media[i].rtp[0].rate)}const p={ssrc:0,trackId:s++,interleaved:r,payloadContext:null,queue:null,currentDTS:BigInt(0),gopCount:0,maxPts:BigInt(0),minPts:BigInt(0),payloadType:a.media[i].rtp[0].payload,dtsDelta:(0,I.k)(BigInt(33),w.i0,c.timeBase),rangeStartOffset:BigInt(0),lastRtcpNtpTime:w.Dh,firstRtcpNtpTime:w.Dh,lastRtcpTimestamp:0,rtcpTsOffset:BigInt(0),baseTimestamp:0,timestamp:0,unwrappedTimestamp:BigInt(0),filter:null};if(a.media[i].control){let e=a.media[i].control.split(";").find((e=>e.indexOf("trackID")>-1));if(e){let t=e.split("=");p.trackId=+t[1].trim()}}if(a.media[i].fmtp.length&&U.zQ[c.codecpar.codecId]&&(p.payloadContext=U.zQ[c.codecpar.codecId](c,a.media[i].fmtp[0].config)),p.queue=new k.A(c.codecpar[o.o9],p.payloadContext),r+=2,c.privData=p,t=await this.rtspSession.setup({trackId:p.trackId,streamMode:2,interleaved:p.interleaved,multcast:!1},this.context.sessionId),200!==t.statusCode)return l.z3(`setup track ${p.trackId} failed, ${n()(t)}`,z,250),u.LR;const h=t.headers.Transport.split(";").find((e=>e.indexOf("ssrc")>-1));h&&(p.ssrc=+("0x"+h.split("=")[1].trim())),this.context.sessionId=t.headers.Session,0===c.codecpar.codecType&&(this.context.canOutputPacket=!1),86017===c.codecpar.codecId?p.filter=new B.A:86019===c.codecpar.codecId&&(p.filter=new C.A),p.filter&&p.filter.init(c.codecpar[o.o9],c.timeBase[o.o9])}return e.streams.length?(t=await this.rtspSession.play(this.context.sessionId),200!==t.statusCode?(l.z3(`play failed, ${n()(t)}`,z,283),u.LR):0):(l.z3("not found stream",z,276),u.LR)}catch(t){return l.z3(t.message,z,290),e.ioReader.error}}addPrft(e,t,a){const s=e.privData;if(s.lastRtcpNtpTime!==w.Dh){const r=(0,h.sY)(16),n=y.q(s.lastRtcpNtpTime)-w.WT,i=BigInt(a)-s.lastRtcpNtpTime,o=(0,I.k)(i,e.timeBase,w.KR);d.M[17](r,n+o),d.M[15](r+8,24),(0,f.Ow)(t,27,r,16)}}getPacketPts(e,t,a){if(-1===a)return-BigInt(1);const s=t.privData;if(s.lastRtcpNtpTime!==w.Dh&&e.streams.length>1){const e=BigInt(a-s.lastRtcpTimestamp|0),r=(s.lastRtcpNtpTime-s.firstRtcpNtpTime)*BigInt(0|t.timeBase.den)/(BigInt(0|t.timeBase.num)<<BigInt(32));return s.rangeStartOffset+s.rtcpTsOffset+r+e}return s.baseTimestamp||(s.baseTimestamp=a),s.timestamp?s.unwrappedTimestamp+=BigInt(a-s.timestamp|0):s.unwrappedTimestamp+=BigInt(a),s.timestamp=a,s.unwrappedTimestamp+s.rangeStartOffset-BigInt(s.baseTimestamp)}handleRtcpPacket(e,t,a=-1){if(200===t[1]){const s=(0,q.N)(t);let r=e.streams.find((e=>{const t=e.privData;return t.ssrc===s.ssrc||t.interleaved===a}));if(r){const t=r.privData;t.lastRtcpNtpTime=s.ntp,t.lastRtcpTimestamp=s.timestamp,t.firstRtcpNtpTime===w.Dh&&(t.firstRtcpNtpTime=s.ntp,t.baseTimestamp||(t.baseTimestamp=s.timestamp),t.rtcpTsOffset=BigInt(t.lastRtcpTimestamp-t.baseTimestamp|0),t.timestamp&&(t.currentDTS=this.getPacketPts(e,r,t.timestamp)))}}}async readAVPacket(e,t){try{for(;;){const{data:a,interleaved:s}=await this.rtspSession.readPacket();if((0,T.A)(a))this.handleRtcpPacket(e,a,s);else if((0,P.A)(a)){const r=(0,M.A)(a),n=e.streams.find((e=>{const t=e.privData;return t.ssrc===r.header.ssrc||t.interleaved===s||t.payloadType===r.header.payloadType}));if(n){const a=n.privData;a.queue.push(r),a.ssrc||(a.ssrc=r.header.ssrc);let s=!1;const p=(a,r,l)=>{let u=s?(0,f._5)():t;d.M[15](u+32,n.index),(0,i.Mr)(u+72,n.timeBase[o.o9],8);const p=(0,h.sY)(a.length);return(0,i.lW)(p,a.length,a),(0,f.NX)(u,p,a.length),d.M[17](u+16,l),d.M[17](u+8,l),r&&(d.M[15](u+36,1|c.f[15](u+36)),this.context.canOutputPacket=!0),s?(e.interval.packetBuffer.push(u),u=0):s=!0,u},m=(a,r,l=BigInt(0))=>{if(!a.length)return;let u=s?(0,f._5)():t;d.M[15](u+32,n.index),(0,i.Mr)(u+72,n.timeBase[o.o9],8);const p=(0,h.sY)(a[0].length);(0,i.lW)(p,a[0].length,a[0]),(0,f.NX)(u,p,a[0].length),d.M[17](u+16,r),d.M[17](u+8,r),d.M[15](u+36,1|c.f[15](u+36)),s?(e.interval.packetBuffer.push(u),u=0):s=!0;for(let t=1;t<a.length;t++){const s=(0,f._5)();d.M[15](s+32,n.index),(0,i.Mr)(s+72,n.timeBase[o.o9],8),d.M[17](s+16,r+BigInt(t)*l),d.M[17](s+8,r+BigInt(t)*l),d.M[15](s+36,1|c.f[15](s+36));const u=(0,h.sY)(a[t].length);(0,i.lW)(u,a[t].length,a[t]),(0,f.NX)(s,u,a[t].length),e.interval.packetBuffer.push(s)}},g=(r,p)=>{let m=s?(0,f._5)():t;d.M[15](m+32,n.index),(0,i.Mr)(m+72,n.timeBase[o.o9],8);const g=(0,h.sY)(r.length);(0,i.lW)(g,r.length,r),(0,f.NX)(m,g,r.length),d.M[17](m+16,p),d.M[17](m+8,p);let y=a.filter.sendAVPacket(m);if(y<0)return l.h2("send avpacket to bsf failed",z,472),u.LR;if(y=a.filter.receiveAVPacket(m),y!==u.LT)for((0,i.Mr)(m+72,n.timeBase[o.o9],8),d.M[15](m+32,n.index),d.M[15](m+36,1|c.f[15](m+36)),s?(e.interval.packetBuffer.push(m),m=0):s=!0;;){const t=this.cacheAVPacket||(0,f._5)();if(y=a.filter.receiveAVPacket(t),0!==y){this.cacheAVPacket=t;break}(0,i.Mr)(t+72,n.timeBase[o.o9],8),d.M[15](t+32,n.index),e.interval.packetBuffer.push(t),this.cacheAVPacket=0}};for(;a.queue.hasFrame();){const t=a.queue.getFrame();if(!t.length)continue;const s=this.getPacketPts(e,n,t[0].header.timestamp);if(0===n.codecpar.codecType||this.context.canOutputPacket)if(27===n.codecpar.codecId||173===n.codecpar.codecId){const{nalus:e,isKey:r}=27===n.codecpar.codecId?b.Hj(t):b.pA(t,a.payloadContext);if(!e.length)continue;if(!r&&!this.context.canOutputPacket){a.currentDTS=s;continue}const i=p(S.nW(e),r,s);d.M[15](i+80,n.codecpar.bitFormat),d.M[17](i+16,a.currentDTS),a.currentDTS+=a.dtsDelta,r?(a.gopCount>1&&(a.dtsDelta=(a.maxPts-a.minPts)/BigInt(a.gopCount-1|0)),a.gopCount=1,a.minPts=s,a.maxPts=s):(a.gopCount++,a.gopCount>5&&a.gopCount<200&&(a.dtsDelta=(a.maxPts-a.minPts)/BigInt(a.gopCount-1|0))),s>a.maxPts&&(a.maxPts=s)}else if(86018===n.codecpar.codecId)m(b.kx(t,n.privData.payloadContext),s,BigInt(1024));else if(12===n.codecpar.codecId){const e=b.xW(t),r=e[4]>>>6==0;if(!r&&!this.context.canOutputPacket){a.currentDTS=s;continue}p(e,r,s)}else if(65543===n.codecpar.codecId||65542===n.codecpar.codecId||69660===n.codecpar.codecId||65537===n.codecpar.codecId||86076===n.codecpar.codecId||86051===n.codecpar.codecId)m([b.xW(t)],s);else if(86017===n.codecpar.codecId){const e=b.Jz(t,n.codecpar.codecType);if(n.codecpar.profile===w.N_){const t=(6&e[1])>>1;n.codecpar.profile=A.Au(t)}g(e,s)}else if(86019===n.codecpar.codecId)g(b.we(t),s);else if(2===n.codecpar.codecId){const e=b.Jz(t,n.codecpar.codecType),r=1==(e[5]>>3&7);if(!r&&!this.context.canOutputPacket){a.currentDTS=s;continue}p(e,r,s)}else if(139===n.codecpar.codecId){const{payload:e,isKey:r}=b.hw(t);if(!r&&!this.context.canOutputPacket){a.currentDTS=s;continue}p(e,r,s)}else if(167===n.codecpar.codecId){const{payload:e,isKey:r}=b.o_(t);if(!r&&!this.context.canOutputPacket){a.currentDTS=s;continue}p(e,r,s)}else if(225===n.codecpar.codecId){const{payload:e,isKey:r}=b.l6(t);if(!r&&!this.context.canOutputPacket){a.currentDTS=s;continue}p(e,r,s)}}if(s)return 0}}else l.R8("received invalid data",z,640)}}catch(t){return-1048576!==e.ioReader.error?(l.z3(`read packet error, ${t}`,z,646),u.LR):e.ioReader.error}}async seek(e,t,a,s){return BigInt(u.E$)}getAnalyzeStreamsCount(){return 0}async destroy(e){await this.rtspSession.teardown(this.context.sessionId),this.cacheAVPacket&&((0,f.Qe)(this.cacheAVPacket),this.cacheAVPacket=0),v.__(e.streams,(e=>{const t=e.privData;t.filter&&(t.filter.destroy(),t.filter=null)}))}}},75294:(e,t,a)=>{a.d(t,{CM:()=>o,Vz:()=>n,qg:()=>i});var s=a(134),r=a(64093);class n{constructor(){(0,s.A)(this,"version",void 0),(0,s.A)(this,"layer",void 0),(0,s.A)(this,"protection",void 0),(0,s.A)(this,"bitrateIndex",void 0),(0,s.A)(this,"samplingFrequency",void 0),(0,s.A)(this,"padding",void 0),(0,s.A)(this,"private",void 0),(0,s.A)(this,"mode",void 0),(0,s.A)(this,"modeExtension",void 0),(0,s.A)(this,"copyright",void 0),(0,s.A)(this,"original",void 0),(0,s.A)(this,"emphasis",void 0)}}function i(e,t){e.version=t>>19&3,e.layer=t>>17&3,e.protection=t>>16&1,e.bitrateIndex=t>>12&15,e.samplingFrequency=t>>10&3,e.padding=t>>9&1,e.mode=t>>6&3,e.modeExtension=t>>4&3,e.copyright=t>>3&1,e.original=t>>2&1,e.emphasis=3&t}function o(e,t){let a=r.oz(e.version,e.layer,e.bitrateIndex);switch(e.layer){case 1:default:a=144e3*a/(t<<(3===e.version?0:1))>>>0,a+=e.padding;break;case 2:a=144e3*a/t>>>0,a+=e.padding;break;case 3:a=12e3*a/t>>>0,a=4*(a+e.padding)}return a}},91712:(e,t,a)=>{a.d(t,{K:()=>i,pl:()=>n});var s=a(134);class r{constructor(){(0,s.A)(this,"version",void 0),(0,s.A)(this,"padding",void 0),(0,s.A)(this,"count",void 0),(0,s.A)(this,"payloadType",void 0),(0,s.A)(this,"length",void 0)}}class n{constructor(){(0,s.A)(this,"ssrc",void 0),(0,s.A)(this,"fractionLost",void 0),(0,s.A)(this,"packetLost",void 0),(0,s.A)(this,"highestSequence",void 0),(0,s.A)(this,"interArrivalJitter",void 0),(0,s.A)(this,"lsr",void 0),(0,s.A)(this,"dlsr",void 0)}}class i extends r{constructor(...e){super(...e),(0,s.A)(this,"ssrc",void 0),(0,s.A)(this,"ntp",void 0),(0,s.A)(this,"timestamp",void 0),(0,s.A)(this,"senderPacketCount",void 0),(0,s.A)(this,"senderOctetCount",void 0),(0,s.A)(this,"reports",[])}}},90764:(e,t,a)=>{function s(e){return e.length>4&&e[0]>127&&e[0]<192&&e[0]>>>6==2&&e[1]>=192&&e[1]<=223}a.d(t,{A:()=>s})},39342:(e,t,a)=>{a.d(t,{N:()=>n});var s=a(31865),r=a(91712);function n(e){const t=new s.A(e),a=new r.K;!function(e,t){let a=t.readUint8();e.version=a>>>6,e.padding=a>>>5&1,e.count=31&a,e.payloadType=t.readUint8(),e.length=t.readUint16()}(a,t),a.ssrc=t.readUint32(),a.ntp=t.readUint64(),a.timestamp=t.readUint32(),a.senderPacketCount=t.readUint32(),a.senderOctetCount=t.readUint32();for(let e=0;e<a.count;e++){const e=new r.pl;e.ssrc=t.readUint32(),e.fractionLost=t.readUint8(),e.packetLost=t.readUint24(),e.highestSequence=t.readUint32(),e.interArrivalJitter=t.readUint32(),e.lsr=t.readUint32(),e.dlsr=t.readUint32()}return a}},48416:(e,t,a)=>{a.d(t,{A:()=>c});var s=a(134),r=a(63939),n=a(77231),i=a(15012);const o=n.zg>>>1;class c{constructor(e,t){(0,s.A)(this,"queue",void 0),(0,s.A)(this,"frameQueue",void 0),(0,s.A)(this,"codecpar",void 0),(0,s.A)(this,"currentSeqStart",void 0),(0,s.A)(this,"readyPos",void 0),(0,s.A)(this,"maskerQueue",void 0),(0,s.A)(this,"payloadContext",void 0),this.codecpar=e,this.queue=[],this.frameQueue=[],this.currentSeqStart=-1,this.readyPos=0,this.maskerQueue=[],this.payloadContext=t}isSeqIncreaseOne(e,t){return e+1===t||e===n.zg&&0===t}seqAMoreThenB(e,t){return e>t&&e-t<o||e<t&&t-e>o}isFirstStart(){if(this.currentSeqStart>-1)return this.isSeqIncreaseOne(this.currentSeqStart,this.queue[0].header.sequence);if(this.queue.length>5){if(1===r.f[15](this.codecpar))return!0;if(27===r.f[15](this.codecpar+4))switch(31&this.queue[0].payload[0]){case 24:for(let e=1;e<this.queue[0].payload.length-2;){const t=this.queue[0].payload[e]<<8|this.queue[0].payload[e+1],a=31&this.queue[0].payload[e+2];if(7===a||8===a||5===a||9===a)return!0;e+=2+t}break;case 28:if(128&this.queue[0].payload[1])return!0;break;case 7:case 9:return!0}else if(173===r.f[15](this.codecpar+4))switch(this.queue[0].payload[0]>>>1&63){case 48:let e=i.Dm+(this.payloadContext.usingDonlField?i.hE:0);for(;e<this.queue[0].payload.length-i.Dm;){const t=this.queue[0].payload[e]<<8|this.queue[0].payload[e+1],a=this.queue[0].payload[e+2]>>>1&63;if(34===a||32===a||33===a||20===a||19===a||35===a)return!0;e+=2+t,this.payloadContext.usingDonlField&&(e+=i.hQ)}break;case 49:if(128&this.queue[0].payload[2])return!0;break;case 32:case 35:return!0}else if(139===r.f[15](this.codecpar+4)){if(16&this.queue[0].payload[0])return!0}else if(167===r.f[15](this.codecpar+4)){if(8&this.queue[0].payload[0])return!0}else if(225===r.f[15](this.codecpar+4)){if(1&this.queue[0].payload[0])return!0}else if(2===r.f[15](this.codecpar+4)&&1==(this.queue[0].payload[2]>>>5&1))return!0;return this.readyPos>200}return!1}check(){for(;this.readyPos<this.queue.length-1&&this.isSeqIncreaseOne(this.queue[this.readyPos].header.sequence,this.queue[this.readyPos+1].header.sequence);)this.readyPos++,(this.queue[this.readyPos].header.masker||65543===r.f[15](this.codecpar+4)||65542===r.f[15](this.codecpar+4)||86017===r.f[15](this.codecpar+4)||69660===r.f[15](this.codecpar+4)||65537===r.f[15](this.codecpar+4))&&this.maskerQueue.push(this.readyPos)}push(e){if(this.currentSeqStart>-1&&this.seqAMoreThenB(this.currentSeqStart,e.header.sequence))return;if(!this.queue.length)return this.queue.push(e),void(e.header.masker&&this.maskerQueue.push(0));let t=!1;if(this.seqAMoreThenB(this.queue[0].header.sequence,e.header.sequence))this.queue.unshift(e),this.readyPos=0,this.maskerQueue.length=0,t=!0,this.check();else for(let a=this.readyPos;a<this.queue.length;a++)if(this.seqAMoreThenB(this.queue[a].header.sequence,e.header.sequence)){this.queue.splice(a,0,e),t=!0,a===this.readyPos+1&&this.check();break}t||(this.queue.push(e),this.readyPos+2===this.queue.length&&this.check());let a=0;for(;this.isFirstStart()&&this.maskerQueue.length;){const e=this.maskerQueue.shift()+1,t=this.queue.slice(a,e);this.frameQueue.push(t),a=e,this.currentSeqStart=t[t.length-1].header.sequence}if(a){this.queue=this.queue.slice(a),this.readyPos=Math.max(0,this.readyPos-a);for(let e=0;e<this.maskerQueue.length;e++)this.maskerQueue[e]-=a}}hasFrame(){return this.frameQueue.length}getFrame(){return this.frameQueue.shift()}}},67088:(e,t,a)=>{a.d(t,{El:()=>i,N8:()=>c,tW:()=>o});var s=a(134),r=a(80662),n=a.n(r);class i{constructor(){(0,s.A)(this,"version",void 0),(0,s.A)(this,"padding",void 0),(0,s.A)(this,"extension",void 0),(0,s.A)(this,"csrc",void 0),(0,s.A)(this,"masker",void 0),(0,s.A)(this,"payloadType",void 0),(0,s.A)(this,"sequence",void 0),(0,s.A)(this,"timestamp",void 0),(0,s.A)(this,"ssrc",void 0),(0,s.A)(this,"csrcList",[])}}class o{constructor(){(0,s.A)(this,"id",void 0),(0,s.A)(this,"length",void 0),(0,s.A)(this,"extension",void 0),(0,s.A)(this,"headers",new(n()))}hasOneByteExtensions(){return 48862===this.id}hasTwoBytesExtensions(){return 4096==(65520&this.id)}parse(){if(this.hasOneByteExtensions())for(let e=0;e<this.extension.length;e++){const t=(240&this.extension[e])>>>4,a=1+(15&this.extension[e]);if(15===t)break;0!==t?(this.headers.set(t,this.extension.subarray(e+1,e+1+a)),e+=1+a):e++}else if(this.hasTwoBytesExtensions())for(let e=0;e<this.extension.length;e++){const t=this.extension[e],a=this.extension[e+1];0!==t?(this.headers.set(t,this.extension.subarray(e+2,e+2+a)),e+=2+a):e++}}}class c{constructor(){(0,s.A)(this,"header",void 0),(0,s.A)(this,"headerExtension",void 0),(0,s.A)(this,"payload",void 0)}}},38183:(e,t,a)=>{a.d(t,{Hj:()=>c,Jz:()=>f,hw:()=>u,kx:()=>l,l6:()=>h,o_:()=>p,pA:()=>d,we:()=>m,xW:()=>g});var s=a(4624),r=a(15012),n=a(92647),i=a(37246);const o="src/avprotocol/rtp/depacketizer.ts";function c(e){const t=[];let a=!1;for(let r=0;r<e.length;r++){const i=e[r].payload,c=31&i[0];switch(c){case 24:for(let e=1;e<i.length-2;){const r=i[e]<<8|i[e+1];if(e+2+r>i.length)return s.z3("pack h264 STAP-A failed",o,52),{nalus:[],isKey:a};t.push(i.subarray(e+2,e+2+r)),5==(31&i[e+2])&&(a=!0),e+=2+r}break;case 25:case 26:case 27:case 29:return s.z3("not support nalu pack",o,75),{nalus:[],isKey:a};case 28:const d=i[1];if(1&~(d>>>7))return s.z3("not the first FU-A packet",o,84),{nalus:[],isKey:a};const l=31&d,u=224&i[0]|l;5===l&&(a=!0);const p=[new Uint8Array([u])];for(p.push(i.subarray(2)),r++;r<e.length&&(p.push(e[r].payload.subarray(2)),!(e[r].payload[1]>>>6&1));r++);t.push((0,n.A)(Uint8Array,p));break;default:5===c&&(a=!0),t.push(i)}}return{nalus:t,isKey:a}}function d(e,t){const a=[];let i=!1;for(let c=0;c<e.length;c++){const d=e[c].payload,l=d[0]>>>1&63;switch(l>50&&s.z3("not support nalu pack",o,131),l){case 48:for(let e=r.Dm+(t.usingDonlField?r.hE:0);e<d.length-2;){const n=d[e]<<8|d[e+1];if(e+2+n>d.length)return s.z3("pack hevc STAP-A failed",o,140),{nalus:[],isKey:i};a.push(d.subarray(e+2,e+2+n));const c=d[e+2]>>>1&63;20!==c&&19!==c||(i=!0),e+=2+n,t.usingDonlField&&(e+=r.hQ)}break;case 49:const u=63&d[2];20!==u&&19!==u||(i=!0);const p=[new Uint8Array([129&d[0]|u<<1,d[1]])];for(p.push(d.subarray(3+(t.usingDonlField?r.hE:0))),c++;c<e.length&&(p.push(e[c].payload.subarray(3+(t.usingDonlField?r.hE:0))),!(e[c].payload[2]>>>6&1));c++);a.push((0,n.A)(Uint8Array,p));break;case 50:return s.z3("not support nalu pack",o,184),{nalus:[],isKey:i};default:20!==l&&19!==l||(i=!0),a.push(d)}}return{nalus:a,isKey:i}}function l(e,t){const a=[],c=[],d=new i.A(r.MO);for(let i=0;i<e.length;i++){const l=e[i].payload;if(t.latm){let e=0;for(;e<l.length;){let t=0;for(;;){const a=l[e++];if(t+=a,255!==a)break}a.push(l.subarray(e,e+t)),e+=t}}else{if(l.length<2)return void s.z3("invalid mpeg4 payload length",o,228);const e=l[0]<<8|l[1];if(e>r.MO)return void s.z3("invalid mpeg4 payload au header length",o,233);const i=(e+7)/8>>>0;if(l.length-2<i)return void s.z3("invalid mpeg4 payload au length",o,238);const u=t.sizeLength+t.indexLength;if(e%u!=0)return void s.z3("not support mpeg4 payload au format",o,245);const p=e/u,h=[],f=[];d.reset(),d.appendBuffer(l.subarray(2));for(let e=0;e<p;e++)h.push(d.readU(t.sizeLength)),f.push(d.readU(t.indexLength));if(1===h.length&&h[0]+i+2>l.length)c.push(l.subarray(2+i));else if(h.length>1){let e=i+2;for(let t=0;t<h.length;t++)!f[t]&&c.length&&(a.push((0,n.A)(Uint8Array,c)),c.length=0),a.push(l.subarray(e,e+h[t])),e+=h[t]}}}return c.length&&a.push(1===c.length?c[0]:(0,n.A)(Uint8Array,c)),a}function u(e){const t=[];let a=!1;for(let s=0;s<e.length;s++){const r=e[s].payload[0]>>>7,n=e[s].payload[0]>>>4&1,i=7&e[s].payload[0];let o=1;if(r){const r=e[s].payload[o]>>>7,c=e[s].payload[o]>>>6&1,d=e[s].payload[o]>>>5&1,l=e[s].payload[o]>>>4&1;o++,r&&e[s].payload[o++]>>>7&&o++,c&&o++,(d||l)&&o++,!n||0!==i||1&e[s].payload[o]||(a=!0),t.push(e[s].payload.subarray(o))}}return 1===t.length?{payload:t[0],isKey:a}:{payload:(0,n.A)(Uint8Array,t),isKey:a}}function p(e){const t=[];let a=!1;for(let r=0;r<e.length;r++){const n=e[r].payload[0]>>>7,i=e[r].payload[0]>>>5&1,c=e[r].payload[0]>>>4&1,d=e[r].payload[0]>>>3&1,l=e[r].payload[0]>>>1&1;let u=1;n&&e[r].payload[u++]>>>7&&u++;let p=0;if(i&&(c&&(p=3&e[r].payload[u]),u++),c)for(let t=0;t<p;t++)16&e[t].payload[u]?u+=2:u+=1;if(l){const t=e[r].payload[u]>>5,a=!!(16&e[r].payload[u]),n=!!(8&e[r].payload[u]);if(u++,t>0&&s.h2("VP9 scalability structure with multiple layers",o,383),a)for(r=0;r<t+1;r++)u+=4;if(n){const t=e[r].payload[u++];for(r=0;r<t;r++){const t=e[r].payload[u]>>2&3;u++;for(let e=0;e<t;e++)u++}}}if(d){const t=e[r].payload[u],s=((t>>>4&1)<<1)+(t>>>5&1);a=!(t>>>(3===s?2:3)&1||t>>>(3===s?1:2)&1)}t.push(e[r].payload.subarray(u))}return 1===t.length?{isKey:a,payload:t[0]}:{isKey:a,payload:(0,n.A)(Uint8Array,t)}}function h(e){const t=[];let a=!1;function s(e,t){let a=0;for(let s=0;s<8;s++){let r=e[t++];if(a|=(127&r)<<7*s,!(128&r))break}return{value:a,offset:t}}for(let r=0;r<e.length;r++){const n=e[r].payload[0]>>>4&3;let i=1;if(n){for(let r=0;r<n-1;r++){const n=s(e[r].payload,i);i=n.offset,1==(e[r].payload[i]>>>3&15)&&(a=!0),t.push(e[r].payload.subarray(i,i+n.value)),i+=n.value}1==(e[r].payload[i]>>>3&15)&&(a=!0),t.push(e[r].payload.subarray(i))}else for(;i<e[r].payload.length-1;){const n=s(e[r].payload,i);i=n.offset,1==(e[r].payload[i]>>>3&15)&&(a=!0),t.push(e[r].payload.subarray(i,i+n.value)),i+=n.value}}return 1===t.length?{payload:t[0],isKey:a}:{payload:(0,n.A)(Uint8Array,t),isKey:a}}function f(e,t){const a=[];for(let s=0;s<e.length;s++){let r=4;0===t&&1==(e[s].payload[0]>>>2&1)&&(r=8),a.push(e[s].payload.subarray(r))}return 1===a.length?a[0]:(0,n.A)(Uint8Array,a)}function m(e){const t=[],a=[];for(let s=0;s<e.length;s++){const r=e[s].payload;switch(3&r[0]){case 0:t.push(r.subarray(2));break;case 1:case 2:a.push(r.subarray(2));break;case 3:a.push(r.subarray(2)),t.push((0,n.A)(Uint8Array,a)),a.length=0}}return 1===t.length?t[0]:(0,n.A)(Uint8Array,t)}function g(e){if(1===e.length)return e[0].payload;const t=[];for(let a=0;a<e.length;a++)t.push(e[a].payload);return(0,n.A)(Uint8Array,t)}},30725:(e,t,a)=>{a.d(t,{zQ:()=>f});var s=a(37837),r=a(14686),n=a(4919),i=a(62815),o=a(67659),c=a(95832),d=a(60264),l=a(37246),u=a(4624);function p(e,t){const a=e.split(";");for(let e=0;e<a.length;e++){const s=a[e].split("="),r=s[0].trim();s.shift(),t(r,s.join("=").trim())}}function h(e,t){const a={};return p(t,((t,n)=>{switch(t){case"streamtype":a.streamType=+n;break;case"profile-level-id":a.profileLevelId=+n;break;case"mode":a.mode=n;break;case"sizelength":a.sizeLength=+n;break;case"indexlength":a.indexLength=+n;break;case"indexdeltalength":a.indexDeltaLength=+n;break;case"config":a.config=n,e.codecpar.extradata=(0,s.sY)(n.length/2),e.codecpar.extradataSize=n.length/2;const t=(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize);let i=0;for(let e=0;e<n.length;e+=2)t[i++]=+("0x"+n.substring(e,e+2));86018===e.codecpar.codecId&&c.XC(e,(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}})),a}const f={27:function(e,t){e.codecpar.bitFormat=2;const a={};return p(t,((t,o)=>{switch(t){case"profile-level-id":a.profile=+("0x"+o.substring(0,2)),a.level=+("0x"+o.substring(4,6));break;case"packetization-mode":a.packetizationMode=+o;break;case"sprop-parameter-sets":const t=o.split(",").map((e=>n.E_(e))),c=i.S1(d.nW(t));e.codecpar.extradata=(0,s.sY)(c.length),e.codecpar.extradataSize=c.length,(0,r.lW)(e.codecpar.extradata,c.length,c),i.XC(e,(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}})),a},173:function(e,t){const a={},i=[];if(e.codecpar.bitFormat=2,p(t,((e,t)=>{switch(e){case"profile-id":a.profile=+t;break;case"sprop-vps":case"sprop-sps":case"sprop-pps":case"sprop-sei":i.push(n.E_(t))}})),i.length){const t=o.S1(d.nW(i));e.codecpar.extradata=(0,s.sY)(t.length),e.codecpar.extradataSize=t.length,(0,r.lW)(e.codecpar.extradata,t.length,t),o.XC(e,(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}return a},86018:h,86065:function(e,t){const a={latm:!0};return e.codecpar.codecId=86018,p(t,((t,n)=>{switch(t){case"profile-level-id":a.profileLevelId=+n;break;case"cpresent":a.cpresent=+n;break;case"config":a.config=n;const t=new Uint8Array(n.length/2);let i=0;for(let e=0;e<n.length;e+=2)t[i++]=+("0x"+n.substring(e,e+2));const o=new l.A(t.length);o.appendBuffer(t);const d=o.readU1(),p=o.readU1();o.skip(6);const h=o.readU(4),f=o.readU(3);0==d&&1==p&&0==h&&0==f||u.h2("LATM config not support","src/avprotocol/rtp/fmtp.ts",186),e.codecpar.extradata=(0,s.sY)(2),e.codecpar.extradataSize=2;const m=(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize);m[0]=o.readU(8),m[1]=o.readU(8),c.XC(e,(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}})),a},12:h}},79940:(e,t,a)=>{function s(e){return e.length>12&&e[0]>127&&e[0]<192&&e[0]>>>6==2}a.d(t,{A:()=>s})},52575:(e,t,a)=>{a.d(t,{A:()=>r});var s=a(67088);function r(e){const t=new s.N8,a=t.header=new s.El;let r=0;a.version=e[r]>>6,a.padding=e[r]>>5&1,a.extension=e[r]>>4&1,a.csrc=15&e[r],r++,a.masker=e[r]>>7&1,a.payloadType=127&e[r],r++,a.sequence=e[r]<<8|e[r+1],r+=2,a.timestamp=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0,r+=4,a.ssrc=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0,r+=4;for(let t=0;t<a.csrc;t++)a.csrcList.push((e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0),r+=4;return a.extension&&(t.headerExtension=t.headerExtension=new s.tW,t.headerExtension.id=e[r]<<8|e[r+1],r+=2,t.headerExtension.length=e[r]<<8|e[r+1],r+=2,t.headerExtension.extension=e.subarray(r,4*t.headerExtension.length),r+=4*t.headerExtension.length),t.payload=e.subarray(r,e.length-(a.padding?e[e.length-1]:0)),t}},15012:(e,t,a)=>{a.d(t,{Dm:()=>r,MO:()=>s,fm:()=>c,hE:()=>i,hQ:()=>n,xl:()=>o});const s=8192,r=2,n=1,i=2,o={PCMU:65542,PCMA:65543,G723:86068,G722:69660,L16:65537,MPA:86017,MPV:2,MP2T:131072,H264:27,H265:173,HEVC:173,VP8:139,VP9:167,AV1:225,opus:86076,speex:86051,vorbis:86021,theora:30,"MP4A-LATM":86065,"MP4V-ES":12,"mpeg4-generic":86018,ac3:86019},c=[{payload:0,name:"PCMU",codecType:1,codecId:65542,rate:8e3,encoding:1},{payload:4,name:"G723",codecType:1,codecId:86068,rate:8e3,encoding:1},{payload:8,name:"PCMA",codecType:1,codecId:65543,rate:8e3,encoding:1},{payload:9,name:"G722",codecType:1,codecId:69660,rate:8e3,encoding:1},{payload:10,name:"L16",codecType:1,codecId:65537,rate:44100,encoding:2},{payload:11,name:"L16",codecType:1,codecId:65537,rate:44100,encoding:1},{payload:14,name:"MPA",codecType:1,codecId:86017,rate:-1,encoding:-1},{payload:31,name:"H261",codecType:0,codecId:3,rate:9e4,encoding:-1},{payload:32,name:"MPV",codecType:0,codecId:2,rate:9e4,encoding:-1},{payload:33,name:"MPV",codecType:2,codecId:131072,rate:9e4,encoding:-1},{payload:34,name:"H263",codecType:0,codecId:4,rate:9e4,encoding:-1}]},89222:(e,t,a)=>{a.d(t,{A:()=>n});var s=a(134),r=a(95434);class n extends r.zo{constructor(e,t,a){super(t,a),(0,s.A)(this,"seq",void 0),(0,s.A)(this,"version","RTSP/1.0"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"authorization",void 0),this.seq=1,this.uri=e}async options(){const e=new r.yz("OPTIONS",this.uri,this.version,{CSeq:""+this.seq++});return super.request(e)}async describe(){const e=new r.yz("DESCRIBE",this.uri,this.version,{CSeq:""+this.seq++,Accept:"application/sdp",Authorization:this.authorization});return super.request(e)}async setup(e,t=""){let a="";2===e.streamMode&&(a="/TCP");let s="",n="";1===e.streamMode?n=`;${e.clientPort}-${e.clientPort+1}`:2===e.streamMode&&(s=`;${e.interleaved}-${e.interleaved+1}`);const i=new r.yz("SETUP",this.uri+`/trackID=${e.trackId}`,this.version,{CSeq:""+this.seq++,Session:t,Authorization:this.authorization,Transport:`RTP/AVP${a};${e.multcast?"multcast":"unicast"}${s}${n}`});return super.request(i)}async play(e,t={from:0,to:-1}){const a=new r.yz("PLAY",this.uri,this.version,{CSeq:""+this.seq++,Session:e,Authorization:this.authorization,Range:`npt=${t.from>=0?t.from:0}-${t.to>0?t.to:""}`});return super.request(a)}async pause(e){const t=new r.yz("PAUSE",this.uri,this.version,{CSeq:""+this.seq++,Session:e,Authorization:this.authorization});return super.request(t)}async teardown(e){const t=new r.yz("TEARDOWN",this.uri,this.version,{CSeq:""+this.seq++,Session:e,Authorization:this.authorization});await super.notify(t)}async readPacket(){for(;;){36!==await this.ioReader.peekUint8()&&await this.readResponse(),await this.ioReader.skip(1);const e=await this.ioReader.readUint8(),t=await this.ioReader.readUint16();return{interleaved:e,data:await this.ioReader.readBuffer(t)}}}}},87631:(e,t,a)=>{a.d(t,{lN:()=>n}),a(67672);const s=/(.*)/,r="%s",n={v:[{name:"version",reg:/^(\d*)$/,format:r}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name",reg:s,format:r}],i:[{name:"description",reg:s,format:r}],u:[{name:"uri",reg:s,format:r}],e:[{name:"email",reg:s,format:r}],p:[{name:"phone",reg:s,format:r}],z:[{name:"timezones",reg:s,format:r}],r:[{name:"repeats",reg:s,format:r}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/,format:r},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/,format:r},{name:"icelite",reg:/^(ice-lite)/,format:r},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){let t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v",t}},{name:"endOfCandidates",reg:/^(end-of-candidates)/,format:r},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){let t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/,format:r},{name:"rtcpRsize",reg:/^(rtcp-rsize)/,format:r},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/,format:r},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){let t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":"",t}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",reg:s,names:["value"],format:r}]}},47860:(e,t,a)=>{a.d(t,{q:()=>o});var s=a(87631);a(67672);const r=e=>/^([a-z])=(.*)/.test(e);function n(e){return String(Number(e))===e?Number(e):e}function i(e,t,a){const s=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:s&&!t[e.name]&&(t[e.name]={});const r=e.push?{}:s?t[e.name]:t;!function(e,t,a,s){if(s&&!a)t[s]=n(e[1]);else for(let s=0;s<a.length;s+=1)null!=e[s+1]&&(t[a[s]]=n(e[s+1]))}(a.match(e.reg),r,e.names,e.name),e.push&&t[e.push].push(r)}function o(e){const t={},a=[];let n=t;return e.split(/(\r\n|\r|\n)/).filter(r).forEach((e=>{const t=e[0],r=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),n=a[a.length-1]);for(let e=0;e<(s.lN[t]||[]).length;e+=1){const a=s.lN[t][e];if(a.reg.test(r))return i(a,n,r)}})),t.media=a,t}},95832:(e,t,a)=>{a.d(t,{Bq:()=>u,Ij:()=>l,XC:()=>d,f7:()=>p,uF:()=>n});var s=a(77231),r=a(37246);const n={1:"Main",2:"LC",3:"LC",4:"LC",5:"HE",6:"HE"},i={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},o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,s.N_,s.N_,s.N_],c=[s.N_,1,2,3,4,5,6,7];function d(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t){const{profile:a,sampleRate:r,channels:n}=function(e){let t=s.N_,a=s.N_,r=s.N_;var n,i;return e.length>=2&&(t=e[0]>>3&31,a=null!==(n=o[(7&e[0])<<1|e[1]>>7])&&void 0!==n?n:48e3,r=null!==(i=c[e[1]>>3&15])&&void 0!==i?i:2),{profile:t,sampleRate:a,channels:r}}(t);e.codecpar.profile=a,e.codecpar.sampleRate=r,e.codecpar.chLayout.nbChannels=n}}function l(e){const t=i[e.sampleRate],a=e.chLayout.nbChannels,r=e.profile===s.N_?2:e.profile,n=new Uint8Array(2);return n[0]=(31&r)<<3|(14&t)>>1,n[1]=(1&t)<<7|(15&a)<<3,n}function u(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],s=(192&e[2])>>>6,r=(60&e[2])>>>2,n=(1&e[2])<<2|(192&e[3])>>>6,i=(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5,d=3&e[6];let l=1===a?7:9,u=i-l;return{syncWord:t,profile:s+1,sampleRate:o[r],channels:c[n],aacFrameLength:i,numberOfRawDataBlocksInFrame:d,headerLength:l,framePayloadLength:u}}function p(e,t){function a(){const e=t.readU(2);let a=0;for(let s=0;s<=e;s++)a<<=8,a|=t.readU(8);return a}t||(t=new r.A).appendBuffer(e);const s=t.getPointer(),n={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},i=t.readU(11);if(695!==i)return-1;n.syncWord=i,n.muxLengthBytes=t.readU(13);const d=1===t.readU1();if(n.useSameStreamMux=d,!d){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 s=e?a():0;const r=t.readU(5);s-=5;const i=t.readU(4);s-=4;const d=t.readU(4);if(s-=4,t.readU(3),s-=3,s>0&&t.readU(s),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),n.profile=r+1,n.sampleRate=o[i],n.channels=c[d]}let l=0;for(;;){const e=t.readU(8);if(l+=e,255!==e)break}return n.framePayloadLength=l,n.headerLength=t.getPointer()-s+(8===t.getBitLeft()?0:1),n}},87518:(e,t,a)=>{a.d(t,{R:()=>h,j:()=>r});var s=a(37246);const r=[3,4,3,7,259,263,1539,1543],n=[[64,69,96],[64,70,96],[80,87,120],[80,88,120],[96,104,144],[96,105,144],[112,121,168],[112,122,168],[128,139,192],[128,140,192],[160,174,240],[160,175,240],[192,208,288],[192,209,288],[224,243,336],[224,244,336],[256,278,384],[256,279,384],[320,348,480],[320,349,480],[384,417,576],[384,418,576],[448,487,672],[448,488,672],[512,557,768],[512,558,768],[640,696,960],[640,697,960],[768,835,1152],[768,836,1152],[896,975,1344],[896,976,1344],[1024,1114,1536],[1024,1115,1536],[1152,1253,1728],[1152,1254,1728],[1280,1393,1920],[1280,1394,1920]],i=[4,5,6,5],o=[4,6,7,6],c=[48e3,44100,32e3,0],d=[32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640],l=[2,1,2,3,3,4,4,5],u=[1,2,3,6],p=7;function h(e){const t=new s.A(e.length);t.appendBuffer(e);const a={syncWord:0,crc1:0,srCode:0,bitstreamId:0,bitstreamMode:0,channelMode:0,lfeOn:0,frameType:0,substreamId:0,centerMixLevel:0,surroundMixLevel:0,channelMap:0,numBlocks:0,dolbySurroundMode:0,srShift:0,sampleRate:0,bitrate:0,channels:0,frameSize:0,channelLayout:BigInt(0),ac3BitrateCode:0};if(a.syncWord=t.readU(16),2935!==a.syncWord)return-1;if(a.bitstreamId=31&t.peekU(29),a.bitstreamId>16)return-2;if(a.numBlocks=6,a.ac3BitrateCode=-1,a.centerMixLevel=5,a.surroundMixLevel=6,a.dolbySurroundMode=0,a.bitstreamId<=10){if(a.crc1=t.readU(16),a.srCode=t.readU(2),3===a.srCode)return-3;const e=t.readU(6);if(e>37)return-4;a.ac3BitrateCode=e>>1,t.readU(5),a.bitstreamMode=t.readU(3),a.channelMode=t.readU(3),2==a.channelMode?a.dolbySurroundMode=t.readU(2):(1&a.channelMode&&1!=a.channelMode&&(a.centerMixLevel=i[t.readU(2)]),4&a.channelMode&&(a.surroundMixLevel=o[t.readU(2)])),a.lfeOn=t.readU(1),a.srShift=Math.max(a.bitstreamId,8)-8,a.sampleRate=c[a.srCode]>>a.srShift,a.bitrate=1e3*d[a.ac3BitrateCode]>>a.srShift,a.channels=l[a.channelMode]+a.lfeOn,a.frameSize=2*n[e][a.srCode],a.frameType=2,a.substreamId=0}else{if(a.crc1=0,a.frameType=t.readU(2),3==a.frameType)return-5;if(a.substreamId=t.readU(3),a.frameSize=t.readU(11)+1<<1,a.frameSize<p)return-6;if(a.srCode=t.readU(2),3==a.srCode){const e=t.readU(2);if(3==e)return-7;a.sampleRate=c[e]/2,a.srShift=1}else a.numBlocks=u[t.readU(2)],a.sampleRate=c[a.srCode],a.srShift=0;a.channelMode=t.readU(3),a.lfeOn=t.readU(1),a.bitrate=8*a.frameSize*a.sampleRate/(256*a.numBlocks),a.channels=l[a.channelMode]+a.lfeOn}return a.channelLayout=BigInt(r[a.channelMode]),a.lfeOn&&(a.channelLayout|=BigInt(8)),a}},64093:(e,t,a)=>{a.d(t,{Au:()=>v,He:()=>A,XC:()=>x,Y2:()=>m,hG:()=>g,oz:()=>y});var s=a(77231);const r=[44100,48e3,32e3,0],n=[22050,24e3,16e3,0],i=[11025,12e3,8e3,0],o=[0,1152,1152,384],c=[0,576,1152,384],d=[0,576,1152,384],l=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],u=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],p=[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],f=[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1];function m(e,t){switch(e){case 0:return i[t];case 2:return n[t];case 3:return r[t]}return s.N_}function g(e,t){switch(e){case 0:return d[t];case 2:return c[t];case 3:return o[t]}return s.N_}function y(e,t,a){switch(t){case 1:switch(e){case 0:case 2:return f[a];case 3:return p[a]}break;case 2:switch(e){case 0:case 2:return f[a];case 3:return u[a]}case 3:switch(e){case 0:case 2:return h[a];case 3:return l[a]}}return s.N_}function v(e){switch(e){case 1:return 34;case 2:return 33;case 3:return 32}return s.N_}const A={32:"Layer1",33:"Layer2",34:"Layer3"};function x(e,t){if(t&&t.length>=4){const a=t[1]>>>3&3,s=(6&t[1])>>1,r=(12&t[2])>>>2,n=3&~(t[3]>>>6)?2:1,i=v(s),o=m(a,r);e.codecpar.profile=i,e.codecpar.sampleRate=o,e.codecpar.chLayout.nbChannels=n}}},41654:(e,t,a)=>{function s(e){const t=e>>BigInt(32),a=(e&BigInt(4294967295))*BigInt(1e6)/BigInt(4294967295);return t*BigInt(1e6)+a}a.d(t,{q:()=>s})},95434:(e,t,a)=>{a.d(t,{yz:()=>n,zo:()=>o});var s=a(134),r=a(95335);class n{constructor(e,t,a,r={},n=""){(0,s.A)(this,"method",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"protocol",void 0),(0,s.A)(this,"headers",void 0),(0,s.A)(this,"content",void 0),this.method=e,this.uri=t,this.protocol=a,this.headers=r,this.content=n}setHeader(e,t){this.headers[e]=t}encode(){let e=`${this.method} ${this.uri} ${this.protocol}\r\n`;return this.headers["Content-Length"]=this.content.length+"",r.__(this.headers,((t,a)=>{t&&(e+=`${a}: ${t}\r\n`)})),e+="\r\n",this.content&&(e+=this.content),e}}class i{constructor(e,t,a,r,n){(0,s.A)(this,"protocol",void 0),(0,s.A)(this,"statusCode",void 0),(0,s.A)(this,"statusText",void 0),(0,s.A)(this,"headers",void 0),(0,s.A)(this,"content",void 0),this.protocol=e,this.statusCode=t,this.statusText=a,this.headers=r,this.content=n}}class o{constructor(e,t){(0,s.A)(this,"ioReader",void 0),(0,s.A)(this,"ioWriter",void 0),this.ioReader=e,this.ioWriter=t}async readResponse(){let e=(await this.ioReader.readLine()).trim().split(" "),t="",a={};for(;;){const e=(await this.ioReader.readLine()).trim();if(!e)break;const t=e.split(":");a[t[0].trim()]=t[1].trim()}return a["Content-Length"]&&(t=await this.ioReader.readString(+a["Content-Length"])),new i(e[0].trim(),+e[1].trim(),e[2].trim(),a,t)}async request(e){return this.ioWriter.reset(),this.ioWriter.writeString(e.encode()),this.ioWriter.flush(),this.readResponse()}async notify(e){this.ioWriter.reset(),this.ioWriter.writeString(e.encode()),await this.ioWriter.flush()}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[531],{85947:(a,t,e)=>{e.d(t,{A:()=>s});var i=e(134);class s{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(a){}}},92047:(a,t,e)=>{e.r(t),e.d(t,{default:()=>k});var i=e(134),s=e(63939),r=e(50932),n=e(4624),o=e(9705),d=e(65977),c=e(74963),p=e(85947),f=e(85428),l=e(9690),m=e(72739),u=e(14686),w=e(37837),g=e(71517),h=e(44328),z=e(77231),v=e(39381);const U="src/avformat/formats/IMovFormat.ts";class k extends p.A{constructor(a={}){super(),(0,i.A)(this,"type",1),(0,i.A)(this,"context",void 0),(0,i.A)(this,"options",void 0),this.options=a,this.context=(0,l.A)()}init(a){a.ioReader&&a.ioReader.setEndian(!0)}async readHeader(a){try{const t=await a.ioReader.fileSize();let e=0,i=await a.ioReader.readUint32(),s=await a.ioReader.readUint32();s===(0,d.A)("ftyp")?await c.E6(a.ioReader,this.context,{type:s,size:i-8}):(!t||i<t)&&await a.ioReader.skip(i-8);let r=BigInt(0);for(;!this.context.foundMoov;){const e=a.ioReader.getPos();if(e===t)return n.z3("the file format is not mp4",U,100),o.LR;if(i=await a.ioReader.readUint32(),s=await a.ioReader.readUint32(),i<8||t&&e+BigInt(Math.floor(i))>t)return n.z3(`invalid box size ${i}`,U,108),o.LR;s===(0,d.A)("mdat")?(this.context.foundMdat||(r=e),this.context.foundMdat=!0,await a.ioReader.seek(e+BigInt(Math.floor(i)))):s===(0,d.A)("moov")?(await c.wB(a.ioReader,a,this.context,{size:i-8,type:s}),this.context.foundMoov=!0):await a.ioReader.seek(e+BigInt(Math.floor(i)))}if(!this.context.fragment&&!this.context.foundMdat){const t=await a.ioReader.peekUint64()>>BigInt(32);Number(t)===(0,d.A)("moof")&&(this.context.fragment=!0)}if(this.context.fragment&&1&a.ioReader.flags){const t=a.ioReader.getPos(),e=await a.ioReader.fileSize();if(e>BigInt(16)){await a.ioReader.seek(e-BigInt(12));let i=await a.ioReader.readUint32();if(i===(0,d.A)("mfro")){await a.ioReader.skip(4);const t=await a.ioReader.readUint32();await a.ioReader.seek(e-BigInt(Math.floor(t)));const s=await a.ioReader.readUint32();i=await a.ioReader.readUint32(),i===(0,d.A)("mfra")&&await c.t9(a.ioReader,a,this.context,{size:s-8,type:i})}await a.ioReader.seek(t)}}return!this.context.fragment&&this.context.foundMdat&&await a.ioReader.seek(r),e}catch(t){return n.z3(t.message,U,170),this.context.foundMoov||n.z3("moov not found",U,173),a.ioReader.error}}async readAVPacket_(a,t){const{sample:e,stream:i}=(0,f.G)(a,this.context);if(!e)return-1048576;{r.M[15](t+32,i.index),r.M[17](t+16,e.dts),r.M[17](t+8,e.pts),r.M[17](t+48,BigInt(Math.floor(e.duration))),r.M[15](t+36,s.f[15](t+36)|e.flags),r.M[17](t+56,e.pos),r.M[15](t+76,i.timeBase.den),r.M[15](t+72,i.timeBase.num),i.startTime===z.Dh&&(i.startTime=s.f[17](t+8)||s.f[17](t+16));const n=Number(BigInt.asIntN(32,s.f[17](t+56)-a.ioReader.getPos()));0!==n&&(n>0&&(4&a.ioReader.flags||2&a.ioReader.flags)?await a.ioReader.skip(n):await a.ioReader.seek(s.f[17](t+56)));const o=e.size,c=(0,w.sY)(o);if((0,g.NX)(t,c,o),await a.ioReader.readBuffer(o,(0,u.JW)(c,o)),27!==i.codecpar.codecId&&173!==i.codecpar.codecId&&196!==i.codecpar.codecId||r.M[15](t+80,1),94226===i.codecpar.codecId&&s.f[15](t+28)>=8){const a=v.Sg(s.f[20](t+24)+4)>>>0,e=s.f[15](t+28);if(a===(0,d.A)("vtte")&&8===e){const a=(0,w.Gy)(1);(0,g.NX)(t,a,1),r.M[15](t+28,1)}if(e>8&&(a===(0,d.A)("vtte")||a===(0,d.A)("vttc"))){let a=s.f[20](t+24)+8;const i=s.f[20](t+24)+e;for(;a<i;){const e=v.Sg(a);if(v.Sg(a+4)>>>0===(0,d.A)("payl")&&e>8){const i=(0,w.sY)(e-8);(0,u.Mr)(i,a+8,e-8),(0,g.NX)(t,i,e-8);break}a+=e}}}if(i.sideData[1]){const a=i.sideData[1].length,e=(0,w.sY)(a);(0,g.Ow)(t,1,e,a),(0,u.lW)(e,a,i.sideData[1]),delete i.sideData[1]}}return 0}async readAVPacket(a,t){try{if(this.context.fragment&&!this.context.currentFragment)for(;!this.context.currentFragment;){const t=a.ioReader.getPos(),e=await a.ioReader.readUint32(),i=await a.ioReader.readUint32();i===(0,d.A)("moof")?(this.context.currentFragment={pos:t,size:e,sequence:0,tracks:[],currentTrack:null},this.context.firstMoof||(this.context.firstMoof=t),await c.wZ(a.ioReader,a,this.context,{type:i,size:e-8})):i===(0,d.A)("moov")?await c.wB(a.ioReader,a,this.context,{size:e-8,type:i}):await a.ioReader.skip(e-8)}return await this.readAVPacket_(a,t)}catch(t){return-1048576!==a.ioReader.error?(n.z3(`read packet error, ${t}`,U,320),o.LR):a.ioReader.error}}async seek(a,t,e,i){const s=e,r=t.privData,n=()=>{this.context.currentFragment=null,a.streams.forEach((a=>{a.privData.samplesIndex.length=0}))};if(16&i&&this.context.fragment){const i=(0,h.k)(e,t.timeBase,z.i0);return await a.ioReader.seek(i,!0),n(),BigInt(0)}if(this.context.fragment){if(r.fragIndexes.length){let t=m.El(r.fragIndexes,(a=>a.time>s?-1:a.time===s?0:1));if(t>-1)return await a.ioReader.seek(r.fragIndexes[t].pos,!0),n(),BigInt(0)}return s===BigInt(0)&&this.context.firstMoof?(await a.ioReader.seek(this.context.firstMoof),n(),BigInt(0)):BigInt(o.E$)}let d=m.El(r.samplesIndex,(a=>a.pts>s?-1:a.pts===s?0:1));if(d>-1&&0===t.codecpar.codecType){let a=d;for(;a>=0;a--)if(1&r.samplesIndex[a].flags){d=a;break}a<0&&(d=-1)}return d>-1?(r.currentSample=d,r.sampleEnd=!1,m.__(a.streams,(a=>{if(a!==t){const e=a.privData;let i=(0,h.k)(r.samplesIndex[r.currentSample].pts,t.timeBase,a.timeBase),s=m.El(e.samplesIndex,(a=>a.pts>i?-1:a.pts===i?0:1));if(s>-1&&0===a.codecpar.codecType){let a=s;for(;a>=0;a--)if(1&e.samplesIndex[a].flags){s=a;break}a<0&&(s=-1)}s>=0?(e.currentSample=s,e.sampleEnd=!1):(e.sampleEnd=!0,e.currentSample=e.samplesIndex.length)}})),BigInt(0)):BigInt(o.LR)}getAnalyzeStreamsCount(){return 0}}},21071:(a,t,e)=>{e.d(t,{_l:()=>i,gQ:()=>s});const i=["hmhd","nmhd","iods","xml ","url ","bxml","ipro","mere","stts","ctts","stss","stsz","stz2","stsc","stco","co64","stsd","dref","mvhd","tkhd","mdhd","hdlr"],s=["moov","trak","edts","mdia","minf","dinf","stbl","mvex","moof","traf","vttc","tref","iref","mfra","hnti","hinf","strd","sinf","rinf","schi","trgr","udta","iprp","ipco","strk","meco"]},61179:(a,t,e)=>{function i(a,t,e,i=0){const s=a.privData,r=e.trexs.find((a=>a.trackId===t.trackId));let n=t.baseDataOffset+BigInt(Math.floor(t.dataOffset));t.baseIsMoof&&(n+=e.currentFragment.pos);let o=t.baseMediaDecodeTime;const d=t.sampleSizes,c=t.sampleDurations,p=t.sampleFlags,f=t.sampleCompositionTimeOffset;if(!d.length)for(let a=0;a<t.sampleCount;a++)d.push(t.defaultSampleSize||r.size);if(!c.length)for(let a=0;a<t.sampleCount;a++)c.push(t.defaultSampleDuration||r.duration);if(!p.length)for(let a=0;a<t.sampleCount;a++)p.push(t.defaultSampleFlags||r.flags);if(!f.length)for(let a=0;a<t.sampleCount;a++)f.push(0);const l=[];for(let a=0;a<t.sampleCount;a++){const e={dts:o,pts:o+BigInt(Math.floor(f[a])),pos:n,size:d[a],duration:c[a],flags:0};o+=BigInt(Math.floor(e.duration)),n+=BigInt(Math.floor(e.size));let s=p[a];0===a&&t.firstSampleFlags&&(s=t.firstSampleFlags),16842752&s||(e.flags|=1),0===a&&d.length>1&&2&i&&(e.flags|=1),l.push(e)}s.samplesIndex=l}e.d(t,{p:()=>i})},98859:(a,t,e)=>{function i(a){const t=a.privData,e=t.chunkOffsets,i=t.sampleSizes,s=t.cttsSampleCounts,r=t.cttsSampleOffsets,n=t.stscFirstChunk,o=t.stscSamplesPerChunk,d=t.stssSampleNumbersMap,c=t.sttsSampleCounts,p=t.sttsSampleDeltas;if(!e.length)return;let f=0,l=0,m=0,u=0,w=0,g=0,h=BigInt(0),z=0,v=BigInt(0);const U=[];for(let t=0;t<e.length;t++)for(h=e[t],f<n.length-1&&n[f+1]===t+1&&f++,g=o[f];g>0;){const t={dts:v,pts:v,pos:h,size:i[z],duration:0,flags:0};(d&&d.has(z+1)||1===a.codecpar.codecType)&&(t.flags|=1),r&&(t.pts=t.dts+BigInt(Math.floor(r[u])),w++,w===s[u]&&(u++,w=0)),z&&(U[z-1].duration=Number(t.dts-U[z-1].dts)),h+=BigInt(Math.floor(t.size)),v+=BigInt(Math.floor(p[l])),m++,m===c[l]&&(l++,m=0),z++,U.push(t),g--}U.length>1&&(U[z-1].duration=U[z-2].duration),t.samplesIndex=U}e.d(t,{X:()=>i})},3384:(a,t,e)=>{function i(){return{trackId:0,baseDataOffset:BigInt(0),defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0,baseMediaDecodeTime:BigInt(0),sampleCount:0,dataOffset:0,dataOffsetPos:BigInt(0),firstSampleFlags:0,sampleDurations:[],sampleSizes:[],sampleFlags:[],sampleCompositionTimeOffset:[],baseIsMoof:!1,ioWriter:null,buffers:[]}}e.d(t,{A:()=>i})},9690:(a,t,e)=>{e.d(t,{A:()=>s});var i=e(77231);function s(){return{isom:!1,timescale:i.N_,duration:i.Dh,foundMoov:!1,foundMdat:!1,majorBrand:0,minorVersion:0,compatibleBrand:[],creationTime:BigInt(0),modificationTime:BigInt(0),rate:i.N_,volume:i.N_,matrix:null,nextTrackId:1,fragment:!1,trexs:[],currentFragment:null,boxsPositionInfo:[],holdMoovPos:BigInt(0),currentChunk:null}}},38106:(a,t,e)=>{e.d(t,{A:()=>s});var i=e(77231);function s(){return{chunkOffsets:null,cttsSampleCounts:null,cttsSampleOffsets:null,stscFirstChunk:null,stscSamplesPerChunk:null,stscSampleDescriptionIndex:null,stssSampleNumbersMap:null,stssSampleNumbers:null,sampleSizes:null,sttsSampleCounts:null,sttsSampleDeltas:null,timescale:0,duration:BigInt(0),trackId:i.N_,layer:0,alternateGroup:0,volume:0,matrix:null,width:0,height:0,audioCid:0,samplesPerFrame:0,bytesPerFrame:0,currentSample:0,sampleEnd:!1,samplesIndex:[],fragIndexes:[],lastPts:BigInt(0),lastDts:BigInt(0),startDts:BigInt(0),startCT:0,lastDuration:0,chunkCount:0,firstWrote:!1,lastStscCount:0,perStreamGrouping:!1,index:0,flags:0}}},85428:(a,t,e)=>{e.d(t,{G:()=>r});var i=e(77231),s=e(44328);function r(a,t){let e,r,n,o,d,c,p=BigInt(0);if(a.streams.forEach((a=>{const t=a.privData;if(!t.samplesIndex||!t.samplesIndex.length)return t.sampleEnd=!0,!0;t.sampleEnd||n&&!(t.samplesIndex[t.currentSample].pos<n.pos)||(n=t.samplesIndex[t.currentSample],o=a),t.sampleEnd||d&&!((0,s.k)(t.samplesIndex[t.currentSample].dts,a.timeBase,i.KR)<p)||(d=t.samplesIndex[t.currentSample],p=(0,s.k)(d.dts,a.timeBase,i.KR),c=a)})),n&&d){const t=(0,s.k)(n.dts,o.timeBase,i.KR),p=(0,s.k)(d.dts,c.timeBase,i.KR);Math.abs(Number(t-p))<1e6||2&a.ioReader.flags||4&a.ioReader.flags?(e=n,r=o):(e=d,r=c)}else n?(e=n,r=o):d&&(e=d,r=c);if(r&&(r.privData.currentSample++,r.privData.currentSample>=r.privData.samplesIndex.length&&(r.privData.sampleEnd=!0)),t.fragment){const e=!!a.streams.find((a=>!1===a.privData.sampleEnd));e||(t.currentFragment=null)}return{sample:e,stream:r}}},74963:(a,t,e)=>{e.d(t,{E6:()=>w,t9:()=>v,wB:()=>h,wZ:()=>z});var i=e(65977),s=e(21071),r=e(68361),n=e(4624),o=e(61179),d=e(98859),c=e(3384),p=e(38106),f=e(37837),l=e(14686),m=e(77231);const u="src/avformat/formats/mov/imov.ts";async function w(a,t,e){const s=a.getPos()+BigInt(Math.floor(e.size));for(t.majorBrand=await a.readUint32(),t.minorVersion=await a.readUint32(),t.majorBrand===(0,i.A)("qt ")&&(t.isom=!0);a.getPos()<s;)t.compatibleBrand.push(await a.readUint32())}async function g(a,t,e,o){const d=a.getPos()+BigInt(Math.floor(e.size));for(;a.getPos()<d;){const e=await a.readUint32(),d=await a.readUint32();if(e<8)return void n.z3(`invalid box size ${e}`,u,76);if(r.A[d])await r.A[d](a,t,{type:d,size:e-8},o);else if(d===(0,i.A)("mdia")){let n=!1,d=BigInt(0);const c=a.getPos()+BigInt(Math.floor(e-8));for(;a.getPos()<c;){const e=await a.readUint32(),c=await a.readUint32();c===(0,i.A)("hdlr")?(await r.A[c](a,t,{type:c,size:e-8},o),n=!0):c===(0,i.A)("minf")&&n?await g(a,t,{type:c,size:e-8},o):c!==(0,i.A)("minf")||n?r.A[c]?await r.A[c](a,t,{type:c,size:e-8},o):s.gQ.some((a=>(0,i.A)(a)===c))?await g(a,t,{type:c,size:e-8},o):await a.skip(e-8):(d=a.getPos()-BigInt(8),await a.skip(e-8))}if(d){const e=a.getPos();await a.seek(d);const i=await a.readUint32(),s=await a.readUint32();await g(a,t,{type:s,size:i-8},o),await a.seek(e)}}else s.gQ.some((a=>(0,i.A)(a)===d))?await g(a,t,{type:d,size:e-8},o):await a.skip(e-8)}}async function h(a,t,e,s){const o=a.getPos()+BigInt(Math.floor(s.size));for(;a.getPos()<o;){const s=await a.readUint32(),o=await a.readUint32();if(s<8)return void n.z3(`invalid box, type: ${o}, size ${s}`,u,209);if(r.A[o])await r.A[o](a,null,{type:o,size:s-8},e);else if(o===(0,i.A)("trak"))if(!e.foundMoov||e.fragment){const i=t.createStream();if(i.privData=(0,p.A)(),await g(a,i,{type:o,size:s-8},e),e.fragment){const a=i.privData,e=t.streams.find((t=>{const e=t.privData;if(t.index!==i.index&&e.trackId===a.trackId)return!0}));e?(i.sideData[1]&&(e.sideData[1]=i.sideData[1],e.codecpar.extradata&&(0,f.Eb)(e.codecpar.extradata),e.codecpar.extradataSize=e.sideData[1].length,e.codecpar.extradata=(0,f.sY)(e.codecpar.extradataSize),(0,l.lW)(e.codecpar.extradata,e.codecpar.extradataSize,e.sideData[1]),i.codecpar.width!==m.N_&&a.width>0&&(e.codecpar.width=a.width),i.codecpar.width!==m.N_&&a.height>0&&(e.codecpar.height=a.height)),t.removeStream(i),t.streamIndex--):(i.codecpar.width===m.N_&&a.width>0&&(i.codecpar.width=a.width),i.codecpar.width===m.N_&&a.height>0&&(i.codecpar.height=a.height))}else(0,d.X)(i)}else await a.skip(s-8);else o===(0,i.A)("mvex")?(e.fragment=!0,await g(a,null,{type:o,size:s-8},e)):await a.skip(s-8)}}async function z(a,t,e,s){const d=a.getPos()+BigInt(Math.floor(s.size));for(;a.getPos()<d;){const s=await a.readUint32(),d=await a.readUint32();if(s<8)return void n.z3(`invalid box, type: ${d}, size ${s}`,u,314);if(r.A[d])await r.A[d](a,null,{type:d,size:s-8},e);else if(d===(0,i.A)("traf")){const i=(0,c.A)();e.currentFragment.currentTrack=i,await g(a,null,{type:d,size:s-8},e),e.currentFragment.tracks.push(i),e.currentFragment.currentTrack=null;const r=t.streams.find((a=>a.privData.trackId===i.trackId));if(r){const a=r.privData;i.streamIndex=r.index,(0,o.p)(r,i,e,t.ioReader.flags),a.currentSample=0,a.sampleEnd=!1}}else await a.skip(s-8)}}async function v(a,t,e,s){const r=a.getPos()+BigInt(Math.floor(s.size));for(;a.getPos()<r;){const s=a.getPos(),r=await a.readUint32();if(await a.readUint32()===(0,i.A)("tfra")){const s=await a.readUint8();await a.skip(3);const r=await a.readUint32(),n=await a.readUint32(),o=await a.readUint32(),d=t.streams.find((a=>a.privData.trackId===r));if(d){const r=d.privData;let c,p;for(let t=0;t<o;t++){1===s?(c=await a.readUint64(),p=await a.readUint64()):(c=BigInt(Math.floor(await a.readUint32())),p=BigInt(Math.floor(await a.readUint32()))),r.fragIndexes.push({pos:p,time:c});for(let t=0;t<1+(n>>4&3);t++)await a.skip(1);for(let t=0;t<1+(n>>2&3);t++)await a.skip(1);for(let t=0;t<1+(3&n);t++)await a.skip(1)}if(r.fragIndexes.length){await a.seek(r.fragIndexes[r.fragIndexes.length-1].pos);const s=await a.readUint32(),n=await a.readUint32();if(n===(0,i.A)("moof")&&(e.currentFragment={pos:BigInt(0),size:s,sequence:0,tracks:[],currentTrack:null},await z(a,t,e,{size:s,type:n}),r.samplesIndex.length)){const a=r.samplesIndex[r.samplesIndex.length-1];d.duration=a.pts+BigInt(Math.floor(a.duration)),r.samplesIndex.length=0}}}}await a.seek(s+BigInt(Math.floor(r)),!1,!1)}e.currentFragment=null}},6660:(a,t,e)=>{e.d(t,{Q9:()=>r,f3:()=>n,uf:()=>o,zs:()=>s});var i=e(65977);const s={86018:64,86017:105,86076:173,86028:193,86021:221,12:32,27:33,173:35,196:51,167:177,0:0},r={32:12,33:27,35:173,51:196,177:167,64:86018,102:86018,103:86018,104:86018,105:86017,107:86017,173:86076,193:86028,221:86021,0:0},n={vide:0,soun:1,clcp:3,sbtl:3,subt:3,subp:3,text:3},o={[(0,i.A)("mp4a")]:86018,1836253269:86017,[(0,i.A)("Opus")]:86076,[(0,i.A)("fLaC")]:86028,[(0,i.A)("spex")]:86051,[(0,i.A)("SPXN")]:86051,[(0,i.A)("ac-3")]:86019,[(0,i.A)("sac3")]:86019,[i.A.mp4v]:12,[(0,i.A)("av01")]:225,[(0,i.A)("vp08")]:139,[(0,i.A)("vp09")]:167,[(0,i.A)("avc1")]:27,[(0,i.A)("hev1")]:173,[(0,i.A)("hvc1")]:173,[(0,i.A)("vvc1")]:196,[(0,i.A)("vvi1")]:196,[(0,i.A)("text")]:94213,[(0,i.A)("tx3g")]:94213}},38582:(a,t,e)=>{e.d(t,{A:()=>d});var i=e(4624),s=e(14686),r=e(37837),n=e(21477);const o="src/avformat/formats/mov/parsing/av1c.ts";async function d(a,t,e,d){const c=a.getPos();if(t.codecpar.codecId=225,e.size<=0)return;const p=(0,r.sY)(e.size),f=await a.readBuffer(e.size,(0,s.JW)(p,e.size));d.foundMoov?(t.sideData[1]=f.slice(),(0,r.Eb)(p)):(t.codecpar.extradata=p,t.codecpar.extradataSize=e.size,t.sideData[1]=f.slice()),n.XC(t,t.sideData[1]);const l=e.size-Number(a.getPos()-c);l>0?await a.skip(l):l<0&&i.z3(`read avcc error, size: ${e.size}, read: ${e.size-l}`,o,67)}},73840:(a,t,e)=>{e.d(t,{A:()=>d});var i=e(37837),s=e(14686),r=e(4624),n=e(62815);const o="src/avformat/formats/mov/parsing/avcc.ts";async function d(a,t,e,d){const c=a.getPos();if(t.codecpar.codecId=27,e.size<=0)return;const p=(0,i.sY)(e.size),f=await a.readBuffer(e.size,(0,s.JW)(p,e.size));d.foundMoov?(t.sideData[1]=f.slice(),(0,i.Eb)(p)):(t.codecpar.extradata=p,t.codecpar.extradataSize=e.size,t.sideData[1]=f.slice()),n.XC(t,t.sideData[1]);const l=e.size-Number(a.getPos()-c);l>0?await a.skip(l):l<0&&r.z3(`read avcc error, size: ${e.size}, read: ${e.size-l}`,o,67)}},37213:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/co64.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=[],c=await a.readUint32();if(0===o)for(let t=0;t<c;t++)d.push(await a.readUint64());t.privData.chunkOffsets=d;const p=e.size-Number(a.getPos()-n);p>0?await a.skip(p):p<0&&i.z3(`read co64 error, size: ${e.size}, read: ${e.size-p}`,s,56)}},12869:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/colr.ts";async function r(a,t,e,r){const n=a.getPos();let o=await a.readString(4);if("nclx"===o||"nclc"===o||"prof"===o)if("prof"===o){const i=await a.readBuffer(e.size-4);t.sideData[28]=i}else{let e=await a.readUint16(),i=await a.readUint16(),s=await a.readUint16();if("nclx"===o){const e=await a.readUint8()>>7;t.codecpar.colorRange=e?2:1}e>=23&&(e=2),i>=19&&(i=2),s>=15&&(s=2),t.codecpar.colorPrimaries=e,t.codecpar.colorTrc=i,t.codecpar.colorSpace=s}else i.R8(`unsupported color_parameter_type: ${o}`,s,79);const d=e.size-Number(a.getPos()-n);d>0?await a.skip(d):d<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-d}`,s,87)}},59299:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/ctts.ts";async function r(a,t,e,r){const n=a.getPos(),o=t.privData;await a.skip(4);const d=[],c=[],p=await a.readUint32();for(let t=0;t<p;t++)d.push(await a.readUint32()),c.push(await a.readInt32());o.cttsSampleCounts=d,o.cttsSampleOffsets=c;const f=e.size-Number(a.getPos()-n);f>0?await a.skip(f):f<0&&i.z3(`read ctts error, size: ${e.size}, read: ${e.size-f}`,s,59)}},7320:(a,t,e)=>{e.d(t,{A:()=>f});var i=e(61499),s=e(63939),r=e(50932),n=e(4624),o=e(71517),d=e(87518),c=e(99991);const p="src/avformat/formats/mov/parsing/dac3.ts";async function f(a,t,e,f){const l=a.getPos();if(t.codecpar.codecId=86019,e.size<=0)return;const m=(0,o.E4)(t.codecpar[i.o9]+20,t.codecpar[i.o9]+24,7,4),u=s.f[20](m),w=await a.readUint24(),g=w>>14&7,h=w>>11&7,z=w>>10&1;let v=d.j[h];z&&(v|=8),c.bl(t.codecpar[i.o9]+112),c.ML(t.codecpar[i.o9]+112,v),r.M[15](u,g);const U=e.size-Number(a.getPos()-l);U>0?await a.skip(U):U<0&&n.z3(`read avcc error, size: ${e.size}, read: ${e.size-U}`,p,77)}},36868:(a,t,e)=>{e.d(t,{A:()=>f});var i=e(61499),s=e(63939),r=e(50932),n=e(4624),o=e(71517),d=e(87518),c=e(99991);const p="src/avformat/formats/mov/parsing/dec3.ts";async function f(a,t,e,f){const l=a.getPos();if(t.codecpar.codecId=86056,e.size<=0)return;const m=(0,o.E4)(t.codecpar[i.o9]+20,t.codecpar[i.o9]+24,7,4),u=s.f[20](m);await a.skip(2);const w=await a.readUint24(),g=w>>12&31,h=w>>9&7,z=w>>8&1;let v=d.j[h];z&&(v|=8),c.bl(t.codecpar[i.o9]+112),c.ML(t.codecpar[i.o9]+112,v),r.M[15](u,g),t.codecpar.chLayout.nbChannels>1&&7==g&&r.M[15](u,8);const U=e.size-Number(a.getPos()-l);U>0?await a.skip(U):U<0&&n.z3(`read avcc error, size: ${e.size}, read: ${e.size-U}`,p,82)}},86528:(a,t,e)=>{e.d(t,{A:()=>o});var i=e(4624),s=e(37837),r=e(14686);const n="src/avformat/formats/mov/parsing/dfla.ts";async function o(a,t,e,o){const d=a.getPos();t.codecpar.codecId=86028,await a.skip(1),await a.skip(3);const c=await a.readUint8(),p=128&c,f=127&c,l=await a.readUint24();if(0===f&&34===l){const e=(0,s.sY)(l),i=await a.readBuffer(l,(0,r.JW)(e,l));o.foundMoov?(t.sideData[1]=i.slice(),(0,s.Eb)(e)):(t.codecpar.extradata=e,t.codecpar.extradataSize=l)}else i.z3("streaminfo must be first FLACMetadataBlock",n,67);p||i.R8("non streaminfo FLACMetadataBlock(s) ignored",n,71);const m=e.size-Number(a.getPos()-d);m>0?await a.skip(m):m<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-m}`,n,79)}},41781:(a,t,e)=>{e.d(t,{A:()=>p});var i=e(4624),s=e(37837),r=e(14686),n=e(22576),o=e(31865),d=e(729);const c="src/avformat/formats/mov/parsing/dops.ts";async function p(a,t,e,p){const f=a.getPos();t.codecpar.codecId=86076,await a.skip(1);const l=(0,s.sY)(e.size+8),m=(0,r.JW)(l,e.size+8),u=new o.A(m),w=new d.A(m,!1);w.writeString("OpusHead"),w.writeUint8(1),await a.readBuffer(e.size-1,(0,r.JW)(l+9,e.size-1)),u.seek(10),w.seek(10),w.writeUint16(u.readUint16()),w.writeUint32(u.readUint32()),w.writeUint16(u.readUint16()),p.foundMoov?(t.sideData[1]=m.slice(),(0,s.Eb)(l)):(t.codecpar.extradata=l,t.codecpar.extradataSize=m.length,n.XC(t,m.slice()));const g=e.size-Number(a.getPos()-f);g>0?await a.skip(g):g<0&&i.z3(`read dops error, size: ${e.size}, read: ${e.size-g}`,c,81)}},28412:(a,t,e)=>{e.d(t,{A:()=>f});var i=e(4624),s=e(6660),r=e(37837),n=e(14686),o=e(95832),d=e(22576);const c="src/avformat/formats/mov/parsing/esds.ts";async function p(a){let t=0;for(let e=0;e<4;e++){const e=await a.readUint8();if(t=t<<7|127&e,!(128&e))break}return t}async function f(a,t,e,f){const l=a.getPos();await a.skip(4);let m=a.getPos()+BigInt(Math.floor(e.size-4));for(;a.getPos()<m;){let e=await a.readUint8(),l=await p(a);if(0!==l)if(3===e){let m=a.getPos()+BigInt(Math.floor(l));if(await a.skip(2),await a.skip(1),e=await a.readUint8(),l=await p(a),0===l){i.R8("esds invalid ES descriptor size 0, skip",c,85),await a.skip(Number(m-a.getPos()));continue}if(4===e)if(t.codecpar.codecId=s.Q9[await a.readUint8()],await a.skip(1),await a.skip(3),await a.skip(4),await a.skip(4),a.getPos()<m-BigInt(5))if(e=await a.readUint8(),l=await p(a),5===e){const e=(0,r.sY)(l),i=await a.readBuffer(l,(0,n.JW)(e,l));f.foundMoov?(t.sideData[1]=i.slice(),(0,r.Eb)(e)):(t.codecpar.extradata=e,t.codecpar.extradataSize=l,86018===t.codecpar.codecId?o.XC(t,i.slice()):86076===t.codecpar.codecId&&d.XC(t,i.slice()))}else await a.skip(Number(m-a.getPos()));else await a.skip(Number(m-a.getPos()));else await a.skip(Math.min(l,Number(m-a.getPos())))}else await a.skip(Math.min(l,Number(m-a.getPos())));else i.R8("esds invalid descriptor size 0, skip",c,68),await a.skip(Number(m-a.getPos()))}const u=e.size-Number(a.getPos()-l);u>0?await a.skip(u):u<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-u}`,c,153)}},40179:(a,t,e)=>{e.d(t,{A:()=>o});var i=e(4624),s=e(34677),r=e(6660);const n="src/avformat/formats/mov/parsing/hdlr.ts";async function o(a,t,e,o){const d=a.getPos(),c=await a.readUint8();if(await a.skip(3),0===c){await a.skip(4);const i=await a.readString(4),n=r.f3[i];(0,s.A)(n)&&(t.codecpar.codecType=n),await a.skip(4),await a.skip(4),await a.skip(4);const d=e.size-24;if(d>0){const e=!o.isom&&await a.peekUint8()===d-1;e&&await a.skip(1),t.metadata.handlerName=await a.readString(d-(e?1:0))}}const p=e.size-Number(a.getPos()-d);p>0?await a.skip(p):p<0&&i.z3(`read hdlr error, size: ${e.size}, read: ${e.size-p}`,n,77)}},31421:(a,t,e)=>{e.d(t,{A:()=>d});var i=e(37837),s=e(14686),r=e(4624),n=e(67659);const o="src/avformat/formats/mov/parsing/hvcc.ts";async function d(a,t,e,d){const c=a.getPos();if(t.codecpar.codecId=173,e.size<=0)return;const p=(0,i.sY)(e.size),f=await a.readBuffer(e.size,(0,s.JW)(p,e.size));d.foundMoov?(t.sideData[1]=f.slice(),(0,i.Eb)(p)):(t.codecpar.extradata=p,t.codecpar.extradataSize=e.size,t.sideData[1]=f.slice()),n.XC(t,t.sideData[1]);const l=e.size-Number(a.getPos()-c);l>0?await a.skip(l):l<0&&r.z3(`read hevc error, size: ${e.size}, read: ${e.size-l}`,o,67)}},45248:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/mdhd.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);let d=BigInt(0),c=BigInt(0),p=0,f=BigInt(0);1===o?(d=await a.readUint64(),c=await a.readUint64(),p=await a.readUint32(),f=await a.readUint64()):(d=BigInt(Math.floor(await a.readUint32())),c=BigInt(Math.floor(await a.readUint32())),p=await a.readUint32(),f=BigInt(Math.floor(await a.readUint32()))),t.duration=f,t.timeBase.den=p,t.timeBase.num=1,t.metadata.creationTime=d,t.metadata.modificationTime=c;const l=await a.readUint16(),m=[];m[0]=l>>10&31,m[1]=l>>5&31,m[2]=31&l;const u=String.fromCharCode(m[0]+96,m[1]+96,m[2]+96);t.metadata.language=l,t.metadata.languageString=u,await a.skip(2);const w=e.size-Number(a.getPos()-n);w>0?await a.skip(w):w<0&&i.z3(`read mdhd error, size: ${e.size}, read: ${e.size-w}`,s,83)}},7018:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/mfhd.ts";async function r(a,t,e,r){const n=a.getPos();await a.readUint8(),await a.skip(3),r.currentFragment.sequence=await a.readUint32();const o=e.size-Number(a.getPos()-n);o>0?await a.skip(o):o<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-o}`,s,49)}},19354:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/mvhd.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3),1===o?(r.creationTime=await a.readUint64(),r.modificationTime=await a.readUint64(),r.timescale=await a.readUint32(),r.duration=await a.readUint64()):(r.creationTime=BigInt(Math.floor(await a.readUint32())),r.modificationTime=BigInt(Math.floor(await a.readUint32())),r.timescale=await a.readUint32(),r.duration=BigInt(Math.floor(await a.readUint32()))),r.rate=await a.readUint32(),r.volume=await a.readUint16()>>>8,await a.skip(10),r.matrix=new Uint32Array(9);for(let t=0;t<9;t++)r.matrix[t]=await a.readUint32();await a.skip(24),r.nextTrackId=await a.readUint32();const d=e.size-Number(a.getPos()-n);d>0?await a.skip(d):d<0&&i.z3(`read mvhd error, size: ${e.size}, read: ${e.size-d}`,s,70)}},68361:(a,t,e)=>{e.d(t,{A:()=>A});var i=e(91635),s=e(59299),r=e(63080),n=e(62831),o=e(6570),d=e(34136),c=e(15692),p=e(37213),f=e(45248),l=e(19354),m=e(27436),u=e(40179),w=e(35173),g=e(25778),h=e(7018),z=e(61807),v=e(67523),U=e(58996),k=e(65977);const A={[(0,k.A)("stts")]:i.A,[(0,k.A)("ctts")]:s.A,[(0,k.A)("stss")]:r.A,[(0,k.A)("stsz")]:n.A,[(0,k.A)("stz2")]:o.A,[(0,k.A)("stsc")]:d.A,[(0,k.A)("stco")]:c.A,[(0,k.A)("co64")]:p.A,[(0,k.A)("mdhd")]:f.A,[(0,k.A)("mvhd")]:l.A,[(0,k.A)("tkhd")]:m.A,[(0,k.A)("hdlr")]:u.A,[(0,k.A)("stsd")]:w.A,[(0,k.A)("trex")]:g.A,[(0,k.A)("mfhd")]:h.A,[(0,k.A)("tfhd")]:z.A,[(0,k.A)("tfdt")]:v.A,[(0,k.A)("trun")]:U.A}},15692:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/stco.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=[],c=await a.readUint32();if(0===o)for(let t=0;t<c;t++)d.push(BigInt(Math.floor(await a.readUint32())));t.privData.chunkOffsets=d;const p=e.size-Number(a.getPos()-n);p>0?await a.skip(p):p<0&&i.z3(`read stco error, size: ${e.size}, read: ${e.size-p}`,s,56)}},34136:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/stsc.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=t.privData,c=[],p=[],f=[],l=await a.readUint32();if(0===o)for(let t=0;t<l;t++)c.push(await a.readUint32()),p.push(await a.readUint32()),f.push(await a.readUint32());d.stscFirstChunk=c,d.stscSamplesPerChunk=p,d.stscSampleDescriptionIndex=f;const m=e.size-Number(a.getPos()-n);m>0?await a.skip(m):m<0&&i.z3(`read stsc error, size: ${e.size}, read: ${e.size-m}`,s,65)}},35173:(a,t,e)=>{e.d(t,{A:()=>v});var i=e(4624),s=e(65977),r=e(6660),n=e(73840),o=e(31421),d=e(60703),c=e(83561),p=e(38582),f=e(28412),l=e(28460),m=e(86528),u=e(41781),w=e(12869),g=e(7320),h=e(36868);const z="src/avformat/formats/mov/parsing/stsd.ts";async function v(a,t,e,v){const U=a.getPos(),k=await a.readUint8();await a.skip(3);const A=t.privData,I=await a.readUint32();for(let e=0;e<I;e++){const e=await a.readUint32(),U=await a.readUint32(),I=a.getPos()+BigInt(Math.floor(e-8));if(r.uf[U]&&(t.codecpar.codecId=r.uf[U]),0===e){i.R8("stsd entry invalid box size 0, skip",z,73),await a.skip(Number(I-a.getPos()));break}if(e>=16?(await a.skip(6),await a.skip(2)):e<=7&&i.h2(`invalid size: ${e} in stsd`,z,86),0===t.codecpar.codecType){await a.skip(2),await a.skip(2),t.metadata.vendorId=await a.readString(4),await a.skip(4),await a.skip(4),t.codecpar.width=await a.readUint16(),t.codecpar.height=await a.readUint16(),await a.skip(4),await a.skip(4),await a.skip(4),await a.skip(2);let e=await a.readUint8();for(e>31&&(e=31),t.metadata.encoder=await a.readString(e),e<31&&await a.skip(31-e),await a.skip(2),await a.skip(2);a.getPos()<I;){const e=await a.readUint32(),r=await a.readUint32();0!==e?r===(0,s.A)("avcC")?await(0,n.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("hvcC")?await(0,o.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("vvcC")?await(0,d.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("av1C")?await(0,p.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("vpcC")?await(0,c.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("esds")?await(0,f.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("wave")?await(0,l.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("colr")?await(0,w.A)(a,t,{type:r,size:e-8},v):await a.skip(Math.min(e-8,Number(I-a.getPos()))):(i.R8("stsd video invalid box size 0, skip",z,135),await a.skip(Number(I-a.getPos())))}}else if(1===t.codecpar.codecType){const e=await a.readUint16();for(await a.skip(2),t.metadata.vendorId=await a.readString(4),t.codecpar.chLayout.nbChannels=await a.readUint16(),t.codecpar.bitsPerCodedSample=await a.readUint16(),A.audioCid=await a.readUint16(),await a.skip(2),t.codecpar.sampleRate=await a.readUint32()>>>16,(!v.isom||0===k&&e>0)&&(1===e?(A.samplesPerFrame=await a.readUint32(),await a.skip(4),A.bytesPerFrame=await a.readUint32(),await a.skip(4)):2===e&&(await a.skip(4),t.codecpar.sampleRate=Number(await a.readUint64()),t.codecpar.chLayout.nbChannels=await a.readUint32(),await a.skip(4),t.codecpar.bitsPerCodedSample=await a.readUint32(),await a.skip(4),A.bytesPerFrame=await a.readUint32(),A.samplesPerFrame=await a.readUint32()));a.getPos()<I;){const e=await a.readUint32(),r=await a.readUint32();0!==e?r===(0,s.A)("esds")?await(0,f.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("dfLa")?await(0,m.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("dOps")?await(0,u.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("wave")?await(0,l.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("dac3")?await(0,g.A)(a,t,{type:r,size:e-8},v):r===(0,s.A)("dec3")?await(0,h.A)(a,t,{type:r,size:e-8},v):await a.skip(Math.min(e-8,Number(I-a.getPos()))):(i.R8("stsd audio invalid box size 0, skip",z,282),await a.skip(Number(I-a.getPos())))}}else 3===t.codecpar.codecType?(U===(0,s.A)("stpp")?t.codecpar.codecId=94232:U===(0,s.A)("wvtt")?t.codecpar.codecId=94226:U===(0,s.A)("tx3g")||U===(0,s.A)("text")?t.codecpar.codecId=94213:U===(0,s.A)("c608")&&(t.codecpar.codecId=94218),await a.skip(Math.min(e-8,Number(I-a.getPos())))):await a.skip(Math.min(e-8,Number(I-a.getPos())))}const b=e.size-Number(a.getPos()-U);b>0?await a.skip(b):b<0&&i.z3(`read stsd error, size: ${e.size}, read: ${e.size-b}`,z,383)}},63080:(a,t,e)=>{e.d(t,{A:()=>o});var i=e(80662),s=e.n(i),r=e(4624);const n="src/avformat/formats/mov/parsing/stss.ts";async function o(a,t,e,i){const o=a.getPos(),d=await a.readUint8();await a.skip(3);const c=new(s()),p=await a.readUint32();if(0===d)for(let t=0;t<p;t++)c.set(await a.readUint32(),!0);t.privData.stssSampleNumbersMap=c;const f=e.size-Number(a.getPos()-o);f>0?await a.skip(f):f<0&&r.z3(`read stss error, size: ${e.size}, read: ${e.size-f}`,n,57)}},62831:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/stsz.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=[];let c=0,p=0;if(0===o){c=await a.readUint32(),p=await a.readUint32();for(let t=0;t<p;t++)0===c?d.push(await a.readUint32()):d[t]=c}t.privData.sampleSizes=d;const f=e.size-Number(a.getPos()-n);f>0?await a.skip(f):f<0&&i.z3(`read stsz error, size: ${e.size}, read: ${e.size-f}`,s,65)}},91635:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/stts.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=t.privData,c=[],p=[],f=await a.readUint32();let l=1;if(0===o)for(let t=0;t<f;t++)c.push(await a.readUint32()),l=await a.readInt32(),l<0&&i.R8("File uses negative stts sample delta, using value 1 instead, sync may be lost!",s,53),p.push(l);d.sttsSampleCounts=c,d.sttsSampleDeltas=p;const m=e.size-Number(a.getPos()-n);m>0?await a.skip(m):m<0&&i.z3(`read stts error, size: ${e.size}, read: ${e.size-m}`,s,67)}},6570:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/stz2.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=[];let c=0,p=0;if(0===o)if(await a.skip(3),p=await a.readUint8(),c=await a.readUint32(),4===p)for(let t=0;t<c;t+=2){const e=await a.readUint8();d[t]=e>>4&15,d[t+1]=15&e}else if(8===p)for(let t=0;t<c;t++)d[t]=await a.readUint8();else if(16===p)for(let t=0;t<c;t++)d[t]=await a.readUint16();else i.z3("Error in length field in stz2 box",s,67);t.privData.sampleSizes=d;const f=e.size-Number(a.getPos()-n);f>0?await a.skip(f):f<0&&i.z3(`read stz2 error, size: ${e.size}, read: ${e.size-f}`,s,78)}},67523:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/tfdt.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8();await a.skip(3);const d=r.currentFragment.currentTrack;d&&(d.baseMediaDecodeTime=1===o?await a.readUint64():BigInt(Math.floor(await a.readUint32())));const c=e.size-Number(a.getPos()-n);c>0?await a.skip(c):c<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-c}`,s,57)}},61807:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/tfhd.ts";async function r(a,t,e,r){const n=a.getPos(),o=(await a.readUint8(),await a.readUint24()),d=await a.readUint32(),c=r.currentFragment.currentTrack;c.trackId=d,c&&(1&o&&(c.baseDataOffset=await a.readUint64()),2&o&&await a.skip(4),8&o&&(c.defaultSampleDuration=await a.readUint32()),16&o&&(c.defaultSampleSize=await a.readUint32()),32&o&&(c.defaultSampleFlags=await a.readUint32()),131072&o&&(c.baseIsMoof=!0));const p=e.size-Number(a.getPos()-n);p>0?await a.skip(p):p<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-p}`,s,75)}},27436:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/tkhd.ts";async function r(a,t,e,r){const n=t.privData,o=a.getPos(),d=await a.readUint8();n.flags=await a.readUint24(),1&n.flags&&(t.disposition|=1),1===d?(t.metadata.creationTime=await a.readUint64(),t.metadata.modificationTime=await a.readUint64(),n.trackId=await a.readUint32(),await a.skip(4),n.duration=await a.readUint64()):(t.metadata.creationTime=BigInt(Math.floor(await a.readUint32())),t.metadata.modificationTime=BigInt(Math.floor(await a.readUint32())),n.trackId=await a.readUint32(),await a.skip(4),n.duration=BigInt(Math.floor(await a.readUint32()))),await a.skip(8),n.layer=await a.readInt16(),n.alternateGroup=await a.readInt16(),n.volume=await a.readInt16()>>8,await a.skip(2);const c=[];n.matrix=new Int32Array(9);for(let t=0;t<9;t++)n.matrix[t]=await a.readInt32(),c[t]=8===t?n.matrix[t]/1073741824:n.matrix[t]/65536;n.width=await a.readUint32()>>16,n.height=await a.readUint32()>>16,t.metadata.matrix=c;const p=e.size-Number(a.getPos()-o);p>0?await a.skip(p):p<0&&i.z3(`read tkhd error, size: ${e.size}, read: ${e.size-p}`,s,91)}},25778:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/trex.ts";async function r(a,t,e,r){const n=a.getPos();await a.readUint8(),await a.skip(3);const o=await a.readUint32();await a.skip(4);const d=await a.readUint32(),c=await a.readUint32(),p=await a.readUint32();r.trexs.push({trackId:o,duration:d,size:c,flags:p});const f=e.size-Number(a.getPos()-n);f>0?await a.skip(f):f<0&&i.z3(`read trex error, size: ${e.size}, read: ${e.size-f}`,s,61)}},58996:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/formats/mov/parsing/trun.ts";async function r(a,t,e,r){const n=a.getPos(),o=await a.readUint8(),d=await a.readUint24(),c=r.currentFragment.currentTrack;if(c){c.sampleCount=await a.readUint32(),1&d&&(c.dataOffset=await a.readInt32()),4&d&&(c.firstSampleFlags=await a.readUint32());for(let t=0;t<c.sampleCount;t++)256&d&&c.sampleDurations.push(await a.readUint32()),512&d&&c.sampleSizes.push(await a.readUint32()),1024&d&&c.sampleFlags.push(await a.readUint32()),2048&d&&(0===o?c.sampleCompositionTimeOffset.push(await a.readUint32()):c.sampleCompositionTimeOffset.push(await a.readInt32()))}const p=e.size-Number(a.getPos()-n);p>0?await a.skip(p):p<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-p}`,s,79)}},83561:(a,t,e)=>{e.d(t,{A:()=>d});var i=e(37837),s=e(14686),r=e(4624),n=e(82014);const o="src/avformat/formats/mov/parsing/vpcc.ts";async function d(a,t,e,d){const c=a.getPos();if(await a.readUint8(),await a.skip(3),t.codecpar.codecId=167,e.size-4<=0)return;const p=(0,i.sY)(e.size-4),f=await a.readBuffer(e.size-4,(0,s.JW)(p,e.size-4));d.foundMoov?(t.sideData[1]=f.slice(),(0,i.Eb)(p)):(t.codecpar.extradata=p,t.codecpar.extradataSize=e.size-4,t.sideData[1]=f.slice()),n.XC(t,t.sideData[1]);const l=e.size-Number(a.getPos()-c);l>0?await a.skip(l):l<0&&r.z3(`read vpcc error, size: ${e.size}, read: ${e.size-l}`,o,71)}},60703:(a,t,e)=>{e.d(t,{A:()=>d});var i=e(37837),s=e(14686),r=e(4624),n=e(59166);const o="src/avformat/formats/mov/parsing/vvcc.ts";async function d(a,t,e,d){const c=a.getPos();if(await a.readUint8(),await a.skip(3),t.codecpar.codecId=196,e.size-4<=0)return;const p=(0,i.sY)(e.size-4),f=await a.readBuffer(e.size-4,(0,s.JW)(p,e.size-4));d.foundMoov?(t.sideData[1]=f.slice(),(0,i.Eb)(p)):(t.codecpar.extradata=p,t.codecpar.extradataSize=e.size-4,t.sideData[1]=f.slice()),n.XC(t,t.sideData[1]);const l=e.size-Number(a.getPos()-c);l>0?await a.skip(l):l<0&&r.z3(`read vvcc error, size: ${e.size}, read: ${e.size-l}`,o,71)}},28460:(a,t,e)=>{e.d(t,{A:()=>o});var i=e(4624),s=e(65977),r=e(28412);const n="src/avformat/formats/mov/parsing/wave.ts";async function o(a,t,e,o){const d=a.getPos(),c=d+BigInt(Math.floor(e.size));for(;a.getPos()<c;){const e=await a.readUint32(),d=await a.readUint32();0!==e?d===(0,s.A)("esds")?await(0,r.A)(a,t,{type:d,size:e-8},o):await a.skip(Math.min(e-8,Number(c-a.getPos()))):(i.R8("wave invalid box size 0, skip",n,47),await a.skip(Number(c-a.getPos())))}const p=e.size-Number(a.getPos()-d);p>0?await a.skip(p):p<0&&i.z3(`read vpcc error, size: ${e.size}, read: ${e.size-p}`,n,73)}},65977:(a,t,e)=>{e.d(t,{A:()=>r});var i=e(4624);const s="src/avformat/function/mktag.ts";function r(a){4!==a.length&&i.R8(`tag length is not 4, tag: ${a}`,s,30);let t=0;for(let e=0;e<4;e++)t=t<<8|a.charCodeAt(e);return t}},95832:(a,t,e)=>{e.d(t,{Bq:()=>f,Ij:()=>p,XC:()=>c,f7:()=>l,uF:()=>r});var i=e(77231),s=e(37246);const r={1:"Main",2:"LC",3:"LC",4:"LC",5:"HE",6:"HE"},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},o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,i.N_,i.N_,i.N_],d=[i.N_,1,2,3,4,5,6,7];function c(a,t){if(!t&&a.sideData[1]&&(t=a.sideData[1]),t){const{profile:e,sampleRate:s,channels:r}=function(a){let t=i.N_,e=i.N_,s=i.N_;var r,n;return a.length>=2&&(t=a[0]>>3&31,e=null!==(r=o[(7&a[0])<<1|a[1]>>7])&&void 0!==r?r:48e3,s=null!==(n=d[a[1]>>3&15])&&void 0!==n?n:2),{profile:t,sampleRate:e,channels:s}}(t);a.codecpar.profile=e,a.codecpar.sampleRate=s,a.codecpar.chLayout.nbChannels=r}}function p(a){const t=n[a.sampleRate],e=a.chLayout.nbChannels,s=a.profile===i.N_?2:a.profile,r=new Uint8Array(2);return r[0]=(31&s)<<3|(14&t)>>1,r[1]=(1&t)<<7|(15&e)<<3,r}function f(a){if(a.length<7)return-1;const t=a[0]<<4|a[1]>>4;if(4095!==t)return-1;const e=1&a[1],i=(192&a[2])>>>6,s=(60&a[2])>>>2,r=(1&a[2])<<2|(192&a[3])>>>6,n=(3&a[3])<<11|a[4]<<3|(224&a[5])>>>5,c=3&a[6];let p=1===e?7:9,f=n-p;return{syncWord:t,profile:i+1,sampleRate:o[s],channels:d[r],aacFrameLength:n,numberOfRawDataBlocksInFrame:c,headerLength:p,framePayloadLength:f}}function l(a,t){function e(){const a=t.readU(2);let e=0;for(let i=0;i<=a;i++)e<<=8,e|=t.readU(8);return e}t||(t=new s.A).appendBuffer(a);const i=t.getPointer(),r={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;r.syncWord=n,r.muxLengthBytes=t.readU(13);const c=1===t.readU1();if(r.useSameStreamMux=c,!c){const a=1===t.readU1();if(a&&1===t.readU1())return-1;if(a&&e(),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=a?e():0;const s=t.readU(5);i-=5;const n=t.readU(4);i-=4;const c=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(a)e();else{let a=0;for(;;){a<<=8;const e=1===t.readU1();if(a+=t.readU(8),!e)break}}1===t.readU1()&&t.readU(8),r.profile=s+1,r.sampleRate=o[n],r.channels=d[c]}let p=0;for(;;){const a=t.readU(8);if(p+=a,255!==a)break}return r.framePayloadLength=p,r.headerLength=t.getPointer()-i+(8===t.getBitLeft()?0:1),r}},87518:(a,t,e)=>{e.d(t,{R:()=>m,j:()=>s});var i=e(37246);const s=[3,4,3,7,259,263,1539,1543],r=[[64,69,96],[64,70,96],[80,87,120],[80,88,120],[96,104,144],[96,105,144],[112,121,168],[112,122,168],[128,139,192],[128,140,192],[160,174,240],[160,175,240],[192,208,288],[192,209,288],[224,243,336],[224,244,336],[256,278,384],[256,279,384],[320,348,480],[320,349,480],[384,417,576],[384,418,576],[448,487,672],[448,488,672],[512,557,768],[512,558,768],[640,696,960],[640,697,960],[768,835,1152],[768,836,1152],[896,975,1344],[896,976,1344],[1024,1114,1536],[1024,1115,1536],[1152,1253,1728],[1152,1254,1728],[1280,1393,1920],[1280,1394,1920]],n=[4,5,6,5],o=[4,6,7,6],d=[48e3,44100,32e3,0],c=[32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640],p=[2,1,2,3,3,4,4,5],f=[1,2,3,6],l=7;function m(a){const t=new i.A(a.length);t.appendBuffer(a);const e={syncWord:0,crc1:0,srCode:0,bitstreamId:0,bitstreamMode:0,channelMode:0,lfeOn:0,frameType:0,substreamId:0,centerMixLevel:0,surroundMixLevel:0,channelMap:0,numBlocks:0,dolbySurroundMode:0,srShift:0,sampleRate:0,bitrate:0,channels:0,frameSize:0,channelLayout:BigInt(0),ac3BitrateCode:0};if(e.syncWord=t.readU(16),2935!==e.syncWord)return-1;if(e.bitstreamId=31&t.peekU(29),e.bitstreamId>16)return-2;if(e.numBlocks=6,e.ac3BitrateCode=-1,e.centerMixLevel=5,e.surroundMixLevel=6,e.dolbySurroundMode=0,e.bitstreamId<=10){if(e.crc1=t.readU(16),e.srCode=t.readU(2),3===e.srCode)return-3;const a=t.readU(6);if(a>37)return-4;e.ac3BitrateCode=a>>1,t.readU(5),e.bitstreamMode=t.readU(3),e.channelMode=t.readU(3),2==e.channelMode?e.dolbySurroundMode=t.readU(2):(1&e.channelMode&&1!=e.channelMode&&(e.centerMixLevel=n[t.readU(2)]),4&e.channelMode&&(e.surroundMixLevel=o[t.readU(2)])),e.lfeOn=t.readU(1),e.srShift=Math.max(e.bitstreamId,8)-8,e.sampleRate=d[e.srCode]>>e.srShift,e.bitrate=1e3*c[e.ac3BitrateCode]>>e.srShift,e.channels=p[e.channelMode]+e.lfeOn,e.frameSize=2*r[a][e.srCode],e.frameType=2,e.substreamId=0}else{if(e.crc1=0,e.frameType=t.readU(2),3==e.frameType)return-5;if(e.substreamId=t.readU(3),e.frameSize=t.readU(11)+1<<1,e.frameSize<l)return-6;if(e.srCode=t.readU(2),3==e.srCode){const a=t.readU(2);if(3==a)return-7;e.sampleRate=d[a]/2,e.srShift=1}else e.numBlocks=f[t.readU(2)],e.sampleRate=d[e.srCode],e.srShift=0;e.channelMode=t.readU(3),e.lfeOn=t.readU(1),e.bitrate=8*e.frameSize*e.sampleRate/(256*e.numBlocks),e.channels=p[e.channelMode]+e.lfeOn}return e.channelLayout=BigInt(s[e.channelMode]),e.lfeOn&&(e.channelLayout|=BigInt(8)),e}},21477:(a,t,e)=>{e.d(t,{Ui:()=>n,XC:()=>r,zk:()=>s});var i=e(37246);e(83314),e(97317);const s={0:"Main",1:"High",2:"Professional"};function r(a,t){if(!t&&a.sideData[1]&&(t=a.sideData[1]),t&&t.length>=4){const e=n(t);a.codecpar.profile=e.profile,a.codecpar.level=e.level}}function n(a){const t=new i.A(a.length);t.appendBuffer(a),t.readU1(),t.readU(7);const e=t.readU(3),s=t.readU(5),r=t.readU1();let n=t.readU1()?10:8;return t.readU1()&&(n=12),{profile:e,level:s,tier:r,bitDepth:n,monochrome:t.readU1(),chromaSubsamplingX:t.readU1(),chromaSubsamplingY:t.readU1(),chromaSamplePosition:t.readU(2)}}},22576:(a,t,e)=>{e.d(t,{Ij:()=>c,XC:()=>d,kt:()=>o});var i=e(31865),s=e(729),r=e(44328);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 o(a){let t=0,e=0,i=0;if(a.length<1)return 0;switch(t=a[0],e=n[t>>3],3&t){case 0:i=1;break;case 1:case 2:i=2;break;case 3:if(a.length<2)return 0;i=63&a[1]}return i*e}function d(a,t){if(!t&&a.sideData[1]&&(t=a.sideData[1]),t&&t.length>=19){const e=new i.A(t,!1);e.skip(9),a.codecpar.chLayout.nbChannels=e.readUint8(),a.codecpar.initialPadding=e.readUint16(),a.codecpar.sampleRate=e.readUint32(),a.codecpar.seekPreroll=Number((0,r.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function c(a){const t=new Uint8Array(19),e=new s.A(t,!1);return e.writeString("OpusHead"),e.writeUint8(1),e.writeUint8(a.chLayout.nbChannels),e.writeUint16(a.initialPadding),e.writeUint32(a.sampleRate),t}},82014:(a,t,e)=>{e.d(t,{Ui:()=>n,XC:()=>r,wN:()=>s}),e(9599);var i=e(37246);e(77231),e(97317),e(729);const s={0:"Profile0",1:"Profile1",2:"Profile2",3:"Profile3"};function r(a,t){if(!t&&a.sideData[1]&&(t=a.sideData[1]),t&&t.length>=6){const e=n(t);a.codecpar.profile=e.profile,a.codecpar.level=e.level}}function n(a){const t=new i.A(a.length);return t.appendBuffer(a),{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)}}},null:()=>{}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[543],{58121:(t,i,e)=>{e.d(i,{A:()=>r});var s=e(134);class r{constructor(){(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"flags",void 0),(0,s.A)(this,"dataOffset",void 0),(0,s.A)(this,"hasVideo",void 0),(0,s.A)(this,"hasAudio",void 0),this.signature="FLV",this.version=1,this.flags=0,this.dataOffset=9,this.hasAudio=!1,this.hasVideo=!1}async read(t){this.signature=await t.readString(3),this.version=await t.readUint8(),this.flags=await t.readUint8(),this.dataOffset=await t.readUint32(),this.hasAudio=!!(4&this.flags),this.hasVideo=!!(1&this.flags)}write(t){this.flags=0,this.hasAudio&&(this.flags|=4),this.hasVideo&&(this.flags|=1),t.writeString(this.signature),t.writeUint8(this.version),t.writeUint8(this.flags),t.writeUint32(this.dataOffset)}}},68243:(t,i,e)=>{e.d(i,{A:()=>l});var s=e(134),r=e(35336),n=e(92647),a=e(4624),h=e(94889),o=e(9705),f=e(73040);class l{constructor(){(0,s.A)(this,"onMetaData",void 0),this.onMetaData={canSeekToEnd:!1}}async read(t,i){const e=t.getPos(),s=e+BigInt(Math.floor(i)),r=await(0,f.$x)(t,s),n=await(0,f.$x)(t,s);this[r]=n,s>t.getPos()&&await t.skip(Number(BigInt.asIntN(32,s-t.getPos())));const h=Number(t.getPos()-e),l=await t.readUint32();return h+11!==l?(a.R8(`script size not match, size: ${h+11}, previousTagSize: ${l}`,"src/avformat/formats/flv/FlvScriptTag.ts",64),o.LR):0}computeSize(){const t=[],i=new r.A;return i.onFlush=i=>(t.push(i.slice()),0),(0,f.bD)(i,"onMetaData"),(0,f.bD)(i,this.onMetaData),i.flush(),(0,n.A)(Uint8Array,t).length}write(t){if(this.onMetaData){const i=[],e=new r.A;e.onFlush=t=>(i.push(t.slice()),0),(0,f.bD)(e,"onMetaData"),(0,f.bD)(e,this.onMetaData),e.flush();const s=(0,n.A)(Uint8Array,i),a=t.getPos();h.xk(t,18,s.length,BigInt(0)),t.writeBuffer(s),t.writeUint32(Number(t.getPos()-a))}}dts2Position(t){if(this.canSeek()){let i=-1;const e=this.onMetaData.keyframes.times,s=this.onMetaData.keyframes.filepositions;let r;for(r=0;r<e.length;r++){if(e[r]===t){i=r;break}if(e[r]>t){i=Math.max(r-1,0);break}}return r&&r===e.length&&(i=e.length-1),{pos:s[i],dts:e[i]}}return{pos:-1,dts:-1}}position2DTS(t){if(this.canSeek()){let e=-1;const s=this.onMetaData.keyframes.times,r=this.onMetaData.keyframes.filepositions;let n=0;for(n=0;n<r.length;n++)if(r[n]>t){e=n;break}var i;return n===r.length?null!==(i=this.onMetaData.duration)&&void 0!==i?i:s[s.length-1]:s[e]}return-1}canSeek(){return!!(this.onMetaData.keyframes&&this.onMetaData.keyframes.filepositions&&this.onMetaData.keyframes.filepositions.length)}}},35028:(t,i,e)=>{e.d(i,{FJ:()=>s,U5:()=>r});const s={10:86018,2:86017,11:86051,1:69645,4:86049,5:86049,6:86049,7:65543,8:65542},r={7:27,12:173,13:196,9:12,2:4,3:86,4:92,5:106,6:131}},94889:(t,i,e)=>{function s(t,i,e,s){t.writeUint8(i),t.writeUint24(e),t.writeUint24(Number(s&BigInt(16777215))),t.writeUint8(Number(s>>BigInt(24)&BigInt(255))),t.writeUint24(0)}e.d(i,{xk:()=>s}),e(35028)},67543:(t,i,e)=>{e.r(i),e.d(i,{default:()=>b});var s=e(134),r=e(36773),n=e(14619),a=e(42383),h=e(82058),o=e(24175),f=e(34531),l=e(8507),u=e(35336),d=e(58121),p=e(68243),c=e(31865),w=e(73040),g=e(34677);class b extends r.A{constructor(...t){super(...t),(0,s.A)(this,"info",void 0),(0,s.A)(this,"socket",void 0),(0,s.A)(this,"session",void 0),(0,s.A)(this,"ioReader",void 0),(0,s.A)(this,"ioWriter",void 0),(0,s.A)(this,"flvWriter",void 0),(0,s.A)(this,"flvHeader",void 0),(0,s.A)(this,"packetQueue",void 0),(0,s.A)(this,"flvHeaderWrote",void 0),(0,s.A)(this,"hasMetadata",void 0),(0,s.A)(this,"bufferReader",void 0)}writeFlvData(t){this.flvWriter.writeUint8(t.type),this.flvWriter.writeUint24(t.payload.length),this.flvWriter.writeUint24(t.timestamp),this.flvWriter.writeUint8(t.timestamp>>24),this.flvWriter.writeUint24(0),this.flvWriter.writeBuffer(t.payload),this.flvWriter.writeUint32(t.payload.length+11),this.flvWriter.flush()}async handleRtmpPacket(t){if(this.flvHeaderWrote)this.writeFlvData(t);else{if(this.packetQueue.push(t),8===t.type)this.flvHeader.hasAudio=!0;else if(9===t.type)this.flvHeader.hasVideo=!0;else if(18===t.type&&(this.bufferReader?this.bufferReader.resetBuffer(t.payload):this.bufferReader=new c.A(t.payload),"onMetaData"===await w.$x(this.bufferReader,BigInt(t.payload.length)))){this.hasMetadata=!0;const i=await w.$x(this.bufferReader,BigInt(t.payload.length));this.flvHeader.hasAudio=(0,g.A)(i.audiocodecid),this.flvHeader.hasVideo=(0,g.A)(i.videocodecid)}if(this.packetQueue.length>10||this.hasMetadata){if(this.flvHeader.write(this.flvWriter),this.flvWriter.writeUint32(0),!this.hasMetadata&&this.session.getDuration()){const t=new p.A;t.onMetaData={duration:this.session.getDuration()},t.write(this.flvWriter)}this.packetQueue.forEach((t=>{this.writeFlvData(t)})),this.packetQueue.length=0,this.flvHeaderWrote=!0}}}async send(t){return this.socket?(await this.socket.send(t),0):-1048574}async open(t){this.info=t,this.status=1,3===t.subProtocol?(this.socket=new a.A(this.options),await this.socket.open({url:t.url,webtransportOptions:t.webtransportOptions})):(this.socket=new n.A(this.options),await this.socket.open({url:t.url})),this.ioReader=new o.A,this.ioReader.onFlush=async t=>this.socket.read(t),this.ioReader.onSeek=async t=>this.socket.seek(t),this.ioReader.onSize=async()=>this.socket.size(),this.ioWriter=new f.A,this.ioWriter.onFlush=async t=>this.socket.write(t),this.ioWriter.onSeek=async t=>this.socket.seek(t),this.flvWriter=new u.A,this.flvWriter.onFlush=t=>(this.readQueue.push(t.slice()),this.consume&&this.consume(),0),this.flvHeader=new d.A,this.packetQueue=[],this.flvHeaderWrote=!1,this.hasMetadata=!1,this.session=new h.A(this.ioReader,this.ioWriter,{isLive:this.options.isLive,isPull:!0}),this.session.onMediaPacket=async(t,i)=>this.handleRtmpPacket(t),this.session.onError=()=>{this.status=3,this.consume&&this.consume()},await this.session.handshake();const i=l.qg(this.info.uri),e=i.pathname.split("/");await this.session.connect(e[1],`rtmp://${i.host}${i.port?":"+i.port:""}/${e[1]}`);const s=e.slice(2);return this.session.play((s.length>1?s.join("/"):s[0])||""),0}async seek(t){return await this.session.seek(Number(t)),0}async size(){return BigInt(0)}async stop(){this.socket&&(await this.socket.stop(),this.socket=null),this.status=4}}},46084:(t,i,e)=>{e.d(i,{u:()=>r});var s=e(134);class r{constructor(t,i,e,r){(0,s.A)(this,"channelId",void 0),(0,s.A)(this,"type",void 0),(0,s.A)(this,"timestamp",void 0),(0,s.A)(this,"tsField",0),(0,s.A)(this,"extra",0),(0,s.A)(this,"payload",void 0),this.channelId=t,this.type=i,this.timestamp=e,this.payload=r instanceof Uint8Array?r:new Uint8Array(r)}}},82058:(t,i,e)=>{e.d(i,{A:()=>U});var s=e(134),r=e(80662),n=e.n(r),a=e(54001),h=e.n(a),o=e(46084),f=e(90519),l=e(86932),u=e(729),d=e(68680),p=e(73040),c=e(98951),w=e(31865),g=e(4624),b=e(72739),y=e(67672),m=e(13724),k=e(83229);const v="src/avprotocol/rtmp/RtmpSession.ts";class U{constructor(t,i,e){(0,s.A)(this,"ioReader",void 0),(0,s.A)(this,"ioWriter",void 0),(0,s.A)(this,"prevReadPacket",void 0),(0,s.A)(this,"prevWritePacket",void 0),(0,s.A)(this,"inChunkSize",void 0),(0,s.A)(this,"outChunkSize",void 0),(0,s.A)(this,"seq",void 0),(0,s.A)(this,"bufferWriter",void 0),(0,s.A)(this,"bufferReader",void 0),(0,s.A)(this,"requestMap",void 0),(0,s.A)(this,"state",void 0),(0,s.A)(this,"maxSentUnacked",void 0),(0,s.A)(this,"receiveReportSize",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"options",void 0),(0,s.A)(this,"streamIdMap",void 0),(0,s.A)(this,"sendAsync",void 0),(0,s.A)(this,"onMediaPacket",void 0),(0,s.A)(this,"onError",void 0),this.ioReader=t,this.ioWriter=i,this.options=e,this.prevReadPacket=new(n()),this.prevWritePacket=new(n()),this.requestMap=new(n()),this.streamIdMap=new(n()),this.inChunkSize=128,this.outChunkSize=128,this.seq=0,this.maxSentUnacked=25e5,this.receiveReportSize=1048576,this.sendAsync=new k.an,this.bufferWriter=new u.A(new Uint8Array(1)),this.bufferReader=new w.A(new Uint8Array(1)),this.state=0}async handshake(){const t=(0,l.A)();await this.ioWriter.writeUint8(3),await this.ioWriter.writeUint32(0),await this.ioWriter.writeUint32(0);const i=new Uint8Array(1528);f.y(i),await this.ioWriter.writeBuffer(i),await this.ioWriter.flush(),await this.ioReader.readUint8();const e=await this.ioReader.readUint32();await this.ioReader.skip(4);const s=await this.ioReader.readBuffer(1528);await this.ioWriter.writeUint32(e),await this.ioWriter.writeUint32((0,l.A)()-t),await this.ioWriter.writeBuffer(s),await this.ioWriter.flush(),await this.ioReader.skip(1536),this.readRtmpPacket()}async sendPacket(t){await(0,k.s2)(this.sendAsync),await(0,c.U)(this.ioWriter,this.outChunkSize,t,this.prevWritePacket.get(t.channelId)),this.prevWritePacket.set(t.channelId,t),(0,k.Tl)(this.sendAsync)}async readPacket(){const t=await(0,c.w)(this.ioReader,this.inChunkSize,this.prevReadPacket);return this.prevReadPacket.set(t.channelId,t),t}handleChunkSize(t){t.payload.length>=4&&(this.bufferReader.resetBuffer(t.payload),this.inChunkSize=this.bufferReader.readUint32())}handleUserControl(t){t.payload.length>=2&&(this.bufferReader.resetBuffer(t.payload),6===this.bufferReader.readUint16()&&this.sendPong(t,this.bufferReader.readUint32()))}handleSetPeerBW(t){t.payload.length>=4&&(this.bufferReader.resetBuffer(t.payload),this.maxSentUnacked=this.bufferReader.readUint32(),g.Yz(`Max sent, unacked = ${this.maxSentUnacked}`,v,205))}handleWindowSizeACK(t){t.payload.length>=4&&(this.bufferReader.resetBuffer(t.payload),this.receiveReportSize=this.bufferReader.readUint32(),g.Yz(`Window acknowledgement size = ${this.receiveReportSize}`,v,212),this.receiveReportSize>>=1)}async handleInvoke(t){this.bufferReader.resetBuffer(t.payload);const i=BigInt(t.payload.length),e=await p.$x(this.bufferReader,i),s=await p.$x(this.bufferReader,i);if("_result"===e||"_error"===e){if(this.requestMap.has(s)){const t=await p.$x(this.bufferReader,i),r=await p.$x(this.bufferReader,i);"_result"===e?this.requestMap.get(s).resolve({options:t,info:r}):this.requestMap.get(s).reject({options:t,info:r}),this.requestMap.delete(s)}}else if("onStatus"===e){const t=await p.$x(this.bufferReader,i);let e=await p.$x(this.bufferReader,i);if("error"===e.level)g.z3(`Server error: ${e.description}, ${e.code}`,v,248),this.requestMap.has(s)?(this.requestMap.get(s).reject({options:t,info:e}),this.requestMap.delete(s)):this.onError&&this.onError();else{switch(e.code){case"NetStream.Play.Start":case"NetStream.Seek.Notify":this.state=3;break;case"NetStream.Play.Stop":case"NetStream.Play.UnpublishNotify":this.state=8;break;case"NetStream.Publish.Start":this.state=5}this.requestMap.has(s)&&(this.requestMap.get(s).resolve({options:t,info:e}),this.requestMap.delete(s))}}else"onBWDone"===e&&await this.sendCheckBW()}async handleNotify(t){this.bufferReader.resetBuffer(t.payload),"@setDataFrame"===await p.$x(this.bufferReader,BigInt(t.payload.length))&&(t.payload=t.payload.subarray(Number(this.bufferReader.getPos()))),t.payload.length&&this.onMediaPacket&&await this.onMediaPacket(t,this.streamIdMap.get(t.extra))}async readRtmpPacket(){for(;;)try{const t=await this.readPacket();switch(t.type){case 3:default:break;case 1:this.handleChunkSize(t);break;case 4:this.handleUserControl(t);break;case 6:this.handleSetPeerBW(t);break;case 5:this.handleWindowSizeACK(t);break;case 20:await this.handleInvoke(t);break;case 18:await this.handleNotify(t);break;case 22:case 8:case 9:this.onMediaPacket&&await this.onMediaPacket(t,this.streamIdMap.get(t.extra))}}catch(t){break}}async sendPong(t,i){if(t.payload.length<6)return void g.R8(`Too short ping packet (${t.payload.length})`,v,348);const e=new o.u(2,4,t.timestamp+1,6);this.bufferWriter.resetBuffer(e.payload),this.bufferWriter.writeUint16(7),this.bufferWriter.writeUint32(i),this.sendPacket(e)}async sendWindowAckSize(){const t=new o.u(2,5,0,4);this.bufferWriter.resetBuffer(t.payload),this.bufferWriter.writeUint32(this.maxSentUnacked),await this.sendPacket(t)}async sendBufferTime(t){const i=new o.u(2,4,1,10);this.bufferWriter.resetBuffer(i.payload),this.bufferWriter.writeUint16(3),this.bufferWriter.writeUint32(t),this.bufferWriter.writeUint32(this.options.clientBufferTime||3e3),await this.sendPacket(i)}async sendFCSubscribe(t){const i=new o.u(3,20,0,27+t.length);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"FCSubscribe"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async sendFCPublish(t){const i=new o.u(3,20,0,25+t.length);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"FCPublish"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async sendReleaseStream(t){const i=new o.u(3,20,0,29+t.length);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"releaseStream"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async sendCheckBW(){const t=new o.u(3,20,0,21);this.bufferWriter.resetBuffer(t.payload),p.bD(this.bufferWriter,"_checkbw"),p.bD(this.bufferWriter,++this.seq),p.bD(this.bufferWriter,null),await this.sendPacket(t)}async request(t,i){const e=new o.u(3,20,0,4096+d.iD);return this.bufferWriter.resetBuffer(e.payload),p.bD(this.bufferWriter,t),p.bD(this.bufferWriter,++this.seq),b.__(i,(t=>{p.bD(this.bufferWriter,t)})),e.payload=e.payload.subarray(0,this.bufferWriter.getPos()),new(h())(((t,i)=>{this.requestMap.set(this.seq,{resolve:t,reject:i}),this.sendPacket(e)}))}async connect(t,i){await this.request("connect",[{app:t,fourCcList:["hvc1","av01","vp09"],flashVer:"LNX 9,0,124,2",tcUrl:i,fpad:0,capabilities:15,audioCodecs:4071,videoCodecs:252,videoFunction:1}]),this.options.isPull&&await this.sendWindowAckSize()}async createStream(){return(await this.request("createStream",[null])).info}async play(t){const i=await this.createStream();if(this.streamIdMap.set(i,t),!this.options.isLive){const i=await h().race([this.request("getStreamLength",[null,t]),new m.A(1)]);y.ai(i)||(this.duration=i.info)}await this.sendFCSubscribe(t),this.request("play",[null,t,-1,-1,!0]),await this.sendBufferTime(i)}async publish(t){await this.sendReleaseStream(t),await this.sendFCPublish(t);const i=await this.createStream();this.streamIdMap.set(i,t),await this.request("publish",[null,t,"live"])}async sendStreamPacket(t,i){let e=0;this.streamIdMap.forEach(((t,s)=>{t===i&&(e=s)})),t.extra=e,await this.sendPacket(t)}async seek(t){const i=new o.u(3,20,0,26);this.bufferWriter.resetBuffer(i.payload),p.bD(this.bufferWriter,"seek"),p.bD(this.bufferWriter,0),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),await this.sendPacket(i)}async pause(t,i){const e=new o.u(3,20,0,29);this.bufferWriter.resetBuffer(e.payload),p.bD(this.bufferWriter,"pause"),p.bD(this.bufferWriter,0),p.bD(this.bufferWriter,null),p.bD(this.bufferWriter,t),p.bD(this.bufferWriter,i),await this.sendPacket(e)}getDuration(){return this.duration}}},68680:(t,i,e)=>{e.d(i,{iD:()=>s});const s=1024},98951:(t,i,e)=>{e.d(i,{U:()=>o,w:()=>f});var s=e(46084),r=e(92647),n=e(4624);const a="src/avprotocol/rtmp/util.ts";async function h(t,i,e){if(i<64)await t.writeUint8(i|e<<6);else if(i<320)await t.writeUint8(e<<6),await t.writeUint8(i-64);else{await t.writeUint8(1|e<<6);const s=i-64;await t.writeUint8(255&s),await t.writeUint8(s>>>8)}}async function o(t,i,e,s){const r=s&&s.extra===e.extra&&e.timestamp>=s.timestamp;let n=e.timestamp;r&&(n-=s.timestamp),e.tsField=n>16777215?16777215:n;let a=0;r&&(e.type===s.type&&e.payload.length===s.payload.length?(a=2,e.tsField===s.tsField&&(a=3)):a=1),await h(t,e.channelId,a),3!==a&&(await t.writeUint24(e.tsField),2!==a&&(await t.writeUint24(e.payload.length),await t.writeUint8(e.type),0===a&&(await t.writeUint8(e.extra),await t.writeUint8(e.extra>>8),await t.writeUint8(e.extra>>16),await t.writeUint8(e.extra>>24)))),16777215===e.tsField&&await t.writeUint32(n);let o=0;for(;o<e.payload.length;){const s=Math.min(i,e.payload.length-o);await t.writeBuffer(e.payload.subarray(o,o+s)),o+=s,o<e.payload.length&&(await h(t,e.channelId,3),16777215===e.tsField&&await t.writeUint32(n))}await t.flush()}async function f(t,i,e){const h=[],o=await t.readUint8();let f=63&o;f<2&&(f=0===await t.readUint8()?await t.readUint8()+64:64+(await t.readUint8()|await t.readUint8()<<8));const l=o>>>6,u=e.get(f);let d=u?u.payload.length:0,p=u?u.type:0,c=u?u.extra:0,w=0,g=0;if(3===l?w=u.tsField:(w=await t.readUint24(),2!==l&&(d=await t.readUint24(),p=await t.readUint8(),0===l&&(c=await t.readUint8(),c|=await t.readUint8()<<8,c|=await t.readUint8()<<16,c|=await t.readUint8()<<24))),g=16777215===w?await t.readUint32():w,0!==l&&(u?g+=u.timestamp:n.R8(`got invalid message fmt, channel id ${f} can not find prev message with fmt ${l}`,a,171)),d<i)h.push(await t.readBuffer(d));else{let e=d;for(;e;){const s=Math.min(i,e);if(h.push(await t.readBuffer(s)),e-=s,e){const i=63&await t.readUint8();i<2&&await t.skip(i+1),16777215===w&&await t.skip(4)}}}const b=new s.u(f,p,g,(0,r.A)(Uint8Array,h));return b.tsField=w,b.extra=c,b}},73040:(t,i,e)=>{e.d(i,{$x:()=>h,bD:()=>o});var s=e(67672),r=e(72739),n=e(95335);async function a(t,i){return{key:await t.readString(await t.readUint16()),value:await h(t,i)}}async function h(t,i){let e;switch(await t.readUint8()){case 0:e=await t.readDouble();break;case 1:e=!!await t.readUint8();break;case 2:e=await t.readString(await t.readUint16());break;case 3:for(e={};t.getPos()<i;){const{key:s,value:r}=await a(t,i);if(e[s]=r,9==(16777215&await t.peekUint24())){await t.skip(3);break}}break;case 8:for(e={},await t.skip(4);t.getPos()<i;){const{key:s,value:r}=await a(t,i);if(e[s]=r,9==(16777215&await t.peekUint24())){await t.skip(3);break}}break;case 9:case 5:e=null;break;case 10:e=[];const s=await t.readUint32();for(let r=0;r<s;r++)e.push(await h(t,i));break;case 11:const r=await t.readDouble(),n=await t.readInt16();e=new Date(r+60*n*1e3);break;case 12:e=await t.readString(await t.readUint32())}return e}function o(t,i){s.ai(i)?(t.writeUint8(0),t.writeDouble(i)):s.o(i)?(t.writeUint8(0),t.writeDouble(Number(i))):s.zM(i)?(t.writeUint8(1),t.writeUint8(i?1:0)):s.Yj(i)?i.length>=65536?(t.writeUint8(12),t.writeUint32(i.length),t.writeString(i)):(t.writeUint8(2),t.writeUint16(i.length),t.writeString(i)):s.YO(i)?(t.writeUint8(10),t.writeUint32(i.length),r.__(i,(i=>{o(t,i)}))):s.Ik(i)?(t.writeUint8(3),n.__(i,((i,e)=>{t.writeUint16(e.length),t.writeString(e),o(t,i)})),t.writeUint24(9)):i instanceof Date?(t.writeUint8(11),t.writeDouble(i.getTime()),t.writeInt16(0)):null==i&&t.writeUint8(5)}},90519:(t,i,e)=>{function s(t){crypto.getRandomValues(t)}e.d(i,{y:()=>s})},83229:(t,i,e)=>{e.d(i,{Tl:()=>o,an:()=>a,s2:()=>h});var s=e(134),r=e(54001),n=e.n(r);class a{constructor(){(0,s.A)(this,"list",[])}}async function h(t){return new(n())((i=>{t.list.push(i),1===t.list.length&&i()}))}function o(t){t.list.shift(),t.list.length&&t.list[0]()}},6498:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(67672),r=e(72739);function n(t,i){const e=[];return s.ai(t)&&(t+=""),t&&s.Yj(t)&&r.__(t.split(i),((t,i)=>{(t=t.trim())&&e.push(t)})),e}},24175:(t,i,e)=>{e.d(i,{A:()=>o});var s=e(134),r=e(4624),n=e(50011),a=e(13724);const h="src/common/io/IOReader.ts";class o{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"fileSize_",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),(0,s.A)(this,"onSize",void 0),(0,s.A)(this,"flags",void 0),this.pos=BigInt(0),this.pointer=0,this.error=0,this.endPointer=0,this.littleEndian=!i,this.flags=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.size=Math.max(t,102400),this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}async readUint8(){this.remainingLength()<1&&await this.flush(1);const t=this.data.getUint8(this.pointer);return this.pointer++,this.pos++,t}async peekUint8(){return this.remainingLength()<1&&await this.flush(1),this.data.getUint8(this.pointer)}async readUint16(){this.remainingLength()<2&&await this.flush(2);const t=this.data.getUint16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}async peekUint16(){return this.remainingLength()<2&&await this.flush(2),this.data.getUint16(this.pointer,this.littleEndian)}async readUint24(){this.remainingLength()<3&&await this.flush(3);const t=await this.readUint16(),i=await this.readUint8();return this.littleEndian?i<<16|t:t<<8|i}async peekUint24(){this.remainingLength()<3&&await this.flush(3);const t=this.pointer,i=this.pos,e=await this.readUint16(),s=await this.readUint8(),r=this.littleEndian?s<<16|e:e<<8|s;return this.pointer=t,this.pos=i,r}async readUint32(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getUint32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekUint32(){return this.remainingLength()<4&&await this.flush(4),this.data.getUint32(this.pointer,this.littleEndian)}async readUint64(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getBigUint64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekUint64(){return this.remainingLength()<8&&await this.flush(8),this.data.getBigUint64(this.pointer,this.littleEndian)}async readInt8(){this.remainingLength()<1&&await this.flush(1);const t=this.data.getInt8(this.pointer);return this.pointer++,this.pos++,t}async peekInt8(){return this.remainingLength()<1&&await this.flush(1),this.data.getInt8(this.pointer)}async readInt16(){this.remainingLength()<2&&await this.flush(2);const t=this.data.getInt16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}async peekInt16(){return this.remainingLength()<2&&await this.flush(2),this.data.getInt16(this.pointer,this.littleEndian)}async readInt24(){const t=await this.readUint24();return 8388608&t?t-16777216:t}async peekInt24(){const t=await this.peekUint24();return 8388608&t?t-16777216:t}async readInt32(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getInt32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekInt32(){return this.remainingLength()<4&&await this.flush(4),this.data.getInt32(this.pointer,this.littleEndian)}async readInt64(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getBigInt64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekInt64(){return this.remainingLength()<8&&await this.flush(8),this.data.getBigInt64(this.pointer,this.littleEndian)}async readFloat(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getFloat32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekFloat(){return this.remainingLength()<4&&await this.flush(4),this.data.getFloat32(this.pointer,this.littleEndian)}async readDouble(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getFloat64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekDouble(){return this.remainingLength()<8&&await this.flush(8),this.data.getFloat64(this.pointer,this.littleEndian)}async readHex(t=1){let i="";for(let e=0;e<t;e++){const t=(await this.readUint8()).toString(16);i+=1===t.length?"0"+t:t}return i}async peekHex(t=1){t>this.size&&(this.error=-1048574,r.h2("peekHex, length too large",h,414)),this.remainingLength()<t&&await this.flush(t);const i=this.pointer,e=this.pos;let s="";for(let i=0;i<t;i++){const t=(await this.readUint8()).toString(16);s+=1===t.length?"0"+t:t}return this.pointer=i,this.pos=e,s}async readBuffer(t,i){if(i||(i=new Uint8Array(t)),this.remainingLength()<t){let e=0;if(this.remainingLength()>0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){await this.flush();const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}}else i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t);return i}async peekBuffer(t,i){return t>this.size&&(this.error=-1048574,r.h2("peekBuffer, length too large",h,499)),this.remainingLength()<t&&await this.flush(t),i||(i=new Uint8Array(t)),i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),i}async readToBuffer(t,i){if(this.remainingLength()<t){let e=0;if(this.remainingLength()>0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){try{await this.flush()}catch(t){if(-1048576===this.error&&e)return e;throw t}const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}return e}return i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t),t}async readString(t=1){const i=await this.readBuffer(t);return n.decode(i)}async peekString(t=1){const i=await this.peekBuffer(t);return n.decode(i)}async readLine(){let t="";for(;;){let i=!1;for(let e=this.pointer;e<this.endPointer;e++)if(10===this.buffer[e]||13===this.buffer[e]){e!==this.pointer&&(t+=await this.readString(e-this.pointer)),i=!0;break}if(i)break;t+=await this.readString(this.remainingLength()),await this.flush()}let i=await this.peekUint8();return 10!==i&&13!==i||(this.pointer++,13===i&&(i=await this.peekUint8(),10===i&&this.pointer++)),t}async peekLine(){if(this.remainingLength()<this.size)try{await this.flush()}catch(t){if(-1048576!==this.error)throw t}let t="",i=!1;for(let e=this.pointer;e<this.endPointer;e++)if(10===this.buffer[e]||13===this.buffer[e]){t+=await this.peekString(e-this.pointer),i=!0;break}return i||(this.error=-1048574,r.h2("peekLine, out of buffer",h,657)),t}getPointer(){return this.pointer}getPos(){return this.pos}async skip(t){const i=t;for(;this.remainingLength()<t;)t-=this.remainingLength(),this.pointer=this.endPointer,await this.flush();this.remainingLength()>=t&&(this.pointer+=t),this.pos+=BigInt(i)}remainingLength(){return this.endPointer-this.pointer}async flush_(t){for(;;){const i=await this.onFlush(t);if(-1048575!==i)return i;await new a.A(0)}}async flush(t=0){if(this.onFlush||(this.error=-1048574,r.h2("IOReader error, flush failed because of no flush callback",h,731)),!(this.size-this.remainingLength()<=0)){if(t=Math.min(t,this.size),this.pointer<this.endPointer?(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer):this.endPointer=0,this.pointer=0,t)for(;this.remainingLength()<t;){const t=await this.flush_(this.buffer.subarray(this.endPointer));if(t<0)throw this.error=t,new Error(`IOReader error, flush ${-1048576===t?"ended":"failed"}, ret: ${t}`);this.endPointer+=t}else{const t=await this.flush_(this.buffer.subarray(this.endPointer));if(t<0)throw this.error=t,new Error(`IOReader error, flush ${-1048576===t?"ended":"failed"}, ret: ${t}`);this.endPointer+=t}this.error=0}}async seek(t,i=!1,e=!0){if(!i){const i=Number(t-this.pos);if(i<0&&Math.abs(i)<this.pointer)return this.pointer+=i,void(this.pos=t);if(i>0&&this.pointer+i<this.endPointer)return this.pointer+=i,void(this.pos=t);if(0===i)return}this.onSeek||(this.error=-1048574,r.h2("IOReader error, seek failed because of no seek callback",h,802)),this.pointer=this.endPointer=0,this.pos=t;const s=await this.onSeek(t);0!==s&&(this.error=s,r.h2("IOReader error, seek failed",h,811)),e&&await this.flush()}getBuffer(){return this.buffer}appendBuffer(t){if(this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else if(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer,this.pointer=0,this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else{const i=Math.min(this.size-this.endPointer,t.length);this.buffer.set(t.subarray(0,i),this.endPointer),this.endPointer+=i,r.R8("IOReader, call appendBuffer but the buffer's size is lagger then the remaining size",h,849)}}reset(){this.pointer=this.endPointer=0,this.pos=BigInt(0),this.error=0}setEndian(t){this.littleEndian=!t}async fileSize(){if(this.fileSize_)return this.fileSize_;if(!this.onSize)return r.R8("IOReader error, fileSize failed because of no onSize callback",h,882),BigInt(0);try{this.fileSize_=await this.onSize()}catch(t){r.R8(`IOReader error, call fileSize failed: ${t}`,h,889),this.fileSize_=BigInt(0)}return this.fileSize_}getBufferSize(){return this.size}async pipe(t,i){if(i)if(this.remainingLength()<i){if(this.remainingLength()>0){const e=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}for(;i>0;){await this.flush();const e=Math.min(this.remainingLength(),i);await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}}else await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i);else{if(this.remainingLength()>0){const i=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}for(;await this.flush_(this.buffer.subarray(0))>0;){const i=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}}}}},34531:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(134),r=e(50011);class n{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!i,this.error=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}async writeUint8(t){this.remainingLength()<1&&await this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}async writeUint16(t){this.remainingLength()<2&&await this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}async writeUint24(t){this.remainingLength()<3&&await this.flush();const i=(16711680&t)>>16,e=(65280&t)>>8,s=255&t;this.littleEndian?(await this.writeUint8(s),await this.writeUint8(e),await this.writeUint8(i)):(await this.writeUint8(i),await this.writeUint8(e),await this.writeUint8(s))}async writeUint32(t){this.remainingLength()<4&&await this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeUint64(t){this.remainingLength()<8&&await this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}async writeInt8(t){this.remainingLength()<1&&await this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}async writeInt16(t){this.remainingLength()<2&&await this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}async writeInt24(t){await this.writeUint24(t<0?t+16777216:t)}async writeInt32(t){this.remainingLength()<4&&await this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeInt64(t){this.remainingLength()<8&&await this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}async writeFloat(t){this.remainingLength()<4&&await this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeDouble(t){this.remainingLength()<8&&await this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}async writeBuffer(t){if(!t.length)return;let i=t.length;if(this.remainingLength()<i){let e=0;for(;i>0;){await this.flush();const s=Math.min(this.size,i);this.buffer.set(t.subarray(e,e+s),this.pointer),this.pointer+=s,this.pos+=BigInt(s),e+=s,i-=s}}else this.buffer.set(t,this.pointer),this.pointer+=i,this.pos+=BigInt(i)}async writeString(t){const i=r.encode(t);return await this.writeBuffer(i),i.length}async flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=await this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}async flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const i=await this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==i)throw this.error=i,Error("IOWriter error, flush failed")}this.pointer=0}async seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");await this.flush();const i=await this.onSeek(t);if(0!==i)throw this.error=i,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const i=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-i)}skip(t){const i=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-i)}back(t){const i=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-i)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},35336:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(134),r=e(50011);class n{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!i,this.error=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}writeUint8(t){this.remainingLength()<1&&this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}writeUint16(t){this.remainingLength()<2&&this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeUint24(t){this.remainingLength()<3&&this.flush();const i=(16711680&t)>>16,e=(65280&t)>>8,s=255&t;this.littleEndian?(this.writeUint8(s),this.writeUint8(e),this.writeUint8(i)):(this.writeUint8(i),this.writeUint8(e),this.writeUint8(s))}writeUint32(t){this.remainingLength()<4&&this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeUint64(t){this.remainingLength()<8&&this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeInt8(t){this.remainingLength()<1&&this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}writeInt16(t){this.remainingLength()<2&&this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.remainingLength()<4&&this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeInt64(t){this.remainingLength()<8&&this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeFloat(t){this.remainingLength()<4&&this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeDouble(t){this.remainingLength()<8&&this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}writeBuffer(t){if(!t.length)return;let i=t.length;if(this.remainingLength()<i){let e=0;for(;i>0;){this.flush();const s=Math.min(this.size,i);this.buffer.set(t.subarray(e,e+s),this.pointer),this.pointer+=s,this.pos+=BigInt(s),e+=s,i-=s}}else this.buffer.set(t,this.pointer),this.pointer+=i,this.pos+=BigInt(i)}writeString(t){const i=r.encode(t);return this.writeBuffer(i),i.length}flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const i=this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==i)throw this.error=i,Error("IOWriter error, flush failed")}this.pointer=0}seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");this.flush();const i=this.onSeek(t);if(0!==i)throw this.error=i,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const i=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-i)}skip(t){const i=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-i)}back(t){const i=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-i)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},8507:(t,i,e)=>{e.d(i,{ll:()=>w,mA:()=>a,qg:()=>h}),e(73146);var s=e(67672),r=e(6498),n=e(72739);function a(t,i="&"){const e={};if(s.Yj(t)&&t.indexOf("=")>=0){let s=t.charAt(0),a="?"===s||"#"===s?1:0;a>0&&(t=t.substr(a)),n.__((0,r.A)(t,i),(t=>{let i=t.split("=");if(2===i.length){var s;let t=null===(s=i[0])||void 0===s?void 0:s.trim();t&&(e[t]=decodeURIComponent(i[1]))}}))}return e}function h(t){const i=t,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],s=/:\/\/([^\/@]*@?)\[(\S+)\]/;let r="";s.test(t)&&(t=t.replace(s,((t,i,e)=>(r=e,`://${i||""}a.b`))));const n={},a=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);let h=14;for(;h--;){var o;n[e[h]]=null!==(o=a[h])&&void 0!==o?o:""}return r&&(n.host=r,n.source=i,n.authority=r+(n.port?":"+n.port:"")),{protocol:n.protocol,file:n.file,host:n.host,port:n.port,user:n.user,password:n.password,origin:`${n.protocol}://${n.authority}`,pathname:n.path,search:`?${n.query}`,hash:n.anchor?`#${n.anchor}`:""}}e(95335);const o=/(?:\/|^)\.(?=\/)/g,f=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l=/^(?=([^\/?#]*))\1([^]*)$/,u=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;function d(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}function p(t){const i=u.exec(t);return i?{scheme:i[1]||"",netLoc:i[2]||"",path:i[3]||"",params:i[4]||"",query:i[5]||"",fragment:i[6]||""}:null}function c(t){for(t=t.split("").reverse().join("").replace(o,"");t.length!==(t=t.replace(f,"")).length;);return t.split("").reverse().join("")}function w(t,i,e){if(e=e||{},t=t.trim(),!(i=i.trim())){if(!e.alwaysNormalize)return t;let i=p(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=c(i.path),d(i)}let s=p(i);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return e.alwaysNormalize?(s.path=c(s.path),d(s)):i;let r=p(t);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&"/"!==r.path[0]){let t=l.exec(r.path);r.netLoc=t[1],r.path=t[2]}r.netLoc&&!r.path&&(r.path="/");const n={scheme:r.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(n.netLoc=r.netLoc,"/"!==s.path[0]))if(s.path){let t=r.path,i=t.substring(0,t.lastIndexOf("/")+1)+s.path;n.path=c(i)}else n.path=r.path,s.params||(n.params=r.params,s.query||(n.query=r.query));return null===n.path&&(n.path=e.alwaysNormalize?c(s.path):s.path),d(n)}},85079:(t,i,e)=>{var s=e(46438),r=s.JSON||(s.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},73146:(t,i,e)=>{t.exports=e(85079)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[576],{41576:(e,t,i)=>{i.r(t),i.d(t,{default:()=>L});var s=i(134),a=i(80662),n=i.n(a),d=i(54001),o=i.n(d),r=i(13724),l=i(82800),m=i(95335),u=i(4624),h=i(78417),c=i(77580),g=i(86932),f=i(9705);const p="src/avnetwork/ioLoader/DashIOLoader.ts";class L extends l.A{constructor(...e){super(...e),(0,s.A)(this,"info",void 0),(0,s.A)(this,"range",void 0),(0,s.A)(this,"mediaPlayList",void 0),(0,s.A)(this,"fetchMediaPlayListPromise",void 0),(0,s.A)(this,"minBuffer",void 0),(0,s.A)(this,"audioResource",void 0),(0,s.A)(this,"videoResource",void 0),(0,s.A)(this,"subtitleResource",void 0)}createResource(e){return{type:e,fetchedMap:new(n()),fetchedHistoryList:[],loader:null,segmentIndex:0,currentUri:"",selectedIndex:0,segments:[],initSegmentPadding:"",initedSegment:""}}async fetchMediaPlayList(e){var t,i,s;if(!e){if(this.fetchMediaPlayListPromise)return;this.fetchMediaPlayListPromise=new(o())((t=>{e=t}))}const a={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};null!==(t=this.info.httpOptions)&&void 0!==t&&t.headers&&m.__(this.info.httpOptions.headers,((e,t)=>{a.headers[t]=e})),null!==(i=this.info.httpOptions)&&void 0!==i&&i.credentials&&(a.credentials=this.info.httpOptions.credentials),null!==(s=this.info.httpOptions)&&void 0!==s&&s.referrerPolicy&&(a.referrerPolicy=this.info.httpOptions.referrerPolicy);try{const t=await fetch(this.info.url,a),i=await t.text();if(this.mediaPlayList=(0,h.A)(i,this.info.url),this.minBuffer=this.mediaPlayList.minBufferTime,this.options.isLive){var n,d;const t=this.mediaPlayList.minBufferTime/this.mediaPlayList.maxSegmentDuration,i=Math.max(this.mediaPlayList.mediaList.audio&&(null===(n=this.mediaPlayList.mediaList.audio[0])||void 0===n?void 0:n.mediaSegments.length)||0,this.mediaPlayList.mediaList.video&&(null===(d=this.mediaPlayList.mediaList.video[0])||void 0===d?void 0:d.mediaSegments.length)||0);if(i<t)return await new r.A((t-i)*this.mediaPlayList.maxSegmentDuration),u.R8(`wait for min buffer time, buffer: ${i*this.mediaPlayList.maxSegmentDuration}, need: ${t*this.mediaPlayList.maxSegmentDuration}`,p,136),this.fetchMediaPlayList(e)}if("vod"===this.mediaPlayList.type?this.options.isLive=!1:this.options.isLive=!0,this.mediaPlayList.mediaList.audio.length){const e=this.mediaPlayList.mediaList.audio[this.audioResource.selectedIndex];e.file?this.audioResource.segments=[e.file]:this.options.isLive&&this.audioResource.initedSegment===e.initSegment?this.audioResource.segments=e.mediaSegments.map((e=>e.url)):(this.audioResource.segments=[e.initSegment].concat(e.mediaSegments.map((e=>e.url))),this.audioResource.initedSegment=e.initSegment)}if(this.mediaPlayList.mediaList.video.length){const e=this.mediaPlayList.mediaList.video[this.videoResource.selectedIndex];e.file?this.videoResource.segments=[e.file]:this.options.isLive&&this.videoResource.initedSegment===e.initSegment?this.videoResource.segments=e.mediaSegments.map((e=>e.url)):(this.videoResource.segments=[e.initSegment].concat(e.mediaSegments.map((e=>e.url))),this.videoResource.initedSegment=e.initSegment)}if(this.mediaPlayList.mediaList.subtitle.length){const e=this.mediaPlayList.mediaList.subtitle[this.subtitleResource.selectedIndex];e.file?this.subtitleResource.segments=[e.file]:this.options.isLive&&this.subtitleResource.initedSegment===e.initSegment?this.subtitleResource.segments=e.mediaSegments.map((e=>e.url)):(this.subtitleResource.segments=[e.initSegment].concat(e.mediaSegments.map((e=>e.url))),this.subtitleResource.initedSegment=e.initSegment)}return e(),this.fetchMediaPlayListPromise=null,this.status=2,this.retryCount=0,this.mediaPlayList}catch(t){if(this.retryCount<this.options.retryCount)return this.retryCount++,u.z3(`failed fetch mpd file, retry(${this.retryCount}/3)`,p,208),await new r.A(2===this.status?this.options.retryInterval:5),this.fetchMediaPlayList(e);this.status=3,e(),u.h2(`DashLoader: exception, fetch slice error, error: ${t.message}`,p,216)}}async open(e,t){return 0!==this.status?f.lh:(this.info=e,this.range=t,this.range.to||(this.range.to=-1),this.range.from=Math.max(this.range.from,0),this.videoResource=this.createResource("video"),this.audioResource=this.createResource("audio"),this.subtitleResource=this.createResource("subtitle"),this.status=1,this.retryCount=0,await this.fetchMediaPlayList(),0)}async readResource(e,t){let i=0;if(t.loader){if(i=await t.loader.read(e),-1048576!==i)return i;if(this.options.isLive)t.fetchedMap.set(t.currentUri,!0),10===t.fetchedHistoryList.length&&t.fetchedMap.delete(t.fetchedHistoryList.shift()),t.fetchedHistoryList.push(t.currentUri);else if(t.segmentIndex++,t.segmentIndex>=t.segments.length)return-1048576;t.loader=null}if(this.options.isLive){const i=t.segments.filter((e=>!t.fetchedMap.get(e)));if(!i.length){if(this.mediaPlayList.isEnd)return-1048576;const i=(this.mediaPlayList.duration||this.mediaPlayList.minimumUpdatePeriod)-((0,g.A)()-this.mediaPlayList.timestamp)/1e3;if(i>0&&await new r.A(Math.max(i,2)),this.fetchMediaPlayListPromise){if(await this.fetchMediaPlayListPromise,3===this.status)return-1048576}else await this.fetchMediaPlayList();return this.readResource(e,t)}return t.currentUri=i[0],t.loader=new c.A(m.X$({},this.options,{disableSegment:!0,loop:!1})),await t.loader.open(m.X$({},this.info,{url:t.currentUri}),{from:0,to:-1}),t.loader.read(e)}return t.loader=new c.A(m.X$({},this.options,{disableSegment:!0,loop:!1})),t.initSegmentPadding?(await t.loader.open(m.X$({},this.info,{url:t.initSegmentPadding}),{from:0,to:-1}),t.initSegmentPadding=null,t.segmentIndex--):await t.loader.open(m.X$({},this.info,{url:t.segments[t.segmentIndex]}),{from:0,to:-1}),t.loader.read(e)}async read(e,t){return"audio"===t.mediaType?this.readResource(e,this.audioResource):"video"===t.mediaType?this.readResource(e,this.videoResource):"subtitle"===t.mediaType?this.readResource(e,this.subtitleResource):f.UY}async seekResource(e,t){t.loader&&(await t.loader.abort(),t.loader=null);let i=Number(BigInt.asIntN(32,e));if(t.segments){let e=0;const s="audio"===t.type?this.mediaPlayList.mediaList.audio:"video"===t.type?this.mediaPlayList.mediaList.video:this.mediaPlayList.mediaList.subtitle,a=s[t.selectedIndex].mediaSegments;if(null!=a&&a.length)for(let t=0;t<a.length;t++)if(i>=1e3*a[t].start&&i<1e3*a[t].end){e=t;break}t.segmentIndex=e+(s[t.selectedIndex].initSegment?1:0)}}async seek(e,t){return"audio"===t.mediaType&&this.audioResource.loader&&await this.seekResource(e,this.audioResource),"video"===t.mediaType&&this.videoResource.loader&&await this.seekResource(e,this.videoResource),"subtitle"===t.mediaType&&this.subtitleResource.loader&&await this.seekResource(e,this.subtitleResource),4===this.status&&(this.status=2),0}async size(){return BigInt(0)}async abort(){this.videoResource.loader&&(await this.videoResource.loader.abort(),this.videoResource.loader=null),this.audioResource.loader&&(await this.audioResource.loader.abort(),this.audioResource.loader=null),this.subtitleResource.loader&&(await this.subtitleResource.loader.abort(),this.subtitleResource.loader=null)}async stop(){await this.abort(),this.status=0}getDuration(){return this.mediaPlayList.duration}hasVideo(){var e;return(null===(e=this.mediaPlayList)||void 0===e?void 0:e.mediaList.video.length)>0}hasAudio(){var e;return(null===(e=this.mediaPlayList)||void 0===e?void 0:e.mediaList.audio.length)>0}hasSubtitle(){var e;return(null===(e=this.mediaPlayList)||void 0===e?void 0:e.mediaList.subtitle.length)>0}getVideoList(){return this.hasVideo()?{list:this.mediaPlayList.mediaList.video.map((e=>({width:e.width,height:e.height,frameRate:e.frameRate,codecs:e.codecs}))),selectedIndex:this.videoResource.selectedIndex}:{list:[],selectedIndex:0}}getAudioList(){return this.hasAudio()?{list:this.mediaPlayList.mediaList.audio.map((e=>({lang:e.lang,codecs:e.codecs}))),selectedIndex:this.audioResource.selectedIndex}:{list:[],selectedIndex:0}}getSubtitleList(){return this.hasSubtitle()?{list:this.mediaPlayList.mediaList.subtitle.map((e=>({lang:e.lang,codecs:e.codecs}))),selectedIndex:this.subtitleResource.selectedIndex}:{list:[],selectedIndex:0}}selectVideo(e){if(e!==this.videoResource.selectedIndex&&this.hasVideo()&&e>=0&&e<this.mediaPlayList.mediaList.video.length){this.videoResource.selectedIndex=e;const t=this.mediaPlayList.mediaList.video[this.videoResource.selectedIndex];t.file?this.videoResource.segments=[t.file]:(this.videoResource.segments=[t.initSegment].concat(t.mediaSegments.map((e=>e.url))),this.videoResource.initSegmentPadding=t.initSegment)}}selectAudio(e){if(e!==this.audioResource.selectedIndex&&this.hasAudio()&&e>=0&&e<this.mediaPlayList.mediaList.audio.length){this.audioResource.selectedIndex=e;const t=this.mediaPlayList.mediaList.audio[this.audioResource.selectedIndex];t.file?this.audioResource.segments=[t.file]:(this.audioResource.segments=[t.initSegment].concat(t.mediaSegments.map((e=>e.url))),this.audioResource.initSegmentPadding=t.initSegment)}}selectSubtitle(e){if(e!==this.subtitleResource.selectedIndex&&this.hasSubtitle()&&e>=0&&e<this.mediaPlayList.mediaList.subtitle.length){this.subtitleResource.selectedIndex=e;const t=this.mediaPlayList.mediaList.subtitle[this.subtitleResource.selectedIndex];t.file?this.subtitleResource.segments=[t.file]:(this.subtitleResource.segments=[t.initSegment].concat(t.mediaSegments.map((e=>e.url))),this.subtitleResource.initSegmentPadding=t.initSegment)}}getMinBuffer(){return this.minBuffer}}},78417:(e,t,i)=>{i.d(t,{A:()=>g});var s=i(88032),a=i.n(s),n=i(29967),d=i.n(n),o=i(79331),r=i(67672),l=i(62100),m=i(86932);function u(e){let t=0,i=0,s=0;return(e=e.slice(e.indexOf("PT")+2)).indexOf("H")>-1&&e.indexOf("M")>-1&&e.indexOf("S")>-1?(t=a()(e.slice(0,e.indexOf("H"))),i=a()(e.slice(e.indexOf("H")+1,e.indexOf("M"))),s=a()(e.slice(e.indexOf("M")+1,e.indexOf("S")))):e.indexOf("H")<0&&e.indexOf("M")>0&&e.indexOf("S")>-1?(i=a()(e.slice(0,e.indexOf("M"))),s=a()(e.slice(e.indexOf("M")+1,e.indexOf("S")))):e.indexOf("H")<0&&e.indexOf("M")<0&&e.indexOf("S")>-1&&(s=a()(e.slice(0,e.indexOf("S")))),3600*t+60*i+s}function h(e,t){return(Array(t).join("0")+e).slice(-t)}function c(e){if(!e)return 0;if(e.indexOf("/")>-1){const t=e.split("/");return a()(t[0])/a()(t[1])}return a()(e)}function g(e,t){const i={source:e,mediaList:{audio:[],video:[],subtitle:[]},type:"live",isEnd:!1,duration:0,minBufferTime:0,maxSegmentDuration:0,minimumUpdatePeriod:0,timestamp:(0,m.A)()},s=[],n=(g=e,g?(0,o.A)(g,{aloneValueName:"value"}):null).MPD;var g;"static"===n.type&&(i.type="vod",i.isEnd=!0),n.minBufferTime&&(i.minBufferTime=u(n.minBufferTime)),n.maxSegmentDuration&&(i.maxSegmentDuration=u(n.maxSegmentDuration)),n.minimumUpdatePeriod&&(i.minimumUpdatePeriod=u(n.minimumUpdatePeriod)),n.mediaPresentationDuration&&(i.duration=u(n.mediaPresentationDuration));let f="";n.BaseURL&&(f=r.Yj(n.BaseURL)?n.BaseURL:n.BaseURL.value);const p=r.YO(n.Period)?n.Period[0]:n.Period;return!i.duration&&p&&p.duration&&(i.duration=u(p.duration)),(r.YO(p.AdaptationSet)?p.AdaptationSet:[p.AdaptationSet]).forEach(((e,n)=>{let o="video/mp4",m="avc1.64001E",u=640,g=360,p=640,L=360,S=25,R="1:1",y="1",P=588633,b=f,v="und";e.BaseURL&&(b+=e.BaseURL),e.lang&&(v=e.lang),e.mimeType?(o=e.mimeType,"video/mp4"===o?(m=e.codecs,u=a()(e.width),g=a()(e.height),e.maxWidth&&(p=a()(e.maxWidth)),e.maxHeight&&(L=a()(e.maxHeight)),e.frameRate&&(S=c(e.frameRate)),R=e.sar,y=e.startWithSAP,P=a()(e.bandwidth)):"audio/mp4"===o&&(m=e.codecs,y=e.startWithSAP,P=a()(e.bandwidth))):(e.maxWidth&&(p=a()(e.maxWidth)),e.maxHeight&&(L=a()(e.maxHeight)),e.frameRate&&(S=c(e.frameRate))),(r.YO(e.Representation)?e.Representation:[e.Representation]).forEach(((n,c)=>{s.indexOf(n.id)>-1&&(n.id=(d()(s[s.length-1])+1).toString()),s.push(n.id);let f="";const x=[];let w=0,A=0,I=t.slice(0,t.lastIndexOf("/")+1)+b;n.mimeType&&(o=n.mimeType),"video/mp4"===o?(n.codecs&&(m=n.codecs),n.width&&(u=a()(n.width)),n.height&&(g=a()(n.height)),n.maxWidth&&(p=a()(n.maxWidth)),n.maxHeight&&(L=a()(n.maxHeight)),n.frameRate&&(S=a()(n.frameRate)),n.sar&&(R=n.sar),n.startWithSAP&&(y=n.startWithSAP),n.bandwidth&&(P=a()(n.bandwidth))):(n.codecs&&(m=n.codecs),n.startWithSAP&&(y=n.startWithSAP),n.bandwidth&&(P=a()(n.bandwidth))),n.BaseURL&&(I+=n.BaseURL);let T=!1;if((e.ContentProtection||n.ContentProtection)&&(T=!0),n.SegmentBase)"video/mp4"===o?i.mediaList.video.push({id:n.id,file:I,mimeType:o,codecs:m,width:u,height:g,maxWidth:p,maxHeight:L,frameRate:S,sar:R,startWithSAP:"1"===y,bandwidth:P,timescale:w,duration:A,encrypted:T}):"audio/mp4"===o?i.mediaList.audio.push({id:n.id,file:I,mimeType:o,codecs:m,startWithSAP:"1"===y,bandwidth:P,timescale:w,duration:A,encrypted:T,lang:v}):"application/mp4"===o&&i.mediaList.subtitle.push({id:n.id,file:I,mimeType:o,codecs:m,startWithSAP:"1"===y,bandwidth:P,timescale:w,duration:A,encrypted:T,lang:v});else{let t;if(e.SegmentTemplate&&(t=r.YO(e.SegmentTemplate)?e.SegmentTemplate[0]:e.SegmentTemplate),n.SegmentTemplate&&(t=r.YO(n.SegmentTemplate)?n.SegmentTemplate[0]:n.SegmentTemplate),t){const e=d()(t.startNumber);if(f=t.initialization,w=a()(t.timescale||"1"),t.duration&&!t.SegmentTimeline){A=a()(t.duration);let s=A/w;const d=e+Math.ceil((i.duration||s)/s)-1;for(let a=e;a<=d;a++){const o=s*(a-e);let r=s*(a-e+1);a===d&&(s=i.duration-s*(d-e),r=i.duration),x.push({idx:a,start:o,end:r,url:I+t.media.replace(/\$RepresentationID\$/g,n.id).replace(/\$Number(%(\d+)d)?\$/g,((e,t,i)=>i?h(a,+i):(0,l.A)(a))),segmentDuration:s})}}else if(t.SegmentTimeline&&t.SegmentTimeline.S){const i=r.YO(t.SegmentTimeline.S)?t.SegmentTimeline.S:[t.SegmentTimeline.S];let s=0,o=e;for(let e=0;e<i.length;e++){let r=a()(i[e].d);i[e].t&&(s=a()(i[0].t));let m=1;i[e].r&&(m=d()(i[e].r)+1);for(let e=0;e<m;e++)x.push({idx:o,start:s/w,end:(s+r)/w,url:I+t.media.replace(/\$RepresentationID\$/g,n.id).replace(/\$Number(%(\d+)d)?\$/g,((e,t,i)=>i?h(o,+i):(0,l.A)(o))).replace(/\$Time\$/g,(0,l.A)(s)),segmentDuration:r/w}),o++,s+=r}}}else if(n.SegmentList){const e=r.YO(n.SegmentList.SegmentURL)?n.SegmentList.SegmentURL:[n.SegmentList.SegmentURL];let t=0,i=a()(n.SegmentList.duration);for(let s=0;s<e.length;s++)x.push({idx:s,start:t/w,end:(t+i)/w,url:I+e[s].media,segmentDuration:i/w}),t+=i}"video/mp4"===o?i.mediaList.video.push({id:n.id,baseURL:I,initSegment:I+f.replace(/\$RepresentationID\$/g,n.id).replace(/\$Bandwidth\$/g,(0,l.A)(P)),mediaSegments:x,mimeType:o,codecs:m,width:u,height:g,maxWidth:p,maxHeight:L,frameRate:S,sar:R,startWithSAP:"1"===y,bandwidth:P,timescale:w,duration:A,encrypted:T}):"audio/mp4"===o?i.mediaList.audio.push({id:n.id,baseURL:I,initSegment:I+f.replace(/\$RepresentationID\$/g,n.id).replace(/\$Bandwidth\$/g,(0,l.A)(P)),mediaSegments:x,mimeType:o,codecs:m,startWithSAP:"1"===y,bandwidth:P,timescale:w,duration:A,encrypted:T,lang:v}):"application/mp4"===o&&i.mediaList.subtitle.push({id:n.id,baseURL:I,initSegment:I+f.replace(/\$RepresentationID\$/g,n.id).replace(/\$Bandwidth\$/g,(0,l.A)(P)),mediaSegments:x,mimeType:o,codecs:m,startWithSAP:"1"===y,bandwidth:P,timescale:w,duration:A,encrypted:T,lang:v})}}))})),["video","audio"].forEach((e=>{i.mediaList[e].sort(((e,t)=>e.bandwidth-t.bandwidth))})),i}},79331:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(68632),a=i.n(s),n=i(72739);const d={aloneValueName:"_@attribute"},o=[" ","/",'"',"'","<",">"];function r(e,t=d){e=(e=(e=(e=e.replace(/<!--[\s\S]*?-->/g,"")).replace(/[\n\t\r]/g,"")).replace(/>[ \t]+</g,"><")).replace(/<\?[^>]*\?>/g,"");const i=[];let s=0;function r(e,s){const n=i[i.length-1];n&&(e===t.aloneValueName||null==n.obj[t.aloneValueName]?null==n.obj[e]?n.obj[e]=s:a()(n.obj[e])?n.obj[e].push(s):n.obj[e]=[n.obj[e],s]:n.obj[t.aloneValueName]=[n.obj[t.aloneValueName],{tagName:e,...s}])}function l(t){for(;s<e.length;){if(e[s]===t)return!0;s++}return!1}function m(){u();let t="";for(;s<e.length&&!n.zy(o,e[s]);)t+=e[s],s++;return t}function u(){for(;s<e.length&&/\s|\r|\n/.test(e[s]);)s++}const h=/\s/,c=/'/,g=/"/;function f(){if(s>=e.length)return!0;u();let t=h;'"'!==e[s]&&"'"!=e[s]||(t='"'===e[s]?g:c,s++);let i="";for(;s<e.length;){if(t.test(e[s])){s++;break}i+=e[s],s++}return i}function p(){u();let t="";for(;s<e.length&&"<"!==e[s];)t+=e[s],s++;return t}function L(){for(;"<"===e[s];){const t=s;if(s++,u(),"/"!==e[s]){s=t;break}if(s++,m()===i[i.length-1].tag){if(i.length>1){const e=i.pop();r(e.tag,e.obj)}l(">"),s++,u()}else i.pop(),l(">"),s++,u()}}return function a(){if(s>=e.length)return;let n=s;if(u(),"<"!==e[s])return s=n,r(t.aloneValueName,p()),L(),a();let d=l("<");if(!d)return;n=s,s++;const o=m();if(i.push({obj:{},tag:o,start:n}),function(){for(;u(),">"!==e[s]&&"/"!==e[s];){let e=m();if(!e)break;"="===e[e.length-1]?e=e.substring(0,e.length-1):(l("="),s++),r(e,f())}}(),u(),"/"===e[s]){if(s++,i.length>1){const e=i.pop();r(e.tag,e.obj)}return l(">"),s++,L(),a()}d=l(">"),d&&(s++,u(),"<"!==e[s]&&(r(t.aloneValueName,p()),u()),L(),a())}(),{[i[0].tag]:i[0].obj}}}}]);
|