@remotion/media-parser 4.0.193 → 4.0.195
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/add-new-matroska-tracks.d.ts +8 -0
- package/dist/add-new-matroska-tracks.js +14 -0
- package/dist/av1-codec-string.d.ts +3 -0
- package/dist/av1-codec-string.js +91 -0
- package/dist/boxes/iso-base-media/esds/decoder-specific-config.d.ts +14 -0
- package/dist/boxes/iso-base-media/esds/decoder-specific-config.js +38 -0
- package/dist/boxes/iso-base-media/esds/esds-descriptors.d.ts +8 -0
- package/dist/boxes/iso-base-media/esds/esds-descriptors.js +22 -2
- package/dist/boxes/iso-base-media/make-track.d.ts +3 -0
- package/dist/boxes/iso-base-media/make-track.js +112 -0
- package/dist/boxes/iso-base-media/mdat/mdat.d.ts +16 -0
- package/dist/boxes/iso-base-media/mdat/mdat.js +97 -0
- package/dist/boxes/iso-base-media/moov/moov.d.ts +4 -2
- package/dist/boxes/iso-base-media/moov/moov.js +4 -2
- package/dist/boxes/iso-base-media/mvhd.js +7 -1
- package/dist/boxes/iso-base-media/process-box.d.ts +20 -3
- package/dist/boxes/iso-base-media/process-box.js +356 -18
- package/dist/boxes/iso-base-media/stsd/av1c.d.ts +9 -0
- package/dist/boxes/iso-base-media/stsd/av1c.js +10 -0
- package/dist/boxes/iso-base-media/stsd/avcc-hvcc.d.ts +20 -0
- package/dist/boxes/iso-base-media/stsd/avcc-hvcc.js +73 -0
- package/dist/boxes/iso-base-media/stsd/avcc.d.ts +10 -0
- package/dist/boxes/iso-base-media/stsd/avcc.js +21 -0
- package/dist/boxes/iso-base-media/stsd/colr.d.ts +11 -0
- package/dist/boxes/iso-base-media/stsd/colr.js +35 -0
- package/dist/boxes/iso-base-media/stsd/ctts.d.ts +19 -0
- package/dist/boxes/iso-base-media/stsd/ctts.js +30 -0
- package/dist/boxes/iso-base-media/stsd/hvcc.d.ts +11 -0
- package/dist/boxes/iso-base-media/stsd/hvcc.js +17 -0
- package/dist/boxes/iso-base-media/stsd/keys.js +1 -0
- package/dist/boxes/iso-base-media/stsd/mebx.d.ts +4 -2
- package/dist/boxes/iso-base-media/stsd/mebx.js +4 -2
- package/dist/boxes/iso-base-media/stsd/pasp.d.ts +12 -0
- package/dist/boxes/iso-base-media/stsd/pasp.js +17 -0
- package/dist/boxes/iso-base-media/stsd/samples.d.ts +12 -5
- package/dist/boxes/iso-base-media/stsd/samples.js +27 -10
- package/dist/boxes/iso-base-media/stsd/stco.d.ts +14 -0
- package/dist/boxes/iso-base-media/stsd/stco.js +30 -0
- package/dist/boxes/iso-base-media/stsd/stsc.d.ts +19 -0
- package/dist/boxes/iso-base-media/stsd/stsc.js +34 -0
- package/dist/boxes/iso-base-media/stsd/stsd.d.ts +4 -2
- package/dist/boxes/iso-base-media/stsd/stsd.js +6 -2
- package/dist/boxes/iso-base-media/stsd/stss.d.ts +13 -0
- package/dist/boxes/iso-base-media/stsd/stss.js +28 -0
- package/dist/boxes/iso-base-media/stsd/stsz.d.ts +21 -0
- package/dist/boxes/iso-base-media/stsd/stsz.js +44 -0
- package/dist/boxes/iso-base-media/stsd/stts.d.ts +15 -0
- package/dist/boxes/iso-base-media/stsd/stts.js +35 -0
- package/dist/boxes/iso-base-media/tkhd.d.ts +3 -0
- package/dist/boxes/iso-base-media/tkhd.js +41 -14
- package/dist/boxes/iso-base-media/trak/trak.d.ts +4 -2
- package/dist/boxes/iso-base-media/trak/trak.js +4 -2
- package/dist/boxes/iso-base-media/void-box.d.ts +4 -0
- package/dist/boxes/iso-base-media/void-box.js +2 -0
- package/dist/boxes/webm/allowed-partial-segments.d.ts +1 -0
- package/dist/boxes/webm/allowed-partial-segments.js +4 -0
- package/dist/boxes/webm/av1-codec-private.d.ts +2 -0
- package/dist/boxes/webm/av1-codec-private.js +95 -0
- package/dist/boxes/webm/bitstream/av1/bitstream-frame-header.d.ts +14 -0
- package/dist/boxes/webm/bitstream/av1/bitstream-frame-header.js +67 -0
- package/dist/boxes/webm/bitstream/av1/bitstream-frame.d.ts +11 -0
- package/dist/boxes/webm/bitstream/av1/bitstream-frame.js +14 -0
- package/dist/boxes/webm/bitstream/av1/chroma-sample-position.d.ts +6 -0
- package/dist/boxes/webm/bitstream/av1/chroma-sample-position.js +9 -0
- package/dist/boxes/webm/bitstream/av1/color-config.d.ts +16 -0
- package/dist/boxes/webm/bitstream/av1/color-config.js +103 -0
- package/dist/boxes/webm/bitstream/av1/color-primaries.d.ts +14 -0
- package/dist/boxes/webm/bitstream/av1/color-primaries.js +17 -0
- package/dist/boxes/webm/bitstream/av1/decoder-model-info.d.ts +9 -0
- package/dist/boxes/webm/bitstream/av1/decoder-model-info.js +17 -0
- package/dist/boxes/webm/bitstream/av1/frame.d.ts +0 -0
- package/dist/boxes/webm/bitstream/av1/frame.js +1 -0
- package/dist/boxes/webm/bitstream/av1/header-segment.d.ts +51 -0
- package/dist/boxes/webm/bitstream/av1/header-segment.js +183 -0
- package/dist/boxes/webm/bitstream/av1/matrix-coefficients.d.ts +17 -0
- package/dist/boxes/webm/bitstream/av1/matrix-coefficients.js +20 -0
- package/dist/boxes/webm/bitstream/av1/operating-parameters-info.d.ts +10 -0
- package/dist/boxes/webm/bitstream/av1/operating-parameters-info.js +15 -0
- package/dist/boxes/webm/bitstream/av1/temporal-point-info.d.ts +5 -0
- package/dist/boxes/webm/bitstream/av1/temporal-point-info.js +8 -0
- package/dist/boxes/webm/bitstream/av1/timing-info.d.ts +8 -0
- package/dist/boxes/webm/bitstream/av1/timing-info.js +20 -0
- package/dist/boxes/webm/bitstream/av1/transfer-characteristics.d.ts +21 -0
- package/dist/boxes/webm/bitstream/av1/transfer-characteristics.js +24 -0
- package/dist/boxes/webm/bitstream/av1/uvlc.d.ts +2 -0
- package/dist/boxes/webm/bitstream/av1/uvlc.js +20 -0
- package/dist/boxes/webm/bitstream/av1.d.ts +20 -0
- package/dist/boxes/webm/bitstream/av1.js +118 -0
- package/dist/boxes/webm/bitstream/h264/get-h264-descriptor.d.ts +0 -0
- package/dist/boxes/webm/bitstream/h264/get-h264-descriptor.js +1 -0
- package/dist/boxes/webm/description.d.ts +2 -0
- package/dist/boxes/webm/description.js +83 -0
- package/dist/boxes/webm/get-ready-tracks.d.ts +3 -0
- package/dist/boxes/webm/get-ready-tracks.js +29 -0
- package/dist/boxes/webm/get-track.d.ts +6 -0
- package/dist/boxes/webm/get-track.js +183 -0
- package/dist/boxes/webm/parse-webm-header.d.ts +2 -1
- package/dist/boxes/webm/parse-webm-header.js +2 -2
- package/dist/boxes/webm/segments/all-segments.d.ts +269 -0
- package/dist/boxes/webm/segments/all-segments.js +277 -0
- package/dist/boxes/webm/segments/duration.d.ts +1 -1
- package/dist/boxes/webm/segments/duration.js +13 -9
- package/dist/boxes/webm/segments/info.d.ts +2 -1
- package/dist/boxes/webm/segments/info.js +12 -4
- package/dist/boxes/webm/segments/main.d.ts +0 -2
- package/dist/boxes/webm/segments/main.js +0 -11
- package/dist/boxes/webm/segments/muxing.d.ts +1 -1
- package/dist/boxes/webm/segments/muxing.js +1 -2
- package/dist/boxes/webm/segments/parse-children.d.ts +11 -1
- package/dist/boxes/webm/segments/parse-children.js +82 -6
- package/dist/boxes/webm/segments/seek-head.d.ts +2 -1
- package/dist/boxes/webm/segments/seek-head.js +12 -3
- package/dist/boxes/webm/segments/seek-position.d.ts +1 -1
- package/dist/boxes/webm/segments/seek-position.js +1 -2
- package/dist/boxes/webm/segments/seek.d.ts +7 -2
- package/dist/boxes/webm/segments/seek.js +22 -9
- package/dist/boxes/webm/segments/track-entry.d.ts +102 -22
- package/dist/boxes/webm/segments/track-entry.js +269 -57
- package/dist/boxes/webm/segments/tracks.d.ts +2 -1
- package/dist/boxes/webm/segments/tracks.js +12 -4
- package/dist/boxes/webm/segments/void.d.ts +1 -1
- package/dist/boxes/webm/segments/void.js +1 -2
- package/dist/boxes/webm/segments/writing.d.ts +1 -1
- package/dist/boxes/webm/segments/writing.js +1 -2
- package/dist/boxes/webm/segments.d.ts +8 -4
- package/dist/boxes/webm/segments.js +176 -40
- package/dist/boxes/webm/traversal.d.ts +7 -0
- package/dist/boxes/webm/traversal.js +25 -0
- package/dist/buffer-iterator.d.ts +16 -1
- package/dist/buffer-iterator.js +124 -41
- package/dist/combine-uint8array.d.ts +1 -0
- package/dist/combine-uint8array.js +13 -0
- package/dist/from-fetch.d.ts +2 -0
- package/dist/from-fetch.js +54 -0
- package/dist/from-node.js +12 -2
- package/dist/from-web-file.d.ts +2 -0
- package/dist/from-web-file.js +34 -0
- package/dist/get-audio-codec.d.ts +19 -0
- package/dist/get-audio-codec.js +153 -60
- package/dist/get-dimensions.d.ts +8 -2
- package/dist/get-dimensions.js +13 -91
- package/dist/get-duration.js +4 -7
- package/dist/get-fps.d.ts +4 -3
- package/dist/get-fps.js +17 -116
- package/dist/get-sample-aspect-ratio.d.ts +37 -0
- package/dist/get-sample-aspect-ratio.js +137 -0
- package/dist/get-sample-positions.d.ts +22 -0
- package/dist/get-sample-positions.js +54 -0
- package/dist/get-tracks.d.ts +49 -0
- package/dist/get-tracks.js +84 -0
- package/dist/get-video-codec.d.ts +2 -0
- package/dist/get-video-codec.js +47 -31
- package/dist/has-all-info.d.ts +2 -1
- package/dist/has-all-info.js +14 -5
- package/dist/index.d.ts +1 -0
- package/dist/make-hvc1-codec-strings.d.ts +2 -0
- package/dist/make-hvc1-codec-strings.js +47 -0
- package/dist/options.d.ts +26 -4
- package/dist/parse-media.js +76 -20
- package/dist/parse-result.d.ts +17 -5
- package/dist/parse-video.d.ts +12 -2
- package/dist/parse-video.js +15 -6
- package/dist/parser-context.d.ts +8 -0
- package/dist/parser-context.js +2 -0
- package/dist/parser-state.d.ts +23 -0
- package/dist/parser-state.js +112 -0
- package/dist/reader.d.ts +2 -2
- package/dist/traversal.d.ts +56 -0
- package/dist/traversal.js +331 -0
- package/dist/understand-vorbis.d.ts +1 -0
- package/dist/understand-vorbis.js +12 -0
- package/dist/webcodec-sample-types.d.ts +21 -0
- package/dist/webcodec-sample-types.js +2 -0
- package/package.json +10 -2
- package/src/add-new-matroska-tracks.ts +23 -0
- package/src/boxes/iso-base-media/esds/decoder-specific-config.ts +61 -0
- package/src/boxes/iso-base-media/esds/esds-descriptors.ts +33 -2
- package/src/boxes/iso-base-media/make-track.ts +157 -0
- package/src/boxes/iso-base-media/mdat/mdat.ts +131 -0
- package/src/boxes/iso-base-media/moov/moov.ts +8 -3
- package/src/boxes/iso-base-media/mvhd.ts +7 -1
- package/src/boxes/iso-base-media/process-box.ts +426 -21
- package/src/boxes/iso-base-media/stsd/av1c.ts +19 -0
- package/src/boxes/iso-base-media/stsd/avcc.ts +36 -0
- package/src/boxes/iso-base-media/stsd/colr.ts +49 -0
- package/src/boxes/iso-base-media/stsd/ctts.ts +55 -0
- package/src/boxes/iso-base-media/stsd/hvcc.ts +32 -0
- package/src/boxes/iso-base-media/stsd/keys.ts +2 -0
- package/src/boxes/iso-base-media/stsd/mebx.ts +8 -3
- package/src/boxes/iso-base-media/stsd/pasp.ts +32 -0
- package/src/boxes/iso-base-media/stsd/samples.ts +43 -16
- package/src/boxes/iso-base-media/stsd/stco.ts +50 -0
- package/src/boxes/iso-base-media/stsd/stsc.ts +61 -0
- package/src/boxes/iso-base-media/stsd/stsd.ts +10 -3
- package/src/boxes/iso-base-media/stsd/stss.ts +47 -0
- package/src/boxes/iso-base-media/stsd/stsz.ts +75 -0
- package/src/boxes/iso-base-media/tkhd.ts +63 -16
- package/src/boxes/iso-base-media/trak/trak.ts +8 -3
- package/src/boxes/iso-base-media/void-box.ts +4 -0
- package/src/boxes/webm/allowed-partial-segments.ts +1 -0
- package/src/boxes/webm/av1-codec-private.ts +113 -0
- package/src/boxes/webm/description.ts +101 -0
- package/src/boxes/webm/get-ready-tracks.ts +36 -0
- package/src/boxes/webm/get-track.ts +250 -0
- package/src/boxes/webm/parse-webm-header.ts +6 -2
- package/src/boxes/webm/segments/all-segments.ts +285 -0
- package/src/boxes/webm/segments/duration.ts +15 -8
- package/src/boxes/webm/segments/info.ts +18 -4
- package/src/boxes/webm/segments/main.ts +0 -13
- package/src/boxes/webm/segments/muxing.ts +1 -1
- package/src/boxes/webm/segments/parse-children.ts +132 -9
- package/src/boxes/webm/segments/seek-head.ts +17 -4
- package/src/boxes/webm/segments/seek-position.ts +1 -2
- package/src/boxes/webm/segments/seek.ts +31 -9
- package/src/boxes/webm/segments/track-entry.ts +475 -65
- package/src/boxes/webm/segments/tracks.ts +17 -7
- package/src/boxes/webm/segments/void.ts +4 -2
- package/src/boxes/webm/segments/writing.ts +1 -1
- package/src/boxes/webm/segments.ts +266 -42
- package/src/boxes/webm/traversal.ts +32 -0
- package/src/buffer-iterator.ts +155 -40
- package/src/combine-uint8array.ts +13 -0
- package/src/{from-web.ts → from-fetch.ts} +18 -7
- package/src/from-node.ts +15 -2
- package/src/from-web-file.ts +39 -0
- package/src/get-audio-codec.ts +213 -84
- package/src/get-dimensions.ts +25 -132
- package/src/get-duration.ts +4 -8
- package/src/get-fps.ts +27 -172
- package/src/get-sample-aspect-ratio.ts +204 -0
- package/src/get-sample-positions.ts +93 -0
- package/src/get-tracks.ts +147 -0
- package/src/get-video-codec.ts +62 -47
- package/src/has-all-info.ts +35 -5
- package/src/index.ts +8 -0
- package/src/make-hvc1-codec-strings.ts +55 -0
- package/src/options.ts +48 -9
- package/src/parse-media.ts +112 -25
- package/src/parse-result.ts +29 -4
- package/src/parse-video.ts +32 -7
- package/src/parser-context.ts +9 -0
- package/src/parser-state.ts +151 -0
- package/src/reader.ts +3 -3
- package/src/test/aspect-ratio.test.ts +42 -0
- package/src/test/av1.test.ts +108 -0
- package/src/test/duration.test.ts +5 -21
- package/src/test/matroska.test.ts +350 -31
- package/src/test/mvhd.test.ts +6 -1
- package/src/test/parse-esds.test.ts +29 -6
- package/src/test/parse-stco.test.ts +59 -0
- package/src/test/parse-stsc.test.ts +104 -0
- package/src/test/parse-stsz.test.ts +57 -0
- package/src/test/parse-stts.test.ts +1 -1
- package/src/test/parse-video.test.ts +23 -35
- package/src/test/parse-webm.test.ts +5 -5
- package/src/test/stream-local.test.ts +543 -47
- package/src/test/stream-remote.test.ts +15 -13
- package/src/test/stream-samples.test.ts +259 -0
- package/src/test/stsd.test.ts +60 -8
- package/src/test/tkhd.test.ts +4 -1
- package/src/traversal.ts +496 -0
- package/src/webcodec-sample-types.ts +30 -0
- package/tsconfig.json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/boxes.json +0 -1
- /package/src/boxes/iso-base-media/{stts → stsd}/stts.ts +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Track } from './get-tracks';
|
|
2
|
+
import type { ParserContext } from './parser-context';
|
|
3
|
+
import type { ParserState } from './parser-state';
|
|
4
|
+
export declare const registerTrack: ({ state, options, track, }: {
|
|
5
|
+
state: ParserState;
|
|
6
|
+
options: ParserContext;
|
|
7
|
+
track: Track;
|
|
8
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTrack = void 0;
|
|
4
|
+
const registerTrack = async ({ state, options, track, }) => {
|
|
5
|
+
if (track.type === 'video' && options.onVideoTrack) {
|
|
6
|
+
const callback = await options.onVideoTrack(track);
|
|
7
|
+
await state.registerVideoSampleCallback(track.trackId, callback !== null && callback !== void 0 ? callback : null);
|
|
8
|
+
}
|
|
9
|
+
if (track.type === 'audio' && options.onAudioTrack) {
|
|
10
|
+
const callback = await options.onAudioTrack(track);
|
|
11
|
+
await state.registerAudioSampleCallback(track.trackId, callback !== null && callback !== void 0 ? callback : null);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.registerTrack = registerTrack;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ColorParameterBox } from './boxes/iso-base-media/stsd/colr';
|
|
2
|
+
import type { Av1BitstreamHeaderSegment } from './boxes/webm/bitstream/av1/header-segment';
|
|
3
|
+
export declare const constructAv1CodecString: (av1BitstreamHeader: Av1BitstreamHeaderSegment, colrAtom: ColorParameterBox | null) => string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://aomediacodec.github.io/av1-isobmff/#codecsparam
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.constructAv1CodecString = void 0;
|
|
5
|
+
const constructAv1CodecString = (av1BitstreamHeader, colrAtom) => {
|
|
6
|
+
let str = 'av01.';
|
|
7
|
+
// Profile
|
|
8
|
+
str += av1BitstreamHeader.seq_profile;
|
|
9
|
+
str += '.';
|
|
10
|
+
// Level
|
|
11
|
+
// The level parameter value SHALL equal the first level value indicated by seq_level_idx in the Sequence Header OBU
|
|
12
|
+
str += av1BitstreamHeader.seq_level[0].seq_level_idx
|
|
13
|
+
.toString()
|
|
14
|
+
.padStart(2, '0');
|
|
15
|
+
// Tier
|
|
16
|
+
// The tier parameter value SHALL be equal to M when the first seq_tier value in the Sequence Header OBU is equal to 0, and H when it is equal to 1
|
|
17
|
+
str += av1BitstreamHeader.seq_level[0].seq_tier ? 'H' : 'M';
|
|
18
|
+
str += '.';
|
|
19
|
+
// bitDepth
|
|
20
|
+
// The bitDepth parameter value SHALL equal the value of BitDepth variable as defined in [AV1] derived from the Sequence Header OBU
|
|
21
|
+
str += av1BitstreamHeader.color_config.bitDepth.toString().padStart(2, '0');
|
|
22
|
+
str += '.';
|
|
23
|
+
// monochrome
|
|
24
|
+
// The monochrome parameter value, represented by a single digit decimal, SHALL equal the value of mono_chrome in the Sequence Header OBU
|
|
25
|
+
str += av1BitstreamHeader.color_config.mono_chrome ? '1' : '0';
|
|
26
|
+
str += '.';
|
|
27
|
+
// The chromaSubsampling parameter value, represented by a three-digit decimal,
|
|
28
|
+
// SHALL have its first digit equal to subsampling_x
|
|
29
|
+
str += av1BitstreamHeader.color_config.subsampling_x ? '1' : '0';
|
|
30
|
+
// and its second digit equal to subsampling_y.
|
|
31
|
+
str += av1BitstreamHeader.color_config.subsampling_y ? '1' : '0';
|
|
32
|
+
// If both subsampling_x and subsampling_y are set to 1, then the third digit SHALL be equal to chroma_sample_position, otherwise it SHALL be set to 0
|
|
33
|
+
str +=
|
|
34
|
+
av1BitstreamHeader.color_config.subsampling_x &&
|
|
35
|
+
av1BitstreamHeader.color_config.subsampling_y
|
|
36
|
+
? av1BitstreamHeader.color_config.chroma_sample_position === 1
|
|
37
|
+
? '1'
|
|
38
|
+
: '0'
|
|
39
|
+
: '0';
|
|
40
|
+
str += '.';
|
|
41
|
+
// The colorPrimaries, transferCharacteristics, matrixCoefficients, and videoFullRangeFlag parameter values are set as follows:
|
|
42
|
+
// If a colr box with colour_type set to nclx is present, the colorPrimaries, transferCharacteristics, matrixCoefficients, and videoFullRangeFlag parameter values SHALL equal the values of matching fields in the colr box.
|
|
43
|
+
if (colrAtom) {
|
|
44
|
+
str += colrAtom.primaries.toString().padStart(2, '0');
|
|
45
|
+
str += '.';
|
|
46
|
+
str += colrAtom.transfer.toString().padStart(2, '0');
|
|
47
|
+
str += '.';
|
|
48
|
+
str += colrAtom.matrixIndex.toString().padStart(2, '0');
|
|
49
|
+
str += '.';
|
|
50
|
+
str += colrAtom.fullRangeFlag ? '1' : '0';
|
|
51
|
+
}
|
|
52
|
+
// Otherwise, a colr box with colour_type set to nclx is absent.
|
|
53
|
+
// If the color_description_present_flag is set to 1 in the Sequence Header OBU, the colorPrimaries, transferCharacteristics, and matrixCoefficients parameter values SHALL equal the values of matching fields in the Sequence Header OBU.
|
|
54
|
+
else if (av1BitstreamHeader.color_config.color_description_present_flag) {
|
|
55
|
+
str += av1BitstreamHeader.color_config.color_primaries
|
|
56
|
+
.toString()
|
|
57
|
+
.padStart(2, '0');
|
|
58
|
+
str += '.';
|
|
59
|
+
str += av1BitstreamHeader.color_config.transfer_characteristics
|
|
60
|
+
.toString()
|
|
61
|
+
.padStart(2, '0');
|
|
62
|
+
str += '.';
|
|
63
|
+
str += av1BitstreamHeader.color_config.matrix_coefficients
|
|
64
|
+
.toString()
|
|
65
|
+
.padStart(2, '0');
|
|
66
|
+
str += '.';
|
|
67
|
+
// The videoFullRangeFlag parameter value SHALL equal the color_range flag in the Sequence Header OBU.
|
|
68
|
+
str += av1BitstreamHeader.color_config.color_range ? '1' : '0';
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// Otherwise, the color_description_present_flag is set to 0 in the Sequence Header OBU. The colorPrimaries, transferCharacteristics, and matrixCoefficients parameter values SHOULD be set to the default values below.
|
|
72
|
+
// colorPrimaries 01 (ITU-R BT.709)
|
|
73
|
+
str += '01';
|
|
74
|
+
str += '.';
|
|
75
|
+
// transferCharacteristics 01 (ITU-R BT.709)
|
|
76
|
+
str += '01';
|
|
77
|
+
str += '.';
|
|
78
|
+
// matrixCoefficients 00 (ITU-R BT.709)
|
|
79
|
+
str += '01';
|
|
80
|
+
str += '.';
|
|
81
|
+
// videoFullRangeFlag 0 (studio swing representation)
|
|
82
|
+
str += '0';
|
|
83
|
+
}
|
|
84
|
+
// If the codecs parameter string ends with ".0.110.01.01.01.0" (containing all the default values below), that trailing part of the string SHOULD be omitted.
|
|
85
|
+
const suffix = '.0.110.01.01.01.0';
|
|
86
|
+
if (str.endsWith(suffix)) {
|
|
87
|
+
str = str.slice(0, -suffix.length);
|
|
88
|
+
}
|
|
89
|
+
return str;
|
|
90
|
+
};
|
|
91
|
+
exports.constructAv1CodecString = constructAv1CodecString;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
+
type UnknownDecoderSpecificConfig = {
|
|
3
|
+
type: 'unknown-decoder-specific-config';
|
|
4
|
+
};
|
|
5
|
+
type AudioSpecificConfig = {
|
|
6
|
+
type: 'audio-specific-config';
|
|
7
|
+
audioObjectType: number;
|
|
8
|
+
samplingFrequencyIndex: number;
|
|
9
|
+
channelConfiguration: number;
|
|
10
|
+
asBytes: Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
export type DecoderSpecificConfig = UnknownDecoderSpecificConfig | AudioSpecificConfig;
|
|
13
|
+
export declare const parseDecoderSpecificConfig: (iterator: BufferIterator) => DecoderSpecificConfig;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDecoderSpecificConfig = void 0;
|
|
4
|
+
const parseDecoderSpecificConfig = (iterator) => {
|
|
5
|
+
const layerTag = iterator.getUint8();
|
|
6
|
+
const layerSize = iterator.getPaddedFourByteNumber();
|
|
7
|
+
const start = iterator.counter.getOffset();
|
|
8
|
+
if (layerTag !== 5) {
|
|
9
|
+
iterator.discard(layerSize);
|
|
10
|
+
return {
|
|
11
|
+
type: 'unknown-decoder-specific-config',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
// https://csclub.uwaterloo.ca/~pbarfuss/ISO14496-3-2009.pdf
|
|
15
|
+
// 1.6.2.1 AudioSpecificConfig
|
|
16
|
+
const bytes = iterator.getSlice(layerSize);
|
|
17
|
+
iterator.counter.decrement(layerSize);
|
|
18
|
+
iterator.startReadingBits();
|
|
19
|
+
const audioObjectType = iterator.getBits(5);
|
|
20
|
+
const samplingFrequencyIndex = iterator.getBits(4);
|
|
21
|
+
if (samplingFrequencyIndex === 0xf) {
|
|
22
|
+
iterator.getBits(24);
|
|
23
|
+
}
|
|
24
|
+
const channelConfiguration = iterator.getBits(4);
|
|
25
|
+
iterator.stopReadingBits();
|
|
26
|
+
const read = iterator.counter.getOffset() - start;
|
|
27
|
+
if (read < layerSize) {
|
|
28
|
+
iterator.discard(layerSize - read);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
type: 'audio-specific-config',
|
|
32
|
+
audioObjectType,
|
|
33
|
+
samplingFrequencyIndex,
|
|
34
|
+
channelConfiguration,
|
|
35
|
+
asBytes: bytes,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.parseDecoderSpecificConfig = parseDecoderSpecificConfig;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
+
import type { DecoderSpecificConfig } from './decoder-specific-config';
|
|
2
3
|
type AudioObjectType = 'aac' | 'mp3' | 'unknown';
|
|
3
4
|
type DecoderConfigDescriptor = {
|
|
4
5
|
type: 'decoder-config-descriptor';
|
|
5
6
|
objectTypeIndication: AudioObjectType;
|
|
7
|
+
asNumber: number;
|
|
8
|
+
streamType: number;
|
|
9
|
+
upStream: number;
|
|
10
|
+
bufferSizeDB: number;
|
|
11
|
+
maxBitrate: number;
|
|
12
|
+
avgBitrate: number;
|
|
13
|
+
decoderSpecificConfigs: DecoderSpecificConfig[];
|
|
6
14
|
};
|
|
7
15
|
type SlConfigDescriptor = {
|
|
8
16
|
type: 'sl-config-descriptor';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseDescriptors = exports.processDescriptor = void 0;
|
|
4
|
+
const decoder_specific_config_1 = require("./decoder-specific-config");
|
|
4
5
|
const mapToObjectAudioIndicator = (num) => {
|
|
5
6
|
// https://chromium.googlesource.com/chromium/src/media/+/master/formats/mp4/es_descriptor.h
|
|
6
7
|
// http://netmedia.zju.edu.cn/multimedia2013/mpeg-4/ISO%20IEC%2014496-1%20MPEG-4%20System%20Standard.pdf
|
|
@@ -19,12 +20,31 @@ const processDescriptor = ({ iterator, }) => {
|
|
|
19
20
|
const size = iterator.getPaddedFourByteNumber();
|
|
20
21
|
const initialOffset = iterator.counter.getOffset();
|
|
21
22
|
const objectTypeIndication = iterator.getUint8();
|
|
22
|
-
|
|
23
|
-
iterator.
|
|
23
|
+
iterator.startReadingBits();
|
|
24
|
+
const streamType = iterator.getBits(6);
|
|
25
|
+
const upStream = iterator.getBits(1);
|
|
26
|
+
// reserved
|
|
27
|
+
iterator.getBits(1);
|
|
28
|
+
const bufferSizeDB = iterator.getBits(24);
|
|
29
|
+
iterator.stopReadingBits();
|
|
30
|
+
const maxBitrate = iterator.getUint32();
|
|
31
|
+
const avgBitrate = iterator.getUint32();
|
|
32
|
+
const decoderSpecificConfigs = [];
|
|
33
|
+
while (size - (iterator.counter.getOffset() - initialOffset) >= 0) {
|
|
34
|
+
const decoderSpecificConfig = (0, decoder_specific_config_1.parseDecoderSpecificConfig)(iterator);
|
|
35
|
+
decoderSpecificConfigs.push(decoderSpecificConfig);
|
|
36
|
+
}
|
|
24
37
|
return {
|
|
25
38
|
descriptor: {
|
|
26
39
|
type: 'decoder-config-descriptor',
|
|
27
40
|
objectTypeIndication: mapToObjectAudioIndicator(objectTypeIndication),
|
|
41
|
+
asNumber: objectTypeIndication,
|
|
42
|
+
bufferSizeDB,
|
|
43
|
+
streamType,
|
|
44
|
+
upStream,
|
|
45
|
+
avgBitrate,
|
|
46
|
+
maxBitrate,
|
|
47
|
+
decoderSpecificConfigs,
|
|
28
48
|
},
|
|
29
49
|
};
|
|
30
50
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeBaseMediaTrack = void 0;
|
|
4
|
+
const get_audio_codec_1 = require("../../get-audio-codec");
|
|
5
|
+
const get_fps_1 = require("../../get-fps");
|
|
6
|
+
const get_sample_aspect_ratio_1 = require("../../get-sample-aspect-ratio");
|
|
7
|
+
const get_sample_positions_1 = require("../../get-sample-positions");
|
|
8
|
+
const get_video_codec_1 = require("../../get-video-codec");
|
|
9
|
+
const traversal_1 = require("../../traversal");
|
|
10
|
+
const makeBaseMediaTrack = (trakBox) => {
|
|
11
|
+
const stszBox = (0, traversal_1.getStszBox)(trakBox);
|
|
12
|
+
const stcoBox = (0, traversal_1.getStcoBox)(trakBox);
|
|
13
|
+
const stscBox = (0, traversal_1.getStscBox)(trakBox);
|
|
14
|
+
const stssBox = (0, traversal_1.getStssBox)(trakBox);
|
|
15
|
+
const sttsBox = (0, traversal_1.getSttsBox)(trakBox);
|
|
16
|
+
const tkhdBox = (0, traversal_1.getTkhdBox)(trakBox);
|
|
17
|
+
const cttsBox = (0, traversal_1.getCttsBox)(trakBox);
|
|
18
|
+
const videoDescriptors = (0, traversal_1.getVideoDescriptors)(trakBox);
|
|
19
|
+
const timescaleAndDuration = (0, get_fps_1.getTimescaleAndDuration)(trakBox);
|
|
20
|
+
if (!tkhdBox) {
|
|
21
|
+
throw new Error('Expected tkhd box in trak box');
|
|
22
|
+
}
|
|
23
|
+
if (!stszBox) {
|
|
24
|
+
throw new Error('Expected stsz box in trak box');
|
|
25
|
+
}
|
|
26
|
+
if (!stcoBox) {
|
|
27
|
+
throw new Error('Expected stco box in trak box');
|
|
28
|
+
}
|
|
29
|
+
if (!stscBox) {
|
|
30
|
+
throw new Error('Expected stsc box in trak box');
|
|
31
|
+
}
|
|
32
|
+
if (!sttsBox) {
|
|
33
|
+
throw new Error('Expected stts box in trak box');
|
|
34
|
+
}
|
|
35
|
+
if (!timescaleAndDuration) {
|
|
36
|
+
throw new Error('Expected timescale and duration in trak box');
|
|
37
|
+
}
|
|
38
|
+
const samplePositions = (0, get_sample_positions_1.getSamplePositions)({
|
|
39
|
+
stcoBox,
|
|
40
|
+
stscBox,
|
|
41
|
+
stszBox,
|
|
42
|
+
stssBox,
|
|
43
|
+
sttsBox,
|
|
44
|
+
cttsBox,
|
|
45
|
+
});
|
|
46
|
+
if ((0, get_fps_1.trakBoxContainsAudio)(trakBox)) {
|
|
47
|
+
const numberOfChannels = (0, get_audio_codec_1.getNumberOfChannelsFromTrak)(trakBox);
|
|
48
|
+
if (numberOfChannels === null) {
|
|
49
|
+
throw new Error('Could not find number of channels');
|
|
50
|
+
}
|
|
51
|
+
const sampleRate = (0, get_audio_codec_1.getSampleRate)(trakBox);
|
|
52
|
+
if (sampleRate === null) {
|
|
53
|
+
throw new Error('Could not find sample rate');
|
|
54
|
+
}
|
|
55
|
+
const { codecString, description } = (0, get_audio_codec_1.getAudioCodecStringFromTrak)(trakBox);
|
|
56
|
+
return {
|
|
57
|
+
type: 'audio',
|
|
58
|
+
samplePositions,
|
|
59
|
+
trackId: tkhdBox.trackId,
|
|
60
|
+
timescale: timescaleAndDuration.timescale,
|
|
61
|
+
codec: codecString,
|
|
62
|
+
numberOfChannels,
|
|
63
|
+
sampleRate,
|
|
64
|
+
description,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (!(0, get_fps_1.trakBoxContainsVideo)(trakBox)) {
|
|
68
|
+
return {
|
|
69
|
+
type: 'other',
|
|
70
|
+
samplePositions,
|
|
71
|
+
trackId: tkhdBox.trackId,
|
|
72
|
+
timescale: timescaleAndDuration.timescale,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const videoSample = (0, get_sample_aspect_ratio_1.getVideoSample)(trakBox);
|
|
76
|
+
if (!videoSample) {
|
|
77
|
+
throw new Error('No video sample');
|
|
78
|
+
}
|
|
79
|
+
const sampleAspectRatio = (0, get_sample_aspect_ratio_1.getSampleAspectRatio)(trakBox);
|
|
80
|
+
const aspectRatioApplied = (0, get_sample_aspect_ratio_1.applyAspectRatios)({
|
|
81
|
+
dimensions: videoSample,
|
|
82
|
+
sampleAspectRatio,
|
|
83
|
+
displayAspectRatio: (0, get_sample_aspect_ratio_1.getDisplayAspectRatio)({
|
|
84
|
+
sampleAspectRatio,
|
|
85
|
+
nativeDimensions: videoSample,
|
|
86
|
+
}),
|
|
87
|
+
});
|
|
88
|
+
const { displayAspectHeight, displayAspectWidth, height, rotation, width } = (0, get_sample_aspect_ratio_1.applyTkhdBox)(aspectRatioApplied, tkhdBox);
|
|
89
|
+
const codec = (0, get_video_codec_1.getVideoCodecString)(trakBox);
|
|
90
|
+
if (!codec) {
|
|
91
|
+
throw new Error('Could not find video codec');
|
|
92
|
+
}
|
|
93
|
+
const track = {
|
|
94
|
+
type: 'video',
|
|
95
|
+
samplePositions,
|
|
96
|
+
trackId: tkhdBox.trackId,
|
|
97
|
+
description: videoDescriptors !== null && videoDescriptors !== void 0 ? videoDescriptors : undefined,
|
|
98
|
+
timescale: timescaleAndDuration.timescale,
|
|
99
|
+
codec,
|
|
100
|
+
sampleAspectRatio: (0, get_sample_aspect_ratio_1.getSampleAspectRatio)(trakBox),
|
|
101
|
+
width,
|
|
102
|
+
height,
|
|
103
|
+
codedWidth: videoSample.width,
|
|
104
|
+
codedHeight: videoSample.height,
|
|
105
|
+
// Repeating those keys because they get picked up by VideoDecoder
|
|
106
|
+
displayAspectWidth,
|
|
107
|
+
displayAspectHeight,
|
|
108
|
+
rotation,
|
|
109
|
+
};
|
|
110
|
+
return track;
|
|
111
|
+
};
|
|
112
|
+
exports.makeBaseMediaTrack = makeBaseMediaTrack;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
+
import type { AnySegment } from '../../../parse-result';
|
|
3
|
+
import type { ParserContext } from '../../../parser-context';
|
|
4
|
+
export interface MdatBox {
|
|
5
|
+
type: 'mdat-box';
|
|
6
|
+
samplesProcessed: boolean;
|
|
7
|
+
boxSize: number;
|
|
8
|
+
fileOffset: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const parseMdat: ({ data, size, fileOffset, existingBoxes, options, }: {
|
|
11
|
+
data: BufferIterator;
|
|
12
|
+
size: number;
|
|
13
|
+
fileOffset: number;
|
|
14
|
+
existingBoxes: AnySegment[];
|
|
15
|
+
options: ParserContext;
|
|
16
|
+
}) => Promise<MdatBox>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMdat = void 0;
|
|
4
|
+
const get_tracks_1 = require("../../../get-tracks");
|
|
5
|
+
const parseMdat = async ({ data, size, fileOffset, existingBoxes, options, }) => {
|
|
6
|
+
const alreadyHas = (0, get_tracks_1.hasTracks)(existingBoxes);
|
|
7
|
+
if (!alreadyHas) {
|
|
8
|
+
data.discard(size - 8);
|
|
9
|
+
return Promise.resolve({
|
|
10
|
+
type: 'mdat-box',
|
|
11
|
+
boxSize: size,
|
|
12
|
+
samplesProcessed: false,
|
|
13
|
+
fileOffset,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const tracks = (0, get_tracks_1.getTracks)(existingBoxes, options.parserState);
|
|
17
|
+
const allTracks = [
|
|
18
|
+
...tracks.videoTracks,
|
|
19
|
+
...tracks.audioTracks,
|
|
20
|
+
...tracks.otherTracks,
|
|
21
|
+
];
|
|
22
|
+
const flatSamples = allTracks
|
|
23
|
+
.map((track) => {
|
|
24
|
+
if (!track.samplePositions) {
|
|
25
|
+
throw new Error('No sample positions');
|
|
26
|
+
}
|
|
27
|
+
return track.samplePositions.map((samplePosition) => {
|
|
28
|
+
return {
|
|
29
|
+
track,
|
|
30
|
+
samplePosition,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
})
|
|
34
|
+
.flat(1);
|
|
35
|
+
// eslint-disable-next-line no-constant-condition
|
|
36
|
+
while (true) {
|
|
37
|
+
const sampleWithIndex = flatSamples.find((sample) => {
|
|
38
|
+
return sample.samplePosition.offset === data.counter.getOffset();
|
|
39
|
+
});
|
|
40
|
+
if (!sampleWithIndex) {
|
|
41
|
+
// There are various reasons why in mdat we find weird stuff:
|
|
42
|
+
// - iphonevideo.hevc has a fake hoov atom which is not mapped
|
|
43
|
+
// - corrupted.mp4 has a corrupt table
|
|
44
|
+
const nextSample_ = flatSamples
|
|
45
|
+
.filter((s) => s.samplePosition.offset > data.counter.getOffset())
|
|
46
|
+
.sort((a, b) => a.samplePosition.offset - b.samplePosition.offset)[0];
|
|
47
|
+
if (nextSample_) {
|
|
48
|
+
data.discard(nextSample_.samplePosition.offset - data.counter.getOffset());
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const bytesRemaining = size + fileOffset - data.counter.getOffset();
|
|
53
|
+
data.discard(bytesRemaining);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (data.bytesRemaining() < sampleWithIndex.samplePosition.size) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
const bytes = data.getSlice(sampleWithIndex.samplePosition.size);
|
|
61
|
+
if (sampleWithIndex.track.type === 'audio') {
|
|
62
|
+
await options.parserState.onAudioSample(sampleWithIndex.track.trackId, {
|
|
63
|
+
data: bytes,
|
|
64
|
+
timestamp: sampleWithIndex.samplePosition.offset,
|
|
65
|
+
offset: data.counter.getOffset(),
|
|
66
|
+
trackId: sampleWithIndex.track.trackId,
|
|
67
|
+
type: sampleWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (sampleWithIndex.track.type === 'video') {
|
|
71
|
+
const timestamp = (sampleWithIndex.samplePosition.cts * 1000000) /
|
|
72
|
+
sampleWithIndex.track.timescale;
|
|
73
|
+
const duration = (sampleWithIndex.samplePosition.duration * 1000000) /
|
|
74
|
+
sampleWithIndex.track.timescale;
|
|
75
|
+
await options.parserState.onVideoSample(sampleWithIndex.track.trackId, {
|
|
76
|
+
data: bytes,
|
|
77
|
+
timestamp,
|
|
78
|
+
duration,
|
|
79
|
+
cts: sampleWithIndex.samplePosition.cts,
|
|
80
|
+
dts: sampleWithIndex.samplePosition.dts,
|
|
81
|
+
trackId: sampleWithIndex.track.trackId,
|
|
82
|
+
type: sampleWithIndex.samplePosition.isKeyframe ? 'key' : 'delta',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const remaining = size - (data.counter.getOffset() - fileOffset);
|
|
86
|
+
if (remaining === 0) {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return Promise.resolve({
|
|
91
|
+
type: 'mdat-box',
|
|
92
|
+
boxSize: size,
|
|
93
|
+
samplesProcessed: true,
|
|
94
|
+
fileOffset,
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.parseMdat = parseMdat;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
2
|
import type { AnySegment } from '../../../parse-result';
|
|
3
|
+
import type { ParserContext } from '../../../parser-context';
|
|
3
4
|
import type { BaseBox } from '../base-type';
|
|
4
5
|
export interface MoovBox extends BaseBox {
|
|
5
6
|
type: 'moov-box';
|
|
6
7
|
children: AnySegment[];
|
|
7
8
|
}
|
|
8
|
-
export declare const parseMoov: ({ iterator, offset, size, }: {
|
|
9
|
+
export declare const parseMoov: ({ iterator, offset, size, options, }: {
|
|
9
10
|
iterator: BufferIterator;
|
|
10
11
|
offset: number;
|
|
11
12
|
size: number;
|
|
12
|
-
|
|
13
|
+
options: ParserContext;
|
|
14
|
+
}) => Promise<MoovBox>;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseMoov = void 0;
|
|
4
4
|
const process_box_1 = require("../process-box");
|
|
5
|
-
const parseMoov = ({ iterator, offset, size, }) => {
|
|
6
|
-
const children = (0, process_box_1.parseBoxes)({
|
|
5
|
+
const parseMoov = async ({ iterator, offset, size, options, }) => {
|
|
6
|
+
const children = await (0, process_box_1.parseBoxes)({
|
|
7
7
|
iterator,
|
|
8
8
|
maxBytes: size - (iterator.counter.getOffset() - offset),
|
|
9
9
|
allowIncompleteBoxes: false,
|
|
10
10
|
initialBoxes: [],
|
|
11
|
+
options,
|
|
12
|
+
continueMdat: false,
|
|
11
13
|
});
|
|
12
14
|
if (children.status === 'incomplete') {
|
|
13
15
|
throw new Error('Incomplete boxes are not allowed');
|
|
@@ -35,12 +35,18 @@ const parseMvhd = ({ iterator, offset, size, }) => {
|
|
|
35
35
|
// matrix
|
|
36
36
|
const matrix = [];
|
|
37
37
|
for (let i = 0; i < 9; i++) {
|
|
38
|
-
|
|
38
|
+
if (i % 3 === 2) {
|
|
39
|
+
matrix.push(iterator.getFixedPointSigned230Number());
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
matrix.push(iterator.getFixedPointSigned1616Number());
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
// pre-defined
|
|
41
46
|
iterator.discard(4 * 6);
|
|
42
47
|
// next track id
|
|
43
48
|
const nextTrackId = iterator.getUint32();
|
|
49
|
+
volumeView.destroy();
|
|
44
50
|
return {
|
|
45
51
|
creationTime: (0, to_date_1.toUnixTimestamp)(creationTime),
|
|
46
52
|
modificationTime: (0, to_date_1.toUnixTimestamp)(modificationTime),
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import type { BufferIterator } from '../../buffer-iterator';
|
|
2
|
-
import type { IsoBaseMediaBox, ParseResult } from '../../parse-result';
|
|
3
|
-
|
|
2
|
+
import type { AnySegment, IsoBaseMediaBox, ParseResult } from '../../parse-result';
|
|
3
|
+
import type { BoxAndNext, PartialMdatBox } from '../../parse-video';
|
|
4
|
+
import type { ParserContext } from '../../parser-context';
|
|
5
|
+
export declare const parseMdatPartially: ({ iterator, boxSize, fileOffset, parsedBoxes, options, }: {
|
|
6
|
+
iterator: BufferIterator;
|
|
7
|
+
boxSize: number;
|
|
8
|
+
fileOffset: number;
|
|
9
|
+
parsedBoxes: AnySegment[];
|
|
10
|
+
options: ParserContext;
|
|
11
|
+
}) => Promise<BoxAndNext>;
|
|
12
|
+
export declare const processBox: ({ iterator, allowIncompleteBoxes, parsedBoxes, options, }: {
|
|
13
|
+
iterator: BufferIterator;
|
|
14
|
+
allowIncompleteBoxes: boolean;
|
|
15
|
+
parsedBoxes: AnySegment[];
|
|
16
|
+
options: ParserContext;
|
|
17
|
+
}) => Promise<BoxAndNext>;
|
|
18
|
+
export declare const parseBoxes: ({ iterator, maxBytes, allowIncompleteBoxes, initialBoxes, options, continueMdat, }: {
|
|
4
19
|
iterator: BufferIterator;
|
|
5
20
|
maxBytes: number;
|
|
6
21
|
allowIncompleteBoxes: boolean;
|
|
7
22
|
initialBoxes: IsoBaseMediaBox[];
|
|
8
|
-
|
|
23
|
+
options: ParserContext;
|
|
24
|
+
continueMdat: false | PartialMdatBox;
|
|
25
|
+
}) => Promise<ParseResult>;
|