@remotion/media-parser 4.0.213 → 4.0.214
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/dist/boxes/webm/make-header.js +2 -2
- package/dist/boxes/webm/segments/block-simple-block-flags.d.ts +1 -1
- package/dist/readers/from-fetch.js +2 -2
- package/dist/truthy.js +1 -2
- package/package.json +3 -3
- package/dist/av1-codec-string.d.ts +0 -3
- package/dist/av1-codec-string.js +0 -91
- package/dist/boxes/iso-base-media/ftype.d.ts +0 -9
- package/dist/boxes/iso-base-media/ftype.js +0 -31
- package/dist/boxes/iso-base-media/stsd/avcc-hvcc.d.ts +0 -20
- package/dist/boxes/iso-base-media/stsd/avcc-hvcc.js +0 -73
- package/dist/boxes/iso-base-media/stts/stts.d.ts +0 -15
- package/dist/boxes/iso-base-media/stts/stts.js +0 -35
- package/dist/boxes/webm/bitstream/av1/bitstream-frame-header.d.ts +0 -14
- package/dist/boxes/webm/bitstream/av1/bitstream-frame-header.js +0 -67
- package/dist/boxes/webm/bitstream/av1/bitstream-frame.d.ts +0 -11
- package/dist/boxes/webm/bitstream/av1/bitstream-frame.js +0 -14
- package/dist/boxes/webm/bitstream/av1/chroma-sample-position.d.ts +0 -6
- package/dist/boxes/webm/bitstream/av1/chroma-sample-position.js +0 -9
- package/dist/boxes/webm/bitstream/av1/color-config.d.ts +0 -16
- package/dist/boxes/webm/bitstream/av1/color-config.js +0 -103
- package/dist/boxes/webm/bitstream/av1/color-primaries.d.ts +0 -14
- package/dist/boxes/webm/bitstream/av1/color-primaries.js +0 -17
- package/dist/boxes/webm/bitstream/av1/decoder-model-info.d.ts +0 -9
- package/dist/boxes/webm/bitstream/av1/decoder-model-info.js +0 -17
- package/dist/boxes/webm/bitstream/av1/frame.d.ts +0 -0
- package/dist/boxes/webm/bitstream/av1/frame.js +0 -1
- package/dist/boxes/webm/bitstream/av1/header-segment.d.ts +0 -51
- package/dist/boxes/webm/bitstream/av1/header-segment.js +0 -183
- package/dist/boxes/webm/bitstream/av1/matrix-coefficients.d.ts +0 -17
- package/dist/boxes/webm/bitstream/av1/matrix-coefficients.js +0 -20
- package/dist/boxes/webm/bitstream/av1/operating-parameters-info.d.ts +0 -10
- package/dist/boxes/webm/bitstream/av1/operating-parameters-info.js +0 -15
- package/dist/boxes/webm/bitstream/av1/temporal-point-info.d.ts +0 -5
- package/dist/boxes/webm/bitstream/av1/temporal-point-info.js +0 -8
- package/dist/boxes/webm/bitstream/av1/timing-info.d.ts +0 -8
- package/dist/boxes/webm/bitstream/av1/timing-info.js +0 -20
- package/dist/boxes/webm/bitstream/av1/transfer-characteristics.d.ts +0 -21
- package/dist/boxes/webm/bitstream/av1/transfer-characteristics.js +0 -24
- package/dist/boxes/webm/bitstream/av1/uvlc.d.ts +0 -2
- package/dist/boxes/webm/bitstream/av1/uvlc.js +0 -20
- package/dist/boxes/webm/bitstream/av1.d.ts +0 -20
- package/dist/boxes/webm/bitstream/av1.js +0 -118
- package/dist/boxes/webm/bitstream/h264/get-h264-descriptor.d.ts +0 -0
- package/dist/boxes/webm/bitstream/h264/get-h264-descriptor.js +0 -1
- package/dist/boxes/webm/get-track.d.ts +0 -6
- package/dist/boxes/webm/get-track.js +0 -184
- package/dist/boxes/webm/segments/duration.d.ts +0 -6
- package/dist/boxes/webm/segments/duration.js +0 -19
- package/dist/boxes/webm/segments/info.d.ts +0 -9
- package/dist/boxes/webm/segments/info.js +0 -22
- package/dist/boxes/webm/segments/main.d.ts +0 -5
- package/dist/boxes/webm/segments/main.js +0 -2
- package/dist/boxes/webm/segments/muxing.d.ts +0 -6
- package/dist/boxes/webm/segments/muxing.js +0 -11
- package/dist/boxes/webm/segments/seek-head.d.ts +0 -9
- package/dist/boxes/webm/segments/seek-head.js +0 -22
- package/dist/boxes/webm/segments/seek-position.d.ts +0 -6
- package/dist/boxes/webm/segments/seek-position.js +0 -11
- package/dist/boxes/webm/segments/seek.d.ts +0 -13
- package/dist/boxes/webm/segments/seek.js +0 -35
- package/dist/boxes/webm/segments/timestamp-scale.d.ts +0 -6
- package/dist/boxes/webm/segments/timestamp-scale.js +0 -11
- package/dist/boxes/webm/segments/tracks.d.ts +0 -8
- package/dist/boxes/webm/segments/tracks.js +0 -21
- package/dist/boxes/webm/segments/unknown.d.ts +0 -6
- package/dist/boxes/webm/segments/unknown.js +0 -11
- package/dist/boxes/webm/segments/void.d.ts +0 -6
- package/dist/boxes/webm/segments/void.js +0 -11
- package/dist/boxes/webm/segments/writing.d.ts +0 -6
- package/dist/boxes/webm/segments/writing.js +0 -11
- package/dist/boxes/webm/tracks.d.ts +0 -8
- package/dist/boxes/webm/tracks.js +0 -21
- package/dist/combine-uint8array.d.ts +0 -1
- package/dist/combine-uint8array.js +0 -13
- package/dist/create/cues.d.ts +0 -0
- package/dist/create/cues.js +0 -1
- 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/from-web.d.ts +0 -2
- package/dist/from-web.js +0 -45
- package/dist/get-video-metadata.d.ts +0 -2
- package/dist/get-video-metadata.js +0 -44
- package/dist/read-and-increment-offset.d.ts +0 -28
- package/dist/read-and-increment-offset.js +0 -177
- 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
- package/dist/understand-vorbis.d.ts +0 -1
- package/dist/understand-vorbis.js +0 -12
|
@@ -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;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDurationSegment = void 0;
|
|
4
|
-
const parseDurationSegment = (iterator, length) => {
|
|
5
|
-
if (length === 8) {
|
|
6
|
-
return {
|
|
7
|
-
type: 'duration-segment',
|
|
8
|
-
duration: iterator.getFloat64(),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
if (length === 4) {
|
|
12
|
-
return {
|
|
13
|
-
type: 'duration-segment',
|
|
14
|
-
duration: iterator.getFloat32(),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
throw new Error('Expected duration segment to be 4 or 8 bytes, but it is ' + length);
|
|
18
|
-
};
|
|
19
|
-
exports.parseDurationSegment = parseDurationSegment;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
-
import type { ParserContext } from '../../../parser-context';
|
|
3
|
-
import type { MatroskaSegment } from '../segments';
|
|
4
|
-
export type InfoSegment = {
|
|
5
|
-
type: 'info-segment';
|
|
6
|
-
length: number;
|
|
7
|
-
children: MatroskaSegment[];
|
|
8
|
-
};
|
|
9
|
-
export declare const parseInfoSegment: (iterator: BufferIterator, length: number, parserContext: ParserContext) => Promise<InfoSegment>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseInfoSegment = void 0;
|
|
4
|
-
const parse_children_1 = require("./parse-children");
|
|
5
|
-
const parseInfoSegment = async (iterator, length, parserContext) => {
|
|
6
|
-
const children = await (0, parse_children_1.expectChildren)({
|
|
7
|
-
iterator,
|
|
8
|
-
length,
|
|
9
|
-
initialChildren: [],
|
|
10
|
-
wrap: null,
|
|
11
|
-
parserContext,
|
|
12
|
-
});
|
|
13
|
-
if (children.status === 'incomplete') {
|
|
14
|
-
throw new Error('Incomplete children');
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
type: 'info-segment',
|
|
18
|
-
length,
|
|
19
|
-
children: children.segments,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
exports.parseInfoSegment = parseInfoSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseMuxingSegment = void 0;
|
|
4
|
-
const parseMuxingSegment = (iterator, length) => {
|
|
5
|
-
const value = iterator.getByteString(length);
|
|
6
|
-
return {
|
|
7
|
-
type: 'muxing-app-segment',
|
|
8
|
-
value,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.parseMuxingSegment = parseMuxingSegment;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
-
import type { ParserContext } from '../../../parser-context';
|
|
3
|
-
import { type MatroskaSegment } from '../segments';
|
|
4
|
-
export type SeekHeadSegment = {
|
|
5
|
-
type: 'seek-head-segment';
|
|
6
|
-
children: MatroskaSegment[];
|
|
7
|
-
length: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const parseSeekHeadSegment: (iterator: BufferIterator, length: number, parserContext: ParserContext) => Promise<SeekHeadSegment>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSeekHeadSegment = void 0;
|
|
4
|
-
const parse_children_1 = require("./parse-children");
|
|
5
|
-
const parseSeekHeadSegment = async (iterator, length, parserContext) => {
|
|
6
|
-
const children = await (0, parse_children_1.expectChildren)({
|
|
7
|
-
iterator,
|
|
8
|
-
length,
|
|
9
|
-
initialChildren: [],
|
|
10
|
-
wrap: null,
|
|
11
|
-
parserContext,
|
|
12
|
-
});
|
|
13
|
-
if (children.status === 'incomplete') {
|
|
14
|
-
throw new Error('Incomplete children');
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
type: 'seek-head-segment',
|
|
18
|
-
length,
|
|
19
|
-
children: children.segments,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
exports.parseSeekHeadSegment = parseSeekHeadSegment;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
-
export type SeekPositionSegment = {
|
|
3
|
-
type: 'seek-position-segment';
|
|
4
|
-
seekPosition: number;
|
|
5
|
-
};
|
|
6
|
-
export declare const parseSeekPositionSegment: (iterator: BufferIterator, length: number) => SeekPositionSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSeekPositionSegment = void 0;
|
|
4
|
-
const parseSeekPositionSegment = (iterator, length) => {
|
|
5
|
-
const seekPosition = iterator.getUint(length);
|
|
6
|
-
return {
|
|
7
|
-
type: 'seek-position-segment',
|
|
8
|
-
seekPosition,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.parseSeekPositionSegment = parseSeekPositionSegment;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
-
import type { ParserContext } from '../../../parser-context';
|
|
3
|
-
import type { MatroskaSegment } from '../segments';
|
|
4
|
-
export type SeekSegment = {
|
|
5
|
-
type: 'seek-segment';
|
|
6
|
-
children: MatroskaSegment[];
|
|
7
|
-
};
|
|
8
|
-
export declare const parseSeekSegment: (iterator: BufferIterator, length: number, parserContext: ParserContext) => Promise<SeekSegment>;
|
|
9
|
-
export type SeekIdSegment = {
|
|
10
|
-
type: 'seek-id-segment';
|
|
11
|
-
seekId: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const parseSeekIdSegment: (iterator: BufferIterator, length: number) => SeekIdSegment;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSeekIdSegment = exports.parseSeekSegment = void 0;
|
|
4
|
-
const parse_children_1 = require("./parse-children");
|
|
5
|
-
const parseSeekSegment = async (iterator, length, parserContext) => {
|
|
6
|
-
const children = await (0, parse_children_1.expectChildren)({
|
|
7
|
-
iterator,
|
|
8
|
-
length,
|
|
9
|
-
initialChildren: [],
|
|
10
|
-
wrap: null,
|
|
11
|
-
parserContext,
|
|
12
|
-
});
|
|
13
|
-
if (children.status === 'incomplete') {
|
|
14
|
-
throw new Error('Incomplete children');
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
type: 'seek-segment',
|
|
18
|
-
children: children.segments,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.parseSeekSegment = parseSeekSegment;
|
|
22
|
-
const parseSeekIdSegment = (iterator, length) => {
|
|
23
|
-
const seekId = '0x' +
|
|
24
|
-
[...iterator.getSlice(length)]
|
|
25
|
-
.map((b) => b.toString(16).padStart(2, '0'))
|
|
26
|
-
.join('');
|
|
27
|
-
if (seekId === null) {
|
|
28
|
-
throw new Error('Not enough bytes to parse seek id');
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
type: 'seek-id-segment',
|
|
32
|
-
seekId,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
exports.parseSeekIdSegment = parseSeekIdSegment;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
-
export type TimestampScaleSegment = {
|
|
3
|
-
type: 'timestamp-scale-segment';
|
|
4
|
-
timestampScale: number;
|
|
5
|
-
};
|
|
6
|
-
export declare const parseTimestampScaleSegment: (iterator: BufferIterator) => TimestampScaleSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTimestampScaleSegment = void 0;
|
|
4
|
-
const parseTimestampScaleSegment = (iterator) => {
|
|
5
|
-
const timestampScale = iterator.getUint(3);
|
|
6
|
-
return {
|
|
7
|
-
type: 'timestamp-scale-segment',
|
|
8
|
-
timestampScale,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.parseTimestampScaleSegment = parseTimestampScaleSegment;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../../buffer-iterator';
|
|
2
|
-
import type { ParserContext } from '../../../parser-context';
|
|
3
|
-
import type { MatroskaSegment } from '../segments';
|
|
4
|
-
export type TracksSegment = {
|
|
5
|
-
type: 'tracks-segment';
|
|
6
|
-
children: MatroskaSegment[];
|
|
7
|
-
};
|
|
8
|
-
export declare const parseTracksSegment: (iterator: BufferIterator, length: number, parserContext: ParserContext) => Promise<TracksSegment>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTracksSegment = void 0;
|
|
4
|
-
const parse_children_1 = require("./parse-children");
|
|
5
|
-
const parseTracksSegment = async (iterator, length, parserContext) => {
|
|
6
|
-
const children = await (0, parse_children_1.expectChildren)({
|
|
7
|
-
iterator,
|
|
8
|
-
length,
|
|
9
|
-
initialChildren: [],
|
|
10
|
-
wrap: null,
|
|
11
|
-
parserContext,
|
|
12
|
-
});
|
|
13
|
-
if (children.status === 'incomplete') {
|
|
14
|
-
throw new Error('Incomplete children');
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
type: 'tracks-segment',
|
|
18
|
-
children: children.segments,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.parseTracksSegment = parseTracksSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseUnknownSegment = void 0;
|
|
4
|
-
const parseUnknownSegment = (iterator, id, length) => {
|
|
5
|
-
iterator.discard(length);
|
|
6
|
-
return {
|
|
7
|
-
id,
|
|
8
|
-
type: 'unknown-segment',
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.parseUnknownSegment = parseUnknownSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseVoidSegment = void 0;
|
|
4
|
-
const parseVoidSegment = (iterator, length) => {
|
|
5
|
-
iterator.discard(length);
|
|
6
|
-
return {
|
|
7
|
-
type: 'void-segment',
|
|
8
|
-
length,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.parseVoidSegment = parseVoidSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseWritingSegment = void 0;
|
|
4
|
-
const parseWritingSegment = (iterator, length) => {
|
|
5
|
-
const value = iterator.getByteString(length);
|
|
6
|
-
return {
|
|
7
|
-
type: 'writing-app-segment',
|
|
8
|
-
value,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
exports.parseWritingSegment = parseWritingSegment;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BufferIterator } from '../../buffer-iterator';
|
|
2
|
-
import type { ParserContext } from '../../parser-context';
|
|
3
|
-
import type { MatroskaSegment } from './segments';
|
|
4
|
-
export type TracksSegment = {
|
|
5
|
-
type: 'tracks-segment';
|
|
6
|
-
children: MatroskaSegment[];
|
|
7
|
-
};
|
|
8
|
-
export declare const parseTracksSegment: (iterator: BufferIterator, length: number, parserContext: ParserContext) => Promise<TracksSegment>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseTracksSegment = void 0;
|
|
4
|
-
const parse_children_1 = require("./segments/parse-children");
|
|
5
|
-
const parseTracksSegment = async (iterator, length, parserContext) => {
|
|
6
|
-
const children = await (0, parse_children_1.expectChildren)({
|
|
7
|
-
iterator,
|
|
8
|
-
length,
|
|
9
|
-
initialChildren: [],
|
|
10
|
-
wrap: null,
|
|
11
|
-
parserContext,
|
|
12
|
-
});
|
|
13
|
-
if (children.status === 'incomplete') {
|
|
14
|
-
throw new Error('Incomplete children');
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
type: 'tracks-segment',
|
|
18
|
-
children: children.segments,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.parseTracksSegment = parseTracksSegment;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const combineUint8Arrays: (array1: Uint8Array | null, array2: Uint8Array) => Uint8Array;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.combineUint8Arrays = void 0;
|
|
4
|
-
const combineUint8Arrays = (array1, array2) => {
|
|
5
|
-
if (!array1) {
|
|
6
|
-
return array2;
|
|
7
|
-
}
|
|
8
|
-
const combined = new Uint8Array(array1.length + array2.length);
|
|
9
|
-
combined.set(array1);
|
|
10
|
-
combined.set(array2, array1.length);
|
|
11
|
-
return combined;
|
|
12
|
-
};
|
|
13
|
-
exports.combineUint8Arrays = combineUint8Arrays;
|
package/dist/create/cues.d.ts
DELETED
|
File without changes
|
package/dist/create/cues.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
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