@remotion/media-parser 4.0.537 → 4.0.538
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/aac-codecprivate.d.ts +2 -2
- package/dist/containers/avc/interpret-sps.js +2 -1
- package/dist/containers/avc/key.d.ts +1 -1
- package/dist/containers/flac/get-block-size.d.ts +1 -1
- package/dist/containers/flac/get-sample-rate.d.ts +1 -1
- package/dist/containers/flac/get-sample-rate.js +2 -1
- package/dist/containers/flac/parse-flac-frame.js +2 -1
- package/dist/containers/iso-base-media/collect-sample-positions-from-trak.d.ts +1 -1
- package/dist/containers/iso-base-media/find-track-to-seek.d.ts +1 -1
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.d.ts +1 -1
- package/dist/containers/iso-base-media/make-track.js +4 -3
- package/dist/containers/mp3/samples-per-mpeg-file.d.ts +1 -1
- package/dist/containers/riff/convert-queued-sample-to-mediaparser-sample.d.ts +4 -4
- package/dist/containers/riff/convert-queued-sample-to-mediaparser-sample.js +2 -1
- package/dist/containers/riff/has-index.js +2 -1
- package/dist/containers/riff/seeking-hints.js +2 -1
- package/dist/containers/transport-stream/process-audio.js +4 -2
- package/dist/containers/webm/seek/get-seeking-byte.js +4 -3
- package/dist/containers/webm/segments/all-segments.d.ts +563 -563
- package/dist/containers/webm/segments/block-simple-block-flags.d.ts +1 -1
- package/dist/containers/webm/traversal.js +2 -1
- package/dist/controller/emitter.js +5 -5
- package/dist/download-and-parse-media.js +2 -1
- package/dist/emit-available-info.js +31 -30
- package/dist/esm/index.mjs +1 -1
- package/dist/get-duration.d.ts +1 -1
- package/dist/get-duration.js +2 -1
- package/dist/get-fps.js +2 -1
- package/dist/get-number-of-audio-channels.js +2 -1
- package/dist/get-sample-rate.js +2 -1
- package/dist/get-tracks.js +2 -1
- package/dist/get-video-codec.js +2 -1
- package/dist/index.d.ts +454 -1056
- package/dist/log.d.ts +6 -6
- package/dist/metadata/metadata-from-iso.js +2 -1
- package/dist/register-track.d.ts +2 -2
- package/dist/state/iso-base-media/cached-sample-positions.js +2 -1
- package/dist/state/m3u-state.d.ts +2 -2
- package/dist/state/matroska/lazy-cues-fetch.js +4 -3
- package/dist/state/matroska/webm.d.ts +1 -1
- package/dist/state/parser-state.d.ts +37 -43
- package/dist/state/riff/lazy-idx1-fetch.d.ts +2 -2
- package/dist/state/riff/sample-counter.js +2 -1
- package/dist/state/riff.d.ts +2 -2
- package/dist/state/transport-stream/last-emitted-sample.d.ts +1 -1
- package/dist/state/transport-stream/observed-pes-header.d.ts +1 -1
- package/dist/state/transport-stream/transport-stream.d.ts +1 -1
- package/dist/state/video-section.d.ts +4 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getSampleRateFromSampleFrequencyIndex: (samplingFrequencyIndex: number) =>
|
|
1
|
+
export declare const getSampleRateFromSampleFrequencyIndex: (samplingFrequencyIndex: number) => 7350 | 8000 | 11025 | 12000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000 | 64000 | 88200 | 96000;
|
|
2
2
|
export declare const createAacCodecPrivate: ({ audioObjectType, sampleRate, channelConfiguration, codecPrivate, }: {
|
|
3
3
|
audioObjectType: number;
|
|
4
4
|
sampleRate: number;
|
|
@@ -10,4 +10,4 @@ export declare const parseAacCodecPrivate: (bytes: Uint8Array) => {
|
|
|
10
10
|
sampleRate: number;
|
|
11
11
|
channelConfiguration: number;
|
|
12
12
|
};
|
|
13
|
-
export declare const mapAudioObjectTypeToCodecString: (audioObjectType: number) => "mp4a.40.
|
|
13
|
+
export declare const mapAudioObjectTypeToCodecString: (audioObjectType: number) => "mp4a.40.1" | "mp4a.40.17" | "mp4a.40.2" | "mp4a.40.23" | "mp4a.40.29" | "mp4a.40.3" | "mp4a.40.4" | "mp4a.40.5";
|
|
@@ -32,7 +32,8 @@ const getSampleAspectRatioFromSps = (sps) => {
|
|
|
32
32
|
};
|
|
33
33
|
exports.getSampleAspectRatioFromSps = getSampleAspectRatioFromSps;
|
|
34
34
|
const getVideoColorFromSps = (sps) => {
|
|
35
|
-
var _a, _b, _c, _d
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
var _e;
|
|
36
37
|
const matrixCoefficients = (_a = sps.vui_parameters) === null || _a === void 0 ? void 0 : _a.matrix_coefficients;
|
|
37
38
|
const transferCharacteristics = (_b = sps.vui_parameters) === null || _b === void 0 ? void 0 : _b.transfer_characteristics;
|
|
38
39
|
const colorPrimaries = (_c = sps.vui_parameters) === null || _c === void 0 ? void 0 : _c.colour_primaries;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AvcInfo } from './parse-avc';
|
|
2
|
-
export declare const getKeyFrameOrDeltaFromAvcInfo: (infos: AvcInfo[]) =>
|
|
2
|
+
export declare const getKeyFrameOrDeltaFromAvcInfo: (infos: AvcInfo[]) => 'key' | 'delta' | 'bidirectional';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
|
-
export declare const getBlockSize: (iterator: BufferIterator) => number |
|
|
2
|
+
export declare const getBlockSize: (iterator: BufferIterator) => number | 'uncommon-u16' | 'uncommon-u8' | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
|
2
2
|
import type { ParserState } from '../../state/parser-state';
|
|
3
|
-
export declare const getSampleRate: (iterator: BufferIterator, state: ParserState) => number |
|
|
3
|
+
export declare const getSampleRate: (iterator: BufferIterator, state: ParserState) => number | 'uncommon-u8' | 'uncommon-u16' | 'uncommon-u16-10';
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getSampleRate = void 0;
|
|
4
4
|
// https://www.rfc-editor.org/rfc/rfc9639.html#name-sample-rate-bits
|
|
5
5
|
const getSampleRate = (iterator, state) => {
|
|
6
|
-
var _a
|
|
6
|
+
var _a;
|
|
7
|
+
var _b;
|
|
7
8
|
const mode = iterator.getBits(4);
|
|
8
9
|
if (mode === 0b0000 || mode === 0b1111) {
|
|
9
10
|
const structure = state.structure.getFlacStructure();
|
|
@@ -110,7 +110,8 @@ const emitSample = async ({ state, data, offset, }) => {
|
|
|
110
110
|
iterator.destroy();
|
|
111
111
|
};
|
|
112
112
|
const parseFlacFrame = async ({ state, iterator, }) => {
|
|
113
|
-
var _a
|
|
113
|
+
var _a;
|
|
114
|
+
var _b;
|
|
114
115
|
const blockingBit = state.flac.getBlockingBitStrategy();
|
|
115
116
|
const offset = iterator.counter.getOffset();
|
|
116
117
|
const { returnToCheckpoint } = iterator.startCheckpoint();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { TrakBox } from './trak/trak';
|
|
2
|
-
export declare const collectSamplePositionsFromTrak: (trakBox: TrakBox) => import("
|
|
2
|
+
export declare const collectSamplePositionsFromTrak: (trakBox: TrakBox) => import("../..").SamplePosition[];
|
|
@@ -3,7 +3,7 @@ import type { MediaParserAudioTrack, MediaParserOtherTrack, MediaParserVideoTrac
|
|
|
3
3
|
import type { IsoBaseMediaStructure } from '../../parse-result';
|
|
4
4
|
import type { StructureState } from '../../state/structure';
|
|
5
5
|
export declare const findAnyTrackWithSamplePositions: (allTracks: (MediaParserVideoTrack | MediaParserAudioTrack | MediaParserOtherTrack)[], struc: IsoBaseMediaStructure) => {
|
|
6
|
-
track:
|
|
6
|
+
track: MediaParserAudioTrack | MediaParserVideoTrack;
|
|
7
7
|
samplePositions: SamplePosition[];
|
|
8
8
|
} | null;
|
|
9
9
|
type TrackWithSamplePositions = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { TrakBox } from './trak/trak';
|
|
2
|
-
export declare const getVideoCodecFromIsoTrak: (trakBox: TrakBox) => "
|
|
2
|
+
export declare const getVideoCodecFromIsoTrak: (trakBox: TrakBox) => "av1" | "h264" | "h265" | "prores" | "vp9";
|
|
@@ -13,7 +13,8 @@ const get_video_codec_from_iso_track_1 = require("./get-video-codec-from-iso-tra
|
|
|
13
13
|
const get_editlist_1 = require("./mdat/get-editlist");
|
|
14
14
|
const traversal_1 = require("./traversal");
|
|
15
15
|
const makeBaseMediaTrack = (trakBox, startTimeInSeconds) => {
|
|
16
|
-
var _a
|
|
16
|
+
var _a;
|
|
17
|
+
var _b, _c, _d, _e;
|
|
17
18
|
const tkhdBox = (0, traversal_1.getTkhdBox)(trakBox);
|
|
18
19
|
const videoDescriptors = (0, traversal_1.getVideoDescriptors)(trakBox);
|
|
19
20
|
const timescaleAndDuration = (0, get_fps_1.getTimescaleAndDuration)(trakBox);
|
|
@@ -33,7 +34,7 @@ const makeBaseMediaTrack = (trakBox, startTimeInSeconds) => {
|
|
|
33
34
|
throw new Error('Could not find sample rate');
|
|
34
35
|
}
|
|
35
36
|
const { codecString, description } = (0, get_audio_codec_1.getAudioCodecStringFromTrak)(trakBox);
|
|
36
|
-
const codecPrivate = (
|
|
37
|
+
const codecPrivate = (_c = (_b = (0, get_audio_codec_1.getCodecPrivateFromTrak)(trakBox)) !== null && _b !== void 0 ? _b : description) !== null && _c !== void 0 ? _c : null;
|
|
37
38
|
const codecEnum = (0, get_audio_codec_1.getAudioCodecFromTrack)(trakBox);
|
|
38
39
|
const actual = (0, get_actual_number_of_channels_1.getActualDecoderParameters)({
|
|
39
40
|
audioCodec: codecEnum,
|
|
@@ -48,7 +49,7 @@ const makeBaseMediaTrack = (trakBox, startTimeInSeconds) => {
|
|
|
48
49
|
codec: codecString,
|
|
49
50
|
numberOfChannels: actual.numberOfChannels,
|
|
50
51
|
sampleRate: actual.sampleRate,
|
|
51
|
-
description: (_d = (
|
|
52
|
+
description: (_d = (_a = actual.codecPrivate) === null || _a === void 0 ? void 0 : _a.data) !== null && _d !== void 0 ? _d : undefined,
|
|
52
53
|
codecData: actual.codecPrivate,
|
|
53
54
|
codecEnum,
|
|
54
55
|
startInSeconds: startTimeInSeconds,
|
|
@@ -5,11 +5,11 @@ export declare const convertQueuedSampleToMediaParserSample: ({ sample, state, t
|
|
|
5
5
|
state: ParserState;
|
|
6
6
|
trackId: number;
|
|
7
7
|
}) => {
|
|
8
|
-
timestamp: number;
|
|
9
|
-
decodingTimestamp: number;
|
|
10
|
-
type: "key" | "delta";
|
|
11
8
|
data: Uint8Array;
|
|
9
|
+
type: 'key' | 'delta';
|
|
12
10
|
duration: number | undefined;
|
|
13
11
|
offset: number;
|
|
14
|
-
avc?: import("../../webcodec-sample-types").MediaParserAvcExtraInfo
|
|
12
|
+
avc?: import("../../webcodec-sample-types").MediaParserAvcExtraInfo;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
decodingTimestamp: number;
|
|
15
15
|
};
|
|
@@ -4,7 +4,8 @@ exports.convertQueuedSampleToMediaParserSample = void 0;
|
|
|
4
4
|
const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
|
|
5
5
|
const get_strh_for_index_1 = require("./get-strh-for-index");
|
|
6
6
|
const getKeyFrameOffsetAndPocs = ({ state, sample, trackId, }) => {
|
|
7
|
-
var _a
|
|
7
|
+
var _a;
|
|
8
|
+
var _b;
|
|
8
9
|
if (sample.type === 'key') {
|
|
9
10
|
const sampleOffset = state.riff.sampleCounter.getSampleCountForTrack({
|
|
10
11
|
trackId,
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.riffHasIndex = void 0;
|
|
4
4
|
const riffHasIndex = (structure) => {
|
|
5
|
-
var _a, _b
|
|
5
|
+
var _a, _b;
|
|
6
|
+
var _c;
|
|
6
7
|
return ((_c = (_b = (_a = structure.boxes.find((b) => b.type === 'list-box' && b.listType === 'hdrl')) === null || _a === void 0 ? void 0 : _a.children.find((box) => box.type === 'avih-box')) === null || _b === void 0 ? void 0 : _b.hasIndex) !== null && _c !== void 0 ? _c : false);
|
|
7
8
|
};
|
|
8
9
|
exports.riffHasIndex = riffHasIndex;
|
|
@@ -4,7 +4,8 @@ exports.setSeekingHintsForRiff = exports.getSeekingHintsForRiff = void 0;
|
|
|
4
4
|
const has_index_1 = require("./has-index");
|
|
5
5
|
const traversal_1 = require("./traversal");
|
|
6
6
|
const getSeekingHintsForRiff = ({ structureState, riffState, mediaSectionState, }) => {
|
|
7
|
-
var _a
|
|
7
|
+
var _a;
|
|
8
|
+
var _b;
|
|
8
9
|
const structure = structureState.getRiffStructure();
|
|
9
10
|
const strl = (0, traversal_1.getStrlBoxes)(structure);
|
|
10
11
|
let samplesPerSecond = null;
|
|
@@ -4,7 +4,8 @@ exports.processAudio = exports.canProcessAudio = void 0;
|
|
|
4
4
|
const adts_header_1 = require("./adts-header");
|
|
5
5
|
const process_stream_buffers_1 = require("./process-stream-buffers");
|
|
6
6
|
const canProcessAudio = ({ streamBuffer, }) => {
|
|
7
|
-
var _a
|
|
7
|
+
var _a;
|
|
8
|
+
var _b;
|
|
8
9
|
const expectedLength = (_b = (_a = (0, adts_header_1.readAdtsHeader)(streamBuffer.getBuffer())) === null || _a === void 0 ? void 0 : _a.frameLength) !== null && _b !== void 0 ? _b : null;
|
|
9
10
|
if (expectedLength === null) {
|
|
10
11
|
return false;
|
|
@@ -16,7 +17,8 @@ const canProcessAudio = ({ streamBuffer, }) => {
|
|
|
16
17
|
};
|
|
17
18
|
exports.canProcessAudio = canProcessAudio;
|
|
18
19
|
const processAudio = async ({ transportStreamEntry, structure, offset, sampleCallbacks, logLevel, onAudioTrack, onVideoTrack, transportStream, makeSamplesStartAtZero, avcState, }) => {
|
|
19
|
-
var _a
|
|
20
|
+
var _a;
|
|
21
|
+
var _b;
|
|
20
22
|
const { streamBuffers, nextPesHeaderStore: nextPesHeader } = transportStream;
|
|
21
23
|
const streamBuffer = streamBuffers.get(transportStreamEntry.pid);
|
|
22
24
|
if (!streamBuffer) {
|
|
@@ -51,14 +51,15 @@ const getByteFromCues = ({ cuesResponse, time, info, logLevel, }) => {
|
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
const getSeekingByteFromMatroska = async ({ time, webmState, info, logLevel, mediaSection, }) => {
|
|
54
|
-
var _a
|
|
54
|
+
var _a;
|
|
55
|
+
var _b, _c, _d, _e;
|
|
55
56
|
if (!info.track) {
|
|
56
57
|
log_1.Log.trace(logLevel, 'No video track found, cannot seek yet');
|
|
57
58
|
return {
|
|
58
59
|
type: 'valid-but-must-wait',
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
const cuesResponse = (
|
|
62
|
+
const cuesResponse = (_b = info.loadedCues) !== null && _b !== void 0 ? _b : (await webmState.cues.getLoadedCues());
|
|
62
63
|
// Check if we have already read keyframes
|
|
63
64
|
const byteFromObservedKeyframe = findKeyframeBeforeTime({
|
|
64
65
|
keyframes: info.keyframes,
|
|
@@ -72,7 +73,7 @@ const getSeekingByteFromMatroska = async ({ time, webmState, info, logLevel, med
|
|
|
72
73
|
logLevel,
|
|
73
74
|
});
|
|
74
75
|
// Fallback: back to the beginning
|
|
75
|
-
const byteFromFirstMediaSection = (_c = (
|
|
76
|
+
const byteFromFirstMediaSection = (_c = (_a = webmState.getFirstCluster()) === null || _a === void 0 ? void 0 : _a.start) !== null && _c !== void 0 ? _c : null;
|
|
76
77
|
// Optimization possibility for later:
|
|
77
78
|
// Don't seek back, if the last seen time is smaller than the time we want to seek to
|
|
78
79
|
const seekPossibilities = [
|