xgplayer-transmuxer 3.0.0-alpha.2

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.
Files changed (60) hide show
  1. package/dist/index.min.js +2 -0
  2. package/dist/index.min.js.map +1 -0
  3. package/es/codec/aac.d.ts +34 -0
  4. package/es/codec/aac.js +242 -0
  5. package/es/codec/avc.d.ts +35 -0
  6. package/es/codec/avc.js +250 -0
  7. package/es/codec/hevc.d.ts +38 -0
  8. package/es/codec/hevc.js +202 -0
  9. package/es/codec/index.d.ts +4 -0
  10. package/es/codec/nalu.d.ts +11 -0
  11. package/es/codec/nalu.js +194 -0
  12. package/es/flv/amf.d.ts +16 -0
  13. package/es/flv/amf.js +247 -0
  14. package/es/flv/fixer.d.ts +31 -0
  15. package/es/flv/fixer.js +437 -0
  16. package/es/flv/index.d.ts +65 -0
  17. package/es/flv/index.js +441 -0
  18. package/es/index.d.ts +5 -0
  19. package/es/index.js +13 -0
  20. package/es/model/audio-sample.d.ts +18 -0
  21. package/es/model/audio-sample.js +26 -0
  22. package/es/model/audio-track.d.ts +38 -0
  23. package/es/model/audio-track.js +94 -0
  24. package/es/model/index.d.ts +6 -0
  25. package/es/model/metadata-track.d.ts +36 -0
  26. package/es/model/metadata-track.js +100 -0
  27. package/es/model/types.d.ts +26 -0
  28. package/es/model/types.js +31 -0
  29. package/es/model/video-sample.d.ts +44 -0
  30. package/es/model/video-sample.js +66 -0
  31. package/es/model/video-track.d.ts +45 -0
  32. package/es/model/video-track.js +99 -0
  33. package/es/mp4/fmp4-remuxer.d.ts +32 -0
  34. package/es/mp4/fmp4-remuxer.js +172 -0
  35. package/es/mp4/index.d.ts +4 -0
  36. package/es/mp4/logger.d.ts +13 -0
  37. package/es/mp4/logger.js +97 -0
  38. package/es/mp4/mp4-demuxer.d.ts +24 -0
  39. package/es/mp4/mp4-demuxer.js +268 -0
  40. package/es/mp4/mp4-parser.d.ts +161 -0
  41. package/es/mp4/mp4-parser.js +776 -0
  42. package/es/mp4/mp4-remuxer.d.ts +23 -0
  43. package/es/mp4/mp4-remuxer.js +273 -0
  44. package/es/mp4/mp4.d.ts +56 -0
  45. package/es/mp4/mp4.js +574 -0
  46. package/es/mpeg-ts/fixer.d.ts +23 -0
  47. package/es/mpeg-ts/fixer.js +383 -0
  48. package/es/mpeg-ts/index.d.ts +60 -0
  49. package/es/mpeg-ts/index.js +480 -0
  50. package/es/utils/env.d.ts +4 -0
  51. package/es/utils/env.js +10 -0
  52. package/es/utils/exp-golomb.d.ts +17 -0
  53. package/es/utils/exp-golomb.js +172 -0
  54. package/es/utils/index.d.ts +11 -0
  55. package/es/utils/index.js +77 -0
  56. package/es/utils/logger.d.ts +9 -0
  57. package/es/utils/logger.js +45 -0
  58. package/es/utils/utf8.d.ts +9 -0
  59. package/es/utils/utf8.js +91 -0
  60. package/package.json +25 -0
