@remotion/media-parser 4.0.278 → 4.0.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/check-if-done.d.ts +2 -0
- package/dist/check-if-done.js +34 -0
- package/dist/containers/aac/parse-aac.js +15 -10
- package/dist/containers/avc/parse-avc.js +1 -1
- package/dist/containers/flac/get-block-size.d.ts +1 -1
- package/dist/containers/flac/get-channel-count.d.ts +2 -2
- package/dist/containers/flac/get-sample-rate.d.ts +1 -1
- package/dist/containers/flac/parse-flac-frame.d.ts +1 -1
- package/dist/containers/flac/parse-flac-frame.js +16 -11
- package/dist/containers/flac/parse-flac.d.ts +1 -1
- package/dist/containers/flac/parse-header.d.ts +1 -1
- package/dist/containers/flac/parse-metadata.d.ts +1 -1
- package/dist/containers/flac/parse-streaminfo.d.ts +1 -1
- package/dist/containers/flac/parse-unknown-block.d.ts +1 -1
- package/dist/containers/iso-base-media/esds/decoder-specific-config.d.ts +1 -1
- package/dist/containers/iso-base-media/esds/esds-descriptors.d.ts +1 -1
- package/dist/containers/iso-base-media/esds/esds.d.ts +1 -1
- package/dist/containers/iso-base-media/ftyp.d.ts +1 -1
- package/dist/containers/iso-base-media/get-moov-atom.js +9 -3
- package/dist/containers/iso-base-media/get-seeking-from-mp4.d.ts +5 -0
- package/dist/containers/iso-base-media/get-seeking-from-mp4.js +56 -0
- package/dist/containers/iso-base-media/mdat/mdat.js +29 -20
- package/dist/containers/iso-base-media/mdhd.d.ts +1 -1
- package/dist/containers/iso-base-media/meta/hdlr.d.ts +1 -1
- package/dist/containers/iso-base-media/meta/ilst.d.ts +1 -1
- package/dist/containers/iso-base-media/mvhd.d.ts +1 -1
- package/dist/containers/iso-base-media/mvhd.js +1 -1
- package/dist/containers/iso-base-media/parse-icc-profile.js +1 -1
- package/dist/containers/iso-base-media/stsd/av1c.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/avcc.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/colr.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/ctts.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/hvcc.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/keys.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/pasp.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stco.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stsc.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stss.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stsz.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stts.d.ts +1 -1
- package/dist/containers/iso-base-media/tfdt.d.ts +1 -1
- package/dist/containers/iso-base-media/tfhd.d.ts +1 -1
- package/dist/containers/iso-base-media/tkhd.d.ts +1 -1
- package/dist/containers/iso-base-media/trun.d.ts +1 -1
- package/dist/containers/m3u/parse-m3u-manifest.d.ts +1 -1
- package/dist/containers/mp3/id3-v1.d.ts +1 -1
- package/dist/containers/mp3/parse-mpeg-header.js +14 -9
- package/dist/containers/riff/is-movi.d.ts +1 -1
- package/dist/containers/riff/parse-avih.d.ts +1 -1
- package/dist/containers/riff/parse-isft.d.ts +1 -1
- package/dist/containers/riff/parse-movi.js +29 -20
- package/dist/containers/riff/parse-strf.d.ts +1 -1
- package/dist/containers/riff/parse-strh.d.ts +1 -1
- package/dist/containers/transport-stream/adts-header.js +1 -1
- package/dist/containers/transport-stream/discard-rest-of-packet.d.ts +1 -1
- package/dist/containers/transport-stream/handle-aac-packet.js +6 -1
- package/dist/containers/transport-stream/handle-avc-packet.js +6 -1
- package/dist/containers/transport-stream/parse-pat.d.ts +1 -1
- package/dist/containers/transport-stream/parse-pes.d.ts +1 -1
- package/dist/containers/transport-stream/parse-pmt.d.ts +1 -1
- package/dist/containers/wav/parse-video-section.js +15 -10
- package/dist/containers/webm/av1-codec-private.js +1 -1
- package/dist/containers/webm/description.js +1 -1
- package/dist/containers/webm/get-sample-from-block.js +1 -1
- package/dist/containers/webm/make-track.js +1 -1
- package/dist/containers/webm/parse-ebml.js +16 -3
- package/dist/containers/webm/segments/block-simple-block-flags.d.ts +1 -1
- package/dist/emit-all-info.d.ts +3 -0
- package/dist/emit-all-info.js +30 -0
- package/dist/emit-audio-sample.d.ts +12 -0
- package/dist/emit-audio-sample.js +14 -0
- package/dist/emit-available-info.d.ts +2 -7
- package/dist/emit-available-info.js +34 -31
- package/dist/esm/index.mjs +1921 -1618
- package/dist/esm/worker-server-entry.mjs +840 -537
- package/dist/esm/worker-web-entry.mjs +840 -537
- package/dist/fields.d.ts +61 -0
- package/dist/fields.js +2 -0
- package/dist/get-fields-from-callbacks.d.ts +2 -1
- package/dist/get-seeking-info.d.ts +4 -0
- package/dist/get-seeking-info.js +22 -0
- package/dist/has-all-info.d.ts +3 -5
- package/dist/has-all-info.js +3 -4
- package/dist/index.d.ts +53 -14
- package/dist/index.js +1 -1
- package/dist/init-video.d.ts +1 -4
- package/dist/init-video.js +2 -1
- package/dist/internal-parse-media.js +25 -188
- package/dist/{buffer-iterator.d.ts → iterator/buffer-iterator.d.ts} +12 -15
- package/dist/{buffer-iterator.js → iterator/buffer-iterator.js} +8 -116
- package/dist/iterator/buffer-manager.d.ts +18 -0
- package/dist/iterator/buffer-manager.js +87 -0
- package/dist/iterator/offset-counter.d.ts +10 -0
- package/dist/iterator/offset-counter.js +31 -0
- package/dist/make-hvc1-codec-strings.d.ts +1 -1
- package/dist/make-progress-object.d.ts +6 -0
- package/dist/make-progress-object.js +13 -0
- package/dist/media-parser-controller.d.ts +3 -0
- package/dist/media-parser-controller.js +4 -0
- package/dist/options.d.ts +1 -61
- package/dist/parse-loop.d.ts +8 -0
- package/dist/parse-loop.js +93 -0
- package/dist/parse-media-on-worker-entry.d.ts +2 -1
- package/dist/perform-seek.d.ts +2 -7
- package/dist/perform-seek.js +23 -24
- package/dist/print-timings.d.ts +2 -0
- package/dist/print-timings.js +12 -0
- package/dist/register-track.js +3 -0
- package/dist/run-parse-iteration.d.ts +1 -4
- package/dist/run-parse-iteration.js +1 -4
- package/dist/seek-backwards.d.ts +2 -0
- package/dist/seek-backwards.js +26 -0
- package/dist/seek-forwards.d.ts +2 -0
- package/dist/seek-forwards.js +28 -0
- package/dist/seek-signal.d.ts +22 -0
- package/dist/seek-signal.js +26 -0
- package/dist/seeking-info.d.ts +8 -0
- package/dist/seeking-info.js +2 -0
- package/dist/state/can-skip-tracks.d.ts +2 -2
- package/dist/state/can-skip-tracks.js +5 -2
- package/dist/state/emitted-fields.d.ts +1 -1
- package/dist/state/has-tracks-section.d.ts +2 -1
- package/dist/state/need-samples-for-fields.d.ts +1 -1
- package/dist/state/parser-state.d.ts +38 -8
- package/dist/state/parser-state.js +22 -2
- package/dist/state/sample-callbacks.d.ts +8 -3
- package/dist/state/sample-callbacks.js +16 -3
- package/dist/state/timings.d.ts +8 -0
- package/dist/state/timings.js +13 -0
- package/dist/state/video-section.d.ts +1 -1
- package/dist/state/webm.d.ts +1 -1
- package/dist/throttled-progress.d.ts +2 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/work-on-seek-request.d.ts +2 -0
- package/dist/work-on-seek-request.js +43 -0
- package/dist/worker/worker-types.d.ts +2 -1
- package/package.json +10 -10
- package/dist/parse-media-on-server-worker.d.ts +0 -2
- package/dist/parse-media-on-server-worker.js +0 -4
- package/dist/parse-media-on-web-worker.d.ts +0 -2
- package/dist/parse-media-on-web-worker.js +0 -4
- package/dist/worker.module.d.ts +0 -4
- package/dist/worker.module.js +0 -16
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseMovi = exports.handleChunk = void 0;
|
|
4
4
|
const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
|
|
5
|
+
const emit_audio_sample_1 = require("../../emit-audio-sample");
|
|
5
6
|
const key_1 = require("../avc/key");
|
|
6
7
|
const parse_avc_1 = require("../avc/parse-avc");
|
|
7
8
|
const traversal_1 = require("./traversal");
|
|
@@ -40,17 +41,21 @@ const handleChunk = async ({ state, ckId, ckSize, }) => {
|
|
|
40
41
|
// We must also NOT pass a duration because if the the next sample is 0,
|
|
41
42
|
// this sample would be longer. Chrome will pad it with silence.
|
|
42
43
|
// If we'd pass a duration instead, it would shift the audio and we think that audio is not finished
|
|
43
|
-
await
|
|
44
|
-
cts: timestamp,
|
|
45
|
-
dts: timestamp,
|
|
46
|
-
data,
|
|
47
|
-
duration: undefined,
|
|
48
|
-
timestamp,
|
|
44
|
+
await (0, emit_audio_sample_1.emitVideoSample)({
|
|
49
45
|
trackId,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
videoSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
47
|
+
cts: timestamp,
|
|
48
|
+
dts: timestamp,
|
|
49
|
+
data,
|
|
50
|
+
duration: undefined,
|
|
51
|
+
timestamp,
|
|
52
|
+
trackId,
|
|
53
|
+
type: keyOrDelta,
|
|
54
|
+
offset,
|
|
55
|
+
timescale: samplesPerSecond,
|
|
56
|
+
}, 1),
|
|
57
|
+
state,
|
|
58
|
+
});
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
const audioChunk = ckId.match(/^([0-9]{2})wb$/);
|
|
@@ -67,17 +72,21 @@ const handleChunk = async ({ state, ckId, ckSize, }) => {
|
|
|
67
72
|
// We must also NOT pass a duration because if the the next sample is 0,
|
|
68
73
|
// this sample would be longer. Chrome will pad it with silence.
|
|
69
74
|
// If we'd pass a duration instead, it would shift the audio and we think that audio is not finished
|
|
70
|
-
await
|
|
71
|
-
cts: timestamp,
|
|
72
|
-
dts: timestamp,
|
|
73
|
-
data,
|
|
74
|
-
duration: undefined,
|
|
75
|
-
timestamp,
|
|
75
|
+
await (0, emit_audio_sample_1.emitAudioSample)({
|
|
76
76
|
trackId,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
audioSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
78
|
+
cts: timestamp,
|
|
79
|
+
dts: timestamp,
|
|
80
|
+
data,
|
|
81
|
+
duration: undefined,
|
|
82
|
+
timestamp,
|
|
83
|
+
trackId,
|
|
84
|
+
type: 'key',
|
|
85
|
+
offset,
|
|
86
|
+
timescale: samplesPerSecond,
|
|
87
|
+
}, 1),
|
|
88
|
+
state,
|
|
89
|
+
});
|
|
81
90
|
}
|
|
82
91
|
};
|
|
83
92
|
exports.handleChunk = handleChunk;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../buffer-iterator';
|
|
1
|
+
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
2
|
import type { FccType, StrfBoxAudio, StrfBoxVideo } from './riff-box';
|
|
3
3
|
export declare const parseStrf: ({ iterator, size, fccType, }: {
|
|
4
4
|
iterator: BufferIterator;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readAdtsHeader = void 0;
|
|
4
4
|
const aac_codecprivate_1 = require("../../aac-codecprivate");
|
|
5
|
-
const buffer_iterator_1 = require("../../buffer-iterator");
|
|
5
|
+
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
|
6
6
|
const readAdtsHeader = (buffer) => {
|
|
7
7
|
if (buffer.byteLength < 9) {
|
|
8
8
|
return null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../buffer-iterator';
|
|
1
|
+
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
2
|
export declare const discardRestOfPacket: (iterator: BufferIterator) => void;
|
|
3
3
|
export declare const getRestOfPacket: (iterator: BufferIterator) => Uint8Array;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handleAacPacket = void 0;
|
|
4
4
|
const aac_codecprivate_1 = require("../../aac-codecprivate");
|
|
5
5
|
const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
|
|
6
|
+
const emit_audio_sample_1 = require("../../emit-audio-sample");
|
|
6
7
|
const register_track_1 = require("../../register-track");
|
|
7
8
|
const adts_header_1 = require("./adts-header");
|
|
8
9
|
const handle_avc_packet_1 = require("./handle-avc-packet");
|
|
@@ -47,6 +48,10 @@ const handleAacPacket = async ({ streamBuffer, state, programId, offset, }) => {
|
|
|
47
48
|
offset,
|
|
48
49
|
timescale: handle_avc_packet_1.MPEG_TIMESCALE,
|
|
49
50
|
};
|
|
50
|
-
await
|
|
51
|
+
await (0, emit_audio_sample_1.emitAudioSample)({
|
|
52
|
+
trackId: programId,
|
|
53
|
+
audioSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)(sample, handle_avc_packet_1.MPEG_TIMESCALE),
|
|
54
|
+
state,
|
|
55
|
+
});
|
|
51
56
|
};
|
|
52
57
|
exports.handleAacPacket = handleAacPacket;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleAvcPacket = exports.MPEG_TIMESCALE = void 0;
|
|
4
4
|
const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
|
|
5
|
+
const emit_audio_sample_1 = require("../../emit-audio-sample");
|
|
5
6
|
const register_track_1 = require("../../register-track");
|
|
6
7
|
const codec_string_1 = require("../avc/codec-string");
|
|
7
8
|
const create_sps_pps_data_1 = require("../avc/create-sps-pps-data");
|
|
@@ -58,6 +59,10 @@ const handleAvcPacket = async ({ streamBuffer, programId, state, offset, }) => {
|
|
|
58
59
|
offset,
|
|
59
60
|
timescale: exports.MPEG_TIMESCALE,
|
|
60
61
|
};
|
|
61
|
-
await
|
|
62
|
+
await (0, emit_audio_sample_1.emitVideoSample)({
|
|
63
|
+
trackId: programId,
|
|
64
|
+
videoSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)(sample, exports.MPEG_TIMESCALE),
|
|
65
|
+
state,
|
|
66
|
+
});
|
|
62
67
|
};
|
|
63
68
|
exports.handleAvcPacket = handleAvcPacket;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../buffer-iterator';
|
|
1
|
+
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
2
|
import type { TransportStreamPATBox, TransportStreamSdtBox } from './boxes';
|
|
3
3
|
export type TransportStreamProgramAssociationTableEntry = {
|
|
4
4
|
type: 'transport-stream-program-association-table';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseVideoSection = void 0;
|
|
4
4
|
const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
|
|
5
|
+
const emit_audio_sample_1 = require("../../emit-audio-sample");
|
|
5
6
|
const parseVideoSection = async ({ state, }) => {
|
|
6
7
|
const { iterator } = state;
|
|
7
8
|
const structure = state.getWavStructure();
|
|
@@ -18,17 +19,21 @@ const parseVideoSection = async ({ state, }) => {
|
|
|
18
19
|
const duration = toRead / (fmtBox.sampleRate * fmtBox.blockAlign);
|
|
19
20
|
const timestamp = (offset - videoSection.start) / (fmtBox.sampleRate * fmtBox.blockAlign);
|
|
20
21
|
const data = iterator.getSlice(toRead);
|
|
21
|
-
await
|
|
22
|
-
cts: timestamp,
|
|
23
|
-
dts: timestamp,
|
|
24
|
-
data,
|
|
25
|
-
duration,
|
|
26
|
-
timestamp,
|
|
22
|
+
await (0, emit_audio_sample_1.emitAudioSample)({
|
|
27
23
|
trackId: 0,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
audioSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
25
|
+
cts: timestamp,
|
|
26
|
+
dts: timestamp,
|
|
27
|
+
data,
|
|
28
|
+
duration,
|
|
29
|
+
timestamp,
|
|
30
|
+
trackId: 0,
|
|
31
|
+
type: 'key',
|
|
32
|
+
offset,
|
|
33
|
+
timescale: 1000000,
|
|
34
|
+
}, 1),
|
|
35
|
+
state,
|
|
36
|
+
});
|
|
32
37
|
return null;
|
|
33
38
|
};
|
|
34
39
|
exports.parseVideoSection = parseVideoSection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseAv1PrivateData = void 0;
|
|
4
|
-
const buffer_iterator_1 = require("../../buffer-iterator");
|
|
4
|
+
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
|
5
5
|
const parseAv1PrivateData = (data, colrAtom) => {
|
|
6
6
|
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)(data, data.byteLength);
|
|
7
7
|
iterator.startReadingBits();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAudioDescription = void 0;
|
|
4
|
-
const buffer_iterator_1 = require("../../buffer-iterator");
|
|
4
|
+
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
|
5
5
|
const traversal_1 = require("./traversal");
|
|
6
6
|
const getAudioDescription = (track) => {
|
|
7
7
|
const codec = (0, traversal_1.getCodecSegment)(track);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSampleFromBlock = void 0;
|
|
4
|
-
const buffer_iterator_1 = require("../../buffer-iterator");
|
|
4
|
+
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
|
5
5
|
const parse_avc_1 = require("../avc/parse-avc");
|
|
6
6
|
const get_ready_tracks_1 = require("./get-ready-tracks");
|
|
7
7
|
const all_segments_1 = require("./segments/all-segments");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTrack = exports.getMatroskaAudioCodecWithoutConfigString = exports.NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS = void 0;
|
|
4
|
-
const buffer_iterator_1 = require("../../buffer-iterator");
|
|
4
|
+
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
|
5
5
|
const make_hvc1_codec_strings_1 = require("../../make-hvc1-codec-strings");
|
|
6
6
|
const av1_codec_private_1 = require("./av1-codec-private");
|
|
7
7
|
const color_1 = require("./color");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.postprocessEbml = exports.parseEbml = void 0;
|
|
4
|
+
const emit_audio_sample_1 = require("../../emit-audio-sample");
|
|
4
5
|
const register_track_1 = require("../../register-track");
|
|
5
6
|
const get_sample_from_block_1 = require("./get-sample-from-block");
|
|
6
7
|
const make_track_1 = require("./make-track");
|
|
@@ -140,7 +141,11 @@ const postprocessEbml = async ({ offset, ebml, state, }) => {
|
|
|
140
141
|
if (ebml.type === 'Block' || ebml.type === 'SimpleBlock') {
|
|
141
142
|
const sample = (0, get_sample_from_block_1.getSampleFromBlock)(ebml, state, offset);
|
|
142
143
|
if (sample.type === 'video-sample') {
|
|
143
|
-
await
|
|
144
|
+
await (0, emit_audio_sample_1.emitVideoSample)({
|
|
145
|
+
trackId: sample.videoSample.trackId,
|
|
146
|
+
videoSample: sample.videoSample,
|
|
147
|
+
state,
|
|
148
|
+
});
|
|
144
149
|
return {
|
|
145
150
|
type: 'Block',
|
|
146
151
|
value: new Uint8Array([]),
|
|
@@ -148,7 +153,11 @@ const postprocessEbml = async ({ offset, ebml, state, }) => {
|
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
if (sample.type === 'audio-sample') {
|
|
151
|
-
await
|
|
156
|
+
await (0, emit_audio_sample_1.emitAudioSample)({
|
|
157
|
+
trackId: sample.audioSample.trackId,
|
|
158
|
+
audioSample: sample.audioSample,
|
|
159
|
+
state,
|
|
160
|
+
});
|
|
152
161
|
return {
|
|
153
162
|
type: 'Block',
|
|
154
163
|
value: new Uint8Array([]),
|
|
@@ -181,7 +190,11 @@ const postprocessEbml = async ({ offset, ebml, state, }) => {
|
|
|
181
190
|
...sample.partialVideoSample,
|
|
182
191
|
type: hasReferenceBlock ? 'delta' : 'key',
|
|
183
192
|
};
|
|
184
|
-
await
|
|
193
|
+
await (0, emit_audio_sample_1.emitVideoSample)({
|
|
194
|
+
trackId: sample.partialVideoSample.trackId,
|
|
195
|
+
videoSample: completeFrame,
|
|
196
|
+
state,
|
|
197
|
+
});
|
|
185
198
|
}
|
|
186
199
|
return {
|
|
187
200
|
type: 'BlockGroup',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.triggerInfoEmit = exports.emitAllInfo = void 0;
|
|
4
|
+
const emit_available_info_1 = require("./emit-available-info");
|
|
5
|
+
const has_all_info_1 = require("./has-all-info");
|
|
6
|
+
const emitAllInfo = async (state) => {
|
|
7
|
+
// Force assign
|
|
8
|
+
const allFields = Object.keys(state.fields).reduce((acc, key) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if ((_a = state.fields) === null || _a === void 0 ? void 0 : _a[key]) {
|
|
11
|
+
acc[key] = true;
|
|
12
|
+
}
|
|
13
|
+
return acc;
|
|
14
|
+
}, {});
|
|
15
|
+
await (0, emit_available_info_1.emitAvailableInfo)({
|
|
16
|
+
hasInfo: allFields,
|
|
17
|
+
state,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
exports.emitAllInfo = emitAllInfo;
|
|
21
|
+
const triggerInfoEmit = async (state) => {
|
|
22
|
+
const availableInfo = (0, has_all_info_1.getAvailableInfo)({
|
|
23
|
+
state,
|
|
24
|
+
});
|
|
25
|
+
await (0, emit_available_info_1.emitAvailableInfo)({
|
|
26
|
+
hasInfo: availableInfo,
|
|
27
|
+
state,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.triggerInfoEmit = triggerInfoEmit;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParserState } from './state/parser-state';
|
|
2
|
+
import type { AudioOrVideoSample } from './webcodec-sample-types';
|
|
3
|
+
export declare const emitAudioSample: ({ trackId, audioSample, state, }: {
|
|
4
|
+
trackId: number;
|
|
5
|
+
audioSample: AudioOrVideoSample;
|
|
6
|
+
state: ParserState;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
export declare const emitVideoSample: ({ trackId, videoSample, state, }: {
|
|
9
|
+
trackId: number;
|
|
10
|
+
videoSample: AudioOrVideoSample;
|
|
11
|
+
state: ParserState;
|
|
12
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitVideoSample = exports.emitAudioSample = void 0;
|
|
4
|
+
const work_on_seek_request_1 = require("./work-on-seek-request");
|
|
5
|
+
const emitAudioSample = async ({ trackId, audioSample, state, }) => {
|
|
6
|
+
await state.callbacks.onAudioSample(trackId, audioSample);
|
|
7
|
+
await (0, work_on_seek_request_1.workOnSeekRequest)(state);
|
|
8
|
+
};
|
|
9
|
+
exports.emitAudioSample = emitAudioSample;
|
|
10
|
+
const emitVideoSample = async ({ trackId, videoSample, state, }) => {
|
|
11
|
+
await state.callbacks.onVideoSample(trackId, videoSample);
|
|
12
|
+
await (0, work_on_seek_request_1.workOnSeekRequest)(state);
|
|
13
|
+
};
|
|
14
|
+
exports.emitVideoSample = emitVideoSample;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Options, ParseMediaFields } from './fields';
|
|
2
2
|
import type { ParserState } from './state/parser-state';
|
|
3
|
-
export declare const emitAvailableInfo: ({ hasInfo,
|
|
3
|
+
export declare const emitAvailableInfo: ({ hasInfo, state, }: {
|
|
4
4
|
hasInfo: Record<keyof Options<ParseMediaFields>, boolean>;
|
|
5
|
-
callbacks: ParseMediaCallbacks;
|
|
6
|
-
fieldsInReturnValue: Options<ParseMediaFields>;
|
|
7
5
|
state: ParserState;
|
|
8
|
-
returnValue: ParseMediaResult<AllParseMediaFields>;
|
|
9
|
-
mimeType: string | null;
|
|
10
|
-
name: string;
|
|
11
6
|
}) => Promise<void>;
|