@remotion/media-parser 4.0.300 → 4.0.302
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/esm/index.mjs +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/containers/avc/create-avc-decoder-configuration-record.d.ts +0 -2
- package/dist/containers/avc/create-avc-decoder-configuration-record.js +0 -35
- package/dist/containers/iso-base-media/sample-positions.d.ts +0 -25
- package/dist/containers/iso-base-media/sample-positions.js +0 -37
- package/dist/containers/iso-base-media/turn-sample-positions-into-array.d.ts +0 -19
- package/dist/containers/iso-base-media/turn-sample-positions-into-array.js +0 -73
- package/dist/containers/m3u/iterate-over-segment-files.d.ts +0 -21
- package/dist/containers/m3u/iterate-over-segment-files.js +0 -132
- package/dist/containers/mp3/audio-sample-from-cbr.d.ts +0 -11
- package/dist/containers/mp3/audio-sample-from-cbr.js +0 -35
- package/dist/emit-audio-sample.d.ts +0 -12
- package/dist/emit-audio-sample.js +0 -11
- package/dist/server-worker.module.d.ts +0 -2
- package/dist/server-worker.module.js +0 -12
package/dist/esm/index.mjs
CHANGED
|
@@ -17140,7 +17140,7 @@ var downloadAndParseMedia = async (options) => {
|
|
|
17140
17140
|
return returnValue;
|
|
17141
17141
|
};
|
|
17142
17142
|
// src/version.ts
|
|
17143
|
-
var VERSION = "4.0.
|
|
17143
|
+
var VERSION = "4.0.302";
|
|
17144
17144
|
|
|
17145
17145
|
// src/index.ts
|
|
17146
17146
|
var MediaParserInternals = {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.302";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
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.302",
|
|
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.19.0",
|
|
12
12
|
"@types/bun": "1.2.8",
|
|
13
|
-
"@remotion/
|
|
14
|
-
"@remotion/
|
|
13
|
+
"@remotion/example-videos": "4.0.302",
|
|
14
|
+
"@remotion/eslint-config-internal": "4.0.302"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAVCDecoderConfigurationRecord = void 0;
|
|
4
|
-
const combine_uint8_arrays_1 = require("../../combine-uint8-arrays");
|
|
5
|
-
const truthy_1 = require("../../truthy");
|
|
6
|
-
function serializeUint16(value) {
|
|
7
|
-
const buffer = new ArrayBuffer(2);
|
|
8
|
-
const view = new DataView(buffer);
|
|
9
|
-
view.setUint16(0, value);
|
|
10
|
-
return new Uint8Array(buffer);
|
|
11
|
-
}
|
|
12
|
-
const createAVCDecoderConfigurationRecord = (avc1Profile) => {
|
|
13
|
-
return (0, combine_uint8_arrays_1.combineUint8Arrays)([
|
|
14
|
-
new Uint8Array([
|
|
15
|
-
// https://gist.github.com/uupaa/8493378ec15f644a3d2b
|
|
16
|
-
1, // version
|
|
17
|
-
avc1Profile.sps.spsData.profile,
|
|
18
|
-
avc1Profile.sps.spsData.compatibility,
|
|
19
|
-
avc1Profile.sps.spsData.level,
|
|
20
|
-
0xff,
|
|
21
|
-
0xe1,
|
|
22
|
-
]),
|
|
23
|
-
// sequence parameter set length
|
|
24
|
-
serializeUint16(avc1Profile.sps.sps.length),
|
|
25
|
-
// sequence parameter set
|
|
26
|
-
avc1Profile.sps.sps,
|
|
27
|
-
// num of PPS
|
|
28
|
-
new Uint8Array([0x01]),
|
|
29
|
-
// picture parameter set length
|
|
30
|
-
serializeUint16(avc1Profile.pps.pps.length),
|
|
31
|
-
// PPS
|
|
32
|
-
avc1Profile.pps.pps,
|
|
33
|
-
].filter(truthy_1.truthy));
|
|
34
|
-
};
|
|
35
|
-
exports.createAVCDecoderConfigurationRecord = createAVCDecoderConfigurationRecord;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { SamplePosition } from '../../get-sample-positions';
|
|
2
|
-
import type { CttsBox } from './stsd/ctts';
|
|
3
|
-
import type { StcoBox } from './stsd/stco';
|
|
4
|
-
import type { StscBox } from './stsd/stsc';
|
|
5
|
-
import type { StssBox } from './stsd/stss';
|
|
6
|
-
import type { StszBox } from './stsd/stsz';
|
|
7
|
-
import type { SttsBox } from './stsd/stts';
|
|
8
|
-
export type GroupOfSamplePositions = {
|
|
9
|
-
type: 'array';
|
|
10
|
-
boxes: SamplePosition[];
|
|
11
|
-
} | {
|
|
12
|
-
type: 'map';
|
|
13
|
-
boxes: {
|
|
14
|
-
stszBox: StszBox;
|
|
15
|
-
stcoBox: StcoBox;
|
|
16
|
-
stscBox: StscBox;
|
|
17
|
-
sttsBox: SttsBox;
|
|
18
|
-
stssBox: StssBox | null;
|
|
19
|
-
cttsBox: CttsBox | null;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export declare const hasNoSamplePositions: (samplePositions: GroupOfSamplePositions) => boolean;
|
|
23
|
-
export declare const hasNoSamplePositionsGroup: (samplePositions: GroupOfSamplePositions[]) => boolean;
|
|
24
|
-
export declare const getKeyframesFromGroupOfSamplePositions: (samplePositions: GroupOfSamplePositions) => SamplePosition[];
|
|
25
|
-
export declare const groupGetKeyframesFromGroupOfSamplePositions: (samplePositions: GroupOfSamplePositions[]) => SamplePosition[];
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupGetKeyframesFromGroupOfSamplePositions = exports.getKeyframesFromGroupOfSamplePositions = exports.hasNoSamplePositionsGroup = exports.hasNoSamplePositions = void 0;
|
|
4
|
-
const turn_sample_positions_into_array_1 = require("./turn-sample-positions-into-array");
|
|
5
|
-
const hasNoSamplePositions = (samplePositions) => {
|
|
6
|
-
if (samplePositions.type === 'array') {
|
|
7
|
-
return samplePositions.boxes.length === 0;
|
|
8
|
-
}
|
|
9
|
-
return samplePositions.boxes.stcoBox.entryCount === 0;
|
|
10
|
-
};
|
|
11
|
-
exports.hasNoSamplePositions = hasNoSamplePositions;
|
|
12
|
-
const hasNoSamplePositionsGroup = (samplePositions) => {
|
|
13
|
-
return samplePositions.every((s) => (0, exports.hasNoSamplePositions)(s));
|
|
14
|
-
};
|
|
15
|
-
exports.hasNoSamplePositionsGroup = hasNoSamplePositionsGroup;
|
|
16
|
-
const getKeyframesFromGroupOfSamplePositions = (samplePositions) => {
|
|
17
|
-
if (samplePositions.type === 'array') {
|
|
18
|
-
return samplePositions.boxes.filter((s) => s.isKeyframe);
|
|
19
|
-
}
|
|
20
|
-
if (!samplePositions.boxes.stssBox) {
|
|
21
|
-
return (0, turn_sample_positions_into_array_1.turnSamplePositionsIntoArraySlow)({
|
|
22
|
-
...samplePositions.boxes,
|
|
23
|
-
onlyKeyframes: true,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return (0, turn_sample_positions_into_array_1.turnSamplePositionsIntoArraySlow)({
|
|
27
|
-
...samplePositions.boxes,
|
|
28
|
-
onlyKeyframes: false,
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
exports.getKeyframesFromGroupOfSamplePositions = getKeyframesFromGroupOfSamplePositions;
|
|
32
|
-
const groupGetKeyframesFromGroupOfSamplePositions = (samplePositions) => {
|
|
33
|
-
return samplePositions
|
|
34
|
-
.map((s) => (0, exports.getKeyframesFromGroupOfSamplePositions)(s))
|
|
35
|
-
.flat();
|
|
36
|
-
};
|
|
37
|
-
exports.groupGetKeyframesFromGroupOfSamplePositions = groupGetKeyframesFromGroupOfSamplePositions;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { SamplePosition } from '../../get-sample-positions';
|
|
2
|
-
import type { GroupOfSamplePositions } from './sample-positions';
|
|
3
|
-
import type { CttsBox } from './stsd/ctts';
|
|
4
|
-
import type { StcoBox } from './stsd/stco';
|
|
5
|
-
import type { StscBox } from './stsd/stsc';
|
|
6
|
-
import type { StssBox } from './stsd/stss';
|
|
7
|
-
import type { StszBox } from './stsd/stsz';
|
|
8
|
-
import type { SttsBox } from './stsd/stts';
|
|
9
|
-
export declare const turnSamplePositionsIntoArraySlow: ({ stcoBox, stszBox, stscBox, stssBox, sttsBox, cttsBox, onlyKeyframes, }: {
|
|
10
|
-
stcoBox: StcoBox;
|
|
11
|
-
stszBox: StszBox;
|
|
12
|
-
stscBox: StscBox;
|
|
13
|
-
stssBox: StssBox | null;
|
|
14
|
-
sttsBox: SttsBox;
|
|
15
|
-
cttsBox: CttsBox | null;
|
|
16
|
-
onlyKeyframes: boolean;
|
|
17
|
-
}) => SamplePosition[];
|
|
18
|
-
export declare const turnIntoOld: (samplePositions: GroupOfSamplePositions) => SamplePosition[];
|
|
19
|
-
export declare const turnGroupIntoOld: (samplePositions: GroupOfSamplePositions[]) => SamplePosition[];
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.turnGroupIntoOld = exports.turnIntoOld = exports.turnSamplePositionsIntoArraySlow = void 0;
|
|
4
|
-
const turnSamplePositionsIntoArraySlow = ({ stcoBox, stszBox, stscBox, stssBox, sttsBox, cttsBox, onlyKeyframes, }) => {
|
|
5
|
-
var _a;
|
|
6
|
-
const sttsDeltas = [];
|
|
7
|
-
for (const distribution of sttsBox.sampleDistribution) {
|
|
8
|
-
for (let i = 0; i < distribution.sampleCount; i++) {
|
|
9
|
-
sttsDeltas.push(distribution.sampleDelta);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
const cttsEntries = [];
|
|
13
|
-
for (const entry of (_a = cttsBox === null || cttsBox === void 0 ? void 0 : cttsBox.entries) !== null && _a !== void 0 ? _a : [
|
|
14
|
-
{ sampleCount: sttsDeltas.length, sampleOffset: 0 },
|
|
15
|
-
]) {
|
|
16
|
-
for (let i = 0; i < entry.sampleCount; i++) {
|
|
17
|
-
cttsEntries.push(entry.sampleOffset);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
let dts = 0;
|
|
21
|
-
const samples = [];
|
|
22
|
-
let samplesPerChunk = 1;
|
|
23
|
-
for (let i = 0; i < stcoBox.entries.length; i++) {
|
|
24
|
-
const hasEntry = stscBox.entries.find((entry) => entry.firstChunk === i + 1);
|
|
25
|
-
if (hasEntry) {
|
|
26
|
-
samplesPerChunk = hasEntry.samplesPerChunk;
|
|
27
|
-
}
|
|
28
|
-
let offsetInThisChunk = 0;
|
|
29
|
-
for (let j = 0; j < samplesPerChunk; j++) {
|
|
30
|
-
const isKeyframe = stssBox
|
|
31
|
-
? stssBox.sampleNumber.includes(samples.length + 1)
|
|
32
|
-
: true;
|
|
33
|
-
if (onlyKeyframes && !isKeyframe) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const size = stszBox.countType === 'fixed'
|
|
37
|
-
? stszBox.sampleSize
|
|
38
|
-
: stszBox.entries[samples.length];
|
|
39
|
-
const delta = sttsDeltas[samples.length];
|
|
40
|
-
const ctsOffset = cttsEntries[samples.length];
|
|
41
|
-
const cts = dts + ctsOffset;
|
|
42
|
-
samples.push({
|
|
43
|
-
offset: Number(stcoBox.entries[i]) + offsetInThisChunk,
|
|
44
|
-
size,
|
|
45
|
-
isKeyframe,
|
|
46
|
-
dts,
|
|
47
|
-
cts,
|
|
48
|
-
duration: delta,
|
|
49
|
-
chunk: i,
|
|
50
|
-
bigEndian: false,
|
|
51
|
-
chunkSize: null,
|
|
52
|
-
});
|
|
53
|
-
dts += delta;
|
|
54
|
-
offsetInThisChunk += size;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return samples;
|
|
58
|
-
};
|
|
59
|
-
exports.turnSamplePositionsIntoArraySlow = turnSamplePositionsIntoArraySlow;
|
|
60
|
-
const turnIntoOld = (samplePositions) => {
|
|
61
|
-
if (samplePositions.type === 'map') {
|
|
62
|
-
return (0, exports.turnSamplePositionsIntoArraySlow)({
|
|
63
|
-
...samplePositions.boxes,
|
|
64
|
-
onlyKeyframes: false,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return samplePositions.boxes;
|
|
68
|
-
};
|
|
69
|
-
exports.turnIntoOld = turnIntoOld;
|
|
70
|
-
const turnGroupIntoOld = (samplePositions) => {
|
|
71
|
-
return samplePositions.map((s) => (0, exports.turnIntoOld)(s)).flat();
|
|
72
|
-
};
|
|
73
|
-
exports.turnGroupIntoOld = turnGroupIntoOld;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { MediaParserController } from '../../controller/media-parser-controller';
|
|
2
|
-
import type { PrefetchCache } from '../../fetch';
|
|
3
|
-
import type { AudioTrack, VideoTrack } from '../../get-tracks';
|
|
4
|
-
import type { LogLevel } from '../../log';
|
|
5
|
-
import type { ReaderInterface } from '../../readers/reader';
|
|
6
|
-
import type { M3uRun, M3uState } from '../../state/m3u-state';
|
|
7
|
-
import type { OnAudioSample, OnVideoSample } from '../../webcodec-sample-types';
|
|
8
|
-
import type { M3uStructure } from './types';
|
|
9
|
-
export declare const iteratorOverSegmentFiles: ({ structure, onVideoTrack, m3uState, onAudioTrack, onDoneWithTracks, playlistUrl, logLevel, parentController, onInitialProgress, readerInterface, prefetchCache, }: {
|
|
10
|
-
structure: M3uStructure;
|
|
11
|
-
onVideoTrack: null | ((track: VideoTrack) => Promise<OnVideoSample | null>);
|
|
12
|
-
onAudioTrack: null | ((track: AudioTrack) => Promise<OnAudioSample | null>);
|
|
13
|
-
onDoneWithTracks: () => void;
|
|
14
|
-
m3uState: M3uState;
|
|
15
|
-
playlistUrl: string;
|
|
16
|
-
logLevel: LogLevel;
|
|
17
|
-
parentController: MediaParserController;
|
|
18
|
-
onInitialProgress: (run: M3uRun | null) => void;
|
|
19
|
-
readerInterface: ReaderInterface;
|
|
20
|
-
prefetchCache: PrefetchCache;
|
|
21
|
-
}) => Promise<void>;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.iteratorOverSegmentFiles = void 0;
|
|
4
|
-
const media_parser_controller_1 = require("../../controller/media-parser-controller");
|
|
5
|
-
const forward_controller_pause_resume_abort_1 = require("../../forward-controller-pause-resume-abort");
|
|
6
|
-
const parse_media_1 = require("../../parse-media");
|
|
7
|
-
const with_resolvers_1 = require("../../with-resolvers");
|
|
8
|
-
const get_chunks_1 = require("./get-chunks");
|
|
9
|
-
const get_playlist_1 = require("./get-playlist");
|
|
10
|
-
const iteratorOverSegmentFiles = async ({ structure, onVideoTrack, m3uState, onAudioTrack, onDoneWithTracks, playlistUrl, logLevel, parentController, onInitialProgress, readerInterface, prefetchCache, }) => {
|
|
11
|
-
const playlist = (0, get_playlist_1.getPlaylist)(structure, playlistUrl);
|
|
12
|
-
const chunks = (0, get_chunks_1.getChunks)(playlist);
|
|
13
|
-
let resolver = onInitialProgress;
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
-
let rejector = (_e) => { };
|
|
16
|
-
for (const chunk of chunks) {
|
|
17
|
-
resolver = onInitialProgress;
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
-
rejector = (_e) => { };
|
|
20
|
-
const childController = (0, media_parser_controller_1.mediaParserController)();
|
|
21
|
-
const forwarded = (0, forward_controller_pause_resume_abort_1.forwardMediaParserControllerPauseResume)({
|
|
22
|
-
childController,
|
|
23
|
-
parentController,
|
|
24
|
-
});
|
|
25
|
-
const nextChunk = chunks[chunks.indexOf(chunk) + 1];
|
|
26
|
-
if (nextChunk) {
|
|
27
|
-
const nextChunkSource = readerInterface.createAdjacentFileSource(nextChunk.url, playlistUrl);
|
|
28
|
-
readerInterface.preload({
|
|
29
|
-
logLevel,
|
|
30
|
-
range: null,
|
|
31
|
-
src: nextChunkSource,
|
|
32
|
-
prefetchCache,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
const makeContinuationFn = () => {
|
|
36
|
-
return {
|
|
37
|
-
continue() {
|
|
38
|
-
const { promise, reject, resolve } = (0, with_resolvers_1.withResolvers)();
|
|
39
|
-
resolver = resolve;
|
|
40
|
-
rejector = reject;
|
|
41
|
-
childController.resume();
|
|
42
|
-
return promise;
|
|
43
|
-
},
|
|
44
|
-
abort() {
|
|
45
|
-
childController.abort();
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
const isLastChunk = chunk === chunks[chunks.length - 1];
|
|
50
|
-
await childController._internals.checkForAbortAndPause();
|
|
51
|
-
const src = readerInterface.createAdjacentFileSource(chunk.url, playlistUrl);
|
|
52
|
-
try {
|
|
53
|
-
const mp4HeaderSegment = m3uState.getMp4HeaderSegment(playlistUrl);
|
|
54
|
-
const data = await (0, parse_media_1.parseMedia)({
|
|
55
|
-
src,
|
|
56
|
-
acknowledgeRemotionLicense: true,
|
|
57
|
-
logLevel,
|
|
58
|
-
controller: childController,
|
|
59
|
-
progressIntervalInMs: 0,
|
|
60
|
-
onParseProgress: () => {
|
|
61
|
-
childController.pause();
|
|
62
|
-
resolver(makeContinuationFn());
|
|
63
|
-
},
|
|
64
|
-
fields: chunk.isHeader ? { structure: true } : undefined,
|
|
65
|
-
onTracks: () => {
|
|
66
|
-
if (!m3uState.hasEmittedDoneWithTracks(playlistUrl)) {
|
|
67
|
-
m3uState.setHasEmittedDoneWithTracks(playlistUrl);
|
|
68
|
-
onDoneWithTracks();
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
onAudioTrack: onAudioTrack === null
|
|
73
|
-
? null
|
|
74
|
-
: async ({ track }) => {
|
|
75
|
-
const callbackOrFalse = m3uState.hasEmittedAudioTrack(playlistUrl);
|
|
76
|
-
if (callbackOrFalse === false) {
|
|
77
|
-
const callback = await onAudioTrack(track);
|
|
78
|
-
if (!callback) {
|
|
79
|
-
m3uState.setHasEmittedAudioTrack(playlistUrl, null);
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
m3uState.setHasEmittedAudioTrack(playlistUrl, callback);
|
|
83
|
-
return (sample) => {
|
|
84
|
-
return callback(sample);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return callbackOrFalse;
|
|
88
|
-
},
|
|
89
|
-
onVideoTrack: onVideoTrack === null
|
|
90
|
-
? null
|
|
91
|
-
: async ({ track }) => {
|
|
92
|
-
const callbackOrFalse = m3uState.hasEmittedVideoTrack(playlistUrl);
|
|
93
|
-
if (callbackOrFalse === false) {
|
|
94
|
-
const callback = await onVideoTrack({
|
|
95
|
-
...track,
|
|
96
|
-
m3uStreamFormat: chunk.isHeader || mp4HeaderSegment ? 'mp4' : 'ts',
|
|
97
|
-
});
|
|
98
|
-
if (!callback) {
|
|
99
|
-
m3uState.setHasEmittedVideoTrack(playlistUrl, null);
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
m3uState.setHasEmittedVideoTrack(playlistUrl, callback);
|
|
103
|
-
return (sample) => {
|
|
104
|
-
return callback(sample);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return callbackOrFalse;
|
|
108
|
-
},
|
|
109
|
-
reader: readerInterface,
|
|
110
|
-
mp4HeaderSegment,
|
|
111
|
-
makeSamplesStartAtZero: false,
|
|
112
|
-
});
|
|
113
|
-
if (chunk.isHeader) {
|
|
114
|
-
if (data.structure.type !== 'iso-base-media') {
|
|
115
|
-
throw new Error('Expected an mp4 file');
|
|
116
|
-
}
|
|
117
|
-
m3uState.setMp4HeaderSegment(playlistUrl, data.structure);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
rejector(e);
|
|
122
|
-
throw e;
|
|
123
|
-
}
|
|
124
|
-
forwarded.cleanup();
|
|
125
|
-
if (!isLastChunk) {
|
|
126
|
-
childController.pause();
|
|
127
|
-
resolver(makeContinuationFn());
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
resolver(null);
|
|
131
|
-
};
|
|
132
|
-
exports.iteratorOverSegmentFiles = iteratorOverSegmentFiles;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ParserState } from '../../state/parser-state';
|
|
2
|
-
import type { AudioOrVideoSample } from '../../webcodec-sample-types';
|
|
3
|
-
export declare const getAudioSampleFromCbr: ({ bitrateInKbit, initialOffset, layer, sampleRate, samplesPerFrame, data, state, }: {
|
|
4
|
-
bitrateInKbit: number;
|
|
5
|
-
layer: number;
|
|
6
|
-
samplesPerFrame: number;
|
|
7
|
-
sampleRate: number;
|
|
8
|
-
initialOffset: number;
|
|
9
|
-
data: Uint8Array;
|
|
10
|
-
state: ParserState;
|
|
11
|
-
}) => AudioOrVideoSample;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAudioSampleFromCbr = void 0;
|
|
4
|
-
const get_frame_length_1 = require("./get-frame-length");
|
|
5
|
-
const getAudioSampleFromCbr = ({ bitrateInKbit, initialOffset, layer, sampleRate, samplesPerFrame, data, state, }) => {
|
|
6
|
-
const avgLength = (0, get_frame_length_1.getAverageMpegFrameLength)({
|
|
7
|
-
bitrateKbit: bitrateInKbit,
|
|
8
|
-
layer,
|
|
9
|
-
samplesPerFrame,
|
|
10
|
-
samplingFrequency: sampleRate,
|
|
11
|
-
});
|
|
12
|
-
const mp3Info = state.mp3.getMp3Info();
|
|
13
|
-
if (!mp3Info) {
|
|
14
|
-
throw new Error('No MP3 info');
|
|
15
|
-
}
|
|
16
|
-
const nthFrame = Math.round((initialOffset - state.mediaSection.getMediaSectionAssertOnlyOne().start) /
|
|
17
|
-
avgLength);
|
|
18
|
-
const durationInSeconds = samplesPerFrame / sampleRate;
|
|
19
|
-
const timeInSeconds = (nthFrame * samplesPerFrame) / sampleRate;
|
|
20
|
-
const timestamp = Math.round(timeInSeconds * 1000000);
|
|
21
|
-
const duration = Math.round(durationInSeconds * 1000000);
|
|
22
|
-
const audioSample = {
|
|
23
|
-
data,
|
|
24
|
-
cts: timestamp,
|
|
25
|
-
dts: timestamp,
|
|
26
|
-
duration,
|
|
27
|
-
offset: initialOffset,
|
|
28
|
-
timescale: 1000000,
|
|
29
|
-
timestamp,
|
|
30
|
-
trackId: 0,
|
|
31
|
-
type: 'key',
|
|
32
|
-
};
|
|
33
|
-
return audioSample;
|
|
34
|
-
};
|
|
35
|
-
exports.getAudioSampleFromCbr = getAudioSampleFromCbr;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { SampleCallbacks } from './state/sample-callbacks';
|
|
2
|
-
import type { AudioOrVideoSample } from './webcodec-sample-types';
|
|
3
|
-
export declare const emitAudioSample: ({ trackId, audioSample, callbacks, }: {
|
|
4
|
-
trackId: number;
|
|
5
|
-
audioSample: AudioOrVideoSample;
|
|
6
|
-
callbacks: SampleCallbacks;
|
|
7
|
-
}) => Promise<void>;
|
|
8
|
-
export declare const emitVideoSample: ({ trackId, videoSample, callbacks, }: {
|
|
9
|
-
trackId: number;
|
|
10
|
-
videoSample: AudioOrVideoSample;
|
|
11
|
-
callbacks: SampleCallbacks;
|
|
12
|
-
}) => Promise<void>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emitVideoSample = exports.emitAudioSample = void 0;
|
|
4
|
-
const emitAudioSample = async ({ trackId, audioSample, callbacks, }) => {
|
|
5
|
-
await callbacks.onAudioSample(trackId, audioSample);
|
|
6
|
-
};
|
|
7
|
-
exports.emitAudioSample = emitAudioSample;
|
|
8
|
-
const emitVideoSample = async ({ trackId, videoSample, callbacks, }) => {
|
|
9
|
-
await callbacks.onVideoSample(trackId, videoSample);
|
|
10
|
-
};
|
|
11
|
-
exports.emitVideoSample = emitVideoSample;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseMediaOnServerWorker = void 0;
|
|
4
|
-
const parse_media_on_worker_entry_1 = require("./parse-media-on-worker-entry");
|
|
5
|
-
const parseMediaOnServerWorker = (params) => {
|
|
6
|
-
if (typeof Worker === 'undefined') {
|
|
7
|
-
throw new Error('"Worker" is not available. Cannot call parseMediaOnServerWorker()');
|
|
8
|
-
}
|
|
9
|
-
const worker = new Worker(new URL('./worker-server-entry', import.meta.url));
|
|
10
|
-
return (0, parse_media_on_worker_entry_1.parseMediaOnWorkerImplementation)(params, worker, 'parseMediaOnServerWorker');
|
|
11
|
-
};
|
|
12
|
-
exports.parseMediaOnServerWorker = parseMediaOnServerWorker;
|