@remotion/media-parser 4.0.216 → 4.0.217
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/webm/ebml.d.ts +1 -1
- package/package.json +2 -2
- package/dist/boxes/webm/get-track.d.ts +0 -6
- package/dist/boxes/webm/get-track.js +0 -184
- package/dist/from-fetch.d.ts +0 -2
- package/dist/from-fetch.js +0 -64
- package/dist/from-node.d.ts +0 -2
- package/dist/from-node.js +0 -40
- package/dist/from-web-file.d.ts +0 -2
- package/dist/from-web-file.js +0 -39
- package/dist/reader.d.ts +0 -11
- package/dist/reader.js +0 -2
- package/dist/traversal.d.ts +0 -65
- package/dist/traversal.js +0 -368
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const measureEBMLVarInt: (value: number) => 1 | 2 |
|
|
1
|
+
export declare const measureEBMLVarInt: (value: number) => 1 | 2 | 3 | 4 | 5 | 6;
|
|
2
2
|
export declare const getVariableInt: (value: number, minWidth: number | null) => Uint8Array;
|
package/package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
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.217",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/wicg-file-system-access": "2023.10.5",
|
|
11
|
-
"@remotion/renderer": "4.0.
|
|
11
|
+
"@remotion/renderer": "4.0.217"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTrack = void 0;
|
|
4
|
-
const buffer_iterator_1 = require("../../buffer-iterator");
|
|
5
|
-
const make_hvc1_codec_strings_1 = require("../../make-hvc1-codec-strings");
|
|
6
|
-
const traversal_1 = require("../../traversal");
|
|
7
|
-
const av1_codec_private_1 = require("./av1-codec-private");
|
|
8
|
-
const description_1 = require("./description");
|
|
9
|
-
const track_entry_1 = require("./segments/track-entry");
|
|
10
|
-
const getDescription = (track) => {
|
|
11
|
-
const codec = (0, traversal_1.getCodecSegment)(track);
|
|
12
|
-
if (!codec) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
if (codec.value === 'V_MPEG4/ISO/AVC' || codec.value === 'V_MPEGH/ISO/HEVC') {
|
|
16
|
-
const priv = (0, traversal_1.getPrivateData)(track);
|
|
17
|
-
if (priv) {
|
|
18
|
-
return priv;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return undefined;
|
|
22
|
-
};
|
|
23
|
-
const getMatroskaVideoCodecString = ({ track, codecSegment: codec, }) => {
|
|
24
|
-
if (codec.value === 'V_VP8') {
|
|
25
|
-
return 'vp8';
|
|
26
|
-
}
|
|
27
|
-
if (codec.value === 'V_VP9') {
|
|
28
|
-
const priv = (0, traversal_1.getPrivateData)(track);
|
|
29
|
-
if (priv) {
|
|
30
|
-
throw new Error('@remotion/media-parser cannot handle the private data for VP9. Do you have an example file you could send so we can implement it?');
|
|
31
|
-
}
|
|
32
|
-
return 'vp09.00.10.08';
|
|
33
|
-
}
|
|
34
|
-
if (codec.value === 'V_MPEG4/ISO/AVC') {
|
|
35
|
-
const priv = (0, traversal_1.getPrivateData)(track);
|
|
36
|
-
if (priv) {
|
|
37
|
-
return `avc1.${priv[1].toString(16).padStart(2, '0')}${priv[2].toString(16).padStart(2, '0')}${priv[3].toString(16).padStart(2, '0')}`;
|
|
38
|
-
}
|
|
39
|
-
throw new Error('Could not find a CodecPrivate field in TrackEntry');
|
|
40
|
-
}
|
|
41
|
-
if (codec.value === 'V_AV1') {
|
|
42
|
-
const priv = (0, traversal_1.getPrivateData)(track);
|
|
43
|
-
if (!priv) {
|
|
44
|
-
throw new Error('Expected private data in AV1 track');
|
|
45
|
-
}
|
|
46
|
-
return (0, av1_codec_private_1.parseAv1PrivateData)(priv, null);
|
|
47
|
-
}
|
|
48
|
-
if (codec.value === 'V_MPEGH/ISO/HEVC') {
|
|
49
|
-
const priv = (0, traversal_1.getPrivateData)(track);
|
|
50
|
-
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)(priv, priv.length);
|
|
51
|
-
return 'hvc1.' + (0, make_hvc1_codec_strings_1.getHvc1CodecString)(iterator);
|
|
52
|
-
}
|
|
53
|
-
throw new Error(`Unknown codec: ${codec.value}`);
|
|
54
|
-
};
|
|
55
|
-
const getMatroskaAudioCodecString = (track) => {
|
|
56
|
-
const codec = (0, traversal_1.getCodecSegment)(track);
|
|
57
|
-
if (!codec) {
|
|
58
|
-
throw new Error('Expected codec segment');
|
|
59
|
-
}
|
|
60
|
-
if (codec.value === 'A_OPUS') {
|
|
61
|
-
return 'opus';
|
|
62
|
-
}
|
|
63
|
-
if (codec.value === 'A_VORBIS') {
|
|
64
|
-
return 'vorbis';
|
|
65
|
-
}
|
|
66
|
-
if (codec.value === 'A_PCM/INT/LIT') {
|
|
67
|
-
// https://github.com/ietf-wg-cellar/matroska-specification/issues/142#issuecomment-330004950
|
|
68
|
-
// Audio samples MUST be considered as signed values, except if the audio bit depth is 8 which MUST be interpreted as unsigned values.
|
|
69
|
-
const bitDepth = (0, traversal_1.getBitDepth)(track);
|
|
70
|
-
if (bitDepth === null) {
|
|
71
|
-
throw new Error('Expected bit depth');
|
|
72
|
-
}
|
|
73
|
-
if (bitDepth === 8) {
|
|
74
|
-
return 'pcm-u8';
|
|
75
|
-
}
|
|
76
|
-
return 'pcm-s' + bitDepth;
|
|
77
|
-
}
|
|
78
|
-
if (codec.value === 'A_AAC') {
|
|
79
|
-
const priv = (0, traversal_1.getPrivateData)(track);
|
|
80
|
-
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)(priv, priv.length);
|
|
81
|
-
iterator.startReadingBits();
|
|
82
|
-
/**
|
|
83
|
-
* ChatGPT
|
|
84
|
-
* ▪ The first 5 bits represent the AOT.
|
|
85
|
-
▪ Common values:
|
|
86
|
-
◦ 1 for AAC Main
|
|
87
|
-
◦ 2 for AAC LC (Low Complexity)
|
|
88
|
-
◦ 3 for AAC SSR (Scalable Sample Rate)
|
|
89
|
-
◦ 4 for AAC LTP (Long Term Prediction)
|
|
90
|
-
◦ 5 for SBR (Spectral Band Replication)
|
|
91
|
-
◦ 29 for HE-AAC (which uses SBR with AAC LC)
|
|
92
|
-
*/
|
|
93
|
-
/**
|
|
94
|
-
* Fully qualified codec:
|
|
95
|
-
* This codec has multiple possible codec strings:
|
|
96
|
-
"mp4a.40.2" — MPEG-4 AAC LC
|
|
97
|
-
"mp4a.40.02" — MPEG-4 AAC LC, leading 0 for Aud-OTI compatibility
|
|
98
|
-
"mp4a.40.5" — MPEG-4 HE-AAC v1 (AAC LC + SBR)
|
|
99
|
-
"mp4a.40.05" — MPEG-4 HE-AAC v1 (AAC LC + SBR), leading 0 for Aud-OTI compatibility
|
|
100
|
-
"mp4a.40.29" — MPEG-4 HE-AAC v2 (AAC LC + SBR + PS)
|
|
101
|
-
"mp4a.67" — MPEG-2 AAC LC
|
|
102
|
-
*/
|
|
103
|
-
const profile = iterator.getBits(5);
|
|
104
|
-
iterator.stopReadingBits();
|
|
105
|
-
iterator.destroy();
|
|
106
|
-
return `mp4a.40.${profile.toString().padStart(2, '0')}`;
|
|
107
|
-
}
|
|
108
|
-
if (codec.value === 'A_MPEG/L3') {
|
|
109
|
-
return 'mp3';
|
|
110
|
-
}
|
|
111
|
-
throw new Error(`Unknown codec: ${codec.value}`);
|
|
112
|
-
};
|
|
113
|
-
const getTrack = ({ timescale, track, }) => {
|
|
114
|
-
const trackType = (0, traversal_1.getTrackTypeSegment)(track);
|
|
115
|
-
if (!trackType) {
|
|
116
|
-
throw new Error('Expected track type segment');
|
|
117
|
-
}
|
|
118
|
-
const trackId = (0, traversal_1.getTrackId)(track);
|
|
119
|
-
if ((0, track_entry_1.trackTypeToString)(trackType.value.value) === 'video') {
|
|
120
|
-
const width = (0, traversal_1.getWidthSegment)(track);
|
|
121
|
-
if (width === null) {
|
|
122
|
-
throw new Error('Expected width segment');
|
|
123
|
-
}
|
|
124
|
-
const height = (0, traversal_1.getHeightSegment)(track);
|
|
125
|
-
if (height === null) {
|
|
126
|
-
throw new Error('Expected height segment');
|
|
127
|
-
}
|
|
128
|
-
const displayHeight = (0, traversal_1.getDisplayHeightSegment)(track);
|
|
129
|
-
const displayWidth = (0, traversal_1.getDisplayWidthSegment)(track);
|
|
130
|
-
const codec = (0, traversal_1.getCodecSegment)(track);
|
|
131
|
-
if (!codec) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
const codecString = getMatroskaVideoCodecString({
|
|
135
|
-
track,
|
|
136
|
-
codecSegment: codec,
|
|
137
|
-
});
|
|
138
|
-
if (!codecString) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
type: 'video',
|
|
143
|
-
trackId,
|
|
144
|
-
codec: codecString,
|
|
145
|
-
description: getDescription(track),
|
|
146
|
-
height: displayHeight ? displayHeight.value.value : height.value.value,
|
|
147
|
-
width: displayWidth ? displayWidth.value.value : width.value.value,
|
|
148
|
-
sampleAspectRatio: {
|
|
149
|
-
numerator: 1,
|
|
150
|
-
denominator: 1,
|
|
151
|
-
},
|
|
152
|
-
timescale,
|
|
153
|
-
codedHeight: height.value.value,
|
|
154
|
-
codedWidth: width.value.value,
|
|
155
|
-
displayAspectHeight: displayHeight
|
|
156
|
-
? displayHeight.value.value
|
|
157
|
-
: height.value.value,
|
|
158
|
-
displayAspectWidth: displayWidth
|
|
159
|
-
? displayWidth.value.value
|
|
160
|
-
: width.value.value,
|
|
161
|
-
rotation: 0,
|
|
162
|
-
trakBox: null,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if ((0, track_entry_1.trackTypeToString)(trackType.value.value) === 'audio') {
|
|
166
|
-
const sampleRate = (0, traversal_1.getSampleRate)(track);
|
|
167
|
-
const numberOfChannels = (0, traversal_1.getNumberOfChannels)(track);
|
|
168
|
-
if (sampleRate === null) {
|
|
169
|
-
throw new Error('Could not find sample rate or number of channels');
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
type: 'audio',
|
|
173
|
-
trackId,
|
|
174
|
-
codec: getMatroskaAudioCodecString(track),
|
|
175
|
-
timescale,
|
|
176
|
-
numberOfChannels,
|
|
177
|
-
sampleRate,
|
|
178
|
-
description: (0, description_1.getAudioDescription)(track),
|
|
179
|
-
trakBox: null,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
return null;
|
|
183
|
-
};
|
|
184
|
-
exports.getTrack = getTrack;
|
package/dist/from-fetch.d.ts
DELETED
package/dist/from-fetch.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchReader = void 0;
|
|
4
|
-
exports.fetchReader = {
|
|
5
|
-
read: async (src, range, signal) => {
|
|
6
|
-
if (typeof src !== 'string') {
|
|
7
|
-
throw new Error('src must be a string when using `fetchReader`');
|
|
8
|
-
}
|
|
9
|
-
const resolvedUrl = typeof window !== 'undefined' && typeof window.location !== 'undefined'
|
|
10
|
-
? new URL(src, window.location.origin).toString()
|
|
11
|
-
: src;
|
|
12
|
-
if (!resolvedUrl.startsWith('https://') &&
|
|
13
|
-
!resolvedUrl.startsWith('http://')) {
|
|
14
|
-
return Promise.reject(new Error(resolvedUrl +
|
|
15
|
-
' is not a URL - needs to start with http:// or https://. If you want to read a local file, pass `nodeReader` to parseMedia().'));
|
|
16
|
-
}
|
|
17
|
-
const res = await fetch(resolvedUrl, {
|
|
18
|
-
headers: range === null
|
|
19
|
-
? {}
|
|
20
|
-
: typeof range === 'number'
|
|
21
|
-
? {
|
|
22
|
-
Range: `bytes=${range}`,
|
|
23
|
-
}
|
|
24
|
-
: {
|
|
25
|
-
Range: `bytes=${`${range[0]}-${range[1]}`}`,
|
|
26
|
-
},
|
|
27
|
-
signal,
|
|
28
|
-
// Disable Next.js caching
|
|
29
|
-
cache: 'no-store',
|
|
30
|
-
});
|
|
31
|
-
if (res.status.toString().startsWith('4') ||
|
|
32
|
-
res.status.toString().startsWith('5')) {
|
|
33
|
-
throw new Error(`Server returned status code ${res.status} for ${src}`);
|
|
34
|
-
}
|
|
35
|
-
if (!res.body) {
|
|
36
|
-
throw new Error('No body');
|
|
37
|
-
}
|
|
38
|
-
const length = res.headers.get('content-length');
|
|
39
|
-
const contentLength = length === null ? null : parseInt(length, 10);
|
|
40
|
-
const reader = res.body.getReader();
|
|
41
|
-
if (signal) {
|
|
42
|
-
signal.addEventListener('abort', () => {
|
|
43
|
-
reader.cancel();
|
|
44
|
-
}, { once: true });
|
|
45
|
-
}
|
|
46
|
-
return { reader, contentLength };
|
|
47
|
-
},
|
|
48
|
-
getLength: async (src) => {
|
|
49
|
-
if (typeof src !== 'string') {
|
|
50
|
-
throw new Error('src must be a string when using `fetchReader`');
|
|
51
|
-
}
|
|
52
|
-
const res = await fetch(src, {
|
|
53
|
-
method: 'HEAD',
|
|
54
|
-
});
|
|
55
|
-
if (!res.body) {
|
|
56
|
-
throw new Error('No body');
|
|
57
|
-
}
|
|
58
|
-
const length = res.headers.get('content-length');
|
|
59
|
-
if (!length) {
|
|
60
|
-
throw new Error('No content-length');
|
|
61
|
-
}
|
|
62
|
-
return parseInt(length, 10);
|
|
63
|
-
},
|
|
64
|
-
};
|
package/dist/from-node.d.ts
DELETED
package/dist/from-node.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nodeReader = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const promises_1 = require("node:fs/promises");
|
|
6
|
-
const stream_1 = require("stream");
|
|
7
|
-
exports.nodeReader = {
|
|
8
|
-
read: async (src, range, signal) => {
|
|
9
|
-
if (typeof src !== 'string') {
|
|
10
|
-
throw new Error('src must be a string when using `nodeReader`');
|
|
11
|
-
}
|
|
12
|
-
const stream = (0, fs_1.createReadStream)(src, {
|
|
13
|
-
start: range === null ? 0 : typeof range === 'number' ? range : range[0],
|
|
14
|
-
end: range === null
|
|
15
|
-
? Infinity
|
|
16
|
-
: typeof range === 'number'
|
|
17
|
-
? Infinity
|
|
18
|
-
: range[1],
|
|
19
|
-
signal,
|
|
20
|
-
});
|
|
21
|
-
const stats = await (0, promises_1.stat)(src);
|
|
22
|
-
const reader = stream_1.Readable.toWeb(stream).getReader();
|
|
23
|
-
if (signal) {
|
|
24
|
-
signal.addEventListener('abort', () => {
|
|
25
|
-
reader.cancel();
|
|
26
|
-
}, { once: true });
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
reader,
|
|
30
|
-
contentLength: stats.size,
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
getLength: async (src) => {
|
|
34
|
-
if (typeof src !== 'string') {
|
|
35
|
-
throw new Error('src must be a string when using `nodeReader`');
|
|
36
|
-
}
|
|
37
|
-
const stats = await (0, promises_1.stat)(src);
|
|
38
|
-
return stats.size;
|
|
39
|
-
},
|
|
40
|
-
};
|
package/dist/from-web-file.d.ts
DELETED
package/dist/from-web-file.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webFileReader = void 0;
|
|
4
|
-
exports.webFileReader = {
|
|
5
|
-
read: (file, range, signal) => {
|
|
6
|
-
if (typeof file === 'string') {
|
|
7
|
-
throw new Error('`inputTypeFileReader` only supports `File` objects');
|
|
8
|
-
}
|
|
9
|
-
const part = range === null
|
|
10
|
-
? file
|
|
11
|
-
: typeof range === 'number'
|
|
12
|
-
? file.slice(range)
|
|
13
|
-
: file.slice(range[0], range[1]);
|
|
14
|
-
const reader = new FileReader();
|
|
15
|
-
reader.readAsArrayBuffer(file);
|
|
16
|
-
if (signal) {
|
|
17
|
-
signal.addEventListener('abort', () => {
|
|
18
|
-
reader.abort();
|
|
19
|
-
}, { once: true });
|
|
20
|
-
}
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
reader.onload = () => {
|
|
23
|
-
resolve({
|
|
24
|
-
reader: part.stream().getReader(),
|
|
25
|
-
contentLength: file.size,
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
reader.onerror = (error) => {
|
|
29
|
-
reject(error);
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
getLength: (src) => {
|
|
34
|
-
if (typeof src === 'string') {
|
|
35
|
-
throw new Error('`inputTypeFileReader` only supports `File` objects');
|
|
36
|
-
}
|
|
37
|
-
return Promise.resolve(src.size);
|
|
38
|
-
},
|
|
39
|
-
};
|
package/dist/reader.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type ReadResult = {
|
|
2
|
-
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
3
|
-
contentLength: number | null;
|
|
4
|
-
};
|
|
5
|
-
type ReadContent = (src: string | File, range: [number, number] | number | null, signal: AbortSignal | undefined) => Promise<ReadResult>;
|
|
6
|
-
type GetLength = (src: string | File) => Promise<number>;
|
|
7
|
-
export type ReaderInterface = {
|
|
8
|
-
read: ReadContent;
|
|
9
|
-
getLength: GetLength;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
package/dist/reader.js
DELETED
package/dist/traversal.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { FtypBox } from './boxes/iso-base-media/ftyp';
|
|
2
|
-
import type { MdhdBox } from './boxes/iso-base-media/mdhd';
|
|
3
|
-
import type { MoovBox } from './boxes/iso-base-media/moov/moov';
|
|
4
|
-
import type { MvhdBox } from './boxes/iso-base-media/mvhd';
|
|
5
|
-
import type { CttsBox } from './boxes/iso-base-media/stsd/ctts';
|
|
6
|
-
import type { StcoBox } from './boxes/iso-base-media/stsd/stco';
|
|
7
|
-
import type { StscBox } from './boxes/iso-base-media/stsd/stsc';
|
|
8
|
-
import type { StsdBox } from './boxes/iso-base-media/stsd/stsd';
|
|
9
|
-
import type { StssBox } from './boxes/iso-base-media/stsd/stss';
|
|
10
|
-
import type { StszBox } from './boxes/iso-base-media/stsd/stsz';
|
|
11
|
-
import type { SttsBox } from './boxes/iso-base-media/stsd/stts';
|
|
12
|
-
import type { TfdtBox } from './boxes/iso-base-media/tfdt';
|
|
13
|
-
import type { TfhdBox } from './boxes/iso-base-media/tfhd';
|
|
14
|
-
import type { TkhdBox } from './boxes/iso-base-media/tkhd';
|
|
15
|
-
import type { TrakBox } from './boxes/iso-base-media/trak/trak';
|
|
16
|
-
import type { TrunBox } from './boxes/iso-base-media/trun';
|
|
17
|
-
import type { AudioSegment, ClusterSegment, CodecIdSegment, DisplayHeightSegment, DisplayWidthSegment, HeightSegment, MainSegment, TimestampScaleSegment, TrackEntry, TrackTypeSegment, VideoSegment, WidthSegment } from './boxes/webm/segments/all-segments';
|
|
18
|
-
import type { AnySegment, IsoBaseMediaBox, RegularBox } from './parse-result';
|
|
19
|
-
export declare const getFtypBox: (segments: AnySegment[]) => FtypBox | null;
|
|
20
|
-
export declare const getMoovBox: (segments: AnySegment[]) => MoovBox | null;
|
|
21
|
-
export declare const getMoofBox: (main: AnySegment[]) => IsoBaseMediaBox | null;
|
|
22
|
-
export declare const getMvhdBox: (moovBox: MoovBox) => MvhdBox | null;
|
|
23
|
-
export declare const getTraks: (moovBox: MoovBox) => TrakBox[];
|
|
24
|
-
export declare const getTkhdBox: (trakBox: TrakBox) => TkhdBox | null;
|
|
25
|
-
export declare const getMdiaBox: (trakBox: TrakBox) => RegularBox | null;
|
|
26
|
-
export declare const getMdhdBox: (trakBox: TrakBox) => MdhdBox | null;
|
|
27
|
-
export declare const getStblBox: (trakBox: TrakBox) => RegularBox | null;
|
|
28
|
-
export declare const getStsdBox: (trakBox: TrakBox) => StsdBox | null;
|
|
29
|
-
export declare const getVideoDescriptors: (trakBox: TrakBox) => Uint8Array | null;
|
|
30
|
-
export declare const getStcoBox: (trakBox: TrakBox) => StcoBox | null;
|
|
31
|
-
export declare const getSttsBox: (trakBox: TrakBox) => SttsBox | null;
|
|
32
|
-
export declare const getCttsBox: (trakBox: TrakBox) => CttsBox | null;
|
|
33
|
-
export declare const getStszBox: (trakBox: TrakBox) => StszBox | null;
|
|
34
|
-
export declare const getStscBox: (trakBox: TrakBox) => StscBox | null;
|
|
35
|
-
export declare const getStssBox: (trakBox: TrakBox) => StssBox | null;
|
|
36
|
-
export declare const getTfdtBox: (segment: IsoBaseMediaBox) => TfdtBox | null;
|
|
37
|
-
export declare const getTfhdBox: (segment: IsoBaseMediaBox) => TfhdBox | null;
|
|
38
|
-
export declare const getTrunBoxes: (segment: IsoBaseMediaBox) => TrunBox[];
|
|
39
|
-
export declare const getClusterSegment: (segment: MainSegment) => ClusterSegment | null;
|
|
40
|
-
export declare const getTracksSegment: (segment: MainSegment) => {
|
|
41
|
-
type: "Tracks";
|
|
42
|
-
value: import("./boxes/webm/segments/all-segments").PossibleEbml[];
|
|
43
|
-
minVintWidth: number | null;
|
|
44
|
-
} | null;
|
|
45
|
-
export declare const getTimescaleSegment: (segment: MainSegment) => TimestampScaleSegment | null;
|
|
46
|
-
export declare const getVideoSegment: (track: TrackEntry) => VideoSegment | null;
|
|
47
|
-
export declare const getAudioSegment: (track: TrackEntry) => AudioSegment | null;
|
|
48
|
-
export declare const getSampleRate: (track: TrackEntry) => number | null;
|
|
49
|
-
export declare const getNumberOfChannels: (track: TrackEntry) => number;
|
|
50
|
-
export declare const getBitDepth: (track: TrackEntry) => number | null;
|
|
51
|
-
export declare const getPrivateData: (track: TrackEntry) => Uint8Array | null;
|
|
52
|
-
export declare const getWidthSegment: (track: TrackEntry) => WidthSegment | null;
|
|
53
|
-
export declare const getHeightSegment: (track: TrackEntry) => HeightSegment | null;
|
|
54
|
-
export declare const getDisplayWidthSegment: (track: TrackEntry) => DisplayWidthSegment | null;
|
|
55
|
-
export declare const getDisplayHeightSegment: (track: TrackEntry) => DisplayHeightSegment | null;
|
|
56
|
-
export declare const getTrackTypeSegment: (track: TrackEntry) => TrackTypeSegment | null;
|
|
57
|
-
export declare const getTrackId: (track: TrackEntry) => number;
|
|
58
|
-
export declare const getCodecSegment: (track: TrackEntry) => CodecIdSegment | null;
|
|
59
|
-
export declare const hasSkippedMdatProcessing: (anySegment: AnySegment[]) => {
|
|
60
|
-
skipped: false;
|
|
61
|
-
fileOffset?: undefined;
|
|
62
|
-
} | {
|
|
63
|
-
skipped: boolean;
|
|
64
|
-
fileOffset: number;
|
|
65
|
-
};
|
package/dist/traversal.js
DELETED
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasSkippedMdatProcessing = exports.getCodecSegment = exports.getTrackId = exports.getTrackTypeSegment = exports.getDisplayHeightSegment = exports.getDisplayWidthSegment = exports.getHeightSegment = exports.getWidthSegment = exports.getPrivateData = exports.getBitDepth = exports.getNumberOfChannels = exports.getSampleRate = exports.getAudioSegment = exports.getVideoSegment = exports.getTimescaleSegment = exports.getTracksSegment = exports.getClusterSegment = exports.getTrunBoxes = exports.getTfhdBox = exports.getTfdtBox = exports.getStssBox = exports.getStscBox = exports.getStszBox = exports.getCttsBox = exports.getSttsBox = exports.getStcoBox = exports.getVideoDescriptors = exports.getStsdBox = exports.getStblBox = exports.getMdhdBox = exports.getMdiaBox = exports.getTkhdBox = exports.getTraks = exports.getMvhdBox = exports.getMoofBox = exports.getMoovBox = exports.getFtypBox = void 0;
|
|
4
|
-
const getFtypBox = (segments) => {
|
|
5
|
-
const ftypBox = segments.find((s) => s.type === 'ftyp-box');
|
|
6
|
-
if (!ftypBox || ftypBox.type !== 'ftyp-box') {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
return ftypBox;
|
|
10
|
-
};
|
|
11
|
-
exports.getFtypBox = getFtypBox;
|
|
12
|
-
const getMoovBox = (segments) => {
|
|
13
|
-
const moovBox = segments.find((s) => s.type === 'moov-box');
|
|
14
|
-
if (!moovBox || moovBox.type !== 'moov-box') {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return moovBox;
|
|
18
|
-
};
|
|
19
|
-
exports.getMoovBox = getMoovBox;
|
|
20
|
-
const getMoofBox = (main) => {
|
|
21
|
-
const moofBox = main.find((s) => s.type === 'regular-box' && s.boxType === 'moof');
|
|
22
|
-
if (!moofBox || moofBox.type !== 'regular-box') {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return moofBox;
|
|
26
|
-
};
|
|
27
|
-
exports.getMoofBox = getMoofBox;
|
|
28
|
-
const getMvhdBox = (moovBox) => {
|
|
29
|
-
const mvHdBox = moovBox.children.find((s) => s.type === 'mvhd-box');
|
|
30
|
-
if (!mvHdBox || mvHdBox.type !== 'mvhd-box') {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return mvHdBox;
|
|
34
|
-
};
|
|
35
|
-
exports.getMvhdBox = getMvhdBox;
|
|
36
|
-
const getTraks = (moovBox) => {
|
|
37
|
-
return moovBox.children.filter((s) => s.type === 'trak-box');
|
|
38
|
-
};
|
|
39
|
-
exports.getTraks = getTraks;
|
|
40
|
-
const getTkhdBox = (trakBox) => {
|
|
41
|
-
const tkhdBox = trakBox.children.find((s) => s.type === 'tkhd-box');
|
|
42
|
-
return tkhdBox;
|
|
43
|
-
};
|
|
44
|
-
exports.getTkhdBox = getTkhdBox;
|
|
45
|
-
const getMdiaBox = (trakBox) => {
|
|
46
|
-
const mdiaBox = trakBox.children.find((s) => s.type === 'regular-box' && s.boxType === 'mdia');
|
|
47
|
-
if (!mdiaBox || mdiaBox.type !== 'regular-box') {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return mdiaBox;
|
|
51
|
-
};
|
|
52
|
-
exports.getMdiaBox = getMdiaBox;
|
|
53
|
-
const getMdhdBox = (trakBox) => {
|
|
54
|
-
const mdiaBox = (0, exports.getMdiaBox)(trakBox);
|
|
55
|
-
if (!mdiaBox) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
const mdhdBox = mdiaBox.children.find((c) => c.type === 'mdhd-box');
|
|
59
|
-
return mdhdBox;
|
|
60
|
-
};
|
|
61
|
-
exports.getMdhdBox = getMdhdBox;
|
|
62
|
-
const getStblBox = (trakBox) => {
|
|
63
|
-
const mdiaBox = (0, exports.getMdiaBox)(trakBox);
|
|
64
|
-
if (!mdiaBox) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const minfBox = mdiaBox.children.find((s) => s.type === 'regular-box' && s.boxType === 'minf');
|
|
68
|
-
if (!minfBox || minfBox.type !== 'regular-box') {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
const stblBox = minfBox.children.find((s) => s.type === 'regular-box' && s.boxType === 'stbl');
|
|
72
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return stblBox;
|
|
76
|
-
};
|
|
77
|
-
exports.getStblBox = getStblBox;
|
|
78
|
-
const getStsdBox = (trakBox) => {
|
|
79
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
80
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const stsdBox = stblBox.children.find((s) => s.type === 'stsd-box');
|
|
84
|
-
return stsdBox;
|
|
85
|
-
};
|
|
86
|
-
exports.getStsdBox = getStsdBox;
|
|
87
|
-
const getVideoDescriptors = (trakBox) => {
|
|
88
|
-
var _a;
|
|
89
|
-
const stsdBox = (0, exports.getStsdBox)(trakBox);
|
|
90
|
-
if (!stsdBox) {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
const descriptors = stsdBox.samples.map((s) => {
|
|
94
|
-
return s.type === 'video'
|
|
95
|
-
? s.descriptors.map((d) => {
|
|
96
|
-
return d.type === 'avcc-box'
|
|
97
|
-
? d.description
|
|
98
|
-
: d.type === 'hvcc-box'
|
|
99
|
-
? d.data
|
|
100
|
-
: null;
|
|
101
|
-
})
|
|
102
|
-
: [];
|
|
103
|
-
});
|
|
104
|
-
return (_a = descriptors.flat(1).filter(Boolean)[0]) !== null && _a !== void 0 ? _a : null;
|
|
105
|
-
};
|
|
106
|
-
exports.getVideoDescriptors = getVideoDescriptors;
|
|
107
|
-
const getStcoBox = (trakBox) => {
|
|
108
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
109
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
const stcoBox = stblBox.children.find((s) => s.type === 'stco-box');
|
|
113
|
-
return stcoBox;
|
|
114
|
-
};
|
|
115
|
-
exports.getStcoBox = getStcoBox;
|
|
116
|
-
const getSttsBox = (trakBox) => {
|
|
117
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
118
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
const sttsBox = stblBox.children.find((s) => s.type === 'stts-box');
|
|
122
|
-
return sttsBox;
|
|
123
|
-
};
|
|
124
|
-
exports.getSttsBox = getSttsBox;
|
|
125
|
-
const getCttsBox = (trakBox) => {
|
|
126
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
127
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
const cttsBox = stblBox.children.find((s) => s.type === 'ctts-box');
|
|
131
|
-
return cttsBox;
|
|
132
|
-
};
|
|
133
|
-
exports.getCttsBox = getCttsBox;
|
|
134
|
-
const getStszBox = (trakBox) => {
|
|
135
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
136
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
const stszBox = stblBox.children.find((s) => s.type === 'stsz-box');
|
|
140
|
-
return stszBox;
|
|
141
|
-
};
|
|
142
|
-
exports.getStszBox = getStszBox;
|
|
143
|
-
const getStscBox = (trakBox) => {
|
|
144
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
145
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
const stcoBox = stblBox.children.find((b) => b.type === 'stsc-box');
|
|
149
|
-
return stcoBox;
|
|
150
|
-
};
|
|
151
|
-
exports.getStscBox = getStscBox;
|
|
152
|
-
const getStssBox = (trakBox) => {
|
|
153
|
-
const stblBox = (0, exports.getStblBox)(trakBox);
|
|
154
|
-
if (!stblBox || stblBox.type !== 'regular-box') {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
const stssBox = stblBox.children.find((b) => b.type === 'stss-box');
|
|
158
|
-
return stssBox;
|
|
159
|
-
};
|
|
160
|
-
exports.getStssBox = getStssBox;
|
|
161
|
-
const getTfdtBox = (segment) => {
|
|
162
|
-
if (segment.type !== 'regular-box' || segment.boxType !== 'traf') {
|
|
163
|
-
throw new Error('Expected traf-box');
|
|
164
|
-
}
|
|
165
|
-
const tfhdBox = segment.children.find((c) => c.type === 'tfdt-box');
|
|
166
|
-
if (!tfhdBox || tfhdBox.type !== 'tfdt-box') {
|
|
167
|
-
throw new Error('Expected tfhd-box');
|
|
168
|
-
}
|
|
169
|
-
return tfhdBox;
|
|
170
|
-
};
|
|
171
|
-
exports.getTfdtBox = getTfdtBox;
|
|
172
|
-
const getTfhdBox = (segment) => {
|
|
173
|
-
if (segment.type !== 'regular-box' || segment.boxType !== 'traf') {
|
|
174
|
-
throw new Error('Expected traf-box');
|
|
175
|
-
}
|
|
176
|
-
const tfhdBox = segment.children.find((c) => c.type === 'tfhd-box');
|
|
177
|
-
if (!tfhdBox || tfhdBox.type !== 'tfhd-box') {
|
|
178
|
-
throw new Error('Expected tfhd-box');
|
|
179
|
-
}
|
|
180
|
-
return tfhdBox;
|
|
181
|
-
};
|
|
182
|
-
exports.getTfhdBox = getTfhdBox;
|
|
183
|
-
const getTrunBoxes = (segment) => {
|
|
184
|
-
if (segment.type !== 'regular-box' || segment.boxType !== 'traf') {
|
|
185
|
-
throw new Error('Expected traf-box');
|
|
186
|
-
}
|
|
187
|
-
const trunBoxes = segment.children.filter((c) => c.type === 'trun-box');
|
|
188
|
-
return trunBoxes;
|
|
189
|
-
};
|
|
190
|
-
exports.getTrunBoxes = getTrunBoxes;
|
|
191
|
-
const getClusterSegment = (segment) => {
|
|
192
|
-
const clusterSegment = segment.value.find((b) => b.type === 'Cluster');
|
|
193
|
-
return clusterSegment !== null && clusterSegment !== void 0 ? clusterSegment : null;
|
|
194
|
-
};
|
|
195
|
-
exports.getClusterSegment = getClusterSegment;
|
|
196
|
-
const getTracksSegment = (segment) => {
|
|
197
|
-
const tracksSegment = segment.value.find((b) => b.type === 'Tracks');
|
|
198
|
-
if (!tracksSegment || tracksSegment.type !== 'Tracks') {
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
return tracksSegment;
|
|
202
|
-
};
|
|
203
|
-
exports.getTracksSegment = getTracksSegment;
|
|
204
|
-
const getTimescaleSegment = (segment) => {
|
|
205
|
-
const infoSegment = segment.value.find((b) => b.type === 'Info');
|
|
206
|
-
if (!infoSegment || infoSegment.type !== 'Info') {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
const timescale = infoSegment.value.find((b) => b.type === 'TimestampScale');
|
|
210
|
-
if (!timescale || timescale.type !== 'TimestampScale') {
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
return timescale;
|
|
214
|
-
};
|
|
215
|
-
exports.getTimescaleSegment = getTimescaleSegment;
|
|
216
|
-
const getVideoSegment = (track) => {
|
|
217
|
-
const videoSegment = track.value.find((b) => b.type === 'Video');
|
|
218
|
-
if (!videoSegment || videoSegment.type !== 'Video') {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
return videoSegment !== null && videoSegment !== void 0 ? videoSegment : null;
|
|
222
|
-
};
|
|
223
|
-
exports.getVideoSegment = getVideoSegment;
|
|
224
|
-
const getAudioSegment = (track) => {
|
|
225
|
-
const audioSegment = track.value.find((b) => b.type === 'Audio');
|
|
226
|
-
if (!audioSegment || audioSegment.type !== 'Audio') {
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
return audioSegment !== null && audioSegment !== void 0 ? audioSegment : null;
|
|
230
|
-
};
|
|
231
|
-
exports.getAudioSegment = getAudioSegment;
|
|
232
|
-
const getSampleRate = (track) => {
|
|
233
|
-
const audioSegment = (0, exports.getAudioSegment)(track);
|
|
234
|
-
if (!audioSegment) {
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
const samplingFrequency = audioSegment.value.find((b) => b.type === 'SamplingFrequency');
|
|
238
|
-
if (!samplingFrequency || samplingFrequency.type !== 'SamplingFrequency') {
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
return samplingFrequency.value.value;
|
|
242
|
-
};
|
|
243
|
-
exports.getSampleRate = getSampleRate;
|
|
244
|
-
const getNumberOfChannels = (track) => {
|
|
245
|
-
const audioSegment = (0, exports.getAudioSegment)(track);
|
|
246
|
-
if (!audioSegment) {
|
|
247
|
-
throw new Error('Could not find audio segment');
|
|
248
|
-
}
|
|
249
|
-
const channels = audioSegment.value.find((b) => b.type === 'Channels');
|
|
250
|
-
if (!channels || channels.type !== 'Channels') {
|
|
251
|
-
return 1;
|
|
252
|
-
}
|
|
253
|
-
return channels.value.value;
|
|
254
|
-
};
|
|
255
|
-
exports.getNumberOfChannels = getNumberOfChannels;
|
|
256
|
-
const getBitDepth = (track) => {
|
|
257
|
-
const audioSegment = (0, exports.getAudioSegment)(track);
|
|
258
|
-
if (!audioSegment) {
|
|
259
|
-
return null;
|
|
260
|
-
}
|
|
261
|
-
const bitDepth = audioSegment.value.find((b) => b.type === 'BitDepth');
|
|
262
|
-
if (!bitDepth || bitDepth.type !== 'BitDepth') {
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
return bitDepth.value.value;
|
|
266
|
-
};
|
|
267
|
-
exports.getBitDepth = getBitDepth;
|
|
268
|
-
const getPrivateData = (track) => {
|
|
269
|
-
const privateData = track.value.find((b) => b.type === 'CodecPrivate');
|
|
270
|
-
if (!privateData || privateData.type !== 'CodecPrivate') {
|
|
271
|
-
return null;
|
|
272
|
-
}
|
|
273
|
-
return privateData.value;
|
|
274
|
-
};
|
|
275
|
-
exports.getPrivateData = getPrivateData;
|
|
276
|
-
const getWidthSegment = (track) => {
|
|
277
|
-
const videoSegment = (0, exports.getVideoSegment)(track);
|
|
278
|
-
if (!videoSegment) {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
const width = videoSegment.value.find((b) => b.type === 'PixelWidth');
|
|
282
|
-
if (!width || width.type !== 'PixelWidth') {
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
|
-
return width;
|
|
286
|
-
};
|
|
287
|
-
exports.getWidthSegment = getWidthSegment;
|
|
288
|
-
const getHeightSegment = (track) => {
|
|
289
|
-
const videoSegment = (0, exports.getVideoSegment)(track);
|
|
290
|
-
if (!videoSegment) {
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
const height = videoSegment.value.find((b) => b.type === 'PixelHeight');
|
|
294
|
-
if (!height || height.type !== 'PixelHeight') {
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
return height;
|
|
298
|
-
};
|
|
299
|
-
exports.getHeightSegment = getHeightSegment;
|
|
300
|
-
const getDisplayWidthSegment = (track) => {
|
|
301
|
-
const videoSegment = (0, exports.getVideoSegment)(track);
|
|
302
|
-
if (!videoSegment) {
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
const displayWidth = videoSegment.value.find((b) => b.type === 'DisplayWidth');
|
|
306
|
-
if (!displayWidth || displayWidth.type !== 'DisplayWidth') {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
return displayWidth;
|
|
310
|
-
};
|
|
311
|
-
exports.getDisplayWidthSegment = getDisplayWidthSegment;
|
|
312
|
-
const getDisplayHeightSegment = (track) => {
|
|
313
|
-
const videoSegment = (0, exports.getVideoSegment)(track);
|
|
314
|
-
if (!videoSegment) {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
const displayHeight = videoSegment.value.find((b) => b.type === 'DisplayHeight');
|
|
318
|
-
if (!displayHeight || displayHeight.type !== 'DisplayHeight') {
|
|
319
|
-
return null;
|
|
320
|
-
}
|
|
321
|
-
return displayHeight;
|
|
322
|
-
};
|
|
323
|
-
exports.getDisplayHeightSegment = getDisplayHeightSegment;
|
|
324
|
-
const getTrackTypeSegment = (track) => {
|
|
325
|
-
const trackType = track.value.find((b) => b.type === 'TrackType');
|
|
326
|
-
if (!trackType || trackType.type !== 'TrackType') {
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
return trackType;
|
|
330
|
-
};
|
|
331
|
-
exports.getTrackTypeSegment = getTrackTypeSegment;
|
|
332
|
-
const getTrackId = (track) => {
|
|
333
|
-
const trackId = track.value.find((b) => b.type === 'TrackNumber');
|
|
334
|
-
if (!trackId || trackId.type !== 'TrackNumber') {
|
|
335
|
-
throw new Error('Expected track number segment');
|
|
336
|
-
}
|
|
337
|
-
return trackId.value.value;
|
|
338
|
-
};
|
|
339
|
-
exports.getTrackId = getTrackId;
|
|
340
|
-
const getCodecSegment = (track) => {
|
|
341
|
-
const codec = track.value.find((b) => b.type === 'CodecID');
|
|
342
|
-
if (!codec || codec.type !== 'CodecID') {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
return codec;
|
|
346
|
-
};
|
|
347
|
-
exports.getCodecSegment = getCodecSegment;
|
|
348
|
-
const hasSkippedMdatProcessing = (anySegment) => {
|
|
349
|
-
const mdat = anySegment.find((b) => b.type === 'mdat-box');
|
|
350
|
-
if (!mdat) {
|
|
351
|
-
return {
|
|
352
|
-
skipped: false,
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
if (mdat.type !== 'mdat-box') {
|
|
356
|
-
throw new Error('Expected mdat-box');
|
|
357
|
-
}
|
|
358
|
-
if (mdat.samplesProcessed) {
|
|
359
|
-
return {
|
|
360
|
-
skipped: false,
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
return {
|
|
364
|
-
skipped: true,
|
|
365
|
-
fileOffset: mdat.fileOffset,
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
exports.hasSkippedMdatProcessing = hasSkippedMdatProcessing;
|