@remotion/media-parser 4.0.269 → 4.0.271
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 +6 -13
- package/dist/add-avc-profile-to-track.js +5 -9
- package/dist/buffer-iterator.js +8 -13
- package/dist/combine-uint8-arrays.js +1 -5
- package/dist/containers/aac/parse-aac.js +9 -13
- package/dist/containers/aac/types.js +1 -2
- package/dist/containers/avc/codec-string.js +1 -5
- package/dist/containers/avc/color.js +3 -9
- package/dist/containers/avc/create-sps-pps-data.js +5 -9
- package/dist/containers/avc/interpret-sps.js +7 -13
- package/dist/containers/avc/key.js +1 -5
- package/dist/containers/avc/parse-avc.js +3 -7
- package/dist/containers/avc/sps-and-pps.js +1 -5
- package/dist/containers/flac/get-block-size.js +1 -5
- package/dist/containers/flac/get-channel-count.d.ts +1 -1
- package/dist/containers/flac/get-channel-count.js +1 -5
- package/dist/containers/flac/get-duration-from-flac.js +1 -5
- package/dist/containers/flac/get-metadata-from-flac.js +1 -5
- package/dist/containers/flac/get-sample-rate.js +1 -5
- package/dist/containers/flac/parse-flac-frame.js +14 -19
- package/dist/containers/flac/parse-flac.js +15 -19
- package/dist/containers/flac/parse-header.js +1 -5
- package/dist/containers/flac/parse-metadata.js +1 -5
- package/dist/containers/flac/parse-streaminfo.js +3 -7
- package/dist/containers/flac/parse-unknown-block.js +1 -5
- package/dist/containers/flac/types.d.ts +2 -2
- package/dist/containers/flac/types.js +1 -2
- package/dist/containers/iso-base-media/base-media-box.js +1 -2
- package/dist/containers/iso-base-media/base-type.js +1 -2
- package/dist/containers/iso-base-media/esds/decoder-specific-config.js +1 -5
- package/dist/containers/iso-base-media/esds/esds-descriptors.js +5 -10
- package/dist/containers/iso-base-media/esds/esds.js +3 -7
- package/dist/containers/iso-base-media/ftyp.js +1 -5
- package/dist/containers/iso-base-media/get-actual-number-of-channels.js +4 -8
- package/dist/containers/iso-base-media/get-children.js +3 -7
- package/dist/containers/iso-base-media/get-keyframes.js +7 -11
- package/dist/containers/iso-base-media/get-moov-atom.js +22 -15
- package/dist/containers/iso-base-media/get-sample-positions-from-track.js +20 -24
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.d.ts +1 -1
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.js +3 -7
- package/dist/containers/iso-base-media/make-track.js +30 -34
- package/dist/containers/iso-base-media/mdat/mdat.js +16 -20
- package/dist/containers/iso-base-media/mdhd.js +1 -5
- package/dist/containers/iso-base-media/meta/hdlr.js +1 -5
- package/dist/containers/iso-base-media/meta/ilst.js +1 -5
- package/dist/containers/iso-base-media/moov/moov.js +3 -7
- package/dist/containers/iso-base-media/mvhd.js +7 -11
- package/dist/containers/iso-base-media/parse-boxes.js +5 -9
- package/dist/containers/iso-base-media/parse-icc-profile.js +4 -8
- package/dist/containers/iso-base-media/process-box.js +63 -67
- package/dist/containers/iso-base-media/stsd/av1c.js +1 -5
- package/dist/containers/iso-base-media/stsd/avcc.js +1 -5
- package/dist/containers/iso-base-media/stsd/colr.js +3 -7
- package/dist/containers/iso-base-media/stsd/ctts.js +1 -5
- package/dist/containers/iso-base-media/stsd/hvcc.js +3 -7
- package/dist/containers/iso-base-media/stsd/keys.js +1 -5
- package/dist/containers/iso-base-media/stsd/mebx.js +3 -7
- package/dist/containers/iso-base-media/stsd/pasp.js +1 -5
- package/dist/containers/iso-base-media/stsd/samples.js +8 -13
- package/dist/containers/iso-base-media/stsd/stco.js +1 -5
- package/dist/containers/iso-base-media/stsd/stsc.js +1 -5
- package/dist/containers/iso-base-media/stsd/stsd.js +3 -7
- package/dist/containers/iso-base-media/stsd/stss.js +1 -5
- package/dist/containers/iso-base-media/stsd/stsz.js +1 -5
- package/dist/containers/iso-base-media/stsd/stts.js +1 -5
- package/dist/containers/iso-base-media/tfdt.js +1 -5
- package/dist/containers/iso-base-media/tfhd.js +1 -5
- package/dist/containers/iso-base-media/tkhd.js +4 -8
- package/dist/containers/iso-base-media/to-date.js +1 -5
- package/dist/containers/iso-base-media/trak/trak.js +3 -7
- package/dist/containers/iso-base-media/traversal.d.ts +3 -2
- package/dist/containers/iso-base-media/traversal.js +42 -57
- package/dist/containers/iso-base-media/trun.js +2 -6
- package/dist/containers/iso-base-media/void-box.js +1 -2
- package/dist/containers/m3u/after-manifest-fetch.d.ts +8 -8
- package/dist/containers/m3u/after-manifest-fetch.js +33 -51
- package/dist/containers/m3u/fetch-m3u8-stream.d.ts +5 -2
- package/dist/containers/m3u/fetch-m3u8-stream.js +4 -12
- package/dist/containers/m3u/get-chunks.d.ts +1 -0
- package/dist/containers/m3u/get-chunks.js +6 -6
- package/dist/containers/m3u/get-duration-from-m3u.d.ts +2 -2
- package/dist/containers/m3u/get-duration-from-m3u.js +9 -8
- package/dist/containers/m3u/get-playlist.d.ts +6 -1
- package/dist/containers/m3u/get-playlist.js +19 -16
- package/dist/containers/m3u/get-streams.d.ts +14 -7
- package/dist/containers/m3u/get-streams.js +15 -18
- package/dist/containers/m3u/iterate-over-segment-files.d.ts +19 -0
- package/dist/containers/m3u/iterate-over-segment-files.js +106 -0
- package/dist/containers/m3u/m3u-child-stream.d.ts +0 -0
- package/dist/containers/m3u/m3u-child-stream.js +1 -0
- package/dist/containers/m3u/parse-directive.js +37 -10
- package/dist/containers/m3u/parse-m3u-manifest.js +3 -7
- package/dist/containers/m3u/parse-m3u-media-directive.d.ts +1 -0
- package/dist/containers/m3u/parse-m3u-media-directive.js +7 -7
- package/dist/containers/m3u/parse-m3u.js +18 -11
- package/dist/containers/m3u/parse-m3u8-text.js +3 -7
- package/dist/containers/m3u/parse-stream-inf.js +2 -7
- package/dist/containers/m3u/return-packets.d.ts +3 -2
- package/dist/containers/m3u/return-packets.js +92 -54
- package/dist/containers/m3u/run-over-m3u.d.ts +9 -0
- package/dist/containers/m3u/run-over-m3u.js +85 -0
- package/dist/containers/m3u/sample-sorter.d.ts +13 -0
- package/dist/containers/m3u/sample-sorter.js +60 -0
- package/dist/containers/m3u/select-stream.d.ts +10 -1
- package/dist/containers/m3u/select-stream.js +23 -7
- package/dist/containers/m3u/types.d.ts +15 -1
- package/dist/containers/m3u/types.js +1 -2
- package/dist/containers/mp3/get-duration.js +5 -9
- package/dist/containers/mp3/get-frame-length.js +2 -7
- package/dist/containers/mp3/get-metadata-from-mp3.d.ts +2 -2
- package/dist/containers/mp3/get-metadata-from-mp3.js +1 -5
- package/dist/containers/mp3/id3-v1.js +1 -5
- package/dist/containers/mp3/id3.js +1 -5
- package/dist/containers/mp3/parse-mp3.js +7 -11
- package/dist/containers/mp3/parse-mpeg-header.js +10 -14
- package/dist/containers/mp3/samples-per-mpeg-file.js +1 -5
- package/dist/containers/riff/expect-riff-box.js +11 -15
- package/dist/containers/riff/get-duration.js +7 -12
- package/dist/containers/riff/get-tracks-from-avi.js +20 -28
- package/dist/containers/riff/is-movi.js +1 -5
- package/dist/containers/riff/parse-avih.js +1 -5
- package/dist/containers/riff/parse-isft.js +1 -5
- package/dist/containers/riff/parse-list-box.js +3 -7
- package/dist/containers/riff/parse-movi.js +13 -18
- package/dist/containers/riff/parse-riff-body.js +9 -13
- package/dist/containers/riff/parse-riff-box.js +9 -13
- package/dist/containers/riff/parse-riff-header.js +1 -5
- package/dist/containers/riff/parse-riff.js +5 -9
- package/dist/containers/riff/parse-strf.js +1 -5
- package/dist/containers/riff/parse-strh.js +3 -7
- package/dist/containers/riff/parse-video-section.js +7 -11
- package/dist/containers/riff/riff-box.js +1 -2
- package/dist/containers/riff/timescale.js +1 -4
- package/dist/containers/riff/traversal.js +7 -15
- package/dist/containers/transport-stream/adts-header.js +6 -10
- package/dist/containers/transport-stream/boxes.js +1 -2
- package/dist/containers/transport-stream/discard-rest-of-packet.js +2 -7
- package/dist/containers/transport-stream/find-separator.js +1 -4
- package/dist/containers/transport-stream/get-tracks.js +7 -12
- package/dist/containers/transport-stream/handle-aac-packet.js +12 -16
- package/dist/containers/transport-stream/handle-avc-packet.js +22 -26
- package/dist/containers/transport-stream/next-pes-header-store.js +1 -5
- package/dist/containers/transport-stream/parse-packet.js +13 -17
- package/dist/containers/transport-stream/parse-pat.js +5 -10
- package/dist/containers/transport-stream/parse-pes.js +1 -5
- package/dist/containers/transport-stream/parse-pmt.js +3 -7
- package/dist/containers/transport-stream/parse-stream-packet.js +13 -17
- package/dist/containers/transport-stream/parse-transport-stream.js +5 -9
- package/dist/containers/transport-stream/process-stream-buffers.js +10 -15
- package/dist/containers/transport-stream/traversal.js +4 -10
- package/dist/containers/wav/get-duration-from-wav.js +3 -8
- package/dist/containers/wav/get-metadata-from-wav.d.ts +2 -2
- package/dist/containers/wav/get-metadata-from-wav.js +1 -5
- package/dist/containers/wav/parse-data.js +5 -9
- package/dist/containers/wav/parse-fmt.js +3 -7
- package/dist/containers/wav/parse-header.js +1 -5
- package/dist/containers/wav/parse-id3.js +1 -5
- package/dist/containers/wav/parse-list.js +10 -6
- package/dist/containers/wav/parse-video-section.js +3 -7
- package/dist/containers/wav/parse-wav.js +15 -19
- package/dist/containers/wav/types.d.ts +2 -2
- package/dist/containers/wav/types.js +1 -2
- package/dist/containers/webm/allowed-partial-segments.js +1 -4
- package/dist/containers/webm/av1-codec-private.js +3 -7
- package/dist/containers/webm/color.js +6 -10
- package/dist/containers/webm/description.js +6 -10
- package/dist/containers/webm/get-ready-tracks.js +13 -18
- package/dist/containers/webm/get-sample-from-block.js +12 -16
- package/dist/containers/webm/make-track.js +43 -48
- package/dist/containers/webm/parse-ebml.js +14 -19
- package/dist/containers/webm/parse-webm-header.js +3 -7
- package/dist/containers/webm/segments/all-segments.js +168 -173
- package/dist/containers/webm/segments/block-simple-block-flags.js +4 -8
- package/dist/containers/webm/segments/track-entry.js +1 -5
- package/dist/containers/webm/segments.js +9 -13
- package/dist/containers/webm/traversal.js +37 -67
- package/dist/convert-audio-or-video-sample.js +1 -5
- package/dist/download-and-parse-media.js +44 -46
- package/dist/emit-available-info.js +38 -38
- package/dist/emitter.js +1 -5
- package/dist/errors.d.ts +2 -17
- package/dist/errors.js +10 -30
- package/dist/esm/fetch.mjs +93 -67
- package/dist/esm/index.mjs +1189 -355
- package/dist/esm/node.mjs +59 -36
- package/dist/esm/universal.mjs +323 -0
- package/dist/esm/web-file.mjs +55 -43
- package/dist/esm/web.mjs +257 -0
- package/dist/esm/worker-server-entry.mjs +13056 -0
- package/dist/esm/worker-server.mjs +12914 -0
- package/dist/esm/worker-web-entry.mjs +12969 -0
- package/dist/esm/worker.mjs +439 -0
- package/dist/fetch.js +1 -17
- package/dist/file-types/bmp.js +3 -7
- package/dist/file-types/detect-file-type.js +24 -38
- package/dist/file-types/index.js +22 -26
- package/dist/file-types/jpeg.js +4 -9
- package/dist/file-types/pdf.js +3 -7
- package/dist/file-types/png.js +4 -9
- package/dist/file-types/webp.js +3 -7
- package/dist/forward-controller.js +1 -5
- package/dist/get-audio-codec.js +25 -38
- package/dist/get-container.d.ts +3 -3
- package/dist/get-container.js +5 -10
- package/dist/get-dimensions.js +8 -13
- package/dist/get-duration.js +27 -34
- package/dist/get-fields-from-callbacks.js +1 -5
- package/dist/get-fps.js +24 -34
- package/dist/get-is-hdr.js +5 -10
- package/dist/get-keyframes.js +6 -11
- package/dist/get-location.js +4 -9
- package/dist/get-number-of-audio-channels.js +2 -7
- package/dist/get-sample-aspect-ratio.js +17 -30
- package/dist/get-sample-positions-from-lpcm.js +5 -9
- package/dist/get-sample-positions.js +1 -5
- package/dist/get-sample-rate.js +2 -7
- package/dist/get-tracks.d.ts +5 -0
- package/dist/get-tracks.js +37 -44
- package/dist/get-video-codec.js +26 -34
- package/dist/has-all-info.js +33 -38
- package/dist/index.d.ts +44 -36
- package/dist/index.js +34 -47
- package/dist/init-video.d.ts +1 -1
- package/dist/init-video.js +47 -20
- package/dist/internal-parse-media.js +39 -41
- package/dist/is-audio-structure.d.ts +2 -2
- package/dist/is-audio-structure.js +1 -5
- package/dist/log.js +8 -12
- package/dist/make-hvc1-codec-strings.js +1 -5
- package/dist/media-parser-controller.js +7 -11
- package/dist/metadata/get-metadata.d.ts +4 -4
- package/dist/metadata/get-metadata.js +17 -22
- package/dist/metadata/metadata-from-iso.d.ts +3 -3
- package/dist/metadata/metadata-from-iso.js +12 -17
- package/dist/metadata/metadata-from-matroska.d.ts +2 -2
- package/dist/metadata/metadata-from-matroska.js +3 -7
- package/dist/metadata/metadata-from-riff.d.ts +2 -2
- package/dist/metadata/metadata-from-riff.js +3 -7
- package/dist/node-writer.js +1 -17
- package/dist/node.js +1 -17
- package/dist/options.d.ts +32 -25
- package/dist/options.js +1 -2
- package/dist/parse-media-on-browser-worker.d.ts +2 -0
- package/dist/parse-media-on-browser-worker.js +4 -0
- package/dist/parse-media-on-server-worker.d.ts +2 -0
- package/dist/parse-media-on-server-worker.js +4 -0
- package/dist/parse-media-on-web-worker.d.ts +2 -0
- package/dist/parse-media-on-web-worker.js +4 -0
- package/dist/parse-media-on-worker-entry.d.ts +2 -0
- package/dist/parse-media-on-worker-entry.js +269 -0
- package/dist/parse-media-on-worker.d.ts +2 -0
- package/dist/parse-media-on-worker.js +4 -0
- package/dist/parse-media.js +10 -12
- package/dist/parse-result.d.ts +3 -3
- package/dist/parse-result.js +1 -2
- package/dist/pause-signal.js +1 -5
- package/dist/perform-seek.js +6 -10
- package/dist/readers/fetch/get-body-and-reader.js +1 -5
- package/dist/readers/fetch/resolve-url.d.ts +1 -1
- package/dist/readers/fetch/resolve-url.js +1 -5
- package/dist/readers/from-fetch.d.ts +4 -1
- package/dist/readers/from-fetch.js +109 -94
- package/dist/readers/from-node.d.ts +4 -1
- package/dist/readers/from-node.js +58 -41
- package/dist/readers/from-web-file.d.ts +4 -1
- package/dist/readers/from-web-file.js +55 -49
- package/dist/readers/reader.d.ts +5 -1
- package/dist/readers/reader.js +1 -2
- package/dist/readers/universal.d.ts +2 -0
- package/dist/readers/universal.js +35 -0
- package/dist/readers/web.d.ts +2 -0
- package/dist/readers/web.js +22 -0
- package/dist/register-track.js +9 -15
- package/dist/remotion-license-acknowledge.js +4 -8
- package/dist/run-parse-iteration.js +26 -25
- package/dist/samples-from-moof.js +8 -12
- package/dist/skip.js +1 -5
- package/dist/state/aac-state.js +1 -5
- package/dist/state/can-skip-tracks.d.ts +2 -2
- package/dist/state/can-skip-tracks.js +3 -8
- package/dist/state/emitted-fields.js +1 -5
- package/dist/state/flac-state.js +1 -5
- package/dist/state/has-tracks-section.js +3 -7
- package/dist/state/images.js +1 -5
- package/dist/state/iso-base-media/cached-sample-positions.js +8 -13
- package/dist/state/iso-base-media/iso-state.js +5 -9
- package/dist/state/iso-base-media/moov-box.js +1 -5
- package/dist/state/keyframes.js +1 -5
- package/dist/state/last-eventloop-break.js +3 -7
- package/dist/state/m3u-state.d.ts +37 -16
- package/dist/state/m3u-state.js +98 -29
- package/dist/state/may-skip-video-data.js +3 -7
- package/dist/state/mp3.js +1 -5
- package/dist/state/need-samples-for-fields.js +1 -5
- package/dist/state/parser-state.d.ts +39 -33
- package/dist/state/parser-state.js +37 -41
- package/dist/state/riff.js +1 -5
- package/dist/state/sample-callbacks.js +8 -12
- package/dist/state/slow-duration-fps.js +1 -5
- package/dist/state/structure.d.ts +4 -4
- package/dist/state/structure.js +1 -5
- package/dist/state/transport-stream.js +3 -7
- package/dist/state/video-section.js +1 -5
- package/dist/state/webm.js +5 -9
- package/dist/throttled-progress.js +21 -14
- package/dist/truthy.js +1 -4
- package/dist/universal.d.ts +1 -0
- package/dist/universal.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -4
- package/dist/web-file.js +1 -17
- package/dist/web.d.ts +1 -0
- package/dist/web.js +1 -0
- package/dist/webcodec-sample-types.d.ts +6 -4
- package/dist/webcodec-sample-types.js +1 -2
- package/dist/worker/forward-controller.d.ts +3 -0
- package/dist/worker/forward-controller.js +20 -0
- package/dist/worker/serialize-error.d.ts +4 -0
- package/dist/worker/serialize-error.js +95 -0
- package/dist/worker/worker-types.d.ts +243 -0
- package/dist/worker/worker-types.js +1 -0
- package/dist/worker-bun-entry.d.ts +1 -0
- package/dist/worker-bun-entry.js +5 -0
- package/dist/worker-entry.d.ts +1 -0
- package/dist/worker-entry.js +5 -0
- package/dist/worker-server-entry.d.ts +1 -0
- package/dist/worker-server-entry.js +5 -0
- package/dist/worker-server.d.ts +2 -0
- package/dist/worker-server.js +381 -0
- package/dist/worker-web-entry.d.ts +1 -0
- package/dist/worker-web-entry.js +5 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +267 -0
- package/dist/writers/node.js +16 -23
- package/dist/writers/writer.js +1 -2
- package/package.json +40 -21
- package/fetch.js +0 -2
- package/test.json +0 -663
- package/web-file.js +0 -2
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.parseMebx = void 0;
|
|
4
|
-
const get_children_1 = require("../get-children");
|
|
5
|
-
const parseMebx = async ({ offset, size, state, }) => {
|
|
1
|
+
import { getIsoBaseMediaChildren } from '../get-children';
|
|
2
|
+
export const parseMebx = async ({ offset, size, state, }) => {
|
|
6
3
|
// reserved, 6 bit
|
|
7
4
|
state.iterator.discard(6);
|
|
8
5
|
const dataReferenceIndex = state.iterator.getUint16();
|
|
9
|
-
const children = await
|
|
6
|
+
const children = await getIsoBaseMediaChildren({
|
|
10
7
|
state,
|
|
11
8
|
size: size - 8,
|
|
12
9
|
});
|
|
@@ -19,4 +16,3 @@ const parseMebx = async ({ offset, size, state, }) => {
|
|
|
19
16
|
children,
|
|
20
17
|
};
|
|
21
18
|
};
|
|
22
|
-
exports.parseMebx = parseMebx;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parsePasp = void 0;
|
|
4
|
-
const parsePasp = ({ iterator, offset, size, }) => {
|
|
1
|
+
export const parsePasp = ({ iterator, offset, size, }) => {
|
|
5
2
|
const hSpacing = iterator.getUint32();
|
|
6
3
|
const vSpacing = iterator.getUint32();
|
|
7
4
|
const bytesRemainingInBox = size - (iterator.counter.getOffset() - offset);
|
|
@@ -14,4 +11,3 @@ const parsePasp = ({ iterator, offset, size, }) => {
|
|
|
14
11
|
vSpacing,
|
|
15
12
|
};
|
|
16
13
|
};
|
|
17
|
-
exports.parsePasp = parsePasp;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseIsoFormatBoxes = exports.processIsoFormatBox = void 0;
|
|
4
|
-
const get_children_1 = require("../get-children");
|
|
1
|
+
import { getIsoBaseMediaChildren } from '../get-children';
|
|
5
2
|
// https://developer.apple.com/documentation/quicktime-file-format/video_sample_description
|
|
6
3
|
const videoTags = [
|
|
7
4
|
'cvid',
|
|
@@ -63,7 +60,7 @@ const audioTags = [
|
|
|
63
60
|
'mp4a',
|
|
64
61
|
'ac-3',
|
|
65
62
|
];
|
|
66
|
-
const processIsoFormatBox = async ({ state, }) => {
|
|
63
|
+
export const processIsoFormatBox = async ({ state, }) => {
|
|
67
64
|
const { iterator } = state;
|
|
68
65
|
const fileOffset = iterator.counter.getOffset();
|
|
69
66
|
const bytesRemaining = iterator.bytesRemaining();
|
|
@@ -100,7 +97,7 @@ const processIsoFormatBox = async ({ state, }) => {
|
|
|
100
97
|
const compressionId = iterator.getUint16();
|
|
101
98
|
const packetSize = iterator.getUint16();
|
|
102
99
|
const sampleRate = iterator.getFixedPointUnsigned1616Number();
|
|
103
|
-
const children = await
|
|
100
|
+
const children = await getIsoBaseMediaChildren({
|
|
104
101
|
state,
|
|
105
102
|
size: boxSize - (iterator.counter.getOffset() - fileOffset),
|
|
106
103
|
});
|
|
@@ -137,7 +134,7 @@ const processIsoFormatBox = async ({ state, }) => {
|
|
|
137
134
|
const bytesPerPacket = iterator.getUint32();
|
|
138
135
|
const bytesPerFrame = iterator.getUint32();
|
|
139
136
|
const bytesPerSample = iterator.getUint32();
|
|
140
|
-
const children = await
|
|
137
|
+
const children = await getIsoBaseMediaChildren({
|
|
141
138
|
state,
|
|
142
139
|
size: boxSize - (iterator.counter.getOffset() - fileOffset),
|
|
143
140
|
});
|
|
@@ -178,7 +175,7 @@ const processIsoFormatBox = async ({ state, }) => {
|
|
|
178
175
|
iterator.getUint32(); // ignore;
|
|
179
176
|
const bytesPerFrame = iterator.getUint32();
|
|
180
177
|
const samplesPerPacket = iterator.getUint32();
|
|
181
|
-
const children = await
|
|
178
|
+
const children = await getIsoBaseMediaChildren({
|
|
182
179
|
state,
|
|
183
180
|
size: boxSize - (iterator.counter.getOffset() - fileOffset),
|
|
184
181
|
});
|
|
@@ -224,7 +221,7 @@ const processIsoFormatBox = async ({ state, }) => {
|
|
|
224
221
|
const colorTableId = iterator.getInt16();
|
|
225
222
|
const bytesRemainingInBox = boxSize - (iterator.counter.getOffset() - fileOffset);
|
|
226
223
|
const children = bytesRemainingInBox > 8
|
|
227
|
-
? await
|
|
224
|
+
? await getIsoBaseMediaChildren({
|
|
228
225
|
state,
|
|
229
226
|
size: bytesRemainingInBox,
|
|
230
227
|
})
|
|
@@ -256,14 +253,13 @@ const processIsoFormatBox = async ({ state, }) => {
|
|
|
256
253
|
}
|
|
257
254
|
throw new Error(`Unknown sample format ${boxFormat}`);
|
|
258
255
|
};
|
|
259
|
-
|
|
260
|
-
const parseIsoFormatBoxes = async ({ maxBytes, state, }) => {
|
|
256
|
+
export const parseIsoFormatBoxes = async ({ maxBytes, state, }) => {
|
|
261
257
|
const { iterator } = state;
|
|
262
258
|
const samples = [];
|
|
263
259
|
const initialOffset = iterator.counter.getOffset();
|
|
264
260
|
while (iterator.bytesRemaining() > 0 &&
|
|
265
261
|
iterator.counter.getOffset() - initialOffset < maxBytes) {
|
|
266
|
-
const { sample } = await
|
|
262
|
+
const { sample } = await processIsoFormatBox({
|
|
267
263
|
state,
|
|
268
264
|
});
|
|
269
265
|
if (sample) {
|
|
@@ -272,4 +268,3 @@ const parseIsoFormatBoxes = async ({ maxBytes, state, }) => {
|
|
|
272
268
|
}
|
|
273
269
|
return samples;
|
|
274
270
|
};
|
|
275
|
-
exports.parseIsoFormatBoxes = parseIsoFormatBoxes;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStco = void 0;
|
|
4
|
-
const parseStco = ({ iterator, offset, size, mode64Bit, }) => {
|
|
1
|
+
export const parseStco = ({ iterator, offset, size, mode64Bit, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
if (version !== 0) {
|
|
7
4
|
throw new Error(`Unsupported STSD version ${version}`);
|
|
@@ -27,4 +24,3 @@ const parseStco = ({ iterator, offset, size, mode64Bit, }) => {
|
|
|
27
24
|
entryCount,
|
|
28
25
|
};
|
|
29
26
|
};
|
|
30
|
-
exports.parseStco = parseStco;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStsc = void 0;
|
|
4
|
-
const parseStsc = ({ iterator, offset, size, }) => {
|
|
1
|
+
export const parseStsc = ({ iterator, offset, size, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
if (version !== 0) {
|
|
7
4
|
throw new Error(`Unsupported STSD version ${version}`);
|
|
@@ -31,4 +28,3 @@ const parseStsc = ({ iterator, offset, size, }) => {
|
|
|
31
28
|
entries,
|
|
32
29
|
};
|
|
33
30
|
};
|
|
34
|
-
exports.parseStsc = parseStsc;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.parseStsd = void 0;
|
|
4
|
-
const samples_1 = require("./samples");
|
|
5
|
-
const parseStsd = async ({ offset, size, state, }) => {
|
|
1
|
+
import { parseIsoFormatBoxes } from './samples';
|
|
2
|
+
export const parseStsd = async ({ offset, size, state, }) => {
|
|
6
3
|
const { iterator } = state;
|
|
7
4
|
const version = iterator.getUint8();
|
|
8
5
|
if (version !== 0) {
|
|
@@ -12,7 +9,7 @@ const parseStsd = async ({ offset, size, state, }) => {
|
|
|
12
9
|
iterator.discard(3);
|
|
13
10
|
const numberOfEntries = iterator.getUint32();
|
|
14
11
|
const bytesRemainingInBox = size - (iterator.counter.getOffset() - offset);
|
|
15
|
-
const boxes = await
|
|
12
|
+
const boxes = await parseIsoFormatBoxes({
|
|
16
13
|
maxBytes: bytesRemainingInBox,
|
|
17
14
|
state,
|
|
18
15
|
});
|
|
@@ -27,4 +24,3 @@ const parseStsd = async ({ offset, size, state, }) => {
|
|
|
27
24
|
samples: boxes,
|
|
28
25
|
};
|
|
29
26
|
};
|
|
30
|
-
exports.parseStsd = parseStsd;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStss = void 0;
|
|
4
|
-
const parseStss = ({ iterator, offset, boxSize, }) => {
|
|
1
|
+
export const parseStss = ({ iterator, offset, boxSize, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
if (version !== 0) {
|
|
7
4
|
throw new Error(`Unsupported STSS version ${version}`);
|
|
@@ -25,4 +22,3 @@ const parseStss = ({ iterator, offset, boxSize, }) => {
|
|
|
25
22
|
offset,
|
|
26
23
|
};
|
|
27
24
|
};
|
|
28
|
-
exports.parseStss = parseStss;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStsz = void 0;
|
|
4
|
-
const parseStsz = ({ iterator, offset, size, }) => {
|
|
1
|
+
export const parseStsz = ({ iterator, offset, size, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
if (version !== 0) {
|
|
7
4
|
throw new Error(`Unsupported STSD version ${version}`);
|
|
@@ -41,4 +38,3 @@ const parseStsz = ({ iterator, offset, size, }) => {
|
|
|
41
38
|
entries: samples,
|
|
42
39
|
};
|
|
43
40
|
};
|
|
44
|
-
exports.parseStsz = parseStsz;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStts = void 0;
|
|
4
|
-
const parseStts = ({ data, size, fileOffset, }) => {
|
|
1
|
+
export const parseStts = ({ data, size, fileOffset, }) => {
|
|
5
2
|
const initialOffset = data.counter.getOffset();
|
|
6
3
|
const initialCounter = initialOffset - fileOffset;
|
|
7
4
|
const version = data.getUint8();
|
|
@@ -32,4 +29,3 @@ const parseStts = ({ data, size, fileOffset, }) => {
|
|
|
32
29
|
sampleDistribution: sampleDistributions,
|
|
33
30
|
};
|
|
34
31
|
};
|
|
35
|
-
exports.parseStts = parseStts;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTfdt = void 0;
|
|
4
|
-
const parseTfdt = ({ iterator, size, offset, }) => {
|
|
1
|
+
export const parseTfdt = ({ iterator, size, offset, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
iterator.discard(3);
|
|
7
4
|
// Flags, discard them
|
|
@@ -17,4 +14,3 @@ const parseTfdt = ({ iterator, size, offset, }) => {
|
|
|
17
14
|
offset,
|
|
18
15
|
};
|
|
19
16
|
};
|
|
20
|
-
exports.parseTfdt = parseTfdt;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTfhd = void 0;
|
|
4
|
-
const getTfhd = ({ iterator, offset, size, }) => {
|
|
1
|
+
export const getTfhd = ({ iterator, offset, size, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
const flags = iterator.getUint24();
|
|
7
4
|
const trackId = iterator.getUint32();
|
|
@@ -38,4 +35,3 @@ const getTfhd = ({ iterator, offset, size, }) => {
|
|
|
38
35
|
defaultSampleFlags,
|
|
39
36
|
};
|
|
40
37
|
};
|
|
41
|
-
exports.getTfhd = getTfhd;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTkhd = void 0;
|
|
4
|
-
const to_date_1 = require("./to-date");
|
|
1
|
+
import { toUnixTimestamp } from './to-date';
|
|
5
2
|
function getRotationAngleFromMatrix(matrix) {
|
|
6
3
|
// Extract elements from the matrix
|
|
7
4
|
const [a, b, c, d] = matrix;
|
|
@@ -25,7 +22,7 @@ const applyRotation = ({ matrix, width, height, }) => {
|
|
|
25
22
|
height: Math.abs(newHeight),
|
|
26
23
|
};
|
|
27
24
|
};
|
|
28
|
-
const parseTkhd = ({ iterator, offset, size, }) => {
|
|
25
|
+
export const parseTkhd = ({ iterator, offset, size, }) => {
|
|
29
26
|
const version = iterator.getUint8();
|
|
30
27
|
// Flags, we discard them
|
|
31
28
|
iterator.discard(3);
|
|
@@ -68,8 +65,8 @@ const parseTkhd = ({ iterator, offset, size, }) => {
|
|
|
68
65
|
offset,
|
|
69
66
|
boxSize: size,
|
|
70
67
|
type: 'tkhd-box',
|
|
71
|
-
creationTime:
|
|
72
|
-
modificationTime:
|
|
68
|
+
creationTime: toUnixTimestamp(Number(creationTime)),
|
|
69
|
+
modificationTime: toUnixTimestamp(Number(modificationTime)),
|
|
73
70
|
trackId,
|
|
74
71
|
duration: Number(duration),
|
|
75
72
|
layer,
|
|
@@ -84,4 +81,3 @@ const parseTkhd = ({ iterator, offset, size, }) => {
|
|
|
84
81
|
unrotatedHeight: heightWithoutRotationApplied,
|
|
85
82
|
};
|
|
86
83
|
};
|
|
87
|
-
exports.parseTkhd = parseTkhd;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toUnixTimestamp = void 0;
|
|
4
|
-
const toUnixTimestamp = (value) => {
|
|
1
|
+
export const toUnixTimestamp = (value) => {
|
|
5
2
|
if (value === 0) {
|
|
6
3
|
return null;
|
|
7
4
|
}
|
|
8
5
|
const baseDate = new Date('1904-01-01T00:00:00Z');
|
|
9
6
|
return Math.floor(value + baseDate.getTime() / 1000) * 1000;
|
|
10
7
|
};
|
|
11
|
-
exports.toUnixTimestamp = toUnixTimestamp;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const get_children_1 = require("../get-children");
|
|
5
|
-
const parseTrak = async ({ size, offsetAtStart, state: options, }) => {
|
|
6
|
-
const children = await (0, get_children_1.getIsoBaseMediaChildren)({
|
|
1
|
+
import { getIsoBaseMediaChildren } from '../get-children';
|
|
2
|
+
export const parseTrak = async ({ size, offsetAtStart, state: options, }) => {
|
|
3
|
+
const children = await getIsoBaseMediaChildren({
|
|
7
4
|
state: options,
|
|
8
5
|
size: size - 8,
|
|
9
6
|
});
|
|
@@ -14,4 +11,3 @@ const parseTrak = async ({ size, offsetAtStart, state: options, }) => {
|
|
|
14
11
|
children,
|
|
15
12
|
};
|
|
16
13
|
};
|
|
17
|
-
exports.parseTrak = parseTrak;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnySegment } from '../../parse-result';
|
|
1
|
+
import type { AnySegment, IsoBaseMediaStructure } from '../../parse-result';
|
|
2
2
|
import type { ParserState } from '../../state/parser-state';
|
|
3
3
|
import type { IsoBaseMediaBox, RegularBox } from './base-media-box';
|
|
4
4
|
import type { FtypBox } from './ftyp';
|
|
@@ -18,7 +18,8 @@ import type { TkhdBox } from './tkhd';
|
|
|
18
18
|
import type { TrakBox } from './trak/trak';
|
|
19
19
|
import type { TrunBox } from './trun';
|
|
20
20
|
export declare const getFtypBox: (segments: AnySegment[]) => FtypBox | null;
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const getMoovFromFromIsoStructure: (structure: IsoBaseMediaStructure) => MoovBox | null;
|
|
22
|
+
export declare const getMoovBoxFromState: (state: ParserState) => MoovBox | null;
|
|
22
23
|
export declare const getMoofBoxes: (main: AnySegment[]) => IsoBaseMediaBox[];
|
|
23
24
|
export declare const getMvhdBox: (moovBox: MoovBox) => MvhdBox | null;
|
|
24
25
|
export declare const getTraks: (moovBox: MoovBox) => TrakBox[];
|
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTrunBoxes = exports.getTfhdBox = exports.getTfdtBox = exports.getStssBox = exports.getStscBox = exports.getStszBox = exports.getCttsBox = exports.getSttsBox = exports.getStcoBox = exports.getVideoDescriptors = exports.getStsdBox = exports.getStblBox = exports.getMdhdBox = exports.getMdiaBox = exports.getTkhdBox = exports.getTraks = exports.getMvhdBox = exports.getMoofBoxes = exports.getMoovBox = exports.getFtypBox = void 0;
|
|
4
|
-
const getFtypBox = (segments) => {
|
|
1
|
+
export const getFtypBox = (segments) => {
|
|
5
2
|
const ftypBox = segments.find((s) => s.type === 'ftyp-box');
|
|
6
3
|
if (!ftypBox || ftypBox.type !== 'ftyp-box') {
|
|
7
4
|
return null;
|
|
8
5
|
}
|
|
9
6
|
return ftypBox;
|
|
10
7
|
};
|
|
11
|
-
|
|
12
|
-
const getMoovBox = (state) => {
|
|
13
|
-
if (state.iso.moov.getMoovBox()) {
|
|
14
|
-
return state.iso.moov.getMoovBox();
|
|
15
|
-
}
|
|
16
|
-
const structure = state.getIsoStructure();
|
|
8
|
+
export const getMoovFromFromIsoStructure = (structure) => {
|
|
17
9
|
const moovBox = structure.boxes.find((s) => s.type === 'moov-box');
|
|
18
10
|
if (!moovBox || moovBox.type !== 'moov-box') {
|
|
19
11
|
return null;
|
|
20
12
|
}
|
|
21
13
|
return moovBox;
|
|
22
14
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
15
|
+
export const getMoovBoxFromState = (state) => {
|
|
16
|
+
const got = state.iso.moov.getMoovBox();
|
|
17
|
+
if (got) {
|
|
18
|
+
return got;
|
|
19
|
+
}
|
|
20
|
+
const a = state.mp4HeaderSegment;
|
|
21
|
+
if (a) {
|
|
22
|
+
return getMoovFromFromIsoStructure(a);
|
|
23
|
+
}
|
|
24
|
+
const structure = state.getIsoStructure();
|
|
25
|
+
return getMoovFromFromIsoStructure(structure);
|
|
26
|
+
};
|
|
27
|
+
export const getMoofBoxes = (main) => {
|
|
25
28
|
const moofBoxes = main.filter((s) => s.type === 'regular-box' && s.boxType === 'moof');
|
|
26
29
|
return moofBoxes;
|
|
27
30
|
};
|
|
28
|
-
|
|
29
|
-
const getMvhdBox = (moovBox) => {
|
|
31
|
+
export const getMvhdBox = (moovBox) => {
|
|
30
32
|
const mvHdBox = moovBox.children.find((s) => s.type === 'mvhd-box');
|
|
31
33
|
if (!mvHdBox || mvHdBox.type !== 'mvhd-box') {
|
|
32
34
|
return null;
|
|
33
35
|
}
|
|
34
36
|
return mvHdBox;
|
|
35
37
|
};
|
|
36
|
-
|
|
37
|
-
const getTraks = (moovBox) => {
|
|
38
|
+
export const getTraks = (moovBox) => {
|
|
38
39
|
return moovBox.children.filter((s) => s.type === 'trak-box');
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
const getTkhdBox = (trakBox) => {
|
|
41
|
+
export const getTkhdBox = (trakBox) => {
|
|
42
42
|
const tkhdBox = trakBox.children.find((s) => s.type === 'tkhd-box');
|
|
43
43
|
return tkhdBox;
|
|
44
44
|
};
|
|
45
|
-
|
|
46
|
-
const getMdiaBox = (trakBox) => {
|
|
45
|
+
export const getMdiaBox = (trakBox) => {
|
|
47
46
|
const mdiaBox = trakBox.children.find((s) => s.type === 'regular-box' && s.boxType === 'mdia');
|
|
48
47
|
if (!mdiaBox || mdiaBox.type !== 'regular-box') {
|
|
49
48
|
return null;
|
|
50
49
|
}
|
|
51
50
|
return mdiaBox;
|
|
52
51
|
};
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
const mdiaBox = (0, exports.getMdiaBox)(trakBox);
|
|
52
|
+
export const getMdhdBox = (trakBox) => {
|
|
53
|
+
const mdiaBox = getMdiaBox(trakBox);
|
|
56
54
|
if (!mdiaBox) {
|
|
57
55
|
return null;
|
|
58
56
|
}
|
|
59
57
|
const mdhdBox = mdiaBox.children.find((c) => c.type === 'mdhd-box');
|
|
60
58
|
return mdhdBox;
|
|
61
59
|
};
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
const mdiaBox = (0, exports.getMdiaBox)(trakBox);
|
|
60
|
+
export const getStblBox = (trakBox) => {
|
|
61
|
+
const mdiaBox = getMdiaBox(trakBox);
|
|
65
62
|
if (!mdiaBox) {
|
|
66
63
|
return null;
|
|
67
64
|
}
|
|
@@ -75,19 +72,17 @@ const getStblBox = (trakBox) => {
|
|
|
75
72
|
}
|
|
76
73
|
return stblBox;
|
|
77
74
|
};
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
75
|
+
export const getStsdBox = (trakBox) => {
|
|
76
|
+
const stblBox = getStblBox(trakBox);
|
|
81
77
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
82
78
|
return null;
|
|
83
79
|
}
|
|
84
80
|
const stsdBox = stblBox.children.find((s) => s.type === 'stsd-box');
|
|
85
81
|
return stsdBox;
|
|
86
82
|
};
|
|
87
|
-
|
|
88
|
-
const getVideoDescriptors = (trakBox) => {
|
|
83
|
+
export const getVideoDescriptors = (trakBox) => {
|
|
89
84
|
var _a;
|
|
90
|
-
const stsdBox =
|
|
85
|
+
const stsdBox = getStsdBox(trakBox);
|
|
91
86
|
if (!stsdBox) {
|
|
92
87
|
return null;
|
|
93
88
|
}
|
|
@@ -104,62 +99,55 @@ const getVideoDescriptors = (trakBox) => {
|
|
|
104
99
|
});
|
|
105
100
|
return (_a = descriptors.flat(1).filter(Boolean)[0]) !== null && _a !== void 0 ? _a : null;
|
|
106
101
|
};
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
102
|
+
export const getStcoBox = (trakBox) => {
|
|
103
|
+
const stblBox = getStblBox(trakBox);
|
|
110
104
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
111
105
|
return null;
|
|
112
106
|
}
|
|
113
107
|
const stcoBox = stblBox.children.find((s) => s.type === 'stco-box');
|
|
114
108
|
return stcoBox;
|
|
115
109
|
};
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
110
|
+
export const getSttsBox = (trakBox) => {
|
|
111
|
+
const stblBox = getStblBox(trakBox);
|
|
119
112
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
120
113
|
return null;
|
|
121
114
|
}
|
|
122
115
|
const sttsBox = stblBox.children.find((s) => s.type === 'stts-box');
|
|
123
116
|
return sttsBox;
|
|
124
117
|
};
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
118
|
+
export const getCttsBox = (trakBox) => {
|
|
119
|
+
const stblBox = getStblBox(trakBox);
|
|
128
120
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
129
121
|
return null;
|
|
130
122
|
}
|
|
131
123
|
const cttsBox = stblBox.children.find((s) => s.type === 'ctts-box');
|
|
132
124
|
return cttsBox;
|
|
133
125
|
};
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
126
|
+
export const getStszBox = (trakBox) => {
|
|
127
|
+
const stblBox = getStblBox(trakBox);
|
|
137
128
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
138
129
|
return null;
|
|
139
130
|
}
|
|
140
131
|
const stszBox = stblBox.children.find((s) => s.type === 'stsz-box');
|
|
141
132
|
return stszBox;
|
|
142
133
|
};
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
134
|
+
export const getStscBox = (trakBox) => {
|
|
135
|
+
const stblBox = getStblBox(trakBox);
|
|
146
136
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
147
137
|
return null;
|
|
148
138
|
}
|
|
149
139
|
const stcoBox = stblBox.children.find((b) => b.type === 'stsc-box');
|
|
150
140
|
return stcoBox;
|
|
151
141
|
};
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
142
|
+
export const getStssBox = (trakBox) => {
|
|
143
|
+
const stblBox = getStblBox(trakBox);
|
|
155
144
|
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
156
145
|
return null;
|
|
157
146
|
}
|
|
158
147
|
const stssBox = stblBox.children.find((b) => b.type === 'stss-box');
|
|
159
148
|
return stssBox;
|
|
160
149
|
};
|
|
161
|
-
|
|
162
|
-
const getTfdtBox = (segment) => {
|
|
150
|
+
export const getTfdtBox = (segment) => {
|
|
163
151
|
if (segment.type !== 'regular-box' || segment.boxType !== 'traf') {
|
|
164
152
|
throw new Error('Expected traf-box');
|
|
165
153
|
}
|
|
@@ -169,8 +157,7 @@ const getTfdtBox = (segment) => {
|
|
|
169
157
|
}
|
|
170
158
|
return tfhdBox;
|
|
171
159
|
};
|
|
172
|
-
|
|
173
|
-
const getTfhdBox = (segment) => {
|
|
160
|
+
export const getTfhdBox = (segment) => {
|
|
174
161
|
if (segment.type !== 'regular-box' || segment.boxType !== 'traf') {
|
|
175
162
|
throw new Error('Expected traf-box');
|
|
176
163
|
}
|
|
@@ -180,12 +167,10 @@ const getTfhdBox = (segment) => {
|
|
|
180
167
|
}
|
|
181
168
|
return tfhdBox;
|
|
182
169
|
};
|
|
183
|
-
|
|
184
|
-
const getTrunBoxes = (segment) => {
|
|
170
|
+
export const getTrunBoxes = (segment) => {
|
|
185
171
|
if (segment.type !== 'regular-box' || segment.boxType !== 'traf') {
|
|
186
172
|
throw new Error('Expected traf-box');
|
|
187
173
|
}
|
|
188
174
|
const trunBoxes = segment.children.filter((c) => c.type === 'trun-box');
|
|
189
175
|
return trunBoxes;
|
|
190
176
|
};
|
|
191
|
-
exports.getTrunBoxes = getTrunBoxes;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTrun = void 0;
|
|
4
|
-
const parseTrun = ({ iterator, offset, size, }) => {
|
|
1
|
+
export const parseTrun = ({ iterator, offset, size, }) => {
|
|
5
2
|
const version = iterator.getUint8();
|
|
6
3
|
if (version !== 0 && version !== 1) {
|
|
7
4
|
throw new Error(`Unsupported TRUN version ${version}`);
|
|
@@ -18,7 +15,7 @@ const parseTrun = ({ iterator, offset, size, }) => {
|
|
|
18
15
|
const sampleCompositionTimeOffset = flags & 0x800
|
|
19
16
|
? version === 0
|
|
20
17
|
? iterator.getUint32()
|
|
21
|
-
: iterator.
|
|
18
|
+
: iterator.getInt32()
|
|
22
19
|
: null;
|
|
23
20
|
samples.push({
|
|
24
21
|
sampleDuration,
|
|
@@ -41,4 +38,3 @@ const parseTrun = ({ iterator, offset, size, }) => {
|
|
|
41
38
|
samples,
|
|
42
39
|
};
|
|
43
40
|
};
|
|
44
|
-
exports.parseTrun = parseTrun;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import type { LogLevel } from '../../log';
|
|
2
|
+
import type { ReaderInterface } from '../../readers/reader';
|
|
1
3
|
import type { M3uState } from '../../state/m3u-state';
|
|
2
|
-
import type {
|
|
3
|
-
import type { SelectM3uStreamFn } from './select-stream';
|
|
4
|
+
import type { SelectM3uAssociatedPlaylistsFn, SelectM3uStreamFn } from './select-stream';
|
|
4
5
|
import type { M3uStructure } from './types';
|
|
5
|
-
export declare const afterManifestFetch: ({ structure, m3uState, src, selectM3uStreamFn, }: {
|
|
6
|
+
export declare const afterManifestFetch: ({ structure, m3uState, src, selectM3uStreamFn, logLevel, selectAssociatedPlaylistsFn, readerInterface, }: {
|
|
6
7
|
structure: M3uStructure;
|
|
7
8
|
m3uState: M3uState;
|
|
8
|
-
src: string
|
|
9
|
+
src: string;
|
|
9
10
|
selectM3uStreamFn: SelectM3uStreamFn;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
structure: M3uStructure;
|
|
11
|
+
selectAssociatedPlaylistsFn: SelectM3uAssociatedPlaylistsFn;
|
|
12
|
+
logLevel: LogLevel;
|
|
13
|
+
readerInterface: ReaderInterface;
|
|
14
14
|
}) => Promise<void>;
|