@@ -0,0 +1,437 @@
1
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
2
+ import _createClass from '@babel/runtime/helpers/createClass';
3
+ import 'core-js/modules/web.dom-collections.for-each.js';
4
+ import 'core-js/modules/es.number.is-finite.js';
5
+ import 'core-js/modules/es.number.constructor.js';
6
+ import 'core-js/modules/es.array.splice.js';
7
+ import 'core-js/modules/es.array.iterator.js';
8
+ import 'core-js/modules/es.object.to-string.js';
9
+ import 'core-js/modules/es.typed-array.uint8-array.js';
10
+ import 'core-js/modules/es.typed-array.copy-within.js';
11
+ import 'core-js/modules/es.typed-array.every.js';
12
+ import 'core-js/modules/es.typed-array.fill.js';
13
+ import 'core-js/modules/es.typed-array.filter.js';
14
+ import 'core-js/modules/es.typed-array.find.js';
15
+ import 'core-js/modules/es.typed-array.find-index.js';
16
+ import 'core-js/modules/es.typed-array.for-each.js';
17
+ import 'core-js/modules/es.typed-array.includes.js';
18
+ import 'core-js/modules/es.typed-array.index-of.js';
19
+ import 'core-js/modules/es.typed-array.iterator.js';
20
+ import 'core-js/modules/es.typed-array.join.js';
21
+ import 'core-js/modules/es.typed-array.last-index-of.js';
22
+ import 'core-js/modules/es.typed-array.map.js';
23
+ import 'core-js/modules/es.typed-array.reduce.js';
24
+ import 'core-js/modules/es.typed-array.reduce-right.js';
25
+ import 'core-js/modules/es.typed-array.reverse.js';
26
+ import 'core-js/modules/es.typed-array.set.js';
27
+ import 'core-js/modules/es.typed-array.slice.js';
28
+ import 'core-js/modules/es.typed-array.some.js';
29
+ import 'core-js/modules/es.typed-array.sort.js';
30
+ import 'core-js/modules/es.typed-array.subarray.js';
31
+ import 'core-js/modules/es.typed-array.to-locale-string.js';
32
+ import 'core-js/modules/es.typed-array.to-string.js';
33
+ import { WarningType, AudioCodecType } from '../model/types.js';
34
+ import { AAC } from '../codec/aac.js';
35
+ import { isSafari } from '../utils/env.js';
36
+ import { AudioSample } from '../model/audio-sample.js';
37
+
38
+ var LARGE_AV_FIRST_FRAME_GAP = 500; // ms
39
+
40
+ var AUDIO_GAP_OVERLAP_THRESHOLD_COUNT = 3;
41
+ var MAX_SILENT_FRAME_DURATION = 1000; // ms
42
+
43
+ var AUDIO_EXCETION_LOG_EMIT_DURATION = 5000; // 5s
44
+
45
+ var MAX_VIDEO_FRAME_DURATION = 1000; // ms
46
+
47
+ var MAX_DTS_DELTA_WITH_NEXT_CHUNK = 200; // ms
48
+
49
+ var VIDEO_EXCETION_LOG_EMIT_DURATION = 5000; // 5s
50
+
51
+ var TRACK_BREACKED_CHECK_TIME = 5;
52
+ var FlvFixer = /*#__PURE__*/function () {
53
+ function FlvFixer(videoTrack, audioTrack, metadataTrack) {
54
+ _classCallCheck(this, FlvFixer);
55
+
56
+ this.videoTrack = videoTrack;
57
+ this.audioTrack = audioTrack;
58
+ this.metadataTrack = metadataTrack;
59
+ this._baseDts = -1;
60
+ this._baseDtsInited = false;
61
+ this._audioNextPts = undefined;
62
+ this._videoNextDts = undefined;
63
+ this._audioTimestampBreak = 0;
64
+ this._videoTimestampBreak = 0;
65
+ this._lastAudioExceptionGapDot = -Infinity;
66
+ this._lastAudioExceptionOverlapDot = -Infinity;
67
+ this._lastAudioExceptionLargeGapDot = -Infinity;
68
+ this._lastVideoExceptionLargeGapDot = -Infinity;
69
+ this._lastVideoExceptionChunkFirstDtsDot = -Infinity;
70
+ }
71
+ /**
72
+ * @param {number} startTime 点播seek到的时间点
73
+ * @param {boolean} discontinuity 是否换流
74
+ * @param {boolean} contiguous 前后chunk时间戳是否连续
75
+ */
76
+
77
+
78
+ _createClass(FlvFixer, [{
79
+ key: "fix",
80
+ value: function fix() {
81
+ var _this = this;
82
+
83
+ var startTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
84
+ var discontinuity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
85
+ var contiguous = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
86
+ startTime = Math.round(startTime * 1000);
87
+ var videoTrack = this.videoTrack;
88
+ var audioTrack = this.audioTrack;
89
+
90
+ if (discontinuity || !contiguous) {
91
+ this._videoLastSample = null;
92
+ this._audioNextPts = undefined;
93
+ this._videoNextDts = undefined;
94
+ this._audioTimestampBreak = 0;
95
+ this._videoTimestampBreak = 0;
96
+ this._lastAudioExceptionGapDot = -Infinity;
97
+ this._lastAudioExceptionOverlapDot = -Infinity;
98
+ this._lastAudioExceptionLargeGapDot = -Infinity;
99
+ this._lastVideoExceptionLargeGapDot = -Infinity;
100
+ this._lastVideoExceptionChunkFirstDtsDot = -Infinity;
101
+ }
102
+
103
+ if (discontinuity && !contiguous) {
104
+ this._baseDtsInited = false;
105
+ }
106
+
107
+ if (!this._baseDtsInited) {
108
+ this._calculateBaseDts(audioTrack, videoTrack);
109
+ }
110
+
111
+ if (!this._baseDtsInited) return;
112
+
113
+ if (!contiguous && startTime) {
114
+ this._audioNextPts = this._videoNextDts = startTime;
115
+ }
116
+
117
+ this._resetBaseDtsWhenStreamBreaked();
118
+
119
+ this._fixAudio(audioTrack);
120
+
121
+ this._fixVideo(videoTrack);
122
+
123
+ if (this.metadataTrack.exist()) {
124
+ var timescale = this.metadataTrack.timescale;
125
+ this.metadataTrack.seiSamples.forEach(function (s) {
126
+ s.pts = s.originPts - _this._baseDts;
127
+ s.time = Math.max(0, s.pts) / timescale;
128
+ });
129
+ this.metadataTrack.flvScriptSamples.forEach(function (s) {
130
+ s.pts = s.originPts - _this._baseDts;
131
+ s.time = Math.max(0, s.pts) / timescale;
132
+ });
133
+ }
134
+
135
+ if (videoTrack.samples.length) {
136
+ videoTrack.baseMediaDecodeTime = videoTrack.samples[0].dts;
137
+ }
138
+
139
+ if (audioTrack.samples.length) {
140
+ audioTrack.baseMediaDecodeTime = audioTrack.samples[0].pts * audioTrack.timescale / 1000;
141
+ }
142
+ }
143
+ }, {
144
+ key: "_fixVideo",
145
+ value: function _fixVideo(videoTrack) {
146
+ var _this2 = this;
147
+
148
+ var samples = videoTrack.samples;
149
+ if (!samples.length) return;
150
+ samples.forEach(function (x) {
151
+ x.dts -= _this2._baseDts;
152
+ x.pts -= _this2._baseDts;
153
+ });
154
+ var refSampleDurationInt;
155
+
156
+ if (videoTrack.fpsNum && videoTrack.fpsDen) {
157
+ refSampleDurationInt = videoTrack.timescale * (videoTrack.fpsDen / videoTrack.fpsNum);
158
+ } else {
159
+ var first = videoTrack.samples[0];
160
+ var last = videoTrack.samples[samples.length - 1];
161
+ refSampleDurationInt = Math.floor((last.dts - first.dts) / (samples.length - 1));
162
+ }
163
+
164
+ var lastSample = samples.pop();
165
+
166
+ if (this._videoLastSample) {
167
+ samples.unshift(this._videoLastSample);
168
+ }
169
+
170
+ this._videoLastSample = lastSample;
171
+ if (!samples.length) return;
172
+
173
+ if (this._videoNextDts === undefined) {
174
+ var samp0 = samples[0];
175
+ this._videoNextDts = samp0.dts;
176
+ }
177
+
178
+ var len = samples.length;
179
+ var sampleDuration = 0;
180
+ var firstSample = samples[0];
181
+ var vDelta = this._videoNextDts - firstSample.dts;
182
+
183
+ if (Math.abs(vDelta) > MAX_DTS_DELTA_WITH_NEXT_CHUNK) {
184
+ // emit large delta of first sample with expect
185
+ if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCETION_LOG_EMIT_DURATION) {
186
+ var _samples$;
187
+
188
+ this._lastVideoExceptionChunkFirstDtsDot = firstSample.dts;
189
+ videoTrack.warnings.push({
190
+ type: WarningType.LARGE_VIDEO_GAP_BETWEEN_CHUNK,
191
+ nextDts: this._videoNextDts,
192
+ firstSampleDts: firstSample.dts,
193
+ nextSampleDts: (_samples$ = samples[1]) === null || _samples$ === void 0 ? void 0 : _samples$.dts,
194
+ sampleDuration: vDelta
195
+ });
196
+ } // only video breaked
197
+
198
+
199
+ if (this._videoTimestampBreak >= TRACK_BREACKED_CHECK_TIME) {
200
+ this._videoNextDts = firstSample.dts;
201
+ this._videoTimestampBreak = 0;
202
+ } else {
203
+ // resolve first frame only
204
+ firstSample.dts += vDelta;
205
+ firstSample.pts += vDelta;
206
+ }
207
+ }
208
+
209
+ for (var i = 0; i < len; i++) {
210
+ var dts = samples[i].dts;
211
+ var nextSample = samples[i + 1];
212
+
213
+ if (i < len - 1) {
214
+ sampleDuration = nextSample.dts - dts;
215
+ } else if (lastSample) {
216
+ sampleDuration = lastSample.dts - dts;
217
+ } else {
218
+ sampleDuration = refSampleDurationInt;
219
+ }
220
+
221
+ if (sampleDuration > MAX_VIDEO_FRAME_DURATION || sampleDuration < 0) {
222
+ this._videoTimestampBreak++; // emit stream breaked
223
+
224
+ if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCETION_LOG_EMIT_DURATION) {
225
+ this._lastVideoExceptionLargeGapDot = dts;
226
+ videoTrack.warnings.push({
227
+ type: WarningType.LARGE_VIDEO_GAP,
228
+ time: dts / videoTrack.timescale,
229
+ dts: dts,
230
+ originDts: samples[i].originDts,
231
+ nextDts: this._videoNextDts,
232
+ sampleDuration: sampleDuration,
233
+ refSampleDuration: refSampleDurationInt
234
+ });
235
+ }
236
+
237
+ sampleDuration = refSampleDurationInt;
238
+ }
239
+
240
+ samples[i].duration = sampleDuration;
241
+ this._videoNextDts += sampleDuration;
242
+ }
243
+ }
244
+ }, {
245
+ key: "_fixAudio",
246
+ value: function _fixAudio(audioTrack) {
247
+ var _this3 = this;
248
+
249
+ var samples = audioTrack.samples;
250
+ if (!samples.length) return; // offset origin timestamp
251
+
252
+ samples.forEach(function (x) {
253
+ x.dts = x.pts -= _this3._baseDts;
254
+ });
255
+
256
+ this._doFixAudioInternal(audioTrack, samples, 1000);
257
+ }
258
+ }, {
259
+ key: "_calculateBaseDts",
260
+ value: function _calculateBaseDts(audioTrack, videoTrack) {
261
+ var audioSamps = audioTrack.samples;
262
+ var videoSamps = videoTrack.samples;
263
+
264
+ if (!audioSamps.length && !videoSamps.length) {
265
+ return false;
266
+ }
267
+
268
+ var audioBasePts = Infinity;
269
+ var videoBaseDts = Infinity;
270
+
271
+ if (audioSamps.length) {
272
+ audioTrack.baseDts = audioBasePts = audioSamps[0].pts;
273
+ }
274
+
275
+ if (videoSamps.length) {
276
+ videoTrack.baseDts = videoBaseDts = videoSamps[0].dts;
277
+ }
278
+
279
+ this._baseDts = Math.min(audioBasePts, videoBaseDts);
280
+ var delta = videoBaseDts - audioBasePts;
281
+
282
+ if (Number.isFinite(delta) && Math.abs(delta) > LARGE_AV_FIRST_FRAME_GAP) {
283
+ videoTrack.warnings.push({
284
+ type: WarningType.LARGE_AV_SHIFT,
285
+ videoBaseDts: videoBaseDts,
286
+ audioBasePts: audioBasePts,
287
+ baseDts: this._baseDts,
288
+ delta: delta
289
+ });
290
+ }
291
+
292
+ this._baseDtsInited = true;
293
+ return true;
294
+ }
295
+ }, {
296
+ key: "_resetBaseDtsWhenStreamBreaked",
297
+ value: function _resetBaseDtsWhenStreamBreaked() {
298
+ if (this._baseDtsInited && this._videoTimestampBreak && this._audioTimestampBreak) {
299
+ /**
300
+ * timestamp breaked
301
+ * _audioNextDts
302
+ * ---------------------|
303
+ * (_baseDts) _videoNextDts
304
+ * ----------------------|
305
+ * <----------------
306
+ * nextVideo.dts
307
+ * ----------------------------------------|
308
+ * nextAudio.dts
309
+ * ---------------------------------------|
310
+ */
311
+ // calc baseDts base on new samples
312
+ var calc = this._calculateBaseDts(this.audioTrack, this.videoTrack);
313
+
314
+ if (!calc) return; // consider the expect dts for next frame
315
+
316
+ this._baseDts -= Math.min(this._audioNextPts, this._videoNextDts);
317
+ this._videoLastSample = null;
318
+ this._videoTimestampBreak = 0;
319
+ this._audioTimestampBreak = 0;
320
+ }
321
+ }
322
+ }, {
323
+ key: "_doFixAudioInternal",
324
+ value: function _doFixAudioInternal(audioTrack, samples, timescale) {
325
+ if (!audioTrack.sampleDuration) {
326
+ audioTrack.sampleDuration = audioTrack.codecType === AudioCodecType.AAC ? AAC.getFrameDuration(audioTrack.timescale, timescale) : this._getG711Duration(audioTrack);
327
+ }
328
+
329
+ var refSampleDuration = audioTrack.sampleDuration;
330
+ var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1000;
331
+
332
+ if (this._audioNextPts === undefined) {
333
+ var samp0 = samples[0];
334
+ this._audioNextPts = samp0.pts;
335
+ }
336
+
337
+ for (var i = 0; i < samples.length; i++) {
338
+ var nextPts = this._audioNextPts;
339
+ var sample = samples[i];
340
+ var delta = sample.pts - nextPts; // only audio breaked
341
+
342
+ if (i === 0 && this._audioTimestampBreak >= TRACK_BREACKED_CHECK_TIME) {
343
+ nextPts = this._audioNextPts = sample.dts;
344
+ delta = 0;
345
+ this._audioTimestampBreak = 0;
346
+ } // fill frames
347
+ // delta >= 3 * refSampleDurationInt
348
+ // delta <= 500s
349
+
350
+
351
+ if (!this._audioTimestampBreak && delta >= AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta <= MAX_SILENT_FRAME_DURATION && !isSafari) {
352
+ var silentFrame = this._getSilentFrame(audioTrack) || samples[0].data.subarray();
353
+ var count = Math.floor(delta / refSampleDuration);
354
+
355
+ if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION) {
356
+ this._lastAudioExceptionGapDot = sample.pts;
357
+ audioTrack.warnings.push({
358
+ type: WarningType.AUDIO_FILLED,
359
+ pts: sample.pts,
360
+ originPts: sample.originPts,
361
+ count: count,
362
+ nextPts: nextPts,
363
+ refSampleDuration: refSampleDuration
364
+ });
365
+ }
366
+
367
+ for (var j = 0; j < count; j++) {
368
+ var silentSample = new AudioSample(Math.floor(this._audioNextPts + refSampleDuration) - Math.floor(this._audioNextPts), silentFrame, sampleDurationInSampleRate);
369
+ silentSample.originPts = Math.floor(this._baseDts + nextPts);
370
+ samples.splice(i, 0, silentSample);
371
+ this._audioNextPts += refSampleDuration;
372
+ i++;
373
+ }
374
+
375
+ i--; // delta <= -3 * refSampleDurationInt
376
+ // delta >= -500ms
377
+ } else if (delta <= -AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta >= -1 * MAX_SILENT_FRAME_DURATION) {
378
+ // need discard frames
379
+ if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION) {
380
+ this._lastAudioExceptionOverlapDot = sample.pts;
381
+ audioTrack.warnings.push({
382
+ type: WarningType.AUDIO_DROPPED,
383
+ pts: sample.pts,
384
+ originPts: sample.originPts,
385
+ nextPts: nextPts,
386
+ refSampleDuration: refSampleDuration
387
+ });
388
+ }
389
+
390
+ samples.splice(i, 1);
391
+ i--;
392
+ } else {
393
+ if (Math.abs(delta) > MAX_SILENT_FRAME_DURATION) {
394
+ this._audioTimestampBreak++;
395
+
396
+ if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCETION_LOG_EMIT_DURATION) {
397
+ this._lastAudioExceptionLargeGapDot = sample.pts;
398
+ audioTrack.warnings.push({
399
+ type: WarningType.LARGE_AUDIO_GAP,
400
+ time: sample.pts / 1000,
401
+ pts: sample.pts,
402
+ originPts: sample.originPts,
403
+ nextPts: nextPts,
404
+ sampleDuration: delta,
405
+ refSampleDuration: refSampleDuration
406
+ });
407
+ }
408
+ }
409
+
410
+ sample.dts = sample.pts = nextPts;
411
+ sample.duration = sampleDurationInSampleRate;
412
+ this._audioNextPts += refSampleDuration;
413
+ }
414
+ }
415
+ }
416
+ }, {
417
+ key: "_getG711Duration",
418
+ value: function _getG711Duration(track) {
419
+ var sampleSize = track.sampleSize,
420
+ channelCount = track.channelCount,
421
+ sampleRate = track.sampleRate;
422
+ var samp0 = track.samples[0];
423
+ if (!samp0) return;
424
+ return samp0.data.byteLength * 2 / channelCount / (sampleSize / 8) / sampleRate * 1000;
425
+ }
426
+ }, {
427
+ key: "_getSilentFrame",
428
+ value: function _getSilentFrame(track) {
429
+ if (track.codecType === AudioCodecType.AAC) return AAC.getSilentFrame(track.codec, track.channelCount);
430
+ return new Uint8Array(8 * track.sampleDuration * track.channelCount);
431
+ }
432
+ }]);
433
+
434
+ return FlvFixer;
435
+ }();
436
+
437
+ export { FlvFixer };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @typedef {Object} DemuxResult
3
+ * @property {VideoTrack} videoTrack
4
+ * @property {AudioTrack} audioTrack
5
+ * @property {MetadataTrack} metadataTrack
6
+ */
7
+ export class FlvDemuxer {
8
+ static AUDIO_RATE: number[];
9
+ /**
10
+ * @param { Uint8Array } data
11
+ * @returns {boolean}
12
+ */
13
+ static probe(data: Uint8Array): boolean;
14
+ /**
15
+ * @param {VideoTrack} [videoTrack]
16
+ * @param {AudioTrack} [audioTrack]
17
+ * @param {MetadataTrack} [metadataTrack]
18
+ */
19
+ constructor(videoTrack?: VideoTrack, audioTrack?: AudioTrack, metadataTrack?: MetadataTrack);
20
+ _headerParsed: boolean;
21
+ _remainingData: any;
22
+ _gopId: number;
23
+ _needAddMetaBeforeKeyFrameNal: boolean;
24
+ videoTrack: VideoTrack;
25
+ audioTrack: AudioTrack;
26
+ metadataTrack: MetadataTrack;
27
+ _fixer: FlvFixer;
28
+ /**
29
+ * @param {Uint8Array} data
30
+ * @param {boolean} [discontinuity=false]
31
+ * @param {boolean} [contiguous=true]
32
+ * @returns {DemuxResult}
33
+ */
34
+ demux(data: Uint8Array, discontinuity?: boolean, contiguous?: boolean): DemuxResult;
35
+ /**
36
+ * @param {number} [startTime=0]
37
+ * @param {boolean} [discontinuity=false]
38
+ * @param {boolean} [contiguous=true]
39
+ * @returns {DemuxResult}
40
+ */
41
+ fix(startTime?: number, discontinuity?: boolean, contiguous?: boolean): DemuxResult;
42
+ /**
43
+ * @param {Uint8Array} data
44
+ * @param {boolean} [discontinuity=false]
45
+ * @param {boolean} [contiguous=true]
46
+ * @param {number} [startTime=0]
47
+ * @returns {DemuxResult}
48
+ */
49
+ demuxAndFix(data: Uint8Array, discontinuity?: boolean, contiguous?: boolean, startTime?: number): DemuxResult;
50
+ _parseAudio(data: any, pts: any): void;
51
+ _parseG711(data: any, pts: any, format: any): void;
52
+ _parseAac(data: any, pts: any): void;
53
+ _parseVideo(data: any, dts: any): void;
54
+ _checkAddMetaNalToUnits(hevc: any, units: any, track: any): any;
55
+ _parseScript(data: any, pts: any): void;
56
+ }
57
+ export type DemuxResult = {
58
+ videoTrack: VideoTrack;
59
+ audioTrack: AudioTrack;
60
+ metadataTrack: MetadataTrack;
61
+ };
62
+ import { VideoTrack } from "../model";
63
+ import { AudioTrack } from "../model";
64
+ import { MetadataTrack } from "../model/metadata-track";
65
+ import { FlvFixer } from "./fixer";