@remotion/media-parser 4.0.270 → 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.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 +21 -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 +5 -3
- package/dist/containers/m3u/after-manifest-fetch.js +13 -17
- package/dist/containers/m3u/fetch-m3u8-stream.d.ts +5 -1
- 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.js +4 -8
- package/dist/containers/m3u/get-playlist.js +6 -12
- package/dist/containers/m3u/get-streams.d.ts +11 -5
- package/dist/containers/m3u/get-streams.js +5 -15
- 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/parse-directive.js +10 -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 +13 -13
- 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 +1 -1
- package/dist/containers/m3u/return-packets.js +14 -5
- package/dist/containers/m3u/run-over-m3u.js +10 -13
- package/dist/containers/m3u/sample-sorter.js +4 -8
- package/dist/containers/m3u/select-stream.d.ts +3 -2
- package/dist/containers/m3u/select-stream.js +9 -13
- package/dist/containers/m3u/types.d.ts +1 -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 +1 -5
- 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 -47
- 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 +679 -175
- 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 +15 -11
- package/dist/index.js +34 -48
- package/dist/init-video.d.ts +1 -1
- package/dist/init-video.js +47 -20
- package/dist/internal-parse-media.js +36 -40
- 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 +30 -24
- 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 -13
- 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 +3 -0
- package/dist/state/m3u-state.js +16 -11
- 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 +12 -10
- package/dist/state/parser-state.js +36 -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 +1 -5
- 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,55 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const transport_stream_1 = require("./transport-stream");
|
|
20
|
-
const video_section_1 = require("./video-section");
|
|
21
|
-
const webm_1 = require("./webm");
|
|
22
|
-
const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, controller, fields, onAudioTrack, onVideoTrack, contentLength, logLevel, mode, src, readerInterface, onDiscardedData, selectM3uStreamFn, selectM3uAssociatedPlaylistsFn, }) => {
|
|
1
|
+
import { getArrayBufferIterator } from '../buffer-iterator';
|
|
2
|
+
import { Log } from '../log';
|
|
3
|
+
import { aacState } from './aac-state';
|
|
4
|
+
import { emittedState } from './emitted-fields';
|
|
5
|
+
import { flacState } from './flac-state';
|
|
6
|
+
import { imagesState } from './images';
|
|
7
|
+
import { isoBaseMediaState } from './iso-base-media/iso-state';
|
|
8
|
+
import { keyframesState } from './keyframes';
|
|
9
|
+
import { m3uState } from './m3u-state';
|
|
10
|
+
import { makeMp3State } from './mp3';
|
|
11
|
+
import { riffSpecificState } from './riff';
|
|
12
|
+
import { sampleCallback } from './sample-callbacks';
|
|
13
|
+
import { slowDurationAndFpsState } from './slow-duration-fps';
|
|
14
|
+
import { structureState } from './structure';
|
|
15
|
+
import { transportStreamState } from './transport-stream';
|
|
16
|
+
import { videoSectionState } from './video-section';
|
|
17
|
+
import { webmState } from './webm';
|
|
18
|
+
export const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, controller, fields, onAudioTrack, onVideoTrack, contentLength, logLevel, mode, src, readerInterface, onDiscardedData, selectM3uStreamFn, selectM3uAssociatedPlaylistsFn, mp4HeaderSegment, }) => {
|
|
23
19
|
let skippedBytes = 0;
|
|
24
|
-
const iterator =
|
|
20
|
+
const iterator = getArrayBufferIterator(new Uint8Array([]), contentLength);
|
|
25
21
|
const increaseSkippedBytes = (bytes) => {
|
|
26
22
|
skippedBytes += bytes;
|
|
27
23
|
};
|
|
28
|
-
const structure =
|
|
29
|
-
const keyframes =
|
|
30
|
-
const emittedFields =
|
|
31
|
-
const slowDurationAndFps =
|
|
32
|
-
const mp3Info =
|
|
33
|
-
const images =
|
|
24
|
+
const structure = structureState();
|
|
25
|
+
const keyframes = keyframesState();
|
|
26
|
+
const emittedFields = emittedState();
|
|
27
|
+
const slowDurationAndFps = slowDurationAndFpsState();
|
|
28
|
+
const mp3Info = makeMp3State();
|
|
29
|
+
const images = imagesState();
|
|
34
30
|
const discardReadBytes = async (force) => {
|
|
35
31
|
const { bytesRemoved, removedData } = iterator.removeBytesRead(force, mode);
|
|
36
32
|
if (bytesRemoved) {
|
|
37
|
-
|
|
33
|
+
Log.verbose(logLevel, `Freed ${bytesRemoved} bytes`);
|
|
38
34
|
}
|
|
39
35
|
if (removedData && onDiscardedData) {
|
|
40
36
|
await onDiscardedData(removedData);
|
|
41
37
|
}
|
|
42
38
|
};
|
|
43
39
|
return {
|
|
44
|
-
riff:
|
|
45
|
-
transportStream:
|
|
46
|
-
webm:
|
|
47
|
-
iso:
|
|
40
|
+
riff: riffSpecificState(),
|
|
41
|
+
transportStream: transportStreamState(),
|
|
42
|
+
webm: webmState(),
|
|
43
|
+
iso: isoBaseMediaState(),
|
|
48
44
|
mp3Info,
|
|
49
|
-
aac:
|
|
50
|
-
flac:
|
|
51
|
-
m3u:
|
|
52
|
-
callbacks:
|
|
45
|
+
aac: aacState(),
|
|
46
|
+
flac: flacState(),
|
|
47
|
+
m3u: m3uState(logLevel),
|
|
48
|
+
callbacks: sampleCallback({
|
|
53
49
|
controller,
|
|
54
50
|
hasAudioTrackHandlers,
|
|
55
51
|
hasVideoTrackHandlers,
|
|
@@ -77,17 +73,16 @@ const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, control
|
|
|
77
73
|
slowDurationAndFps,
|
|
78
74
|
contentLength,
|
|
79
75
|
images,
|
|
80
|
-
videoSection:
|
|
76
|
+
videoSection: videoSectionState(),
|
|
81
77
|
logLevel,
|
|
82
78
|
iterator,
|
|
83
79
|
controller,
|
|
84
80
|
mode,
|
|
85
|
-
eventLoop: (0, last_eventloop_break_1.eventLoopState)(logLevel),
|
|
86
81
|
src,
|
|
87
82
|
readerInterface,
|
|
88
83
|
discardReadBytes,
|
|
89
84
|
selectM3uStreamFn,
|
|
90
85
|
selectM3uAssociatedPlaylistsFn,
|
|
86
|
+
mp4HeaderSegment,
|
|
91
87
|
};
|
|
92
88
|
};
|
|
93
|
-
exports.makeParserState = makeParserState;
|
package/dist/state/riff.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.riffSpecificState = void 0;
|
|
4
|
-
const riffSpecificState = () => {
|
|
1
|
+
export const riffSpecificState = () => {
|
|
5
2
|
let avcProfile = null;
|
|
6
3
|
let nextTrackIndex = 0;
|
|
7
4
|
const profileCallbacks = [];
|
|
@@ -29,4 +26,3 @@ const riffSpecificState = () => {
|
|
|
29
26
|
},
|
|
30
27
|
};
|
|
31
28
|
};
|
|
32
|
-
exports.riffSpecificState = riffSpecificState;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const has_tracks_section_1 = require("./has-tracks-section");
|
|
6
|
-
const need_samples_for_fields_1 = require("./need-samples-for-fields");
|
|
7
|
-
const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, slowDurationAndFpsState, structure, }) => {
|
|
1
|
+
import { makeCanSkipTracksState } from './can-skip-tracks';
|
|
2
|
+
import { makeTracksSectionState } from './has-tracks-section';
|
|
3
|
+
import { needsToIterateOverSamples } from './need-samples-for-fields';
|
|
4
|
+
export const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, slowDurationAndFpsState, structure, }) => {
|
|
8
5
|
const videoSampleCallbacks = {};
|
|
9
6
|
const audioSampleCallbacks = {};
|
|
10
7
|
const queuedAudioSamples = {};
|
|
11
8
|
const queuedVideoSamples = {};
|
|
12
|
-
const canSkipTracksState =
|
|
9
|
+
const canSkipTracksState = makeCanSkipTracksState({
|
|
13
10
|
hasAudioTrackHandlers,
|
|
14
11
|
fields,
|
|
15
12
|
hasVideoTrackHandlers,
|
|
16
13
|
structure,
|
|
17
14
|
});
|
|
18
|
-
const tracksState =
|
|
15
|
+
const tracksState = makeTracksSectionState(canSkipTracksState);
|
|
19
16
|
const samplesForTrack = {};
|
|
20
17
|
return {
|
|
21
18
|
registerVideoSampleCallback: async (id, callback) => {
|
|
@@ -45,7 +42,7 @@ const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandle
|
|
|
45
42
|
await callback(audioSample);
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
if (
|
|
45
|
+
if (needsToIterateOverSamples({ emittedFields, fields })) {
|
|
49
46
|
slowDurationAndFpsState.addAudioSample(audioSample);
|
|
50
47
|
}
|
|
51
48
|
},
|
|
@@ -68,7 +65,7 @@ const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandle
|
|
|
68
65
|
await callback(videoSample);
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
if (
|
|
68
|
+
if (needsToIterateOverSamples({
|
|
72
69
|
fields,
|
|
73
70
|
emittedFields,
|
|
74
71
|
})) {
|
|
@@ -104,4 +101,3 @@ const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandle
|
|
|
104
101
|
hasVideoTrackHandlers,
|
|
105
102
|
};
|
|
106
103
|
};
|
|
107
|
-
exports.sampleCallback = sampleCallback;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slowDurationAndFpsState = void 0;
|
|
4
|
-
const slowDurationAndFpsState = () => {
|
|
1
|
+
export const slowDurationAndFpsState = () => {
|
|
5
2
|
let smallestVideoSample;
|
|
6
3
|
let largestVideoSample;
|
|
7
4
|
let smallestAudioSample;
|
|
@@ -85,4 +82,3 @@ const slowDurationAndFpsState = () => {
|
|
|
85
82
|
},
|
|
86
83
|
};
|
|
87
84
|
};
|
|
88
|
-
exports.slowDurationAndFpsState = slowDurationAndFpsState;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MediaParserStructureUnstable } from '../parse-result';
|
|
2
2
|
export declare const structureState: () => {
|
|
3
|
-
getStructureOrNull: () =>
|
|
4
|
-
getStructure: () =>
|
|
5
|
-
setStructure: (value:
|
|
3
|
+
getStructureOrNull: () => MediaParserStructureUnstable | null;
|
|
4
|
+
getStructure: () => MediaParserStructureUnstable;
|
|
5
|
+
setStructure: (value: MediaParserStructureUnstable) => void;
|
|
6
6
|
getFlacStructure: () => import("../containers/flac/types").FlacStructure;
|
|
7
7
|
getIsoStructure: () => import("../parse-result").IsoBaseMediaStructure;
|
|
8
8
|
getMp3Structure: () => import("../parse-result").Mp3Structure;
|
package/dist/state/structure.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.structureState = void 0;
|
|
4
|
-
const structureState = () => {
|
|
1
|
+
export const structureState = () => {
|
|
5
2
|
let structure = null;
|
|
6
3
|
const getStructure = () => {
|
|
7
4
|
if (structure === null) {
|
|
@@ -75,4 +72,3 @@ const structureState = () => {
|
|
|
75
72
|
},
|
|
76
73
|
};
|
|
77
74
|
};
|
|
78
|
-
exports.structureState = structureState;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.transportStreamState = void 0;
|
|
4
|
-
const next_pes_header_store_1 = require("../containers/transport-stream/next-pes-header-store");
|
|
5
|
-
const transportStreamState = () => {
|
|
1
|
+
import { makeNextPesHeaderStore } from '../containers/transport-stream/next-pes-header-store';
|
|
2
|
+
export const transportStreamState = () => {
|
|
6
3
|
return {
|
|
7
|
-
nextPesHeaderStore:
|
|
4
|
+
nextPesHeaderStore: makeNextPesHeaderStore(),
|
|
8
5
|
streamBuffers: new Map(),
|
|
9
6
|
};
|
|
10
7
|
};
|
|
11
|
-
exports.transportStreamState = transportStreamState;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Keeps track of in which section of the file the video is playing
|
|
4
3
|
* Usually this section is in a different format and it is the only section
|
|
5
4
|
* that can be read partially
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
exports.videoSectionState = void 0;
|
|
9
|
-
const videoSectionState = () => {
|
|
6
|
+
export const videoSectionState = () => {
|
|
10
7
|
let videoSection = null;
|
|
11
8
|
const setVideoSection = (section) => {
|
|
12
9
|
videoSection = section;
|
|
@@ -34,4 +31,3 @@ const videoSectionState = () => {
|
|
|
34
31
|
isInVideoSectionState,
|
|
35
32
|
};
|
|
36
33
|
};
|
|
37
|
-
exports.videoSectionState = videoSectionState;
|
package/dist/state/webm.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.webmState = void 0;
|
|
4
|
-
const traversal_1 = require("../containers/webm/traversal");
|
|
5
|
-
const webmState = () => {
|
|
1
|
+
import { getTrackCodec, getTrackId, getTrackTimestampScale, } from '../containers/webm/traversal';
|
|
2
|
+
export const webmState = () => {
|
|
6
3
|
const trackEntries = {};
|
|
7
4
|
const onTrackEntrySegment = (trackEntry) => {
|
|
8
5
|
var _a;
|
|
9
|
-
const trackId =
|
|
6
|
+
const trackId = getTrackId(trackEntry);
|
|
10
7
|
if (!trackId) {
|
|
11
8
|
throw new Error('Expected track id');
|
|
12
9
|
}
|
|
13
10
|
if (trackEntries[trackId]) {
|
|
14
11
|
return;
|
|
15
12
|
}
|
|
16
|
-
const codec =
|
|
13
|
+
const codec = getTrackCodec(trackEntry);
|
|
17
14
|
if (!codec) {
|
|
18
15
|
throw new Error('Expected codec');
|
|
19
16
|
}
|
|
20
|
-
const trackTimescale =
|
|
17
|
+
const trackTimescale = getTrackTimestampScale(trackEntry);
|
|
21
18
|
trackEntries[trackId] = {
|
|
22
19
|
codec: codec.value,
|
|
23
20
|
trackTimescale: (_a = trackTimescale === null || trackTimescale === void 0 ? void 0 : trackTimescale.value) !== null && _a !== void 0 ? _a : null,
|
|
@@ -106,4 +103,3 @@ const webmState = () => {
|
|
|
106
103
|
getAvcProfileForTrackNumber,
|
|
107
104
|
};
|
|
108
105
|
};
|
|
109
|
-
exports.webmState = webmState;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.throttledStateUpdate = void 0;
|
|
4
|
-
const throttledStateUpdate = ({ updateFn, everyMilliseconds, controller, }) => {
|
|
1
|
+
export const throttledStateUpdate = ({ updateFn, everyMilliseconds, controller, }) => {
|
|
5
2
|
let currentState = {
|
|
6
3
|
bytes: 0,
|
|
7
4
|
percentage: null,
|
|
@@ -52,4 +49,3 @@ const throttledStateUpdate = ({ updateFn, everyMilliseconds, controller, }) => {
|
|
|
52
49
|
},
|
|
53
50
|
};
|
|
54
51
|
};
|
|
55
|
-
exports.throttledStateUpdate = throttledStateUpdate;
|
package/dist/truthy.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { universalReader } from './readers/universal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { universalReader } from './readers/universal';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.271";
|
package/dist/version.js
CHANGED
package/dist/web-file.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./readers/from-web-file"), exports);
|
|
1
|
+
export * from './readers/from-web-file';
|
package/dist/web.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { webReader } from './readers/web';
|
package/dist/web.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { webReader } from './readers/web';
|
|
@@ -2,14 +2,16 @@ import type { AudioTrack, VideoTrack } from './get-tracks';
|
|
|
2
2
|
import type { MediaParserContainer } from './options';
|
|
3
3
|
export type OnAudioSample = (sample: AudioOrVideoSample) => void | Promise<void>;
|
|
4
4
|
export type OnVideoSample = (sample: AudioOrVideoSample) => void | Promise<void>;
|
|
5
|
-
export type
|
|
5
|
+
export type OnAudioTrackParams = {
|
|
6
6
|
track: AudioTrack;
|
|
7
7
|
container: MediaParserContainer;
|
|
8
|
-
}
|
|
9
|
-
export type
|
|
8
|
+
};
|
|
9
|
+
export type OnAudioTrack = (options: OnAudioTrackParams) => OnAudioSample | Promise<OnAudioSample | null> | null;
|
|
10
|
+
export type OnVideoTrackParams = {
|
|
10
11
|
track: VideoTrack;
|
|
11
12
|
container: MediaParserContainer;
|
|
12
|
-
}
|
|
13
|
+
};
|
|
14
|
+
export type OnVideoTrack = (options: OnVideoTrackParams) => OnVideoSample | Promise<OnVideoSample | null> | null;
|
|
13
15
|
export type AudioOrVideoSample = {
|
|
14
16
|
data: Uint8Array;
|
|
15
17
|
timestamp: number;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MediaParserController } from '../media-parser-controller';
|
|
2
|
+
import type { WorkerRequestPayload } from './worker-types';
|
|
3
|
+
export declare const forwardMediaParserControllerToWorker: (controller: MediaParserController) => ((message: WorkerRequestPayload) => void);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Log } from '../log';
|
|
2
|
+
export const forwardMediaParserControllerToWorker = (controller) => {
|
|
3
|
+
return (message) => {
|
|
4
|
+
if (message.type === 'request-pause') {
|
|
5
|
+
controller.pause();
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (message.type === 'request-resume') {
|
|
9
|
+
controller.resume();
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (message.type === 'request-abort') {
|
|
13
|
+
controller.abort();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const msg = `Unknown message type: ${message.type}`;
|
|
17
|
+
Log.error(msg);
|
|
18
|
+
throw new Error(msg);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IsAGifError, IsAnImageError, IsAnUnsupportedFileTypeError, IsAPdfError, MediaParserAbortError, } from '../errors';
|
|
2
|
+
import { Log } from '../log';
|
|
3
|
+
export const serializeError = (error, logLevel) => {
|
|
4
|
+
var _a, _b, _c, _d, _e;
|
|
5
|
+
if (error instanceof IsAGifError) {
|
|
6
|
+
return {
|
|
7
|
+
type: 'response-error',
|
|
8
|
+
errorName: 'IsAGifError',
|
|
9
|
+
errorMessage: error.message,
|
|
10
|
+
errorStack: (_a = error.stack) !== null && _a !== void 0 ? _a : '',
|
|
11
|
+
mimeType: error.mimeType,
|
|
12
|
+
sizeInBytes: error.sizeInBytes,
|
|
13
|
+
fileName: error.fileName,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (error instanceof IsAnImageError) {
|
|
17
|
+
return {
|
|
18
|
+
type: 'response-error',
|
|
19
|
+
errorName: 'IsAnImageError',
|
|
20
|
+
dimensions: error.dimensions,
|
|
21
|
+
errorMessage: error.message,
|
|
22
|
+
errorStack: (_b = error.stack) !== null && _b !== void 0 ? _b : '',
|
|
23
|
+
fileName: error.fileName,
|
|
24
|
+
imageType: error.imageType,
|
|
25
|
+
mimeType: error.mimeType,
|
|
26
|
+
sizeInBytes: error.sizeInBytes,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (error instanceof IsAPdfError) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'response-error',
|
|
32
|
+
errorName: 'IsAPdfError',
|
|
33
|
+
errorMessage: error.message,
|
|
34
|
+
errorStack: (_c = error.stack) !== null && _c !== void 0 ? _c : '',
|
|
35
|
+
mimeType: error.mimeType,
|
|
36
|
+
sizeInBytes: error.sizeInBytes,
|
|
37
|
+
fileName: error.fileName,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (error instanceof MediaParserAbortError) {
|
|
41
|
+
return {
|
|
42
|
+
type: 'response-error',
|
|
43
|
+
errorName: 'MediaParserAbortError',
|
|
44
|
+
errorMessage: error.message,
|
|
45
|
+
errorStack: (_d = error.stack) !== null && _d !== void 0 ? _d : '',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (error.name !== 'Error') {
|
|
49
|
+
Log.warn(logLevel, `Original error was of type ${error.name} did not properly propagate`);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
type: 'response-error',
|
|
53
|
+
errorName: 'Error',
|
|
54
|
+
errorMessage: error.message,
|
|
55
|
+
errorStack: (_e = error.stack) !== null && _e !== void 0 ? _e : '',
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export const deserializeError = (error) => {
|
|
59
|
+
switch (error.errorName) {
|
|
60
|
+
case 'IsAGifError':
|
|
61
|
+
return new IsAGifError({
|
|
62
|
+
fileName: error.fileName,
|
|
63
|
+
mimeType: error.mimeType,
|
|
64
|
+
sizeInBytes: error.sizeInBytes,
|
|
65
|
+
message: error.errorMessage,
|
|
66
|
+
});
|
|
67
|
+
case 'IsAnImageError':
|
|
68
|
+
return new IsAnImageError({
|
|
69
|
+
dimensions: error.dimensions,
|
|
70
|
+
fileName: error.fileName,
|
|
71
|
+
imageType: error.imageType,
|
|
72
|
+
mimeType: error.mimeType,
|
|
73
|
+
sizeInBytes: error.sizeInBytes,
|
|
74
|
+
message: error.errorMessage,
|
|
75
|
+
});
|
|
76
|
+
case 'IsAPdfError':
|
|
77
|
+
return new IsAPdfError({
|
|
78
|
+
fileName: error.fileName,
|
|
79
|
+
mimeType: error.mimeType,
|
|
80
|
+
sizeInBytes: error.sizeInBytes,
|
|
81
|
+
message: error.errorMessage,
|
|
82
|
+
});
|
|
83
|
+
case 'IsAnUnsupportedFileTypeError':
|
|
84
|
+
return new IsAnUnsupportedFileTypeError({
|
|
85
|
+
fileName: error.fileName,
|
|
86
|
+
mimeType: error.mimeType,
|
|
87
|
+
sizeInBytes: error.sizeInBytes,
|
|
88
|
+
message: error.errorMessage,
|
|
89
|
+
});
|
|
90
|
+
case 'MediaParserAbortError':
|
|
91
|
+
return new MediaParserAbortError(error.errorMessage);
|
|
92
|
+
default:
|
|
93
|
+
return new Error(error.errorMessage);
|
|
94
|
+
}
|
|
95
|
+
};
|