@remotion/media-parser 4.0.276 → 4.0.278
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/aac-codecprivate.js +13 -6
- package/dist/add-avc-profile-to-track.js +9 -5
- package/dist/buffer-iterator.js +13 -8
- package/dist/combine-uint8-arrays.js +5 -1
- package/dist/containers/aac/parse-aac.js +13 -9
- package/dist/containers/aac/types.js +2 -1
- package/dist/containers/avc/codec-string.js +5 -1
- package/dist/containers/avc/color.js +9 -3
- package/dist/containers/avc/create-sps-pps-data.js +9 -5
- package/dist/containers/avc/interpret-sps.js +13 -7
- package/dist/containers/avc/key.js +5 -1
- package/dist/containers/avc/parse-avc.js +7 -3
- package/dist/containers/avc/sps-and-pps.js +5 -1
- package/dist/containers/flac/get-block-size.js +5 -1
- package/dist/containers/flac/get-channel-count.js +5 -1
- package/dist/containers/flac/get-duration-from-flac.js +5 -1
- package/dist/containers/flac/get-metadata-from-flac.js +5 -1
- package/dist/containers/flac/get-sample-rate.js +5 -1
- package/dist/containers/flac/parse-flac-frame.js +19 -14
- package/dist/containers/flac/parse-flac.js +19 -15
- package/dist/containers/flac/parse-header.js +5 -1
- package/dist/containers/flac/parse-metadata.js +5 -1
- package/dist/containers/flac/parse-streaminfo.js +7 -3
- package/dist/containers/flac/parse-unknown-block.js +5 -1
- package/dist/containers/flac/types.js +2 -1
- package/dist/containers/iso-base-media/base-media-box.js +2 -1
- package/dist/containers/iso-base-media/base-type.js +2 -1
- package/dist/containers/iso-base-media/esds/decoder-specific-config.js +5 -1
- package/dist/containers/iso-base-media/esds/esds-descriptors.js +10 -5
- package/dist/containers/iso-base-media/esds/esds.js +7 -3
- package/dist/containers/iso-base-media/ftyp.js +5 -1
- package/dist/containers/iso-base-media/get-actual-number-of-channels.js +8 -4
- package/dist/containers/iso-base-media/get-children.js +7 -3
- package/dist/containers/iso-base-media/get-keyframes.js +11 -7
- package/dist/containers/iso-base-media/get-moov-atom.js +17 -13
- package/dist/containers/iso-base-media/get-sample-positions-from-track.js +24 -20
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.js +7 -3
- package/dist/containers/iso-base-media/make-track.js +34 -30
- package/dist/containers/iso-base-media/mdat/mdat.js +20 -16
- package/dist/containers/iso-base-media/mdhd.js +5 -1
- package/dist/containers/iso-base-media/meta/hdlr.js +5 -1
- package/dist/containers/iso-base-media/meta/ilst.js +5 -1
- package/dist/containers/iso-base-media/moov/moov.js +7 -3
- package/dist/containers/iso-base-media/mvhd.js +11 -7
- package/dist/containers/iso-base-media/parse-boxes.js +9 -5
- package/dist/containers/iso-base-media/parse-icc-profile.js +8 -4
- package/dist/containers/iso-base-media/process-box.js +67 -63
- package/dist/containers/iso-base-media/stsd/av1c.js +5 -1
- package/dist/containers/iso-base-media/stsd/avcc.js +5 -1
- package/dist/containers/iso-base-media/stsd/colr.js +7 -3
- package/dist/containers/iso-base-media/stsd/ctts.js +5 -1
- package/dist/containers/iso-base-media/stsd/hvcc.js +7 -3
- package/dist/containers/iso-base-media/stsd/keys.js +5 -1
- package/dist/containers/iso-base-media/stsd/mebx.js +7 -3
- package/dist/containers/iso-base-media/stsd/pasp.js +5 -1
- package/dist/containers/iso-base-media/stsd/samples.js +13 -8
- package/dist/containers/iso-base-media/stsd/stco.js +5 -1
- package/dist/containers/iso-base-media/stsd/stsc.js +5 -1
- package/dist/containers/iso-base-media/stsd/stsd.js +7 -3
- package/dist/containers/iso-base-media/stsd/stss.js +5 -1
- package/dist/containers/iso-base-media/stsd/stsz.js +5 -1
- package/dist/containers/iso-base-media/stsd/stts.js +5 -1
- package/dist/containers/iso-base-media/tfdt.js +5 -1
- package/dist/containers/iso-base-media/tfhd.js +5 -1
- package/dist/containers/iso-base-media/tkhd.js +8 -4
- package/dist/containers/iso-base-media/to-date.js +5 -1
- package/dist/containers/iso-base-media/trak/trak.js +7 -3
- package/dist/containers/iso-base-media/traversal.js +57 -33
- package/dist/containers/iso-base-media/trun.js +5 -1
- package/dist/containers/iso-base-media/void-box.js +2 -1
- package/dist/containers/m3u/after-manifest-fetch.js +15 -11
- package/dist/containers/m3u/fetch-m3u8-stream.js +7 -3
- package/dist/containers/m3u/get-chunks.js +5 -1
- package/dist/containers/m3u/get-duration-from-m3u.js +8 -4
- package/dist/containers/m3u/get-playlist.js +12 -6
- package/dist/containers/m3u/get-streams.js +9 -3
- package/dist/containers/m3u/iterate-over-segment-files.js +15 -11
- package/dist/containers/m3u/parse-directive.js +10 -6
- package/dist/containers/m3u/parse-m3u-manifest.js +7 -3
- package/dist/containers/m3u/parse-m3u-media-directive.js +10 -5
- package/dist/containers/m3u/parse-m3u.js +11 -7
- package/dist/containers/m3u/parse-m3u8-text.js +7 -3
- package/dist/containers/m3u/parse-stream-inf.js +7 -2
- package/dist/containers/m3u/run-over-m3u.js +13 -9
- package/dist/containers/m3u/sample-sorter.js +8 -4
- package/dist/containers/m3u/select-stream.js +11 -4
- package/dist/containers/m3u/types.js +2 -1
- package/dist/containers/mp3/get-duration.js +9 -5
- package/dist/containers/mp3/get-frame-length.js +7 -2
- package/dist/containers/mp3/get-metadata-from-mp3.js +5 -1
- package/dist/containers/mp3/id3-v1.js +5 -1
- package/dist/containers/mp3/id3.js +5 -1
- package/dist/containers/mp3/parse-mp3.js +11 -7
- package/dist/containers/mp3/parse-mpeg-header.js +14 -10
- package/dist/containers/mp3/samples-per-mpeg-file.js +5 -1
- package/dist/containers/riff/expect-riff-box.js +15 -11
- package/dist/containers/riff/get-duration.js +12 -7
- package/dist/containers/riff/get-tracks-from-avi.js +28 -20
- package/dist/containers/riff/is-movi.js +5 -1
- package/dist/containers/riff/parse-avih.js +5 -1
- package/dist/containers/riff/parse-isft.js +5 -1
- package/dist/containers/riff/parse-list-box.js +7 -3
- package/dist/containers/riff/parse-movi.js +18 -13
- package/dist/containers/riff/parse-riff-body.js +13 -9
- package/dist/containers/riff/parse-riff-box.js +13 -9
- package/dist/containers/riff/parse-riff-header.js +5 -1
- package/dist/containers/riff/parse-riff.js +9 -5
- package/dist/containers/riff/parse-strf.js +5 -1
- package/dist/containers/riff/parse-strh.js +7 -3
- package/dist/containers/riff/parse-video-section.js +11 -7
- package/dist/containers/riff/riff-box.js +2 -1
- package/dist/containers/riff/timescale.js +4 -1
- package/dist/containers/riff/traversal.js +15 -7
- package/dist/containers/transport-stream/adts-header.js +10 -6
- package/dist/containers/transport-stream/boxes.js +2 -1
- package/dist/containers/transport-stream/discard-rest-of-packet.js +7 -2
- package/dist/containers/transport-stream/find-separator.js +4 -1
- package/dist/containers/transport-stream/get-tracks.js +16 -10
- package/dist/containers/transport-stream/handle-aac-packet.js +16 -12
- package/dist/containers/transport-stream/handle-avc-packet.js +26 -22
- package/dist/containers/transport-stream/next-pes-header-store.js +5 -1
- package/dist/containers/transport-stream/parse-packet.js +17 -13
- package/dist/containers/transport-stream/parse-pat.js +10 -5
- package/dist/containers/transport-stream/parse-pes.js +5 -1
- package/dist/containers/transport-stream/parse-pmt.js +7 -3
- package/dist/containers/transport-stream/parse-stream-packet.js +17 -13
- package/dist/containers/transport-stream/parse-transport-stream.js +9 -5
- package/dist/containers/transport-stream/process-stream-buffers.js +17 -12
- package/dist/containers/transport-stream/traversal.js +10 -4
- package/dist/containers/wav/get-duration-from-wav.js +8 -3
- package/dist/containers/wav/get-metadata-from-wav.js +5 -1
- package/dist/containers/wav/parse-data.js +9 -5
- package/dist/containers/wav/parse-fmt.js +7 -3
- package/dist/containers/wav/parse-header.js +5 -1
- package/dist/containers/wav/parse-id3.js +5 -1
- package/dist/containers/wav/parse-list.js +5 -1
- package/dist/containers/wav/parse-video-section.js +7 -3
- package/dist/containers/wav/parse-wav.js +19 -15
- package/dist/containers/wav/types.js +2 -1
- package/dist/containers/webm/allowed-partial-segments.js +4 -1
- package/dist/containers/webm/av1-codec-private.js +7 -3
- package/dist/containers/webm/color.js +10 -6
- package/dist/containers/webm/description.js +10 -6
- package/dist/containers/webm/get-ready-tracks.js +18 -13
- package/dist/containers/webm/get-sample-from-block.js +16 -12
- package/dist/containers/webm/make-track.js +48 -43
- package/dist/containers/webm/parse-ebml.js +19 -14
- package/dist/containers/webm/parse-webm-header.js +7 -3
- package/dist/containers/webm/segments/all-segments.js +173 -168
- package/dist/containers/webm/segments/block-simple-block-flags.js +8 -4
- package/dist/containers/webm/segments/track-entry.js +5 -1
- package/dist/containers/webm/segments.js +13 -9
- package/dist/containers/webm/traversal.js +67 -37
- package/dist/convert-audio-or-video-sample.js +5 -1
- package/dist/download-and-parse-media.js +14 -10
- package/dist/emit-available-info.js +38 -34
- package/dist/emitter.js +5 -1
- package/dist/errors.js +15 -6
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/worker.mjs +4 -5
- package/dist/fetch.js +17 -1
- package/dist/file-types/bmp.js +7 -3
- package/dist/file-types/detect-file-type.js +38 -24
- package/dist/file-types/index.js +26 -22
- package/dist/file-types/jpeg.js +9 -4
- package/dist/file-types/pdf.js +7 -3
- package/dist/file-types/png.js +9 -4
- package/dist/file-types/webp.js +7 -3
- package/dist/forward-controller.js +5 -1
- package/dist/get-audio-codec.js +38 -25
- package/dist/get-container.js +10 -5
- package/dist/get-dimensions.js +13 -8
- package/dist/get-duration.js +34 -27
- package/dist/get-fields-from-callbacks.js +5 -1
- package/dist/get-fps.js +34 -24
- package/dist/get-is-hdr.js +10 -5
- package/dist/get-keyframes.js +11 -6
- package/dist/get-location.js +9 -4
- package/dist/get-number-of-audio-channels.js +7 -2
- package/dist/get-sample-aspect-ratio.js +30 -17
- package/dist/get-sample-positions-from-lpcm.js +9 -5
- package/dist/get-sample-positions.js +5 -1
- package/dist/get-sample-rate.js +7 -2
- package/dist/get-tracks.js +40 -29
- package/dist/get-video-codec.js +34 -26
- package/dist/has-all-info.js +38 -33
- package/dist/index.js +47 -32
- package/dist/init-video.js +28 -24
- package/dist/internal-parse-media.js +39 -35
- package/dist/is-audio-structure.js +5 -1
- package/dist/log.js +12 -8
- package/dist/make-hvc1-codec-strings.js +5 -1
- package/dist/media-parser-controller.js +11 -7
- package/dist/metadata/get-metadata.js +22 -17
- package/dist/metadata/metadata-from-iso.js +17 -12
- package/dist/metadata/metadata-from-matroska.js +7 -3
- package/dist/metadata/metadata-from-riff.js +7 -3
- package/dist/node-writer.js +17 -1
- package/dist/node.js +17 -1
- package/dist/options.js +2 -1
- package/dist/parse-media-on-worker-entry.js +7 -3
- package/dist/parse-media.js +12 -8
- package/dist/parse-result.js +2 -1
- package/dist/pause-signal.js +5 -1
- package/dist/perform-seek.js +10 -6
- package/dist/readers/fetch/get-body-and-reader.js +5 -1
- package/dist/readers/fetch/resolve-url.js +5 -1
- package/dist/readers/from-fetch.js +21 -14
- package/dist/readers/from-node.js +23 -17
- package/dist/readers/from-web-file.js +13 -7
- package/dist/readers/reader.js +2 -1
- package/dist/readers/universal.js +16 -13
- package/dist/readers/web.js +12 -9
- package/dist/register-track.js +15 -9
- package/dist/remotion-license-acknowledge.js +8 -4
- package/dist/run-parse-iteration.js +25 -21
- package/dist/samples-from-moof.js +10 -6
- package/dist/skip.js +5 -1
- package/dist/state/aac-state.js +5 -1
- package/dist/state/can-skip-tracks.js +8 -3
- package/dist/state/emitted-fields.js +5 -1
- package/dist/state/flac-state.js +5 -1
- package/dist/state/has-tracks-section.js +7 -3
- package/dist/state/images.js +5 -1
- package/dist/state/iso-base-media/cached-sample-positions.js +13 -8
- package/dist/state/iso-base-media/iso-state.js +9 -5
- package/dist/state/iso-base-media/moov-box.js +5 -1
- package/dist/state/keyframes.js +5 -1
- package/dist/state/m3u-state.js +9 -5
- package/dist/state/may-skip-video-data.js +7 -3
- package/dist/state/mp3.js +5 -1
- package/dist/state/need-samples-for-fields.js +5 -1
- package/dist/state/parser-state.js +39 -35
- package/dist/state/riff.js +5 -1
- package/dist/state/sample-callbacks.js +12 -8
- package/dist/state/slow-duration-fps.js +5 -1
- package/dist/state/structure.js +5 -1
- package/dist/state/transport-stream.js +7 -3
- package/dist/state/video-section.js +5 -1
- package/dist/state/webm.js +9 -5
- package/dist/throttled-progress.js +5 -1
- package/dist/truthy.js +4 -1
- package/dist/universal.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +4 -1
- package/dist/web.js +5 -1
- package/dist/webcodec-sample-types.js +2 -1
- package/dist/worker/forward-controller.js +7 -3
- package/dist/worker/serialize-error.js +19 -14
- package/dist/worker/worker-types.js +2 -1
- package/dist/worker-server-entry.js +5 -3
- package/dist/worker-server.js +16 -12
- package/dist/worker-web-entry.js +5 -3
- package/dist/worker.d.ts +3 -2
- package/dist/worker.js +11 -2
- package/dist/worker.module.d.ts +4 -0
- package/dist/worker.module.js +16 -0
- package/dist/writers/node.js +23 -16
- package/dist/writers/writer.js +2 -1
- package/package.json +3 -3
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseVorbisComment = void 0;
|
|
4
|
+
const parseVorbisComment = ({ state, iterator, size, }) => {
|
|
2
5
|
const { expectNoMoreBytes } = iterator.startBox(size);
|
|
3
6
|
const box = {
|
|
4
7
|
type: 'flac-vorbis-comment',
|
|
@@ -18,3 +21,4 @@ export const parseVorbisComment = ({ state, iterator, size, }) => {
|
|
|
18
21
|
expectNoMoreBytes();
|
|
19
22
|
return Promise.resolve(null);
|
|
20
23
|
};
|
|
24
|
+
exports.parseVorbisComment = parseVorbisComment;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseStreamInfo = void 0;
|
|
4
|
+
const register_track_1 = require("../../register-track");
|
|
5
|
+
const parseStreamInfo = async ({ iterator, state, }) => {
|
|
3
6
|
const counter = iterator.counter.getOffset();
|
|
4
7
|
const minimumBlockSize = iterator.getUint16();
|
|
5
8
|
const maximumBlockSize = iterator.getUint16();
|
|
@@ -28,7 +31,7 @@ export const parseStreamInfo = async ({ iterator, state, }) => {
|
|
|
28
31
|
totalSamples,
|
|
29
32
|
};
|
|
30
33
|
state.getFlacStructure().boxes.push(flacStreamInfo);
|
|
31
|
-
await registerAudioTrack({
|
|
34
|
+
await (0, register_track_1.registerAudioTrack)({
|
|
32
35
|
container: 'flac',
|
|
33
36
|
state,
|
|
34
37
|
track: {
|
|
@@ -47,3 +50,4 @@ export const parseStreamInfo = async ({ iterator, state, }) => {
|
|
|
47
50
|
state.callbacks.tracks.setIsDone(state.logLevel);
|
|
48
51
|
return Promise.resolve(null);
|
|
49
52
|
};
|
|
53
|
+
exports.parseStreamInfo = parseStreamInfo;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFlacUnkownBlock = void 0;
|
|
4
|
+
const parseFlacUnkownBlock = ({ iterator, state, size, }) => {
|
|
2
5
|
iterator.discard(size);
|
|
3
6
|
state.getFlacStructure().boxes.push({
|
|
4
7
|
type: 'flac-header',
|
|
5
8
|
});
|
|
6
9
|
return Promise.resolve(null);
|
|
7
10
|
};
|
|
11
|
+
exports.parseFlacUnkownBlock = parseFlacUnkownBlock;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDecoderSpecificConfig = void 0;
|
|
4
|
+
const parseDecoderSpecificConfig = (iterator) => {
|
|
2
5
|
const layerTag = iterator.getUint8();
|
|
3
6
|
const layerSize = iterator.getPaddedFourByteNumber();
|
|
4
7
|
const start = iterator.counter.getOffset();
|
|
@@ -32,3 +35,4 @@ export const parseDecoderSpecificConfig = (iterator) => {
|
|
|
32
35
|
asBytes: bytes,
|
|
33
36
|
};
|
|
34
37
|
};
|
|
38
|
+
exports.parseDecoderSpecificConfig = parseDecoderSpecificConfig;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDescriptors = exports.processDescriptor = void 0;
|
|
4
|
+
const decoder_specific_config_1 = require("./decoder-specific-config");
|
|
2
5
|
const mapToObjectAudioIndicator = (num) => {
|
|
3
6
|
// https://chromium.googlesource.com/chromium/src/media/+/master/formats/mp4/es_descriptor.h
|
|
4
7
|
// http://netmedia.zju.edu.cn/multimedia2013/mpeg-4/ISO%20IEC%2014496-1%20MPEG-4%20System%20Standard.pdf
|
|
@@ -11,7 +14,7 @@ const mapToObjectAudioIndicator = (num) => {
|
|
|
11
14
|
}
|
|
12
15
|
return 'unknown';
|
|
13
16
|
};
|
|
14
|
-
|
|
17
|
+
const processDescriptor = ({ iterator, }) => {
|
|
15
18
|
const tag = iterator.getUint8();
|
|
16
19
|
if (tag === 4) {
|
|
17
20
|
const size = iterator.getPaddedFourByteNumber();
|
|
@@ -28,7 +31,7 @@ export const processDescriptor = ({ iterator, }) => {
|
|
|
28
31
|
const avgBitrate = iterator.getUint32();
|
|
29
32
|
const decoderSpecificConfigs = [];
|
|
30
33
|
while (size - (iterator.counter.getOffset() - initialOffset) > 0) {
|
|
31
|
-
const decoderSpecificConfig = parseDecoderSpecificConfig(iterator);
|
|
34
|
+
const decoderSpecificConfig = (0, decoder_specific_config_1.parseDecoderSpecificConfig)(iterator);
|
|
32
35
|
decoderSpecificConfigs.push(decoderSpecificConfig);
|
|
33
36
|
}
|
|
34
37
|
return {
|
|
@@ -58,12 +61,13 @@ export const processDescriptor = ({ iterator, }) => {
|
|
|
58
61
|
descriptor: null,
|
|
59
62
|
};
|
|
60
63
|
};
|
|
61
|
-
|
|
64
|
+
exports.processDescriptor = processDescriptor;
|
|
65
|
+
const parseDescriptors = (iterator, maxBytes) => {
|
|
62
66
|
const descriptors = [];
|
|
63
67
|
const initialOffset = iterator.counter.getOffset();
|
|
64
68
|
while (iterator.bytesRemaining() > 0 &&
|
|
65
69
|
iterator.counter.getOffset() - initialOffset < maxBytes) {
|
|
66
|
-
const { descriptor } = processDescriptor({
|
|
70
|
+
const { descriptor } = (0, exports.processDescriptor)({
|
|
67
71
|
iterator,
|
|
68
72
|
});
|
|
69
73
|
if (descriptor) {
|
|
@@ -75,3 +79,4 @@ export const parseDescriptors = (iterator, maxBytes) => {
|
|
|
75
79
|
}
|
|
76
80
|
return descriptors;
|
|
77
81
|
};
|
|
82
|
+
exports.parseDescriptors = parseDescriptors;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseEsds = void 0;
|
|
4
|
+
const esds_descriptors_1 = require("./esds-descriptors");
|
|
5
|
+
const parseEsds = ({ data, size, fileOffset, }) => {
|
|
3
6
|
const version = data.getUint8();
|
|
4
7
|
// Flags, we discard them
|
|
5
8
|
data.discard(3);
|
|
@@ -9,7 +12,7 @@ export const parseEsds = ({ data, size, fileOffset, }) => {
|
|
|
9
12
|
// disard 1 byte, currently unknown
|
|
10
13
|
data.discard(1);
|
|
11
14
|
const remaining = size - (data.counter.getOffset() - fileOffset);
|
|
12
|
-
const descriptors = parseDescriptors(data, remaining);
|
|
15
|
+
const descriptors = (0, esds_descriptors_1.parseDescriptors)(data, remaining);
|
|
13
16
|
const remainingNow = size - (data.counter.getOffset() - fileOffset);
|
|
14
17
|
data.discard(remainingNow);
|
|
15
18
|
return {
|
|
@@ -21,3 +24,4 @@ export const parseEsds = ({ data, size, fileOffset, }) => {
|
|
|
21
24
|
descriptors,
|
|
22
25
|
};
|
|
23
26
|
};
|
|
27
|
+
exports.parseEsds = parseEsds;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFtyp = void 0;
|
|
4
|
+
const parseFtyp = ({ iterator, size, offset, }) => {
|
|
2
5
|
const majorBrand = iterator.getByteString(4, false);
|
|
3
6
|
const minorVersion = iterator.getFourByteNumber();
|
|
4
7
|
const types = (size - iterator.counter.getOffset()) / 4;
|
|
@@ -16,3 +19,4 @@ export const parseFtyp = ({ iterator, size, offset, }) => {
|
|
|
16
19
|
boxSize: offsetAtEnd - offset,
|
|
17
20
|
};
|
|
18
21
|
};
|
|
22
|
+
exports.parseFtyp = parseFtyp;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getActualDecoderParameters = void 0;
|
|
4
|
+
const aac_codecprivate_1 = require("../../aac-codecprivate");
|
|
2
5
|
// Example video: 'https://remotion-assets.s3.eu-central-1.amazonaws.com/example-videos/riverside.mp4';
|
|
3
6
|
// This video has `numberOfChannels = 2`, but the actual number of channels is `1` according to Codec Private.
|
|
4
7
|
// Therefore, prioritizing Codec Private over `numberOfChannels`.
|
|
5
|
-
|
|
8
|
+
const getActualDecoderParameters = ({ audioCodec, codecPrivate, numberOfChannels, sampleRate, }) => {
|
|
6
9
|
if (audioCodec !== 'aac') {
|
|
7
10
|
return { numberOfChannels, sampleRate, codecPrivate };
|
|
8
11
|
}
|
|
9
12
|
if (codecPrivate === null) {
|
|
10
13
|
return { numberOfChannels, sampleRate, codecPrivate };
|
|
11
14
|
}
|
|
12
|
-
const parsed = parseAacCodecPrivate(codecPrivate);
|
|
15
|
+
const parsed = (0, aac_codecprivate_1.parseAacCodecPrivate)(codecPrivate);
|
|
13
16
|
return {
|
|
14
17
|
numberOfChannels: parsed.channelConfiguration,
|
|
15
18
|
sampleRate: parsed.sampleRate,
|
|
16
|
-
codecPrivate: createAacCodecPrivate({ ...parsed, codecPrivate }),
|
|
19
|
+
codecPrivate: (0, aac_codecprivate_1.createAacCodecPrivate)({ ...parsed, codecPrivate }),
|
|
17
20
|
};
|
|
18
21
|
};
|
|
22
|
+
exports.getActualDecoderParameters = getActualDecoderParameters;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIsoBaseMediaChildren = void 0;
|
|
4
|
+
const process_box_1 = require("./process-box");
|
|
5
|
+
const getIsoBaseMediaChildren = async ({ state, size, }) => {
|
|
3
6
|
const boxes = [];
|
|
4
7
|
const { iterator } = state;
|
|
5
8
|
const initial = iterator.counter.getOffset();
|
|
6
9
|
while (iterator.counter.getOffset() < size + initial) {
|
|
7
|
-
const parsed = await processBox(state);
|
|
10
|
+
const parsed = await (0, process_box_1.processBox)(state);
|
|
8
11
|
if (!parsed) {
|
|
9
12
|
throw new Error('Expected box');
|
|
10
13
|
}
|
|
@@ -15,3 +18,4 @@ export const getIsoBaseMediaChildren = async ({ state, size, }) => {
|
|
|
15
18
|
}
|
|
16
19
|
return boxes;
|
|
17
20
|
};
|
|
21
|
+
exports.getIsoBaseMediaChildren = getIsoBaseMediaChildren;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getKeyframesFromIsoBaseMedia = void 0;
|
|
4
|
+
const get_tracks_1 = require("../../get-tracks");
|
|
5
|
+
const get_sample_positions_from_track_1 = require("./get-sample-positions-from-track");
|
|
6
|
+
const traversal_1 = require("./traversal");
|
|
7
|
+
const getKeyframesFromIsoBaseMedia = (state) => {
|
|
8
|
+
const { videoTracks } = (0, get_tracks_1.getTracksFromIsoBaseMedia)(state);
|
|
6
9
|
const structure = state.getIsoStructure();
|
|
7
|
-
const moofBox = getMoofBoxes(structure.boxes);
|
|
10
|
+
const moofBox = (0, traversal_1.getMoofBoxes)(structure.boxes);
|
|
8
11
|
const allSamples = videoTracks.map((t) => {
|
|
9
12
|
const { timescale: ts } = t;
|
|
10
|
-
const samplePositions = getSamplePositionsFromTrack({
|
|
13
|
+
const samplePositions = (0, get_sample_positions_from_track_1.getSamplePositionsFromTrack)({
|
|
11
14
|
trakBox: t.trakBox,
|
|
12
15
|
moofBoxes: moofBox,
|
|
13
16
|
});
|
|
@@ -28,3 +31,4 @@ export const getKeyframesFromIsoBaseMedia = (state) => {
|
|
|
28
31
|
});
|
|
29
32
|
return allSamples.flat();
|
|
30
33
|
};
|
|
34
|
+
exports.getKeyframesFromIsoBaseMedia = getKeyframesFromIsoBaseMedia;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMoovAtom = void 0;
|
|
4
|
+
const log_1 = require("../../log");
|
|
5
|
+
const register_track_1 = require("../../register-track");
|
|
6
|
+
const parser_state_1 = require("../../state/parser-state");
|
|
7
|
+
const process_box_1 = require("./process-box");
|
|
8
|
+
const traversal_1 = require("./traversal");
|
|
9
|
+
const getMoovAtom = async ({ endOfMdat, state, }) => {
|
|
7
10
|
const headerSegment = state.mp4HeaderSegment;
|
|
8
11
|
if (headerSegment) {
|
|
9
|
-
const segment = getMoovFromFromIsoStructure(headerSegment);
|
|
12
|
+
const segment = (0, traversal_1.getMoovFromFromIsoStructure)(headerSegment);
|
|
10
13
|
if (!segment) {
|
|
11
14
|
throw new Error('No moov box found in header segment');
|
|
12
15
|
}
|
|
13
16
|
return segment;
|
|
14
17
|
}
|
|
15
18
|
const start = Date.now();
|
|
16
|
-
Log.verbose(state.logLevel, 'Starting second fetch to get moov atom');
|
|
19
|
+
log_1.Log.verbose(state.logLevel, 'Starting second fetch to get moov atom');
|
|
17
20
|
const { reader } = await state.readerInterface.read({
|
|
18
21
|
src: state.src,
|
|
19
22
|
range: endOfMdat,
|
|
20
23
|
controller: state.controller,
|
|
21
24
|
});
|
|
22
|
-
const childState = makeParserState({
|
|
25
|
+
const childState = (0, parser_state_1.makeParserState)({
|
|
23
26
|
hasAudioTrackHandlers: false,
|
|
24
27
|
hasVideoTrackHandlers: false,
|
|
25
28
|
controller: state.controller,
|
|
@@ -28,13 +31,13 @@ export const getMoovAtom = async ({ endOfMdat, state, }) => {
|
|
|
28
31
|
},
|
|
29
32
|
onAudioTrack: state.onAudioTrack
|
|
30
33
|
? async ({ track, container }) => {
|
|
31
|
-
await registerAudioTrack({ state, track, container });
|
|
34
|
+
await (0, register_track_1.registerAudioTrack)({ state, track, container });
|
|
32
35
|
return null;
|
|
33
36
|
}
|
|
34
37
|
: null,
|
|
35
38
|
onVideoTrack: state.onVideoTrack
|
|
36
39
|
? async ({ track, container }) => {
|
|
37
|
-
await registerVideoTrack({ state, track, container });
|
|
40
|
+
await (0, register_track_1.registerVideoTrack)({ state, track, container });
|
|
38
41
|
return null;
|
|
39
42
|
}
|
|
40
43
|
: null,
|
|
@@ -59,7 +62,7 @@ export const getMoovAtom = async ({ endOfMdat, state, }) => {
|
|
|
59
62
|
}
|
|
60
63
|
const boxes = [];
|
|
61
64
|
while (true) {
|
|
62
|
-
const box = await processBox(childState);
|
|
65
|
+
const box = await (0, process_box_1.processBox)(childState);
|
|
63
66
|
if (box) {
|
|
64
67
|
boxes.push(box);
|
|
65
68
|
}
|
|
@@ -76,6 +79,7 @@ export const getMoovAtom = async ({ endOfMdat, state, }) => {
|
|
|
76
79
|
if (!moov) {
|
|
77
80
|
throw new Error('No moov box found');
|
|
78
81
|
}
|
|
79
|
-
Log.verbose(state.logLevel, `Finished fetching moov atom in ${Date.now() - start}ms`);
|
|
82
|
+
log_1.Log.verbose(state.logLevel, `Finished fetching moov atom in ${Date.now() - start}ms`);
|
|
80
83
|
return moov;
|
|
81
84
|
};
|
|
85
|
+
exports.getMoovAtom = getMoovAtom;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSamplePositionsFromTrack = void 0;
|
|
4
|
+
const get_audio_codec_1 = require("../../get-audio-codec");
|
|
5
|
+
const get_fps_1 = require("../../get-fps");
|
|
6
|
+
const get_sample_positions_1 = require("../../get-sample-positions");
|
|
7
|
+
const get_sample_positions_from_lpcm_1 = require("../../get-sample-positions-from-lpcm");
|
|
8
|
+
const samples_from_moof_1 = require("../../samples-from-moof");
|
|
9
|
+
const traversal_1 = require("./traversal");
|
|
10
|
+
const getSamplePositionsFromTrack = ({ trakBox, moofBoxes, }) => {
|
|
11
|
+
const isLpcm = (0, get_audio_codec_1.isLpcmAudioCodec)(trakBox);
|
|
12
|
+
const timescaleAndDuration = (0, get_fps_1.getTimescaleAndDuration)(trakBox);
|
|
10
13
|
if (isLpcm) {
|
|
11
|
-
return getSamplePositionsFromLpcm(trakBox);
|
|
12
|
-
}
|
|
13
|
-
const stszBox = getStszBox(trakBox);
|
|
14
|
-
const stcoBox = getStcoBox(trakBox);
|
|
15
|
-
const stscBox = getStscBox(trakBox);
|
|
16
|
-
const stssBox = getStssBox(trakBox);
|
|
17
|
-
const sttsBox = getSttsBox(trakBox);
|
|
18
|
-
const tkhdBox = getTkhdBox(trakBox);
|
|
19
|
-
const cttsBox = getCttsBox(trakBox);
|
|
14
|
+
return (0, get_sample_positions_from_lpcm_1.getSamplePositionsFromLpcm)(trakBox);
|
|
15
|
+
}
|
|
16
|
+
const stszBox = (0, traversal_1.getStszBox)(trakBox);
|
|
17
|
+
const stcoBox = (0, traversal_1.getStcoBox)(trakBox);
|
|
18
|
+
const stscBox = (0, traversal_1.getStscBox)(trakBox);
|
|
19
|
+
const stssBox = (0, traversal_1.getStssBox)(trakBox);
|
|
20
|
+
const sttsBox = (0, traversal_1.getSttsBox)(trakBox);
|
|
21
|
+
const tkhdBox = (0, traversal_1.getTkhdBox)(trakBox);
|
|
22
|
+
const cttsBox = (0, traversal_1.getCttsBox)(trakBox);
|
|
20
23
|
if (!tkhdBox) {
|
|
21
24
|
throw new Error('Expected tkhd box in trak box');
|
|
22
25
|
}
|
|
@@ -35,7 +38,7 @@ export const getSamplePositionsFromTrack = ({ trakBox, moofBoxes, }) => {
|
|
|
35
38
|
if (!timescaleAndDuration) {
|
|
36
39
|
throw new Error('Expected timescale and duration in trak box');
|
|
37
40
|
}
|
|
38
|
-
let samplePositions = getSamplePositions({
|
|
41
|
+
let samplePositions = (0, get_sample_positions_1.getSamplePositions)({
|
|
39
42
|
stcoBox,
|
|
40
43
|
stscBox,
|
|
41
44
|
stszBox,
|
|
@@ -46,9 +49,10 @@ export const getSamplePositionsFromTrack = ({ trakBox, moofBoxes, }) => {
|
|
|
46
49
|
if (samplePositions.length === 0 && moofBoxes.length > 0) {
|
|
47
50
|
samplePositions = moofBoxes
|
|
48
51
|
.map((m) => {
|
|
49
|
-
return getSamplesFromMoof({ moofBox: m, trackId: tkhdBox.trackId });
|
|
52
|
+
return (0, samples_from_moof_1.getSamplesFromMoof)({ moofBox: m, trackId: tkhdBox.trackId });
|
|
50
53
|
})
|
|
51
54
|
.flat(1);
|
|
52
55
|
}
|
|
53
56
|
return samplePositions;
|
|
54
57
|
};
|
|
58
|
+
exports.getSamplePositionsFromTrack = getSamplePositionsFromTrack;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVideoCodecFromIsoTrak = void 0;
|
|
4
|
+
const traversal_1 = require("./traversal");
|
|
5
|
+
const getVideoCodecFromIsoTrak = (trakBox) => {
|
|
6
|
+
const stsdBox = (0, traversal_1.getStsdBox)(trakBox);
|
|
4
7
|
if (stsdBox && stsdBox.type === 'stsd-box') {
|
|
5
8
|
const videoSample = stsdBox.samples.find((s) => s.type === 'video');
|
|
6
9
|
if (videoSample && videoSample.type === 'video') {
|
|
@@ -49,3 +52,4 @@ export const getVideoCodecFromIsoTrak = (trakBox) => {
|
|
|
49
52
|
}
|
|
50
53
|
throw new Error('Could not find video codec');
|
|
51
54
|
};
|
|
55
|
+
exports.getVideoCodecFromIsoTrak = getVideoCodecFromIsoTrak;
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeBaseMediaTrack = void 0;
|
|
4
|
+
const get_audio_codec_1 = require("../../get-audio-codec");
|
|
5
|
+
const get_fps_1 = require("../../get-fps");
|
|
6
|
+
const get_sample_aspect_ratio_1 = require("../../get-sample-aspect-ratio");
|
|
7
|
+
const get_video_codec_1 = require("../../get-video-codec");
|
|
8
|
+
const get_actual_number_of_channels_1 = require("./get-actual-number-of-channels");
|
|
9
|
+
const get_video_codec_from_iso_track_1 = require("./get-video-codec-from-iso-track");
|
|
10
|
+
const traversal_1 = require("./traversal");
|
|
11
|
+
const makeBaseMediaTrack = (trakBox) => {
|
|
9
12
|
var _a, _b, _c, _d;
|
|
10
|
-
const tkhdBox = getTkhdBox(trakBox);
|
|
11
|
-
const videoDescriptors = getVideoDescriptors(trakBox);
|
|
12
|
-
const timescaleAndDuration = getTimescaleAndDuration(trakBox);
|
|
13
|
+
const tkhdBox = (0, traversal_1.getTkhdBox)(trakBox);
|
|
14
|
+
const videoDescriptors = (0, traversal_1.getVideoDescriptors)(trakBox);
|
|
15
|
+
const timescaleAndDuration = (0, get_fps_1.getTimescaleAndDuration)(trakBox);
|
|
13
16
|
if (!tkhdBox) {
|
|
14
17
|
throw new Error('Expected tkhd box in trak box');
|
|
15
18
|
}
|
|
16
19
|
if (!timescaleAndDuration) {
|
|
17
20
|
throw new Error('Expected timescale and duration in trak box');
|
|
18
21
|
}
|
|
19
|
-
if (trakBoxContainsAudio(trakBox)) {
|
|
20
|
-
const numberOfChannels = getNumberOfChannelsFromTrak(trakBox);
|
|
22
|
+
if ((0, get_fps_1.trakBoxContainsAudio)(trakBox)) {
|
|
23
|
+
const numberOfChannels = (0, get_audio_codec_1.getNumberOfChannelsFromTrak)(trakBox);
|
|
21
24
|
if (numberOfChannels === null) {
|
|
22
25
|
throw new Error('Could not find number of channels');
|
|
23
26
|
}
|
|
24
|
-
const sampleRate = getSampleRate(trakBox);
|
|
27
|
+
const sampleRate = (0, get_audio_codec_1.getSampleRate)(trakBox);
|
|
25
28
|
if (sampleRate === null) {
|
|
26
29
|
throw new Error('Could not find sample rate');
|
|
27
30
|
}
|
|
28
|
-
const { codecString, description } = getAudioCodecStringFromTrak(trakBox);
|
|
29
|
-
const codecPrivate = (_b = (_a = getCodecPrivateFromTrak(trakBox)) !== null && _a !== void 0 ? _a : description) !== null && _b !== void 0 ? _b : null;
|
|
30
|
-
const codecWithoutConfig = getAudioCodecFromTrack(trakBox);
|
|
31
|
-
const actual = getActualDecoderParameters({
|
|
31
|
+
const { codecString, description } = (0, get_audio_codec_1.getAudioCodecStringFromTrak)(trakBox);
|
|
32
|
+
const codecPrivate = (_b = (_a = (0, get_audio_codec_1.getCodecPrivateFromTrak)(trakBox)) !== null && _a !== void 0 ? _a : description) !== null && _b !== void 0 ? _b : null;
|
|
33
|
+
const codecWithoutConfig = (0, get_audio_codec_1.getAudioCodecFromTrack)(trakBox);
|
|
34
|
+
const actual = (0, get_actual_number_of_channels_1.getActualDecoderParameters)({
|
|
32
35
|
audioCodec: codecWithoutConfig,
|
|
33
36
|
codecPrivate,
|
|
34
37
|
numberOfChannels,
|
|
@@ -47,7 +50,7 @@ export const makeBaseMediaTrack = (trakBox) => {
|
|
|
47
50
|
codecWithoutConfig,
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
if (!trakBoxContainsVideo(trakBox)) {
|
|
53
|
+
if (!(0, get_fps_1.trakBoxContainsVideo)(trakBox)) {
|
|
51
54
|
return {
|
|
52
55
|
type: 'other',
|
|
53
56
|
trackId: tkhdBox.trackId,
|
|
@@ -55,25 +58,25 @@ export const makeBaseMediaTrack = (trakBox) => {
|
|
|
55
58
|
trakBox,
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
|
-
const videoSample = getStsdVideoConfig(trakBox);
|
|
61
|
+
const videoSample = (0, get_sample_aspect_ratio_1.getStsdVideoConfig)(trakBox);
|
|
59
62
|
if (!videoSample) {
|
|
60
63
|
throw new Error('No video sample');
|
|
61
64
|
}
|
|
62
|
-
const sampleAspectRatio = getSampleAspectRatio(trakBox);
|
|
63
|
-
const aspectRatioApplied = applyAspectRatios({
|
|
65
|
+
const sampleAspectRatio = (0, get_sample_aspect_ratio_1.getSampleAspectRatio)(trakBox);
|
|
66
|
+
const aspectRatioApplied = (0, get_sample_aspect_ratio_1.applyAspectRatios)({
|
|
64
67
|
dimensions: videoSample,
|
|
65
68
|
sampleAspectRatio,
|
|
66
|
-
displayAspectRatio: getDisplayAspectRatio({
|
|
69
|
+
displayAspectRatio: (0, get_sample_aspect_ratio_1.getDisplayAspectRatio)({
|
|
67
70
|
sampleAspectRatio,
|
|
68
71
|
nativeDimensions: videoSample,
|
|
69
72
|
}),
|
|
70
73
|
});
|
|
71
|
-
const { displayAspectHeight, displayAspectWidth, height, rotation, width } = applyTkhdBox(aspectRatioApplied, tkhdBox);
|
|
72
|
-
const codec = getVideoCodecString(trakBox);
|
|
74
|
+
const { displayAspectHeight, displayAspectWidth, height, rotation, width } = (0, get_sample_aspect_ratio_1.applyTkhdBox)(aspectRatioApplied, tkhdBox);
|
|
75
|
+
const codec = (0, get_video_codec_1.getVideoCodecString)(trakBox);
|
|
73
76
|
if (!codec) {
|
|
74
77
|
throw new Error('Could not find video codec');
|
|
75
78
|
}
|
|
76
|
-
const privateData = getVideoPrivateData(trakBox);
|
|
79
|
+
const privateData = (0, get_video_codec_1.getVideoPrivateData)(trakBox);
|
|
77
80
|
const track = {
|
|
78
81
|
m3uStreamFormat: null,
|
|
79
82
|
type: 'video',
|
|
@@ -81,7 +84,7 @@ export const makeBaseMediaTrack = (trakBox) => {
|
|
|
81
84
|
description: videoDescriptors !== null && videoDescriptors !== void 0 ? videoDescriptors : undefined,
|
|
82
85
|
timescale: timescaleAndDuration.timescale,
|
|
83
86
|
codec,
|
|
84
|
-
sampleAspectRatio: getSampleAspectRatio(trakBox),
|
|
87
|
+
sampleAspectRatio: (0, get_sample_aspect_ratio_1.getSampleAspectRatio)(trakBox),
|
|
85
88
|
width,
|
|
86
89
|
height,
|
|
87
90
|
codedWidth: videoSample.width,
|
|
@@ -92,14 +95,15 @@ export const makeBaseMediaTrack = (trakBox) => {
|
|
|
92
95
|
rotation,
|
|
93
96
|
trakBox,
|
|
94
97
|
codecPrivate: privateData,
|
|
95
|
-
color: (_d = getIsoBmColrConfig(trakBox)) !== null && _d !== void 0 ? _d : {
|
|
98
|
+
color: (_d = (0, get_video_codec_1.getIsoBmColrConfig)(trakBox)) !== null && _d !== void 0 ? _d : {
|
|
96
99
|
fullRange: null,
|
|
97
100
|
matrixCoefficients: null,
|
|
98
101
|
primaries: null,
|
|
99
102
|
transferCharacteristics: null,
|
|
100
103
|
},
|
|
101
|
-
codecWithoutConfig: getVideoCodecFromIsoTrak(trakBox),
|
|
102
|
-
fps: getFpsFromMp4TrakBox(trakBox),
|
|
104
|
+
codecWithoutConfig: (0, get_video_codec_from_iso_track_1.getVideoCodecFromIsoTrak)(trakBox),
|
|
105
|
+
fps: (0, get_fps_1.getFpsFromMp4TrakBox)(trakBox),
|
|
103
106
|
};
|
|
104
107
|
return track;
|
|
105
108
|
};
|
|
109
|
+
exports.makeBaseMediaTrack = makeBaseMediaTrack;
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMdatSection = void 0;
|
|
4
|
+
const convert_audio_or_video_sample_1 = require("../../../convert-audio-or-video-sample");
|
|
5
|
+
const get_tracks_1 = require("../../../get-tracks");
|
|
6
|
+
const skip_1 = require("../../../skip");
|
|
7
|
+
const cached_sample_positions_1 = require("../../../state/iso-base-media/cached-sample-positions");
|
|
8
|
+
const may_skip_video_data_1 = require("../../../state/may-skip-video-data");
|
|
9
|
+
const get_moov_atom_1 = require("../get-moov-atom");
|
|
10
|
+
const parseMdatSection = async (state) => {
|
|
8
11
|
const videoSection = state.videoSection.getVideoSection();
|
|
9
12
|
const endOfMdat = videoSection.size + videoSection.start;
|
|
10
13
|
// don't need mdat at all, can skip
|
|
11
|
-
if (maySkipVideoData({ state })) {
|
|
12
|
-
return makeSkip(endOfMdat);
|
|
14
|
+
if ((0, may_skip_video_data_1.maySkipVideoData)({ state })) {
|
|
15
|
+
return (0, skip_1.makeSkip)(endOfMdat);
|
|
13
16
|
}
|
|
14
|
-
const alreadyHas = getHasTracks(state);
|
|
17
|
+
const alreadyHas = (0, get_tracks_1.getHasTracks)(state);
|
|
15
18
|
if (!alreadyHas) {
|
|
16
|
-
const moov = await getMoovAtom({
|
|
19
|
+
const moov = await (0, get_moov_atom_1.getMoovAtom)({
|
|
17
20
|
endOfMdat,
|
|
18
21
|
state,
|
|
19
22
|
});
|
|
20
23
|
state.iso.moov.setMoovBox(moov);
|
|
21
24
|
state.callbacks.tracks.setIsDone(state.logLevel);
|
|
22
25
|
state.getIsoStructure().boxes.push(moov);
|
|
23
|
-
return parseMdatSection(state);
|
|
26
|
+
return (0, exports.parseMdatSection)(state);
|
|
24
27
|
}
|
|
25
28
|
if (!state.iso.flatSamples.getSamples(videoSection.start)) {
|
|
26
|
-
state.iso.flatSamples.setSamples(videoSection.start, calculateFlatSamples(state));
|
|
29
|
+
state.iso.flatSamples.setSamples(videoSection.start, (0, cached_sample_positions_1.calculateFlatSamples)(state));
|
|
27
30
|
}
|
|
28
31
|
const flatSamples = state.iso.flatSamples.getSamples(videoSection.start);
|
|
29
32
|
const { iterator } = state;
|
|
@@ -43,7 +46,7 @@ export const parseMdatSection = async (state) => {
|
|
|
43
46
|
}
|
|
44
47
|
// guess we reached the end!
|
|
45
48
|
// iphonevideo.mov has extra padding here, so let's make sure to jump ahead
|
|
46
|
-
return makeSkip(endOfMdat);
|
|
49
|
+
return (0, skip_1.makeSkip)(endOfMdat);
|
|
47
50
|
}
|
|
48
51
|
if (iterator.bytesRemaining() < samplesWithIndex.samplePosition.size) {
|
|
49
52
|
return null;
|
|
@@ -51,7 +54,7 @@ export const parseMdatSection = async (state) => {
|
|
|
51
54
|
const bytes = iterator.getSlice(samplesWithIndex.samplePosition.size);
|
|
52
55
|
const { cts, dts, duration, isKeyframe, offset } = samplesWithIndex.samplePosition;
|
|
53
56
|
if (samplesWithIndex.track.type === 'audio') {
|
|
54
|
-
await state.callbacks.onAudioSample(samplesWithIndex.track.trackId, convertAudioOrVideoSampleToWebCodecsTimestamps({
|
|
57
|
+
await state.callbacks.onAudioSample(samplesWithIndex.track.trackId, (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
55
58
|
data: bytes,
|
|
56
59
|
timestamp: cts,
|
|
57
60
|
duration,
|
|
@@ -76,7 +79,7 @@ export const parseMdatSection = async (state) => {
|
|
|
76
79
|
const seiType = bytes[5];
|
|
77
80
|
isRecoveryPoint = seiType === 6;
|
|
78
81
|
}
|
|
79
|
-
await state.callbacks.onVideoSample(samplesWithIndex.track.trackId, convertAudioOrVideoSampleToWebCodecsTimestamps({
|
|
82
|
+
await state.callbacks.onVideoSample(samplesWithIndex.track.trackId, (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
80
83
|
data: bytes,
|
|
81
84
|
timestamp: cts,
|
|
82
85
|
duration,
|
|
@@ -90,3 +93,4 @@ export const parseMdatSection = async (state) => {
|
|
|
90
93
|
}
|
|
91
94
|
return null;
|
|
92
95
|
};
|
|
96
|
+
exports.parseMdatSection = parseMdatSection;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMdhd = void 0;
|
|
4
|
+
const parseMdhd = ({ data, size, fileOffset, }) => {
|
|
2
5
|
const version = data.getUint8();
|
|
3
6
|
// flags, we discard them
|
|
4
7
|
data.discard(3);
|
|
@@ -26,3 +29,4 @@ export const parseMdhd = ({ data, size, fileOffset, }) => {
|
|
|
26
29
|
modificationTime,
|
|
27
30
|
};
|
|
28
31
|
};
|
|
32
|
+
exports.parseMdhd = parseMdhd;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseHdlr = void 0;
|
|
4
|
+
const parseHdlr = ({ iterator, size, offset, }) => {
|
|
2
5
|
const box = iterator.startBox(size - 8);
|
|
3
6
|
const version = iterator.getUint8();
|
|
4
7
|
if (version !== 0) {
|
|
@@ -27,3 +30,4 @@ export const parseHdlr = ({ iterator, size, offset, }) => {
|
|
|
27
30
|
componentName,
|
|
28
31
|
});
|
|
29
32
|
};
|
|
33
|
+
exports.parseHdlr = parseHdlr;
|