@remotion/media-parser 4.0.243 → 4.0.244
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/boxes/iso-base-media/ftyp.js +2 -2
- package/dist/boxes/iso-base-media/meta/hdlr.js +1 -1
- package/dist/boxes/iso-base-media/meta/ilst.js +1 -1
- package/dist/boxes/iso-base-media/parse-icc-profile.js +12 -12
- package/dist/boxes/iso-base-media/process-box.js +1 -1
- package/dist/boxes/iso-base-media/stsd/colr.js +1 -1
- package/dist/boxes/iso-base-media/stsd/keys.js +1 -1
- package/dist/boxes/riff/expect-riff-box.js +1 -1
- package/dist/boxes/riff/is-movi.js +1 -1
- package/dist/boxes/riff/parse-box.js +2 -2
- package/dist/boxes/riff/parse-isft.js +1 -1
- package/dist/boxes/riff/parse-list-box.js +1 -1
- package/dist/boxes/riff/parse-movi.js +1 -1
- package/dist/boxes/riff/parse-strf.js +1 -1
- package/dist/boxes/riff/parse-strh.js +4 -2
- package/dist/boxes/webm/description.js +1 -1
- package/dist/boxes/webm/ebml.d.ts +1 -1
- package/dist/boxes/webm/parse-ebml.js +1 -1
- package/dist/boxes/webm/segments/all-segments.d.ts +16 -0
- package/dist/boxes/webm/segments/all-segments.js +12 -2
- package/dist/buffer-iterator.d.ts +2 -2
- package/dist/buffer-iterator.js +8 -2
- package/dist/esm/index.mjs +47 -34
- package/dist/get-audio-codec.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseFtyp = void 0;
|
|
4
4
|
const parseFtyp = ({ iterator, size, offset, }) => {
|
|
5
|
-
const majorBrand = iterator.getByteString(4);
|
|
5
|
+
const majorBrand = iterator.getByteString(4, false);
|
|
6
6
|
const minorVersion = iterator.getFourByteNumber();
|
|
7
7
|
const types = (size - iterator.counter.getOffset()) / 4;
|
|
8
8
|
const compatibleBrands = [];
|
|
9
9
|
for (let i = 0; i < types; i++) {
|
|
10
|
-
compatibleBrands.push(iterator.getByteString(4).trim());
|
|
10
|
+
compatibleBrands.push(iterator.getByteString(4, false).trim());
|
|
11
11
|
}
|
|
12
12
|
const offsetAtEnd = iterator.counter.getOffset();
|
|
13
13
|
return {
|
|
@@ -12,7 +12,7 @@ const parseHdlr = ({ iterator, size, offset, }) => {
|
|
|
12
12
|
// predefined
|
|
13
13
|
iterator.discard(4);
|
|
14
14
|
// type
|
|
15
|
-
const hdlrType = iterator.getByteString(4);
|
|
15
|
+
const hdlrType = iterator.getByteString(4, false);
|
|
16
16
|
// component manufactor
|
|
17
17
|
iterator.discard(4);
|
|
18
18
|
// component flags
|
|
@@ -4,7 +4,7 @@ exports.parseIlstBox = void 0;
|
|
|
4
4
|
// https://developer.apple.com/documentation/quicktime-file-format/well-known_types
|
|
5
5
|
const parseFromWellKnownType = (wellKnownType, iterator, size) => {
|
|
6
6
|
if (wellKnownType === 1) {
|
|
7
|
-
const value = iterator.getByteString(size);
|
|
7
|
+
const value = iterator.getByteString(size, false);
|
|
8
8
|
return { type: 'text', value };
|
|
9
9
|
}
|
|
10
10
|
if (wellKnownType === 21) {
|
|
@@ -8,34 +8,34 @@ const parseIccProfile = (data) => {
|
|
|
8
8
|
if (size !== data.length) {
|
|
9
9
|
throw new Error('Invalid ICC profile size');
|
|
10
10
|
}
|
|
11
|
-
const preferredCMMType = iterator.getByteString(4);
|
|
12
|
-
const profileVersion = iterator.getByteString(4);
|
|
13
|
-
const profileDeviceClass = iterator.getByteString(4);
|
|
14
|
-
const colorSpace = iterator.getByteString(4);
|
|
15
|
-
const pcs = iterator.getByteString(4);
|
|
11
|
+
const preferredCMMType = iterator.getByteString(4, false);
|
|
12
|
+
const profileVersion = iterator.getByteString(4, false);
|
|
13
|
+
const profileDeviceClass = iterator.getByteString(4, false);
|
|
14
|
+
const colorSpace = iterator.getByteString(4, false);
|
|
15
|
+
const pcs = iterator.getByteString(4, false);
|
|
16
16
|
const dateTime = iterator.getSlice(12);
|
|
17
|
-
const signature = iterator.getByteString(4);
|
|
17
|
+
const signature = iterator.getByteString(4, false);
|
|
18
18
|
if (signature !== 'acsp') {
|
|
19
19
|
throw new Error('Invalid ICC profile signature');
|
|
20
20
|
}
|
|
21
|
-
const primaryPlatform = iterator.getByteString(4);
|
|
21
|
+
const primaryPlatform = iterator.getByteString(4, false);
|
|
22
22
|
const profileFlags = iterator.getUint32();
|
|
23
|
-
const deviceManufacturer = iterator.getByteString(4);
|
|
24
|
-
const deviceModel = iterator.getByteString(4);
|
|
23
|
+
const deviceManufacturer = iterator.getByteString(4, false);
|
|
24
|
+
const deviceModel = iterator.getByteString(4, false);
|
|
25
25
|
const deviceAttributes = iterator.getUint64();
|
|
26
26
|
const renderingIntent = iterator.getUint32();
|
|
27
27
|
const pcsIlluminant1 = iterator.getUint32();
|
|
28
28
|
const pcsIlluminant2 = iterator.getUint32();
|
|
29
29
|
const pcsIlluminant3 = iterator.getUint32();
|
|
30
|
-
const profileCreator = iterator.getByteString(4);
|
|
31
|
-
const profileId = iterator.getByteString(16);
|
|
30
|
+
const profileCreator = iterator.getByteString(4, false);
|
|
31
|
+
const profileId = iterator.getByteString(16, false);
|
|
32
32
|
// reserved
|
|
33
33
|
iterator.discard(28);
|
|
34
34
|
const tagCount = iterator.getUint32();
|
|
35
35
|
const entries = [];
|
|
36
36
|
for (let i = 0; i < tagCount; i++) {
|
|
37
37
|
const entry = {
|
|
38
|
-
tag: iterator.getByteString(4),
|
|
38
|
+
tag: iterator.getByteString(4, false),
|
|
39
39
|
offset: iterator.getUint32(),
|
|
40
40
|
size: iterator.getUint32(),
|
|
41
41
|
};
|
|
@@ -122,7 +122,7 @@ const processBox = async ({ iterator, allowIncompleteBoxes, parsedBoxes, state,
|
|
|
122
122
|
skipTo: null,
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
const boxType = iterator.getByteString(4);
|
|
125
|
+
const boxType = iterator.getByteString(4, false);
|
|
126
126
|
const boxSize = boxSizeRaw === 1 ? iterator.getEightByteNumber() : boxSizeRaw;
|
|
127
127
|
if (bytesRemaining < boxSize) {
|
|
128
128
|
if (boxType === 'mdat') {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseColorParameterBox = void 0;
|
|
4
4
|
const parse_icc_profile_1 = require("../parse-icc-profile");
|
|
5
5
|
const parseColorParameterBox = ({ iterator, size, }) => {
|
|
6
|
-
const byteString = iterator.getByteString(4);
|
|
6
|
+
const byteString = iterator.getByteString(4, false);
|
|
7
7
|
if (byteString === 'nclx') {
|
|
8
8
|
const primaries = iterator.getUint16();
|
|
9
9
|
const transfer = iterator.getUint16();
|
|
@@ -13,7 +13,7 @@ const parseKeys = ({ iterator, offset, size, }) => {
|
|
|
13
13
|
// key_size
|
|
14
14
|
const keySize = iterator.getUint32();
|
|
15
15
|
const namespace = iterator.getAtom();
|
|
16
|
-
const value = iterator.getByteString(keySize - 8);
|
|
16
|
+
const value = iterator.getByteString(keySize - 8, false);
|
|
17
17
|
// data
|
|
18
18
|
const entry = {
|
|
19
19
|
keySize,
|
|
@@ -14,7 +14,7 @@ const expectRiffBox = async ({ iterator, state, structure, }) => {
|
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
const ckId = iterator.getByteString(4);
|
|
17
|
+
const ckId = iterator.getByteString(4, false);
|
|
18
18
|
const ckSize = iterator.getUint32Le();
|
|
19
19
|
if ((0, is_movi_1.isMoviAtom)(iterator, ckId)) {
|
|
20
20
|
iterator.discard(4);
|
|
@@ -121,7 +121,7 @@ const parseRiffBody = async ({ iterator, structure, maxOffset, state, }) => {
|
|
|
121
121
|
};
|
|
122
122
|
exports.parseRiffBody = parseRiffBody;
|
|
123
123
|
const parseRiff = ({ iterator, state, fields, }) => {
|
|
124
|
-
const riff = iterator.getByteString(4);
|
|
124
|
+
const riff = iterator.getByteString(4, false);
|
|
125
125
|
if (riff !== 'RIFF') {
|
|
126
126
|
throw new Error('Not a RIFF file');
|
|
127
127
|
}
|
|
@@ -130,7 +130,7 @@ const parseRiff = ({ iterator, state, fields, }) => {
|
|
|
130
130
|
throw new Error('Structure is not a RIFF structure');
|
|
131
131
|
}
|
|
132
132
|
const size = iterator.getUint32Le();
|
|
133
|
-
const fileType = iterator.getByteString(4);
|
|
133
|
+
const fileType = iterator.getByteString(4, false);
|
|
134
134
|
if (fileType !== 'WAVE' && fileType !== 'AVI') {
|
|
135
135
|
throw new Error(`File type ${fileType} not supported`);
|
|
136
136
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseIsft = void 0;
|
|
4
4
|
const parseIsft = ({ iterator, size, }) => {
|
|
5
5
|
const { expectNoMoreBytes } = iterator.startBox(size);
|
|
6
|
-
const software = iterator.getByteString(size - 1);
|
|
6
|
+
const software = iterator.getByteString(size - 1, false);
|
|
7
7
|
const last = iterator.getUint8();
|
|
8
8
|
if (last !== 0) {
|
|
9
9
|
throw new Error(`Expected 0 byte, got ${last}`);
|
|
@@ -4,7 +4,7 @@ exports.parseListBox = void 0;
|
|
|
4
4
|
const parse_box_1 = require("./parse-box");
|
|
5
5
|
const parseListBox = async ({ iterator, size, state, }) => {
|
|
6
6
|
const counter = iterator.counter.getOffset();
|
|
7
|
-
const listType = iterator.getByteString(4);
|
|
7
|
+
const listType = iterator.getByteString(4, false);
|
|
8
8
|
if (listType === 'movi') {
|
|
9
9
|
throw new Error('should not be handled here');
|
|
10
10
|
}
|
|
@@ -91,7 +91,7 @@ const parseMovi = async ({ iterator, maxOffset, state, structure, }) => {
|
|
|
91
91
|
},
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
const ckId = iterator.getByteString(4);
|
|
94
|
+
const ckId = iterator.getByteString(4, false);
|
|
95
95
|
const ckSize = iterator.getUint32Le();
|
|
96
96
|
if ((0, may_skip_video_data_1.maySkipVideoData)({
|
|
97
97
|
state,
|
|
@@ -29,7 +29,7 @@ const parseStrfVideo = ({ iterator, size, }) => {
|
|
|
29
29
|
const height = iterator.getInt32Le();
|
|
30
30
|
const planes = iterator.getUint16Le();
|
|
31
31
|
const bitCount = iterator.getUint16Le();
|
|
32
|
-
const compression = iterator.getByteString(4);
|
|
32
|
+
const compression = iterator.getByteString(4, false);
|
|
33
33
|
const sizeImage = iterator.getUint32Le();
|
|
34
34
|
const xPelsPerMeter = iterator.getInt32Le();
|
|
35
35
|
const yPelsPerMeter = iterator.getInt32Le();
|
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseStrh = void 0;
|
|
4
4
|
const parseStrh = ({ iterator, size, }) => {
|
|
5
5
|
const box = iterator.startBox(size);
|
|
6
|
-
const fccType = iterator.getByteString(4);
|
|
6
|
+
const fccType = iterator.getByteString(4, false);
|
|
7
7
|
if (fccType !== 'vids' && fccType !== 'auds') {
|
|
8
8
|
throw new Error('Expected AVI handler to be vids / auds');
|
|
9
9
|
}
|
|
10
|
-
const handler = fccType === 'vids'
|
|
10
|
+
const handler = fccType === 'vids'
|
|
11
|
+
? iterator.getByteString(4, false)
|
|
12
|
+
: iterator.getUint32Le();
|
|
11
13
|
if (typeof handler === 'string' && handler !== 'H264') {
|
|
12
14
|
throw new Error(`Only H264 is supported as a stream type in .avi, got ${handler}`);
|
|
13
15
|
}
|
|
@@ -48,7 +48,7 @@ const getAudioDescription = (track) => {
|
|
|
48
48
|
// type
|
|
49
49
|
bufferIterator.getUint8();
|
|
50
50
|
// vorbis
|
|
51
|
-
const vorbis = bufferIterator.getByteString(6);
|
|
51
|
+
const vorbis = bufferIterator.getByteString(6, false);
|
|
52
52
|
if (vorbis !== 'vorbis') {
|
|
53
53
|
throw new Error('Error parsing vorbis codec private');
|
|
54
54
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const measureEBMLVarInt: (value: number) =>
|
|
1
|
+
export declare const measureEBMLVarInt: (value: number) => 4 | 2 | 1 | 3 | 5 | 6;
|
|
2
2
|
export declare const getVariableInt: (value: number, minWidth: number | null) => Uint8Array;
|
|
@@ -348,6 +348,10 @@ export declare const seekId: {
|
|
|
348
348
|
readonly name: "SeekID";
|
|
349
349
|
readonly type: "hex-string";
|
|
350
350
|
};
|
|
351
|
+
export declare const _name: {
|
|
352
|
+
readonly name: "Name";
|
|
353
|
+
readonly type: "string";
|
|
354
|
+
};
|
|
351
355
|
export declare const seekPosition: {
|
|
352
356
|
readonly name: "SeekPosition";
|
|
353
357
|
readonly type: "uint";
|
|
@@ -520,6 +524,10 @@ export declare const referenceBlock: {
|
|
|
520
524
|
readonly name: "ReferenceBlock";
|
|
521
525
|
readonly type: "uint";
|
|
522
526
|
};
|
|
527
|
+
export declare const blockDurationSegment: {
|
|
528
|
+
readonly name: "BlockDuration";
|
|
529
|
+
readonly type: "uint";
|
|
530
|
+
};
|
|
523
531
|
export declare const blockElement: {
|
|
524
532
|
readonly name: "Block";
|
|
525
533
|
readonly type: "uint8array";
|
|
@@ -759,6 +767,10 @@ export declare const ebmlMap: {
|
|
|
759
767
|
readonly name: "SeekID";
|
|
760
768
|
readonly type: "hex-string";
|
|
761
769
|
};
|
|
770
|
+
readonly "0x536e": {
|
|
771
|
+
readonly name: "Name";
|
|
772
|
+
readonly type: "string";
|
|
773
|
+
};
|
|
762
774
|
readonly "0x53ac": {
|
|
763
775
|
readonly name: "SeekPosition";
|
|
764
776
|
readonly type: "uint";
|
|
@@ -875,6 +887,10 @@ export declare const ebmlMap: {
|
|
|
875
887
|
readonly name: "CodecPrivate";
|
|
876
888
|
readonly type: "uint8array";
|
|
877
889
|
};
|
|
890
|
+
readonly "0x9b": {
|
|
891
|
+
readonly name: "BlockDuration";
|
|
892
|
+
readonly type: "uint";
|
|
893
|
+
};
|
|
878
894
|
readonly "0x75a1": {
|
|
879
895
|
readonly name: "BlockAdditions";
|
|
880
896
|
readonly type: "uint8array";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.incrementOffsetAndChildren = exports.ebmlMap = exports.tagStringType = exports.tagNameType = exports.simpleTagType = exports.targetsType = exports.cluster = exports.segment = exports.blockGroup = exports.simpleBlock = exports.block = exports.timestampEntry = exports.tracks = exports.trackEntry = exports.trackTimestampScale = exports.codecName = exports.blockElement = exports.referenceBlock = exports.flagDefault = exports.videoSegment = exports.audioSegment = exports.maxBlockAdditionIdSegment = exports.blockAdditionsSegment = exports.codecPrivate = exports.defaultDuration = void 0;
|
|
3
|
+
exports.ChromaSitingVert = exports.ChromaSitingHorz = exports.range = exports.primaries = exports.matrixCoefficients = exports.transferCharacteristics = exports.color = exports.trackUID = exports.trackNumber = exports.tags = exports.tagSegment = exports.flagLacing = exports.displayHeight = exports.displayWidth = exports.bitDepth = exports.interlaced = exports.alphaMode = exports.channels = exports.samplingFrequency = exports.tagTrackUidType = exports.titleType = exports.infoType = exports.writingApp = exports.timestampScale = exports.duration = exports.muxingApp = exports.heightType = exports.widthType = exports.trackType = exports.codecID = exports.voidHeader = exports.seekHead = exports.seek = exports.seekPosition = exports._name = exports.seekId = exports.matroskaHeader = exports.docTypeReadVersion = exports.docTypeVersion = exports.docType = exports.ebmlMaxSizeLength = exports.ebmlMaxIdLength = exports.ebmlReadVersion = exports.ebmlVersion = exports.getIdForName = exports.getSegmentName = exports.knownIdsWithThreeLength = exports.knownIdsWithTwoLength = exports.knownIdsWithOneLength = exports.matroskaElements = void 0;
|
|
4
|
+
exports.incrementOffsetAndChildren = exports.ebmlMap = exports.tagStringType = exports.tagNameType = exports.simpleTagType = exports.targetsType = exports.cluster = exports.segment = exports.blockGroup = exports.simpleBlock = exports.block = exports.timestampEntry = exports.tracks = exports.trackEntry = exports.trackTimestampScale = exports.codecName = exports.blockElement = exports.blockDurationSegment = exports.referenceBlock = exports.flagDefault = exports.videoSegment = exports.audioSegment = exports.maxBlockAdditionIdSegment = exports.blockAdditionsSegment = exports.codecPrivate = exports.defaultDuration = exports.language = void 0;
|
|
5
5
|
exports.matroskaElements = {
|
|
6
6
|
Header: '0x1a45dfa3',
|
|
7
7
|
EBMLMaxIDLength: '0x42f2',
|
|
@@ -331,6 +331,10 @@ exports.seekId = {
|
|
|
331
331
|
name: 'SeekID',
|
|
332
332
|
type: 'hex-string',
|
|
333
333
|
};
|
|
334
|
+
exports._name = {
|
|
335
|
+
name: 'Name',
|
|
336
|
+
type: 'string',
|
|
337
|
+
};
|
|
334
338
|
exports.seekPosition = {
|
|
335
339
|
name: 'SeekPosition',
|
|
336
340
|
type: 'uint',
|
|
@@ -503,6 +507,10 @@ exports.referenceBlock = {
|
|
|
503
507
|
name: 'ReferenceBlock',
|
|
504
508
|
type: 'uint',
|
|
505
509
|
};
|
|
510
|
+
exports.blockDurationSegment = {
|
|
511
|
+
name: 'BlockDuration',
|
|
512
|
+
type: 'uint',
|
|
513
|
+
};
|
|
506
514
|
exports.blockElement = {
|
|
507
515
|
name: 'Block',
|
|
508
516
|
type: 'uint8array',
|
|
@@ -643,6 +651,7 @@ exports.ebmlMap = {
|
|
|
643
651
|
[exports.matroskaElements.SeekHead]: exports.seekHead,
|
|
644
652
|
[exports.matroskaElements.Seek]: exports.seek,
|
|
645
653
|
[exports.matroskaElements.SeekID]: exports.seekId,
|
|
654
|
+
[exports.matroskaElements.Name]: exports._name,
|
|
646
655
|
[exports.matroskaElements.SeekPosition]: exports.seekPosition,
|
|
647
656
|
[exports.matroskaElements.Crc32]: {
|
|
648
657
|
name: 'Crc32',
|
|
@@ -684,6 +693,7 @@ exports.ebmlMap = {
|
|
|
684
693
|
[exports.matroskaElements.Language]: exports.language,
|
|
685
694
|
[exports.matroskaElements.DefaultDuration]: exports.defaultDuration,
|
|
686
695
|
[exports.matroskaElements.CodecPrivate]: exports.codecPrivate,
|
|
696
|
+
[exports.matroskaElements.BlockDuration]: exports.blockDurationSegment,
|
|
687
697
|
[exports.matroskaElements.BlockAdditions]: exports.blockAdditionsSegment,
|
|
688
698
|
[exports.matroskaElements.MaxBlockAdditionID]: exports.maxBlockAdditionIdSegment,
|
|
689
699
|
[exports.matroskaElements.Audio]: exports.audioSegment,
|
|
@@ -25,7 +25,7 @@ export declare const getArrayBufferIterator: (initialData: Uint8Array, maxBytes:
|
|
|
25
25
|
discard: (length: number) => void;
|
|
26
26
|
getEightByteNumber: (littleEndian?: boolean) => number;
|
|
27
27
|
getFourByteNumber: () => number;
|
|
28
|
-
getSlice: (amount: number) => Uint8Array
|
|
28
|
+
getSlice: (amount: number) => Uint8Array;
|
|
29
29
|
getAtom: () => string;
|
|
30
30
|
detectFileType: () => import("./file-types/detect-file-type").FileType;
|
|
31
31
|
getPaddedFourByteNumber: () => number;
|
|
@@ -47,7 +47,7 @@ export declare const getArrayBufferIterator: (initialData: Uint8Array, maxBytes:
|
|
|
47
47
|
getFixedPointSigned230Number: () => number;
|
|
48
48
|
getPascalString: () => number[];
|
|
49
49
|
getUint(length: number): number;
|
|
50
|
-
getByteString(length: number): string;
|
|
50
|
+
getByteString(length: number, trimTrailingZeroes: boolean): string;
|
|
51
51
|
getFloat64: () => number;
|
|
52
52
|
readUntilNullTerminator: () => string;
|
|
53
53
|
getFloat32: () => number;
|
package/dist/buffer-iterator.js
CHANGED
|
@@ -491,8 +491,14 @@ const getArrayBufferIterator = (initialData, maxBytes) => {
|
|
|
491
491
|
const numbers = [...Array.from(new Uint8Array(bytes))];
|
|
492
492
|
return numbers.reduce((acc, byte, index) => acc + (byte << (8 * (numbers.length - index - 1))), 0);
|
|
493
493
|
},
|
|
494
|
-
getByteString(length) {
|
|
495
|
-
|
|
494
|
+
getByteString(length, trimTrailingZeroes) {
|
|
495
|
+
let bytes = getSlice(length);
|
|
496
|
+
// This file has trailing zeroes throughout
|
|
497
|
+
// https://github.com/remotion-dev/remotion/issues/4668#issuecomment-2561904068
|
|
498
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
499
|
+
while (trimTrailingZeroes && bytes[bytes.length - 1] === 0) {
|
|
500
|
+
bytes = bytes.slice(0, -1);
|
|
501
|
+
}
|
|
496
502
|
return new TextDecoder().decode(bytes).trim();
|
|
497
503
|
},
|
|
498
504
|
getFloat64: () => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -663,6 +663,10 @@ var seekId = {
|
|
|
663
663
|
name: "SeekID",
|
|
664
664
|
type: "hex-string"
|
|
665
665
|
};
|
|
666
|
+
var _name = {
|
|
667
|
+
name: "Name",
|
|
668
|
+
type: "string"
|
|
669
|
+
};
|
|
666
670
|
var seekPosition = {
|
|
667
671
|
name: "SeekPosition",
|
|
668
672
|
type: "uint"
|
|
@@ -823,6 +827,10 @@ var referenceBlock = {
|
|
|
823
827
|
name: "ReferenceBlock",
|
|
824
828
|
type: "uint"
|
|
825
829
|
};
|
|
830
|
+
var blockDurationSegment = {
|
|
831
|
+
name: "BlockDuration",
|
|
832
|
+
type: "uint"
|
|
833
|
+
};
|
|
826
834
|
var codecName = {
|
|
827
835
|
name: "CodecName",
|
|
828
836
|
type: "string"
|
|
@@ -947,6 +955,7 @@ var ebmlMap = {
|
|
|
947
955
|
[matroskaElements.SeekHead]: seekHead,
|
|
948
956
|
[matroskaElements.Seek]: seek,
|
|
949
957
|
[matroskaElements.SeekID]: seekId,
|
|
958
|
+
[matroskaElements.Name]: _name,
|
|
950
959
|
[matroskaElements.SeekPosition]: seekPosition,
|
|
951
960
|
[matroskaElements.Crc32]: {
|
|
952
961
|
name: "Crc32",
|
|
@@ -988,6 +997,7 @@ var ebmlMap = {
|
|
|
988
997
|
[matroskaElements.Language]: language,
|
|
989
998
|
[matroskaElements.DefaultDuration]: defaultDuration,
|
|
990
999
|
[matroskaElements.CodecPrivate]: codecPrivate,
|
|
1000
|
+
[matroskaElements.BlockDuration]: blockDurationSegment,
|
|
991
1001
|
[matroskaElements.BlockAdditions]: blockAdditionsSegment,
|
|
992
1002
|
[matroskaElements.MaxBlockAdditionID]: maxBlockAdditionIdSegment,
|
|
993
1003
|
[matroskaElements.Audio]: audioSegment,
|
|
@@ -1367,7 +1377,7 @@ var createIsoBaseMediaFtyp = ({
|
|
|
1367
1377
|
};
|
|
1368
1378
|
|
|
1369
1379
|
// src/version.ts
|
|
1370
|
-
var VERSION = "4.0.
|
|
1380
|
+
var VERSION = "4.0.244";
|
|
1371
1381
|
|
|
1372
1382
|
// src/create/iso-base-media/create-ilst.ts
|
|
1373
1383
|
var createIlst = (items) => {
|
|
@@ -5143,8 +5153,11 @@ var getArrayBufferIterator = (initialData, maxBytes) => {
|
|
|
5143
5153
|
const numbers = [...Array.from(new Uint8Array(bytes))];
|
|
5144
5154
|
return numbers.reduce((acc, byte, index) => acc + (byte << 8 * (numbers.length - index - 1)), 0);
|
|
5145
5155
|
},
|
|
5146
|
-
getByteString(length) {
|
|
5147
|
-
|
|
5156
|
+
getByteString(length, trimTrailingZeroes) {
|
|
5157
|
+
let bytes = getSlice(length);
|
|
5158
|
+
while (trimTrailingZeroes && bytes[bytes.length - 1] === 0) {
|
|
5159
|
+
bytes = bytes.slice(0, -1);
|
|
5160
|
+
}
|
|
5148
5161
|
return new TextDecoder().decode(bytes).trim();
|
|
5149
5162
|
},
|
|
5150
5163
|
getFloat64: () => {
|
|
@@ -5731,7 +5744,7 @@ var getAudioDescription = (track) => {
|
|
|
5731
5744
|
const vorbisBooks = privateData.slice(offset);
|
|
5732
5745
|
const bufferIterator = getArrayBufferIterator(vorbisInfo.slice(0), vorbisInfo.length);
|
|
5733
5746
|
bufferIterator.getUint8();
|
|
5734
|
-
const vorbis = bufferIterator.getByteString(6);
|
|
5747
|
+
const vorbis = bufferIterator.getByteString(6, false);
|
|
5735
5748
|
if (vorbis !== "vorbis") {
|
|
5736
5749
|
throw new Error("Error parsing vorbis codec private");
|
|
5737
5750
|
}
|
|
@@ -7195,12 +7208,12 @@ var parseFtyp = ({
|
|
|
7195
7208
|
size,
|
|
7196
7209
|
offset
|
|
7197
7210
|
}) => {
|
|
7198
|
-
const majorBrand = iterator.getByteString(4);
|
|
7211
|
+
const majorBrand = iterator.getByteString(4, false);
|
|
7199
7212
|
const minorVersion = iterator.getFourByteNumber();
|
|
7200
7213
|
const types = (size - iterator.counter.getOffset()) / 4;
|
|
7201
7214
|
const compatibleBrands = [];
|
|
7202
7215
|
for (let i = 0;i < types; i++) {
|
|
7203
|
-
compatibleBrands.push(iterator.getByteString(4).trim());
|
|
7216
|
+
compatibleBrands.push(iterator.getByteString(4, false).trim());
|
|
7204
7217
|
}
|
|
7205
7218
|
const offsetAtEnd = iterator.counter.getOffset();
|
|
7206
7219
|
return {
|
|
@@ -7386,7 +7399,7 @@ var parseHdlr = ({
|
|
|
7386
7399
|
}
|
|
7387
7400
|
iterator.discard(3);
|
|
7388
7401
|
iterator.discard(4);
|
|
7389
|
-
const hdlrType = iterator.getByteString(4);
|
|
7402
|
+
const hdlrType = iterator.getByteString(4, false);
|
|
7390
7403
|
iterator.discard(4);
|
|
7391
7404
|
iterator.discard(4);
|
|
7392
7405
|
iterator.discard(4);
|
|
@@ -7404,7 +7417,7 @@ var parseHdlr = ({
|
|
|
7404
7417
|
// src/boxes/iso-base-media/meta/ilst.ts
|
|
7405
7418
|
var parseFromWellKnownType = (wellKnownType, iterator, size) => {
|
|
7406
7419
|
if (wellKnownType === 1) {
|
|
7407
|
-
const value = iterator.getByteString(size);
|
|
7420
|
+
const value = iterator.getByteString(size, false);
|
|
7408
7421
|
return { type: "text", value };
|
|
7409
7422
|
}
|
|
7410
7423
|
if (wellKnownType === 21) {
|
|
@@ -7615,33 +7628,33 @@ var parseIccProfile = (data) => {
|
|
|
7615
7628
|
if (size !== data.length) {
|
|
7616
7629
|
throw new Error("Invalid ICC profile size");
|
|
7617
7630
|
}
|
|
7618
|
-
const preferredCMMType = iterator.getByteString(4);
|
|
7619
|
-
const profileVersion = iterator.getByteString(4);
|
|
7620
|
-
const profileDeviceClass = iterator.getByteString(4);
|
|
7621
|
-
const colorSpace = iterator.getByteString(4);
|
|
7622
|
-
const pcs = iterator.getByteString(4);
|
|
7631
|
+
const preferredCMMType = iterator.getByteString(4, false);
|
|
7632
|
+
const profileVersion = iterator.getByteString(4, false);
|
|
7633
|
+
const profileDeviceClass = iterator.getByteString(4, false);
|
|
7634
|
+
const colorSpace = iterator.getByteString(4, false);
|
|
7635
|
+
const pcs = iterator.getByteString(4, false);
|
|
7623
7636
|
const dateTime = iterator.getSlice(12);
|
|
7624
|
-
const signature = iterator.getByteString(4);
|
|
7637
|
+
const signature = iterator.getByteString(4, false);
|
|
7625
7638
|
if (signature !== "acsp") {
|
|
7626
7639
|
throw new Error("Invalid ICC profile signature");
|
|
7627
7640
|
}
|
|
7628
|
-
const primaryPlatform = iterator.getByteString(4);
|
|
7641
|
+
const primaryPlatform = iterator.getByteString(4, false);
|
|
7629
7642
|
const profileFlags = iterator.getUint32();
|
|
7630
|
-
const deviceManufacturer = iterator.getByteString(4);
|
|
7631
|
-
const deviceModel = iterator.getByteString(4);
|
|
7643
|
+
const deviceManufacturer = iterator.getByteString(4, false);
|
|
7644
|
+
const deviceModel = iterator.getByteString(4, false);
|
|
7632
7645
|
const deviceAttributes = iterator.getUint64();
|
|
7633
7646
|
const renderingIntent = iterator.getUint32();
|
|
7634
7647
|
const pcsIlluminant1 = iterator.getUint32();
|
|
7635
7648
|
const pcsIlluminant2 = iterator.getUint32();
|
|
7636
7649
|
const pcsIlluminant3 = iterator.getUint32();
|
|
7637
|
-
const profileCreator = iterator.getByteString(4);
|
|
7638
|
-
const profileId = iterator.getByteString(16);
|
|
7650
|
+
const profileCreator = iterator.getByteString(4, false);
|
|
7651
|
+
const profileId = iterator.getByteString(16, false);
|
|
7639
7652
|
iterator.discard(28);
|
|
7640
7653
|
const tagCount = iterator.getUint32();
|
|
7641
7654
|
const entries = [];
|
|
7642
7655
|
for (let i = 0;i < tagCount; i++) {
|
|
7643
7656
|
const entry = {
|
|
7644
|
-
tag: iterator.getByteString(4),
|
|
7657
|
+
tag: iterator.getByteString(4, false),
|
|
7645
7658
|
offset: iterator.getUint32(),
|
|
7646
7659
|
size: iterator.getUint32()
|
|
7647
7660
|
};
|
|
@@ -7718,7 +7731,7 @@ var parseColorParameterBox = ({
|
|
|
7718
7731
|
iterator,
|
|
7719
7732
|
size
|
|
7720
7733
|
}) => {
|
|
7721
|
-
const byteString = iterator.getByteString(4);
|
|
7734
|
+
const byteString = iterator.getByteString(4, false);
|
|
7722
7735
|
if (byteString === "nclx") {
|
|
7723
7736
|
const primaries2 = iterator.getUint16();
|
|
7724
7737
|
const transfer = iterator.getUint16();
|
|
@@ -7824,7 +7837,7 @@ var parseKeys = ({
|
|
|
7824
7837
|
for (let i = 0;i < entryCount; i++) {
|
|
7825
7838
|
const keySize = iterator.getUint32();
|
|
7826
7839
|
const namespace = iterator.getAtom();
|
|
7827
|
-
const value = iterator.getByteString(keySize - 8);
|
|
7840
|
+
const value = iterator.getByteString(keySize - 8, false);
|
|
7828
7841
|
const entry = {
|
|
7829
7842
|
keySize,
|
|
7830
7843
|
namespace,
|
|
@@ -8752,7 +8765,7 @@ var processBox = async ({
|
|
|
8752
8765
|
skipTo: null
|
|
8753
8766
|
};
|
|
8754
8767
|
}
|
|
8755
|
-
const boxType = iterator.getByteString(4);
|
|
8768
|
+
const boxType = iterator.getByteString(4, false);
|
|
8756
8769
|
const boxSize = boxSizeRaw === 1 ? iterator.getEightByteNumber() : boxSizeRaw;
|
|
8757
8770
|
if (bytesRemaining < boxSize) {
|
|
8758
8771
|
if (boxType === "mdat") {
|
|
@@ -9331,7 +9344,7 @@ var isMoviAtom = (iterator, ckId) => {
|
|
|
9331
9344
|
if (ckId !== "LIST") {
|
|
9332
9345
|
return false;
|
|
9333
9346
|
}
|
|
9334
|
-
const listType = iterator.getByteString(4);
|
|
9347
|
+
const listType = iterator.getByteString(4, false);
|
|
9335
9348
|
iterator.counter.decrement(4);
|
|
9336
9349
|
return listType === "movi";
|
|
9337
9350
|
};
|
|
@@ -9663,7 +9676,7 @@ var parseMovi = async ({
|
|
|
9663
9676
|
}
|
|
9664
9677
|
};
|
|
9665
9678
|
}
|
|
9666
|
-
const ckId = iterator.getByteString(4);
|
|
9679
|
+
const ckId = iterator.getByteString(4, false);
|
|
9667
9680
|
const ckSize = iterator.getUint32Le();
|
|
9668
9681
|
if (maySkipVideoData({
|
|
9669
9682
|
state
|
|
@@ -9787,7 +9800,7 @@ var parseIsft = ({
|
|
|
9787
9800
|
size
|
|
9788
9801
|
}) => {
|
|
9789
9802
|
const { expectNoMoreBytes } = iterator.startBox(size);
|
|
9790
|
-
const software = iterator.getByteString(size - 1);
|
|
9803
|
+
const software = iterator.getByteString(size - 1, false);
|
|
9791
9804
|
const last = iterator.getUint8();
|
|
9792
9805
|
if (last !== 0) {
|
|
9793
9806
|
throw new Error(`Expected 0 byte, got ${last}`);
|
|
@@ -9806,7 +9819,7 @@ var parseListBox = async ({
|
|
|
9806
9819
|
state
|
|
9807
9820
|
}) => {
|
|
9808
9821
|
const counter = iterator.counter.getOffset();
|
|
9809
|
-
const listType = iterator.getByteString(4);
|
|
9822
|
+
const listType = iterator.getByteString(4, false);
|
|
9810
9823
|
if (listType === "movi") {
|
|
9811
9824
|
throw new Error("should not be handled here");
|
|
9812
9825
|
}
|
|
@@ -9865,7 +9878,7 @@ var parseStrfVideo = ({
|
|
|
9865
9878
|
const height = iterator.getInt32Le();
|
|
9866
9879
|
const planes = iterator.getUint16Le();
|
|
9867
9880
|
const bitCount = iterator.getUint16Le();
|
|
9868
|
-
const compression = iterator.getByteString(4);
|
|
9881
|
+
const compression = iterator.getByteString(4, false);
|
|
9869
9882
|
const sizeImage = iterator.getUint32Le();
|
|
9870
9883
|
const xPelsPerMeter = iterator.getInt32Le();
|
|
9871
9884
|
const yPelsPerMeter = iterator.getInt32Le();
|
|
@@ -9911,11 +9924,11 @@ var parseStrh = ({
|
|
|
9911
9924
|
size
|
|
9912
9925
|
}) => {
|
|
9913
9926
|
const box = iterator.startBox(size);
|
|
9914
|
-
const fccType = iterator.getByteString(4);
|
|
9927
|
+
const fccType = iterator.getByteString(4, false);
|
|
9915
9928
|
if (fccType !== "vids" && fccType !== "auds") {
|
|
9916
9929
|
throw new Error("Expected AVI handler to be vids / auds");
|
|
9917
9930
|
}
|
|
9918
|
-
const handler = fccType === "vids" ? iterator.getByteString(4) : iterator.getUint32Le();
|
|
9931
|
+
const handler = fccType === "vids" ? iterator.getByteString(4, false) : iterator.getUint32Le();
|
|
9919
9932
|
if (typeof handler === "string" && handler !== "H264") {
|
|
9920
9933
|
throw new Error(`Only H264 is supported as a stream type in .avi, got ${handler}`);
|
|
9921
9934
|
}
|
|
@@ -10001,7 +10014,7 @@ var expectRiffBox = async ({
|
|
|
10001
10014
|
}
|
|
10002
10015
|
};
|
|
10003
10016
|
}
|
|
10004
|
-
const ckId = iterator.getByteString(4);
|
|
10017
|
+
const ckId = iterator.getByteString(4, false);
|
|
10005
10018
|
const ckSize = iterator.getUint32Le();
|
|
10006
10019
|
if (isMoviAtom(iterator, ckId)) {
|
|
10007
10020
|
iterator.discard(4);
|
|
@@ -10159,7 +10172,7 @@ var parseRiff = ({
|
|
|
10159
10172
|
state,
|
|
10160
10173
|
fields
|
|
10161
10174
|
}) => {
|
|
10162
|
-
const riff = iterator.getByteString(4);
|
|
10175
|
+
const riff = iterator.getByteString(4, false);
|
|
10163
10176
|
if (riff !== "RIFF") {
|
|
10164
10177
|
throw new Error("Not a RIFF file");
|
|
10165
10178
|
}
|
|
@@ -10168,7 +10181,7 @@ var parseRiff = ({
|
|
|
10168
10181
|
throw new Error("Structure is not a RIFF structure");
|
|
10169
10182
|
}
|
|
10170
10183
|
const size = iterator.getUint32Le();
|
|
10171
|
-
const fileType = iterator.getByteString(4);
|
|
10184
|
+
const fileType = iterator.getByteString(4, false);
|
|
10172
10185
|
if (fileType !== "WAVE" && fileType !== "AVI") {
|
|
10173
10186
|
throw new Error(`File type ${fileType} not supported`);
|
|
10174
10187
|
}
|
|
@@ -11090,7 +11103,7 @@ var parseEbml = async (iterator, state) => {
|
|
|
11090
11103
|
};
|
|
11091
11104
|
}
|
|
11092
11105
|
if (hasInMap.type === "string") {
|
|
11093
|
-
const value = iterator.getByteString(size);
|
|
11106
|
+
const value = iterator.getByteString(size, true);
|
|
11094
11107
|
return {
|
|
11095
11108
|
type: hasInMap.name,
|
|
11096
11109
|
value,
|
|
@@ -11,7 +11,7 @@ type AudioCodecInfo = {
|
|
|
11
11
|
secondarySpecificator: number | null;
|
|
12
12
|
description: Uint8Array | undefined;
|
|
13
13
|
};
|
|
14
|
-
export declare const getCodecPrivateFromTrak: (trakBox: TrakBox) => Uint8Array
|
|
14
|
+
export declare const getCodecPrivateFromTrak: (trakBox: TrakBox) => Uint8Array | null;
|
|
15
15
|
export declare const getNumberOfChannelsFromTrak: (trak: TrakBox) => number | null;
|
|
16
16
|
export declare const getSampleRate: (trak: TrakBox) => number | null;
|
|
17
17
|
export declare const getAudioCodecFromTrak: (trak: TrakBox) => AudioCodecInfo | null;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.244";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-parser"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/media-parser",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.244",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/wicg-file-system-access": "2023.10.5",
|
|
11
11
|
"eslint": "9.14.0",
|
|
12
|
-
"@remotion/example-videos": "4.0.
|
|
13
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
12
|
+
"@remotion/example-videos": "4.0.244",
|
|
13
|
+
"@remotion/eslint-config-internal": "4.0.244"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|