@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
package/COPYING.LGPLv3
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[118],{85947:(t,i,e)=>{e.d(i,{A:()=>r});var s=e(134);class r{constructor(){(0,s.A)(this,"type",-1),(0,s.A)(this,"onStreamAdd",void 0)}async destroy(t){}}},29118:(t,i,e)=>{e.r(i),e.d(i,{default:()=>P});var s=e(134),r=e(63939),n=e(50932),a=e(38743),h=e(4624),o=e(54712),d=e(87400),g=e(9705),l=e(92647),p=e(85947),u=e(14686),f=e(37837),c=e(71517),m=e(82348),w=e(35336),b=e(77231),I=e(52071),k=e(44328),S=e(72739),B=e(79630),v=e(43607);const y="src/avformat/formats/IOggFormat.ts";class P extends p.A{constructor(){super(),(0,s.A)(this,"type",4),(0,s.A)(this,"headerPagesPayload",void 0),(0,s.A)(this,"page",void 0),(0,s.A)(this,"curSegIndex",void 0),(0,s.A)(this,"curSegStart",void 0),(0,s.A)(this,"segCount",void 0),(0,s.A)(this,"segIndex",void 0),(0,s.A)(this,"currentPts",void 0),(0,s.A)(this,"firstPos",void 0),(0,s.A)(this,"firstGranulePosition",void 0),(0,s.A)(this,"paddingPayload",void 0),this.page=new a.B,this.headerPagesPayload=[]}init(t){t.ioReader&&t.ioReader.setEndian(!1),t.ioReader&&t.ioReader.setEndian(!1),this.curSegIndex=-1,this.curSegStart=0,this.currentPts=BigInt(0),this.segCount=0,this.segIndex=0,this.firstGranulePosition=BigInt(0)}async estimateTotalBlock(t){let i=BigInt(0);const e=t.ioReader.getPos(),s=this.currentPts,r=await t.ioReader.fileSize();for(await t.ioReader.seek(v.T9(r-BigInt(195072),BigInt(0))),await this.syncPage(t);;)try{this.page.reset(),await this.page.read(t.ioReader),i=this.page.granulePosition}catch(t){break}return await t.ioReader.seek(e),this.currentPts=s,i}async getNextSegment(t){if(this.curSegIndex<0){this.page.granulePosition>BigInt(0)&&(this.currentPts=this.page.granulePosition),this.page.reset(),await this.page.read(t.ioReader),this.curSegIndex=0,this.curSegStart=0,this.segIndex=-1,this.segCount=0;for(let t=0;t<this.page.segmentTable.length;t++)255!==this.page.segmentTable[t]&&this.segCount++;this.segCount||(this.segCount=1)}let i=0;for(;this.curSegIndex<this.page.segmentTable.length;){const t=this.page.segmentTable[this.curSegIndex++];if(i+=t,255!==t)break}const e=this.curSegStart;return this.curSegStart+=i,this.segIndex++,this.curSegIndex===this.page.segmentTable.length&&(this.curSegIndex=-1),this.page.payload.subarray(e,e+i)}addComment(t,i){t.vendorString&&(i.metadata.vendor=t.vendorString),S.__(t.comments.list,(t=>{const e=t.split("=");if(e.length>1){const t=e.shift(),s=e.join("=");i.metadata[t]=s}}))}async createStream(t,i){if(i.length<8)return 0;let e=new m.A(i.length,!1);e.appendBuffer(i);const s=e.peekString(8);if("OpusHead"===s){const s=new o.q;s.read(e);const r=new o.o;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),r.read(e),this.headerPagesPayload=[s,r];const n=t.createStream();n.codecpar.codecType=1,n.codecpar.codecId=86076,n.codecpar.sampleRate=s.sampleRate,n.codecpar.chLayout.nbChannels=s.channels,n.timeBase.den=n.codecpar.sampleRate,n.timeBase.num=1,n.privData={serialNumber:this.page.serialNumber},this.addComment(r,n),n.duration=await this.estimateTotalBlock(t)}else if("vorbis"===s.slice(1,7)){const s=[i],r=new d.m;r.read(e);const n=new d.G;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),n.read(e),s.push(i),this.headerPagesPayload=[r,n];const a=t.createStream();a.codecpar.codecType=1,a.codecpar.codecId=86021,a.codecpar.sampleRate=r.sampleRate,a.codecpar.chLayout.nbChannels=r.channels,a.timeBase.den=a.codecpar.sampleRate,a.timeBase.num=1,a.privData={serialNumber:this.page.serialNumber},this.addComment(n,a),s.push(await this.getNextSegment(t));const h=s.reduce(((t,i)=>t+2+i.length),0),o=(0,f.sY)(h),g=new w.A(h,!0,new B.A(o,h));s.forEach((t=>{g.writeUint16(t.length),g.writeBuffer(t)})),a.codecpar.extradata=o,a.codecpar.extradataSize=h,a.duration=await this.estimateTotalBlock(t)}else if("FLAC"===s.slice(1,5)){e.setEndian(!0),e.skip(1),e.skip(4),e.skip(1),e.skip(1),e.readUint16(),e.skip(4);const s=e.readUint8(),r=e.readUint24();if(0!==s)return g.LR;{const s=t.createStream();s.codecpar.codecType=1,s.codecpar.codecId=86028;const n=(0,f.sY)(r);e.peekBuffer(r,(0,u.s3)(n,r)),e.skip(10);const h=e.readUint24();s.codecpar.sampleRate=h>>4,s.codecpar.chLayout.nbChannels=1+((15&h)>>>1),s.timeBase.den=s.codecpar.sampleRate,s.timeBase.num=1,s.privData={serialNumber:this.page.serialNumber},s.codecpar.extradata=n,s.codecpar.extradataSize=r;const o=new a.h;i=await this.getNextSegment(t),e=new m.A(i.length-4,!1),e.appendBuffer(i.subarray(4)),o.read(e),s.duration=await this.estimateTotalBlock(t),this.addComment(o,s),this.headerPagesPayload=[o]}}else{if("Speex"!==s.slice(0,5))return 0;{const s=t.createStream();s.codecpar.codecType=1,s.codecpar.codecId=86051;const r=(0,f.sY)(i.length);(0,u.lW)(r,i.length,i),s.codecpar.extradata=r,s.codecpar.extradataSize=i.length,e.seek(BigInt(36)),s.codecpar.sampleRate=e.readUint32(),e.seek(BigInt(48)),s.codecpar.chLayout.nbChannels=e.readUint32(),s.timeBase.den=s.codecpar.sampleRate,s.timeBase.num=1,s.privData={serialNumber:this.page.serialNumber};const n=new a.h;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),n.read(e),s.duration=await this.estimateTotalBlock(t),this.addComment(n,s),this.headerPagesPayload=[n]}}return 1}async readHeader(t){try{if("OggS"!==await t.ioReader.peekString(4))return h.z3("the file format is not oggs",y,387),g.LR;for(;;){let i=this.paddingPayload||await this.getNextSegment(t);this.paddingPayload&&(this.paddingPayload=null);const e=await this.createStream(t,i);if(e<0)return e;if(!e){this.paddingPayload=i;break}}return this.firstPos=this.paddingPayload?this.page.pos:t.ioReader.getPos(),0}catch(i){return h.z3(i.message,y,409),t.ioReader.error}}async readAVPacket(t,i){n.M[17](i+56,t.ioReader.getPos());try{const e=this.paddingPayload||await this.getNextSegment(t);this.paddingPayload&&(this.paddingPayload=null);let s=this.currentPts+(this.page.granulePosition-this.currentPts)/BigInt(Math.floor(this.segCount))*BigInt(Math.floor(this.segIndex));n.M[17](i+16,s),n.M[17](i+8,s),this.firstGranulePosition||(this.firstGranulePosition=this.page.granulePosition);const a=t.streams.find((t=>t.privData&&t.privData.serialNumber===this.page.serialNumber));if(!a)return await this.createStream(t,e),this.readAVPacket(t,i);n.M[15](i+32,a.index),n.M[15](i+76,a.timeBase.den),n.M[15](i+72,a.timeBase.num),1===a.codecpar.codecType&&n.M[15](i+36,1|r.f[15](i+36));const h=[e];for(;this.curSegIndex<0;)try{if(!(1&(await t.ioReader.peekBuffer(6))[5]))break;h.push(await this.getNextSegment(t))}catch(t){break}const o=(0,l.A)(Uint8Array,h),d=o.length,g=(0,f.sY)(d);return(0,u.lW)(g,d,o),(0,c.NX)(i,g,d),0}catch(i){return-1048576!==t.ioReader.error?(h.z3(`read packet error, ${i}`,y,478),g.LR):t.ioReader.error}}async syncPage(t){let i=b.Dh,e=BigInt(0);for(;;)try{if("OggS"===await t.ioReader.peekString(4)){i=t.ioReader.getPos(),this.page.reset(),await this.page.read(t.ioReader),e=this.page.granulePosition;let s=0;for(;3!==s&&"OggS"===await t.ioReader.peekString(4);)s++,this.page.reset(),await this.page.read(t.ioReader);if(3===s)break}await t.ioReader.skip(1)}catch(t){break}if(i!==b.Dh){for(await t.ioReader.seek(i);1&(await t.ioReader.peekBuffer(6))[5];)this.page.reset(),await this.page.read(t.ioReader),e=this.page.granulePosition;this.currentPts=e-this.firstGranulePosition,this.curSegIndex=-1}}async seek(t,i,e,s){const r=t.ioReader.getPos();if(2&s){const i=await t.ioReader.fileSize();return i<=BigInt(0)?BigInt(g.E$):(e<BigInt(0)?e=BigInt(0):e>i&&(e=i),await t.ioReader.seek(e),4&s||await this.syncPage(t),r)}return(0,k.k)(e,i.timeBase,b.i0)<BigInt(1e4)?(h.Yz(`seek pts is earlier then 10s, seek to first packet pos(${this.firstPos}) directly`,y,571),await t.ioReader.seek(this.firstPos),this.currentPts=BigInt(0),r):(0,I.A)(t,i,e,this.firstPos,this.readAVPacket.bind(this),this.syncPage.bind(this))}getAnalyzeStreamsCount(){return 1}}},38743:(t,i,e)=>{e.d(i,{B:()=>h,h:()=>o});var s=e(134),r=e(77231),n=e(50011);class a{constructor(){(0,s.A)(this,"list",void 0),this.list=[]}read(t,i){for(let e=0;e<i;e++){const i=t.readUint32();this.list.push(t.readString(i))}}write(t){for(let i=0;i<this.list.length;i++){const e=n.encode(this.list[i]);t.writeUint32(e.length),t.writeBuffer(e)}}addComment(t){this.list.push(t)}}class h{constructor(){(0,s.A)(this,"capturePattern",void 0),(0,s.A)(this,"streamStructureVersion",void 0),(0,s.A)(this,"headerTypeFlag",void 0),(0,s.A)(this,"granulePosition",void 0),(0,s.A)(this,"serialNumber",void 0),(0,s.A)(this,"pageSequenceNumber",void 0),(0,s.A)(this,"crcCheckSum",void 0),(0,s.A)(this,"numberPageSegments",void 0),(0,s.A)(this,"segmentTable",void 0),(0,s.A)(this,"payload",void 0),(0,s.A)(this,"pos",void 0),this.reset()}reset(){this.capturePattern="OggS",this.streamStructureVersion=0,this.headerTypeFlag=0,this.granulePosition=r.Dh,this.serialNumber=0,this.pageSequenceNumber=0,this.crcCheckSum=0,this.numberPageSegments=0,this.segmentTable=[],this.pos=BigInt(0)}async read(t){this.pos=t.getPos(),await this.readPageHeader(t);const i=this.segmentTable.reduce(((t,i)=>t+i),0);i&&(this.payload=await t.readBuffer(i))}async readPageHeader(t){if(this.capturePattern=await t.readString(4),this.streamStructureVersion=await t.readUint8(),this.headerTypeFlag=await t.readUint8(),this.granulePosition=await t.readUint64(),this.serialNumber=await t.readUint32(),this.pageSequenceNumber=await t.readUint32(),this.crcCheckSum=await t.readUint32(),this.numberPageSegments=await t.readUint8(),this.numberPageSegments)for(let i=0;i<this.numberPageSegments;i++){const i=await t.readUint8();this.segmentTable.push(i)}}write(t){if(this.pos=t.getPos(),t.writeString(this.capturePattern),t.writeUint8(this.streamStructureVersion),t.writeUint8(this.headerTypeFlag),t.writeUint64(this.granulePosition),t.writeUint32(this.serialNumber),t.writeUint32(this.pageSequenceNumber),t.writeUint32(this.crcCheckSum),this.payload){this.numberPageSegments=Math.floor(this.payload.length/255)+1;const i=this.payload.length%255;t.writeUint8(this.numberPageSegments);for(let i=0;i<this.numberPageSegments-1;i++)t.writeUint8(255);t.writeUint8(i),t.writeBuffer(this.payload)}else t.writeUint8(0)}}class o{constructor(){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"vendorStringLength",void 0),(0,s.A)(this,"vendorString",void 0),(0,s.A)(this,"userCommentListLength",void 0),(0,s.A)(this,"comments",void 0),this.vendorString="v0.2.0",this.vendorStringLength=this.vendorString.length,this.userCommentListLength=0,this.comments=new a}read(t){this.vendorStringLength=t.readUint32(),this.vendorString=t.readString(this.vendorStringLength),this.userCommentListLength=t.readUint32(),this.userCommentListLength&&this.comments.read(t,this.userCommentListLength)}write(t){const i=n.encode(this.vendorString);t.writeUint32(i.length),t.writeBuffer(i),t.writeUint32(this.comments.list.length),this.comments.write(t)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},54712:(t,i,e)=>{e.d(i,{o:()=>h,q:()=>a});var s=e(134),r=e(38743);class n{constructor(){(0,s.A)(this,"streamCount",void 0),(0,s.A)(this,"coupledStreamCount",void 0),(0,s.A)(this,"mapping",void 0),this.streamCount=1,this.coupledStreamCount=0,this.mapping=new Uint8Array(1)}read(t){this.streamCount=t.readUint8(),this.coupledStreamCount=t.readUint8(),this.mapping=t.readBuffer(this.streamCount+this.coupledStreamCount)}write(t){t.writeUint8(this.streamCount),t.writeUint8(this.coupledStreamCount),t.writeBuffer(this.mapping)}}class a{constructor(){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"preSkip",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"outputGain",void 0),(0,s.A)(this,"channelMappingFamily",void 0),(0,s.A)(this,"channelMappingTable",void 0),this.signature="OpusHead",this.version=1,this.channels=1,this.preSkip=0,this.sampleRate=48e3,this.outputGain=0,this.channelMappingFamily=0,this.channelMappingTable=new n}read(t){this.signature=t.readString(8),this.version=t.readUint8(),this.channels=t.readUint8(),this.preSkip=t.readUint16(),this.sampleRate=t.readUint32(),this.outputGain=t.readInt16(),this.channelMappingFamily=t.readUint8(),0!==this.channelMappingFamily&&this.channelMappingTable.read(t)}write(t){t.writeString(this.signature),t.writeUint8(this.version),t.writeUint8(this.channels),t.writeUint16(this.preSkip),t.writeUint32(this.sampleRate),t.writeInt16(this.outputGain),t.writeUint8(this.channelMappingFamily),0!==this.channelMappingFamily&&this.channelMappingTable.write(t)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels,this.channelMappingFamily=t.format}}class h extends r.h{constructor(){super(),this.signature="OpusTags"}read(t){this.signature=t.readString(8),super.read(t)}write(t){t.writeString(this.signature),super.write(t)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},87400:(t,i,e)=>{e.d(i,{G:()=>a,m:()=>n});var s=e(134),r=e(38743);class n{constructor(t="vorbis"){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"bitrateMaximum",void 0),(0,s.A)(this,"bitrateNominal",void 0),(0,s.A)(this,"bitrateMinimum",void 0),(0,s.A)(this,"blocksize0",void 0),(0,s.A)(this,"blocksize1",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.version=0,this.channels=1,this.sampleRate=48e3,this.bitrateMaximum=0,this.bitrateNominal=0,this.bitrateMinimum=0,this.blocksize0=2048,this.blocksize1=256}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),this.version=t.readUint32(),this.channels=t.readUint8(),this.sampleRate=t.readInt32(),this.bitrateMaximum=t.readInt32(),this.bitrateNominal=t.readInt32(),this.bitrateMinimum=t.readInt32();const i=255&t.readUint8();this.blocksize0=Math.pow(2,i>>>4),this.blocksize1=Math.pow(2,15&i),this.framingFlag=t.readUint8()}write(t){t.writeUint8(1),t.writeString(this.signature),t.writeUint32(this.version),t.writeUint8(this.channels),t.writeInt32(this.sampleRate),t.writeInt32(this.bitrateMaximum),t.writeInt32(this.bitrateNominal),t.writeInt32(this.bitrateMinimum),t.writeUint8(Math.log2(this.blocksize0)<<4|Math.log2(this.blocksize1)),t.writeUint8(1)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels}}class a extends r.h{constructor(t="vorbis"){super(),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.packetType=1,this.framingFlag=1}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),super.read(t),"vorbis"===this.signature&&(this.framingFlag=t.readUint8())}write(t){t.writeUint8(this.packetType),t.writeString(this.signature),super.write(t),"vorbis"===this.signature&&t.writeUint8(this.framingFlag)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},2187:(t,i,e)=>{e.d(i,{d:()=>a});var s=e(72739),r=e(44328),n=e(77231);function a(t,i,e){let a=BigInt(0);return s.__(t,(t=>{a+=t.codecpar.bitrate*(0,r.k)(i,e,n.i0)/BigInt(8e3)})),a}},52071:(t,i,e)=>{e.d(i,{A:()=>u});var s=e(63939),r=e(9599),n=e(29170),a=e(77231),h=e(44328),o=e(2187),d=e(71517),g=e(9705),l=e(4624);const p="src/avformat/function/seekInBytes.ts";async function u(t,i,e,u,f,c){const m=t.ioReader.getPos(),w=await t.ioReader.fileSize();let b=a.Dh,I=e;i.startTime!==a.Dh?I-=i.startTime:I-=i.firstDTS;const k=(0,h.k)(e,i.timeBase,a.i0);if(k<BigInt(1e4))return l.Yz(`seek pts is earlier then 10s, seek to first packet pos(${u}) directly`,p,64),await t.ioReader.seek(u),m;let S=(0,o.d)(t.streams,I,i.timeBase);const B=w-(0,o.d)(t.streams,BigInt(1e4),a.i0),v=(0,o.d)(t.streams,BigInt(1e4),a.i0);if(S>B&&(S=B),S<u)return await t.ioReader.seek(u),m;const y=(0,d._5)();let P=w,U=BigInt(0);for(;;){if(P-U<v){b=U;break}if(await t.ioReader.seek(S),await c(t),8&t.ioReader.flags)break;const i=t.ioReader.getPos();if(!(await f(t,y)>=0)){b=a.Dh;break}{const t=(0,h.k)(s.f[17](y+8),(0,n.A)(y+72,r.P),a.i0),e=t-k;if(l.Yz(`try to seek to pos: ${S}, got packet pts: ${s.f[17](y+8)}(${t}ms), diff: ${e}ms`,p,102),e<=BigInt(0)&&-e<BigInt(1e4)){b=i;break}e>BigInt(0)?(P=S,S=U+P>>BigInt(1)):(U=S,S=U+P>>BigInt(1))}if(8&t.ioReader.flags)break}return(0,d.Qe)(y),b!==a.Dh?(l.Yz(`finally seek to pos ${b}`,p,133),await t.ioReader.seek(b),await c(t),m):(await t.ioReader.seek(m),8&t.ioReader.flags?BigInt(g.LT):BigInt(g.E$))}},82348:(t,i,e)=>{e.d(i,{A:()=>h});var s=e(134),r=e(4624),n=e(50011);const a="src/common/io/IOReaderSync.ts";class h{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)}}readUint8(){this.remainingLength()<1&&this.flush(1);const t=this.data.getUint8(this.pointer);return this.pointer++,this.pos++,t}peekUint8(){return this.remainingLength()<1&&this.flush(1),this.data.getUint8(this.pointer)}readUint16(){this.remainingLength()<2&&this.flush(2);const t=this.data.getUint16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}peekUint16(){return this.remainingLength()<2&&this.flush(2),this.data.getUint16(this.pointer,this.littleEndian)}readUint24(){this.remainingLength()<3&&this.flush(3);const t=this.readUint16(),i=this.readUint8();return this.littleEndian?i<<16|t:t<<8|i}peekUint24(){this.remainingLength()<3&&this.flush(3);const t=this.pointer,i=this.pos,e=this.readUint16(),s=this.readUint8(),r=this.littleEndian?s<<16|e:e<<8|s;return this.pointer=t,this.pos=i,r}readUint32(){this.remainingLength()<4&&this.flush(4);const t=this.data.getUint32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekUint32(){return this.remainingLength()<4&&this.flush(4),this.data.getUint32(this.pointer,this.littleEndian)}readUint64(){this.remainingLength()<8&&this.flush(8);const t=this.data.getBigUint64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekUint64(){return this.remainingLength()<8&&this.flush(8),this.data.getBigUint64(this.pointer,this.littleEndian)}readInt8(){this.remainingLength()<1&&this.flush(1);const t=this.data.getInt8(this.pointer);return this.pointer++,this.pos++,t}peekInt8(){return this.remainingLength()<1&&this.flush(1),this.data.getInt8(this.pointer)}readInt16(){this.remainingLength()<2&&this.flush(2);const t=this.data.getInt16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}peekInt16(){return this.remainingLength()<2&&this.flush(2),this.data.getInt16(this.pointer,this.littleEndian)}readInt24(){const t=this.readUint24();return 8388608&t?t-16777216:t}peekInt24(){const t=this.peekUint24();return 8388608&t?t-16777216:t}readInt32(){this.remainingLength()<4&&this.flush(4);const t=this.data.getInt32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekInt32(){return this.remainingLength()<4&&this.flush(4),this.data.getInt32(this.pointer,this.littleEndian)}readInt64(){this.remainingLength()<8&&this.flush(8);const t=this.data.getBigInt64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekInt64(){return this.remainingLength()<8&&this.flush(8),this.data.getBigInt64(this.pointer,this.littleEndian)}readFloat(){this.remainingLength()<4&&this.flush(4);const t=this.data.getFloat32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekFloat(){return this.remainingLength()<4&&this.flush(4),this.data.getFloat32(this.pointer,this.littleEndian)}readDouble(){this.remainingLength()<8&&this.flush(8);const t=this.data.getFloat64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekDouble(){return this.remainingLength()<8&&this.flush(8),this.data.getFloat64(this.pointer,this.littleEndian)}readHex(t=1){let i="";for(let e=0;e<t;e++){const t=this.readUint8().toString(16);i+=1===t.length?"0"+t:t}return i}peekHex(t=1){t>this.size&&(this.error=-1048574,r.h2("peekHex, length too large",a,412)),this.remainingLength()<t&&this.flush(t);const i=this.pointer,e=this.pos;let s="";for(let i=0;i<t;i++){const t=this.readUint8().toString(16);s+=1===t.length?"0"+t:t}return this.pointer=i,this.pos=e,s}readBuffer(t,i){if(!t)return new Uint8Array(0);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;){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}peekBuffer(t,i){return t?(t>this.size&&(this.error=-1048574,r.h2("peekBuffer, length too large",a,505)),this.remainingLength()<t&&this.flush(t),i||(i=new Uint8Array(t)),i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),i):new Uint8Array(0)}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{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}readString(t=1){const i=this.readBuffer(t);return n.decode(i)}peekString(t=1){const i=this.peekBuffer(t);return n.decode(i)}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+=this.readString(e-this.pointer)),i=!0;break}if(i)break;t+=this.readString(this.remainingLength()),this.flush()}let i=this.peekUint8();return 10!==i&&13!==i||(this.pointer++,13===i&&(i=this.peekUint8(),10===i&&this.pointer++)),t}peekLine(){this.remainingLength()<this.size&&this.flush();let t="",i=!1;for(let e=this.pointer;e<this.endPointer;e++)if(10===this.buffer[e]||13===this.buffer[e]){t+=this.peekString(e-this.pointer),i=!0;break}return i||(this.error=-1048574,r.h2("peekLine, out of buffer",a,656)),t}getPointer(){return this.pointer}getPos(){return this.pos}skip(t){const i=t;for(;this.remainingLength()<t;)t-=this.remainingLength(),this.pointer=this.endPointer,this.flush();this.remainingLength()>=t&&(this.pointer+=t),this.pos+=BigInt(i)}remainingLength(){return this.endPointer-this.pointer}flush(t=0){if(this.onFlush||(this.error=-1048574,r.h2("IOReader error, flush failed because of no flush callback",a,720)),!(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=this.onFlush(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=this.onFlush(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}}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",a,790)),this.pointer=this.endPointer=0,this.pos=t;const s=this.onSeek(t);0!==s&&(this.error=s,r.h2("IOReader error, seek failed",a,799)),e&&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",a,838)}}reset(){this.pointer=this.endPointer=0,this.pos=BigInt(0),this.error=0}setEndian(t){this.littleEndian=!t}fileSize(){if(this.fileSize_)return this.fileSize_;if(!this.onSize)return r.R8("IOReader error, fileSize failed because of no onSize callback",a,871),BigInt(0);try{this.fileSize_=this.onSize()}catch(t){r.R8(`IOReader error, call fileSize failed: ${t}`,a,878),this.fileSize_=BigInt(0)}return this.fileSize_}getBufferSize(){return this.size}pipe(t,i){if(i)if(this.remainingLength()<i){if(this.remainingLength()>0){const e=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}for(;i>0;){this.flush();const e=Math.min(this.endPointer-this.pointer,i);t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}}else 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();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}for(;this.onFlush(this.buffer.subarray(0))>0;){const i=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}}}}},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}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[217],{50848:(e,t,a)=>{a.d(t,{A:()=>I});var i=a(134),s=a(63939),r=a(50932),n=a(77162),o=a(29170),c=a(64436),h=a(14686),d=a(4624),l=a(9705),f=a(77231),p=a(95832),u=a(44328),g=a(37837),m=a(71517),A=a(67672);class I extends c.A{constructor(...e){super(...e),(0,i.A)(this,"streamMuxConfig",void 0),(0,i.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.streamMuxConfig={profile:f.N_,sampleRate:f.N_,channels:f.N_},0}sendAVPacket(e){let t=0,a=s.f[17](e+16)||s.f[17](e+8);const i=(0,h.s3)(s.f[20](e+24),s.f[15](e+28)).slice();for(;t<i.length;){const e=p.Bq(i.subarray(t));if(A.ai(e))return d.z3("AACADTSParser parse failed","src/avformat/bsf/aac/ADTS2RawFilter.ts",81),l.LR;const c={dts:a,buffer:null,extradata:null,duration:f.N_};c.buffer=i.subarray(t+e.headerLength,t+e.headerLength+e.framePayloadLength),this.streamMuxConfig.profile=e.profile,this.streamMuxConfig.sampleRate=e.sampleRate,this.streamMuxConfig.channels=e.channels;const m=s.f[15](this.inCodecpar+48)!==this.streamMuxConfig.profile||s.f[15](this.inCodecpar+136)!==this.streamMuxConfig.sampleRate||s.f[15](this.inCodecpar+116)!==this.streamMuxConfig.channels,I=(0,u.k)(BigInt(Math.floor(1024*(e.numberOfRawDataBlocksInFrame+1)/this.streamMuxConfig.sampleRate*f.SF)),f.KR,this.inTimeBase);if(c.duration=Number(I),m){r.M[15](this.inCodecpar+48,this.streamMuxConfig.profile),r.M[15](this.inCodecpar+136,this.streamMuxConfig.sampleRate),r.M[15](this.inCodecpar+116,this.streamMuxConfig.channels);const e=(0,p.Ij)((0,o.A)(this.inCodecpar,n.A));s.f[20](this.inCodecpar+12)&&(0,g.Eb)(s.f[20](this.inCodecpar+12)),r.M[20](this.inCodecpar+12,(0,g.sY)(e.length)),(0,h.lW)(s.f[20](this.inCodecpar+12),e.length,e),r.M[15](this.inCodecpar+16,e.length),c.extradata=e}this.caches.push(c),t+=e.aacFrameLength,a+=I}return 0}receiveAVPacket(e){if(this.caches.length){(0,m.Up)(e);const t=this.caches.shift(),a=(0,g.sY)(t.buffer.length);if((0,h.lW)(a,t.buffer.length,t.buffer),(0,m.NX)(e,a,t.buffer.length),r.M[17](e+16,t.dts),r.M[17](e+8,t.dts),r.M[17](e+48,BigInt(Math.floor(t.duration))),r.M[15](e+36,1|s.f[15](e+36)),t.extradata){const a=(0,g.sY)(t.extradata.length);(0,h.lW)(a,t.extradata.length,t.extradata),(0,m.Ow)(e,1,a,t.extradata.length)}return 0}return l.LT}reset(){return 0}}},85947:(e,t,a)=>{a.d(t,{A:()=>s});var i=a(134);class s{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},51660:(e,t,a)=>{a.d(t,{A:()=>o});var i=a(77231),s=a(4624),r=a(9705);const n="src/avformat/formats/mpegts/function/parsePES.ts";function o(e){const t=e.data,a=t[3],o=t[4]<<8|t[5];let c=0,h=0,d=0;if(188!==a&&190!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a){let a=i.Dh,l=i.Dh;for(;;){if(6+h>=t.length)return;if(d=t[6+h],255!==d)break;h++}if(64==(192&d)&&(h+=2,d=t[6+h]),32==(224&d))c+=5,a=a=BigInt(Math.floor(536870912*(14&t[6+h])+4194304*(255&t[7+h])+16384*(254&t[8+h])+128*(255&t[9+h])+(254&t[10+h])/2)),16&d?(l=BigInt(Math.floor(536870912*(14&t[11+h])+4194304*(255&t[12+h])+16384*(254&t[13+h])+128*(255&t[14+h])+(254&t[15+h])/2)),c+=5):l=a;else if(128==(192&d)){const e=(192&t[7+h])>>>6;c=3+t[8+h],2!==e&&3!==e||(a=BigInt(Math.floor(536870912*(14&t[9+h])+4194304*(255&t[10+h])+16384*(254&t[11+h])+128*(255&t[12+h])+(254&t[13+h])/2)),l=3===e?BigInt(Math.floor(536870912*(14&t[14+h])+4194304*(255&t[15+h])+16384*(254&t[16+h])+128*(255&t[17+h])+(254&t[18+h])/2)):a)}else{if(15!==d)return s.z3("invalid data",n,121),r.LR;c=1}e.dts=l,e.pts=a;const f=6+h+c;let p=0;if(0!==o){if(o<h+c)return void s.z3("Malformed PES: PES_packet_length < 3 + PES_header_data_length",n,133);p=o-(h+c)}else p=t.byteLength-f;e.payload=t.subarray(f,f+p)}else if((188===a||191===a||240===a||241===a||255===a||242===a||248===a)&&6===e.streamId){const a=6;let i=0;i=0!==o?o:t.byteLength-a,e.payload=t.subarray(a,a+i)}return 0}},6403:(e,t,a)=>{a.d(t,{Cd:()=>d,I4:()=>f,am:()=>c,kJ:()=>l,pi:()=>h,xf:()=>p});var i=a(134),s=a(80662),r=a.n(s),n=a(77231);class o{constructor(){(0,i.A)(this,"discontinuityIndicator",0),(0,i.A)(this,"randomAccessIndicator",0),(0,i.A)(this,"elementaryStreamPriorityIndicator",0),(0,i.A)(this,"pcrFlag",0),(0,i.A)(this,"opcrFlag",0),(0,i.A)(this,"splicingPointFlag",0),(0,i.A)(this,"transportPrivateDataFlag",0),(0,i.A)(this,"adaptationFieldExtensionFlag",0),(0,i.A)(this,"pcr",BigInt(0)),(0,i.A)(this,"opcr",BigInt(0)),(0,i.A)(this,"spliceCountDown",0),(0,i.A)(this,"transportPrivateData",null),(0,i.A)(this,"extension",null)}}class c{constructor(){(0,i.A)(this,"pos",n.Dh),(0,i.A)(this,"payloadUnitStartIndicator",0),(0,i.A)(this,"transportPriority",0),(0,i.A)(this,"pid",n.N_),(0,i.A)(this,"adaptationFieldControl",0),(0,i.A)(this,"continuityCounter",0),(0,i.A)(this,"transportScramblingControl",0),(0,i.A)(this,"adaptationFieldInfo",new o),(0,i.A)(this,"payload",null)}}class h{constructor(){(0,i.A)(this,"slices",[]),(0,i.A)(this,"totalLength",0),(0,i.A)(this,"expectedLength",n.N_),(0,i.A)(this,"randomAccessIndicator",0),(0,i.A)(this,"pid",n.N_),(0,i.A)(this,"streamType",0),(0,i.A)(this,"pos",n.Dh)}}class d{constructor(){(0,i.A)(this,"versionNumber",0),(0,i.A)(this,"networkPid",n.N_),(0,i.A)(this,"program2PmtPid",new(r()))}}class l{constructor(){(0,i.A)(this,"tag",void 0),(0,i.A)(this,"buffer",void 0)}}class f{constructor(){(0,i.A)(this,"versionNumber",0),(0,i.A)(this,"programNumber",0),(0,i.A)(this,"pcrPid",0),(0,i.A)(this,"pid2StreamType",new(r())),(0,i.A)(this,"pid2ESDescriptor",new(r()))}}class p{constructor(){(0,i.A)(this,"pid",n.N_),(0,i.A)(this,"streamType",0),(0,i.A)(this,"streamId",n.N_),(0,i.A)(this,"dts",n.Dh),(0,i.A)(this,"pts",n.Dh),(0,i.A)(this,"pos",n.Dh),(0,i.A)(this,"payload",null),(0,i.A)(this,"data",null),(0,i.A)(this,"randomAccessIndicator",0)}}},2187:(e,t,a)=>{a.d(t,{d:()=>n});var i=a(72739),s=a(44328),r=a(77231);function n(e,t,a){let n=BigInt(0);return i.__(e,(e=>{n+=e.codecpar.bitrate*(0,s.k)(t,a,r.i0)/BigInt(8e3)})),n}},52071:(e,t,a)=>{a.d(t,{A:()=>p});var i=a(63939),s=a(9599),r=a(29170),n=a(77231),o=a(44328),c=a(2187),h=a(71517),d=a(9705),l=a(4624);const f="src/avformat/function/seekInBytes.ts";async function p(e,t,a,p,u,g){const m=e.ioReader.getPos(),A=await e.ioReader.fileSize();let I=n.Dh,b=a;t.startTime!==n.Dh?b-=t.startTime:b-=t.firstDTS;const k=(0,o.k)(a,t.timeBase,n.i0);if(k<BigInt(1e4))return l.Yz(`seek pts is earlier then 10s, seek to first packet pos(${p}) directly`,f,64),await e.ioReader.seek(p),m;let y=(0,c.d)(e.streams,b,t.timeBase);const C=A-(0,c.d)(e.streams,BigInt(1e4),n.i0),x=(0,c.d)(e.streams,BigInt(1e4),n.i0);if(y>C&&(y=C),y<p)return await e.ioReader.seek(p),m;const B=(0,h._5)();let w=A,R=BigInt(0);for(;;){if(w-R<x){I=R;break}if(await e.ioReader.seek(y),await g(e),8&e.ioReader.flags)break;const t=e.ioReader.getPos();if(!(await u(e,B)>=0)){I=n.Dh;break}{const e=(0,o.k)(i.f[17](B+8),(0,r.A)(B+72,s.P),n.i0),a=e-k;if(l.Yz(`try to seek to pos: ${y}, got packet pts: ${i.f[17](B+8)}(${e}ms), diff: ${a}ms`,f,102),a<=BigInt(0)&&-a<BigInt(1e4)){I=t;break}a>BigInt(0)?(w=y,y=R+w>>BigInt(1)):(R=y,y=R+w>>BigInt(1))}if(8&e.ioReader.flags)break}return(0,h.Qe)(B),I!==n.Dh?(l.Yz(`finally seek to pos ${I}`,f,133),await e.ioReader.seek(I),await g(e),m):(await e.ioReader.seek(m),8&e.ioReader.flags?BigInt(d.LT):BigInt(d.E$))}},43290:(e,t,a)=>{a.d(t,{R:()=>h,u:()=>c});var i=a(37246),s=a(95073);const r=[1,2,2,2,2,3,3,4,4,5,6,6,6,7,8,8],n=[0,8e3,16e3,32e3,0,0,11025,22050,44100,0,0,12e3,24e3,48e3,96e3,192e3],o=[32e3,56e3,64e3,96e3,112e3,128e3,192e3,224e3,256e3,32e4,384e3,448e3,512e3,576e3,64e4,768e3,96e4,1024e3,1152e3,128e4,1344e3,1408e3,1411200,1472e3,1536e3,192e4,2048e3,3072e3,384e4,0,0,0],c=32;function h(e){const t=new i.A(e.length);t.appendBuffer(e);const a={syncWord:0,frameType:0,deficitSamples:0,crcFlag:0,sampleBlock:0,frameSize:0,channelIndex:0,sampleRateIndex:0,bitrateIndex:0,channels:0,sampleRate:0,bitrate:0};return a.syncWord=t.readU(32),2147385345!==a.syncWord&&4269736320!==a.syncWord?-1:(a.frameType=t.readU1(),a.deficitSamples=t.readU(5)+1,a.crcFlag=t.readU1(),a.sampleBlock=t.readU(7)+1,a.frameSize=(0,s.A)(t.readU(14)+1,4),a.channelIndex=t.readU(6),a.sampleRateIndex=t.readU(4),a.bitrateIndex=t.readU(5),a.channels=r[a.channelIndex],a.sampleRate=n[a.sampleRateIndex],a.bitrate=o[a.bitrateIndex],a)}},22576:(e,t,a)=>{a.d(t,{Ij:()=>h,XC:()=>c,kt:()=>o});var i=a(31865),s=a(729),r=a(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(e){let t=0,a=0,i=0;if(e.length<1)return 0;switch(t=e[0],a=n[t>>3],3&t){case 0:i=1;break;case 1:case 2:i=2;break;case 3:if(e.length<2)return 0;i=63&e[1]}return i*a}function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=19){const a=new i.A(t,!1);a.skip(9),e.codecpar.chLayout.nbChannels=a.readUint8(),e.codecpar.initialPadding=a.readUint16(),e.codecpar.sampleRate=a.readUint32(),e.codecpar.seekPreroll=Number((0,r.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function h(e){const t=new Uint8Array(19),a=new s.A(t,!1);return a.writeString("OpusHead"),a.writeUint8(1),a.writeUint8(e.chLayout.nbChannels),a.writeUint16(e.initialPadding),a.writeUint32(e.sampleRate),t}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[299],{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){}}},5299:(t,e,s)=>{s.r(e),s.d(e,{default:()=>y});var i=s(134),h=s(63939),r=s(50932),n=s(9705),a=s(85947),u=s(14686),o=s(37837),d=s(71517),c=s(95335),p=s(92647),l=s(62815),f=s(77231),b=s(37246),g=s(23991),m=s(37805);const A={framerate:{num:30,den:1}};class y extends a.A{constructor(t={}){super(),(0,i.A)(this,"type",11),(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,"picOrderCntMsb",void 0),(0,i.A)(this,"lastPicOrderCntLsb",void 0),(0,i.A)(this,"frameNumberOffset",void 0),(0,i.A)(this,"prevFrameNumber",void 0),(0,i.A)(this,"sps",void 0),(0,i.A)(this,"naluReader",void 0),this.options=c.X$({},A,t)}init(t){t.ioReader&&t.ioReader.setEndian(!1),this.slices=[],this.queue=[],this.bitReader=new b.A(50),this.naluReader=new m.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){const e=31&t[1===t[2]?3:4];return 1===e||5===e||2===e||3===e||4===e}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=31&i[1===i[2]?3:4];if(this.isFrameNalu(i))if(e){if(this.bitReader.reset(),this.bitReader.appendBuffer(i.subarray(1===i[2]?4:5,10)),0===g.xb(this.bitReader))return this.slices.push(i),s;s.push(i)}else s.push(i),e=!0;else{if(e&&(9===h||7===h||8===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=27,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=BigInt(0),this.picOrderCntMsb=BigInt(0),this.lastPicOrderCntLsb=0,this.frameNumberOffset=BigInt(0),this.prevFrameNumber=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),n=l.S1(i);if(n){e.codecpar.extradata=(0,o.sY)(n.length),(0,u.lW)(e.codecpar.extradata,n.length,n),e.codecpar.extradataSize=n.length,l.XC(e,n);const{spss:s}=l.MB(n);this.sps=l.wf(s[0]);const a=(0,d._5)(),c=(0,o.sY)(i.length);(0,u.lW)(c,i.length,i),(0,d.NX)(a,c,i.length),r.M[17](a+56,this.naluPos),this.naluPos+=BigInt(Math.floor(i.length)),r.M[17](a+16,this.currentDts),this.currentDts+=this.step,r.M[17](a+8,this.currentPts),this.currentPts+=this.step,r.M[15](a+32,e.index),r.M[15](a+36,1|h.f[15](a+36)),r.M[15](a+72,e.timeBase.num),r.M[15](a+76,e.timeBase.den),r.M[15](a+80,2),t.interval.packetBuffer.push(a);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 n=!1,a=!0;i.forEach((t=>{const e=1===t[2]?t[3]:t[4],s=31&e,i=e>>>5&3;if(7===s&&(this.sps=l.wf(t)),5===s&&(n=!0),(1===s||2===s||3===s||4===s||5===s)&&a){a=!1,this.bitReader.reset(),this.bitReader.appendBuffer(t.subarray(1===t[2]?4:5,50)),g.xb(this.bitReader),this.sliceType=g.xb(this.bitReader),g.xb(this.bitReader);const e=this.bitReader.readU(this.sps.log2MaxFrameNumMinus4+4);let h=0,r=0;if(this.sps.frameMbsOnlyFlag||(h=this.bitReader.readU1()),h&&(r=this.bitReader.readU1()),5===s&&g.xb(this.bitReader),0===this.sps.picOrderCntType){const t=this.bitReader.readU(this.sps.log2MaxPicOrderCntLsbMinus4+4),e=(1<<this.sps.log2MaxPicOrderCntLsbMinus4+4)-1;Math.abs(t-this.lastPicOrderCntLsb)>e>>>1&&(this.picOrderCntMsb+=BigInt(Math.floor(e))),this.poc=this.picOrderCntMsb+BigInt(Math.floor(t)),this.lastPicOrderCntLsb=t}else if(1===this.sps.picOrderCntType){const t=[0,0];if(this.sps.deltaPicOrderAlwaysZeroFlag||(t[0]=g.$x(this.bitReader),r&&(t[1]=g.$x(this.bitReader))),e<this.prevFrameNumber){const t=(1<<this.sps.log2MaxFrameNumMinus4+4)-1;this.frameNumberOffset+=BigInt(Math.floor(t))}let s=this.frameNumberOffset+BigInt(Math.floor(e));0===i&&s>0&&s--,this.poc=BigInt(2)*s+BigInt(0|t[0]),h&&r&&(this.poc+=BigInt(0|t[1])),this.prevFrameNumber=e}else this.poc++}}));const c=(0,p.A)(Uint8Array,i),f=(0,o.sY)(c.length);return(0,u.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),n&&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>BigInt(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)||0===this.sliceType||2===this.sliceType||5===this.sliceType||7===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(n.E$)}getAnalyzeStreamsCount(){return 1}}},37805:(t,e,s)=>{s.d(e,{A:()=>n});var i=s(134),h=s(60264),r=s(92647);class n{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([[331],{64436:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(134),i=a(63939),n=(a(77162),a(37837)),s=a(71766);class o{constructor(){(0,r.A)(this,"inCodecpar",void 0),(0,r.A)(this,"inTimeBase",void 0),(0,r.A)(this,"outCodecpar",void 0)}init(e,t){return this.inCodecpar=(0,n.Gy)(168),(0,s.Yi)(this.inCodecpar,e),this.inTimeBase={den:i.f[15](t+4),num:i.f[15](t)},0}destroy(){this.inCodecpar&&((0,s.dn)(this.inCodecpar),this.inCodecpar=0)}}},50848:(e,t,a)=>{a.d(t,{A:()=>x});var r=a(134),i=a(63939),n=a(50932),s=a(77162),o=a(29170),c=a(64436),d=a(14686),l=a(4624),p=a(9705),h=a(77231),f=a(95832),u=a(44328),m=a(37837),g=a(71517),A=a(67672);class x extends c.A{constructor(...e){super(...e),(0,r.A)(this,"streamMuxConfig",void 0),(0,r.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.streamMuxConfig={profile:h.N_,sampleRate:h.N_,channels:h.N_},0}sendAVPacket(e){let t=0,a=i.f[17](e+16)||i.f[17](e+8);const r=(0,d.s3)(i.f[20](e+24),i.f[15](e+28)).slice();for(;t<r.length;){const e=f.Bq(r.subarray(t));if(A.ai(e))return l.z3("AACADTSParser parse failed","src/avformat/bsf/aac/ADTS2RawFilter.ts",81),p.LR;const c={dts:a,buffer:null,extradata:null,duration:h.N_};c.buffer=r.subarray(t+e.headerLength,t+e.headerLength+e.framePayloadLength),this.streamMuxConfig.profile=e.profile,this.streamMuxConfig.sampleRate=e.sampleRate,this.streamMuxConfig.channels=e.channels;const g=i.f[15](this.inCodecpar+48)!==this.streamMuxConfig.profile||i.f[15](this.inCodecpar+136)!==this.streamMuxConfig.sampleRate||i.f[15](this.inCodecpar+116)!==this.streamMuxConfig.channels,x=(0,u.k)(BigInt(Math.floor(1024*(e.numberOfRawDataBlocksInFrame+1)/this.streamMuxConfig.sampleRate*h.SF)),h.KR,this.inTimeBase);if(c.duration=Number(x),g){n.M[15](this.inCodecpar+48,this.streamMuxConfig.profile),n.M[15](this.inCodecpar+136,this.streamMuxConfig.sampleRate),n.M[15](this.inCodecpar+116,this.streamMuxConfig.channels);const e=(0,f.Ij)((0,o.A)(this.inCodecpar,s.A));i.f[20](this.inCodecpar+12)&&(0,m.Eb)(i.f[20](this.inCodecpar+12)),n.M[20](this.inCodecpar+12,(0,m.sY)(e.length)),(0,d.lW)(i.f[20](this.inCodecpar+12),e.length,e),n.M[15](this.inCodecpar+16,e.length),c.extradata=e}this.caches.push(c),t+=e.aacFrameLength,a+=x}return 0}receiveAVPacket(e){if(this.caches.length){(0,g.Up)(e);const t=this.caches.shift(),a=(0,m.sY)(t.buffer.length);if((0,d.lW)(a,t.buffer.length,t.buffer),(0,g.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|i.f[15](e+36)),t.extradata){const a=(0,m.sY)(t.extradata.length);(0,d.lW)(a,t.extradata.length,t.extradata),(0,g.Ow)(e,1,a,t.extradata.length)}return 0}return p.LT}reset(){return 0}}},36488:(e,t,a)=>{a.d(t,{A:()=>y});var r=a(134),i=a(63939),n=a(50932),s=a(77162),o=a(29170),c=a(64436),d=a(14686),l=a(4624),p=a(9705),h=a(77231),f=a(95832),u=a(44328),m=a(37837),g=a(71517),A=a(37246),x=a(67672);class y extends c.A{constructor(...e){super(...e),(0,r.A)(this,"bitReader",void 0),(0,r.A)(this,"streamMuxConfig",void 0),(0,r.A)(this,"caches",void 0),(0,r.A)(this,"refSampleDuration",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.refSampleDuration=BigInt(0),this.bitReader=new A.A,this.streamMuxConfig={profile:h.N_,sampleRate:h.N_,channels:h.N_},0}sendAVPacket(e){const t=(0,d.s3)(i.f[20](e+24),i.f[15](e+28));this.bitReader.appendBuffer(t);let a=i.f[17](e+16)||i.f[17](e+8);for(;this.bitReader.remainingLength()>=20;){const e=this.bitReader.getPointer(),t=f.f7(null,this.bitReader);if(x.ai(t))return l.z3("AACLATMParser parse failed","src/avformat/bsf/aac/LATM2RawFilter.ts",94),this.bitReader.reset(),p.LR;if(t.framePayloadLength>=this.bitReader.remainingLength()){this.bitReader.skipPadding(),this.bitReader.setPointer(e);break}t.useSameStreamMux||(this.streamMuxConfig.profile=t.profile,this.streamMuxConfig.sampleRate=t.sampleRate,this.streamMuxConfig.channels=t.channels);const r=t.framePayloadLength,c=new Uint8Array(r);for(let e=0;e<r;e++)c[e]=this.bitReader.readU(8);const g={dts:a,buffer:c,extradata:null};if(i.f[15](this.inCodecpar+48)!==this.streamMuxConfig.profile||i.f[15](this.inCodecpar+136)!==this.streamMuxConfig.sampleRate||i.f[15](this.inCodecpar+116)!==this.streamMuxConfig.channels){this.refSampleDuration=(0,u.k)(BigInt(Math.floor(1024/this.streamMuxConfig.sampleRate*h.SF)),h.KR,this.inTimeBase),n.M[15](this.inCodecpar+48,this.streamMuxConfig.profile),n.M[15](this.inCodecpar+136,this.streamMuxConfig.sampleRate),n.M[15](this.inCodecpar+116,this.streamMuxConfig.channels);const e=(0,f.Ij)((0,o.A)(this.inCodecpar,s.A));i.f[20](this.inCodecpar+12)&&(0,m.Eb)(i.f[20](this.inCodecpar+12)),n.M[20](this.inCodecpar+12,(0,m.sY)(e.length)),(0,d.lW)(i.f[20](this.inCodecpar+12),e.length,e),n.M[15](this.inCodecpar+16,e.length),g.extradata=e}this.caches.push(g),a+=this.refSampleDuration,this.bitReader.skipPadding()}return 0}receiveAVPacket(e){if(this.caches.length){(0,g.Up)(e);const t=this.caches.shift(),a=(0,m.sY)(t.buffer.length);if((0,d.lW)(a,t.buffer.length,t.buffer),(0,g.NX)(e,a,t.buffer.length),n.M[17](e+16,t.dts),n.M[17](e+8,t.dts),n.M[15](e+36,1|i.f[15](e+36)),n.M[17](e+48,this.refSampleDuration),t.extradata){const a=(0,m.sY)(t.extradata.length);(0,d.lW)(a,t.extradata.length,t.extradata),(0,g.Ow)(e,1,a,t.extradata.length)}return 0}return p.LT}reset(){return this.bitReader.reset(),0}}},61702:(e,t,a)=>{a.d(t,{A:()=>m});var r=a(134),i=a(63939),n=a(50932),s=a(64436),o=a(77231),c=a(44328),d=a(22576),l=a(4624),p=a(9705),h=a(71517),f=a(37837),u=a(14686);class m extends s.A{constructor(...e){super(...e),(0,r.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],0}sendAVPacket(e){let t=0,a=i.f[17](e+16)||i.f[17](e+8);const r=(0,h.iI)(e);for(;t<r.length;){const e=r[t]<<3|r[t+1]>>5;if(1023!==e)return l.z3(`MpegtsOpusParser found syncWord not 0x3ff, got: 0x${e.toString(16)}`,"src/avformat/bsf/opus/Mpegts2RawFilter.ts",67),p.LR;const n=!!(16&r[t+1]),s=!!(8&r[t+1]);let h=t+2,f=0;for(;255===r[h];)f+=255,h++;f+=r[h],h++,h+=n?2:0,h+=s?2:0;let u=r.subarray(h,h+f);const m=i.f[15](this.inCodecpar+136)>0?i.f[15](this.inCodecpar+136):48e3,g=(0,c.k)(BigInt(Math.floor(d.kt(u)/m*o.SF)),o.KR,this.inTimeBase);this.caches.push({dts:a,buffer:u.slice(),duration:Number(g)}),a+=g,t=h+f}}receiveAVPacket(e){if(this.caches.length){(0,h.Up)(e);const t=this.caches.shift(),a=(0,f.sY)(t.buffer.length);return(0,u.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[15](e+36,1|i.f[15](e+36)),n.M[17](e+48,BigInt(Math.floor(t.duration))),0}return p.LR}reset(){return 0}}},85947:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(134);class i{constructor(){(0,r.A)(this,"type",-1),(0,r.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},59331:(e,t,a)=>{a.r(t),a.d(t,{default:()=>z});var r=a(134),i=a(63939),n=a(50932),s=a(4624),o=a(19770),c=a(53783),d=a(27274),l=a(39e3),p=a(9705),h=a(51660),f=a(39144),u=a(52088),m=a(6403),g=a(85947),A=a(86191),x=a(71517),y=a(77231),I=a(52071),b=a(44328),P=a(72739),k=a(64093),M=a(62815),C=a(67659),S=a(59166),R=a(95832),v=a(22576),U=a(87518),w=a(43290),B=a(37837),L=a(14686),T=a(67672);const F="src/avformat/formats/IMpegtsFormat.ts";class z extends g.A{constructor(){super(),(0,r.A)(this,"type",2),(0,r.A)(this,"context",void 0),(0,r.A)(this,"firstTSPacketPos",void 0),(0,r.A)(this,"cacheAVPacket",void 0),this.context=(0,o.A)()}init(e){e.ioReader&&e.ioReader.setEndian(!0),this.cacheAVPacket=0}async destroy(e){this.cacheAVPacket&&((0,x.Qe)(this.cacheAVPacket),this.cacheAVPacket=0),P.__(e.streams,(e=>{const t=e.privData;t.filter&&(t.filter.destroy(),t.filter=null)}))}async readHeader(e){try{let t=0,a=await c.q(e.ioReader);for(a||(a=d.ZT),this.context.tsPacketSize=a,this.context.tsPacketSize!==d.VG&&71!==await e.ioReader.peekUint8()&&await this.syncTSPacket(e,!1);!this.context.hasPAT||!this.context.hasPMT;){const t=await c.$(e.ioReader,this.context);t.payload&&(0!==t.pid&&t.pid!==this.context.currentPmtPid&&134!==this.context.pmt.pid2StreamType.get(t.pid)||(0,l.A)(t,this.context))}return this.context.hasPAT&&this.context.hasPMT?(this.firstTSPacketPos=e.ioReader.getPos(),t):p.LR}catch(t){return s.z3(t.message,F,147),e.ioReader.error}}checkExtradata(e,t){if(!t.codecpar.extradata){let a=(0,x.rU)(e,1);if(!a)return;t.codecpar.extradata=(0,B.sY)(i.f[15](a+4)),(0,L.Mr)(t.codecpar.extradata,i.f[20](a),i.f[15](a+4)),t.codecpar.extradataSize=i.f[15](a+4),(0,x.Is)(e,1),27===t.codecpar.codecId?M.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):173===t.codecpar.codecId?C.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):196===t.codecpar.codecId?S.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):86018===t.codecpar.codecId?R.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):86076===t.codecpar.codecId&&v.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize))}}parsePESSlice(e,t,a,r){const o=(0,f.A)(a);(0,h.A)(o),(o.randomAccessIndicator||1===r.codecpar.codecType)&&n.M[15](t+36,1|i.f[15](t+36));const c=r.codecpar.codecId;27!==c&&173!==c&&196!==c||n.M[15](t+80,2),n.M[15](t+32,r.index),n.M[17](t+16,o.dts),n.M[17](t+8,o.pts),n.M[17](t+56,o.pos),n.M[15](t+76,9e4),n.M[15](t+72,1),r.startTime===y.Dh&&(r.startTime=i.f[17](t+8)||i.f[17](t+16));const d=(0,B.sY)(o.payload.length);(0,L.lW)(d,o.payload.length,o.payload),(0,x.NX)(t,d,o.payload.length),(0,u.A)(a);const l=r.privData;if(l.filter){let a=0;if(a=l.filter.sendAVPacket(t),a<0)return s.z3("send avpacket to bsf failed",F,223),p.LR;if(a=l.filter.receiveAVPacket(t),a<0)return s.z3("receive avpacket from bsf failed",F,230),p.LR;for(n.M[15](t+76,9e4),n.M[15](t+72,1),n.M[15](t+32,r.index),this.checkExtradata(t,r);;){const t=this.cacheAVPacket||(0,x._5)();if(a=l.filter.receiveAVPacket(t),0!==a){this.cacheAVPacket=t;break}n.M[15](t+76,9e4),n.M[15](t+72,1),n.M[15](t+32,r.index),this.checkExtradata(t,r),e.interval.packetBuffer.push(t),this.cacheAVPacket=0}}else{const e=this.context.pmt.pid2StreamType.get(l.pid);if(3===e||4===e){n.M[15](t+36,1|i.f[15](t+36));const e=(0,x.iI)(t),a=e[1]>>>3&3,s=(6&e[1])>>1,o=(12&e[2])>>>2,c=3&~(e[3]>>>6)?2:1,d=k.Au(s),l=k.Y2(a,o);(r.codecpar.profile!==d||r.codecpar.sampleRate!==l||r.codecpar.chLayout.nbChannels!==c)&&(r.codecpar.profile=d,r.codecpar.sampleRate=l,r.codecpar.chLayout.nbChannels=c)}else if(27===r.codecpar.codecId)r.codecpar.extradata||(M.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(173===r.codecpar.codecId)r.codecpar.extradata||(C.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(196===r.codecpar.codecId)r.codecpar.extradata||(S.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(86019===r.codecpar.codecId||86056===r.codecpar.codecId){if(r.codecpar.sampleRate===y.N_){const e=U.R((0,x.iI)(t));T.ai(e)||(r.codecpar.sampleRate=e.sampleRate,r.codecpar.chLayout.nbChannels=e.channels)}}else if(86020===r.codecpar.codecId&&r.codecpar.sampleRate===y.N_){const e=w.R((0,x.iI)(t));T.ai(e)||(r.codecpar.sampleRate=e.sampleRate,r.codecpar.chLayout.nbChannels=e.channels)}}return 0}async readAVPacket_(e,t){if(this.context.ioEnd){if(!this.context.tsSliceQueueMap.size)return-1048576;const a=this.context.tsSliceQueueMap.values();let r;for(;;){const e=a.next();if(e.value&&e.value.slices.length){r=e.value;break}if(e.done)break}if(!r)return-1048576;const i=e.streams.find((e=>e.privData.pid===r.pid));return i?this.parsePESSlice(e,t,r,i):((0,u.A)(r),this.readAVPacket_(e,t))}try{for(;;){if(this.context.tsPacketSize!==d.VG&&71!==await e.ioReader.peekUint8()){try{await e.ioReader.flush()}catch(e){}await this.syncTSPacket(e,!1)}const i=await c.$(e.ioReader,this.context);if(!i.payload)continue;if(0===i.pid||i.pid===this.context.currentPmtPid||134===this.context.pmt.pid2StreamType.get(i.pid)){(0,l.A)(i,this.context);continue}const n=this.context.pmt.pid2StreamType.get(i.pid);if(!n)continue;let s=e.streams.find((e=>e.privData.pid===i.pid));s||(s=e.createStream(),(0,A.A)(i.pid,s,this.context));let o=i.payload[4]<<8|i.payload[5],p=this.context.tsSliceQueueMap.get(i.pid),h=!1;if(p){if(p.totalLength>0&&i.payloadUnitStartIndicator){const a=this.parsePESSlice(e,t,p,s);if(a<0)return a;h=!0}}else{if(!i.payloadUnitStartIndicator)continue;p=new m.pi,this.context.tsSliceQueueMap.set(i.pid,p)}var a,r;if(i.payloadUnitStartIndicator&&(p.randomAccessIndicator=null!==(a=null===(r=i.adaptationFieldInfo)||void 0===r?void 0:r.randomAccessIndicator)&&void 0!==a?a:0,p.pos=i.pos,p.pid=i.pid,p.streamType=n,p.expectedLength=0===o?0:o+6),p.slices.push(i.payload),p.totalLength+=i.payload.length,p.expectedLength>0&&p.expectedLength===p.totalLength){const a=this.parsePESSlice(e,t,p,s);if(a<0)return a;h=!0}if(h)return 0}}catch(a){return-1048576!==e.ioReader.error||this.context.ioEnd?-1048576===e.ioReader.error?-1048576:(s.z3(`read packet error, ${a}`,F,474),p.LR):(this.context.ioEnd=!0,this.readAVPacket_(e,t))}}async readAVPacket(e,t){try{return this.readAVPacket_(e,t)}catch(t){return-1048576!==e.ioReader.error&&s.z3(t.message,F,487),e.ioReader.error}}async syncTSPacket(e,t=!0){let a=y.Dh;for(;;)try{if(71===await e.ioReader.readUint8()){a=this.context.tsPacketSize===d.VG?e.ioReader.getPos()-BigInt(5):e.ioReader.getPos()-BigInt(1);let t=0,r=e.ioReader.getPos();for(;t<=10&&(await e.ioReader.skip(this.context.tsPacketSize-1),71===await e.ioReader.readUint8());)t++;if(t<10){a=y.Dh,await e.ioReader.seek(r);continue}break}}catch(e){a=y.Dh;break}if(a!==y.Dh&&(await e.ioReader.seek(a),t))for(;;){if((await c.$(e.ioReader,this.context)).payloadUnitStartIndicator){await e.ioReader.seek(a),e.streams.forEach((e=>{let t=this.context.tsSliceQueueMap.get(e.privData.pid);t&&(0,u.A)(t)}));break}a=e.ioReader.getPos()}}async seek(e,t,a,r){let i=e.ioReader.getPos();if(this.context.tsSliceQueueMap.forEach((e=>{e.slices.length&&e.pos<i&&(i=e.pos),(0,u.A)(e)})),this.context.pmt.pid2StreamType.forEach(((e,t)=>{this.context.tsSliceQueueMap.delete(t)})),16&r){const r=(0,b.k)(a,t.timeBase,y.i0);return await e.ioReader.seek(r,!0),this.context.ioEnd=!1,BigInt(0)}if(2&r){const t=await e.ioReader.fileSize();return t<=BigInt(0)?BigInt(p.E$):(a<BigInt(0)?a=BigInt(0):a>t&&(a=t),await e.ioReader.seek(a),4&r||await this.syncTSPacket(e),this.context.ioEnd=!1,i)}{if(t&&t.sampleIndexes.length){let r=P.El(t.sampleIndexes,(e=>e.pts>a?-1:1));if(r>0&&(0,b.k)(a-t.sampleIndexes[r-1].pts,t.timeBase,y.i0)<BigInt(1e4))return s.Yz(`seek in sampleIndexes, found index: ${r}, pts: ${t.sampleIndexes[r-1].pts}, pos: ${t.sampleIndexes[r-1].pos}`,F,625),await e.ioReader.seek(t.sampleIndexes[r-1].pos),this.context.ioEnd=!1,i}s.Yz("not found any keyframe index, try to seek in bytes",F,632);let r=await(0,I.A)(e,t,a,this.firstTSPacketPos,this.readAVPacket.bind(this),this.syncTSPacket.bind(this));return r>=0&&(this.context.ioEnd=!1),r}}getAnalyzeStreamsCount(){var e,t;return null!==(e=null===(t=this.context.pmt)||void 0===t?void 0:t.pid2StreamType.size)&&void 0!==e?e:0}}},89564:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(27274);function i(e,t,a){const i=new Uint8Array(r.GV);let n=0,s=0;for(let r=0;r<e.length-3;r++)if(71===e[r]){const o=8191&(e[r+1]<<8|e[r+2]);let c=48&e[r+3];if(!a||8191===o||c){const e=r%t;i[e]++,n++,i[e]>s&&(s=i[e])}}return s-Math.max(n-10*s,0)/10}},52088:(e,t,a)=>{function r(e){e.slices=[],e.totalLength=0,e.expectedLength=-1}a.d(t,{A:()=>r})},19770:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(80662),i=a.n(r),n=a(77231),s=a(6403);function o(){return{currentProgram:n.N_,currentPmtPid:n.N_,tsPacketSize:n.N_,hasPAT:!1,hasPMT:!1,tsSliceQueueMap:new(i()),pat:new s.Cd,pmt:new s.I4,program2Pmt:new(i()),ioEnd:!1,startPid:256,delay:BigInt(0)}}},76538:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(77231);function i(){return{pid:r.N_,filter:null,tsPacket:null,pes:null,continuityCounter:0,pesSlices:{total:0,buffers:[]},latm:!1}}},39e3:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(6403),i=a(52088),n=a(63599);function s(e,t){const a=t.tsSliceQueueMap.get(e.pid);if(e.payloadUnitStartIndicator){const c=e.payload[0];if(a&&a.totalLength>0){const r=e.payload.slice(1,Math.min(1+c,e.payload.length));a.slices.push(r),a.totalLength+=r.length,a.totalLength===a.expectedLength?((0,n.A)(e.pid,a,t),(0,i.A)(a)):((0,i.A)(a),t.tsSliceQueueMap.delete(e.pid))}for(let a=1+c;a<e.payload.length;){var s,o;if(255===e.payload[a])break;const c=(15&e.payload[a+1])<<8|e.payload[a+2],d=new r.pi;d.pid=e.pid,d.expectedLength=c+3,d.randomAccessIndicator=null!==(s=null===(o=e.adaptationFieldInfo)||void 0===o?void 0:o.randomAccessIndicator)&&void 0!==s?s:0;const l=e.payload.slice(a,Math.min(a+d.expectedLength-d.totalLength,e.payload.length));d.slices.push(l),d.totalLength+=l.length,t.tsSliceQueueMap.set(e.pid,d),d.totalLength===d.expectedLength?((0,n.A)(e.pid,d,t),(0,i.A)(d)):((0,i.A)(d),t.tsSliceQueueMap.delete(e.pid)),a+=l.length}}else if(a&&0!==a.totalLength){const r=e.payload.slice(0,Math.min(a.expectedLength-a.totalLength,e.payload.length));a.slices.push(r),a.totalLength+=r.length,a.totalLength===a.expectedLength?((0,n.A)(e.pid,a,t),(0,i.A)(a)):((0,i.A)(a),t.tsSliceQueueMap.delete(e.pid))}}},86191:(e,t,a)=>{a.d(t,{A:()=>h});var r=a(61499),i=a(76538),n=a(27274),s=a(50848),o=a(36488),c=a(61702),d=a(22576),l=a(37837),p=a(14686);function h(e,t,a){t.timeBase.den=9e4,t.timeBase.num=1;const h=(0,i.A)();h.pid=e,t.privData=h;const f=a.pmt.pid2StreamType.get(e);if(6===f){const r=a.pmt.pid2ESDescriptor.get(e);if(t.codecpar.codecType=2,r){var u;const e=r.find((e=>5===e.tag));if(e&&(null===(u=e.buffer)||void 0===u?void 0:u.length)>=4)if("O"===String.fromCharCode(e.buffer[0])||"p"===String.fromCharCode(e.buffer[1])||"u"===String.fromCharCode(e.buffer[2])||"s"===String.fromCharCode(e.buffer[3])){t.codecpar.codecType=1,t.codecpar.codecId=86076,t.codecpar.sampleRate=48e3;const e=r.find((e=>127===e.tag));if(e&&128===e.buffer[0]){t.codecpar.chLayout.nbChannels=15&e.buffer[1]?15&e.buffer[1]:2;const a=d.Ij(t.codecpar);a&&(t.codecpar.extradata=(0,l.sY)(a.length),(0,p.lW)(t.codecpar.extradata,a.length,a),t.codecpar.extradataSize=a.length)}}else if("A"===String.fromCharCode(e.buffer[0])||"V"===String.fromCharCode(e.buffer[1])||"0"===String.fromCharCode(e.buffer[2])||"1"===String.fromCharCode(e.buffer[3])){t.codecpar.codecType=0,t.codecpar.codecId=225;const e=r.find((e=>128===e.tag));e&&(t.codecpar.extradata=(0,l.sY)(e.buffer.length),(0,p.lW)(t.codecpar.extradata,e.buffer.length,e.buffer),t.codecpar.extradataSize=e.buffer.length)}}}else{const e=n.$x[f];e?(t.codecpar.codecType=e[0],t.codecpar.codecId=e[1]):t.codecpar.codecType=2}let m;switch(f){case 15:m=new s.A;break;case 17:m=new o.A;break;case 27:case 36:break;case 6:86076===t.codecpar.codecId&&(m=new c.A)}return m&&(t.privData.filter=m,m.init(t.codecpar[r.o9],t.timeBase[r.o9])),t}},31239:(e,t,a)=>{function r(e,t){let a=0,r=e[a++];if(t.adaptationFieldInfo.discontinuityIndicator=r>>7&1,t.adaptationFieldInfo.randomAccessIndicator=r>>6&1,t.adaptationFieldInfo.elementaryStreamPriorityIndicator=r>>5&1,t.adaptationFieldInfo.pcrFlag=r>>4&1,t.adaptationFieldInfo.opcrFlag=r>>3&1,t.adaptationFieldInfo.splicingPointFlag=r>>2&1,t.adaptationFieldInfo.transportPrivateDataFlag=r>>1&1,t.adaptationFieldInfo.adaptationFieldExtensionFlag=1&r,t.adaptationFieldInfo.pcrFlag){const r=BigInt(Math.floor(e[a++]<<25|e[a++]<<17|e[a++]<<9|e[a++]<<1|e[a]>>7)),i=BigInt(Math.floor((1&e[a++])<<8|e[a++]));t.adaptationFieldInfo.pcr=r*BigInt(300)+i}if(t.adaptationFieldInfo.opcrFlag){const r=BigInt(Math.floor(e[a++]<<25|e[a++]<<17|e[a++]<<9|e[a++]<<1|e[a]>>7)),i=BigInt(Math.floor((1&e[a++])<<8|e[a++]));t.adaptationFieldInfo.pcr=r*BigInt(300)+i}if(t.adaptationFieldInfo.splicingPointFlag&&(t.adaptationFieldInfo.spliceCountDown=e[a++]),t.adaptationFieldInfo.transportPrivateDataFlag){const r=e[a++];t.adaptationFieldInfo.transportPrivateData=e.subarray(a,a+r),a+=r}if(t.adaptationFieldInfo.adaptationFieldExtensionFlag){const r=e[a++];t.adaptationFieldInfo.extension=e.subarray(a,a+r),a+=r}}a.d(t,{A:()=>r})},20549:(e,t,a)=>{a.d(t,{A:()=>c});var r=a(31865),i=a(6403),n=a(92647),s=a(4624);const o="src/avformat/formats/mpegts/function/parsePAT.ts";function c(e,t){let a=0;const c=new r.A((0,n.A)(Uint8Array,e.slices),!0),d=c.readUint8();0!==d&&s.z3(`parsePAT: table_id ${d} is not corresponded to PAT!`,o,40);const l=4095&c.readUint16();c.readUint16(),a=c.readUint8();const p=a>>1&31,h=1&a,f=c.readUint8();let u;if(c.readUint8(),1===h&&0===f)u=new i.Cd,u.versionNumber=p;else if(u=t.pat,!u)return void s.z3("can not found PAT in mpegts context",o,64);const m=l-5-4,g=Number(BigInt.asIntN(32,c.getPos()))+m;let A=-1,x=-1;for(;c.getPos()<g;){const e=c.readUint16(),t=8191&c.readUint16();0===e?u.networkPid=t:(u.program2PmtPid.set(e,t),-1===A&&(A=e),-1===x&&(x=t))}1===h&&0===f&&(t.pat||s.pq("parsed first PAT",o,100),t.pat=u,t.currentProgram=A,t.currentPmtPid=x,t.hasPAT=!0)}},51660:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(77231),i=a(4624),n=a(9705);const s="src/avformat/formats/mpegts/function/parsePES.ts";function o(e){const t=e.data,a=t[3],o=t[4]<<8|t[5];let c=0,d=0,l=0;if(188!==a&&190!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a){let a=r.Dh,p=r.Dh;for(;;){if(6+d>=t.length)return;if(l=t[6+d],255!==l)break;d++}if(64==(192&l)&&(d+=2,l=t[6+d]),32==(224&l))c+=5,a=a=BigInt(Math.floor(536870912*(14&t[6+d])+4194304*(255&t[7+d])+16384*(254&t[8+d])+128*(255&t[9+d])+(254&t[10+d])/2)),16&l?(p=BigInt(Math.floor(536870912*(14&t[11+d])+4194304*(255&t[12+d])+16384*(254&t[13+d])+128*(255&t[14+d])+(254&t[15+d])/2)),c+=5):p=a;else if(128==(192&l)){const e=(192&t[7+d])>>>6;c=3+t[8+d],2!==e&&3!==e||(a=BigInt(Math.floor(536870912*(14&t[9+d])+4194304*(255&t[10+d])+16384*(254&t[11+d])+128*(255&t[12+d])+(254&t[13+d])/2)),p=3===e?BigInt(Math.floor(536870912*(14&t[14+d])+4194304*(255&t[15+d])+16384*(254&t[16+d])+128*(255&t[17+d])+(254&t[18+d])/2)):a)}else{if(15!==l)return i.z3("invalid data",s,121),n.LR;c=1}e.dts=p,e.pts=a;const h=6+d+c;let f=0;if(0!==o){if(o<d+c)return void i.z3("Malformed PES: PES_packet_length < 3 + PES_header_data_length",s,133);f=o-(d+c)}else f=t.byteLength-h;e.payload=t.subarray(h,h+f)}else if((188===a||191===a||240===a||241===a||255===a||242===a||248===a)&&6===e.streamId){const a=6;let r=0;r=0!==o?o:t.byteLength-a,e.payload=t.subarray(a,a+r)}return 0}},39144:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(6403);function i(e){let t=new Uint8Array(e.totalLength);for(let a=0,r=0;a<e.slices.length;a++){let i=e.slices[a];t.set(i,r),r+=i.byteLength}const a=t[3],i=new r.xf;return i.data=t,i.pid=e.pid,i.streamId=a,i.streamType=e.streamType,i.pos=e.pos,i.randomAccessIndicator=e.randomAccessIndicator,i}},65945:(e,t,a)=>{a.d(t,{A:()=>c});var r=a(31865),i=a(6403),n=a(92647),s=a(4624);const o="src/avformat/formats/mpegts/function/parsePMT.ts";function c(e,t){let a=0;const c=new r.A((0,n.A)(Uint8Array,e.slices),!0),d=c.readUint8();2!==d&&s.z3(`parse PMT: table_id ${d} is not corresponded to PAT!`,o,40);const l=4095&c.readUint16(),p=c.readUint16();a=c.readUint8();const h=a>>1&31,f=1&a,u=c.readUint8();let m;if(c.readUint8(),1===f&&0===u)m=new i.I4,m.programNumber=p,m.versionNumber=h,t.program2Pmt.set(p,m),t.hasPMT=!0;else if(m=t.program2Pmt.get(p),!m)return void s.z3("can not found PMT in mpegts context",o,68);m.pcrPid=8191&c.readUint16();const g=4095&c.readUint16();c.skip(g);let A=Number(BigInt.asIntN(32,c.getPos()))+(l-9-g-4);for(;c.getPos()<A;){const e=c.readUint8(),t=8191&c.readUint16(),a=4095&c.readUint16();if(m.pid2StreamType.set(t,e),a>0){const e=[],r=Number(BigInt.asIntN(32,c.getPos()))+a;for(;c.getPos()<r;){const t=new i.kJ;t.tag=c.readUint8();const a=c.readUint8();a>0&&(t.buffer=c.readBuffer(a)),e.push(t)}m.pid2ESDescriptor.set(t,e)}}p===t.currentProgram&&(t.pmt||s.pq("parsed first PMT",o,111),t.pmt=m)}},43383:(e,t,a)=>{function r(e,t){}a.d(t,{A:()=>r})},63599:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(20549),i=a(65945),n=a(43383);function s(e,t,a){0===e?(0,r.A)(t,a):e===a.currentPmtPid?(0,i.A)(t,a):a.pmt&&134===a.pmt.pid2StreamType.get(e)&&(0,n.A)(t,a)}},53783:(e,t,a)=>{a.d(t,{$:()=>p,q:()=>l});var r=a(27274),i=a(89564),n=a(4624),s=a(6403),o=a(31239),c=a(20576);const d="src/avformat/formats/mpegts/impegts.ts";async function l(e){let t;try{t=await e.peekBuffer(r.pm)}catch(a){-1048576!==e.error&&(t=await e.peekBuffer(e.remainingLength()))}if(t&&t.length>=r.ZT){const e=(0,i.A)(t,r.ZT,!1),a=(0,i.A)(t,r.VG,!1),s=(0,i.A)(t,r.eR,!1);let o=(0,c.A)([e,s,a]);t.length<r.pm&&(o+=r.hY);let l=r.ZT;return e>o?l=r.ZT:a>o?l=r.VG:s>o&&(l=r.eR),n.Yz(`got ts packet size: ${l}`,d,72),l}return 0}async function p(e,t){const a=e.getPos();let i=0;t.tsPacketSize===r.VG&&await e.skip(4);const c=await e.readUint8();71!==c&&n.h2(`found syncByte not 0x47, value: ${c.toString(16)}`,d,94);const l=new s.am;l.pos=a,i=await e.readUint16(),l.payloadUnitStartIndicator=i>>14&1,l.transportPriority=i>>13&1,l.pid=8191&i,i=await e.readUint8(),l.adaptationFieldControl=i>>4&3,l.continuityCounter=15&i;let p=4;if(2===l.adaptationFieldControl||3===l.adaptationFieldControl){const a=await e.readUint8();if(5+a===r.ZT)return(0,o.A)(await e.readBuffer(a),l),t.tsPacketSize===r.eR&&await e.skip(16),l;a>0&&(0,o.A)(await e.readBuffer(a),l),p=5+a}return 1!==l.adaptationFieldControl&&3!==l.adaptationFieldControl||(l.payload=await e.readBuffer(r.ZT-p)),t.tsPacketSize===r.eR&&await e.skip(16),l}},27274:(e,t,a)=>{a.d(t,{$x:()=>d,GV:()=>s,VG:()=>i,ZT:()=>n,eR:()=>r,hY:()=>c,pm:()=>o});const r=204,i=192,n=188,s=204,o=8192,c=5,d={15:[1,86018],17:[1,86018],3:[1,86017],4:[1,86017],1:[0,2],2:[0,2],27:[0,27],16:[0,12],36:[0,173],51:[0,196],129:[1,86019],135:[1,86056],130:[1,86020]}},6403:(e,t,a)=>{a.d(t,{Cd:()=>l,I4:()=>h,am:()=>c,kJ:()=>p,pi:()=>d,xf:()=>f});var r=a(134),i=a(80662),n=a.n(i),s=a(77231);class o{constructor(){(0,r.A)(this,"discontinuityIndicator",0),(0,r.A)(this,"randomAccessIndicator",0),(0,r.A)(this,"elementaryStreamPriorityIndicator",0),(0,r.A)(this,"pcrFlag",0),(0,r.A)(this,"opcrFlag",0),(0,r.A)(this,"splicingPointFlag",0),(0,r.A)(this,"transportPrivateDataFlag",0),(0,r.A)(this,"adaptationFieldExtensionFlag",0),(0,r.A)(this,"pcr",BigInt(0)),(0,r.A)(this,"opcr",BigInt(0)),(0,r.A)(this,"spliceCountDown",0),(0,r.A)(this,"transportPrivateData",null),(0,r.A)(this,"extension",null)}}class c{constructor(){(0,r.A)(this,"pos",s.Dh),(0,r.A)(this,"payloadUnitStartIndicator",0),(0,r.A)(this,"transportPriority",0),(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"adaptationFieldControl",0),(0,r.A)(this,"continuityCounter",0),(0,r.A)(this,"transportScramblingControl",0),(0,r.A)(this,"adaptationFieldInfo",new o),(0,r.A)(this,"payload",null)}}class d{constructor(){(0,r.A)(this,"slices",[]),(0,r.A)(this,"totalLength",0),(0,r.A)(this,"expectedLength",s.N_),(0,r.A)(this,"randomAccessIndicator",0),(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"streamType",0),(0,r.A)(this,"pos",s.Dh)}}class l{constructor(){(0,r.A)(this,"versionNumber",0),(0,r.A)(this,"networkPid",s.N_),(0,r.A)(this,"program2PmtPid",new(n()))}}class p{constructor(){(0,r.A)(this,"tag",void 0),(0,r.A)(this,"buffer",void 0)}}class h{constructor(){(0,r.A)(this,"versionNumber",0),(0,r.A)(this,"programNumber",0),(0,r.A)(this,"pcrPid",0),(0,r.A)(this,"pid2StreamType",new(n())),(0,r.A)(this,"pid2ESDescriptor",new(n()))}}class f{constructor(){(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"streamType",0),(0,r.A)(this,"streamId",s.N_),(0,r.A)(this,"dts",s.Dh),(0,r.A)(this,"pts",s.Dh),(0,r.A)(this,"pos",s.Dh),(0,r.A)(this,"payload",null),(0,r.A)(this,"data",null),(0,r.A)(this,"randomAccessIndicator",0)}}},2187:(e,t,a)=>{a.d(t,{d:()=>s});var r=a(72739),i=a(44328),n=a(77231);function s(e,t,a){let s=BigInt(0);return r.__(e,(e=>{s+=e.codecpar.bitrate*(0,i.k)(t,a,n.i0)/BigInt(8e3)})),s}},52071:(e,t,a)=>{a.d(t,{A:()=>f});var r=a(63939),i=a(9599),n=a(29170),s=a(77231),o=a(44328),c=a(2187),d=a(71517),l=a(9705),p=a(4624);const h="src/avformat/function/seekInBytes.ts";async function f(e,t,a,f,u,m){const g=e.ioReader.getPos(),A=await e.ioReader.fileSize();let x=s.Dh,y=a;t.startTime!==s.Dh?y-=t.startTime:y-=t.firstDTS;const I=(0,o.k)(a,t.timeBase,s.i0);if(I<BigInt(1e4))return p.Yz(`seek pts is earlier then 10s, seek to first packet pos(${f}) directly`,h,64),await e.ioReader.seek(f),g;let b=(0,c.d)(e.streams,y,t.timeBase);const P=A-(0,c.d)(e.streams,BigInt(1e4),s.i0),k=(0,c.d)(e.streams,BigInt(1e4),s.i0);if(b>P&&(b=P),b<f)return await e.ioReader.seek(f),g;const M=(0,d._5)();let C=A,S=BigInt(0);for(;;){if(C-S<k){x=S;break}if(await e.ioReader.seek(b),await m(e),8&e.ioReader.flags)break;const t=e.ioReader.getPos();if(!(await u(e,M)>=0)){x=s.Dh;break}{const e=(0,o.k)(r.f[17](M+8),(0,n.A)(M+72,i.P),s.i0),a=e-I;if(p.Yz(`try to seek to pos: ${b}, got packet pts: ${r.f[17](M+8)}(${e}ms), diff: ${a}ms`,h,102),a<=BigInt(0)&&-a<BigInt(1e4)){x=t;break}a>BigInt(0)?(C=b,b=S+C>>BigInt(1)):(S=b,b=S+C>>BigInt(1))}if(8&e.ioReader.flags)break}return(0,d.Qe)(M),x!==s.Dh?(p.Yz(`finally seek to pos ${x}`,h,133),await e.ioReader.seek(x),await m(e),g):(await e.ioReader.seek(g),8&e.ioReader.flags?BigInt(l.LT):BigInt(l.E$))}},95832:(e,t,a)=>{a.d(t,{Bq:()=>p,Ij:()=>l,XC:()=>d,f7:()=>h,uF:()=>n});var r=a(77231),i=a(37246);const n={1:"Main",2:"LC",3:"LC",4:"LC",5:"HE",6:"HE"},s={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,r.N_,r.N_,r.N_],c=[r.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:i,channels:n}=function(e){let t=r.N_,a=r.N_,i=r.N_;var n,s;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,i=null!==(s=c[e[1]>>3&15])&&void 0!==s?s:2),{profile:t,sampleRate:a,channels:i}}(t);e.codecpar.profile=a,e.codecpar.sampleRate=i,e.codecpar.chLayout.nbChannels=n}}function l(e){const t=s[e.sampleRate],a=e.chLayout.nbChannels,i=e.profile===r.N_?2:e.profile,n=new Uint8Array(2);return n[0]=(31&i)<<3|(14&t)>>1,n[1]=(1&t)<<7|(15&a)<<3,n}function p(e){if(e.length<7)return-1;const t=e[0]<<4|e[1]>>4;if(4095!==t)return-1;const a=1&e[1],r=(192&e[2])>>>6,i=(60&e[2])>>>2,n=(1&e[2])<<2|(192&e[3])>>>6,s=(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5,d=3&e[6];let l=1===a?7:9,p=s-l;return{syncWord:t,profile:r+1,sampleRate:o[i],channels:c[n],aacFrameLength:s,numberOfRawDataBlocksInFrame:d,headerLength:l,framePayloadLength:p}}function h(e,t){function a(){const e=t.readU(2);let a=0;for(let r=0;r<=e;r++)a<<=8,a|=t.readU(8);return a}t||(t=new i.A).appendBuffer(e);const r=t.getPointer(),n={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},s=t.readU(11);if(695!==s)return-1;n.syncWord=s,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 r=e?a():0;const i=t.readU(5);r-=5;const s=t.readU(4);r-=4;const d=t.readU(4);if(r-=4,t.readU(3),r-=3,r>0&&t.readU(r),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=i+1,n.sampleRate=o[s],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()-r+(8===t.getBitLeft()?0:1),n}},87518:(e,t,a)=>{a.d(t,{R:()=>f,j:()=>i});var r=a(37246);const i=[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]],s=[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],p=[1,2,3,6],h=7;function f(e){const t=new r.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=s[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<h)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=p[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(i[a.channelMode]),a.lfeOn&&(a.channelLayout|=BigInt(8)),a}},43290:(e,t,a)=>{a.d(t,{R:()=>d,u:()=>c});var r=a(37246),i=a(95073);const n=[1,2,2,2,2,3,3,4,4,5,6,6,6,7,8,8],s=[0,8e3,16e3,32e3,0,0,11025,22050,44100,0,0,12e3,24e3,48e3,96e3,192e3],o=[32e3,56e3,64e3,96e3,112e3,128e3,192e3,224e3,256e3,32e4,384e3,448e3,512e3,576e3,64e4,768e3,96e4,1024e3,1152e3,128e4,1344e3,1408e3,1411200,1472e3,1536e3,192e4,2048e3,3072e3,384e4,0,0,0],c=32;function d(e){const t=new r.A(e.length);t.appendBuffer(e);const a={syncWord:0,frameType:0,deficitSamples:0,crcFlag:0,sampleBlock:0,frameSize:0,channelIndex:0,sampleRateIndex:0,bitrateIndex:0,channels:0,sampleRate:0,bitrate:0};return a.syncWord=t.readU(32),2147385345!==a.syncWord&&4269736320!==a.syncWord?-1:(a.frameType=t.readU1(),a.deficitSamples=t.readU(5)+1,a.crcFlag=t.readU1(),a.sampleBlock=t.readU(7)+1,a.frameSize=(0,i.A)(t.readU(14)+1,4),a.channelIndex=t.readU(6),a.sampleRateIndex=t.readU(4),a.bitrateIndex=t.readU(5),a.channels=n[a.channelIndex],a.sampleRate=s[a.sampleRateIndex],a.bitrate=o[a.bitrateIndex],a)}},64093:(e,t,a)=>{a.d(t,{Au:()=>x,He:()=>y,XC:()=>I,Y2:()=>m,hG:()=>g,oz:()=>A});var r=a(77231);const i=[44100,48e3,32e3,0],n=[22050,24e3,16e3,0],s=[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],p=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],h=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],f=[0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],u=[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 s[t];case 2:return n[t];case 3:return i[t]}return r.N_}function g(e,t){switch(e){case 0:return d[t];case 2:return c[t];case 3:return o[t]}return r.N_}function A(e,t,a){switch(t){case 1:switch(e){case 0:case 2:return u[a];case 3:return h[a]}break;case 2:switch(e){case 0:case 2:return u[a];case 3:return p[a]}case 3:switch(e){case 0:case 2:return f[a];case 3:return l[a]}}return r.N_}function x(e){switch(e){case 1:return 34;case 2:return 33;case 3:return 32}return r.N_}const y={32:"Layer1",33:"Layer2",34:"Layer3"};function I(e,t){if(t&&t.length>=4){const a=t[1]>>>3&3,r=(6&t[1])>>1,i=(12&t[2])>>>2,n=3&~(t[3]>>>6)?2:1,s=x(r),o=m(a,i);e.codecpar.profile=s,e.codecpar.sampleRate=o,e.codecpar.chLayout.nbChannels=n}}},22576:(e,t,a)=>{a.d(t,{Ij:()=>d,XC:()=>c,kt:()=>o});var r=a(31865),i=a(729),n=a(44328);const s=[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(e){let t=0,a=0,r=0;if(e.length<1)return 0;switch(t=e[0],a=s[t>>3],3&t){case 0:r=1;break;case 1:case 2:r=2;break;case 3:if(e.length<2)return 0;r=63&e[1]}return r*a}function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=19){const a=new r.A(t,!1);a.skip(9),e.codecpar.chLayout.nbChannels=a.readUint8(),e.codecpar.initialPadding=a.readUint16(),e.codecpar.sampleRate=a.readUint32(),e.codecpar.seekPreroll=Number((0,n.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function d(e){const t=new Uint8Array(19),a=new i.A(t,!1);return a.writeString("OpusHead"),a.writeUint8(1),a.writeUint8(e.chLayout.nbChannels),a.writeUint16(e.initialPadding),a.writeUint32(e.sampleRate),t}},20576:(e,t,a)=>{function r(e){if(0===e.length)return 0;const t=e.slice().sort(((e,t)=>e-t)),a=Math.floor(t.length/2);return t.length%2==1?t[a]:(t[a-1]+t[a])/2}a.d(t,{A:()=>r})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunklibmedia=self.webpackChunklibmedia||[]).push([[344],{47344:(t,e,s)=>{s.r(e),s.d(e,{default:()=>p});var i=s(134),n=s(50932),r=s(4624),a=s(9705),c=s(85947),o=s(14686),l=s(37837),d=s(71517),h=s(72739),u=s(50011),f=s(51785);const m="src/avformat/formats/IAssFormat.ts";class p extends c.A{constructor(){super(),(0,i.A)(this,"type",20),(0,i.A)(this,"queue",void 0),(0,i.A)(this,"index",void 0)}init(t){this.queue=[]}async readHeader(t){const e=await t.ioReader.readLine();if("[Script Info]"!==e.trim())return r.z3("the file format is not ass",m,68),a.LR;const s=t.createStream();s.codecpar.codecId=94230,s.codecpar.codecType=3,s.timeBase.den=1e3,s.timeBase.num=1;let i,n=e+"\n",c=!1,d=0,p=0;for(;;){const e=await t.ioReader.readLine();if(!/^;/.test(e)){if("[Events]"===e.trim()&&(c=!0),/^Format:/.test(e)&&c){n+=e,i=f.Bp(e.trim());for(let t=0;t<i.length;t++)"Start"===i[t]?d=t:"End"===i[t]&&(p=t);break}n+=e+"\n"}}const g=u.encode(n);s.codecpar.extradata=(0,l.sY)(g.length),s.codecpar.extradataSize=g.length,(0,o.lW)(s.codecpar.extradata,g.length,g),this.index=0;let x=BigInt(0);try{for(;;){const e=t.ioReader.getPos(),n=(await t.ioReader.readLine()).trim();if(/^;/.test(n)||/^Comment:/.test(n))continue;const{start:r,end:a}=f.Ew(i,n,d,p);s.nbFrames++,s.duration=a;const c={context:n,startTs:r,endTs:a,pos:e};r>=x?(this.queue.push(c),x=r):h._(this.queue,c,(t=>t.startTs<c.startTs?1:-1))}}catch(t){return 0}}async readAVPacket(t,e){if(!this.queue.length)return a.LR;if(this.index>=this.queue.length)return-1048576;const s=t.streams.find((t=>3===t.codecpar.codecType)),i=this.queue[this.index++];n.M[15](e+32,s.index),n.M[15](e+76,s.timeBase.den),n.M[15](e+72,s.timeBase.num),n.M[17](e+16,i.startTs),n.M[17](e+8,i.startTs),n.M[17](e+48,i.endTs-i.startTs);const r=u.encode(i.context),c=(0,l.sY)(r.length);return(0,o.lW)(c,r.length,r),(0,d.NX)(e,c,r.length),0}async seek(t,e,s,i){if(2&i)return BigInt(a.E$);if(s<=BigInt(0))return this.index=0,BigInt(0);const n=h.El(this.queue,(t=>t.startTs>s?-1:1));if(n>=0){for(r.Yz(`seek in cues, found index: ${n}, pts: ${this.queue[n].startTs}, pos: ${this.queue[n].pos}`,m,217),this.index=Math.max(n-1,0);this.index>0&&(this.queue[this.index-1].startTs===this.queue[this.index].startTs||this.queue[this.index-1].endTs>s);)this.index--;return BigInt(0)}return BigInt(a.LR)}getAnalyzeStreamsCount(){return 1}}},85947:(t,e,s)=>{s.d(e,{A:()=>n});var i=s(134);class n{constructor(){(0,i.A)(this,"type",-1),(0,i.A)(this,"onStreamAdd",void 0)}async destroy(t){}}},5028:(t,e,s)=>{s.d(e,{Q:()=>i});const i=["ReadOrder","Layer","Start","End","Style","Name","MarginL","MarginR","MarginV","Effect","Text"]},51785:(t,e,s)=>{s.d(e,{Bp:()=>l,Ew:()=>h,wj:()=>u}),s(7210);var i=s(4624),n=s(5028),r=s(54825),a=s(44453),c=s(93935);const o="src/avformat/formats/ass/iass.ts";function l(t){return function(t,e){const s=e.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/),n=[];for(let e=0;e<s.length;e++){const r=t.find((t=>t.toLowerCase()===s[e].toLowerCase()));r||i.R8(`not support ass field(${s[e]})`,o,40),n.push(r||s[e])}return n}(n.Q,t)}function d(t,e){let s=e.split(",");if(s.length>t.length){const e=s.slice(t.length-1).join(",");s=s.slice(0,t.length-1),s.push(e)}return s}function h(t,e,s,i){const[,,n]=e.match(/^(\w+?)\s*:\s*(.*)/i),a=d(t,n);return{start:(0,r.j)(a[s]),end:(0,r.j)(a[i])}}function u(t,e){const[,s,i]=e.match(/^(\w+?)\s*:\s*(.*)/i);let n=0;switch(s){case"Comment":n=2;break;case"Dialogue":n=1;break;case"Command":n=6;break;case"Movie":n=5;break;case"Picture":n=3;break;case"Sound":n=4}const o=d(t,i),l={type:n};for(let e=0;e<o.length;e++){l[t[e]]=o[e];const s=t[e],i=o[e].trim();switch(s){case"Layer":case"MarginL":case"MarginR":case"MarginV":l[s]=+i;break;case"Start":case"End":l[s]=(0,r.j)(i);break;case"Effect":l[s]=(0,a.d)(i);break;case"Text":l[s]=(0,c.r)(i);break;default:l[s]=i}}return l}},54825:(t,e,s)=>{function i(t){if(!(t=t.trim()))return-BigInt(1);let e=t.split(":"),s=BigInt(0);return 3===e.length&&(s+=BigInt(+e.shift().trim())*BigInt(36e5)),s+=BigInt(+e.shift().trim())*BigInt(6e4),e=e.shift().trim().split("."),s+=BigInt(+e.shift().trim())*BigInt(1e3),s+=BigInt(+e.shift().trim()),s}function n(t){if(!(t=t.trim()))return-BigInt(1);let e=t.split(":"),s=BigInt(0);return 3===e.length&&(s+=BigInt(+e.shift().trim())*BigInt(36e5)),s+=BigInt(+e.shift().trim())*BigInt(6e4),e=e.shift().trim().split(","),s+=BigInt(+e.shift().trim())*BigInt(1e3),s+=BigInt(+e.shift().trim()),s}s.d(e,{j:()=>i,t:()=>n})},11837:(t,e,s)=>{s(21489),t.exports=s(46438).Number.isNaN},21489:(t,e,s)=>{var i=s(88535);i(i.S,"Number",{isNaN:function(t){return t!=t}})},7210:(t,e,s)=>{t.exports=s(11837)},74672:(t,e,s)=>{function i(t){return t?t.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g," $1 ").replace(/([mnlbspc])/g," $1 ").trim().replace(/\s+/g," ").split(/\s(?=[mnlbspc])/).map((t=>t.split(" ").filter(((t,e)=>!(e&&Number.isNaN(1*t)))))):[]}s.d(e,{O:()=>i})},44453:(t,e,s)=>{function i(t){const e=t.toLowerCase().trim().split(/\s*;\s*/);return"banner"===e[0]?{name:e[0],delay:1*e[1]||0,leftToRight:1*e[2]||0,fadeAwayWidth:1*e[3]||0}:/^scroll\s/.test(e[0])?{name:e[0],y1:Math.min(1*e[1],1*e[2]),y2:Math.max(1*e[1],1*e[2]),delay:1*e[3]||0,fadeAwayHeight:1*e[4]||0}:""!==t?{name:t}:null}s.d(e,{d:()=>i})},53534:(t,e,s)=>{s.d(e,{E:()=>r});var i=s(74672);const n=["b","i","u","s","fsp","k","K","kf","ko","kt","fe","q","p","pbo","a","an","fscx","fscy","fax","fay","frx","fry","frz","fr","be","blur","bord","xbord","ybord","shad","xshad","yshad"].map((t=>({name:t,regex:new RegExp(`^${t}-?\\d`)})));function r(t){const e={};for(let s=0;s<n.length;s++){const{name:i,regex:r}=n[s];if(r.test(t))return e[i]=1*t.slice(i.length),e}if(/^fn/.test(t))e.fn=t.slice(2);else if(/^r/.test(t))e.r=t.slice(1);else if(/^fs[\d+-]/.test(t))e.fs=t.slice(2);else if(/^\d?c&?H?[0-9a-fA-F]+|^\d?c$/.test(t)){const[,s,i]=t.match(/^(\d?)c&?H?(\w*)/);e[`c${s||1}`]=i&&`000000${i}`.slice(-6)}else if(/^\da&?H?[0-9a-fA-F]+/.test(t)){const[,s,i]=t.match(/^(\d)a&?H?([0-9a-f]+)/i);e[`a${s}`]=`00${i}`.slice(-2)}else if(/^alpha&?H?[0-9a-fA-F]+/.test(t))[,e.alpha]=t.match(/^alpha&?H?([0-9a-f]+)/i),e.alpha=`00${e.alpha}`.slice(-2);else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(t)){const[,s,i]=t.match(/^(\w+)\((.*?)\)?$/);e[s]=i.trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(t)){const s=t.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);e.clip={inverse:/iclip/.test(t),scale:1,drawing:null,dots:null},1===s.length&&(e.clip.drawing=(0,i.O)(s[0])),2===s.length&&(e.clip.scale=1*s[0],e.clip.drawing=(0,i.O)(s[1])),4===s.length&&(e.clip.dots=s.map(Number))}else if(/^t\(/.test(t)){const s=t.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,(t=>t.replace(/,/g,"\n"))).split(/\s*,\s*/);if(!s[0])return e;e.t={t1:0,t2:0,accel:1,tags:s[s.length-1].replace(/\n/g,",").split("\\").slice(1).map(r)},2===s.length&&(e.t.accel=1*s[0]),3===s.length&&(e.t.t1=1*s[0],e.t.t2=1*s[1]),4===s.length&&(e.t.t1=1*s[0],e.t.t2=1*s[1],e.t.accel=1*s[2])}return e}},27637:(t,e,s)=>{s.d(e,{r:()=>n});var i=s(53534);function n(t){const e=[];let s=0,n="";const r=t.split("\\").slice(1).concat("").join("\\");for(let t=0;t<r.length;t++){const i=r[t];"("===i&&s++,")"===i&&s--,s<0&&(s=0),s||"\\"!==i?n+=i:(n&&e.push(n),n="")}return e.map(i.E)}},93935:(t,e,s)=>{s.d(e,{r:()=>r});var i=s(74672),n=s(27637);function r(t){const e=t.split(/{([^{}]*?)}/),s=[];e[0].length&&s.push({tags:[],text:e[0],drawing:[]});for(let t=1;t<e.length;t+=2){const r=(0,n.r)(e[t]),a=r.reduce(((t,e)=>void 0===e.p?t:!!e.p),!1);s.push({tags:r,text:a?"":e[t+1],drawing:a?(0,i.O)(e[t+1]):[]})}return{raw:t,combined:s.map((t=>t.text)).join(""),parsed:s}}}}]);
|
|
@@ -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}}}}]);
|