@remotion/media-parser 4.0.271 → 4.0.273
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/flac/get-channel-count.d.ts +1 -1
- package/dist/containers/flac/get-metadata-from-flac.d.ts +1 -1
- package/dist/containers/iso-base-media/get-seeking-from-mp4.d.ts +5 -0
- package/dist/containers/iso-base-media/get-seeking-from-mp4.js +50 -0
- package/dist/containers/m3u/iterate-over-segment-files.d.ts +2 -2
- package/dist/containers/m3u/iterate-over-segment-files.js +32 -28
- package/dist/containers/m3u/parse-directive.js +14 -0
- package/dist/containers/m3u/run-over-m3u.js +60 -46
- package/dist/containers/m3u/sample-sorter.d.ts +2 -0
- package/dist/containers/m3u/sample-sorter.js +13 -1
- package/dist/containers/m3u/types.d.ts +8 -1
- package/dist/containers/transport-stream/get-tracks.d.ts +2 -0
- package/dist/containers/transport-stream/get-tracks.js +6 -2
- package/dist/containers/transport-stream/parse-pmt.js +5 -5
- package/dist/containers/transport-stream/process-stream-buffers.js +2 -1
- package/dist/esm/index.mjs +64 -20
- package/dist/esm/worker-server-entry.mjs +63 -19
- package/dist/esm/worker-web-entry.mjs +63 -19
- package/dist/fields.d.ts +63 -0
- package/dist/fields.js +1 -0
- package/dist/get-seeking-info.d.ts +5 -0
- package/dist/get-seeking-info.js +24 -0
- package/dist/index.d.ts +3 -0
- package/dist/seeking-info.d.ts +8 -0
- package/dist/seeking-info.js +1 -0
- package/dist/state/has-tracks-section.d.ts +2 -2
- package/dist/state/has-tracks-section.js +4 -2
- package/dist/state/m3u-state.d.ts +3 -0
- package/dist/state/m3u-state.js +4 -1
- package/dist/state/parser-state.d.ts +3 -0
- package/dist/state/parser-state.js +1 -0
- package/dist/state/sample-callbacks.d.ts +3 -2
- package/dist/state/sample-callbacks.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/fields.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type ParseMediaFields = {
|
|
2
|
+
dimensions: boolean;
|
|
3
|
+
durationInSeconds: boolean;
|
|
4
|
+
slowDurationInSeconds: boolean;
|
|
5
|
+
structure: boolean;
|
|
6
|
+
fps: boolean;
|
|
7
|
+
slowFps: boolean;
|
|
8
|
+
videoCodec: boolean;
|
|
9
|
+
audioCodec: boolean;
|
|
10
|
+
tracks: boolean;
|
|
11
|
+
rotation: boolean;
|
|
12
|
+
unrotatedDimensions: boolean;
|
|
13
|
+
internalStats: boolean;
|
|
14
|
+
size: boolean;
|
|
15
|
+
name: boolean;
|
|
16
|
+
container: boolean;
|
|
17
|
+
isHdr: boolean;
|
|
18
|
+
metadata: boolean;
|
|
19
|
+
location: boolean;
|
|
20
|
+
mimeType: boolean;
|
|
21
|
+
keyframes: boolean;
|
|
22
|
+
slowKeyframes: boolean;
|
|
23
|
+
slowNumberOfFrames: boolean;
|
|
24
|
+
slowVideoBitrate: boolean;
|
|
25
|
+
slowAudioBitrate: boolean;
|
|
26
|
+
images: boolean;
|
|
27
|
+
sampleRate: boolean;
|
|
28
|
+
numberOfAudioChannels: boolean;
|
|
29
|
+
m3uStreams: boolean;
|
|
30
|
+
seekingInfo: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type AllOptions<Fields extends ParseMediaFields> = {
|
|
33
|
+
dimensions: Fields['dimensions'];
|
|
34
|
+
durationInSeconds: Fields['durationInSeconds'];
|
|
35
|
+
slowDurationInSeconds: Fields['slowDurationInSeconds'];
|
|
36
|
+
slowFps: Fields['slowFps'];
|
|
37
|
+
structure: Fields['structure'];
|
|
38
|
+
fps: Fields['fps'];
|
|
39
|
+
videoCodec: Fields['videoCodec'];
|
|
40
|
+
audioCodec: Fields['audioCodec'];
|
|
41
|
+
tracks: Fields['tracks'];
|
|
42
|
+
rotation: Fields['rotation'];
|
|
43
|
+
unrotatedDimensions: Fields['unrotatedDimensions'];
|
|
44
|
+
internalStats: Fields['internalStats'];
|
|
45
|
+
size: Fields['size'];
|
|
46
|
+
name: Fields['name'];
|
|
47
|
+
container: Fields['container'];
|
|
48
|
+
isHdr: Fields['isHdr'];
|
|
49
|
+
metadata: Fields['metadata'];
|
|
50
|
+
location: Fields['location'];
|
|
51
|
+
mimeType: Fields['mimeType'];
|
|
52
|
+
keyframes: Fields['keyframes'];
|
|
53
|
+
slowKeyframes: Fields['slowKeyframes'];
|
|
54
|
+
slowNumberOfFrames: Fields['slowNumberOfFrames'];
|
|
55
|
+
images: Fields['images'];
|
|
56
|
+
sampleRate: Fields['sampleRate'];
|
|
57
|
+
numberOfAudioChannels: Fields['numberOfAudioChannels'];
|
|
58
|
+
slowVideoBitrate: Fields['slowVideoBitrate'];
|
|
59
|
+
slowAudioBitrate: Fields['slowAudioBitrate'];
|
|
60
|
+
m3uStreams: Fields['m3uStreams'];
|
|
61
|
+
seekingInfo: Fields['seekingInfo'];
|
|
62
|
+
};
|
|
63
|
+
export type Options<Fields extends ParseMediaFields> = Partial<AllOptions<Fields>>;
|
package/dist/fields.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SeekingInfo } from './seeking-info';
|
|
2
|
+
import type { ParserState } from './state/parser-state';
|
|
3
|
+
export declare const getSeekingInfo: (state: ParserState) => SeekingInfo | null;
|
|
4
|
+
export declare const hasSeekingInfo: (state: ParserState) => boolean;
|
|
5
|
+
export declare const getSeekingByte: (info: SeekingInfo, time: number) => number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getSeekingByteFromIsoBaseMedia, getSeekingInfoFromMp4, } from './containers/iso-base-media/get-seeking-from-mp4';
|
|
2
|
+
export const getSeekingInfo = (state) => {
|
|
3
|
+
const structure = state.getStructureOrNull();
|
|
4
|
+
if (!structure) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
if (structure.type === 'iso-base-media') {
|
|
8
|
+
return getSeekingInfoFromMp4(state);
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
};
|
|
12
|
+
export const hasSeekingInfo = (state) => {
|
|
13
|
+
const structure = state.getStructureOrNull();
|
|
14
|
+
if (structure && structure.type === 'iso-base-media') {
|
|
15
|
+
return Boolean(getSeekingInfoFromMp4(state));
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
export const getSeekingByte = (info, time) => {
|
|
20
|
+
if (info.type === 'iso-base-media-seeking-info') {
|
|
21
|
+
return getSeekingByteFromIsoBaseMedia(info, time).offset;
|
|
22
|
+
}
|
|
23
|
+
throw new Error(`Unknown seeking info type: ${info.type}`);
|
|
24
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -940,6 +940,7 @@ export declare const MediaParserInternals: {
|
|
|
940
940
|
hasFinishedManifest: () => boolean;
|
|
941
941
|
setM3uStreamRun: (playlistUrl: string, run: import("./state/m3u-state").ExistingM3uRun | null) => void;
|
|
942
942
|
setTracksDone: (playlistUrl: string) => boolean;
|
|
943
|
+
getTrackDone: (playlistUrl: string) => boolean;
|
|
943
944
|
getM3uStreamRun: (playlistUrl: string) => import("./state/m3u-state").ExistingM3uRun;
|
|
944
945
|
abortM3UStreamRuns: () => void;
|
|
945
946
|
setAssociatedPlaylists: (playlists: import("./containers/m3u/get-streams").M3uAssociatedPlaylist[]) => void;
|
|
@@ -949,6 +950,8 @@ export declare const MediaParserInternals: {
|
|
|
949
950
|
addToStreamWithTrack: (src: string) => void;
|
|
950
951
|
addVideoStreamToConsider: (src: string, callback: import("./webcodec-sample-types").OnVideoSample) => void;
|
|
951
952
|
addAudioStreamToConsider: (src: string, callback: import("./webcodec-sample-types").OnAudioSample) => void;
|
|
953
|
+
hasAudioStreamToConsider: (src: string) => boolean;
|
|
954
|
+
hasVideoStreamToConsider: (src: string) => boolean;
|
|
952
955
|
addAudioSample: (src: string, sample: import("./webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
953
956
|
addVideoSample: (src: string, sample: import("./webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
954
957
|
getNextStreamToRun: (streams: string[]) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IsoBaseMediaBox } from './containers/iso-base-media/base-media-box';
|
|
2
|
+
import type { MoovBox } from './containers/iso-base-media/moov/moov';
|
|
3
|
+
export type IsoBaseMediaSeekingInfo = {
|
|
4
|
+
type: 'iso-base-media-seeking-info';
|
|
5
|
+
moovBox: MoovBox;
|
|
6
|
+
moofBoxes: IsoBaseMediaBox[];
|
|
7
|
+
};
|
|
8
|
+
export type SeekingInfo = IsoBaseMediaSeekingInfo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Track } from '../get-tracks';
|
|
2
2
|
import type { LogLevel } from '../log';
|
|
3
|
-
import type { Options, ParseMediaFields } from '../options';
|
|
3
|
+
import type { Options, ParseMediaFields, ParseMediaSrc } from '../options';
|
|
4
4
|
import type { CanSkipTracksState } from './can-skip-tracks';
|
|
5
|
-
export declare const makeTracksSectionState: (canSkipTracksState: CanSkipTracksState) => {
|
|
5
|
+
export declare const makeTracksSectionState: (canSkipTracksState: CanSkipTracksState, src: ParseMediaSrc) => {
|
|
6
6
|
hasAllTracks: () => boolean;
|
|
7
7
|
getIsDone: () => boolean;
|
|
8
8
|
setIsDone: (logLevel: LogLevel) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Log } from '../log';
|
|
2
|
-
export const makeTracksSectionState = (canSkipTracksState) => {
|
|
2
|
+
export const makeTracksSectionState = (canSkipTracksState, src) => {
|
|
3
3
|
const tracks = [];
|
|
4
4
|
let doneWithTracks = false;
|
|
5
5
|
return {
|
|
@@ -24,7 +24,9 @@ export const makeTracksSectionState = (canSkipTracksState) => {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if (!doneWithTracks) {
|
|
27
|
-
throw new Error('Error in Media Parser: End of parsing
|
|
27
|
+
throw new Error('Error in Media Parser: End of parsing of ' +
|
|
28
|
+
src +
|
|
29
|
+
' has been reached, but no tracks have been found ');
|
|
28
30
|
}
|
|
29
31
|
},
|
|
30
32
|
};
|
|
@@ -31,6 +31,7 @@ export declare const m3uState: (logLevel: LogLevel) => {
|
|
|
31
31
|
hasFinishedManifest: () => boolean;
|
|
32
32
|
setM3uStreamRun: (playlistUrl: string, run: ExistingM3uRun | null) => void;
|
|
33
33
|
setTracksDone: (playlistUrl: string) => boolean;
|
|
34
|
+
getTrackDone: (playlistUrl: string) => boolean;
|
|
34
35
|
getM3uStreamRun: (playlistUrl: string) => ExistingM3uRun;
|
|
35
36
|
abortM3UStreamRuns: () => void;
|
|
36
37
|
setAssociatedPlaylists: (playlists: M3uAssociatedPlaylist[]) => void;
|
|
@@ -40,6 +41,8 @@ export declare const m3uState: (logLevel: LogLevel) => {
|
|
|
40
41
|
addToStreamWithTrack: (src: string) => void;
|
|
41
42
|
addVideoStreamToConsider: (src: string, callback: OnVideoSample) => void;
|
|
42
43
|
addAudioStreamToConsider: (src: string, callback: OnAudioSample) => void;
|
|
44
|
+
hasAudioStreamToConsider: (src: string) => boolean;
|
|
45
|
+
hasVideoStreamToConsider: (src: string) => boolean;
|
|
43
46
|
addAudioSample: (src: string, sample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
44
47
|
addVideoSample: (src: string, sample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
45
48
|
getNextStreamToRun: (streams: string[]) => string;
|
package/dist/state/m3u-state.js
CHANGED
|
@@ -62,7 +62,7 @@ export const m3uState = (logLevel) => {
|
|
|
62
62
|
setHasEmittedDoneWithTracks: (src) => {
|
|
63
63
|
hasEmittedDoneWithTracks[src] = true;
|
|
64
64
|
},
|
|
65
|
-
hasEmittedDoneWithTracks: (src) => hasEmittedDoneWithTracks[src],
|
|
65
|
+
hasEmittedDoneWithTracks: (src) => hasEmittedDoneWithTracks[src] !== undefined,
|
|
66
66
|
setReadyToIterateOverM3u: () => {
|
|
67
67
|
readyToIterateOverM3u = true;
|
|
68
68
|
},
|
|
@@ -94,6 +94,9 @@ export const m3uState = (logLevel) => {
|
|
|
94
94
|
const selectedPlaylists = getSelectedPlaylists();
|
|
95
95
|
return selectedPlaylists.every((url) => tracksDone[url]);
|
|
96
96
|
},
|
|
97
|
+
getTrackDone: (playlistUrl) => {
|
|
98
|
+
return tracksDone[playlistUrl];
|
|
99
|
+
},
|
|
97
100
|
getM3uStreamRun: (playlistUrl) => { var _a; return (_a = m3uStreamRuns[playlistUrl]) !== null && _a !== void 0 ? _a : null; },
|
|
98
101
|
abortM3UStreamRuns: () => {
|
|
99
102
|
const values = Object.values(m3uStreamRuns);
|
|
@@ -226,6 +226,7 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
226
226
|
hasFinishedManifest: () => boolean;
|
|
227
227
|
setM3uStreamRun: (playlistUrl: string, run: import("./m3u-state").ExistingM3uRun | null) => void;
|
|
228
228
|
setTracksDone: (playlistUrl: string) => boolean;
|
|
229
|
+
getTrackDone: (playlistUrl: string) => boolean;
|
|
229
230
|
getM3uStreamRun: (playlistUrl: string) => import("./m3u-state").ExistingM3uRun;
|
|
230
231
|
abortM3UStreamRuns: () => void;
|
|
231
232
|
setAssociatedPlaylists: (playlists: import("..").M3uAssociatedPlaylist[]) => void;
|
|
@@ -235,6 +236,8 @@ export declare const makeParserState: ({ hasAudioTrackHandlers, hasVideoTrackHan
|
|
|
235
236
|
addToStreamWithTrack: (src: string) => void;
|
|
236
237
|
addVideoStreamToConsider: (src: string, callback: import("../webcodec-sample-types").OnVideoSample) => void;
|
|
237
238
|
addAudioStreamToConsider: (src: string, callback: import("../webcodec-sample-types").OnAudioSample) => void;
|
|
239
|
+
hasAudioStreamToConsider: (src: string) => boolean;
|
|
240
|
+
hasVideoStreamToConsider: (src: string) => boolean;
|
|
238
241
|
addAudioSample: (src: string, sample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
239
242
|
addVideoSample: (src: string, sample: import("../webcodec-sample-types").AudioOrVideoSample) => Promise<void>;
|
|
240
243
|
getNextStreamToRun: (streams: string[]) => string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { MediaParserController } from '../media-parser-controller';
|
|
2
|
-
import type { AllOptions, Options, ParseMediaFields } from '../options';
|
|
2
|
+
import type { AllOptions, Options, ParseMediaFields, ParseMediaSrc } from '../options';
|
|
3
3
|
import type { AudioOrVideoSample, OnAudioSample, OnVideoSample } from '../webcodec-sample-types';
|
|
4
4
|
import { type KeyframesState } from './keyframes';
|
|
5
5
|
import type { SlowDurationAndFpsState } from './slow-duration-fps';
|
|
6
6
|
import type { StructureState } from './structure';
|
|
7
|
-
export declare const sampleCallback: ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, slowDurationAndFpsState, structure, }: {
|
|
7
|
+
export declare const sampleCallback: ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, slowDurationAndFpsState, structure, src, }: {
|
|
8
8
|
controller: MediaParserController;
|
|
9
9
|
hasAudioTrackHandlers: boolean;
|
|
10
10
|
hasVideoTrackHandlers: boolean;
|
|
@@ -13,6 +13,7 @@ export declare const sampleCallback: ({ controller, hasAudioTrackHandlers, hasVi
|
|
|
13
13
|
emittedFields: AllOptions<ParseMediaFields>;
|
|
14
14
|
slowDurationAndFpsState: SlowDurationAndFpsState;
|
|
15
15
|
structure: StructureState;
|
|
16
|
+
src: ParseMediaSrc;
|
|
16
17
|
}) => {
|
|
17
18
|
registerVideoSampleCallback: (id: number, callback: OnVideoSample | null) => Promise<void>;
|
|
18
19
|
onAudioSample: (trackId: number, audioSample: AudioOrVideoSample) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeCanSkipTracksState } from './can-skip-tracks';
|
|
2
2
|
import { makeTracksSectionState } from './has-tracks-section';
|
|
3
3
|
import { needsToIterateOverSamples } from './need-samples-for-fields';
|
|
4
|
-
export const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, slowDurationAndFpsState, structure, }) => {
|
|
4
|
+
export const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrackHandlers, fields, keyframes, emittedFields, slowDurationAndFpsState, structure, src, }) => {
|
|
5
5
|
const videoSampleCallbacks = {};
|
|
6
6
|
const audioSampleCallbacks = {};
|
|
7
7
|
const queuedAudioSamples = {};
|
|
@@ -12,7 +12,7 @@ export const sampleCallback = ({ controller, hasAudioTrackHandlers, hasVideoTrac
|
|
|
12
12
|
hasVideoTrackHandlers,
|
|
13
13
|
structure,
|
|
14
14
|
});
|
|
15
|
-
const tracksState = makeTracksSectionState(canSkipTracksState);
|
|
15
|
+
const tracksState = makeTracksSectionState(canSkipTracksState, src);
|
|
16
16
|
const samplesForTrack = {};
|
|
17
17
|
return {
|
|
18
18
|
registerVideoSampleCallback: async (id, callback) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.273";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically generated on publish
|
|
2
|
-
export const VERSION = '4.0.
|
|
2
|
+
export const VERSION = '4.0.273';
|
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.273",
|
|
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.0",
|
|
13
|
-
"@remotion/
|
|
14
|
-
"@remotion/
|
|
13
|
+
"@remotion/eslint-config-internal": "4.0.273",
|
|
14
|
+
"@remotion/example-videos": "4.0.273"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|