@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
package/dist/perform-seek.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.performSeek = void 0;
|
|
4
|
+
const log_1 = require("./log");
|
|
5
|
+
const performSeek = async ({ seekTo, state, currentReader, readerInterface, src, }) => {
|
|
3
6
|
const { iterator, logLevel, controller, mode, contentLength } = state;
|
|
4
7
|
if (seekTo <= iterator.counter.getOffset()) {
|
|
5
8
|
throw new Error(`Seeking backwards is not supported. Current position: ${iterator.counter.getOffset()}, seekTo: ${seekTo}`);
|
|
@@ -8,17 +11,17 @@ export const performSeek = async ({ seekTo, state, currentReader, readerInterfac
|
|
|
8
11
|
throw new Error(`Unexpected seek: ${seekTo} > ${contentLength}`);
|
|
9
12
|
}
|
|
10
13
|
if (iterator.counter.getOffset() + iterator.bytesRemaining() >= seekTo) {
|
|
11
|
-
Log.verbose(logLevel, `Skipping over video data from position ${iterator.counter.getOffset()} -> ${seekTo}. Data already fetched`);
|
|
14
|
+
log_1.Log.verbose(logLevel, `Skipping over video data from position ${iterator.counter.getOffset()} -> ${seekTo}. Data already fetched`);
|
|
12
15
|
iterator.discard(seekTo - iterator.counter.getOffset());
|
|
13
16
|
return currentReader;
|
|
14
17
|
}
|
|
15
18
|
if (mode === 'download') {
|
|
16
|
-
Log.verbose(logLevel, `Skipping over video data from position ${iterator.counter.getOffset()} -> ${seekTo}. Fetching but not reading all the data inbetween because in download mode`);
|
|
19
|
+
log_1.Log.verbose(logLevel, `Skipping over video data from position ${iterator.counter.getOffset()} -> ${seekTo}. Fetching but not reading all the data inbetween because in download mode`);
|
|
17
20
|
iterator.discard(seekTo - iterator.counter.getOffset());
|
|
18
21
|
return currentReader;
|
|
19
22
|
}
|
|
20
23
|
const time = Date.now();
|
|
21
|
-
Log.verbose(logLevel, `Skipping over video data from position ${iterator.counter.getOffset()} -> ${seekTo}. Re-reading because this portion is not available`);
|
|
24
|
+
log_1.Log.verbose(logLevel, `Skipping over video data from position ${iterator.counter.getOffset()} -> ${seekTo}. Re-reading because this portion is not available`);
|
|
22
25
|
currentReader.abort();
|
|
23
26
|
await (controller === null || controller === void 0 ? void 0 : controller._internals.checkForAbortAndPause());
|
|
24
27
|
const { reader: newReader } = await readerInterface.read({
|
|
@@ -28,6 +31,7 @@ export const performSeek = async ({ seekTo, state, currentReader, readerInterfac
|
|
|
28
31
|
});
|
|
29
32
|
iterator.skipTo(seekTo);
|
|
30
33
|
await state.discardReadBytes(true);
|
|
31
|
-
Log.verbose(logLevel, `Re-reading took ${Date.now() - time}ms. New position: ${iterator.counter.getOffset()}`);
|
|
34
|
+
log_1.Log.verbose(logLevel, `Re-reading took ${Date.now() - time}ms. New position: ${iterator.counter.getOffset()}`);
|
|
32
35
|
return newReader;
|
|
33
36
|
};
|
|
37
|
+
exports.performSeek = performSeek;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLengthAndReader = void 0;
|
|
4
|
+
const getLengthAndReader = async ({ canLiveWithoutContentLength, res, ownController, requestedWithoutRange, }) => {
|
|
2
5
|
const length = res.headers.get('content-length');
|
|
3
6
|
const contentLength = length === null ? null : parseInt(length, 10);
|
|
4
7
|
if (requestedWithoutRange ||
|
|
@@ -37,3 +40,4 @@ export const getLengthAndReader = async ({ canLiveWithoutContentLength, res, own
|
|
|
37
40
|
needsContentRange: true,
|
|
38
41
|
};
|
|
39
42
|
};
|
|
43
|
+
exports.getLengthAndReader = getLengthAndReader;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveUrl = void 0;
|
|
4
|
+
const resolveUrl = (src) => {
|
|
2
5
|
try {
|
|
3
6
|
const resolvedUrl = typeof window !== 'undefined' && typeof window.location !== 'undefined'
|
|
4
7
|
? new URL(src, window.location.origin)
|
|
@@ -9,3 +12,4 @@ export const resolveUrl = (src) => {
|
|
|
9
12
|
return src;
|
|
10
13
|
}
|
|
11
14
|
};
|
|
15
|
+
exports.resolveUrl = resolveUrl;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchReader = exports.fetchCreateAdjacentFileSource = exports.fetchReadWholeAsText = exports.fetchReadContent = void 0;
|
|
4
|
+
exports.parseContentRange = parseContentRange;
|
|
1
5
|
/* eslint-disable eqeqeq */
|
|
2
6
|
/* eslint-disable no-eq-null */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const get_body_and_reader_1 = require("./fetch/get-body-and-reader");
|
|
9
|
+
const resolve_url_1 = require("./fetch/resolve-url");
|
|
6
10
|
/**
|
|
7
11
|
* Parse Content-Range header.
|
|
8
12
|
* From: https://github.com/gregberge/content-range/blob/main/src/index.ts
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
function parseContentRange(input) {
|
|
11
15
|
const matches = input.match(/^(\w+) ((\d+)-(\d+)|\*)\/(\d+|\*)$/);
|
|
12
16
|
if (!matches)
|
|
13
17
|
return null;
|
|
@@ -42,12 +46,12 @@ const validateContentRangeAndDetectIfSupported = ({ requestedRange, parsedConten
|
|
|
42
46
|
}
|
|
43
47
|
return { supportsContentRange: true };
|
|
44
48
|
};
|
|
45
|
-
|
|
49
|
+
const fetchReadContent = async ({ src, range, controller, }) => {
|
|
46
50
|
var _a;
|
|
47
51
|
if (typeof src !== 'string' && src instanceof URL === false) {
|
|
48
52
|
throw new Error('src must be a string when using `fetchReader`');
|
|
49
53
|
}
|
|
50
|
-
const resolvedUrl = resolveUrl(src);
|
|
54
|
+
const resolvedUrl = (0, resolve_url_1.resolveUrl)(src);
|
|
51
55
|
const resolvedUrlString = resolvedUrl.toString();
|
|
52
56
|
if (!resolvedUrlString.startsWith('https://') &&
|
|
53
57
|
!resolvedUrlString.startsWith('blob:') &&
|
|
@@ -88,7 +92,7 @@ export const fetchReadContent = async ({ src, range, controller, }) => {
|
|
|
88
92
|
statusCode: res.status,
|
|
89
93
|
});
|
|
90
94
|
controller._internals.signal.addEventListener('abort', () => {
|
|
91
|
-
ownController.abort(new MediaParserAbortError('Aborted by user'));
|
|
95
|
+
ownController.abort(new errors_1.MediaParserAbortError('Aborted by user'));
|
|
92
96
|
}, { once: true });
|
|
93
97
|
if (res.status.toString().startsWith('4') ||
|
|
94
98
|
res.status.toString().startsWith('5')) {
|
|
@@ -97,7 +101,7 @@ export const fetchReadContent = async ({ src, range, controller, }) => {
|
|
|
97
101
|
const contentDisposition = res.headers.get('content-disposition');
|
|
98
102
|
const name = (_a = contentDisposition === null || contentDisposition === void 0 ? void 0 : contentDisposition.match(/filename="([^"]+)"/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
99
103
|
const fallbackName = src.toString().split('/').pop();
|
|
100
|
-
const { contentLength, needsContentRange, reader } = await getLengthAndReader({
|
|
104
|
+
const { contentLength, needsContentRange, reader } = await (0, get_body_and_reader_1.getLengthAndReader)({
|
|
101
105
|
canLiveWithoutContentLength,
|
|
102
106
|
res,
|
|
103
107
|
ownController,
|
|
@@ -119,7 +123,8 @@ export const fetchReadContent = async ({ src, range, controller, }) => {
|
|
|
119
123
|
needsContentRange,
|
|
120
124
|
};
|
|
121
125
|
};
|
|
122
|
-
|
|
126
|
+
exports.fetchReadContent = fetchReadContent;
|
|
127
|
+
const fetchReadWholeAsText = async (src) => {
|
|
123
128
|
if (typeof src !== 'string' && src instanceof URL === false) {
|
|
124
129
|
throw new Error('src must be a string when using `fetchReader`');
|
|
125
130
|
}
|
|
@@ -129,14 +134,16 @@ export const fetchReadWholeAsText = async (src) => {
|
|
|
129
134
|
}
|
|
130
135
|
return res.text();
|
|
131
136
|
};
|
|
132
|
-
|
|
137
|
+
exports.fetchReadWholeAsText = fetchReadWholeAsText;
|
|
138
|
+
const fetchCreateAdjacentFileSource = (relativePath, src) => {
|
|
133
139
|
if (typeof src !== 'string' && src instanceof URL === false) {
|
|
134
140
|
throw new Error('src must be a string or URL when using `fetchReader`');
|
|
135
141
|
}
|
|
136
142
|
return new URL(relativePath, src).toString();
|
|
137
143
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
exports.fetchCreateAdjacentFileSource = fetchCreateAdjacentFileSource;
|
|
145
|
+
exports.fetchReader = {
|
|
146
|
+
read: exports.fetchReadContent,
|
|
147
|
+
readWholeAsText: exports.fetchReadWholeAsText,
|
|
148
|
+
createAdjacentFileSource: exports.fetchCreateAdjacentFileSource,
|
|
142
149
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeReader = exports.nodeCreateAdjacentFileSource = exports.nodeReadWholeAsText = exports.nodeReadContent = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const stream_1 = require("stream");
|
|
7
|
+
const nodeReadContent = ({ src, range, controller }) => {
|
|
5
8
|
if (typeof src !== 'string') {
|
|
6
9
|
throw new Error('src must be a string when using `nodeReader`');
|
|
7
10
|
}
|
|
8
11
|
const ownController = new AbortController();
|
|
9
|
-
const stream = createReadStream(src, {
|
|
12
|
+
const stream = (0, fs_1.createReadStream)(src, {
|
|
10
13
|
start: range === null ? 0 : typeof range === 'number' ? range : range[0],
|
|
11
14
|
end: range === null
|
|
12
15
|
? Infinity
|
|
@@ -18,8 +21,8 @@ export const nodeReadContent = ({ src, range, controller }) => {
|
|
|
18
21
|
controller._internals.signal.addEventListener('abort', () => {
|
|
19
22
|
ownController.abort();
|
|
20
23
|
}, { once: true });
|
|
21
|
-
const stats = statSync(src);
|
|
22
|
-
const reader = Readable.toWeb(stream).getReader();
|
|
24
|
+
const stats = (0, fs_1.statSync)(src);
|
|
25
|
+
const reader = stream_1.Readable.toWeb(stream).getReader();
|
|
23
26
|
if (controller) {
|
|
24
27
|
controller._internals.signal.addEventListener('abort', () => {
|
|
25
28
|
reader.cancel().catch(() => { });
|
|
@@ -34,30 +37,33 @@ export const nodeReadContent = ({ src, range, controller }) => {
|
|
|
34
37
|
},
|
|
35
38
|
contentLength: stats.size,
|
|
36
39
|
contentType: null,
|
|
37
|
-
name: src.split(sep).pop(),
|
|
40
|
+
name: src.split(path_1.sep).pop(),
|
|
38
41
|
supportsContentRange: true,
|
|
39
42
|
needsContentRange: true,
|
|
40
43
|
});
|
|
41
44
|
};
|
|
42
|
-
|
|
45
|
+
exports.nodeReadContent = nodeReadContent;
|
|
46
|
+
const nodeReadWholeAsText = (src) => {
|
|
43
47
|
if (typeof src !== 'string') {
|
|
44
48
|
throw new Error('src must be a string when using `nodeReader`');
|
|
45
49
|
}
|
|
46
|
-
return promises.readFile(src, 'utf8');
|
|
50
|
+
return fs_1.promises.readFile(src, 'utf8');
|
|
47
51
|
};
|
|
48
|
-
|
|
52
|
+
exports.nodeReadWholeAsText = nodeReadWholeAsText;
|
|
53
|
+
const nodeCreateAdjacentFileSource = (relativePath, src) => {
|
|
49
54
|
if (typeof src !== 'string') {
|
|
50
55
|
throw new Error('src must be a string when using `nodeReader`');
|
|
51
56
|
}
|
|
52
|
-
const result = join(dirname(src), relativePath);
|
|
53
|
-
const rel = relative(dirname(src), result);
|
|
57
|
+
const result = (0, path_1.join)((0, path_1.dirname)(src), relativePath);
|
|
58
|
+
const rel = (0, path_1.relative)((0, path_1.dirname)(src), result);
|
|
54
59
|
if (rel.startsWith('..')) {
|
|
55
60
|
throw new Error('Path is outside of the parent directory - not allowing reading of arbitrary files');
|
|
56
61
|
}
|
|
57
62
|
return result;
|
|
58
63
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
exports.nodeCreateAdjacentFileSource = nodeCreateAdjacentFileSource;
|
|
65
|
+
exports.nodeReader = {
|
|
66
|
+
read: exports.nodeReadContent,
|
|
67
|
+
readWholeAsText: exports.nodeReadWholeAsText,
|
|
68
|
+
createAdjacentFileSource: exports.nodeCreateAdjacentFileSource,
|
|
63
69
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webFileReader = exports.webFileCreateAdjacentFileSource = exports.webFileReadWholeAsText = exports.webFileReadContent = void 0;
|
|
4
|
+
const webFileReadContent = ({ src, range, controller }) => {
|
|
2
5
|
if (typeof src === 'string' || src instanceof URL) {
|
|
3
6
|
throw new Error('`inputTypeFileReader` only supports `File` objects');
|
|
4
7
|
}
|
|
@@ -44,14 +47,17 @@ export const webFileReadContent = ({ src, range, controller }) => {
|
|
|
44
47
|
};
|
|
45
48
|
});
|
|
46
49
|
};
|
|
47
|
-
|
|
50
|
+
exports.webFileReadContent = webFileReadContent;
|
|
51
|
+
const webFileReadWholeAsText = () => {
|
|
48
52
|
throw new Error('`webFileReader` cannot read auxiliary files.');
|
|
49
53
|
};
|
|
50
|
-
|
|
54
|
+
exports.webFileReadWholeAsText = webFileReadWholeAsText;
|
|
55
|
+
const webFileCreateAdjacentFileSource = () => {
|
|
51
56
|
throw new Error('`webFileReader` cannot create adjacent file sources.');
|
|
52
57
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
exports.webFileCreateAdjacentFileSource = webFileCreateAdjacentFileSource;
|
|
59
|
+
exports.webFileReader = {
|
|
60
|
+
read: exports.webFileReadContent,
|
|
61
|
+
readWholeAsText: exports.webFileReadWholeAsText,
|
|
62
|
+
createAdjacentFileSource: exports.webFileCreateAdjacentFileSource,
|
|
57
63
|
};
|
package/dist/readers/reader.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.universalReader = void 0;
|
|
4
|
+
const from_fetch_1 = require("./from-fetch");
|
|
5
|
+
const from_node_1 = require("./from-node");
|
|
6
|
+
const from_web_file_1 = require("./from-web-file");
|
|
7
|
+
exports.universalReader = {
|
|
5
8
|
read: (params) => {
|
|
6
9
|
if (params.src instanceof Blob) {
|
|
7
|
-
return webFileReadContent(params);
|
|
10
|
+
return (0, from_web_file_1.webFileReadContent)(params);
|
|
8
11
|
}
|
|
9
12
|
if (params.src.toString().startsWith('http') ||
|
|
10
13
|
params.src.toString().startsWith('blob:')) {
|
|
11
|
-
return fetchReadContent(params);
|
|
14
|
+
return (0, from_fetch_1.fetchReadContent)(params);
|
|
12
15
|
}
|
|
13
|
-
return nodeReadContent(params);
|
|
16
|
+
return (0, from_node_1.nodeReadContent)(params);
|
|
14
17
|
},
|
|
15
18
|
readWholeAsText: (src) => {
|
|
16
19
|
if (src instanceof Blob) {
|
|
17
|
-
return webFileReadWholeAsText(src);
|
|
20
|
+
return (0, from_web_file_1.webFileReadWholeAsText)(src);
|
|
18
21
|
}
|
|
19
22
|
if (src.toString().startsWith('http') ||
|
|
20
23
|
src.toString().startsWith('blob:')) {
|
|
21
|
-
return fetchReadWholeAsText(src);
|
|
24
|
+
return (0, from_fetch_1.fetchReadWholeAsText)(src);
|
|
22
25
|
}
|
|
23
|
-
return nodeReadWholeAsText(src);
|
|
26
|
+
return (0, from_node_1.nodeReadWholeAsText)(src);
|
|
24
27
|
},
|
|
25
28
|
createAdjacentFileSource: (relativePath, src) => {
|
|
26
29
|
if (src instanceof Blob) {
|
|
27
|
-
return webFileCreateAdjacentFileSource(relativePath, src);
|
|
30
|
+
return (0, from_web_file_1.webFileCreateAdjacentFileSource)(relativePath, src);
|
|
28
31
|
}
|
|
29
32
|
if (src.toString().startsWith('http') ||
|
|
30
33
|
src.toString().startsWith('blob:')) {
|
|
31
|
-
return fetchCreateAdjacentFileSource(relativePath, src);
|
|
34
|
+
return (0, from_fetch_1.fetchCreateAdjacentFileSource)(relativePath, src);
|
|
32
35
|
}
|
|
33
|
-
return nodeCreateAdjacentFileSource(relativePath, src);
|
|
36
|
+
return (0, from_node_1.nodeCreateAdjacentFileSource)(relativePath, src);
|
|
34
37
|
},
|
|
35
38
|
};
|
package/dist/readers/web.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webReader = void 0;
|
|
4
|
+
const from_fetch_1 = require("./from-fetch");
|
|
5
|
+
const from_web_file_1 = require("./from-web-file");
|
|
6
|
+
exports.webReader = {
|
|
4
7
|
read: (params) => {
|
|
5
8
|
if (params.src instanceof Blob) {
|
|
6
|
-
return webFileReadContent(params);
|
|
9
|
+
return (0, from_web_file_1.webFileReadContent)(params);
|
|
7
10
|
}
|
|
8
|
-
return fetchReadContent(params);
|
|
11
|
+
return (0, from_fetch_1.fetchReadContent)(params);
|
|
9
12
|
},
|
|
10
13
|
createAdjacentFileSource: (relativePath, src) => {
|
|
11
14
|
if (src instanceof Blob) {
|
|
12
|
-
return webFileCreateAdjacentFileSource(relativePath, src);
|
|
15
|
+
return (0, from_web_file_1.webFileCreateAdjacentFileSource)(relativePath, src);
|
|
13
16
|
}
|
|
14
|
-
return fetchCreateAdjacentFileSource(relativePath, src);
|
|
17
|
+
return (0, from_fetch_1.fetchCreateAdjacentFileSource)(relativePath, src);
|
|
15
18
|
},
|
|
16
19
|
readWholeAsText: (src) => {
|
|
17
20
|
if (src instanceof Blob) {
|
|
18
|
-
return webFileReadWholeAsText(src);
|
|
21
|
+
return (0, from_web_file_1.webFileReadWholeAsText)(src);
|
|
19
22
|
}
|
|
20
|
-
return fetchReadWholeAsText(src);
|
|
23
|
+
return (0, from_fetch_1.fetchReadWholeAsText)(src);
|
|
21
24
|
},
|
|
22
25
|
};
|
package/dist/register-track.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerVideoTrackWhenProfileIsAvailable = exports.registerAudioTrack = exports.registerVideoTrack = void 0;
|
|
4
|
+
const add_avc_profile_to_track_1 = require("./add-avc-profile-to-track");
|
|
5
|
+
const log_1 = require("./log");
|
|
6
|
+
const registerVideoTrack = async ({ state, track, container, }) => {
|
|
4
7
|
if (state.callbacks.tracks.getTracks().find((t) => t.trackId === track.trackId)) {
|
|
5
|
-
Log.trace(state.logLevel, `Track ${track.trackId} already registered, skipping`);
|
|
8
|
+
log_1.Log.trace(state.logLevel, `Track ${track.trackId} already registered, skipping`);
|
|
6
9
|
return null;
|
|
7
10
|
}
|
|
8
11
|
if (track.type !== 'video') {
|
|
@@ -16,9 +19,10 @@ export const registerVideoTrack = async ({ state, track, container, }) => {
|
|
|
16
19
|
await state.callbacks.registerVideoSampleCallback(track.trackId, callback !== null && callback !== void 0 ? callback : null);
|
|
17
20
|
return callback;
|
|
18
21
|
};
|
|
19
|
-
|
|
22
|
+
exports.registerVideoTrack = registerVideoTrack;
|
|
23
|
+
const registerAudioTrack = async ({ state, track, container, }) => {
|
|
20
24
|
if (state.callbacks.tracks.getTracks().find((t) => t.trackId === track.trackId)) {
|
|
21
|
-
Log.trace(state.logLevel, `Track ${track.trackId} already registered, skipping`);
|
|
25
|
+
log_1.Log.trace(state.logLevel, `Track ${track.trackId} already registered, skipping`);
|
|
22
26
|
return null;
|
|
23
27
|
}
|
|
24
28
|
if (track.type !== 'audio') {
|
|
@@ -32,12 +36,14 @@ export const registerAudioTrack = async ({ state, track, container, }) => {
|
|
|
32
36
|
await state.callbacks.registerAudioSampleCallback(track.trackId, callback !== null && callback !== void 0 ? callback : null);
|
|
33
37
|
return callback;
|
|
34
38
|
};
|
|
35
|
-
|
|
39
|
+
exports.registerAudioTrack = registerAudioTrack;
|
|
40
|
+
const registerVideoTrackWhenProfileIsAvailable = ({ state, track, container, }) => {
|
|
36
41
|
state.riff.registerOnAvcProfileCallback(async (profile) => {
|
|
37
|
-
await registerVideoTrack({
|
|
42
|
+
await (0, exports.registerVideoTrack)({
|
|
38
43
|
state,
|
|
39
|
-
track: addAvcProfileToTrack(track, profile),
|
|
44
|
+
track: (0, add_avc_profile_to_track_1.addAvcProfileToTrack)(track, profile),
|
|
40
45
|
container,
|
|
41
46
|
});
|
|
42
47
|
});
|
|
43
48
|
};
|
|
49
|
+
exports.registerVideoTrackWhenProfileIsAvailable = registerVideoTrackWhenProfileIsAvailable;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.warnIfRemotionLicenseNotAcknowledged = void 0;
|
|
4
|
+
const log_1 = require("./log");
|
|
2
5
|
let warningShown = false;
|
|
3
|
-
|
|
6
|
+
const warnIfRemotionLicenseNotAcknowledged = ({ acknowledgeRemotionLicense, logLevel, apiName, }) => {
|
|
4
7
|
if (acknowledgeRemotionLicense) {
|
|
5
8
|
return;
|
|
6
9
|
}
|
|
@@ -8,6 +11,7 @@ export const warnIfRemotionLicenseNotAcknowledged = ({ acknowledgeRemotionLicens
|
|
|
8
11
|
return;
|
|
9
12
|
}
|
|
10
13
|
warningShown = true;
|
|
11
|
-
Log.warn(logLevel, 'Note: Some companies are required to obtain a license to use @remotion/media-parser. See: https://remotion.dev/license');
|
|
12
|
-
Log.warn(logLevel, `Pass \`acknowledgeRemotionLicense: true\` to \`${apiName}\` function to make this message disappear.`);
|
|
14
|
+
log_1.Log.warn(logLevel, 'Note: Some companies are required to obtain a license to use @remotion/media-parser. See: https://remotion.dev/license');
|
|
15
|
+
log_1.Log.warn(logLevel, `Pass \`acknowledgeRemotionLicense: true\` to \`${apiName}\` function to make this message disappear.`);
|
|
13
16
|
};
|
|
17
|
+
exports.warnIfRemotionLicenseNotAcknowledged = warnIfRemotionLicenseNotAcknowledged;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runParseIteration = void 0;
|
|
4
|
+
const parse_aac_1 = require("./containers/aac/parse-aac");
|
|
5
|
+
const parse_flac_1 = require("./containers/flac/parse-flac");
|
|
6
|
+
const parse_boxes_1 = require("./containers/iso-base-media/parse-boxes");
|
|
7
|
+
const parse_m3u_1 = require("./containers/m3u/parse-m3u");
|
|
8
|
+
const parse_mp3_1 = require("./containers/mp3/parse-mp3");
|
|
9
|
+
const parse_riff_1 = require("./containers/riff/parse-riff");
|
|
10
|
+
const parse_transport_stream_1 = require("./containers/transport-stream/parse-transport-stream");
|
|
11
|
+
const parse_wav_1 = require("./containers/wav/parse-wav");
|
|
12
|
+
const parse_webm_header_1 = require("./containers/webm/parse-webm-header");
|
|
13
|
+
const init_video_1 = require("./init-video");
|
|
14
|
+
const runParseIteration = async ({ state, mimeType, contentLength, name, }) => {
|
|
12
15
|
const structure = state.getStructureOrNull();
|
|
13
16
|
// m3u8 is busy parsing the chunks once the manifest has been read
|
|
14
17
|
if (structure && structure.type === 'm3u') {
|
|
15
|
-
return parseM3u({ state });
|
|
18
|
+
return (0, parse_m3u_1.parseM3u)({ state });
|
|
16
19
|
}
|
|
17
20
|
if (state.iterator.bytesRemaining() === 0) {
|
|
18
21
|
return Promise.reject(new Error('no bytes'));
|
|
19
22
|
}
|
|
20
23
|
if (structure === null) {
|
|
21
|
-
await initVideo({
|
|
24
|
+
await (0, init_video_1.initVideo)({
|
|
22
25
|
state,
|
|
23
26
|
mimeType,
|
|
24
27
|
name,
|
|
@@ -27,28 +30,29 @@ export const runParseIteration = async ({ state, mimeType, contentLength, name,
|
|
|
27
30
|
return null;
|
|
28
31
|
}
|
|
29
32
|
if (structure.type === 'riff') {
|
|
30
|
-
return parseRiff(state);
|
|
33
|
+
return (0, parse_riff_1.parseRiff)(state);
|
|
31
34
|
}
|
|
32
35
|
if (structure.type === 'mp3') {
|
|
33
|
-
return parseMp3(state);
|
|
36
|
+
return (0, parse_mp3_1.parseMp3)(state);
|
|
34
37
|
}
|
|
35
38
|
if (structure.type === 'iso-base-media') {
|
|
36
|
-
return parseIsoBaseMedia(state);
|
|
39
|
+
return (0, parse_boxes_1.parseIsoBaseMedia)(state);
|
|
37
40
|
}
|
|
38
41
|
if (structure.type === 'matroska') {
|
|
39
|
-
return parseWebm(state);
|
|
42
|
+
return (0, parse_webm_header_1.parseWebm)(state);
|
|
40
43
|
}
|
|
41
44
|
if (structure.type === 'transport-stream') {
|
|
42
|
-
return parseTransportStream(state);
|
|
45
|
+
return (0, parse_transport_stream_1.parseTransportStream)(state);
|
|
43
46
|
}
|
|
44
47
|
if (structure.type === 'wav') {
|
|
45
|
-
return parseWav(state);
|
|
48
|
+
return (0, parse_wav_1.parseWav)(state);
|
|
46
49
|
}
|
|
47
50
|
if (structure.type === 'aac') {
|
|
48
|
-
return parseAac(state);
|
|
51
|
+
return (0, parse_aac_1.parseAac)(state);
|
|
49
52
|
}
|
|
50
53
|
if (structure.type === 'flac') {
|
|
51
|
-
return parseFlac({ state, iterator: state.iterator });
|
|
54
|
+
return (0, parse_flac_1.parseFlac)({ state, iterator: state.iterator });
|
|
52
55
|
}
|
|
53
56
|
return Promise.reject(new Error('Unknown video format ' + structure));
|
|
54
57
|
};
|
|
58
|
+
exports.runParseIteration = runParseIteration;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSamplesFromMoof = void 0;
|
|
4
|
+
const traversal_1 = require("./containers/iso-base-media/traversal");
|
|
2
5
|
const getSamplesFromTraf = (trafSegment, moofOffset) => {
|
|
3
6
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4
7
|
if (trafSegment.type !== 'regular-box' || trafSegment.boxType !== 'traf') {
|
|
5
8
|
throw new Error('Expected traf-box');
|
|
6
9
|
}
|
|
7
|
-
const tfhdBox = getTfhdBox(trafSegment);
|
|
10
|
+
const tfhdBox = (0, traversal_1.getTfhdBox)(trafSegment);
|
|
8
11
|
const defaultSampleDuration = (_a = tfhdBox === null || tfhdBox === void 0 ? void 0 : tfhdBox.defaultSampleDuration) !== null && _a !== void 0 ? _a : null;
|
|
9
12
|
const defaultSampleSize = (_b = tfhdBox === null || tfhdBox === void 0 ? void 0 : tfhdBox.defaultSampleSize) !== null && _b !== void 0 ? _b : null;
|
|
10
13
|
const defaultSampleFlags = (_c = tfhdBox === null || tfhdBox === void 0 ? void 0 : tfhdBox.defaultSampleFlags) !== null && _c !== void 0 ? _c : null;
|
|
11
|
-
const tfdtBox = getTfdtBox(trafSegment);
|
|
12
|
-
const trunBoxes = getTrunBoxes(trafSegment);
|
|
14
|
+
const tfdtBox = (0, traversal_1.getTfdtBox)(trafSegment);
|
|
15
|
+
const trunBoxes = (0, traversal_1.getTrunBoxes)(trafSegment);
|
|
13
16
|
let time = 0;
|
|
14
17
|
let offset = 0;
|
|
15
18
|
let dataOffset = 0;
|
|
@@ -57,16 +60,17 @@ const getSamplesFromTraf = (trafSegment, moofOffset) => {
|
|
|
57
60
|
}
|
|
58
61
|
return samples;
|
|
59
62
|
};
|
|
60
|
-
|
|
63
|
+
const getSamplesFromMoof = ({ moofBox, trackId, }) => {
|
|
61
64
|
if (moofBox.type !== 'regular-box') {
|
|
62
65
|
throw new Error('Expected moof-box');
|
|
63
66
|
}
|
|
64
67
|
const trafs = moofBox.children.filter((c) => c.type === 'regular-box' && c.boxType === 'traf');
|
|
65
68
|
const mapped = trafs.map((traf) => {
|
|
66
|
-
const tfhdBox = getTfhdBox(traf);
|
|
69
|
+
const tfhdBox = (0, traversal_1.getTfhdBox)(traf);
|
|
67
70
|
return (tfhdBox === null || tfhdBox === void 0 ? void 0 : tfhdBox.trackId) === trackId
|
|
68
71
|
? getSamplesFromTraf(traf, moofBox.offset)
|
|
69
72
|
: [];
|
|
70
73
|
});
|
|
71
74
|
return mapped.flat(1);
|
|
72
75
|
};
|
|
76
|
+
exports.getSamplesFromMoof = getSamplesFromMoof;
|
package/dist/skip.js
CHANGED
package/dist/state/aac-state.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aacState = void 0;
|
|
4
|
+
const aacState = () => {
|
|
2
5
|
const samples = [];
|
|
3
6
|
return {
|
|
4
7
|
addSample: ({ offset, size }) => {
|
|
@@ -11,3 +14,4 @@ export const aacState = () => {
|
|
|
11
14
|
getSamples: () => samples,
|
|
12
15
|
};
|
|
13
16
|
};
|
|
17
|
+
exports.aacState = aacState;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCanSkipTracksState = exports.needsTracksForField = void 0;
|
|
4
|
+
const needsTracksForField = ({ field, structure, }) => {
|
|
2
5
|
if (field === 'dimensions') {
|
|
3
6
|
if (structure.type === 'riff') {
|
|
4
7
|
return false;
|
|
@@ -38,7 +41,8 @@ export const needsTracksForField = ({ field, structure, }) => {
|
|
|
38
41
|
}
|
|
39
42
|
throw new Error(`field not implemeted ${field}`);
|
|
40
43
|
};
|
|
41
|
-
|
|
44
|
+
exports.needsTracksForField = needsTracksForField;
|
|
45
|
+
const makeCanSkipTracksState = ({ hasAudioTrackHandlers, fields, hasVideoTrackHandlers, structure, }) => {
|
|
42
46
|
return {
|
|
43
47
|
canSkipTracks: () => {
|
|
44
48
|
if (hasAudioTrackHandlers || hasVideoTrackHandlers) {
|
|
@@ -46,7 +50,8 @@ export const makeCanSkipTracksState = ({ hasAudioTrackHandlers, fields, hasVideo
|
|
|
46
50
|
}
|
|
47
51
|
const keys = Object.keys(fields !== null && fields !== void 0 ? fields : {});
|
|
48
52
|
const selectedKeys = keys.filter((k) => fields[k]);
|
|
49
|
-
return !selectedKeys.some((k) => needsTracksForField({ field: k, structure: structure.getStructure() }));
|
|
53
|
+
return !selectedKeys.some((k) => (0, exports.needsTracksForField)({ field: k, structure: structure.getStructure() }));
|
|
50
54
|
},
|
|
51
55
|
};
|
|
52
56
|
};
|
|
57
|
+
exports.makeCanSkipTracksState = makeCanSkipTracksState;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emittedState = void 0;
|
|
4
|
+
const emittedState = () => {
|
|
2
5
|
const emittedFields = {
|
|
3
6
|
audioCodec: false,
|
|
4
7
|
container: false,
|
|
@@ -31,3 +34,4 @@ export const emittedState = () => {
|
|
|
31
34
|
};
|
|
32
35
|
return emittedFields;
|
|
33
36
|
};
|
|
37
|
+
exports.emittedState = emittedState;
|
package/dist/state/flac-state.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flacState = void 0;
|
|
4
|
+
const flacState = () => {
|
|
2
5
|
let blockingBitStrategy;
|
|
3
6
|
return {
|
|
4
7
|
setBlockingBitStrategy: (strategy) => {
|
|
@@ -7,3 +10,4 @@ export const flacState = () => {
|
|
|
7
10
|
getBlockingBitStrategy: () => blockingBitStrategy,
|
|
8
11
|
};
|
|
9
12
|
};
|
|
13
|
+
exports.flacState = flacState;
|