@remotion/media-parser 4.0.290 → 4.0.292
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/containers/iso-base-media/base-media-box.d.ts +0 -1
- package/dist/containers/iso-base-media/collect-sample-positions-from-moof-boxes.d.ts +4 -1
- package/dist/containers/iso-base-media/collect-sample-positions-from-moof-boxes.js +9 -5
- package/dist/containers/iso-base-media/find-keyframe-before-time.js +16 -11
- package/dist/containers/iso-base-media/find-track-to-seek.d.ts +14 -0
- package/dist/containers/iso-base-media/find-track-to-seek.js +39 -0
- package/dist/containers/iso-base-media/get-children.js +2 -2
- package/dist/containers/iso-base-media/get-keyframes.js +6 -1
- package/dist/containers/iso-base-media/get-mfra-seeking-box.d.ts +3 -1
- package/dist/containers/iso-base-media/get-mfra-seeking-box.js +5 -1
- package/dist/containers/iso-base-media/get-moov-atom.js +6 -3
- package/dist/containers/iso-base-media/get-sample-position-bounds.js +3 -1
- package/dist/containers/iso-base-media/get-sample-positions-from-track.js +1 -1
- package/dist/containers/iso-base-media/get-seeking-byte-from-fragmented-mp4.d.ts +14 -0
- package/dist/containers/iso-base-media/get-seeking-byte-from-fragmented-mp4.js +89 -0
- package/dist/containers/iso-base-media/get-seeking-byte.d.ts +3 -3
- package/dist/containers/iso-base-media/get-seeking-byte.js +32 -96
- package/dist/containers/iso-base-media/mdat/calculate-jump-marks.d.ts +6 -0
- package/dist/containers/iso-base-media/mdat/calculate-jump-marks.js +131 -0
- package/dist/containers/iso-base-media/mdat/mdat.d.ts +2 -2
- package/dist/containers/iso-base-media/mdat/mdat.js +18 -2
- package/dist/containers/iso-base-media/mfra/find-best-segment-from-tfra.d.ts +3 -3
- package/dist/containers/iso-base-media/mfra/find-best-segment-from-tfra.js +2 -2
- package/dist/containers/iso-base-media/mfra/get-mfra-atom.d.ts +5 -1
- package/dist/containers/iso-base-media/mfra/get-mfra-atom.js +3 -1
- package/dist/containers/iso-base-media/mfra/get-mfro-atom.d.ts +5 -1
- package/dist/containers/iso-base-media/mfra/get-mfro-atom.js +3 -1
- package/dist/containers/iso-base-media/parse-boxes.js +5 -2
- package/dist/containers/iso-base-media/process-box.d.ts +16 -5
- package/dist/containers/iso-base-media/process-box.js +206 -118
- package/dist/containers/iso-base-media/sample-positions.d.ts +25 -0
- package/dist/containers/iso-base-media/sample-positions.js +37 -0
- package/dist/containers/iso-base-media/stsd/samples.js +1 -0
- package/dist/containers/iso-base-media/stsd/stsc.d.ts +1 -6
- package/dist/containers/iso-base-media/stsd/stsc.js +2 -5
- package/dist/containers/iso-base-media/stsd/stss.d.ts +1 -1
- package/dist/containers/iso-base-media/stsd/stss.js +2 -2
- package/dist/containers/iso-base-media/turn-sample-positions-into-array.d.ts +19 -0
- package/dist/containers/iso-base-media/turn-sample-positions-into-array.js +73 -0
- package/dist/containers/m3u/after-manifest-fetch.d.ts +5 -1
- package/dist/containers/m3u/after-manifest-fetch.js +3 -1
- package/dist/containers/m3u/first-sample-in-m3u-chunk.d.ts +13 -0
- package/dist/containers/m3u/first-sample-in-m3u-chunk.js +31 -0
- package/dist/containers/m3u/get-seeking-byte.d.ts +13 -0
- package/dist/containers/m3u/get-seeking-byte.js +32 -0
- package/dist/containers/m3u/get-streams.d.ts +1 -0
- package/dist/containers/m3u/get-streams.js +1 -0
- package/dist/containers/m3u/iterate-over-segment-files.d.ts +5 -3
- package/dist/containers/m3u/iterate-over-segment-files.js +11 -1
- package/dist/containers/m3u/parse-m3u-media-directive.js +1 -0
- package/dist/containers/m3u/parse-m3u.js +8 -0
- package/dist/containers/m3u/process-m3u-chunk.d.ts +12 -0
- package/dist/containers/m3u/process-m3u-chunk.js +274 -0
- package/dist/containers/m3u/run-over-m3u.js +7 -80
- package/dist/containers/m3u/sample-sorter.d.ts +1 -0
- package/dist/containers/m3u/sample-sorter.js +4 -1
- package/dist/containers/m3u/seek/get-chunk-to-seek-to.d.ts +5 -0
- package/dist/containers/m3u/seek/get-chunk-to-seek-to.js +14 -0
- package/dist/containers/m3u/seeking-hints.d.ts +2 -0
- package/dist/containers/m3u/seeking-hints.js +9 -0
- package/dist/containers/m3u/select-stream.d.ts +2 -1
- package/dist/containers/m3u/select-stream.js +7 -2
- package/dist/containers/m3u/types.d.ts +1 -0
- package/dist/containers/riff/seek/fetch-idx1.d.ts +3 -1
- package/dist/containers/riff/seek/fetch-idx1.js +3 -1
- package/dist/containers/transport-stream/handle-aac-packet.d.ts +2 -2
- package/dist/containers/transport-stream/handle-avc-packet.d.ts +2 -2
- package/dist/containers/transport-stream/process-audio.d.ts +2 -2
- package/dist/containers/transport-stream/process-stream-buffers.d.ts +3 -3
- package/dist/containers/transport-stream/process-video.d.ts +2 -2
- package/dist/containers/webm/get-sample-from-block.d.ts +12 -2
- package/dist/containers/webm/get-sample-from-block.js +40 -9
- package/dist/containers/webm/parse-ebml.js +28 -10
- package/dist/containers/webm/seek/fetch-web-cues.d.ts +3 -1
- package/dist/containers/webm/seek/fetch-web-cues.js +3 -1
- package/dist/containers/webm/state-for-processing.d.ts +2 -2
- package/dist/controller/media-parser-controller.d.ts +1 -1
- package/dist/controller/media-parser-controller.js +6 -2
- package/dist/controller/seek-signal.d.ts +1 -5
- package/dist/download-and-parse-media.js +1 -1
- package/dist/esm/index.mjs +1400 -611
- package/dist/esm/node.mjs +23 -3
- package/dist/esm/server-worker.mjs +8 -1
- package/dist/esm/universal.mjs +168 -15
- package/dist/esm/web.mjs +145 -13
- package/dist/esm/worker-server-entry.mjs +1467 -635
- package/dist/esm/worker-web-entry.mjs +1439 -634
- package/dist/esm/worker.mjs +8 -1
- package/dist/get-audio-codec.js +3 -0
- package/dist/get-duration.js +2 -1
- package/dist/get-fps.js +2 -1
- package/dist/get-sample-positions-from-mp4.js +10 -5
- package/dist/get-sample-positions.js +4 -4
- package/dist/get-seeking-byte.d.ts +5 -3
- package/dist/get-seeking-byte.js +19 -10
- package/dist/get-seeking-hints.d.ts +3 -3
- package/dist/get-seeking-hints.js +18 -13
- package/dist/get-tracks.d.ts +9 -1
- package/dist/get-tracks.js +13 -6
- package/dist/index.d.ts +21 -5
- package/dist/init-video.js +3 -2
- package/dist/internal-parse-media.js +13 -4
- package/dist/iterator/buffer-iterator.js +5 -3
- package/dist/metadata/metadata-from-iso.js +2 -1
- package/dist/options.d.ts +6 -1
- package/dist/parse-loop.js +22 -6
- package/dist/parse-media-on-worker-entry.js +1 -0
- package/dist/parse-media.js +1 -1
- package/dist/parse-result.d.ts +2 -2
- package/dist/perform-seek.d.ts +3 -1
- package/dist/perform-seek.js +3 -1
- package/dist/readers/fetch/get-body-and-reader.js +17 -2
- package/dist/readers/from-fetch.d.ts +17 -1
- package/dist/readers/from-fetch.js +68 -13
- package/dist/readers/from-node.js +24 -2
- package/dist/readers/from-web-file.js +3 -0
- package/dist/readers/reader.d.ts +19 -2
- package/dist/readers/universal.js +9 -0
- package/dist/readers/web.js +6 -0
- package/dist/register-track.d.ts +3 -3
- package/dist/seek-backwards.d.ts +3 -1
- package/dist/seek-backwards.js +4 -1
- package/dist/seek-forwards.d.ts +3 -1
- package/dist/seek-forwards.js +3 -1
- package/dist/seeking-hints.d.ts +4 -1
- package/dist/set-seeking-hints.js +4 -0
- package/dist/skip.d.ts +5 -0
- package/dist/skip.js +6 -1
- package/dist/state/can-skip-tracks.d.ts +1 -0
- package/dist/state/can-skip-tracks.js +10 -6
- package/dist/state/iso-base-media/cached-sample-positions.d.ts +15 -1
- package/dist/state/iso-base-media/cached-sample-positions.js +9 -4
- package/dist/state/iso-base-media/iso-state.d.ts +5 -1
- package/dist/state/iso-base-media/iso-state.js +2 -1
- package/dist/state/iso-base-media/lazy-mfra-load.d.ts +3 -1
- package/dist/state/iso-base-media/lazy-mfra-load.js +2 -1
- package/dist/state/keyframes.js +1 -0
- package/dist/state/m3u-state.d.ts +15 -4
- package/dist/state/m3u-state.js +20 -0
- package/dist/state/matroska/lazy-cues-fetch.d.ts +3 -1
- package/dist/state/matroska/lazy-cues-fetch.js +2 -1
- package/dist/state/matroska/webm.d.ts +3 -1
- package/dist/state/matroska/webm.js +2 -1
- package/dist/state/parser-state.d.ts +29 -13
- package/dist/state/parser-state.js +19 -5
- package/dist/state/riff/lazy-idx1-fetch.d.ts +3 -1
- package/dist/state/riff/lazy-idx1-fetch.js +2 -1
- package/dist/state/riff.d.ts +3 -1
- package/dist/state/riff.js +2 -1
- package/dist/state/sample-callbacks.d.ts +3 -2
- package/dist/state/sample-callbacks.js +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/work-on-seek-request.d.ts +6 -3
- package/dist/work-on-seek-request.js +13 -13
- package/dist/worker/forward-controller-to-worker.js +1 -1
- package/dist/worker/serialize-error.js +26 -3
- package/dist/worker/worker-types.d.ts +7 -1
- package/dist/worker-server.js +2 -2
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { JumpMark } from '../../containers/iso-base-media/mdat/calculate-jump-marks';
|
|
1
2
|
import type { SamplePosition } from '../../get-sample-positions';
|
|
2
3
|
import type { AudioTrack, OtherTrack, VideoTrack } from '../../get-tracks';
|
|
3
4
|
import type { ParserState } from '../parser-state';
|
|
@@ -5,11 +6,24 @@ export type FlatSample = {
|
|
|
5
6
|
track: VideoTrack | AudioTrack | OtherTrack;
|
|
6
7
|
samplePosition: SamplePosition;
|
|
7
8
|
};
|
|
9
|
+
export type MinimalFlatSampleForTesting = {
|
|
10
|
+
track: {
|
|
11
|
+
trackId: number;
|
|
12
|
+
timescale: number;
|
|
13
|
+
type: 'audio' | 'video' | 'other';
|
|
14
|
+
};
|
|
15
|
+
samplePosition: {
|
|
16
|
+
dts: number;
|
|
17
|
+
offset: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
8
20
|
export declare const calculateFlatSamples: (state: ParserState) => {
|
|
9
21
|
track: VideoTrack | AudioTrack | OtherTrack;
|
|
10
22
|
samplePosition: SamplePosition;
|
|
11
|
-
}[];
|
|
23
|
+
}[][];
|
|
12
24
|
export declare const cachedSamplePositionsState: () => {
|
|
13
25
|
getSamples: (mdatStart: number) => FlatSample[] | null;
|
|
14
26
|
setSamples: (mdatStart: number, samples: FlatSample[]) => void;
|
|
27
|
+
setJumpMarks: (mdatStart: number, marks: JumpMark[]) => void;
|
|
28
|
+
getJumpMarks: (mdatStart: number) => JumpMark[];
|
|
15
29
|
};
|
|
@@ -11,8 +11,7 @@ const calculateFlatSamples = (state) => {
|
|
|
11
11
|
...tracks.audioTracks,
|
|
12
12
|
...tracks.otherTracks,
|
|
13
13
|
];
|
|
14
|
-
const flatSamples = allTracks
|
|
15
|
-
.map((track) => {
|
|
14
|
+
const flatSamples = allTracks.map((track) => {
|
|
16
15
|
const { samplePositions } = (0, get_sample_positions_from_track_1.getSamplePositionsFromTrack)({
|
|
17
16
|
trakBox: track.trakBox,
|
|
18
17
|
moofBoxes: (0, traversal_1.getMoofBoxes)(state.structure.getIsoStructure().boxes),
|
|
@@ -24,13 +23,13 @@ const calculateFlatSamples = (state) => {
|
|
|
24
23
|
samplePosition,
|
|
25
24
|
};
|
|
26
25
|
});
|
|
27
|
-
})
|
|
28
|
-
.flat(1);
|
|
26
|
+
});
|
|
29
27
|
return flatSamples;
|
|
30
28
|
};
|
|
31
29
|
exports.calculateFlatSamples = calculateFlatSamples;
|
|
32
30
|
const cachedSamplePositionsState = () => {
|
|
33
31
|
const cachedForMdatStart = {};
|
|
32
|
+
const jumpMarksForMdatStart = {};
|
|
34
33
|
return {
|
|
35
34
|
getSamples: (mdatStart) => {
|
|
36
35
|
if (cachedForMdatStart[mdatStart]) {
|
|
@@ -41,6 +40,12 @@ const cachedSamplePositionsState = () => {
|
|
|
41
40
|
setSamples: (mdatStart, samples) => {
|
|
42
41
|
cachedForMdatStart[mdatStart] = samples;
|
|
43
42
|
},
|
|
43
|
+
setJumpMarks: (mdatStart, marks) => {
|
|
44
|
+
jumpMarksForMdatStart[mdatStart] = marks;
|
|
45
|
+
},
|
|
46
|
+
getJumpMarks: (mdatStart) => {
|
|
47
|
+
return jumpMarksForMdatStart[mdatStart];
|
|
48
|
+
},
|
|
44
49
|
};
|
|
45
50
|
};
|
|
46
51
|
exports.cachedSamplePositionsState = cachedSamplePositionsState;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import type { MediaParserController } from '../../controller/media-parser-controller';
|
|
2
|
+
import type { PrefetchCache } from '../../fetch';
|
|
2
3
|
import type { LogLevel } from '../../log';
|
|
3
4
|
import type { ParseMediaSrc } from '../../options';
|
|
4
5
|
import type { ReaderInterface } from '../../readers/reader';
|
|
5
|
-
export declare const isoBaseMediaState: ({ contentLength, controller, readerInterface, src, logLevel, }: {
|
|
6
|
+
export declare const isoBaseMediaState: ({ contentLength, controller, readerInterface, src, logLevel, prefetchCache, }: {
|
|
6
7
|
contentLength: number;
|
|
7
8
|
controller: MediaParserController;
|
|
8
9
|
readerInterface: ReaderInterface;
|
|
9
10
|
src: ParseMediaSrc;
|
|
10
11
|
logLevel: LogLevel;
|
|
12
|
+
prefetchCache: PrefetchCache;
|
|
11
13
|
}) => {
|
|
12
14
|
flatSamples: {
|
|
13
15
|
getSamples: (mdatStart: number) => import("./cached-sample-positions").FlatSample[] | null;
|
|
14
16
|
setSamples: (mdatStart: number, samples: import("./cached-sample-positions").FlatSample[]) => void;
|
|
17
|
+
setJumpMarks: (mdatStart: number, marks: import("../../containers/iso-base-media/mdat/calculate-jump-marks").JumpMark[]) => void;
|
|
18
|
+
getJumpMarks: (mdatStart: number) => import("../../containers/iso-base-media/mdat/calculate-jump-marks").JumpMark[];
|
|
15
19
|
};
|
|
16
20
|
moov: {
|
|
17
21
|
setMoovBox: (moov: {
|
|
@@ -6,7 +6,7 @@ const lazy_mfra_load_1 = require("./lazy-mfra-load");
|
|
|
6
6
|
const moov_box_1 = require("./moov-box");
|
|
7
7
|
const precomputed_moof_1 = require("./precomputed-moof");
|
|
8
8
|
const precomputed_tfra_1 = require("./precomputed-tfra");
|
|
9
|
-
const isoBaseMediaState = ({ contentLength, controller, readerInterface, src, logLevel, }) => {
|
|
9
|
+
const isoBaseMediaState = ({ contentLength, controller, readerInterface, src, logLevel, prefetchCache, }) => {
|
|
10
10
|
return {
|
|
11
11
|
flatSamples: (0, cached_sample_positions_1.cachedSamplePositionsState)(),
|
|
12
12
|
moov: (0, moov_box_1.moovState)(),
|
|
@@ -16,6 +16,7 @@ const isoBaseMediaState = ({ contentLength, controller, readerInterface, src, lo
|
|
|
16
16
|
readerInterface,
|
|
17
17
|
src,
|
|
18
18
|
logLevel,
|
|
19
|
+
prefetchCache,
|
|
19
20
|
}),
|
|
20
21
|
moof: (0, precomputed_moof_1.precomputedMoofState)(),
|
|
21
22
|
tfra: (0, precomputed_tfra_1.precomputedTfraState)(),
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { IsoBaseMediaBox } from '../../containers/iso-base-media/base-media-box';
|
|
2
2
|
import type { MediaParserController } from '../../controller/media-parser-controller';
|
|
3
|
+
import type { PrefetchCache } from '../../fetch';
|
|
3
4
|
import { type LogLevel } from '../../log';
|
|
4
5
|
import type { ParseMediaSrc } from '../../options';
|
|
5
6
|
import type { ReaderInterface } from '../../readers/reader';
|
|
6
7
|
import type { IsoBaseMediaSeekingHints } from '../../seeking-hints';
|
|
7
|
-
export declare const lazyMfraLoad: ({ contentLength, controller, readerInterface, src, logLevel, }: {
|
|
8
|
+
export declare const lazyMfraLoad: ({ contentLength, controller, readerInterface, src, logLevel, prefetchCache, }: {
|
|
8
9
|
contentLength: number;
|
|
9
10
|
controller: MediaParserController;
|
|
10
11
|
readerInterface: ReaderInterface;
|
|
11
12
|
src: ParseMediaSrc;
|
|
12
13
|
logLevel: LogLevel;
|
|
14
|
+
prefetchCache: PrefetchCache;
|
|
13
15
|
}) => {
|
|
14
16
|
triggerLoad: () => Promise<IsoBaseMediaBox[] | null>;
|
|
15
17
|
getIfAlreadyLoaded: () => IsoBaseMediaBox[] | null;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.lazyMfraLoad = void 0;
|
|
4
4
|
const get_mfra_seeking_box_1 = require("../../containers/iso-base-media/get-mfra-seeking-box");
|
|
5
5
|
const log_1 = require("../../log");
|
|
6
|
-
const lazyMfraLoad = ({ contentLength, controller, readerInterface, src, logLevel, }) => {
|
|
6
|
+
const lazyMfraLoad = ({ contentLength, controller, readerInterface, src, logLevel, prefetchCache, }) => {
|
|
7
7
|
let prom = null;
|
|
8
8
|
let result = null;
|
|
9
9
|
const triggerLoad = () => {
|
|
@@ -17,6 +17,7 @@ const lazyMfraLoad = ({ contentLength, controller, readerInterface, src, logLeve
|
|
|
17
17
|
readerInterface,
|
|
18
18
|
src,
|
|
19
19
|
logLevel,
|
|
20
|
+
prefetchCache,
|
|
20
21
|
}).then((boxes) => {
|
|
21
22
|
log_1.Log.verbose(logLevel, 'Lazily found mfra atom.');
|
|
22
23
|
result = boxes;
|
package/dist/state/keyframes.js
CHANGED
|
@@ -9,10 +9,13 @@ export type M3uStreamOrInitialUrl = {
|
|
|
9
9
|
type: 'initial-url';
|
|
10
10
|
url: string;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
13
|
-
continue: () => Promise<
|
|
12
|
+
export type M3uRun = {
|
|
13
|
+
continue: () => Promise<M3uRun | null>;
|
|
14
14
|
abort: () => void;
|
|
15
15
|
};
|
|
16
|
+
type M3uSeek = {
|
|
17
|
+
targetTime: number;
|
|
18
|
+
};
|
|
16
19
|
export declare const m3uState: (logLevel: LogLevel) => {
|
|
17
20
|
setSelectedMainPlaylist: (stream: M3uStreamOrInitialUrl) => void;
|
|
18
21
|
getSelectedMainPlaylist: () => M3uStreamOrInitialUrl | null;
|
|
@@ -25,19 +28,22 @@ export declare const m3uState: (logLevel: LogLevel) => {
|
|
|
25
28
|
setReadyToIterateOverM3u: () => void;
|
|
26
29
|
isReadyToIterateOverM3u: () => boolean;
|
|
27
30
|
setAllChunksProcessed: (src: string) => void;
|
|
31
|
+
clearAllChunksProcessed: () => void;
|
|
28
32
|
getAllChunksProcessedForPlaylist: (src: string) => boolean;
|
|
29
33
|
getAllChunksProcessedOverall: () => boolean;
|
|
30
34
|
setHasFinishedManifest: () => void;
|
|
31
35
|
hasFinishedManifest: () => boolean;
|
|
32
|
-
setM3uStreamRun: (playlistUrl: string, run:
|
|
36
|
+
setM3uStreamRun: (playlistUrl: string, run: M3uRun | null) => void;
|
|
33
37
|
setTracksDone: (playlistUrl: string) => boolean;
|
|
34
38
|
getTrackDone: (playlistUrl: string) => boolean;
|
|
35
|
-
|
|
39
|
+
clearTracksDone: () => void;
|
|
40
|
+
getM3uStreamRun: (playlistUrl: string) => M3uRun;
|
|
36
41
|
abortM3UStreamRuns: () => void;
|
|
37
42
|
setAssociatedPlaylists: (playlists: M3uAssociatedPlaylist[]) => void;
|
|
38
43
|
getAssociatedPlaylists: () => M3uAssociatedPlaylist[] | null;
|
|
39
44
|
getSelectedPlaylists: () => string[];
|
|
40
45
|
sampleSorter: {
|
|
46
|
+
clearSamples: () => void;
|
|
41
47
|
addToStreamWithTrack: (src: string) => void;
|
|
42
48
|
addVideoStreamToConsider: (src: string, callback: OnVideoSample) => void;
|
|
43
49
|
addAudioStreamToConsider: (src: string, callback: OnAudioSample) => void;
|
|
@@ -49,5 +55,10 @@ export declare const m3uState: (logLevel: LogLevel) => {
|
|
|
49
55
|
};
|
|
50
56
|
setMp4HeaderSegment: (playlistUrl: string, structure: IsoBaseMediaStructure) => void;
|
|
51
57
|
getMp4HeaderSegment: (playlistUrl: string) => IsoBaseMediaStructure;
|
|
58
|
+
setSeekToSecondsToProcess: (playlistUrl: string, m3uSeek: M3uSeek | null) => void;
|
|
59
|
+
getSeekToSecondsToProcess: (playlistUrl: string) => M3uSeek | null;
|
|
60
|
+
setNextSeekShouldSubtractChunks: (playlistUrl: string, chunks: number) => void;
|
|
61
|
+
getNextSeekShouldSubtractChunks: (playlistUrl: string) => number;
|
|
52
62
|
};
|
|
53
63
|
export type M3uState = ReturnType<typeof m3uState>;
|
|
64
|
+
export {};
|
package/dist/state/m3u-state.js
CHANGED
|
@@ -10,6 +10,8 @@ const m3uState = (logLevel) => {
|
|
|
10
10
|
const hasEmittedAudioTrack = {};
|
|
11
11
|
const hasEmittedDoneWithTracks = {};
|
|
12
12
|
let hasFinishedManifest = false;
|
|
13
|
+
const seekToSecondsToProcess = {};
|
|
14
|
+
const nextSeekShouldSubtractChunks = {};
|
|
13
15
|
let readyToIterateOverM3u = false;
|
|
14
16
|
const allChunksProcessed = {};
|
|
15
17
|
const m3uStreamRuns = {};
|
|
@@ -73,6 +75,11 @@ const m3uState = (logLevel) => {
|
|
|
73
75
|
setAllChunksProcessed: (src) => {
|
|
74
76
|
allChunksProcessed[src] = true;
|
|
75
77
|
},
|
|
78
|
+
clearAllChunksProcessed: () => {
|
|
79
|
+
Object.keys(allChunksProcessed).forEach((key) => {
|
|
80
|
+
delete allChunksProcessed[key];
|
|
81
|
+
});
|
|
82
|
+
},
|
|
76
83
|
getAllChunksProcessedForPlaylist,
|
|
77
84
|
getAllChunksProcessedOverall: () => {
|
|
78
85
|
if (!selectedMainPlaylist) {
|
|
@@ -100,6 +107,11 @@ const m3uState = (logLevel) => {
|
|
|
100
107
|
getTrackDone: (playlistUrl) => {
|
|
101
108
|
return tracksDone[playlistUrl];
|
|
102
109
|
},
|
|
110
|
+
clearTracksDone: () => {
|
|
111
|
+
Object.keys(tracksDone).forEach((key) => {
|
|
112
|
+
delete tracksDone[key];
|
|
113
|
+
});
|
|
114
|
+
},
|
|
103
115
|
getM3uStreamRun: (playlistUrl) => { var _a; return (_a = m3uStreamRuns[playlistUrl]) !== null && _a !== void 0 ? _a : null; },
|
|
104
116
|
abortM3UStreamRuns: () => {
|
|
105
117
|
const values = Object.values(m3uStreamRuns);
|
|
@@ -119,6 +131,14 @@ const m3uState = (logLevel) => {
|
|
|
119
131
|
sampleSorter: (0, sample_sorter_1.sampleSorter)({ logLevel, getAllChunksProcessedForPlaylist }),
|
|
120
132
|
setMp4HeaderSegment,
|
|
121
133
|
getMp4HeaderSegment,
|
|
134
|
+
setSeekToSecondsToProcess: (playlistUrl, m3uSeek) => {
|
|
135
|
+
seekToSecondsToProcess[playlistUrl] = m3uSeek;
|
|
136
|
+
},
|
|
137
|
+
getSeekToSecondsToProcess: (playlistUrl) => { var _a; return (_a = seekToSecondsToProcess[playlistUrl]) !== null && _a !== void 0 ? _a : null; },
|
|
138
|
+
setNextSeekShouldSubtractChunks: (playlistUrl, chunks) => {
|
|
139
|
+
nextSeekShouldSubtractChunks[playlistUrl] = chunks;
|
|
140
|
+
},
|
|
141
|
+
getNextSeekShouldSubtractChunks: (playlistUrl) => { var _a; return (_a = nextSeekShouldSubtractChunks[playlistUrl]) !== null && _a !== void 0 ? _a : 0; },
|
|
122
142
|
};
|
|
123
143
|
};
|
|
124
144
|
exports.m3uState = m3uState;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { MatroskaCue } from '../../containers/webm/seek/format-cues';
|
|
2
2
|
import type { MediaParserController } from '../../controller/media-parser-controller';
|
|
3
|
+
import type { PrefetchCache } from '../../fetch';
|
|
3
4
|
import type { LogLevel } from '../../log';
|
|
4
5
|
import type { ParseMediaSrc } from '../../options';
|
|
5
6
|
import type { ReaderInterface } from '../../readers/reader';
|
|
6
7
|
import type { WebmSeekingHints } from '../../seeking-hints';
|
|
7
|
-
export declare const lazyCuesFetch: ({ controller, logLevel, readerInterface, src, }: {
|
|
8
|
+
export declare const lazyCuesFetch: ({ controller, logLevel, readerInterface, src, prefetchCache, }: {
|
|
8
9
|
controller: MediaParserController;
|
|
9
10
|
logLevel: LogLevel;
|
|
10
11
|
readerInterface: ReaderInterface;
|
|
11
12
|
src: ParseMediaSrc;
|
|
13
|
+
prefetchCache: PrefetchCache;
|
|
12
14
|
}) => {
|
|
13
15
|
triggerLoad: (position: number, segmentOffset: number) => Promise<MatroskaCue[] | null>;
|
|
14
16
|
getLoadedCues: () => Promise<{
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.lazyCuesFetch = void 0;
|
|
4
4
|
const fetch_web_cues_1 = require("../../containers/webm/seek/fetch-web-cues");
|
|
5
5
|
const log_1 = require("../../log");
|
|
6
|
-
const lazyCuesFetch = ({ controller, logLevel, readerInterface, src, }) => {
|
|
6
|
+
const lazyCuesFetch = ({ controller, logLevel, readerInterface, src, prefetchCache, }) => {
|
|
7
7
|
let prom = null;
|
|
8
8
|
let sOffset = null;
|
|
9
9
|
let result = null;
|
|
@@ -25,6 +25,7 @@ const lazyCuesFetch = ({ controller, logLevel, readerInterface, src, }) => {
|
|
|
25
25
|
position,
|
|
26
26
|
readerInterface,
|
|
27
27
|
src,
|
|
28
|
+
prefetchCache,
|
|
28
29
|
}).then((cues) => {
|
|
29
30
|
log_1.Log.verbose(logLevel, 'Cues loaded');
|
|
30
31
|
result = cues;
|
|
@@ -2,6 +2,7 @@ import type { AvcProfileInfo } from '../../containers/avc/parse-avc';
|
|
|
2
2
|
import type { OnTrackEntrySegment } from '../../containers/webm/segments';
|
|
3
3
|
import type { TrackInfo } from '../../containers/webm/segments/track-entry';
|
|
4
4
|
import type { MediaParserController } from '../../controller/media-parser-controller';
|
|
5
|
+
import type { PrefetchCache } from '../../fetch';
|
|
5
6
|
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
6
7
|
import type { LogLevel } from '../../log';
|
|
7
8
|
import type { ParseMediaSrc } from '../../options';
|
|
@@ -16,11 +17,12 @@ export type ClusterSection = {
|
|
|
16
17
|
size: number;
|
|
17
18
|
segment: number;
|
|
18
19
|
};
|
|
19
|
-
export declare const webmState: ({ controller, logLevel, readerInterface, src, }: {
|
|
20
|
+
export declare const webmState: ({ controller, logLevel, readerInterface, src, prefetchCache, }: {
|
|
20
21
|
controller: MediaParserController;
|
|
21
22
|
logLevel: LogLevel;
|
|
22
23
|
readerInterface: ReaderInterface;
|
|
23
24
|
src: ParseMediaSrc;
|
|
25
|
+
prefetchCache: PrefetchCache;
|
|
24
26
|
}) => {
|
|
25
27
|
cues: {
|
|
26
28
|
triggerLoad: (position: number, segmentOffset: number) => Promise<import("../../containers/webm/seek/format-cues").MatroskaCue[] | null>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.webmState = void 0;
|
|
4
4
|
const traversal_1 = require("../../containers/webm/traversal");
|
|
5
5
|
const lazy_cues_fetch_1 = require("./lazy-cues-fetch");
|
|
6
|
-
const webmState = ({ controller, logLevel, readerInterface, src, }) => {
|
|
6
|
+
const webmState = ({ controller, logLevel, readerInterface, src, prefetchCache, }) => {
|
|
7
7
|
const trackEntries = {};
|
|
8
8
|
const onTrackEntrySegment = (trackEntry) => {
|
|
9
9
|
var _a;
|
|
@@ -70,6 +70,7 @@ const webmState = ({ controller, logLevel, readerInterface, src, }) => {
|
|
|
70
70
|
logLevel,
|
|
71
71
|
readerInterface,
|
|
72
72
|
src,
|
|
73
|
+
prefetchCache,
|
|
73
74
|
});
|
|
74
75
|
const getTimeStampMapForSeekingHints = () => {
|
|
75
76
|
return timestampMap;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AvcPPs, AvcProfileInfo } from '../containers/avc/parse-avc';
|
|
2
2
|
import type { SelectM3uAssociatedPlaylistsFn, SelectM3uStreamFn } from '../containers/m3u/select-stream';
|
|
3
3
|
import type { MediaParserController } from '../controller/media-parser-controller';
|
|
4
|
+
import type { PrefetchCache } from '../fetch';
|
|
4
5
|
import type { Options, ParseMediaFields } from '../fields';
|
|
5
6
|
import { type BufferIterator } from '../iterator/buffer-iterator';
|
|
6
7
|
import { type LogLevel } from '../log';
|
|
7
|
-
import type { AllParseMediaFields, OnDiscardedData, ParseMediaCallbacks, ParseMediaMode, ParseMediaResult, ParseMediaSrc } from '../options';
|
|
8
|
-
import type { IsoBaseMediaStructure } from '../parse-result';
|
|
8
|
+
import type { AllParseMediaFields, M3uPlaylistContext, OnDiscardedData, ParseMediaCallbacks, ParseMediaMode, ParseMediaResult, ParseMediaSrc } from '../options';
|
|
9
9
|
import type { Reader, ReaderInterface } from '../readers/reader';
|
|
10
10
|
import type { OnAudioTrack, OnVideoTrack } from '../webcodec-sample-types';
|
|
11
11
|
export type InternalStats = {
|
|
@@ -16,7 +16,7 @@ export type SpsAndPps = {
|
|
|
16
16
|
sps: AvcProfileInfo;
|
|
17
17
|
pps: AvcPPs;
|
|
18
18
|
};
|
|
19
|
-
export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHandlers, controller, onAudioTrack, onVideoTrack, contentLength, logLevel, mode, src, readerInterface, onDiscardedData, selectM3uStreamFn, selectM3uAssociatedPlaylistsFn,
|
|
19
|
+
export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHandlers, controller, onAudioTrack, onVideoTrack, contentLength, logLevel, mode, src, readerInterface, onDiscardedData, selectM3uStreamFn, selectM3uAssociatedPlaylistsFn, m3uPlaylistContext, contentType, name, callbacks, fieldsInReturnValue, mimeType, initialReaderInstance, makeSamplesStartAtZero, prefetchCache, }: {
|
|
20
20
|
hasAudioTrackHandlers: boolean;
|
|
21
21
|
hasVideoTrackHandlers: boolean;
|
|
22
22
|
controller: MediaParserController;
|
|
@@ -30,7 +30,7 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
30
30
|
onDiscardedData: OnDiscardedData | null;
|
|
31
31
|
selectM3uStreamFn: SelectM3uStreamFn;
|
|
32
32
|
selectM3uAssociatedPlaylistsFn: SelectM3uAssociatedPlaylistsFn;
|
|
33
|
-
|
|
33
|
+
m3uPlaylistContext: M3uPlaylistContext | null;
|
|
34
34
|
contentType: string | null;
|
|
35
35
|
name: string;
|
|
36
36
|
callbacks: ParseMediaCallbacks;
|
|
@@ -38,6 +38,7 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
38
38
|
mimeType: string | null;
|
|
39
39
|
initialReaderInstance: Reader;
|
|
40
40
|
makeSamplesStartAtZero: boolean;
|
|
41
|
+
prefetchCache: PrefetchCache;
|
|
41
42
|
}) => {
|
|
42
43
|
riff: {
|
|
43
44
|
getAvcProfile: () => SpsAndPps | null;
|
|
@@ -136,6 +137,8 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
136
137
|
flatSamples: {
|
|
137
138
|
getSamples: (mdatStart: number) => import("./iso-base-media/cached-sample-positions").FlatSample[] | null;
|
|
138
139
|
setSamples: (mdatStart: number, samples: import("./iso-base-media/cached-sample-positions").FlatSample[]) => void;
|
|
140
|
+
setJumpMarks: (mdatStart: number, marks: import("../containers/iso-base-media/mdat/calculate-jump-marks").JumpMark[]) => void;
|
|
141
|
+
getJumpMarks: (mdatStart: number) => import("../containers/iso-base-media/mdat/calculate-jump-marks").JumpMark[];
|
|
139
142
|
};
|
|
140
143
|
moov: {
|
|
141
144
|
setMoovBox: (moov: {
|
|
@@ -213,19 +216,22 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
213
216
|
setReadyToIterateOverM3u: () => void;
|
|
214
217
|
isReadyToIterateOverM3u: () => boolean;
|
|
215
218
|
setAllChunksProcessed: (src: string) => void;
|
|
219
|
+
clearAllChunksProcessed: () => void;
|
|
216
220
|
getAllChunksProcessedForPlaylist: (src: string) => boolean;
|
|
217
221
|
getAllChunksProcessedOverall: () => boolean;
|
|
218
222
|
setHasFinishedManifest: () => void;
|
|
219
223
|
hasFinishedManifest: () => boolean;
|
|
220
|
-
setM3uStreamRun: (playlistUrl: string, run: import("./m3u-state").
|
|
224
|
+
setM3uStreamRun: (playlistUrl: string, run: import("./m3u-state").M3uRun | null) => void;
|
|
221
225
|
setTracksDone: (playlistUrl: string) => boolean;
|
|
222
226
|
getTrackDone: (playlistUrl: string) => boolean;
|
|
223
|
-
|
|
227
|
+
clearTracksDone: () => void;
|
|
228
|
+
getM3uStreamRun: (playlistUrl: string) => import("./m3u-state").M3uRun;
|
|
224
229
|
abortM3UStreamRuns: () => void;
|
|
225
230
|
setAssociatedPlaylists: (playlists: import("..").M3uAssociatedPlaylist[]) => void;
|
|
226
231
|
getAssociatedPlaylists: () => import("..").M3uAssociatedPlaylist[] | null;
|
|
227
232
|
getSelectedPlaylists: () => string[];
|
|
228
233
|
sampleSorter: {
|
|
234
|
+
clearSamples: () => void;
|
|
229
235
|
addToStreamWithTrack: (src: string) => void;
|
|
230
236
|
addVideoStreamToConsider: (src: string, callback: import("../webcodec-sample-types").OnVideoSample) => void;
|
|
231
237
|
addAudioStreamToConsider: (src: string, callback: import("../webcodec-sample-types").OnAudioSample) => void;
|
|
@@ -235,8 +241,16 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
235
241
|
addVideoSample: (src: string, sample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
236
242
|
getNextStreamToRun: (streams: string[]) => string;
|
|
237
243
|
};
|
|
238
|
-
setMp4HeaderSegment: (playlistUrl: string, structure: IsoBaseMediaStructure) => void;
|
|
239
|
-
getMp4HeaderSegment: (playlistUrl: string) => IsoBaseMediaStructure;
|
|
244
|
+
setMp4HeaderSegment: (playlistUrl: string, structure: import("../parse-result").IsoBaseMediaStructure) => void;
|
|
245
|
+
getMp4HeaderSegment: (playlistUrl: string) => import("../parse-result").IsoBaseMediaStructure;
|
|
246
|
+
setSeekToSecondsToProcess: (playlistUrl: string, m3uSeek: {
|
|
247
|
+
targetTime: number;
|
|
248
|
+
} | null) => void;
|
|
249
|
+
getSeekToSecondsToProcess: (playlistUrl: string) => {
|
|
250
|
+
targetTime: number;
|
|
251
|
+
} | null;
|
|
252
|
+
setNextSeekShouldSubtractChunks: (playlistUrl: string, chunks: number) => void;
|
|
253
|
+
getNextSeekShouldSubtractChunks: (playlistUrl: string) => number;
|
|
240
254
|
};
|
|
241
255
|
timings: {
|
|
242
256
|
timeIterating: number;
|
|
@@ -250,6 +264,7 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
250
264
|
onAudioSample: (trackId: number, audioSample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
251
265
|
onVideoSample: (trackId: number, videoSample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
252
266
|
canSkipTracksState: {
|
|
267
|
+
doFieldsNeedTracks: () => boolean;
|
|
253
268
|
canSkipTracks: () => boolean;
|
|
254
269
|
};
|
|
255
270
|
registerAudioSampleCallback: (id: number, callback: import("../webcodec-sample-types").OnAudioSample | null) => Promise<void>;
|
|
@@ -275,11 +290,11 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
275
290
|
setFromSeekingHints: (keyframesFromHints: import("../options").MediaParserKeyframe[]) => void;
|
|
276
291
|
};
|
|
277
292
|
structure: {
|
|
278
|
-
getStructureOrNull: () => import("
|
|
279
|
-
getStructure: () => import("
|
|
280
|
-
setStructure: (value: import("
|
|
293
|
+
getStructureOrNull: () => import("..").MediaParserStructureUnstable | null;
|
|
294
|
+
getStructure: () => import("..").MediaParserStructureUnstable;
|
|
295
|
+
setStructure: (value: import("..").MediaParserStructureUnstable) => void;
|
|
281
296
|
getFlacStructure: () => import("../containers/flac/types").FlacStructure;
|
|
282
|
-
getIsoStructure: () => IsoBaseMediaStructure;
|
|
297
|
+
getIsoStructure: () => import("../parse-result").IsoBaseMediaStructure;
|
|
283
298
|
getMp3Structure: () => import("../parse-result").Mp3Structure;
|
|
284
299
|
getM3uStructure: () => import("../containers/m3u/types").M3uStructure;
|
|
285
300
|
getRiffStructure: () => import("../containers/riff/riff-box").RiffStructure;
|
|
@@ -402,7 +417,7 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
402
417
|
discardReadBytes: (force: boolean) => Promise<void>;
|
|
403
418
|
selectM3uStreamFn: SelectM3uStreamFn;
|
|
404
419
|
selectM3uAssociatedPlaylistsFn: SelectM3uAssociatedPlaylistsFn;
|
|
405
|
-
|
|
420
|
+
m3uPlaylistContext: M3uPlaylistContext | null;
|
|
406
421
|
contentType: string | null;
|
|
407
422
|
name: string;
|
|
408
423
|
returnValue: ParseMediaResult<AllParseMediaFields>;
|
|
@@ -419,5 +434,6 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
419
434
|
reset: () => void;
|
|
420
435
|
};
|
|
421
436
|
makeSamplesStartAtZero: boolean;
|
|
437
|
+
prefetchCache: PrefetchCache;
|
|
422
438
|
};
|
|
423
439
|
export type ParserState = ReturnType<typeof makeParserState>;
|
|
@@ -22,7 +22,7 @@ const structure_1 = require("./structure");
|
|
|
22
22
|
const timings_1 = require("./timings");
|
|
23
23
|
const transport_stream_1 = require("./transport-stream/transport-stream");
|
|
24
24
|
const video_section_1 = require("./video-section");
|
|
25
|
-
const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, controller, onAudioTrack, onVideoTrack, contentLength, logLevel, mode, src, readerInterface, onDiscardedData, selectM3uStreamFn, selectM3uAssociatedPlaylistsFn,
|
|
25
|
+
const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, controller, onAudioTrack, onVideoTrack, contentLength, logLevel, mode, src, readerInterface, onDiscardedData, selectM3uStreamFn, selectM3uAssociatedPlaylistsFn, m3uPlaylistContext, contentType, name, callbacks, fieldsInReturnValue, mimeType, initialReaderInstance, makeSamplesStartAtZero, prefetchCache, }) => {
|
|
26
26
|
let skippedBytes = 0;
|
|
27
27
|
const returnValue = {};
|
|
28
28
|
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)(new Uint8Array([]), contentLength);
|
|
@@ -53,22 +53,35 @@ const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, control
|
|
|
53
53
|
callbacks,
|
|
54
54
|
});
|
|
55
55
|
return {
|
|
56
|
-
riff: (0, riff_1.riffSpecificState)({
|
|
56
|
+
riff: (0, riff_1.riffSpecificState)({
|
|
57
|
+
controller,
|
|
58
|
+
logLevel,
|
|
59
|
+
readerInterface,
|
|
60
|
+
src,
|
|
61
|
+
prefetchCache,
|
|
62
|
+
}),
|
|
57
63
|
transportStream: (0, transport_stream_1.transportStreamState)(),
|
|
58
|
-
webm: (0, webm_1.webmState)({
|
|
64
|
+
webm: (0, webm_1.webmState)({
|
|
65
|
+
controller,
|
|
66
|
+
logLevel,
|
|
67
|
+
readerInterface,
|
|
68
|
+
src,
|
|
69
|
+
prefetchCache,
|
|
70
|
+
}),
|
|
59
71
|
iso: (0, iso_state_1.isoBaseMediaState)({
|
|
60
72
|
contentLength,
|
|
61
73
|
controller,
|
|
62
74
|
readerInterface,
|
|
63
75
|
src,
|
|
64
76
|
logLevel,
|
|
77
|
+
prefetchCache,
|
|
65
78
|
}),
|
|
66
79
|
mp3,
|
|
67
80
|
aac: (0, aac_state_1.aacState)(),
|
|
68
81
|
flac: (0, flac_state_1.flacState)(),
|
|
69
82
|
m3u: (0, m3u_state_1.m3uState)(logLevel),
|
|
70
83
|
timings,
|
|
71
|
-
callbacks: (0, sample_callbacks_1.
|
|
84
|
+
callbacks: (0, sample_callbacks_1.callbacksState)({
|
|
72
85
|
controller,
|
|
73
86
|
hasAudioTrackHandlers,
|
|
74
87
|
hasVideoTrackHandlers,
|
|
@@ -109,7 +122,7 @@ const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, control
|
|
|
109
122
|
discardReadBytes,
|
|
110
123
|
selectM3uStreamFn,
|
|
111
124
|
selectM3uAssociatedPlaylistsFn,
|
|
112
|
-
|
|
125
|
+
m3uPlaylistContext,
|
|
113
126
|
contentType,
|
|
114
127
|
name,
|
|
115
128
|
returnValue,
|
|
@@ -120,6 +133,7 @@ const makeParserState = ({ hasAudioTrackHandlers, hasVideoTrackHandlers, control
|
|
|
120
133
|
currentReader: currentReaderState,
|
|
121
134
|
seekInfiniteLoop,
|
|
122
135
|
makeSamplesStartAtZero,
|
|
136
|
+
prefetchCache,
|
|
123
137
|
};
|
|
124
138
|
};
|
|
125
139
|
exports.makeParserState = makeParserState;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { RiffSeekingHints } from '../../containers/riff/seeking-hints';
|
|
2
2
|
import type { MediaParserController } from '../../controller/media-parser-controller';
|
|
3
|
+
import type { PrefetchCache } from '../../fetch';
|
|
3
4
|
import type { LogLevel } from '../../log';
|
|
4
5
|
import type { ParseMediaSrc } from '../../options';
|
|
5
6
|
import type { ReaderInterface } from '../../readers/reader';
|
|
6
|
-
export declare const lazyIdx1Fetch: ({ controller, logLevel, readerInterface, src, }: {
|
|
7
|
+
export declare const lazyIdx1Fetch: ({ controller, logLevel, readerInterface, src, prefetchCache, }: {
|
|
7
8
|
controller: MediaParserController;
|
|
8
9
|
logLevel: LogLevel;
|
|
9
10
|
readerInterface: ReaderInterface;
|
|
10
11
|
src: ParseMediaSrc;
|
|
12
|
+
prefetchCache: PrefetchCache;
|
|
11
13
|
}) => {
|
|
12
14
|
triggerLoad: (position: number) => Promise<{
|
|
13
15
|
entries: import("../../containers/riff/riff-box").Idx1Entry[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lazyIdx1Fetch = void 0;
|
|
4
4
|
const fetch_idx1_1 = require("../../containers/riff/seek/fetch-idx1");
|
|
5
|
-
const lazyIdx1Fetch = ({ controller, logLevel, readerInterface, src, }) => {
|
|
5
|
+
const lazyIdx1Fetch = ({ controller, logLevel, readerInterface, src, prefetchCache, }) => {
|
|
6
6
|
let prom = null;
|
|
7
7
|
let result = null;
|
|
8
8
|
const triggerLoad = (position) => {
|
|
@@ -18,6 +18,7 @@ const lazyIdx1Fetch = ({ controller, logLevel, readerInterface, src, }) => {
|
|
|
18
18
|
position,
|
|
19
19
|
readerInterface,
|
|
20
20
|
src,
|
|
21
|
+
prefetchCache,
|
|
21
22
|
}).then((entries) => {
|
|
22
23
|
prom = null;
|
|
23
24
|
result = entries;
|
package/dist/state/riff.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { MediaParserController } from '../controller/media-parser-controller';
|
|
2
|
+
import type { PrefetchCache } from '../fetch';
|
|
2
3
|
import type { LogLevel } from '../log';
|
|
3
4
|
import type { ParseMediaSrc } from '../options';
|
|
4
5
|
import type { ReaderInterface } from '../readers/reader';
|
|
5
6
|
import type { SpsAndPps } from './parser-state';
|
|
6
7
|
type AvcProfileInfoCallback = (profile: SpsAndPps) => Promise<void>;
|
|
7
|
-
export declare const riffSpecificState: ({ controller, logLevel, readerInterface, src, }: {
|
|
8
|
+
export declare const riffSpecificState: ({ controller, logLevel, readerInterface, src, prefetchCache, }: {
|
|
8
9
|
controller: MediaParserController;
|
|
9
10
|
logLevel: LogLevel;
|
|
10
11
|
readerInterface: ReaderInterface;
|
|
11
12
|
src: ParseMediaSrc;
|
|
13
|
+
prefetchCache: PrefetchCache;
|
|
12
14
|
}) => {
|
|
13
15
|
getAvcProfile: () => SpsAndPps | null;
|
|
14
16
|
onProfile: (profile: SpsAndPps) => Promise<void>;
|
package/dist/state/riff.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.riffSpecificState = void 0;
|
|
4
4
|
const lazy_idx1_fetch_1 = require("./riff/lazy-idx1-fetch");
|
|
5
5
|
const sample_counter_1 = require("./riff/sample-counter");
|
|
6
|
-
const riffSpecificState = ({ controller, logLevel, readerInterface, src, }) => {
|
|
6
|
+
const riffSpecificState = ({ controller, logLevel, readerInterface, src, prefetchCache, }) => {
|
|
7
7
|
let avcProfile = null;
|
|
8
8
|
let nextTrackIndex = 0;
|
|
9
9
|
const profileCallbacks = [];
|
|
@@ -22,6 +22,7 @@ const riffSpecificState = ({ controller, logLevel, readerInterface, src, }) => {
|
|
|
22
22
|
logLevel,
|
|
23
23
|
readerInterface,
|
|
24
24
|
src,
|
|
25
|
+
prefetchCache,
|
|
25
26
|
});
|
|
26
27
|
const sampleCounter = (0, sample_counter_1.riffSampleCounter)();
|
|
27
28
|
return {
|
|
@@ -7,7 +7,7 @@ import type { AudioOrVideoSample, OnAudioSample, OnVideoSample } from '../webcod
|
|
|
7
7
|
import { type KeyframesState } from './keyframes';
|
|
8
8
|
import type { SamplesObservedState } from './samples-observed/slow-duration-fps';
|
|
9
9
|
import type { StructureState } from './structure';
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const callbacksState: ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, samplesObserved, structure, src, seekSignal, logLevel, }: {
|
|
11
11
|
controller: MediaParserController;
|
|
12
12
|
hasAudioTrackHandlers: boolean;
|
|
13
13
|
hasVideoTrackHandlers: boolean;
|
|
@@ -24,6 +24,7 @@ export declare const sampleCallback: ({ controller, hasAudioTrackHandlers, hasVi
|
|
|
24
24
|
onAudioSample: (trackId: number, audioSample: AudioOrVideoSample) => Promise<void>;
|
|
25
25
|
onVideoSample: (trackId: number, videoSample: AudioOrVideoSample) => Promise<void>;
|
|
26
26
|
canSkipTracksState: {
|
|
27
|
+
doFieldsNeedTracks: () => boolean;
|
|
27
28
|
canSkipTracks: () => boolean;
|
|
28
29
|
};
|
|
29
30
|
registerAudioSampleCallback: (id: number, callback: OnAudioSample | null) => Promise<void>;
|
|
@@ -40,4 +41,4 @@ export declare const sampleCallback: ({ controller, hasAudioTrackHandlers, hasVi
|
|
|
40
41
|
hasAudioTrackHandlers: boolean;
|
|
41
42
|
hasVideoTrackHandlers: boolean;
|
|
42
43
|
};
|
|
43
|
-
export type
|
|
44
|
+
export type CallbacksState = ReturnType<typeof callbacksState>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.callbacksState = void 0;
|
|
4
4
|
const log_1 = require("../log");
|
|
5
5
|
const can_skip_tracks_1 = require("./can-skip-tracks");
|
|
6
6
|
const has_tracks_section_1 = require("./has-tracks-section");
|
|
7
7
|
const need_samples_for_fields_1 = require("./need-samples-for-fields");
|
|
8
|
-
const
|
|
8
|
+
const callbacksState = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, samplesObserved, structure, src, seekSignal, logLevel, }) => {
|
|
9
9
|
const videoSampleCallbacks = {};
|
|
10
10
|
const audioSampleCallbacks = {};
|
|
11
11
|
const queuedAudioSamples = {};
|
|
@@ -102,4 +102,4 @@ const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandle
|
|
|
102
102
|
hasVideoTrackHandlers,
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
exports.
|
|
105
|
+
exports.callbacksState = callbacksState;
|