@remotion/media-parser 4.0.277 → 4.0.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aac-codecprivate.js +13 -6
- package/dist/add-avc-profile-to-track.js +9 -5
- package/dist/check-if-done.d.ts +2 -0
- package/dist/check-if-done.js +34 -0
- package/dist/combine-uint8-arrays.js +5 -1
- package/dist/containers/aac/parse-aac.js +27 -18
- 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.d.ts +1 -1
- package/dist/containers/flac/get-block-size.js +5 -1
- package/dist/containers/flac/get-channel-count.d.ts +2 -2
- 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.d.ts +1 -1
- package/dist/containers/flac/get-sample-rate.js +5 -1
- package/dist/containers/flac/parse-flac-frame.d.ts +1 -1
- package/dist/containers/flac/parse-flac-frame.js +33 -23
- package/dist/containers/flac/parse-flac.d.ts +1 -1
- package/dist/containers/flac/parse-flac.js +19 -15
- package/dist/containers/flac/parse-header.d.ts +1 -1
- package/dist/containers/flac/parse-header.js +5 -1
- package/dist/containers/flac/parse-metadata.d.ts +1 -1
- package/dist/containers/flac/parse-metadata.js +5 -1
- package/dist/containers/flac/parse-streaminfo.d.ts +1 -1
- package/dist/containers/flac/parse-streaminfo.js +7 -3
- package/dist/containers/flac/parse-unknown-block.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/containers/iso-base-media/esds/decoder-specific-config.js +5 -1
- package/dist/containers/iso-base-media/esds/esds-descriptors.d.ts +1 -1
- package/dist/containers/iso-base-media/esds/esds-descriptors.js +10 -5
- package/dist/containers/iso-base-media/esds/esds.d.ts +1 -1
- package/dist/containers/iso-base-media/esds/esds.js +7 -3
- package/dist/containers/iso-base-media/ftyp.d.ts +1 -1
- 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 +26 -16
- package/dist/containers/iso-base-media/get-sample-positions-from-track.js +24 -20
- package/dist/containers/iso-base-media/get-seeking-from-mp4.d.ts +5 -0
- package/dist/containers/iso-base-media/get-seeking-from-mp4.js +56 -0
- package/dist/containers/iso-base-media/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 +47 -34
- package/dist/containers/iso-base-media/mdhd.d.ts +1 -1
- package/dist/containers/iso-base-media/mdhd.js +5 -1
- package/dist/containers/iso-base-media/meta/hdlr.d.ts +1 -1
- package/dist/containers/iso-base-media/meta/hdlr.js +5 -1
- package/dist/containers/iso-base-media/meta/ilst.d.ts +1 -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.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/av1c.js +5 -1
- package/dist/containers/iso-base-media/stsd/avcc.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/avcc.js +5 -1
- package/dist/containers/iso-base-media/stsd/colr.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/colr.js +7 -3
- package/dist/containers/iso-base-media/stsd/ctts.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/ctts.js +5 -1
- package/dist/containers/iso-base-media/stsd/hvcc.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/hvcc.js +7 -3
- package/dist/containers/iso-base-media/stsd/keys.d.ts +1 -1
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stco.js +5 -1
- package/dist/containers/iso-base-media/stsd/stsc.d.ts +1 -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.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stss.js +5 -1
- package/dist/containers/iso-base-media/stsd/stsz.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stsz.js +5 -1
- package/dist/containers/iso-base-media/stsd/stts.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stts.js +5 -1
- package/dist/containers/iso-base-media/tfdt.d.ts +1 -1
- package/dist/containers/iso-base-media/tfdt.js +5 -1
- package/dist/containers/iso-base-media/tfhd.d.ts +1 -1
- package/dist/containers/iso-base-media/tfhd.js +5 -1
- package/dist/containers/iso-base-media/tkhd.d.ts +1 -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.d.ts +1 -1
- 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.d.ts +1 -1
- 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.d.ts +1 -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 +28 -19
- 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.d.ts +1 -1
- package/dist/containers/riff/is-movi.js +5 -1
- package/dist/containers/riff/parse-avih.d.ts +1 -1
- package/dist/containers/riff/parse-avih.js +5 -1
- package/dist/containers/riff/parse-isft.d.ts +1 -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 +45 -31
- 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.d.ts +1 -1
- package/dist/containers/riff/parse-strf.js +5 -1
- package/dist/containers/riff/parse-strh.d.ts +1 -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.d.ts +1 -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 +21 -12
- package/dist/containers/transport-stream/handle-avc-packet.js +31 -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.d.ts +1 -1
- package/dist/containers/transport-stream/parse-pat.js +10 -5
- package/dist/containers/transport-stream/parse-pes.d.ts +1 -1
- package/dist/containers/transport-stream/parse-pes.js +5 -1
- package/dist/containers/transport-stream/parse-pmt.d.ts +1 -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 +21 -12
- 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 +35 -17
- 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.d.ts +1 -1
- 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-all-info.d.ts +3 -0
- package/dist/emit-all-info.js +30 -0
- package/dist/emit-audio-sample.d.ts +12 -0
- package/dist/emit-audio-sample.js +14 -0
- package/dist/emit-available-info.d.ts +2 -7
- package/dist/emit-available-info.js +70 -63
- package/dist/emitter.js +5 -1
- package/dist/errors.js +15 -6
- package/dist/esm/index.mjs +1921 -1618
- package/dist/esm/worker-server-entry.mjs +840 -537
- package/dist/esm/worker-web-entry.mjs +840 -537
- package/dist/esm/worker.mjs +4 -5
- package/dist/fetch.js +17 -1
- package/dist/fields.d.ts +61 -0
- package/dist/fields.js +2 -0
- 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.d.ts +2 -1
- 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-seeking-info.d.ts +4 -0
- package/dist/get-seeking-info.js +22 -0
- package/dist/get-tracks.js +40 -29
- package/dist/get-video-codec.js +34 -26
- package/dist/has-all-info.d.ts +3 -5
- package/dist/has-all-info.js +39 -35
- package/dist/index.d.ts +53 -14
- package/dist/index.js +47 -32
- package/dist/init-video.d.ts +1 -4
- package/dist/init-video.js +29 -24
- package/dist/internal-parse-media.js +40 -199
- package/dist/is-audio-structure.js +5 -1
- package/dist/{buffer-iterator.d.ts → iterator/buffer-iterator.d.ts} +12 -15
- package/dist/{buffer-iterator.js → iterator/buffer-iterator.js} +16 -119
- package/dist/iterator/buffer-manager.d.ts +18 -0
- package/dist/iterator/buffer-manager.js +87 -0
- package/dist/iterator/offset-counter.d.ts +10 -0
- package/dist/iterator/offset-counter.js +31 -0
- package/dist/log.js +12 -8
- package/dist/make-hvc1-codec-strings.d.ts +1 -1
- package/dist/make-hvc1-codec-strings.js +5 -1
- package/dist/make-progress-object.d.ts +6 -0
- package/dist/make-progress-object.js +13 -0
- package/dist/media-parser-controller.d.ts +3 -0
- package/dist/media-parser-controller.js +15 -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.d.ts +1 -61
- package/dist/options.js +2 -1
- package/dist/parse-loop.d.ts +8 -0
- package/dist/parse-loop.js +93 -0
- package/dist/parse-media-on-worker-entry.d.ts +2 -1
- package/dist/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.d.ts +2 -7
- package/dist/perform-seek.js +29 -26
- package/dist/print-timings.d.ts +2 -0
- package/dist/print-timings.js +12 -0
- 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 +18 -9
- package/dist/remotion-license-acknowledge.js +8 -4
- package/dist/run-parse-iteration.d.ts +1 -4
- package/dist/run-parse-iteration.js +25 -24
- package/dist/samples-from-moof.js +10 -6
- package/dist/seek-backwards.d.ts +2 -0
- package/dist/seek-backwards.js +26 -0
- package/dist/seek-forwards.d.ts +2 -0
- package/dist/seek-forwards.js +28 -0
- package/dist/seek-signal.d.ts +22 -0
- package/dist/seek-signal.js +26 -0
- package/dist/seeking-info.d.ts +8 -0
- package/dist/seeking-info.js +2 -0
- package/dist/skip.js +5 -1
- package/dist/state/aac-state.js +5 -1
- package/dist/state/can-skip-tracks.d.ts +2 -2
- package/dist/state/can-skip-tracks.js +12 -4
- package/dist/state/emitted-fields.d.ts +1 -1
- package/dist/state/emitted-fields.js +5 -1
- package/dist/state/flac-state.js +5 -1
- package/dist/state/has-tracks-section.d.ts +2 -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.d.ts +1 -1
- package/dist/state/need-samples-for-fields.js +5 -1
- package/dist/state/parser-state.d.ts +38 -8
- package/dist/state/parser-state.js +59 -35
- package/dist/state/riff.js +5 -1
- package/dist/state/sample-callbacks.d.ts +8 -3
- package/dist/state/sample-callbacks.js +27 -10
- package/dist/state/slow-duration-fps.js +5 -1
- package/dist/state/structure.js +5 -1
- package/dist/state/timings.d.ts +8 -0
- package/dist/state/timings.js +13 -0
- package/dist/state/transport-stream.js +7 -3
- package/dist/state/video-section.d.ts +1 -1
- package/dist/state/video-section.js +5 -1
- package/dist/state/webm.d.ts +1 -1
- package/dist/state/webm.js +9 -5
- package/dist/throttled-progress.d.ts +2 -3
- 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/work-on-seek-request.d.ts +2 -0
- package/dist/work-on-seek-request.js +43 -0
- package/dist/worker/forward-controller.js +7 -3
- package/dist/worker/serialize-error.js +19 -14
- package/dist/worker/worker-types.d.ts +2 -1
- 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/writers/node.js +23 -16
- package/dist/writers/writer.js +2 -1
- package/package.json +10 -10
- package/dist/parse-media-on-server-worker.d.ts +0 -2
- package/dist/parse-media-on-server-worker.js +0 -4
- package/dist/parse-media-on-web-worker.d.ts +0 -2
- package/dist/parse-media-on-web-worker.js +0 -4
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expectRiffBox = void 0;
|
|
4
|
+
const register_track_1 = require("../../register-track");
|
|
5
|
+
const get_tracks_from_avi_1 = require("./get-tracks-from-avi");
|
|
6
|
+
const is_movi_1 = require("./is-movi");
|
|
7
|
+
const parse_riff_box_1 = require("./parse-riff-box");
|
|
8
|
+
const expectRiffBox = async (state) => {
|
|
6
9
|
const { iterator } = state;
|
|
7
10
|
// Need at least 16 bytes to read LIST,size,movi,size
|
|
8
11
|
if (state.iterator.bytesRemaining() < 16) {
|
|
@@ -11,7 +14,7 @@ export const expectRiffBox = async (state) => {
|
|
|
11
14
|
const checkpoint = iterator.startCheckpoint();
|
|
12
15
|
const ckId = iterator.getByteString(4, false);
|
|
13
16
|
const ckSize = iterator.getUint32Le();
|
|
14
|
-
if (isMoviAtom(iterator, ckId)) {
|
|
17
|
+
if ((0, is_movi_1.isMoviAtom)(iterator, ckId)) {
|
|
15
18
|
iterator.discard(4);
|
|
16
19
|
state.videoSection.setVideoSection({
|
|
17
20
|
start: iterator.counter.getOffset(),
|
|
@@ -23,30 +26,30 @@ export const expectRiffBox = async (state) => {
|
|
|
23
26
|
checkpoint.returnToCheckpoint();
|
|
24
27
|
return null;
|
|
25
28
|
}
|
|
26
|
-
const box = await parseRiffBox({
|
|
29
|
+
const box = await (0, parse_riff_box_1.parseRiffBox)({
|
|
27
30
|
id: ckId,
|
|
28
31
|
size: ckSize,
|
|
29
32
|
state,
|
|
30
33
|
});
|
|
31
34
|
if (box.type === 'strh-box') {
|
|
32
35
|
if (box.strf.type === 'strf-box-audio' && state.onAudioTrack) {
|
|
33
|
-
const audioTrack = makeAviAudioTrack({
|
|
36
|
+
const audioTrack = (0, get_tracks_from_avi_1.makeAviAudioTrack)({
|
|
34
37
|
index: state.riff.getNextTrackIndex(),
|
|
35
38
|
strf: box.strf,
|
|
36
39
|
});
|
|
37
|
-
await registerAudioTrack({
|
|
40
|
+
await (0, register_track_1.registerAudioTrack)({
|
|
38
41
|
state,
|
|
39
42
|
track: audioTrack,
|
|
40
43
|
container: 'avi',
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
if (state.onVideoTrack && box.strf.type === 'strf-box-video') {
|
|
44
|
-
const videoTrack = makeAviVideoTrack({
|
|
47
|
+
const videoTrack = (0, get_tracks_from_avi_1.makeAviVideoTrack)({
|
|
45
48
|
strh: box,
|
|
46
49
|
index: state.riff.getNextTrackIndex(),
|
|
47
50
|
strf: box.strf,
|
|
48
51
|
});
|
|
49
|
-
registerVideoTrackWhenProfileIsAvailable({
|
|
52
|
+
(0, register_track_1.registerVideoTrackWhenProfileIsAvailable)({
|
|
50
53
|
state,
|
|
51
54
|
track: videoTrack,
|
|
52
55
|
container: 'avi',
|
|
@@ -56,3 +59,4 @@ export const expectRiffBox = async (state) => {
|
|
|
56
59
|
}
|
|
57
60
|
return box;
|
|
58
61
|
};
|
|
62
|
+
exports.expectRiffBox = expectRiffBox;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSampleRateFromAvi = exports.getDurationFromAvi = void 0;
|
|
4
|
+
const traversal_1 = require("./traversal");
|
|
5
|
+
const getDurationFromAvi = (structure) => {
|
|
6
|
+
const strl = (0, traversal_1.getStrlBoxes)(structure);
|
|
4
7
|
const lengths = [];
|
|
5
8
|
for (const s of strl) {
|
|
6
|
-
const strh = getStrhBox(s.children);
|
|
9
|
+
const strh = (0, traversal_1.getStrhBox)(s.children);
|
|
7
10
|
if (!strh) {
|
|
8
11
|
throw new Error('No strh box');
|
|
9
12
|
}
|
|
@@ -13,10 +16,11 @@ export const getDurationFromAvi = (structure) => {
|
|
|
13
16
|
}
|
|
14
17
|
return Math.max(...lengths);
|
|
15
18
|
};
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
exports.getDurationFromAvi = getDurationFromAvi;
|
|
20
|
+
const getSampleRateFromAvi = (structure) => {
|
|
21
|
+
const strl = (0, traversal_1.getStrlBoxes)(structure);
|
|
18
22
|
for (const s of strl) {
|
|
19
|
-
const strh = getStrhBox(s.children);
|
|
23
|
+
const strh = (0, traversal_1.getStrhBox)(s.children);
|
|
20
24
|
if (!strh) {
|
|
21
25
|
throw new Error('No strh box');
|
|
22
26
|
}
|
|
@@ -26,3 +30,4 @@ export const getSampleRateFromAvi = (structure) => {
|
|
|
26
30
|
}
|
|
27
31
|
return null;
|
|
28
32
|
};
|
|
33
|
+
exports.getSampleRateFromAvi = getSampleRateFromAvi;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasAllTracksFromAvi = exports.getTracksFromAvi = exports.makeAviVideoTrack = exports.makeAviAudioTrack = exports.getNumberOfTracks = exports.TO_BE_OVERRIDDEN_LATER = void 0;
|
|
4
|
+
const add_avc_profile_to_track_1 = require("../../add-avc-profile-to-track");
|
|
5
|
+
const timescale_1 = require("./timescale");
|
|
6
|
+
const traversal_1 = require("./traversal");
|
|
7
|
+
exports.TO_BE_OVERRIDDEN_LATER = 'to-be-overriden-later';
|
|
8
|
+
const getNumberOfTracks = (structure) => {
|
|
9
|
+
const avihBox = (0, traversal_1.getAvihBox)(structure);
|
|
7
10
|
if (avihBox) {
|
|
8
11
|
return avihBox.streams;
|
|
9
12
|
}
|
|
10
13
|
throw new Error('No avih box found');
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
exports.getNumberOfTracks = getNumberOfTracks;
|
|
16
|
+
const makeAviAudioTrack = ({ strf, index, }) => {
|
|
13
17
|
// 255 = AAC
|
|
14
18
|
if (strf.formatTag !== 255) {
|
|
15
19
|
throw new Error(`Unsupported audio format ${strf.formatTag}`);
|
|
@@ -22,18 +26,19 @@ export const makeAviAudioTrack = ({ strf, index, }) => {
|
|
|
22
26
|
description: new Uint8Array([18, 16]),
|
|
23
27
|
numberOfChannels: strf.numberOfChannels,
|
|
24
28
|
sampleRate: strf.sampleRate,
|
|
25
|
-
timescale: MEDIA_PARSER_RIFF_TIMESCALE,
|
|
29
|
+
timescale: timescale_1.MEDIA_PARSER_RIFF_TIMESCALE,
|
|
26
30
|
trackId: index,
|
|
27
31
|
trakBox: null,
|
|
28
32
|
};
|
|
29
33
|
};
|
|
30
|
-
|
|
34
|
+
exports.makeAviAudioTrack = makeAviAudioTrack;
|
|
35
|
+
const makeAviVideoTrack = ({ strh, strf, index, }) => {
|
|
31
36
|
if (strh.handler !== 'H264') {
|
|
32
37
|
throw new Error(`Unsupported video codec ${strh.handler}`);
|
|
33
38
|
}
|
|
34
39
|
return {
|
|
35
40
|
codecPrivate: null,
|
|
36
|
-
codec: TO_BE_OVERRIDDEN_LATER,
|
|
41
|
+
codec: exports.TO_BE_OVERRIDDEN_LATER,
|
|
37
42
|
codecWithoutConfig: 'h264',
|
|
38
43
|
codedHeight: strf.height,
|
|
39
44
|
codedWidth: strf.width,
|
|
@@ -41,7 +46,7 @@ export const makeAviVideoTrack = ({ strh, strf, index, }) => {
|
|
|
41
46
|
height: strf.height,
|
|
42
47
|
type: 'video',
|
|
43
48
|
displayAspectHeight: strf.height,
|
|
44
|
-
timescale: MEDIA_PARSER_RIFF_TIMESCALE,
|
|
49
|
+
timescale: timescale_1.MEDIA_PARSER_RIFF_TIMESCALE,
|
|
45
50
|
description: undefined,
|
|
46
51
|
m3uStreamFormat: null,
|
|
47
52
|
trackId: index,
|
|
@@ -61,23 +66,24 @@ export const makeAviVideoTrack = ({ strh, strf, index, }) => {
|
|
|
61
66
|
fps: strh.rate / strh.scale,
|
|
62
67
|
};
|
|
63
68
|
};
|
|
64
|
-
|
|
69
|
+
exports.makeAviVideoTrack = makeAviVideoTrack;
|
|
70
|
+
const getTracksFromAvi = (structure, state) => {
|
|
65
71
|
const videoTracks = [];
|
|
66
72
|
const audioTracks = [];
|
|
67
73
|
const otherTracks = [];
|
|
68
|
-
const boxes = getStrlBoxes(structure);
|
|
74
|
+
const boxes = (0, traversal_1.getStrlBoxes)(structure);
|
|
69
75
|
let i = 0;
|
|
70
76
|
for (const box of boxes) {
|
|
71
|
-
const strh = getStrhBox(box.children);
|
|
77
|
+
const strh = (0, traversal_1.getStrhBox)(box.children);
|
|
72
78
|
if (!strh) {
|
|
73
79
|
continue;
|
|
74
80
|
}
|
|
75
81
|
const { strf } = strh;
|
|
76
82
|
if (strf.type === 'strf-box-video') {
|
|
77
|
-
videoTracks.push(addAvcProfileToTrack(makeAviVideoTrack({ strh, strf, index: i }), state.riff.getAvcProfile()));
|
|
83
|
+
videoTracks.push((0, add_avc_profile_to_track_1.addAvcProfileToTrack)((0, exports.makeAviVideoTrack)({ strh, strf, index: i }), state.riff.getAvcProfile()));
|
|
78
84
|
}
|
|
79
85
|
else if (strh.fccType === 'auds') {
|
|
80
|
-
audioTracks.push(makeAviAudioTrack({ strf, index: i }));
|
|
86
|
+
audioTracks.push((0, exports.makeAviAudioTrack)({ strf, index: i }));
|
|
81
87
|
}
|
|
82
88
|
else {
|
|
83
89
|
throw new Error(`Unsupported track type ${strh.fccType}`);
|
|
@@ -86,18 +92,20 @@ export const getTracksFromAvi = (structure, state) => {
|
|
|
86
92
|
}
|
|
87
93
|
return { audioTracks, otherTracks, videoTracks };
|
|
88
94
|
};
|
|
89
|
-
|
|
95
|
+
exports.getTracksFromAvi = getTracksFromAvi;
|
|
96
|
+
const hasAllTracksFromAvi = (state) => {
|
|
90
97
|
try {
|
|
91
98
|
const structure = state.getRiffStructure();
|
|
92
|
-
const numberOfTracks = getNumberOfTracks(structure);
|
|
93
|
-
const tracks = getTracksFromAvi(structure, state);
|
|
99
|
+
const numberOfTracks = (0, exports.getNumberOfTracks)(structure);
|
|
100
|
+
const tracks = (0, exports.getTracksFromAvi)(structure, state);
|
|
94
101
|
return (tracks.videoTracks.length +
|
|
95
102
|
tracks.audioTracks.length +
|
|
96
103
|
tracks.otherTracks.length ===
|
|
97
104
|
numberOfTracks &&
|
|
98
|
-
!tracks.videoTracks.find((t) => t.codec === TO_BE_OVERRIDDEN_LATER));
|
|
105
|
+
!tracks.videoTracks.find((t) => t.codec === exports.TO_BE_OVERRIDDEN_LATER));
|
|
99
106
|
}
|
|
100
107
|
catch (_a) {
|
|
101
108
|
return false;
|
|
102
109
|
}
|
|
103
110
|
};
|
|
111
|
+
exports.hasAllTracksFromAvi = hasAllTracksFromAvi;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../buffer-iterator';
|
|
1
|
+
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
2
|
export declare const isMoviAtom: (iterator: BufferIterator, ckId: string) => boolean;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMoviAtom = void 0;
|
|
4
|
+
const isMoviAtom = (iterator, ckId) => {
|
|
2
5
|
if (ckId !== 'LIST') {
|
|
3
6
|
return false;
|
|
4
7
|
}
|
|
@@ -6,3 +9,4 @@ export const isMoviAtom = (iterator, ckId) => {
|
|
|
6
9
|
iterator.counter.decrement(4);
|
|
7
10
|
return listType === 'movi';
|
|
8
11
|
};
|
|
12
|
+
exports.isMoviAtom = isMoviAtom;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAvih = void 0;
|
|
4
|
+
const parseAvih = ({ iterator, size, }) => {
|
|
2
5
|
const { expectNoMoreBytes } = iterator.startBox(size);
|
|
3
6
|
const dwMicroSecPerFrame = iterator.getUint32Le();
|
|
4
7
|
const dwMaxBytesPerSec = iterator.getUint32Le();
|
|
@@ -26,3 +29,4 @@ export const parseAvih = ({ iterator, size, }) => {
|
|
|
26
29
|
width,
|
|
27
30
|
};
|
|
28
31
|
};
|
|
32
|
+
exports.parseAvih = parseAvih;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseIsft = void 0;
|
|
4
|
+
const parseIsft = ({ iterator, size, }) => {
|
|
2
5
|
const { expectNoMoreBytes } = iterator.startBox(size);
|
|
3
6
|
const software = iterator.getByteString(size - 1, false);
|
|
4
7
|
const last = iterator.getUint8();
|
|
@@ -11,3 +14,4 @@ export const parseIsft = ({ iterator, size, }) => {
|
|
|
11
14
|
software,
|
|
12
15
|
};
|
|
13
16
|
};
|
|
17
|
+
exports.parseIsft = parseIsft;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseListBox = void 0;
|
|
4
|
+
const expect_riff_box_1 = require("./expect-riff-box");
|
|
5
|
+
const parseListBox = async ({ size, state, }) => {
|
|
3
6
|
const { iterator } = state;
|
|
4
7
|
const counter = iterator.counter.getOffset();
|
|
5
8
|
const listType = iterator.getByteString(4, false);
|
|
@@ -9,7 +12,7 @@ export const parseListBox = async ({ size, state, }) => {
|
|
|
9
12
|
const boxes = [];
|
|
10
13
|
const maxOffset = counter + size;
|
|
11
14
|
while (iterator.counter.getOffset() < maxOffset) {
|
|
12
|
-
const box = await expectRiffBox(state);
|
|
15
|
+
const box = await (0, expect_riff_box_1.expectRiffBox)(state);
|
|
13
16
|
if (box === null) {
|
|
14
17
|
throw new Error('Unexpected result');
|
|
15
18
|
}
|
|
@@ -21,3 +24,4 @@ export const parseListBox = async ({ size, state, }) => {
|
|
|
21
24
|
children: boxes,
|
|
22
25
|
};
|
|
23
26
|
};
|
|
27
|
+
exports.parseListBox = parseListBox;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMovi = exports.handleChunk = void 0;
|
|
4
|
+
const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
|
|
5
|
+
const emit_audio_sample_1 = require("../../emit-audio-sample");
|
|
6
|
+
const key_1 = require("../avc/key");
|
|
7
|
+
const parse_avc_1 = require("../avc/parse-avc");
|
|
8
|
+
const traversal_1 = require("./traversal");
|
|
5
9
|
const getStrhForIndex = (structure, trackId) => {
|
|
6
|
-
const boxes = getStrlBoxes(structure);
|
|
10
|
+
const boxes = (0, traversal_1.getStrlBoxes)(structure);
|
|
7
11
|
const box = boxes[trackId];
|
|
8
12
|
if (!box) {
|
|
9
13
|
throw new Error('Expected box');
|
|
10
14
|
}
|
|
11
|
-
const strh = getStrhBox(box.children);
|
|
15
|
+
const strh = (0, traversal_1.getStrhBox)(box.children);
|
|
12
16
|
if (!strh) {
|
|
13
17
|
throw new Error('strh');
|
|
14
18
|
}
|
|
15
19
|
return strh;
|
|
16
20
|
};
|
|
17
|
-
|
|
21
|
+
const handleChunk = async ({ state, ckId, ckSize, }) => {
|
|
18
22
|
const { iterator } = state;
|
|
19
23
|
const offset = iterator.counter.getOffset();
|
|
20
24
|
const videoChunk = ckId.match(/^([0-9]{2})dc$/);
|
|
@@ -26,8 +30,8 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
|
|
|
26
30
|
const timeInSec = nthSample / samplesPerSecond;
|
|
27
31
|
const timestamp = timeInSec;
|
|
28
32
|
const data = iterator.getSlice(ckSize);
|
|
29
|
-
const infos = parseAvc(data);
|
|
30
|
-
const keyOrDelta = getKeyFrameOrDeltaFromAvcInfo(infos);
|
|
33
|
+
const infos = (0, parse_avc_1.parseAvc)(data);
|
|
34
|
+
const keyOrDelta = (0, key_1.getKeyFrameOrDeltaFromAvcInfo)(infos);
|
|
31
35
|
const avcProfile = infos.find((i) => i.type === 'avc-profile');
|
|
32
36
|
const ppsProfile = infos.find((i) => i.type === 'avc-pps');
|
|
33
37
|
if (avcProfile && ppsProfile && !state.riff.getAvcProfile()) {
|
|
@@ -37,17 +41,21 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
|
|
|
37
41
|
// We must also NOT pass a duration because if the the next sample is 0,
|
|
38
42
|
// this sample would be longer. Chrome will pad it with silence.
|
|
39
43
|
// If we'd pass a duration instead, it would shift the audio and we think that audio is not finished
|
|
40
|
-
await
|
|
41
|
-
cts: timestamp,
|
|
42
|
-
dts: timestamp,
|
|
43
|
-
data,
|
|
44
|
-
duration: undefined,
|
|
45
|
-
timestamp,
|
|
44
|
+
await (0, emit_audio_sample_1.emitVideoSample)({
|
|
46
45
|
trackId,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
videoSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
47
|
+
cts: timestamp,
|
|
48
|
+
dts: timestamp,
|
|
49
|
+
data,
|
|
50
|
+
duration: undefined,
|
|
51
|
+
timestamp,
|
|
52
|
+
trackId,
|
|
53
|
+
type: keyOrDelta,
|
|
54
|
+
offset,
|
|
55
|
+
timescale: samplesPerSecond,
|
|
56
|
+
}, 1),
|
|
57
|
+
state,
|
|
58
|
+
});
|
|
51
59
|
return;
|
|
52
60
|
}
|
|
53
61
|
const audioChunk = ckId.match(/^([0-9]{2})wb$/);
|
|
@@ -64,20 +72,25 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
|
|
|
64
72
|
// We must also NOT pass a duration because if the the next sample is 0,
|
|
65
73
|
// this sample would be longer. Chrome will pad it with silence.
|
|
66
74
|
// If we'd pass a duration instead, it would shift the audio and we think that audio is not finished
|
|
67
|
-
await
|
|
68
|
-
cts: timestamp,
|
|
69
|
-
dts: timestamp,
|
|
70
|
-
data,
|
|
71
|
-
duration: undefined,
|
|
72
|
-
timestamp,
|
|
75
|
+
await (0, emit_audio_sample_1.emitAudioSample)({
|
|
73
76
|
trackId,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
audioSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
|
|
78
|
+
cts: timestamp,
|
|
79
|
+
dts: timestamp,
|
|
80
|
+
data,
|
|
81
|
+
duration: undefined,
|
|
82
|
+
timestamp,
|
|
83
|
+
trackId,
|
|
84
|
+
type: 'key',
|
|
85
|
+
offset,
|
|
86
|
+
timescale: samplesPerSecond,
|
|
87
|
+
}, 1),
|
|
88
|
+
state,
|
|
89
|
+
});
|
|
78
90
|
}
|
|
79
91
|
};
|
|
80
|
-
|
|
92
|
+
exports.handleChunk = handleChunk;
|
|
93
|
+
const parseMovi = async ({ state, }) => {
|
|
81
94
|
const { iterator } = state;
|
|
82
95
|
if (iterator.bytesRemaining() < 8) {
|
|
83
96
|
return Promise.resolve();
|
|
@@ -89,7 +102,7 @@ export const parseMovi = async ({ state, }) => {
|
|
|
89
102
|
checkpoint.returnToCheckpoint();
|
|
90
103
|
return Promise.resolve();
|
|
91
104
|
}
|
|
92
|
-
await handleChunk({ state, ckId, ckSize });
|
|
105
|
+
await (0, exports.handleChunk)({ state, ckId, ckSize });
|
|
93
106
|
const videoSection = state.videoSection.getVideoSection();
|
|
94
107
|
const maxOffset = videoSection.start + videoSection.size;
|
|
95
108
|
// Discard added zeroes
|
|
@@ -101,3 +114,4 @@ export const parseMovi = async ({ state, }) => {
|
|
|
101
114
|
}
|
|
102
115
|
}
|
|
103
116
|
};
|
|
117
|
+
exports.parseMovi = parseMovi;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRiffBody = void 0;
|
|
4
|
+
const skip_1 = require("../../skip");
|
|
5
|
+
const may_skip_video_data_1 = require("../../state/may-skip-video-data");
|
|
6
|
+
const expect_riff_box_1 = require("./expect-riff-box");
|
|
7
|
+
const parse_video_section_1 = require("./parse-video-section");
|
|
8
|
+
const parseRiffBody = async (state) => {
|
|
6
9
|
if (state.videoSection.isInVideoSectionState(state.iterator) === 'in-section') {
|
|
7
|
-
if (maySkipVideoData({
|
|
10
|
+
if ((0, may_skip_video_data_1.maySkipVideoData)({
|
|
8
11
|
state,
|
|
9
12
|
}) &&
|
|
10
13
|
state.riff.getAvcProfile()) {
|
|
11
14
|
const videoSection = state.videoSection.getVideoSection();
|
|
12
15
|
// only skipping forward in query mode
|
|
13
|
-
return Promise.resolve(makeSkip(videoSection.start + videoSection.size));
|
|
16
|
+
return Promise.resolve((0, skip_1.makeSkip)(videoSection.start + videoSection.size));
|
|
14
17
|
}
|
|
15
|
-
await parseVideoSection(state);
|
|
18
|
+
await (0, parse_video_section_1.parseVideoSection)(state);
|
|
16
19
|
return null;
|
|
17
20
|
}
|
|
18
|
-
const box = await expectRiffBox(state);
|
|
21
|
+
const box = await (0, expect_riff_box_1.expectRiffBox)(state);
|
|
19
22
|
if (box !== null) {
|
|
20
23
|
const structure = state.getRiffStructure();
|
|
21
24
|
structure.boxes.push(box);
|
|
22
25
|
}
|
|
23
26
|
return null;
|
|
24
27
|
};
|
|
28
|
+
exports.parseRiffBody = parseRiffBody;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRiffBox = void 0;
|
|
4
|
+
const parse_avih_1 = require("./parse-avih");
|
|
5
|
+
const parse_isft_1 = require("./parse-isft");
|
|
6
|
+
const parse_list_box_1 = require("./parse-list-box");
|
|
7
|
+
const parse_strh_1 = require("./parse-strh");
|
|
8
|
+
const parseRiffBox = ({ size, id, state, }) => {
|
|
6
9
|
const { iterator } = state;
|
|
7
10
|
if (id === 'LIST') {
|
|
8
|
-
return parseListBox({ size, state });
|
|
11
|
+
return (0, parse_list_box_1.parseListBox)({ size, state });
|
|
9
12
|
}
|
|
10
13
|
if (id === 'ISFT') {
|
|
11
|
-
return Promise.resolve(parseIsft({ iterator, size }));
|
|
14
|
+
return Promise.resolve((0, parse_isft_1.parseIsft)({ iterator, size }));
|
|
12
15
|
}
|
|
13
16
|
if (id === 'avih') {
|
|
14
|
-
return Promise.resolve(parseAvih({ iterator, size }));
|
|
17
|
+
return Promise.resolve((0, parse_avih_1.parseAvih)({ iterator, size }));
|
|
15
18
|
}
|
|
16
19
|
if (id === 'strh') {
|
|
17
|
-
return Promise.resolve(parseStrh({ iterator, size }));
|
|
20
|
+
return Promise.resolve((0, parse_strh_1.parseStrh)({ iterator, size }));
|
|
18
21
|
}
|
|
19
22
|
iterator.discard(size);
|
|
20
23
|
const box = {
|
|
@@ -24,3 +27,4 @@ export const parseRiffBox = ({ size, id, state, }) => {
|
|
|
24
27
|
};
|
|
25
28
|
return Promise.resolve(box);
|
|
26
29
|
};
|
|
30
|
+
exports.parseRiffBox = parseRiffBox;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRiffHeader = void 0;
|
|
4
|
+
const parseRiffHeader = (state) => {
|
|
2
5
|
const riff = state.iterator.getByteString(4, false);
|
|
3
6
|
if (riff !== 'RIFF') {
|
|
4
7
|
throw new Error('Not a RIFF file');
|
|
@@ -12,3 +15,4 @@ export const parseRiffHeader = (state) => {
|
|
|
12
15
|
structure.boxes.push({ type: 'riff-header', fileSize: size, fileType });
|
|
13
16
|
return null;
|
|
14
17
|
};
|
|
18
|
+
exports.parseRiffHeader = parseRiffHeader;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRiff = void 0;
|
|
4
|
+
const parse_riff_body_1 = require("./parse-riff-body");
|
|
5
|
+
const parse_riff_header_1 = require("./parse-riff-header");
|
|
6
|
+
const parseRiff = (state) => {
|
|
4
7
|
if (state.iterator.counter.getOffset() === 0) {
|
|
5
|
-
return Promise.resolve(parseRiffHeader(state));
|
|
8
|
+
return Promise.resolve((0, parse_riff_header_1.parseRiffHeader)(state));
|
|
6
9
|
}
|
|
7
|
-
return parseRiffBody(state);
|
|
10
|
+
return (0, parse_riff_body_1.parseRiffBody)(state);
|
|
8
11
|
};
|
|
12
|
+
exports.parseRiff = parseRiff;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../buffer-iterator';
|
|
1
|
+
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
2
|
import type { FccType, StrfBoxAudio, StrfBoxVideo } from './riff-box';
|
|
3
3
|
export declare const parseStrf: ({ iterator, size, fccType, }: {
|
|
4
4
|
iterator: BufferIterator;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseStrf = void 0;
|
|
1
4
|
const parseStrfAudio = ({ iterator, size, }) => {
|
|
2
5
|
const box = iterator.startBox(size);
|
|
3
6
|
const formatTag = iterator.getUint16Le();
|
|
@@ -48,7 +51,7 @@ const parseStrfVideo = ({ iterator, size, }) => {
|
|
|
48
51
|
yPelsPerMeter,
|
|
49
52
|
};
|
|
50
53
|
};
|
|
51
|
-
|
|
54
|
+
const parseStrf = ({ iterator, size, fccType, }) => {
|
|
52
55
|
if (fccType === 'vids') {
|
|
53
56
|
return parseStrfVideo({ iterator, size });
|
|
54
57
|
}
|
|
@@ -57,3 +60,4 @@ export const parseStrf = ({ iterator, size, fccType, }) => {
|
|
|
57
60
|
}
|
|
58
61
|
throw new Error(`Unsupported fccType: ${fccType}`);
|
|
59
62
|
};
|
|
63
|
+
exports.parseStrf = parseStrf;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseStrh = void 0;
|
|
4
|
+
const parse_strf_1 = require("./parse-strf");
|
|
5
|
+
const parseStrh = ({ iterator, size, }) => {
|
|
3
6
|
const box = iterator.startBox(size);
|
|
4
7
|
const fccType = iterator.getByteString(4, false);
|
|
5
8
|
if (fccType !== 'vids' && fccType !== 'auds') {
|
|
@@ -34,7 +37,7 @@ export const parseStrh = ({ iterator, size, }) => {
|
|
|
34
37
|
if (iterator.bytesRemaining() < ckSize) {
|
|
35
38
|
throw new Error('Expected strf to be complete');
|
|
36
39
|
}
|
|
37
|
-
const strf = parseStrf({ iterator, size: ckSize, fccType });
|
|
40
|
+
const strf = (0, parse_strf_1.parseStrf)({ iterator, size: ckSize, fccType });
|
|
38
41
|
return {
|
|
39
42
|
type: 'strh-box',
|
|
40
43
|
fccType,
|
|
@@ -53,3 +56,4 @@ export const parseStrh = ({ iterator, size, }) => {
|
|
|
53
56
|
strf,
|
|
54
57
|
};
|
|
55
58
|
};
|
|
59
|
+
exports.parseStrh = parseStrh;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseVideoSection = void 0;
|
|
4
|
+
const get_tracks_1 = require("../../get-tracks");
|
|
5
|
+
const get_tracks_from_avi_1 = require("./get-tracks-from-avi");
|
|
6
|
+
const parse_movi_1 = require("./parse-movi");
|
|
7
|
+
const parseVideoSection = async (state) => {
|
|
8
|
+
await (0, parse_movi_1.parseMovi)({
|
|
6
9
|
state,
|
|
7
10
|
});
|
|
8
|
-
const tracks = getTracks(state);
|
|
9
|
-
if (!tracks.videoTracks.some((t) => t.codec === TO_BE_OVERRIDDEN_LATER) &&
|
|
11
|
+
const tracks = (0, get_tracks_1.getTracks)(state);
|
|
12
|
+
if (!tracks.videoTracks.some((t) => t.codec === get_tracks_from_avi_1.TO_BE_OVERRIDDEN_LATER) &&
|
|
10
13
|
!state.callbacks.tracks.getIsDone()) {
|
|
11
14
|
state.callbacks.tracks.setIsDone(state.logLevel);
|
|
12
15
|
}
|
|
13
16
|
};
|
|
17
|
+
exports.parseVideoSection = parseVideoSection;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|