init commit
This commit is contained in:
1
remotion/node_modules/@remotion/media-parser/dist/containers/webm/allowed-partial-segments.d.ts
generated
vendored
Normal file
1
remotion/node_modules/@remotion/media-parser/dist/containers/webm/allowed-partial-segments.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const allowedPartialSegments: string[];
|
||||
4
remotion/node_modules/@remotion/media-parser/dist/containers/webm/allowed-partial-segments.js
generated
vendored
Normal file
4
remotion/node_modules/@remotion/media-parser/dist/containers/webm/allowed-partial-segments.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.allowedPartialSegments = void 0;
|
||||
exports.allowedPartialSegments = ['0x1f43b675', '0x18538067'];
|
||||
2
remotion/node_modules/@remotion/media-parser/dist/containers/webm/av1-codec-private.d.ts
generated
vendored
Normal file
2
remotion/node_modules/@remotion/media-parser/dist/containers/webm/av1-codec-private.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { ColorParameterBox } from '../iso-base-media/stsd/colr';
|
||||
export declare const parseAv1PrivateData: (data: Uint8Array, colrAtom: ColorParameterBox | null) => string;
|
||||
99
remotion/node_modules/@remotion/media-parser/dist/containers/webm/av1-codec-private.js
generated
vendored
Normal file
99
remotion/node_modules/@remotion/media-parser/dist/containers/webm/av1-codec-private.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseAv1PrivateData = void 0;
|
||||
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
||||
const parseAv1PrivateData = (data, colrAtom) => {
|
||||
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)({
|
||||
initialData: data,
|
||||
maxBytes: data.byteLength,
|
||||
logLevel: 'error',
|
||||
});
|
||||
iterator.startReadingBits();
|
||||
if (iterator.getBits(1) !== 1) {
|
||||
iterator.destroy();
|
||||
throw new Error('Expected av1 private data to be version 1');
|
||||
}
|
||||
const version = iterator.getBits(7);
|
||||
if (version !== 1) {
|
||||
iterator.destroy();
|
||||
throw new Error(`Expected av1 private data to be version 1, got ${version}`);
|
||||
}
|
||||
let str = 'av01.';
|
||||
// https://aomediacodec.github.io/av1-isobmff/#codecsparam
|
||||
const seqProfile = iterator.getBits(3);
|
||||
// Profile
|
||||
str += seqProfile;
|
||||
str += '.';
|
||||
const seq_level_idx = iterator.getBits(5);
|
||||
const seq_tier_0 = iterator.getBits(1);
|
||||
// Level
|
||||
// The level parameter value SHALL equal the first level value indicated by seq_level_idx in the Sequence Header OBU
|
||||
str += String(seq_level_idx).padStart(2, '0');
|
||||
str += seq_tier_0 ? 'H' : 'M';
|
||||
str += '.';
|
||||
// bitDepth
|
||||
// The bitDepth parameter value SHALL equal the value of BitDepth variable as defined in [AV1] derived from the Sequence Header OBU
|
||||
const high_bitdepth = iterator.getBits(1);
|
||||
const twelve_bit = iterator.getBits(1);
|
||||
const bitDepth = high_bitdepth && seqProfile === 2
|
||||
? twelve_bit
|
||||
? 12
|
||||
: 10
|
||||
: high_bitdepth
|
||||
? 10
|
||||
: 8;
|
||||
str += bitDepth.toString().padStart(2, '0');
|
||||
str += '.';
|
||||
// monochrome
|
||||
// The monochrome parameter value, represented by a single digit decimal, SHALL equal the value of mono_chrome in the Sequence Header OBU
|
||||
const mono_chrome = iterator.getBits(1);
|
||||
str += mono_chrome ? '1' : '0';
|
||||
str += '.';
|
||||
// The chromaSubsampling parameter value, represented by a three-digit decimal,
|
||||
// SHALL have its first digit equal to subsampling_x
|
||||
const subsampling_x = iterator.getBits(1);
|
||||
str += subsampling_x ? '1' : '0';
|
||||
// and its second digit equal to subsampling_y.
|
||||
const subsampling_y = iterator.getBits(1);
|
||||
str += subsampling_y ? '1' : '0';
|
||||
// If both subsampling_x and subsampling_y are set to 1, then the third digit SHALL be equal to chroma_sample_position, otherwise it SHALL be set to 0
|
||||
const chroma_sample_position = iterator.getBits(2);
|
||||
str +=
|
||||
subsampling_x && subsampling_y
|
||||
? chroma_sample_position === 1
|
||||
? '1'
|
||||
: '0'
|
||||
: '0';
|
||||
str += '.';
|
||||
if (colrAtom && colrAtom.colorType === 'transfer-characteristics') {
|
||||
str += colrAtom.primaries.toString().padStart(2, '0');
|
||||
str += '.';
|
||||
str += colrAtom.transfer.toString().padStart(2, '0');
|
||||
str += '.';
|
||||
str += colrAtom.matrixIndex.toString().padStart(2, '0');
|
||||
str += '.';
|
||||
str += colrAtom.fullRangeFlag ? '1' : '0';
|
||||
}
|
||||
else {
|
||||
// Otherwise, the color_description_present_flag is set to 0 in the Sequence Header OBU. The colorPrimaries, transferCharacteristics, and matrixCoefficients parameter values SHOULD be set to the default values below.
|
||||
// colorPrimaries 01 (ITU-R BT.709)
|
||||
str += '01';
|
||||
str += '.';
|
||||
// transferCharacteristics 01 (ITU-R BT.709)
|
||||
str += '01';
|
||||
str += '.';
|
||||
// matrixCoefficients 00 (ITU-R BT.709)
|
||||
str += '01';
|
||||
str += '.';
|
||||
// videoFullRangeFlag 0 (studio swing representation)
|
||||
str += '0';
|
||||
}
|
||||
// If the codecs parameter string ends with ".0.110.01.01.01.0" (containing all the default values below), that trailing part of the string SHOULD be omitted.
|
||||
const suffix = '.0.110.01.01.01.0';
|
||||
if (str.endsWith(suffix)) {
|
||||
str = str.slice(0, -suffix.length);
|
||||
}
|
||||
iterator.destroy();
|
||||
return str;
|
||||
};
|
||||
exports.parseAv1PrivateData = parseAv1PrivateData;
|
||||
3
remotion/node_modules/@remotion/media-parser/dist/containers/webm/color.d.ts
generated
vendored
Normal file
3
remotion/node_modules/@remotion/media-parser/dist/containers/webm/color.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { MediaParserAdvancedColor } from '../../get-tracks';
|
||||
import type { ColourSegment } from './segments/all-segments';
|
||||
export declare const parseColorSegment: (colourSegment: ColourSegment) => MediaParserAdvancedColor;
|
||||
26
remotion/node_modules/@remotion/media-parser/dist/containers/webm/color.js
generated
vendored
Normal file
26
remotion/node_modules/@remotion/media-parser/dist/containers/webm/color.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseColorSegment = void 0;
|
||||
const color_1 = require("../avc/color");
|
||||
const traversal_1 = require("./traversal");
|
||||
const parseColorSegment = (colourSegment) => {
|
||||
const transferCharacteristics = (0, traversal_1.getTransferCharacteristicsSegment)(colourSegment);
|
||||
const matrixCoefficients = (0, traversal_1.getMatrixCoefficientsSegment)(colourSegment);
|
||||
const primaries = (0, traversal_1.getPrimariesSegment)(colourSegment);
|
||||
const range = (0, traversal_1.getRangeSegment)(colourSegment);
|
||||
return {
|
||||
transfer: transferCharacteristics
|
||||
? (0, color_1.getTransferCharacteristicsFromIndex)(transferCharacteristics.value.value)
|
||||
: null,
|
||||
matrix: matrixCoefficients
|
||||
? (0, color_1.getMatrixCoefficientsFromIndex)(matrixCoefficients.value.value)
|
||||
: null,
|
||||
primaries: primaries ? (0, color_1.getPrimariesFromIndex)(primaries.value.value) : null,
|
||||
fullRange: (transferCharacteristics === null || transferCharacteristics === void 0 ? void 0 : transferCharacteristics.value.value) && (matrixCoefficients === null || matrixCoefficients === void 0 ? void 0 : matrixCoefficients.value.value)
|
||||
? null
|
||||
: range
|
||||
? Boolean(range === null || range === void 0 ? void 0 : range.value.value)
|
||||
: null,
|
||||
};
|
||||
};
|
||||
exports.parseColorSegment = parseColorSegment;
|
||||
2
remotion/node_modules/@remotion/media-parser/dist/containers/webm/description.d.ts
generated
vendored
Normal file
2
remotion/node_modules/@remotion/media-parser/dist/containers/webm/description.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { TrackEntry } from './segments/all-segments';
|
||||
export declare const getAudioDescription: (track: TrackEntry) => undefined | Uint8Array;
|
||||
87
remotion/node_modules/@remotion/media-parser/dist/containers/webm/description.js
generated
vendored
Normal file
87
remotion/node_modules/@remotion/media-parser/dist/containers/webm/description.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getAudioDescription = void 0;
|
||||
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
||||
const traversal_1 = require("./traversal");
|
||||
const getAudioDescription = (track) => {
|
||||
const codec = (0, traversal_1.getCodecSegment)(track);
|
||||
if (!codec || codec.value !== 'A_VORBIS') {
|
||||
return undefined;
|
||||
}
|
||||
// how to parse vorbis private
|
||||
// https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java#L2466
|
||||
const privateData = (0, traversal_1.getPrivateData)(track);
|
||||
if (!privateData) {
|
||||
return undefined;
|
||||
}
|
||||
if (privateData[0] !== 2) {
|
||||
throw new Error('Expected vorbis private data version 2');
|
||||
}
|
||||
let offset = 1;
|
||||
let vorbisInfoLength = 0;
|
||||
let vorbisSkipLength = 0;
|
||||
while ((privateData[offset] & 0xff) === 0xff) {
|
||||
vorbisInfoLength += 0xff;
|
||||
offset++;
|
||||
}
|
||||
vorbisInfoLength += privateData[offset++] & 0xff;
|
||||
while ((privateData[offset] & 0xff) === 0xff) {
|
||||
vorbisSkipLength += 0xff;
|
||||
offset++;
|
||||
}
|
||||
vorbisSkipLength += privateData[offset++] & 0xff;
|
||||
if (privateData[offset] !== 0x01) {
|
||||
throw new Error('Error parsing vorbis codec private');
|
||||
}
|
||||
const vorbisInfo = privateData.slice(offset, offset + vorbisInfoLength);
|
||||
offset += vorbisInfoLength;
|
||||
if (privateData[offset] !== 0x03) {
|
||||
throw new Error('Error parsing vorbis codec private');
|
||||
}
|
||||
const vorbisComments = privateData.slice(offset, offset + vorbisSkipLength);
|
||||
offset += vorbisSkipLength;
|
||||
if (privateData[offset] !== 0x05) {
|
||||
throw new Error('Error parsing vorbis codec private');
|
||||
}
|
||||
const vorbisBooks = privateData.slice(offset);
|
||||
const bufferIterator = (0, buffer_iterator_1.getArrayBufferIterator)({
|
||||
initialData: vorbisInfo.slice(0),
|
||||
maxBytes: vorbisInfo.length,
|
||||
logLevel: 'error',
|
||||
});
|
||||
// type
|
||||
bufferIterator.getUint8();
|
||||
// vorbis
|
||||
const vorbis = bufferIterator.getByteString(6, false);
|
||||
if (vorbis !== 'vorbis') {
|
||||
throw new Error('Error parsing vorbis codec private');
|
||||
}
|
||||
const vorbisVersion = bufferIterator.getUint32Le();
|
||||
if (vorbisVersion !== 0) {
|
||||
throw new Error('Error parsing vorbis codec private');
|
||||
}
|
||||
const vorbisDescription = new Uint8Array([
|
||||
// constructing the vorbis description
|
||||
// This format consists in the page_segments field
|
||||
/**
|
||||
* The number of segment entries to appear in the segment table.
|
||||
* The maximum number of 255 segments (255 bytes each) sets the maximum possible physical page size at 65307 bytes or just under 64kB (thus we know that a header corrupted so as destroy sizing/alignment information will not cause a runaway bitstream.
|
||||
* We'll read in the page according to the corrupted size information that's guaranteed to be a reasonable size regardless, notice the checksum mismatch, drop sync and then look for recapture).
|
||||
*/
|
||||
2,
|
||||
// followed by the segment_table field
|
||||
// offset of the comments table
|
||||
vorbisInfo.length,
|
||||
// offset of the codebooks table
|
||||
vorbisComments.length,
|
||||
// followed by the three Vorbis header packets,
|
||||
// respectively the identification header,
|
||||
...vorbisInfo,
|
||||
// the comments header,
|
||||
...vorbisComments,
|
||||
// and the setup header, in this order, as described in section 4.2 of [VORBIS].
|
||||
...vorbisBooks,
|
||||
]);
|
||||
return vorbisDescription;
|
||||
};
|
||||
exports.getAudioDescription = getAudioDescription;
|
||||
5
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-byte-for-cues.d.ts
generated
vendored
Normal file
5
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-byte-for-cues.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { type SeekHeadSegment } from './segments/all-segments';
|
||||
export declare const getByteForSeek: ({ seekHeadSegment, offset, }: {
|
||||
seekHeadSegment: SeekHeadSegment;
|
||||
offset: number;
|
||||
}) => number | null;
|
||||
33
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-byte-for-cues.js
generated
vendored
Normal file
33
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-byte-for-cues.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getByteForSeek = void 0;
|
||||
const truthy_1 = require("../../truthy");
|
||||
const all_segments_1 = require("./segments/all-segments");
|
||||
const getByteForSeek = ({ seekHeadSegment, offset, }) => {
|
||||
const value = seekHeadSegment.value
|
||||
.map((v) => {
|
||||
if (v.type !== 'Seek') {
|
||||
return null;
|
||||
}
|
||||
const seekId = v.value.find((_v) => {
|
||||
// cues
|
||||
return _v.type === 'SeekID' && _v.value === all_segments_1.matroskaElements.Cues;
|
||||
});
|
||||
if (!seekId) {
|
||||
return null;
|
||||
}
|
||||
const seekPosition = v.value.find((_v) => {
|
||||
return _v.type === 'SeekPosition';
|
||||
});
|
||||
if (!seekPosition) {
|
||||
return false;
|
||||
}
|
||||
return seekPosition.value;
|
||||
})
|
||||
.filter(truthy_1.truthy);
|
||||
if (value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return value[0].value + offset;
|
||||
};
|
||||
exports.getByteForSeek = getByteForSeek;
|
||||
15
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-ready-tracks.d.ts
generated
vendored
Normal file
15
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-ready-tracks.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { MediaParserTrack } from '../../get-tracks';
|
||||
import type { WebmState } from '../../state/matroska/webm';
|
||||
import type { StructureState } from '../../state/structure';
|
||||
export type ResolvedAndUnresolvedTracks = {
|
||||
resolved: MediaParserTrack[];
|
||||
missingInfo: MediaParserTrack[];
|
||||
};
|
||||
export declare const getTracksFromMatroska: ({ structureState, webmState, }: {
|
||||
structureState: StructureState;
|
||||
webmState: WebmState;
|
||||
}) => ResolvedAndUnresolvedTracks;
|
||||
export declare const matroskaHasTracks: ({ structureState, webmState, }: {
|
||||
structureState: StructureState;
|
||||
webmState: WebmState;
|
||||
}) => boolean;
|
||||
64
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-ready-tracks.js
generated
vendored
Normal file
64
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-ready-tracks.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.matroskaHasTracks = exports.getTracksFromMatroska = void 0;
|
||||
const codec_string_1 = require("../avc/codec-string");
|
||||
const make_track_1 = require("./make-track");
|
||||
const traversal_1 = require("./traversal");
|
||||
const getTracksFromMatroska = ({ structureState, webmState, }) => {
|
||||
const structure = structureState.getMatroskaStructure();
|
||||
const mainSegment = (0, traversal_1.getMainSegment)(structure.boxes);
|
||||
if (!mainSegment) {
|
||||
throw new Error('No main segment');
|
||||
}
|
||||
const tracksSegment = (0, traversal_1.getTracksSegment)(mainSegment);
|
||||
if (!tracksSegment) {
|
||||
throw new Error('No tracks segment');
|
||||
}
|
||||
const resolvedTracks = [];
|
||||
const missingInfo = [];
|
||||
for (const trackEntrySegment of tracksSegment.value) {
|
||||
if (trackEntrySegment.type === 'Crc32') {
|
||||
continue;
|
||||
}
|
||||
if (trackEntrySegment.type !== 'TrackEntry') {
|
||||
throw new Error('Expected track entry segment');
|
||||
}
|
||||
const track = (0, make_track_1.getTrack)({
|
||||
track: trackEntrySegment,
|
||||
timescale: webmState.getTimescale(),
|
||||
});
|
||||
if (!track) {
|
||||
continue;
|
||||
}
|
||||
if (track.codec === make_track_1.NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS) {
|
||||
const avc = webmState.getAvcProfileForTrackNumber(track.trackId);
|
||||
if (avc) {
|
||||
resolvedTracks.push({
|
||||
...track,
|
||||
codec: (0, codec_string_1.getCodecStringFromSpsAndPps)(avc),
|
||||
});
|
||||
}
|
||||
else {
|
||||
missingInfo.push(track);
|
||||
}
|
||||
}
|
||||
else {
|
||||
resolvedTracks.push(track);
|
||||
}
|
||||
}
|
||||
return { missingInfo, resolved: resolvedTracks };
|
||||
};
|
||||
exports.getTracksFromMatroska = getTracksFromMatroska;
|
||||
const matroskaHasTracks = ({ structureState, webmState, }) => {
|
||||
const structure = structureState.getMatroskaStructure();
|
||||
const mainSegment = (0, traversal_1.getMainSegment)(structure.boxes);
|
||||
if (!mainSegment) {
|
||||
return false;
|
||||
}
|
||||
return ((0, traversal_1.getTracksSegment)(mainSegment) !== null &&
|
||||
(0, exports.getTracksFromMatroska)({
|
||||
structureState,
|
||||
webmState,
|
||||
}).missingInfo.length === 0);
|
||||
};
|
||||
exports.matroskaHasTracks = matroskaHasTracks;
|
||||
36
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-sample-from-block.d.ts
generated
vendored
Normal file
36
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-sample-from-block.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { MediaParserLogLevel } from '../../log';
|
||||
import type { AvcState } from '../../state/avc/avc-state';
|
||||
import type { WebmState } from '../../state/matroska/webm';
|
||||
import type { CallbacksState } from '../../state/sample-callbacks';
|
||||
import type { StructureState } from '../../state/structure';
|
||||
import type { MediaParserAudioSample, MediaParserOnVideoTrack, MediaParserVideoSample } from '../../webcodec-sample-types';
|
||||
import type { BlockSegment, SimpleBlockSegment } from './segments/all-segments';
|
||||
type SampleResult = {
|
||||
type: 'video-sample';
|
||||
videoSample: MediaParserVideoSample;
|
||||
trackId: number;
|
||||
timescale: number;
|
||||
} | {
|
||||
type: 'audio-sample';
|
||||
audioSample: MediaParserAudioSample;
|
||||
trackId: number;
|
||||
timescale: number;
|
||||
} | {
|
||||
type: 'partial-video-sample';
|
||||
partialVideoSample: Omit<MediaParserVideoSample, 'type'>;
|
||||
trackId: number;
|
||||
timescale: number;
|
||||
} | {
|
||||
type: 'no-sample';
|
||||
};
|
||||
export declare const getSampleFromBlock: ({ ebml, webmState, offset, structureState, callbacks, logLevel, onVideoTrack, avcState, }: {
|
||||
ebml: BlockSegment | SimpleBlockSegment;
|
||||
webmState: WebmState;
|
||||
offset: number;
|
||||
structureState: StructureState;
|
||||
callbacks: CallbacksState;
|
||||
logLevel: MediaParserLogLevel;
|
||||
onVideoTrack: MediaParserOnVideoTrack | null;
|
||||
avcState: AvcState;
|
||||
}) => Promise<SampleResult>;
|
||||
export {};
|
||||
142
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-sample-from-block.js
generated
vendored
Normal file
142
remotion/node_modules/@remotion/media-parser/dist/containers/webm/get-sample-from-block.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSampleFromBlock = void 0;
|
||||
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
||||
const register_track_1 = require("../../register-track");
|
||||
const webcodecs_timescale_1 = require("../../webcodecs-timescale");
|
||||
const parse_avc_1 = require("../avc/parse-avc");
|
||||
const get_ready_tracks_1 = require("./get-ready-tracks");
|
||||
const all_segments_1 = require("./segments/all-segments");
|
||||
const block_simple_block_flags_1 = require("./segments/block-simple-block-flags");
|
||||
const addAvcToTrackAndActivateTrackIfNecessary = async ({ partialVideoSample, codec, structureState, webmState, trackNumber, logLevel, callbacks, onVideoTrack, avcState, }) => {
|
||||
if (codec !== 'V_MPEG4/ISO/AVC') {
|
||||
return;
|
||||
}
|
||||
const missingTracks = (0, get_ready_tracks_1.getTracksFromMatroska)({
|
||||
structureState,
|
||||
webmState,
|
||||
}).missingInfo;
|
||||
if (missingTracks.length === 0) {
|
||||
return;
|
||||
}
|
||||
const parsed = (0, parse_avc_1.parseAvc)(partialVideoSample.data, avcState);
|
||||
for (const parse of parsed) {
|
||||
if (parse.type === 'avc-profile') {
|
||||
webmState.setAvcProfileForTrackNumber(trackNumber, parse);
|
||||
const track = missingTracks.find((t) => t.trackId === trackNumber);
|
||||
if (!track) {
|
||||
throw new Error('Could not find track ' + trackNumber);
|
||||
}
|
||||
const resolvedTracks = (0, get_ready_tracks_1.getTracksFromMatroska)({
|
||||
structureState,
|
||||
webmState,
|
||||
}).resolved;
|
||||
const resolvedTrack = resolvedTracks.find((t) => t.trackId === trackNumber);
|
||||
if (!resolvedTrack) {
|
||||
throw new Error('Could not find track ' + trackNumber);
|
||||
}
|
||||
await (0, register_track_1.registerVideoTrack)({
|
||||
track: resolvedTrack,
|
||||
container: 'webm',
|
||||
logLevel,
|
||||
onVideoTrack,
|
||||
registerVideoSampleCallback: callbacks.registerVideoSampleCallback,
|
||||
tracks: callbacks.tracks,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const getSampleFromBlock = async ({ ebml, webmState, offset, structureState, callbacks, logLevel, onVideoTrack, avcState, }) => {
|
||||
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)({
|
||||
initialData: ebml.value,
|
||||
maxBytes: ebml.value.length,
|
||||
logLevel: 'error',
|
||||
});
|
||||
const trackNumber = iterator.getVint();
|
||||
if (trackNumber === null) {
|
||||
throw new Error('Not enough data to get track number, should not happen');
|
||||
}
|
||||
const timecodeRelativeToCluster = iterator.getInt16();
|
||||
const { keyframe } = (0, block_simple_block_flags_1.parseBlockFlags)(iterator, ebml.type === 'SimpleBlock'
|
||||
? all_segments_1.matroskaElements.SimpleBlock
|
||||
: all_segments_1.matroskaElements.Block);
|
||||
const { codec, trackTimescale } = webmState.getTrackInfoByNumber(trackNumber);
|
||||
const clusterOffset = webmState.getTimestampOffsetForByteOffset(offset);
|
||||
const timescale = webmState.getTimescale();
|
||||
if (clusterOffset === undefined) {
|
||||
throw new Error('Could not find offset for byte offset ' + offset);
|
||||
}
|
||||
// https://github.com/hubblec4/Matroska-Chapters-Specs/blob/master/notes.md/#timestampscale
|
||||
// The TimestampScale Element is used to calculate the Raw Timestamp of a Block. The timestamp is obtained by adding the Block's timestamp to the Cluster's Timestamp Element, and then multiplying that result by the TimestampScale. The result will be the Block's Raw Timestamp in nanoseconds.
|
||||
const timecodeInNanoSeconds = (timecodeRelativeToCluster + clusterOffset) *
|
||||
timescale *
|
||||
(trackTimescale !== null && trackTimescale !== void 0 ? trackTimescale : 1);
|
||||
// Timecode should be in microseconds
|
||||
const timecodeInMicroseconds = timecodeInNanoSeconds / 1000;
|
||||
if (!codec) {
|
||||
throw new Error(`Could not find codec for track ${trackNumber}`);
|
||||
}
|
||||
const remainingNow = ebml.value.length - iterator.counter.getOffset();
|
||||
if (codec.startsWith('V_')) {
|
||||
const partialVideoSample = {
|
||||
data: iterator.getSlice(remainingNow),
|
||||
decodingTimestamp: timecodeInMicroseconds,
|
||||
duration: undefined,
|
||||
timestamp: timecodeInMicroseconds,
|
||||
offset,
|
||||
};
|
||||
if (keyframe === null) {
|
||||
iterator.destroy();
|
||||
return {
|
||||
type: 'partial-video-sample',
|
||||
partialVideoSample,
|
||||
trackId: trackNumber,
|
||||
timescale: webcodecs_timescale_1.WEBCODECS_TIMESCALE,
|
||||
};
|
||||
}
|
||||
await addAvcToTrackAndActivateTrackIfNecessary({
|
||||
codec,
|
||||
partialVideoSample,
|
||||
structureState,
|
||||
webmState,
|
||||
trackNumber,
|
||||
callbacks,
|
||||
logLevel,
|
||||
onVideoTrack,
|
||||
avcState,
|
||||
});
|
||||
const sample = {
|
||||
...partialVideoSample,
|
||||
type: keyframe ? 'key' : 'delta',
|
||||
};
|
||||
iterator.destroy();
|
||||
return {
|
||||
type: 'video-sample',
|
||||
videoSample: sample,
|
||||
trackId: trackNumber,
|
||||
timescale: webcodecs_timescale_1.WEBCODECS_TIMESCALE,
|
||||
};
|
||||
}
|
||||
if (codec.startsWith('A_')) {
|
||||
const audioSample = {
|
||||
data: iterator.getSlice(remainingNow),
|
||||
timestamp: timecodeInMicroseconds,
|
||||
type: 'key',
|
||||
duration: undefined,
|
||||
decodingTimestamp: timecodeInMicroseconds,
|
||||
offset,
|
||||
};
|
||||
iterator.destroy();
|
||||
return {
|
||||
type: 'audio-sample',
|
||||
audioSample,
|
||||
trackId: trackNumber,
|
||||
timescale: webcodecs_timescale_1.WEBCODECS_TIMESCALE,
|
||||
};
|
||||
}
|
||||
iterator.destroy();
|
||||
return {
|
||||
type: 'no-sample',
|
||||
};
|
||||
};
|
||||
exports.getSampleFromBlock = getSampleFromBlock;
|
||||
10
remotion/node_modules/@remotion/media-parser/dist/containers/webm/make-track.d.ts
generated
vendored
Normal file
10
remotion/node_modules/@remotion/media-parser/dist/containers/webm/make-track.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { MediaParserAudioCodec, MediaParserAudioTrack, MediaParserVideoTrack } from '../../get-tracks';
|
||||
import type { TrackEntry } from './segments/all-segments';
|
||||
export declare const NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS = "no-codec-private-should-be-derived-from-sps";
|
||||
export declare const getMatroskaAudioCodecEnum: ({ track, }: {
|
||||
track: TrackEntry;
|
||||
}) => MediaParserAudioCodec;
|
||||
export declare const getTrack: ({ timescale, track, }: {
|
||||
timescale: number;
|
||||
track: TrackEntry;
|
||||
}) => MediaParserVideoTrack | MediaParserAudioTrack | null;
|
||||
310
remotion/node_modules/@remotion/media-parser/dist/containers/webm/make-track.js
generated
vendored
Normal file
310
remotion/node_modules/@remotion/media-parser/dist/containers/webm/make-track.js
generated
vendored
Normal file
@@ -0,0 +1,310 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getTrack = exports.getMatroskaAudioCodecEnum = exports.NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS = void 0;
|
||||
const buffer_iterator_1 = require("../../iterator/buffer-iterator");
|
||||
const make_hvc1_codec_strings_1 = require("../../make-hvc1-codec-strings");
|
||||
const webcodecs_timescale_1 = require("../../webcodecs-timescale");
|
||||
const color_to_webcodecs_colors_1 = require("../iso-base-media/color-to-webcodecs-colors");
|
||||
const av1_codec_private_1 = require("./av1-codec-private");
|
||||
const color_1 = require("./color");
|
||||
const description_1 = require("./description");
|
||||
const track_entry_1 = require("./segments/track-entry");
|
||||
const traversal_1 = require("./traversal");
|
||||
exports.NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS = 'no-codec-private-should-be-derived-from-sps';
|
||||
const getDescription = (track) => {
|
||||
const codec = (0, traversal_1.getCodecSegment)(track);
|
||||
if (!codec) {
|
||||
return undefined;
|
||||
}
|
||||
if (codec.value === 'V_MPEG4/ISO/AVC' || codec.value === 'V_MPEGH/ISO/HEVC') {
|
||||
const priv = (0, traversal_1.getPrivateData)(track);
|
||||
if (priv) {
|
||||
return priv;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const getMatroskaVideoCodecEnum = ({ codecSegment: codec, }) => {
|
||||
if (codec.value === 'V_VP8') {
|
||||
return 'vp8';
|
||||
}
|
||||
if (codec.value === 'V_VP9') {
|
||||
return 'vp9';
|
||||
}
|
||||
if (codec.value === 'V_MPEG4/ISO/AVC') {
|
||||
return 'h264';
|
||||
}
|
||||
if (codec.value === 'V_AV1') {
|
||||
return 'av1';
|
||||
}
|
||||
if (codec.value === 'V_MPEGH/ISO/HEVC') {
|
||||
return 'h265';
|
||||
}
|
||||
throw new Error(`Unknown codec: ${codec.value}`);
|
||||
};
|
||||
const getMatroskaVideoCodecString = ({ track, codecSegment: codec, }) => {
|
||||
if (codec.value === 'V_VP8') {
|
||||
return 'vp8';
|
||||
}
|
||||
if (codec.value === 'V_VP9') {
|
||||
const priv = (0, traversal_1.getPrivateData)(track);
|
||||
if (priv) {
|
||||
throw new Error('@remotion/media-parser cannot handle the private data for VP9. Do you have an example file you could send so we can implement it? https://remotion.dev/report');
|
||||
}
|
||||
return 'vp09.00.10.08';
|
||||
}
|
||||
if (codec.value === 'V_MPEG4/ISO/AVC') {
|
||||
const priv = (0, traversal_1.getPrivateData)(track);
|
||||
if (priv) {
|
||||
return `avc1.${priv[1].toString(16).padStart(2, '0')}${priv[2].toString(16).padStart(2, '0')}${priv[3].toString(16).padStart(2, '0')}`;
|
||||
}
|
||||
return exports.NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS;
|
||||
}
|
||||
if (codec.value === 'V_MPEGH/ISO/HEVC') {
|
||||
const priv = (0, traversal_1.getPrivateData)(track);
|
||||
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)({
|
||||
initialData: priv,
|
||||
maxBytes: priv.length,
|
||||
logLevel: 'error',
|
||||
});
|
||||
return 'hvc1.' + (0, make_hvc1_codec_strings_1.getHvc1CodecString)(iterator);
|
||||
}
|
||||
if (codec.value === 'V_AV1') {
|
||||
const priv = (0, traversal_1.getPrivateData)(track);
|
||||
if (!priv) {
|
||||
throw new Error('Expected private data in AV1 track');
|
||||
}
|
||||
return (0, av1_codec_private_1.parseAv1PrivateData)(priv, null);
|
||||
}
|
||||
throw new Error(`Unknown codec: ${codec.value}`);
|
||||
};
|
||||
const getMatroskaAudioCodecEnum = ({ track, }) => {
|
||||
const codec = (0, traversal_1.getCodecSegment)(track);
|
||||
if (!codec) {
|
||||
throw new Error('Expected codec segment');
|
||||
}
|
||||
if (codec.value === 'A_OPUS') {
|
||||
return 'opus';
|
||||
}
|
||||
if (codec.value === 'A_VORBIS') {
|
||||
return 'vorbis';
|
||||
}
|
||||
if (codec.value === 'A_PCM/INT/LIT') {
|
||||
// https://github.com/ietf-wg-cellar/matroska-specification/issues/142#issuecomment-330004950
|
||||
// Audio samples MUST be considered as signed values, except if the audio bit depth is 8 which MUST be interpreted as unsigned values.
|
||||
const bitDepth = (0, traversal_1.getBitDepth)(track);
|
||||
if (bitDepth === null) {
|
||||
throw new Error('Expected bit depth');
|
||||
}
|
||||
if (bitDepth === 8) {
|
||||
return 'pcm-u8';
|
||||
}
|
||||
if (bitDepth === 16) {
|
||||
return 'pcm-s16';
|
||||
}
|
||||
if (bitDepth === 24) {
|
||||
return 'pcm-s24';
|
||||
}
|
||||
throw new Error('Unknown audio format');
|
||||
}
|
||||
if (codec.value === 'A_AAC') {
|
||||
return `aac`;
|
||||
}
|
||||
if (codec.value === 'A_MPEG/L3') {
|
||||
return 'mp3';
|
||||
}
|
||||
throw new Error(`Unknown codec: ${codec.value}`);
|
||||
};
|
||||
exports.getMatroskaAudioCodecEnum = getMatroskaAudioCodecEnum;
|
||||
const getMatroskaAudioCodecString = (track) => {
|
||||
const codec = (0, traversal_1.getCodecSegment)(track);
|
||||
if (!codec) {
|
||||
throw new Error('Expected codec segment');
|
||||
}
|
||||
if (codec.value === 'A_OPUS') {
|
||||
return 'opus';
|
||||
}
|
||||
if (codec.value === 'A_VORBIS') {
|
||||
return 'vorbis';
|
||||
}
|
||||
if (codec.value === 'A_PCM/INT/LIT') {
|
||||
// https://github.com/ietf-wg-cellar/matroska-specification/issues/142#issuecomment-330004950
|
||||
// Audio samples MUST be considered as signed values, except if the audio bit depth is 8 which MUST be interpreted as unsigned values.
|
||||
const bitDepth = (0, traversal_1.getBitDepth)(track);
|
||||
if (bitDepth === null) {
|
||||
throw new Error('Expected bit depth');
|
||||
}
|
||||
if (bitDepth === 8) {
|
||||
return 'pcm-u8';
|
||||
}
|
||||
return 'pcm-s' + bitDepth;
|
||||
}
|
||||
if (codec.value === 'A_AAC') {
|
||||
const priv = (0, traversal_1.getPrivateData)(track);
|
||||
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)({
|
||||
initialData: priv,
|
||||
maxBytes: priv.length,
|
||||
logLevel: 'error',
|
||||
});
|
||||
iterator.startReadingBits();
|
||||
/**
|
||||
* ChatGPT
|
||||
* ▪ The first 5 bits represent the AOT.
|
||||
▪ Common values:
|
||||
◦ 1 for AAC Main
|
||||
◦ 2 for AAC LC (Low Complexity)
|
||||
◦ 3 for AAC SSR (Scalable Sample Rate)
|
||||
◦ 4 for AAC LTP (Long Term Prediction)
|
||||
◦ 5 for SBR (Spectral Band Replication)
|
||||
◦ 29 for HE-AAC (which uses SBR with AAC LC)
|
||||
*/
|
||||
/**
|
||||
* Fully qualified codec:
|
||||
* This codec has multiple possible codec strings:
|
||||
"mp4a.40.2" — MPEG-4 AAC LC
|
||||
"mp4a.40.02" — MPEG-4 AAC LC, leading 0 for Aud-OTI compatibility
|
||||
"mp4a.40.5" — MPEG-4 HE-AAC v1 (AAC LC + SBR)
|
||||
"mp4a.40.05" — MPEG-4 HE-AAC v1 (AAC LC + SBR), leading 0 for Aud-OTI compatibility
|
||||
"mp4a.40.29" — MPEG-4 HE-AAC v2 (AAC LC + SBR + PS)
|
||||
"mp4a.67" — MPEG-2 AAC LC
|
||||
*/
|
||||
const profile = iterator.getBits(5);
|
||||
iterator.stopReadingBits();
|
||||
iterator.destroy();
|
||||
return `mp4a.40.${profile.toString().padStart(2, '0')}`;
|
||||
}
|
||||
if (codec.value === 'A_MPEG/L3') {
|
||||
return 'mp3';
|
||||
}
|
||||
throw new Error(`Unknown codec: ${codec.value}`);
|
||||
};
|
||||
const getTrack = ({ timescale, track, }) => {
|
||||
const trackType = (0, traversal_1.getTrackTypeSegment)(track);
|
||||
if (!trackType) {
|
||||
throw new Error('Expected track type segment');
|
||||
}
|
||||
const trackId = (0, traversal_1.getTrackId)(track);
|
||||
if ((0, track_entry_1.trackTypeToString)(trackType.value.value) === 'video') {
|
||||
const width = (0, traversal_1.getWidthSegment)(track);
|
||||
if (width === null) {
|
||||
throw new Error('Expected width segment');
|
||||
}
|
||||
const height = (0, traversal_1.getHeightSegment)(track);
|
||||
if (height === null) {
|
||||
throw new Error('Expected height segment');
|
||||
}
|
||||
const displayHeight = (0, traversal_1.getDisplayHeightSegment)(track);
|
||||
const displayWidth = (0, traversal_1.getDisplayWidthSegment)(track);
|
||||
const codec = (0, traversal_1.getCodecSegment)(track);
|
||||
if (!codec) {
|
||||
return null;
|
||||
}
|
||||
const codecPrivate = (0, traversal_1.getPrivateData)(track);
|
||||
const codecString = getMatroskaVideoCodecString({
|
||||
track,
|
||||
codecSegment: codec,
|
||||
});
|
||||
const colour = (0, traversal_1.getColourSegment)(track);
|
||||
if (!codecString) {
|
||||
return null;
|
||||
}
|
||||
const codecEnum = getMatroskaVideoCodecEnum({
|
||||
codecSegment: codec,
|
||||
});
|
||||
const codecData = codecPrivate === null
|
||||
? null
|
||||
: codecEnum === 'h264'
|
||||
? { type: 'avc-sps-pps', data: codecPrivate }
|
||||
: codecEnum === 'av1'
|
||||
? {
|
||||
type: 'av1c-data',
|
||||
data: codecPrivate,
|
||||
}
|
||||
: codecEnum === 'h265'
|
||||
? {
|
||||
type: 'hvcc-data',
|
||||
data: codecPrivate,
|
||||
}
|
||||
: codecEnum === 'vp8'
|
||||
? {
|
||||
type: 'unknown-data',
|
||||
data: codecPrivate,
|
||||
}
|
||||
: codecEnum === 'vp9'
|
||||
? {
|
||||
type: 'unknown-data',
|
||||
data: codecPrivate,
|
||||
}
|
||||
: null;
|
||||
const advancedColor = colour
|
||||
? (0, color_1.parseColorSegment)(colour)
|
||||
: {
|
||||
fullRange: null,
|
||||
matrix: null,
|
||||
primaries: null,
|
||||
transfer: null,
|
||||
};
|
||||
return {
|
||||
m3uStreamFormat: null,
|
||||
type: 'video',
|
||||
trackId,
|
||||
codec: codecString,
|
||||
description: getDescription(track),
|
||||
height: displayHeight ? displayHeight.value.value : height.value.value,
|
||||
width: displayWidth ? displayWidth.value.value : width.value.value,
|
||||
sampleAspectRatio: {
|
||||
numerator: 1,
|
||||
denominator: 1,
|
||||
},
|
||||
originalTimescale: timescale,
|
||||
codedHeight: height.value.value,
|
||||
codedWidth: width.value.value,
|
||||
displayAspectHeight: displayHeight
|
||||
? displayHeight.value.value
|
||||
: height.value.value,
|
||||
displayAspectWidth: displayWidth
|
||||
? displayWidth.value.value
|
||||
: width.value.value,
|
||||
rotation: 0,
|
||||
codecData,
|
||||
colorSpace: (0, color_to_webcodecs_colors_1.mediaParserAdvancedColorToWebCodecsColor)(advancedColor),
|
||||
advancedColor,
|
||||
codecEnum,
|
||||
fps: null,
|
||||
startInSeconds: 0,
|
||||
timescale: webcodecs_timescale_1.WEBCODECS_TIMESCALE,
|
||||
trackMediaTimeOffsetInTrackTimescale: 0,
|
||||
};
|
||||
}
|
||||
if ((0, track_entry_1.trackTypeToString)(trackType.value.value) === 'audio') {
|
||||
const sampleRate = (0, traversal_1.getSampleRate)(track);
|
||||
const numberOfChannels = (0, traversal_1.getNumberOfChannels)(track);
|
||||
const codecPrivate = (0, traversal_1.getPrivateData)(track);
|
||||
if (sampleRate === null) {
|
||||
throw new Error('Could not find sample rate or number of channels');
|
||||
}
|
||||
const codecString = getMatroskaAudioCodecString(track);
|
||||
return {
|
||||
type: 'audio',
|
||||
trackId,
|
||||
codec: codecString,
|
||||
originalTimescale: timescale,
|
||||
numberOfChannels,
|
||||
sampleRate,
|
||||
description: (0, description_1.getAudioDescription)(track),
|
||||
codecData: codecPrivate
|
||||
? codecString === 'opus'
|
||||
? { type: 'ogg-identification', data: codecPrivate }
|
||||
: { type: 'unknown-data', data: codecPrivate }
|
||||
: null,
|
||||
codecEnum: (0, exports.getMatroskaAudioCodecEnum)({
|
||||
track,
|
||||
}),
|
||||
startInSeconds: 0,
|
||||
timescale: webcodecs_timescale_1.WEBCODECS_TIMESCALE,
|
||||
trackMediaTimeOffsetInTrackTimescale: 0,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.getTrack = getTrack;
|
||||
13
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-ebml.d.ts
generated
vendored
Normal file
13
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-ebml.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
||||
import type { MediaParserLogLevel } from '../../log';
|
||||
import type { PossibleEbml } from './segments/all-segments';
|
||||
import type { WebmRequiredStatesForProcessing } from './state-for-processing';
|
||||
export type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
export declare const parseEbml: (iterator: BufferIterator, statesForProcessing: WebmRequiredStatesForProcessing | null, logLevel: MediaParserLogLevel) => Promise<Prettify<PossibleEbml> | null>;
|
||||
export declare const postprocessEbml: ({ offset, ebml, statesForProcessing: { webmState, callbacks, logLevel, onAudioTrack, onVideoTrack, structureState, avcState, }, }: {
|
||||
offset: number;
|
||||
ebml: Prettify<PossibleEbml>;
|
||||
statesForProcessing: WebmRequiredStatesForProcessing;
|
||||
}) => Promise<Prettify<PossibleEbml>>;
|
||||
235
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-ebml.js
generated
vendored
Normal file
235
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-ebml.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.postprocessEbml = exports.parseEbml = void 0;
|
||||
const log_1 = require("../../log");
|
||||
const register_track_1 = require("../../register-track");
|
||||
const get_sample_from_block_1 = require("./get-sample-from-block");
|
||||
const make_track_1 = require("./make-track");
|
||||
const all_segments_1 = require("./segments/all-segments");
|
||||
const parseEbml = async (iterator, statesForProcessing, logLevel) => {
|
||||
const hex = iterator.getMatroskaSegmentId();
|
||||
if (hex === null) {
|
||||
throw new Error('Not enough bytes left to parse EBML - this should not happen');
|
||||
}
|
||||
const off = iterator.counter.getOffset();
|
||||
const size = iterator.getVint();
|
||||
const minVintWidth = iterator.counter.getOffset() - off;
|
||||
if (size === null) {
|
||||
throw new Error('Not enough bytes left to parse EBML - this should not happen');
|
||||
}
|
||||
const hasInMap = all_segments_1.ebmlMap[hex];
|
||||
if (!hasInMap) {
|
||||
log_1.Log.verbose(logLevel, `Unknown EBML hex ID ${JSON.stringify(hex)}`);
|
||||
iterator.discard(size);
|
||||
return null;
|
||||
}
|
||||
if (hasInMap.type === 'uint') {
|
||||
const beforeUintOffset = iterator.counter.getOffset();
|
||||
const value = size === 0 ? 0 : iterator.getUint(size);
|
||||
const { name } = hasInMap;
|
||||
return {
|
||||
// To work around TS limit
|
||||
type: name,
|
||||
value: {
|
||||
value,
|
||||
byteLength: iterator.counter.getOffset() - beforeUintOffset,
|
||||
},
|
||||
minVintWidth,
|
||||
};
|
||||
}
|
||||
if (hasInMap.type === 'string') {
|
||||
const value = iterator.getByteString(size, true);
|
||||
return {
|
||||
type: hasInMap.name,
|
||||
value,
|
||||
minVintWidth,
|
||||
};
|
||||
}
|
||||
if (hasInMap.type === 'float') {
|
||||
const value = size === 0
|
||||
? 0.0
|
||||
: size === 4
|
||||
? iterator.getFloat32()
|
||||
: iterator.getFloat64();
|
||||
return {
|
||||
type: hasInMap.name,
|
||||
value: {
|
||||
value,
|
||||
size: size === 4 ? '32' : '64',
|
||||
},
|
||||
minVintWidth,
|
||||
};
|
||||
}
|
||||
if (hasInMap.type === 'hex-string') {
|
||||
return {
|
||||
type: hasInMap.name,
|
||||
value: '0x' +
|
||||
[...iterator.getSlice(size)]
|
||||
.map((b) => b.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
.replace(new RegExp('^' + hex), ''),
|
||||
minVintWidth,
|
||||
};
|
||||
}
|
||||
if (hasInMap.type === 'uint8array') {
|
||||
return {
|
||||
type: hasInMap.name,
|
||||
value: iterator.getSlice(size),
|
||||
minVintWidth,
|
||||
};
|
||||
}
|
||||
if (hasInMap.type === 'children') {
|
||||
const children = [];
|
||||
const startOffset = iterator.counter.getOffset();
|
||||
while (true) {
|
||||
if (size === 0) {
|
||||
break;
|
||||
}
|
||||
const offset = iterator.counter.getOffset();
|
||||
const value = await (0, exports.parseEbml)(iterator, statesForProcessing, logLevel);
|
||||
if (value) {
|
||||
const remapped = statesForProcessing
|
||||
? // eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
await (0, exports.postprocessEbml)({
|
||||
offset,
|
||||
ebml: value,
|
||||
statesForProcessing,
|
||||
})
|
||||
: value;
|
||||
children.push(remapped);
|
||||
}
|
||||
const offsetNow = iterator.counter.getOffset();
|
||||
if (offsetNow - startOffset > size) {
|
||||
throw new Error(`Offset ${offsetNow - startOffset} is larger than the length of the hex ${size}`);
|
||||
}
|
||||
if (offsetNow - startOffset === size) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return { type: hasInMap.name, value: children, minVintWidth };
|
||||
}
|
||||
// @ts-expect-error
|
||||
throw new Error(`Unknown segment type ${hasInMap.type}`);
|
||||
};
|
||||
exports.parseEbml = parseEbml;
|
||||
const postprocessEbml = async ({ offset, ebml, statesForProcessing: { webmState, callbacks, logLevel, onAudioTrack, onVideoTrack, structureState, avcState, }, }) => {
|
||||
if (ebml.type === 'TimestampScale') {
|
||||
webmState.setTimescale(ebml.value.value);
|
||||
}
|
||||
if (ebml.type === 'Tracks') {
|
||||
callbacks.tracks.setIsDone(logLevel);
|
||||
}
|
||||
if (ebml.type === 'TrackEntry') {
|
||||
webmState.onTrackEntrySegment(ebml);
|
||||
const track = (0, make_track_1.getTrack)({
|
||||
track: ebml,
|
||||
timescale: webmState.getTimescale(),
|
||||
});
|
||||
if (track && track.type === 'audio') {
|
||||
await (0, register_track_1.registerAudioTrack)({
|
||||
track,
|
||||
container: 'webm',
|
||||
registerAudioSampleCallback: callbacks.registerAudioSampleCallback,
|
||||
tracks: callbacks.tracks,
|
||||
logLevel,
|
||||
onAudioTrack,
|
||||
});
|
||||
}
|
||||
if (track && track.type === 'video') {
|
||||
if (track.codec !== make_track_1.NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS) {
|
||||
await (0, register_track_1.registerVideoTrack)({
|
||||
track,
|
||||
container: 'webm',
|
||||
logLevel,
|
||||
onVideoTrack,
|
||||
registerVideoSampleCallback: callbacks.registerVideoSampleCallback,
|
||||
tracks: callbacks.tracks,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ebml.type === 'Timestamp') {
|
||||
webmState.setTimestampOffset(offset, ebml.value.value);
|
||||
}
|
||||
if (ebml.type === 'Block' || ebml.type === 'SimpleBlock') {
|
||||
const sample = await (0, get_sample_from_block_1.getSampleFromBlock)({
|
||||
ebml,
|
||||
webmState,
|
||||
offset,
|
||||
structureState,
|
||||
callbacks,
|
||||
logLevel,
|
||||
onVideoTrack,
|
||||
avcState,
|
||||
});
|
||||
if (sample.type === 'video-sample') {
|
||||
await callbacks.onVideoSample({
|
||||
videoSample: sample.videoSample,
|
||||
trackId: sample.trackId,
|
||||
});
|
||||
return {
|
||||
type: 'Block',
|
||||
value: new Uint8Array([]),
|
||||
minVintWidth: ebml.minVintWidth,
|
||||
};
|
||||
}
|
||||
if (sample.type === 'audio-sample') {
|
||||
await callbacks.onAudioSample({
|
||||
audioSample: sample.audioSample,
|
||||
trackId: sample.trackId,
|
||||
});
|
||||
return {
|
||||
type: 'Block',
|
||||
value: new Uint8Array([]),
|
||||
minVintWidth: ebml.minVintWidth,
|
||||
};
|
||||
}
|
||||
if (sample.type === 'no-sample') {
|
||||
return {
|
||||
type: 'Block',
|
||||
value: new Uint8Array([]),
|
||||
minVintWidth: ebml.minVintWidth,
|
||||
};
|
||||
}
|
||||
}
|
||||
if (ebml.type === 'BlockGroup') {
|
||||
// Blocks don't have information about keyframes.
|
||||
// https://ffmpeg.org/pipermail/ffmpeg-devel/2015-June/173825.html
|
||||
// "For Blocks, keyframes is
|
||||
// inferred by the absence of ReferenceBlock element (as done by matroskadec).""
|
||||
const block = ebml.value.find((c) => c.type === 'SimpleBlock' || c.type === 'Block');
|
||||
if (!block || (block.type !== 'SimpleBlock' && block.type !== 'Block')) {
|
||||
throw new Error('Expected block segment');
|
||||
}
|
||||
const hasReferenceBlock = ebml.value.find((c) => c.type === 'ReferenceBlock');
|
||||
const sample = block.value.length === 0
|
||||
? null
|
||||
: await (0, get_sample_from_block_1.getSampleFromBlock)({
|
||||
ebml: block,
|
||||
webmState,
|
||||
offset,
|
||||
structureState,
|
||||
callbacks,
|
||||
logLevel,
|
||||
onVideoTrack,
|
||||
avcState,
|
||||
});
|
||||
if (sample && sample.type === 'partial-video-sample') {
|
||||
const completeFrame = {
|
||||
...sample.partialVideoSample,
|
||||
type: hasReferenceBlock ? 'delta' : 'key',
|
||||
};
|
||||
await callbacks.onVideoSample({
|
||||
videoSample: completeFrame,
|
||||
trackId: sample.trackId,
|
||||
});
|
||||
}
|
||||
return {
|
||||
type: 'BlockGroup',
|
||||
value: [],
|
||||
minVintWidth: ebml.minVintWidth,
|
||||
};
|
||||
}
|
||||
return ebml;
|
||||
};
|
||||
exports.postprocessEbml = postprocessEbml;
|
||||
3
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-webm-header.d.ts
generated
vendored
Normal file
3
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-webm-header.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { ParseResult } from '../../parse-result';
|
||||
import type { ParserState } from '../../state/parser-state';
|
||||
export declare const parseWebm: (state: ParserState) => Promise<ParseResult>;
|
||||
63
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-webm-header.js
generated
vendored
Normal file
63
remotion/node_modules/@remotion/media-parser/dist/containers/webm/parse-webm-header.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseWebm = void 0;
|
||||
const skip_1 = require("../../skip");
|
||||
const may_skip_video_data_1 = require("../../state/may-skip-video-data");
|
||||
const get_byte_for_cues_1 = require("./get-byte-for-cues");
|
||||
const segments_1 = require("./segments");
|
||||
const state_for_processing_1 = require("./state-for-processing");
|
||||
// Parsing according to https://darkcoding.net/software/reading-mediarecorders-webm-opus-output/
|
||||
const parseWebm = async (state) => {
|
||||
const structure = state.structure.getMatroskaStructure();
|
||||
const { iterator } = state;
|
||||
const offset = iterator.counter.getOffset();
|
||||
const isInsideSegment = state.webm.isInsideSegment(iterator);
|
||||
const isInsideCluster = state.webm.isInsideCluster(offset);
|
||||
const results = await (0, segments_1.expectSegment)({
|
||||
iterator,
|
||||
logLevel: state.logLevel,
|
||||
statesForProcessing: (0, state_for_processing_1.selectStatesForProcessing)(state),
|
||||
isInsideSegment,
|
||||
mediaSectionState: state.mediaSection,
|
||||
});
|
||||
if ((results === null || results === void 0 ? void 0 : results.type) === 'SeekHead') {
|
||||
const position = (0, get_byte_for_cues_1.getByteForSeek)({ seekHeadSegment: results, offset });
|
||||
if (position !== null) {
|
||||
state.webm.cues.triggerLoad(position, offset);
|
||||
}
|
||||
}
|
||||
if (results === null) {
|
||||
return null;
|
||||
}
|
||||
if (isInsideCluster) {
|
||||
if ((0, may_skip_video_data_1.maySkipVideoData)({ state })) {
|
||||
return (0, skip_1.makeSkip)(Math.min(state.contentLength, isInsideCluster.size + isInsideCluster.start));
|
||||
}
|
||||
const segments = structure.boxes.filter((box) => box.type === 'Segment');
|
||||
const segment = segments[isInsideCluster.segment];
|
||||
if (!segment) {
|
||||
throw new Error('Expected segment');
|
||||
}
|
||||
const clusters = segment.value.find((box) => box.type === 'Cluster');
|
||||
if (!clusters) {
|
||||
throw new Error('Expected cluster');
|
||||
}
|
||||
// let's not add it to the cluster
|
||||
if (results.type !== 'Block' && results.type !== 'SimpleBlock') {
|
||||
clusters.value.push(results);
|
||||
}
|
||||
}
|
||||
else if (isInsideSegment) {
|
||||
const segments = structure.boxes.filter((box) => box.type === 'Segment');
|
||||
const segment = segments[isInsideSegment.index];
|
||||
if (!segment) {
|
||||
throw new Error('Expected segment');
|
||||
}
|
||||
segment.value.push(results);
|
||||
}
|
||||
else {
|
||||
structure.boxes.push(results);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.parseWebm = parseWebm;
|
||||
14
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/fetch-web-cues.d.ts
generated
vendored
Normal file
14
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/fetch-web-cues.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { MediaParserController } from '../../../controller/media-parser-controller';
|
||||
import type { PrefetchCache } from '../../../fetch';
|
||||
import type { MediaParserLogLevel } from '../../../log';
|
||||
import type { ParseMediaSrc } from '../../../options';
|
||||
import type { MediaParserReaderInterface } from '../../../readers/reader';
|
||||
import type { MatroskaCue } from './format-cues';
|
||||
export declare const fetchWebmCues: ({ src, readerInterface, controller, position, logLevel, prefetchCache, }: {
|
||||
src: ParseMediaSrc;
|
||||
readerInterface: MediaParserReaderInterface;
|
||||
controller: MediaParserController;
|
||||
position: number;
|
||||
logLevel: MediaParserLogLevel;
|
||||
prefetchCache: PrefetchCache;
|
||||
}) => Promise<MatroskaCue[] | null>;
|
||||
38
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/fetch-web-cues.js
generated
vendored
Normal file
38
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/fetch-web-cues.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetchWebmCues = void 0;
|
||||
const buffer_iterator_1 = require("../../../iterator/buffer-iterator");
|
||||
const segments_1 = require("../segments");
|
||||
const format_cues_1 = require("./format-cues");
|
||||
const fetchWebmCues = async ({ src, readerInterface, controller, position, logLevel, prefetchCache, }) => {
|
||||
const result = await readerInterface.read({
|
||||
controller,
|
||||
range: position,
|
||||
src,
|
||||
logLevel,
|
||||
prefetchCache,
|
||||
});
|
||||
const { value } = await result.reader.reader.read();
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
result.reader.abort();
|
||||
const iterator = (0, buffer_iterator_1.getArrayBufferIterator)({
|
||||
initialData: value,
|
||||
maxBytes: value.length,
|
||||
logLevel: 'error',
|
||||
});
|
||||
const segment = await (0, segments_1.expectSegment)({
|
||||
iterator,
|
||||
logLevel,
|
||||
statesForProcessing: null,
|
||||
isInsideSegment: null,
|
||||
mediaSectionState: null,
|
||||
});
|
||||
iterator.destroy();
|
||||
if (!(segment === null || segment === void 0 ? void 0 : segment.value)) {
|
||||
return null;
|
||||
}
|
||||
return (0, format_cues_1.formatCues)(segment.value);
|
||||
};
|
||||
exports.fetchWebmCues = fetchWebmCues;
|
||||
8
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/format-cues.d.ts
generated
vendored
Normal file
8
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/format-cues.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { PossibleEbml } from '../segments/all-segments';
|
||||
export type MatroskaCue = {
|
||||
trackId: number;
|
||||
timeInTimescale: number;
|
||||
clusterPositionInSegment: number;
|
||||
relativePosition: number;
|
||||
};
|
||||
export declare const formatCues: (cues: PossibleEbml[]) => MatroskaCue[];
|
||||
42
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/format-cues.js
generated
vendored
Normal file
42
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/format-cues.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.formatCues = void 0;
|
||||
const formatCues = (cues) => {
|
||||
var _a;
|
||||
const matroskaCues = [];
|
||||
for (const cue of cues) {
|
||||
if (cue.type === 'Crc32') {
|
||||
continue;
|
||||
}
|
||||
if (cue.type !== 'CuePoint') {
|
||||
throw new Error('Expected CuePoint');
|
||||
}
|
||||
const cueTime = cue.value.find((_cue) => _cue.type === 'CueTime');
|
||||
if (!cueTime) {
|
||||
throw new Error('Expected CueTime');
|
||||
}
|
||||
const cueTrackPositions = cue.value.find((c) => c.type === 'CueTrackPositions');
|
||||
if (!cueTrackPositions) {
|
||||
throw new Error('Expected CueTrackPositions');
|
||||
}
|
||||
const cueTimeValue = cueTime.value.value;
|
||||
const cueTrack = cueTrackPositions.value.find((_c) => _c.type === 'CueTrack');
|
||||
if (!cueTrack) {
|
||||
throw new Error('Expected CueTrack');
|
||||
}
|
||||
const cueClusterPosition = cueTrackPositions.value.find((_c) => _c.type === 'CueClusterPosition');
|
||||
if (!cueClusterPosition) {
|
||||
throw new Error('Expected CueClusterPosition');
|
||||
}
|
||||
const cueRelativePosition = cueTrackPositions.value.find((_c) => _c.type === 'CueRelativePosition');
|
||||
const matroskaCue = {
|
||||
trackId: cueTrack.value.value,
|
||||
timeInTimescale: cueTimeValue,
|
||||
clusterPositionInSegment: cueClusterPosition.value.value,
|
||||
relativePosition: (_a = cueRelativePosition === null || cueRelativePosition === void 0 ? void 0 : cueRelativePosition.value.value) !== null && _a !== void 0 ? _a : 0,
|
||||
};
|
||||
matroskaCues.push(matroskaCue);
|
||||
}
|
||||
return matroskaCues;
|
||||
};
|
||||
exports.formatCues = formatCues;
|
||||
12
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/get-seeking-byte.d.ts
generated
vendored
Normal file
12
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/get-seeking-byte.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { MediaParserLogLevel } from '../../../log';
|
||||
import type { WebmSeekingHints } from '../../../seeking-hints';
|
||||
import type { WebmState } from '../../../state/matroska/webm';
|
||||
import type { MediaSectionState } from '../../../state/video-section';
|
||||
import type { SeekResolution } from '../../../work-on-seek-request';
|
||||
export declare const getSeekingByteFromMatroska: ({ time, webmState, info, logLevel, mediaSection, }: {
|
||||
time: number;
|
||||
webmState: WebmState;
|
||||
info: WebmSeekingHints;
|
||||
logLevel: MediaParserLogLevel;
|
||||
mediaSection: MediaSectionState;
|
||||
}) => Promise<SeekResolution>;
|
||||
115
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/get-seeking-byte.js
generated
vendored
Normal file
115
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/get-seeking-byte.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSeekingByteFromMatroska = void 0;
|
||||
const log_1 = require("../../../log");
|
||||
const toSeconds = (timeInTimescale, track) => {
|
||||
return (timeInTimescale / track.timescale) * 1000;
|
||||
};
|
||||
const findBiggestCueBeforeTime = ({ cues, time, track, }) => {
|
||||
let biggestCueBeforeTime;
|
||||
for (const cue of cues) {
|
||||
const cueTimeInSeconds = toSeconds(cue.timeInTimescale, track);
|
||||
if (cueTimeInSeconds < time &&
|
||||
(!biggestCueBeforeTime ||
|
||||
cueTimeInSeconds >
|
||||
toSeconds(biggestCueBeforeTime.timeInTimescale, track))) {
|
||||
biggestCueBeforeTime = cue;
|
||||
}
|
||||
}
|
||||
return biggestCueBeforeTime;
|
||||
};
|
||||
const findKeyframeBeforeTime = ({ keyframes, time, }) => {
|
||||
let keyframeBeforeTime;
|
||||
for (const keyframe of keyframes) {
|
||||
if (keyframe.decodingTimeInSeconds < time &&
|
||||
(!keyframeBeforeTime ||
|
||||
keyframe.decodingTimeInSeconds >
|
||||
keyframeBeforeTime.decodingTimeInSeconds)) {
|
||||
keyframeBeforeTime = keyframe;
|
||||
}
|
||||
}
|
||||
return keyframeBeforeTime !== null && keyframeBeforeTime !== void 0 ? keyframeBeforeTime : null;
|
||||
};
|
||||
const getByteFromCues = ({ cuesResponse, time, info, logLevel, }) => {
|
||||
if (!cuesResponse) {
|
||||
log_1.Log.trace(logLevel, 'Has no Matroska cues at the moment, cannot use them');
|
||||
return null;
|
||||
}
|
||||
const { cues, segmentOffset } = cuesResponse;
|
||||
log_1.Log.trace(logLevel, 'Has Matroska cues. Will use them to perform a seek.');
|
||||
const biggestCueBeforeTime = findBiggestCueBeforeTime({
|
||||
cues,
|
||||
time,
|
||||
track: info.track,
|
||||
});
|
||||
if (!biggestCueBeforeTime) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
byte: biggestCueBeforeTime.clusterPositionInSegment + segmentOffset,
|
||||
timeInSeconds: toSeconds(biggestCueBeforeTime.timeInTimescale, info.track),
|
||||
};
|
||||
};
|
||||
const getSeekingByteFromMatroska = async ({ time, webmState, info, logLevel, mediaSection, }) => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if (!info.track) {
|
||||
log_1.Log.trace(logLevel, 'No video track found, cannot seek yet');
|
||||
return {
|
||||
type: 'valid-but-must-wait',
|
||||
};
|
||||
}
|
||||
const cuesResponse = (_a = info.loadedCues) !== null && _a !== void 0 ? _a : (await webmState.cues.getLoadedCues());
|
||||
// Check if we have already read keyframes
|
||||
const byteFromObservedKeyframe = findKeyframeBeforeTime({
|
||||
keyframes: info.keyframes,
|
||||
time,
|
||||
});
|
||||
// Check if we have `Cues`
|
||||
const byteFromCues = getByteFromCues({
|
||||
cuesResponse,
|
||||
time,
|
||||
info,
|
||||
logLevel,
|
||||
});
|
||||
// Fallback: back to the beginning
|
||||
const byteFromFirstMediaSection = (_c = (_b = webmState.getFirstCluster()) === null || _b === void 0 ? void 0 : _b.start) !== null && _c !== void 0 ? _c : null;
|
||||
// Optimization possibility for later:
|
||||
// Don't seek back, if the last seen time is smaller than the time we want to seek to
|
||||
const seekPossibilities = [
|
||||
(_d = byteFromCues === null || byteFromCues === void 0 ? void 0 : byteFromCues.byte) !== null && _d !== void 0 ? _d : null,
|
||||
(_e = byteFromObservedKeyframe === null || byteFromObservedKeyframe === void 0 ? void 0 : byteFromObservedKeyframe.positionInBytes) !== null && _e !== void 0 ? _e : null,
|
||||
byteFromFirstMediaSection,
|
||||
].filter((n) => n !== null);
|
||||
const byteToSeekTo = seekPossibilities.length === 0 ? null : Math.max(...seekPossibilities);
|
||||
if (byteToSeekTo === null) {
|
||||
// dont know what to do
|
||||
return {
|
||||
type: 'invalid',
|
||||
};
|
||||
}
|
||||
// we have assured this is in a media section, but it might not be marked yet
|
||||
// setting size because there is deduplication and media sections which are encompassed
|
||||
// by others will get deleted
|
||||
mediaSection.addMediaSection({
|
||||
start: byteToSeekTo,
|
||||
size: 1,
|
||||
});
|
||||
const timeInSeconds = (() => {
|
||||
if (byteToSeekTo === (byteFromObservedKeyframe === null || byteFromObservedKeyframe === void 0 ? void 0 : byteFromObservedKeyframe.positionInBytes)) {
|
||||
return Math.min(byteFromObservedKeyframe.decodingTimeInSeconds, byteFromObservedKeyframe.presentationTimeInSeconds);
|
||||
}
|
||||
if (byteToSeekTo === (byteFromCues === null || byteFromCues === void 0 ? void 0 : byteFromCues.byte)) {
|
||||
return byteFromCues.timeInSeconds;
|
||||
}
|
||||
if (byteToSeekTo === byteFromFirstMediaSection) {
|
||||
return 0;
|
||||
}
|
||||
throw new Error('Should not happen');
|
||||
})();
|
||||
return {
|
||||
type: 'do-seek',
|
||||
byte: byteToSeekTo,
|
||||
timeInSeconds,
|
||||
};
|
||||
};
|
||||
exports.getSeekingByteFromMatroska = getSeekingByteFromMatroska;
|
||||
10
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/seeking-hints.d.ts
generated
vendored
Normal file
10
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/seeking-hints.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { WebmSeekingHints } from '../../../seeking-hints';
|
||||
import type { TracksState } from '../../../state/has-tracks-section';
|
||||
import type { KeyframesState } from '../../../state/keyframes';
|
||||
import type { WebmState } from '../../../state/matroska/webm';
|
||||
import type { ParserState } from '../../../state/parser-state';
|
||||
export declare const getSeekingHintsFromMatroska: (tracksState: TracksState, keyframesState: KeyframesState, webmState: WebmState) => WebmSeekingHints;
|
||||
export declare const setSeekingHintsForWebm: ({ hints, state, }: {
|
||||
hints: WebmSeekingHints;
|
||||
state: ParserState;
|
||||
}) => void;
|
||||
28
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/seeking-hints.js
generated
vendored
Normal file
28
remotion/node_modules/@remotion/media-parser/dist/containers/webm/seek/seeking-hints.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setSeekingHintsForWebm = exports.getSeekingHintsFromMatroska = void 0;
|
||||
const getSeekingHintsFromMatroska = (tracksState, keyframesState, webmState) => {
|
||||
const tracks = tracksState.getTracks();
|
||||
const firstVideoTrack = tracks.find((track) => track.type === 'video');
|
||||
const keyframes = keyframesState.getKeyframes();
|
||||
const loadedCues = webmState.cues.getIfAlreadyLoaded();
|
||||
return {
|
||||
type: 'webm-seeking-hints',
|
||||
track: firstVideoTrack
|
||||
? {
|
||||
timescale: firstVideoTrack.originalTimescale,
|
||||
trackId: firstVideoTrack.trackId,
|
||||
}
|
||||
: null,
|
||||
keyframes,
|
||||
loadedCues,
|
||||
timestampMap: webmState.getTimeStampMapForSeekingHints(),
|
||||
};
|
||||
};
|
||||
exports.getSeekingHintsFromMatroska = getSeekingHintsFromMatroska;
|
||||
const setSeekingHintsForWebm = ({ hints, state, }) => {
|
||||
state.webm.cues.setFromSeekingHints(hints);
|
||||
state.keyframes.setFromSeekingHints(hints.keyframes);
|
||||
state.webm.setTimeStampMapForSeekingHints(hints.timestampMap);
|
||||
};
|
||||
exports.setSeekingHintsForWebm = setSeekingHintsForWebm;
|
||||
15
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments.d.ts
generated
vendored
Normal file
15
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { BufferIterator } from '../../iterator/buffer-iterator';
|
||||
import type { MediaParserLogLevel } from '../../log';
|
||||
import type { SegmentSection } from '../../state/matroska/webm';
|
||||
import type { MediaSectionState } from '../../state/video-section';
|
||||
import { type PossibleEbml, type TrackEntry } from './segments/all-segments';
|
||||
import { type WebmRequiredStatesForProcessing } from './state-for-processing';
|
||||
export type MatroskaSegment = PossibleEbml;
|
||||
export type OnTrackEntrySegment = (trackEntry: TrackEntry) => void;
|
||||
export declare const expectSegment: ({ statesForProcessing, isInsideSegment, iterator, logLevel, mediaSectionState, }: {
|
||||
iterator: BufferIterator;
|
||||
logLevel: MediaParserLogLevel;
|
||||
statesForProcessing: WebmRequiredStatesForProcessing | null;
|
||||
isInsideSegment: SegmentSection | null;
|
||||
mediaSectionState: MediaSectionState | null;
|
||||
}) => Promise<MatroskaSegment | null>;
|
||||
102
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments.js
generated
vendored
Normal file
102
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.expectSegment = void 0;
|
||||
const log_1 = require("../../log");
|
||||
const parse_ebml_1 = require("./parse-ebml");
|
||||
const all_segments_1 = require("./segments/all-segments");
|
||||
const expectSegment = async ({ statesForProcessing, isInsideSegment, iterator, logLevel, mediaSectionState, }) => {
|
||||
var _a;
|
||||
if (iterator.bytesRemaining() === 0) {
|
||||
throw new Error('has no bytes');
|
||||
}
|
||||
const offset = iterator.counter.getOffset();
|
||||
const { returnToCheckpoint } = iterator.startCheckpoint();
|
||||
const segmentId = iterator.getMatroskaSegmentId();
|
||||
if (segmentId === null) {
|
||||
returnToCheckpoint();
|
||||
return null;
|
||||
}
|
||||
const offsetBeforeVInt = iterator.counter.getOffset();
|
||||
const size = iterator.getVint();
|
||||
const offsetAfterVInt = iterator.counter.getOffset();
|
||||
if (size === null) {
|
||||
returnToCheckpoint();
|
||||
return null;
|
||||
}
|
||||
const bytesRemainingNow = iterator.bytesRemaining();
|
||||
log_1.Log.trace(logLevel, 'Segment ID:', (_a = all_segments_1.ebmlMap[segmentId]) === null || _a === void 0 ? void 0 : _a.name, 'Size:' + size, bytesRemainingNow);
|
||||
if (segmentId === all_segments_1.matroskaElements.Segment) {
|
||||
if (!statesForProcessing) {
|
||||
throw new Error('States for processing are required');
|
||||
}
|
||||
statesForProcessing.webmState.addSegment({
|
||||
start: offset,
|
||||
size,
|
||||
});
|
||||
const newSegment = {
|
||||
type: 'Segment',
|
||||
minVintWidth: offsetAfterVInt - offsetBeforeVInt,
|
||||
value: [],
|
||||
};
|
||||
return newSegment;
|
||||
}
|
||||
if (segmentId === all_segments_1.matroskaElements.Cluster) {
|
||||
if (isInsideSegment === null) {
|
||||
throw new Error('Expected to be inside segment');
|
||||
}
|
||||
if (!statesForProcessing) {
|
||||
throw new Error('States for processing are required');
|
||||
}
|
||||
if (mediaSectionState) {
|
||||
mediaSectionState.addMediaSection({
|
||||
start: offset,
|
||||
size,
|
||||
});
|
||||
}
|
||||
statesForProcessing.webmState.addCluster({
|
||||
start: offset,
|
||||
size: size + (offsetAfterVInt - offset),
|
||||
segment: isInsideSegment.index,
|
||||
});
|
||||
const newSegment = {
|
||||
type: 'Cluster',
|
||||
minVintWidth: offsetAfterVInt - offsetBeforeVInt,
|
||||
value: [],
|
||||
};
|
||||
return newSegment;
|
||||
}
|
||||
if (bytesRemainingNow < size) {
|
||||
returnToCheckpoint();
|
||||
return null;
|
||||
}
|
||||
const segment = await parseSegment({
|
||||
segmentId,
|
||||
length: size,
|
||||
headerReadSoFar: iterator.counter.getOffset() - offset,
|
||||
statesForProcessing,
|
||||
iterator,
|
||||
logLevel,
|
||||
});
|
||||
return segment;
|
||||
};
|
||||
exports.expectSegment = expectSegment;
|
||||
const parseSegment = async ({ segmentId, length, iterator, headerReadSoFar, statesForProcessing, logLevel, }) => {
|
||||
if (length < 0) {
|
||||
throw new Error(`Expected length of ${segmentId} to be greater or equal 0`);
|
||||
}
|
||||
iterator.counter.decrement(headerReadSoFar);
|
||||
const offset = iterator.counter.getOffset();
|
||||
const ebml = await (0, parse_ebml_1.parseEbml)(iterator, statesForProcessing, logLevel);
|
||||
if (ebml === null) {
|
||||
return null;
|
||||
}
|
||||
if (!statesForProcessing) {
|
||||
return ebml;
|
||||
}
|
||||
const remapped = await (0, parse_ebml_1.postprocessEbml)({
|
||||
offset,
|
||||
ebml,
|
||||
statesForProcessing,
|
||||
});
|
||||
return remapped;
|
||||
};
|
||||
996
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/all-segments.d.ts
generated
vendored
Normal file
996
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/all-segments.d.ts
generated
vendored
Normal file
@@ -0,0 +1,996 @@
|
||||
import type { Prettify } from '../parse-ebml';
|
||||
export declare const matroskaElements: {
|
||||
readonly Header: "0x1a45dfa3";
|
||||
readonly EBMLMaxIDLength: "0x42f2";
|
||||
readonly EBMLVersion: "0x4286";
|
||||
readonly EBMLReadVersion: "0x42f7";
|
||||
readonly EBMLMaxSizeLength: "0x42f3";
|
||||
readonly DocType: "0x4282";
|
||||
readonly DocTypeVersion: "0x4287";
|
||||
readonly DocTypeReadVersion: "0x4285";
|
||||
readonly Segment: "0x18538067";
|
||||
readonly SeekHead: "0x114d9b74";
|
||||
readonly Seek: "0x4dbb";
|
||||
readonly SeekID: "0x53ab";
|
||||
readonly SeekPosition: "0x53ac";
|
||||
readonly Info: "0x1549a966";
|
||||
readonly SegmentUUID: "0x73a4";
|
||||
readonly SegmentFilename: "0x7384";
|
||||
readonly PrevUUID: "0x3cb923";
|
||||
readonly PrevFilename: "0x3c83ab";
|
||||
readonly NextUUID: "0x3eb923";
|
||||
readonly NextFilename: "0x3e83bb";
|
||||
readonly SegmentFamily: "0x4444";
|
||||
readonly ChapterTranslate: "0x6924";
|
||||
readonly ChapterTranslateID: "0x69a5";
|
||||
readonly ChapterTranslateCodec: "0x69bf";
|
||||
readonly ChapterTranslateEditionUID: "0x69fc";
|
||||
readonly TimestampScale: "0x2ad7b1";
|
||||
readonly Duration: "0x4489";
|
||||
readonly DateUTC: "0x4461";
|
||||
readonly Title: "0x7ba9";
|
||||
readonly MuxingApp: "0x4d80";
|
||||
readonly WritingApp: "0x5741";
|
||||
readonly Cluster: "0x1f43b675";
|
||||
readonly Timestamp: "0xe7";
|
||||
readonly SilentTracks: "0x5854";
|
||||
readonly SilentTrackNumber: "0x58d7";
|
||||
readonly Position: "0xa7";
|
||||
readonly PrevSize: "0xab";
|
||||
readonly SimpleBlock: "0xa3";
|
||||
readonly BlockGroup: "0xa0";
|
||||
readonly Block: "0xa1";
|
||||
readonly BlockVirtual: "0xa2";
|
||||
readonly BlockAdditions: "0x75a1";
|
||||
readonly BlockMore: "0xa6";
|
||||
readonly BlockAdditional: "0xa5";
|
||||
readonly BlockAddID: "0xee";
|
||||
readonly BlockDuration: "0x9b";
|
||||
readonly ReferencePriority: "0xfa";
|
||||
readonly ReferenceBlock: "0xfb";
|
||||
readonly ReferenceVirtual: "0xfd";
|
||||
readonly CodecState: "0xa4";
|
||||
readonly DiscardPadding: "0x75a2";
|
||||
readonly Slices: "0x8e";
|
||||
readonly TimeSlice: "0xe8";
|
||||
readonly LaceNumber: "0xcc";
|
||||
readonly FrameNumber: "0xcd";
|
||||
readonly BlockAdditionID: "0xcb";
|
||||
readonly Delay: "0xce";
|
||||
readonly SliceDuration: "0xcf";
|
||||
readonly ReferenceFrame: "0xc8";
|
||||
readonly ReferenceOffset: "0xc9";
|
||||
readonly ReferenceTimestamp: "0xca";
|
||||
readonly EncryptedBlock: "0xaf";
|
||||
readonly Tracks: "0x1654ae6b";
|
||||
readonly TrackEntry: "0xae";
|
||||
readonly TrackNumber: "0xd7";
|
||||
readonly TrackUID: "0x73c5";
|
||||
readonly TrackType: "0x83";
|
||||
readonly FlagEnabled: "0xb9";
|
||||
readonly FlagDefault: "0x88";
|
||||
readonly FlagForced: "0x55aa";
|
||||
readonly FlagHearingImpaired: "0x55ab";
|
||||
readonly FlagVisualImpaired: "0x55ac";
|
||||
readonly FlagTextDescriptions: "0x55ad";
|
||||
readonly FlagOriginal: "0x55ae";
|
||||
readonly FlagCommentary: "0x55af";
|
||||
readonly FlagLacing: "0x9c";
|
||||
readonly MinCache: "0x6de7";
|
||||
readonly MaxCache: "0x6df8";
|
||||
readonly DefaultDuration: "0x23e383";
|
||||
readonly DefaultDecodedFieldDuration: "0x234e7a";
|
||||
readonly TrackTimestampScale: "0x23314f";
|
||||
readonly TrackOffset: "0x537f";
|
||||
readonly MaxBlockAdditionID: "0x55ee";
|
||||
readonly BlockAdditionMapping: "0x41e4";
|
||||
readonly BlockAddIDValue: "0x41f0";
|
||||
readonly BlockAddIDName: "0x41a4";
|
||||
readonly BlockAddIDType: "0x41e7";
|
||||
readonly BlockAddIDExtraData: "0x41ed";
|
||||
readonly Name: "0x536e";
|
||||
readonly Language: "0x22b59c";
|
||||
readonly LanguageBCP47: "0x22b59d";
|
||||
readonly CodecID: "0x86";
|
||||
readonly CodecPrivate: "0x63a2";
|
||||
readonly CodecName: "0x258688";
|
||||
readonly AttachmentLink: "0x7446";
|
||||
readonly CodecSettings: "0x3a9697";
|
||||
readonly CodecInfoURL: "0x3b4040";
|
||||
readonly CodecDownloadURL: "0x26b240";
|
||||
readonly CodecDecodeAll: "0xaa";
|
||||
readonly TrackOverlay: "0x6fab";
|
||||
readonly CodecDelay: "0x56aa";
|
||||
readonly SeekPreRoll: "0x56bb";
|
||||
readonly TrackTranslate: "0x6624";
|
||||
readonly TrackTranslateTrackID: "0x66a5";
|
||||
readonly TrackTranslateCodec: "0x66bf";
|
||||
readonly TrackTranslateEditionUID: "0x66fc";
|
||||
readonly Video: "0xe0";
|
||||
readonly FlagInterlaced: "0x9a";
|
||||
readonly FieldOrder: "0x9d";
|
||||
readonly StereoMode: "0x53b8";
|
||||
readonly AlphaMode: "0x53c0";
|
||||
readonly OldStereoMode: "0x53b9";
|
||||
readonly PixelWidth: "0xb0";
|
||||
readonly PixelHeight: "0xba";
|
||||
readonly PixelCropBottom: "0x54aa";
|
||||
readonly PixelCropTop: "0x54bb";
|
||||
readonly PixelCropLeft: "0x54cc";
|
||||
readonly PixelCropRight: "0x54dd";
|
||||
readonly DisplayWidth: "0x54b0";
|
||||
readonly DisplayHeight: "0x54ba";
|
||||
readonly DisplayUnit: "0x54b2";
|
||||
readonly AspectRatioType: "0x54b3";
|
||||
readonly UncompressedFourCC: "0x2eb524";
|
||||
readonly GammaValue: "0x2fb523";
|
||||
readonly FrameRate: "0x2383e3";
|
||||
readonly Colour: "0x55b0";
|
||||
readonly MatrixCoefficients: "0x55b1";
|
||||
readonly BitsPerChannel: "0x55b2";
|
||||
readonly ChromaSubsamplingHorz: "0x55b3";
|
||||
readonly ChromaSubsamplingVert: "0x55b4";
|
||||
readonly CbSubsamplingHorz: "0x55b5";
|
||||
readonly CbSubsamplingVert: "0x55b6";
|
||||
readonly ChromaSitingHorz: "0x55b7";
|
||||
readonly ChromaSitingVert: "0x55b8";
|
||||
readonly Range: "0x55b9";
|
||||
readonly TransferCharacteristics: "0x55ba";
|
||||
readonly Primaries: "0x55bb";
|
||||
readonly MaxCLL: "0x55bc";
|
||||
readonly MaxFALL: "0x55bd";
|
||||
readonly MasteringMetadata: "0x55d0";
|
||||
readonly PrimaryRChromaticityX: "0x55d1";
|
||||
readonly PrimaryRChromaticityY: "0x55d2";
|
||||
readonly PrimaryGChromaticityX: "0x55d3";
|
||||
readonly PrimaryGChromaticityY: "0x55d4";
|
||||
readonly PrimaryBChromaticityX: "0x55d5";
|
||||
readonly PrimaryBChromaticityY: "0x55d6";
|
||||
readonly WhitePointChromaticityX: "0x55d7";
|
||||
readonly WhitePointChromaticityY: "0x55d8";
|
||||
readonly LuminanceMax: "0x55d9";
|
||||
readonly LuminanceMin: "0x55da";
|
||||
readonly Projection: "0x7670";
|
||||
readonly ProjectionType: "0x7671";
|
||||
readonly ProjectionPrivate: "0x7672";
|
||||
readonly ProjectionPoseYaw: "0x7673";
|
||||
readonly ProjectionPosePitch: "0x7674";
|
||||
readonly ProjectionPoseRoll: "0x7675";
|
||||
readonly Audio: "0xe1";
|
||||
readonly SamplingFrequency: "0xb5";
|
||||
readonly OutputSamplingFrequency: "0x78b5";
|
||||
readonly Channels: "0x9f";
|
||||
readonly ChannelPositions: "0x7d7b";
|
||||
readonly BitDepth: "0x6264";
|
||||
readonly Emphasis: "0x52f1";
|
||||
readonly TrackOperation: "0xe2";
|
||||
readonly TrackCombinePlanes: "0xe3";
|
||||
readonly TrackPlane: "0xe4";
|
||||
readonly TrackPlaneUID: "0xe5";
|
||||
readonly TrackPlaneType: "0xe6";
|
||||
readonly TrackJoinBlocks: "0xe9";
|
||||
readonly TrackJoinUID: "0xed";
|
||||
readonly TrickTrackUID: "0xc0";
|
||||
readonly TrickTrackSegmentUID: "0xc1";
|
||||
readonly TrickTrackFlag: "0xc6";
|
||||
readonly TrickMasterTrackUID: "0xc7";
|
||||
readonly TrickMasterTrackSegmentUID: "0xc4";
|
||||
readonly ContentEncodings: "0x6d80";
|
||||
readonly ContentEncoding: "0x6240";
|
||||
readonly ContentEncodingOrder: "0x5031";
|
||||
readonly ContentEncodingScope: "0x5032";
|
||||
readonly ContentEncodingType: "0x5033";
|
||||
readonly ContentCompression: "0x5034";
|
||||
readonly ContentCompAlgo: "0x4254";
|
||||
readonly ContentCompSettings: "0x4255";
|
||||
readonly ContentEncryption: "0x5035";
|
||||
readonly ContentEncAlgo: "0x47e1";
|
||||
readonly ContentEncKeyID: "0x47e2";
|
||||
readonly ContentEncAESSettings: "0x47e7";
|
||||
readonly AESSettingsCipherMode: "0x47e8";
|
||||
readonly ContentSignature: "0x47e3";
|
||||
readonly ContentSigKeyID: "0x47e4";
|
||||
readonly ContentSigAlgo: "0x47e5";
|
||||
readonly ContentSigHashAlgo: "0x47e6";
|
||||
readonly Cues: "0x1c53bb6b";
|
||||
readonly CuePoint: "0xbb";
|
||||
readonly CueTime: "0xb3";
|
||||
readonly CueTrackPositions: "0xb7";
|
||||
readonly CueTrack: "0xf7";
|
||||
readonly CueClusterPosition: "0xf1";
|
||||
readonly CueRelativePosition: "0xf0";
|
||||
readonly CueDuration: "0xb2";
|
||||
readonly CueBlockNumber: "0x5378";
|
||||
readonly CueCodecState: "0xea";
|
||||
readonly CueReference: "0xdb";
|
||||
readonly CueRefTime: "0x96";
|
||||
readonly CueRefCluster: "0x97";
|
||||
readonly CueRefNumber: "0x535f";
|
||||
readonly CueRefCodecState: "0xeb";
|
||||
readonly Attachments: "0x1941a469";
|
||||
readonly AttachedFile: "0x61a7";
|
||||
readonly FileDescription: "0x467e";
|
||||
readonly FileName: "0x466e";
|
||||
readonly FileMediaType: "0x4660";
|
||||
readonly FileData: "0x465c";
|
||||
readonly FileUID: "0x46ae";
|
||||
readonly FileReferral: "0x4675";
|
||||
readonly FileUsedStartTime: "0x4661";
|
||||
readonly FileUsedEndTime: "0x4662";
|
||||
readonly Chapters: "0x1043a770";
|
||||
readonly EditionEntry: "0x45b9";
|
||||
readonly EditionUID: "0x45bc";
|
||||
readonly EditionFlagHidden: "0x45bd";
|
||||
readonly EditionFlagDefault: "0x45db";
|
||||
readonly EditionFlagOrdered: "0x45dd";
|
||||
readonly EditionDisplay: "0x4520";
|
||||
readonly EditionString: "0x4521";
|
||||
readonly EditionLanguageIETF: "0x45e4";
|
||||
readonly ChapterAtom: "0xb6";
|
||||
readonly ChapterUID: "0x73c4";
|
||||
readonly ChapterStringUID: "0x5654";
|
||||
readonly ChapterTimeStart: "0x91";
|
||||
readonly ChapterTimeEnd: "0x92";
|
||||
readonly ChapterFlagHidden: "0x98";
|
||||
readonly ChapterFlagEnabled: "0x4598";
|
||||
readonly ChapterSegmentUUID: "0x6e67";
|
||||
readonly ChapterSkipType: "0x4588";
|
||||
readonly ChapterSegmentEditionUID: "0x6ebc";
|
||||
readonly ChapterPhysicalEquiv: "0x63c3";
|
||||
readonly ChapterTrack: "0x8f";
|
||||
readonly ChapterTrackUID: "0x89";
|
||||
readonly ChapterDisplay: "0x80";
|
||||
readonly ChapString: "0x85";
|
||||
readonly ChapLanguage: "0x437c";
|
||||
readonly ChapLanguageBCP47: "0x437d";
|
||||
readonly ChapCountry: "0x437e";
|
||||
readonly ChapProcess: "0x6944";
|
||||
readonly ChapProcessCodecID: "0x6955";
|
||||
readonly ChapProcessPrivate: "0x450d";
|
||||
readonly ChapProcessCommand: "0x6911";
|
||||
readonly ChapProcessTime: "0x6922";
|
||||
readonly ChapProcessData: "0x6933";
|
||||
readonly Tags: "0x1254c367";
|
||||
readonly Tag: "0x7373";
|
||||
readonly Targets: "0x63c0";
|
||||
readonly TargetTypeValue: "0x68ca";
|
||||
readonly TargetType: "0x63ca";
|
||||
readonly TagTrackUID: "0x63c5";
|
||||
readonly TagEditionUID: "0x63c9";
|
||||
readonly TagChapterUID: "0x63c4";
|
||||
readonly TagAttachmentUID: "0x63c6";
|
||||
readonly SimpleTag: "0x67c8";
|
||||
readonly TagName: "0x45a3";
|
||||
readonly TagLanguage: "0x447a";
|
||||
readonly TagLanguageBCP47: "0x447b";
|
||||
readonly TagDefault: "0x4484";
|
||||
readonly TagDefaultBogus: "0x44b4";
|
||||
readonly TagString: "0x4487";
|
||||
readonly TagBinary: "0x4485";
|
||||
readonly Void: "0xec";
|
||||
readonly Crc32: "0xbf";
|
||||
};
|
||||
export declare const knownIdsWithOneLength: string[];
|
||||
export declare const knownIdsWithTwoLength: string[];
|
||||
export declare const knownIdsWithThreeLength: string[];
|
||||
export declare const getSegmentName: (id: string) => string | undefined;
|
||||
export type MatroskaKey = keyof typeof matroskaElements;
|
||||
export type MatroskaElement = (typeof matroskaElements)[MatroskaKey];
|
||||
type EbmlType = 'string';
|
||||
export type EbmlWithChildren = {
|
||||
name: MatroskaKey;
|
||||
type: 'children';
|
||||
};
|
||||
export type EbmlWithUint = {
|
||||
name: MatroskaKey;
|
||||
type: 'uint';
|
||||
};
|
||||
export type EbmlWithHexString = {
|
||||
name: MatroskaKey;
|
||||
type: 'hex-string';
|
||||
};
|
||||
export type EbmlWithString = {
|
||||
name: MatroskaKey;
|
||||
type: EbmlType;
|
||||
};
|
||||
export type EbmlWithFloat = {
|
||||
name: MatroskaKey;
|
||||
type: 'float';
|
||||
};
|
||||
export type EbmlWithUint8Array = {
|
||||
name: MatroskaKey;
|
||||
type: 'uint8array';
|
||||
};
|
||||
export type Ebml = EbmlWithString | EbmlWithUint | EbmlWithChildren | EbmlWithFloat | EbmlWithHexString | EbmlWithUint8Array;
|
||||
export declare const ebmlVersion: {
|
||||
name: "EBMLVersion";
|
||||
type: "uint";
|
||||
};
|
||||
export declare const ebmlReadVersion: {
|
||||
name: "EBMLReadVersion";
|
||||
type: "uint";
|
||||
};
|
||||
export declare const ebmlMaxIdLength: {
|
||||
readonly name: "EBMLMaxIDLength";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const ebmlMaxSizeLength: {
|
||||
name: "EBMLMaxSizeLength";
|
||||
type: "uint";
|
||||
};
|
||||
export declare const docType: {
|
||||
name: "DocType";
|
||||
type: "string";
|
||||
};
|
||||
export declare const docTypeVersion: {
|
||||
name: "DocTypeVersion";
|
||||
type: "uint";
|
||||
};
|
||||
export declare const docTypeReadVersion: {
|
||||
name: "DocTypeReadVersion";
|
||||
type: "uint";
|
||||
};
|
||||
export type EmblTypes = {
|
||||
uint: number;
|
||||
float: number;
|
||||
string: string;
|
||||
children: Ebml[];
|
||||
void: undefined;
|
||||
'hex-string': string;
|
||||
uint8array: Uint8Array;
|
||||
};
|
||||
export declare const matroskaHeader: {
|
||||
readonly name: "Header";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const seekId: {
|
||||
readonly name: "SeekID";
|
||||
readonly type: "hex-string";
|
||||
};
|
||||
export declare const _name: {
|
||||
readonly name: "Name";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const minCache: {
|
||||
readonly name: "MinCache";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const maxCache: {
|
||||
readonly name: "MaxCache";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const seekPosition: {
|
||||
readonly name: "SeekPosition";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const seek: {
|
||||
readonly name: "Seek";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const seekHead: {
|
||||
readonly name: "SeekHead";
|
||||
readonly type: "children";
|
||||
};
|
||||
export type SeekHeadSegment = EbmlParsed<typeof seekHead>;
|
||||
export declare const voidHeader: {
|
||||
readonly name: "Void";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
export declare const codecID: {
|
||||
readonly name: "CodecID";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const trackType: {
|
||||
readonly name: "TrackType";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const widthType: {
|
||||
readonly name: "PixelWidth";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const heightType: {
|
||||
readonly name: "PixelHeight";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const muxingApp: {
|
||||
readonly name: "MuxingApp";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const duration: {
|
||||
readonly name: "Duration";
|
||||
readonly type: "float";
|
||||
};
|
||||
export declare const timestampScale: {
|
||||
readonly name: "TimestampScale";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const writingApp: {
|
||||
readonly name: "WritingApp";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const infoType: {
|
||||
readonly name: "Info";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const titleType: {
|
||||
readonly name: "Title";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const tagTrackUidType: {
|
||||
readonly name: "TagTrackUID";
|
||||
readonly type: "hex-string";
|
||||
};
|
||||
export declare const samplingFrequency: {
|
||||
readonly name: "SamplingFrequency";
|
||||
readonly type: "float";
|
||||
};
|
||||
export declare const channels: {
|
||||
readonly name: "Channels";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const alphaMode: {
|
||||
readonly name: "AlphaMode";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const interlaced: {
|
||||
readonly name: "FlagInterlaced";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const bitDepth: {
|
||||
readonly name: "BitDepth";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const displayWidth: {
|
||||
readonly name: "DisplayWidth";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const displayHeight: {
|
||||
readonly name: "DisplayHeight";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const displayUnit: {
|
||||
readonly name: "DisplayUnit";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const flagLacing: {
|
||||
readonly name: "FlagLacing";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const tagSegment: {
|
||||
readonly name: "Tag";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const tags: {
|
||||
readonly name: "Tags";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const trackNumber: {
|
||||
readonly name: "TrackNumber";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const trackUID: {
|
||||
readonly name: "TrackUID";
|
||||
readonly type: "hex-string";
|
||||
};
|
||||
export declare const color: {
|
||||
readonly name: "Colour";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const transferCharacteristics: {
|
||||
readonly name: "TransferCharacteristics";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const matrixCoefficients: {
|
||||
readonly name: "MatrixCoefficients";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const primaries: {
|
||||
readonly name: "Primaries";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const range: {
|
||||
readonly name: "Range";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const ChromaSitingHorz: {
|
||||
readonly name: "ChromaSitingHorz";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const ChromaSitingVert: {
|
||||
readonly name: "ChromaSitingVert";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const language: {
|
||||
readonly name: "Language";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const defaultDuration: {
|
||||
readonly name: "DefaultDuration";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const codecPrivate: {
|
||||
readonly name: "CodecPrivate";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
export declare const blockAdditionsSegment: {
|
||||
readonly name: "BlockAdditions";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
export declare const maxBlockAdditionIdSegment: {
|
||||
readonly name: "MaxBlockAdditionID";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const audioSegment: {
|
||||
readonly name: "Audio";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const videoSegment: {
|
||||
readonly name: "Video";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const flagDefault: {
|
||||
readonly name: "FlagDefault";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const referenceBlock: {
|
||||
readonly name: "ReferenceBlock";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const blockDurationSegment: {
|
||||
readonly name: "BlockDuration";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const blockElement: {
|
||||
readonly name: "Block";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
export declare const codecName: {
|
||||
readonly name: "CodecName";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const trackTimestampScale: {
|
||||
readonly name: "TrackTimestampScale";
|
||||
readonly type: "float";
|
||||
};
|
||||
export declare const trackEntry: {
|
||||
readonly name: "TrackEntry";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const tracks: {
|
||||
readonly name: "Tracks";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const timestampEntry: {
|
||||
readonly name: "Timestamp";
|
||||
readonly type: "uint";
|
||||
};
|
||||
export declare const block: {
|
||||
readonly name: "Block";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
export declare const simpleBlock: {
|
||||
readonly name: "SimpleBlock";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
export declare const blockGroup: {
|
||||
readonly name: "BlockGroup";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const segment: {
|
||||
readonly name: "Segment";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const cluster: {
|
||||
readonly name: "Cluster";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const targetsType: {
|
||||
readonly name: "Targets";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const simpleTagType: {
|
||||
readonly name: "SimpleTag";
|
||||
readonly type: "children";
|
||||
};
|
||||
export declare const tagNameType: {
|
||||
readonly name: "TagName";
|
||||
readonly type: "string";
|
||||
};
|
||||
export declare const tagStringType: {
|
||||
readonly name: "TagString";
|
||||
readonly type: "string";
|
||||
};
|
||||
export type CodecIdSegment = EbmlParsed<typeof codecID>;
|
||||
export type ColourSegment = EbmlParsed<typeof color>;
|
||||
export type TransferCharacteristicsSegment = EbmlParsed<typeof transferCharacteristics>;
|
||||
export type PrimariesSegment = EbmlParsed<typeof primaries>;
|
||||
export type RangeSegment = EbmlParsed<typeof range>;
|
||||
export type MatrixCoefficientsSegment = EbmlParsed<typeof matrixCoefficients>;
|
||||
export type TrackTypeSegment = EbmlParsed<typeof trackType>;
|
||||
export type WidthSegment = EbmlParsed<typeof widthType>;
|
||||
export type HeightSegment = EbmlParsed<typeof heightType>;
|
||||
export type TimestampScaleSegment = EbmlParsed<typeof timestampScale>;
|
||||
export type DurationSegment = EbmlParsed<typeof duration>;
|
||||
export type DisplayWidthSegment = EbmlParsed<typeof displayWidth>;
|
||||
export type DisplayHeightSegment = EbmlParsed<typeof displayHeight>;
|
||||
export type TrackNumberSegment = EbmlParsed<typeof trackNumber>;
|
||||
export type AudioSegment = EbmlParsed<typeof audioSegment>;
|
||||
export type VideoSegment = EbmlParsed<typeof videoSegment>;
|
||||
export type TrackEntry = EbmlParsed<typeof trackEntry>;
|
||||
export type BlockSegment = EbmlParsed<typeof block>;
|
||||
export type SimpleBlockSegment = EbmlParsed<typeof simpleBlock>;
|
||||
export type MainSegment = EbmlParsed<typeof segment>;
|
||||
export type ClusterSegment = EbmlParsed<typeof cluster>;
|
||||
export type Tracks = EbmlParsed<typeof tracks>;
|
||||
export type FloatWithSize = {
|
||||
value: number;
|
||||
size: '32' | '64';
|
||||
};
|
||||
export type UintWithSize = {
|
||||
value: number;
|
||||
byteLength: number | null;
|
||||
};
|
||||
export type EbmlValue<T extends Ebml, Child = PossibleEbml> = T extends EbmlWithUint ? UintWithSize : T extends EbmlWithString ? string : T extends EbmlWithFloat ? FloatWithSize : T extends EbmlWithHexString ? string : T extends EbmlWithUint8Array ? Uint8Array : T extends EbmlWithChildren ? Child[] : never;
|
||||
export type EbmlParsed<T extends Ebml> = {
|
||||
type: T['name'];
|
||||
value: EbmlValue<T>;
|
||||
minVintWidth: number | null;
|
||||
};
|
||||
export declare const ebmlMap: {
|
||||
readonly "0x1a45dfa3": {
|
||||
readonly name: "Header";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x4282": {
|
||||
name: "DocType";
|
||||
type: "string";
|
||||
};
|
||||
readonly "0x63c0": {
|
||||
readonly name: "Targets";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x67c8": {
|
||||
readonly name: "SimpleTag";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x45a3": {
|
||||
readonly name: "TagName";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x4487": {
|
||||
readonly name: "TagString";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x4287": {
|
||||
name: "DocTypeVersion";
|
||||
type: "uint";
|
||||
};
|
||||
readonly "0x4285": {
|
||||
name: "DocTypeReadVersion";
|
||||
type: "uint";
|
||||
};
|
||||
readonly "0x4286": {
|
||||
name: "EBMLVersion";
|
||||
type: "uint";
|
||||
};
|
||||
readonly "0x42f7": {
|
||||
name: "EBMLReadVersion";
|
||||
type: "uint";
|
||||
};
|
||||
readonly "0x42f2": {
|
||||
readonly name: "EBMLMaxIDLength";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x42f3": {
|
||||
name: "EBMLMaxSizeLength";
|
||||
type: "uint";
|
||||
};
|
||||
readonly "0xec": {
|
||||
name: "Void";
|
||||
type: "uint8array";
|
||||
};
|
||||
readonly "0x1c53bb6b": {
|
||||
readonly name: "Cues";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xbb": {
|
||||
readonly name: "CuePoint";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xb3": {
|
||||
readonly name: "CueTime";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xb7": {
|
||||
readonly name: "CueTrackPositions";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xf1": {
|
||||
readonly name: "CueClusterPosition";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xf0": {
|
||||
readonly name: "CueRelativePosition";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x5378": {
|
||||
readonly name: "CueBlockNumber";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xf7": {
|
||||
readonly name: "CueTrack";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x4461": {
|
||||
readonly name: "DateUTC";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x23314f": {
|
||||
readonly name: "TrackTimestampScale";
|
||||
readonly type: "float";
|
||||
};
|
||||
readonly "0x56aa": {
|
||||
readonly name: "CodecDelay";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x56bb": {
|
||||
readonly name: "SeekPreRoll";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x75a2": {
|
||||
readonly name: "DiscardPadding";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x78b5": {
|
||||
readonly name: "OutputSamplingFrequency";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x258688": {
|
||||
readonly name: "CodecName";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0xa7": {
|
||||
readonly name: "Position";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0xcf": {
|
||||
readonly name: "SliceDuration";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x63c5": {
|
||||
readonly name: "TagTrackUID";
|
||||
readonly type: "hex-string";
|
||||
};
|
||||
readonly "0x114d9b74": {
|
||||
readonly name: "SeekHead";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x4dbb": {
|
||||
readonly name: "Seek";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x53ab": {
|
||||
readonly name: "SeekID";
|
||||
readonly type: "hex-string";
|
||||
};
|
||||
readonly "0x536e": {
|
||||
readonly name: "Name";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x6de7": {
|
||||
readonly name: "MinCache";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x6df8": {
|
||||
readonly name: "MaxCache";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x53ac": {
|
||||
readonly name: "SeekPosition";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xbf": {
|
||||
readonly name: "Crc32";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x4d80": {
|
||||
readonly name: "MuxingApp";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x5741": {
|
||||
readonly name: "WritingApp";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x73a4": {
|
||||
readonly name: "SegmentUUID";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x4489": {
|
||||
readonly name: "Duration";
|
||||
readonly type: "float";
|
||||
};
|
||||
readonly "0x86": {
|
||||
readonly name: "CodecID";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x83": {
|
||||
readonly name: "TrackType";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xb0": {
|
||||
readonly name: "PixelWidth";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xba": {
|
||||
readonly name: "PixelHeight";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x2ad7b1": {
|
||||
readonly name: "TimestampScale";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x1549a966": {
|
||||
readonly name: "Info";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x7ba9": {
|
||||
readonly name: "Title";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0xb5": {
|
||||
readonly name: "SamplingFrequency";
|
||||
readonly type: "float";
|
||||
};
|
||||
readonly "0x9f": {
|
||||
readonly name: "Channels";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x53c0": {
|
||||
readonly name: "AlphaMode";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x9a": {
|
||||
readonly name: "FlagInterlaced";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x6264": {
|
||||
readonly name: "BitDepth";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x54ba": {
|
||||
readonly name: "DisplayHeight";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x54b0": {
|
||||
readonly name: "DisplayWidth";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x54b2": {
|
||||
readonly name: "DisplayUnit";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x9c": {
|
||||
readonly name: "FlagLacing";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x1254c367": {
|
||||
readonly name: "Tags";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x7373": {
|
||||
readonly name: "Tag";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xd7": {
|
||||
readonly name: "TrackNumber";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x73c5": {
|
||||
readonly name: "TrackUID";
|
||||
readonly type: "hex-string";
|
||||
};
|
||||
readonly "0x55b0": {
|
||||
readonly name: "Colour";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x22b59c": {
|
||||
readonly name: "Language";
|
||||
readonly type: "string";
|
||||
};
|
||||
readonly "0x23e383": {
|
||||
readonly name: "DefaultDuration";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x63a2": {
|
||||
readonly name: "CodecPrivate";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x9b": {
|
||||
readonly name: "BlockDuration";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x75a1": {
|
||||
readonly name: "BlockAdditions";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0x55ee": {
|
||||
readonly name: "MaxBlockAdditionID";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xe1": {
|
||||
readonly name: "Audio";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xe0": {
|
||||
readonly name: "Video";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x88": {
|
||||
readonly name: "FlagDefault";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xfb": {
|
||||
readonly name: "ReferenceBlock";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0xae": {
|
||||
readonly name: "TrackEntry";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xe7": {
|
||||
readonly name: "Timestamp";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x1654ae6b": {
|
||||
readonly name: "Tracks";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0xa1": {
|
||||
readonly name: "Block";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0xa3": {
|
||||
readonly name: "SimpleBlock";
|
||||
readonly type: "uint8array";
|
||||
};
|
||||
readonly "0xa0": {
|
||||
readonly name: "BlockGroup";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x18538067": {
|
||||
readonly name: "Segment";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x1f43b675": {
|
||||
readonly name: "Cluster";
|
||||
readonly type: "children";
|
||||
};
|
||||
readonly "0x55ba": {
|
||||
readonly name: "TransferCharacteristics";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x55b1": {
|
||||
readonly name: "MatrixCoefficients";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x55bb": {
|
||||
readonly name: "Primaries";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x55b9": {
|
||||
readonly name: "Range";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x55b7": {
|
||||
readonly name: "ChromaSitingHorz";
|
||||
readonly type: "uint";
|
||||
};
|
||||
readonly "0x55b8": {
|
||||
readonly name: "ChromaSitingVert";
|
||||
readonly type: "uint";
|
||||
};
|
||||
};
|
||||
export type PossibleEbml = Prettify<{
|
||||
[key in keyof typeof ebmlMap]: EbmlParsed<(typeof ebmlMap)[key]>;
|
||||
}[keyof typeof ebmlMap]>;
|
||||
export {};
|
||||
732
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/all-segments.js
generated
vendored
Normal file
732
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/all-segments.js
generated
vendored
Normal file
@@ -0,0 +1,732 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.range = exports.primaries = exports.matrixCoefficients = exports.transferCharacteristics = exports.color = exports.trackUID = exports.trackNumber = exports.tags = exports.tagSegment = exports.flagLacing = exports.displayUnit = exports.displayHeight = exports.displayWidth = exports.bitDepth = exports.interlaced = exports.alphaMode = exports.channels = exports.samplingFrequency = exports.tagTrackUidType = exports.titleType = exports.infoType = exports.writingApp = exports.timestampScale = exports.duration = exports.muxingApp = exports.heightType = exports.widthType = exports.trackType = exports.codecID = exports.voidHeader = exports.seekHead = exports.seek = exports.seekPosition = exports.maxCache = exports.minCache = exports._name = exports.seekId = exports.matroskaHeader = exports.docTypeReadVersion = exports.docTypeVersion = exports.docType = exports.ebmlMaxSizeLength = exports.ebmlMaxIdLength = exports.ebmlReadVersion = exports.ebmlVersion = exports.getSegmentName = exports.knownIdsWithThreeLength = exports.knownIdsWithTwoLength = exports.knownIdsWithOneLength = exports.matroskaElements = void 0;
|
||||
exports.ebmlMap = exports.tagStringType = exports.tagNameType = exports.simpleTagType = exports.targetsType = exports.cluster = exports.segment = exports.blockGroup = exports.simpleBlock = exports.block = exports.timestampEntry = exports.tracks = exports.trackEntry = exports.trackTimestampScale = exports.codecName = exports.blockElement = exports.blockDurationSegment = exports.referenceBlock = exports.flagDefault = exports.videoSegment = exports.audioSegment = exports.maxBlockAdditionIdSegment = exports.blockAdditionsSegment = exports.codecPrivate = exports.defaultDuration = exports.language = exports.ChromaSitingVert = exports.ChromaSitingHorz = void 0;
|
||||
exports.matroskaElements = {
|
||||
Header: '0x1a45dfa3',
|
||||
EBMLMaxIDLength: '0x42f2',
|
||||
EBMLVersion: '0x4286',
|
||||
EBMLReadVersion: '0x42f7',
|
||||
EBMLMaxSizeLength: '0x42f3',
|
||||
DocType: '0x4282',
|
||||
DocTypeVersion: '0x4287',
|
||||
DocTypeReadVersion: '0x4285',
|
||||
Segment: '0x18538067',
|
||||
SeekHead: '0x114d9b74',
|
||||
Seek: '0x4dbb',
|
||||
SeekID: '0x53ab',
|
||||
SeekPosition: '0x53ac',
|
||||
Info: '0x1549a966',
|
||||
SegmentUUID: '0x73a4',
|
||||
SegmentFilename: '0x7384',
|
||||
PrevUUID: '0x3cb923',
|
||||
PrevFilename: '0x3c83ab',
|
||||
NextUUID: '0x3eb923',
|
||||
NextFilename: '0x3e83bb',
|
||||
SegmentFamily: '0x4444',
|
||||
ChapterTranslate: '0x6924',
|
||||
ChapterTranslateID: '0x69a5',
|
||||
ChapterTranslateCodec: '0x69bf',
|
||||
ChapterTranslateEditionUID: '0x69fc',
|
||||
TimestampScale: '0x2ad7b1',
|
||||
Duration: '0x4489',
|
||||
DateUTC: '0x4461',
|
||||
Title: '0x7ba9',
|
||||
MuxingApp: '0x4d80',
|
||||
WritingApp: '0x5741',
|
||||
Cluster: '0x1f43b675',
|
||||
Timestamp: '0xe7',
|
||||
SilentTracks: '0x5854',
|
||||
SilentTrackNumber: '0x58d7',
|
||||
Position: '0xa7',
|
||||
PrevSize: '0xab',
|
||||
SimpleBlock: '0xa3',
|
||||
BlockGroup: '0xa0',
|
||||
Block: '0xa1',
|
||||
BlockVirtual: '0xa2',
|
||||
BlockAdditions: '0x75a1',
|
||||
BlockMore: '0xa6',
|
||||
BlockAdditional: '0xa5',
|
||||
BlockAddID: '0xee',
|
||||
BlockDuration: '0x9b',
|
||||
ReferencePriority: '0xfa',
|
||||
ReferenceBlock: '0xfb',
|
||||
ReferenceVirtual: '0xfd',
|
||||
CodecState: '0xa4',
|
||||
DiscardPadding: '0x75a2',
|
||||
Slices: '0x8e',
|
||||
TimeSlice: '0xe8',
|
||||
LaceNumber: '0xcc',
|
||||
FrameNumber: '0xcd',
|
||||
BlockAdditionID: '0xcb',
|
||||
Delay: '0xce',
|
||||
SliceDuration: '0xcf',
|
||||
ReferenceFrame: '0xc8',
|
||||
ReferenceOffset: '0xc9',
|
||||
ReferenceTimestamp: '0xca',
|
||||
EncryptedBlock: '0xaf',
|
||||
Tracks: '0x1654ae6b',
|
||||
TrackEntry: '0xae',
|
||||
TrackNumber: '0xd7',
|
||||
TrackUID: '0x73c5',
|
||||
TrackType: '0x83',
|
||||
FlagEnabled: '0xb9',
|
||||
FlagDefault: '0x88',
|
||||
FlagForced: '0x55aa',
|
||||
FlagHearingImpaired: '0x55ab',
|
||||
FlagVisualImpaired: '0x55ac',
|
||||
FlagTextDescriptions: '0x55ad',
|
||||
FlagOriginal: '0x55ae',
|
||||
FlagCommentary: '0x55af',
|
||||
FlagLacing: '0x9c',
|
||||
MinCache: '0x6de7',
|
||||
MaxCache: '0x6df8',
|
||||
DefaultDuration: '0x23e383',
|
||||
DefaultDecodedFieldDuration: '0x234e7a',
|
||||
TrackTimestampScale: '0x23314f',
|
||||
TrackOffset: '0x537f',
|
||||
MaxBlockAdditionID: '0x55ee',
|
||||
BlockAdditionMapping: '0x41e4',
|
||||
BlockAddIDValue: '0x41f0',
|
||||
BlockAddIDName: '0x41a4',
|
||||
BlockAddIDType: '0x41e7',
|
||||
BlockAddIDExtraData: '0x41ed',
|
||||
Name: '0x536e',
|
||||
Language: '0x22b59c',
|
||||
LanguageBCP47: '0x22b59d',
|
||||
CodecID: '0x86',
|
||||
CodecPrivate: '0x63a2',
|
||||
CodecName: '0x258688',
|
||||
AttachmentLink: '0x7446',
|
||||
CodecSettings: '0x3a9697',
|
||||
CodecInfoURL: '0x3b4040',
|
||||
CodecDownloadURL: '0x26b240',
|
||||
CodecDecodeAll: '0xaa',
|
||||
TrackOverlay: '0x6fab',
|
||||
CodecDelay: '0x56aa',
|
||||
SeekPreRoll: '0x56bb',
|
||||
TrackTranslate: '0x6624',
|
||||
TrackTranslateTrackID: '0x66a5',
|
||||
TrackTranslateCodec: '0x66bf',
|
||||
TrackTranslateEditionUID: '0x66fc',
|
||||
Video: '0xe0',
|
||||
FlagInterlaced: '0x9a',
|
||||
FieldOrder: '0x9d',
|
||||
StereoMode: '0x53b8',
|
||||
AlphaMode: '0x53c0',
|
||||
OldStereoMode: '0x53b9',
|
||||
PixelWidth: '0xb0',
|
||||
PixelHeight: '0xba',
|
||||
PixelCropBottom: '0x54aa',
|
||||
PixelCropTop: '0x54bb',
|
||||
PixelCropLeft: '0x54cc',
|
||||
PixelCropRight: '0x54dd',
|
||||
DisplayWidth: '0x54b0',
|
||||
DisplayHeight: '0x54ba',
|
||||
DisplayUnit: '0x54b2',
|
||||
AspectRatioType: '0x54b3',
|
||||
UncompressedFourCC: '0x2eb524',
|
||||
GammaValue: '0x2fb523',
|
||||
FrameRate: '0x2383e3',
|
||||
Colour: '0x55b0',
|
||||
MatrixCoefficients: '0x55b1',
|
||||
BitsPerChannel: '0x55b2',
|
||||
ChromaSubsamplingHorz: '0x55b3',
|
||||
ChromaSubsamplingVert: '0x55b4',
|
||||
CbSubsamplingHorz: '0x55b5',
|
||||
CbSubsamplingVert: '0x55b6',
|
||||
ChromaSitingHorz: '0x55b7',
|
||||
ChromaSitingVert: '0x55b8',
|
||||
Range: '0x55b9',
|
||||
TransferCharacteristics: '0x55ba',
|
||||
Primaries: '0x55bb',
|
||||
MaxCLL: '0x55bc',
|
||||
MaxFALL: '0x55bd',
|
||||
MasteringMetadata: '0x55d0',
|
||||
PrimaryRChromaticityX: '0x55d1',
|
||||
PrimaryRChromaticityY: '0x55d2',
|
||||
PrimaryGChromaticityX: '0x55d3',
|
||||
PrimaryGChromaticityY: '0x55d4',
|
||||
PrimaryBChromaticityX: '0x55d5',
|
||||
PrimaryBChromaticityY: '0x55d6',
|
||||
WhitePointChromaticityX: '0x55d7',
|
||||
WhitePointChromaticityY: '0x55d8',
|
||||
LuminanceMax: '0x55d9',
|
||||
LuminanceMin: '0x55da',
|
||||
Projection: '0x7670',
|
||||
ProjectionType: '0x7671',
|
||||
ProjectionPrivate: '0x7672',
|
||||
ProjectionPoseYaw: '0x7673',
|
||||
ProjectionPosePitch: '0x7674',
|
||||
ProjectionPoseRoll: '0x7675',
|
||||
Audio: '0xe1',
|
||||
SamplingFrequency: '0xb5',
|
||||
OutputSamplingFrequency: '0x78b5',
|
||||
Channels: '0x9f',
|
||||
ChannelPositions: '0x7d7b',
|
||||
BitDepth: '0x6264',
|
||||
Emphasis: '0x52f1',
|
||||
TrackOperation: '0xe2',
|
||||
TrackCombinePlanes: '0xe3',
|
||||
TrackPlane: '0xe4',
|
||||
TrackPlaneUID: '0xe5',
|
||||
TrackPlaneType: '0xe6',
|
||||
TrackJoinBlocks: '0xe9',
|
||||
TrackJoinUID: '0xed',
|
||||
TrickTrackUID: '0xc0',
|
||||
TrickTrackSegmentUID: '0xc1',
|
||||
TrickTrackFlag: '0xc6',
|
||||
TrickMasterTrackUID: '0xc7',
|
||||
TrickMasterTrackSegmentUID: '0xc4',
|
||||
ContentEncodings: '0x6d80',
|
||||
ContentEncoding: '0x6240',
|
||||
ContentEncodingOrder: '0x5031',
|
||||
ContentEncodingScope: '0x5032',
|
||||
ContentEncodingType: '0x5033',
|
||||
ContentCompression: '0x5034',
|
||||
ContentCompAlgo: '0x4254',
|
||||
ContentCompSettings: '0x4255',
|
||||
ContentEncryption: '0x5035',
|
||||
ContentEncAlgo: '0x47e1',
|
||||
ContentEncKeyID: '0x47e2',
|
||||
ContentEncAESSettings: '0x47e7',
|
||||
AESSettingsCipherMode: '0x47e8',
|
||||
ContentSignature: '0x47e3',
|
||||
ContentSigKeyID: '0x47e4',
|
||||
ContentSigAlgo: '0x47e5',
|
||||
ContentSigHashAlgo: '0x47e6',
|
||||
Cues: '0x1c53bb6b',
|
||||
CuePoint: '0xbb',
|
||||
CueTime: '0xb3',
|
||||
CueTrackPositions: '0xb7',
|
||||
CueTrack: '0xf7',
|
||||
CueClusterPosition: '0xf1',
|
||||
CueRelativePosition: '0xf0',
|
||||
CueDuration: '0xb2',
|
||||
CueBlockNumber: '0x5378',
|
||||
CueCodecState: '0xea',
|
||||
CueReference: '0xdb',
|
||||
CueRefTime: '0x96',
|
||||
CueRefCluster: '0x97',
|
||||
CueRefNumber: '0x535f',
|
||||
CueRefCodecState: '0xeb',
|
||||
Attachments: '0x1941a469',
|
||||
AttachedFile: '0x61a7',
|
||||
FileDescription: '0x467e',
|
||||
FileName: '0x466e',
|
||||
FileMediaType: '0x4660',
|
||||
FileData: '0x465c',
|
||||
FileUID: '0x46ae',
|
||||
FileReferral: '0x4675',
|
||||
FileUsedStartTime: '0x4661',
|
||||
FileUsedEndTime: '0x4662',
|
||||
Chapters: '0x1043a770',
|
||||
EditionEntry: '0x45b9',
|
||||
EditionUID: '0x45bc',
|
||||
EditionFlagHidden: '0x45bd',
|
||||
EditionFlagDefault: '0x45db',
|
||||
EditionFlagOrdered: '0x45dd',
|
||||
EditionDisplay: '0x4520',
|
||||
EditionString: '0x4521',
|
||||
EditionLanguageIETF: '0x45e4',
|
||||
ChapterAtom: '0xb6',
|
||||
ChapterUID: '0x73c4',
|
||||
ChapterStringUID: '0x5654',
|
||||
ChapterTimeStart: '0x91',
|
||||
ChapterTimeEnd: '0x92',
|
||||
ChapterFlagHidden: '0x98',
|
||||
ChapterFlagEnabled: '0x4598',
|
||||
ChapterSegmentUUID: '0x6e67',
|
||||
ChapterSkipType: '0x4588',
|
||||
ChapterSegmentEditionUID: '0x6ebc',
|
||||
ChapterPhysicalEquiv: '0x63c3',
|
||||
ChapterTrack: '0x8f',
|
||||
ChapterTrackUID: '0x89',
|
||||
ChapterDisplay: '0x80',
|
||||
ChapString: '0x85',
|
||||
ChapLanguage: '0x437c',
|
||||
ChapLanguageBCP47: '0x437d',
|
||||
ChapCountry: '0x437e',
|
||||
ChapProcess: '0x6944',
|
||||
ChapProcessCodecID: '0x6955',
|
||||
ChapProcessPrivate: '0x450d',
|
||||
ChapProcessCommand: '0x6911',
|
||||
ChapProcessTime: '0x6922',
|
||||
ChapProcessData: '0x6933',
|
||||
Tags: '0x1254c367',
|
||||
Tag: '0x7373',
|
||||
Targets: '0x63c0',
|
||||
TargetTypeValue: '0x68ca',
|
||||
TargetType: '0x63ca',
|
||||
TagTrackUID: '0x63c5',
|
||||
TagEditionUID: '0x63c9',
|
||||
TagChapterUID: '0x63c4',
|
||||
TagAttachmentUID: '0x63c6',
|
||||
SimpleTag: '0x67c8',
|
||||
TagName: '0x45a3',
|
||||
TagLanguage: '0x447a',
|
||||
TagLanguageBCP47: '0x447b',
|
||||
TagDefault: '0x4484',
|
||||
TagDefaultBogus: '0x44b4',
|
||||
TagString: '0x4487',
|
||||
TagBinary: '0x4485',
|
||||
Void: '0xec',
|
||||
Crc32: '0xbf',
|
||||
};
|
||||
const matroskaIds = Object.values(exports.matroskaElements);
|
||||
exports.knownIdsWithOneLength = matroskaIds.filter((id) => id.length === 4);
|
||||
exports.knownIdsWithTwoLength = matroskaIds.filter((id) => id.length === 6);
|
||||
exports.knownIdsWithThreeLength = matroskaIds.filter((id) => id.length === 8);
|
||||
const getSegmentName = (id) => {
|
||||
var _a;
|
||||
return (_a = Object.entries(exports.matroskaElements).find(([, value]) => value === id)) === null || _a === void 0 ? void 0 : _a[0];
|
||||
};
|
||||
exports.getSegmentName = getSegmentName;
|
||||
exports.ebmlVersion = {
|
||||
name: 'EBMLVersion',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.ebmlReadVersion = {
|
||||
name: 'EBMLReadVersion',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.ebmlMaxIdLength = {
|
||||
name: 'EBMLMaxIDLength',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.ebmlMaxSizeLength = {
|
||||
name: 'EBMLMaxSizeLength',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.docType = {
|
||||
name: 'DocType',
|
||||
type: 'string',
|
||||
};
|
||||
exports.docTypeVersion = {
|
||||
name: 'DocTypeVersion',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.docTypeReadVersion = {
|
||||
name: 'DocTypeReadVersion',
|
||||
type: 'uint',
|
||||
};
|
||||
const voidEbml = {
|
||||
name: 'Void',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.matroskaHeader = {
|
||||
name: 'Header',
|
||||
type: 'children',
|
||||
};
|
||||
exports.seekId = {
|
||||
name: 'SeekID',
|
||||
type: 'hex-string',
|
||||
};
|
||||
exports._name = {
|
||||
name: 'Name',
|
||||
type: 'string',
|
||||
};
|
||||
exports.minCache = {
|
||||
name: 'MinCache',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.maxCache = {
|
||||
name: 'MaxCache',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.seekPosition = {
|
||||
name: 'SeekPosition',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.seek = {
|
||||
name: 'Seek',
|
||||
type: 'children',
|
||||
};
|
||||
exports.seekHead = {
|
||||
name: 'SeekHead',
|
||||
type: 'children',
|
||||
};
|
||||
exports.voidHeader = {
|
||||
name: 'Void',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.codecID = {
|
||||
name: 'CodecID',
|
||||
type: 'string',
|
||||
};
|
||||
exports.trackType = {
|
||||
name: 'TrackType',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.widthType = {
|
||||
name: 'PixelWidth',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.heightType = {
|
||||
name: 'PixelHeight',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.muxingApp = {
|
||||
name: 'MuxingApp',
|
||||
type: 'string',
|
||||
};
|
||||
exports.duration = {
|
||||
name: 'Duration',
|
||||
type: 'float',
|
||||
};
|
||||
exports.timestampScale = {
|
||||
name: 'TimestampScale',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.writingApp = {
|
||||
name: 'WritingApp',
|
||||
type: 'string',
|
||||
};
|
||||
exports.infoType = {
|
||||
name: 'Info',
|
||||
type: 'children',
|
||||
};
|
||||
exports.titleType = {
|
||||
name: 'Title',
|
||||
type: 'string',
|
||||
};
|
||||
exports.tagTrackUidType = {
|
||||
name: 'TagTrackUID',
|
||||
type: 'hex-string',
|
||||
};
|
||||
exports.samplingFrequency = {
|
||||
name: 'SamplingFrequency',
|
||||
type: 'float',
|
||||
};
|
||||
exports.channels = {
|
||||
name: 'Channels',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.alphaMode = {
|
||||
name: 'AlphaMode',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.interlaced = {
|
||||
name: 'FlagInterlaced',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.bitDepth = {
|
||||
name: 'BitDepth',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.displayWidth = {
|
||||
name: 'DisplayWidth',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.displayHeight = {
|
||||
name: 'DisplayHeight',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.displayUnit = {
|
||||
name: 'DisplayUnit',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.flagLacing = {
|
||||
name: 'FlagLacing',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.tagSegment = {
|
||||
name: 'Tag',
|
||||
type: 'children',
|
||||
};
|
||||
exports.tags = {
|
||||
name: 'Tags',
|
||||
type: 'children',
|
||||
};
|
||||
exports.trackNumber = {
|
||||
name: 'TrackNumber',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.trackUID = {
|
||||
name: 'TrackUID',
|
||||
type: 'hex-string',
|
||||
};
|
||||
exports.color = {
|
||||
name: 'Colour',
|
||||
type: 'children',
|
||||
};
|
||||
exports.transferCharacteristics = {
|
||||
name: 'TransferCharacteristics',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.matrixCoefficients = {
|
||||
name: 'MatrixCoefficients',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.primaries = {
|
||||
name: 'Primaries',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.range = {
|
||||
name: 'Range',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.ChromaSitingHorz = {
|
||||
name: 'ChromaSitingHorz',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.ChromaSitingVert = {
|
||||
name: 'ChromaSitingVert',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.language = {
|
||||
name: 'Language',
|
||||
type: 'string',
|
||||
};
|
||||
exports.defaultDuration = {
|
||||
name: 'DefaultDuration',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.codecPrivate = {
|
||||
name: 'CodecPrivate',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.blockAdditionsSegment = {
|
||||
name: 'BlockAdditions',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.maxBlockAdditionIdSegment = {
|
||||
name: 'MaxBlockAdditionID',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.audioSegment = {
|
||||
name: 'Audio',
|
||||
type: 'children',
|
||||
};
|
||||
exports.videoSegment = {
|
||||
name: 'Video',
|
||||
type: 'children',
|
||||
};
|
||||
exports.flagDefault = {
|
||||
name: 'FlagDefault',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.referenceBlock = {
|
||||
name: 'ReferenceBlock',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.blockDurationSegment = {
|
||||
name: 'BlockDuration',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.blockElement = {
|
||||
name: 'Block',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.codecName = {
|
||||
name: 'CodecName',
|
||||
type: 'string',
|
||||
};
|
||||
exports.trackTimestampScale = {
|
||||
name: 'TrackTimestampScale',
|
||||
type: 'float',
|
||||
};
|
||||
exports.trackEntry = {
|
||||
name: 'TrackEntry',
|
||||
type: 'children',
|
||||
};
|
||||
exports.tracks = {
|
||||
name: 'Tracks',
|
||||
type: 'children',
|
||||
};
|
||||
exports.timestampEntry = {
|
||||
name: 'Timestamp',
|
||||
type: 'uint',
|
||||
};
|
||||
exports.block = {
|
||||
name: 'Block',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.simpleBlock = {
|
||||
name: 'SimpleBlock',
|
||||
type: 'uint8array',
|
||||
};
|
||||
exports.blockGroup = {
|
||||
name: 'BlockGroup',
|
||||
type: 'children',
|
||||
};
|
||||
exports.segment = {
|
||||
name: 'Segment',
|
||||
type: 'children',
|
||||
};
|
||||
exports.cluster = {
|
||||
name: 'Cluster',
|
||||
type: 'children',
|
||||
};
|
||||
exports.targetsType = {
|
||||
name: 'Targets',
|
||||
type: 'children',
|
||||
};
|
||||
exports.simpleTagType = {
|
||||
name: 'SimpleTag',
|
||||
type: 'children',
|
||||
};
|
||||
exports.tagNameType = {
|
||||
name: 'TagName',
|
||||
type: 'string',
|
||||
};
|
||||
exports.tagStringType = {
|
||||
name: 'TagString',
|
||||
type: 'string',
|
||||
};
|
||||
exports.ebmlMap = {
|
||||
[exports.matroskaElements.Header]: exports.matroskaHeader,
|
||||
[exports.matroskaElements.DocType]: exports.docType,
|
||||
[exports.matroskaElements.Targets]: exports.targetsType,
|
||||
[exports.matroskaElements.SimpleTag]: exports.simpleTagType,
|
||||
[exports.matroskaElements.TagName]: exports.tagNameType,
|
||||
[exports.matroskaElements.TagString]: exports.tagStringType,
|
||||
[exports.matroskaElements.DocTypeVersion]: exports.docTypeVersion,
|
||||
[exports.matroskaElements.DocTypeReadVersion]: exports.docTypeReadVersion,
|
||||
[exports.matroskaElements.EBMLVersion]: exports.ebmlVersion,
|
||||
[exports.matroskaElements.EBMLReadVersion]: exports.ebmlReadVersion,
|
||||
[exports.matroskaElements.EBMLMaxIDLength]: exports.ebmlMaxIdLength,
|
||||
[exports.matroskaElements.EBMLMaxSizeLength]: exports.ebmlMaxSizeLength,
|
||||
[exports.matroskaElements.Void]: voidEbml,
|
||||
[exports.matroskaElements.Cues]: {
|
||||
name: 'Cues',
|
||||
type: 'children',
|
||||
},
|
||||
[exports.matroskaElements.CuePoint]: {
|
||||
name: 'CuePoint',
|
||||
type: 'children',
|
||||
},
|
||||
[exports.matroskaElements.CueTime]: {
|
||||
name: 'CueTime',
|
||||
type: 'uint',
|
||||
},
|
||||
[exports.matroskaElements.CueTrackPositions]: {
|
||||
name: 'CueTrackPositions',
|
||||
type: 'children',
|
||||
},
|
||||
[exports.matroskaElements.CueClusterPosition]: {
|
||||
name: 'CueClusterPosition',
|
||||
type: 'uint',
|
||||
},
|
||||
[exports.matroskaElements.CueRelativePosition]: {
|
||||
name: 'CueRelativePosition',
|
||||
type: 'uint',
|
||||
},
|
||||
[exports.matroskaElements.CueBlockNumber]: {
|
||||
name: 'CueBlockNumber',
|
||||
type: 'uint',
|
||||
},
|
||||
[exports.matroskaElements.CueTrack]: {
|
||||
name: 'CueTrack',
|
||||
type: 'uint',
|
||||
},
|
||||
[exports.matroskaElements.DateUTC]: {
|
||||
name: 'DateUTC',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.TrackTimestampScale]: exports.trackTimestampScale,
|
||||
[exports.matroskaElements.CodecDelay]: {
|
||||
name: 'CodecDelay',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.SeekPreRoll]: {
|
||||
name: 'SeekPreRoll',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.DiscardPadding]: {
|
||||
name: 'DiscardPadding',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.OutputSamplingFrequency]: {
|
||||
name: 'OutputSamplingFrequency',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.CodecName]: exports.codecName,
|
||||
[exports.matroskaElements.Position]: {
|
||||
name: 'Position',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.SliceDuration]: {
|
||||
name: 'SliceDuration',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.TagTrackUID]: exports.tagTrackUidType,
|
||||
[exports.matroskaElements.SeekHead]: exports.seekHead,
|
||||
[exports.matroskaElements.Seek]: exports.seek,
|
||||
[exports.matroskaElements.SeekID]: exports.seekId,
|
||||
[exports.matroskaElements.Name]: exports._name,
|
||||
[exports.matroskaElements.MinCache]: exports.minCache,
|
||||
[exports.matroskaElements.MaxCache]: exports.maxCache,
|
||||
[exports.matroskaElements.SeekPosition]: exports.seekPosition,
|
||||
[exports.matroskaElements.Crc32]: {
|
||||
name: 'Crc32',
|
||||
type: 'uint8array',
|
||||
},
|
||||
[exports.matroskaElements.MuxingApp]: exports.muxingApp,
|
||||
[exports.matroskaElements.WritingApp]: {
|
||||
name: 'WritingApp',
|
||||
type: 'string',
|
||||
},
|
||||
[exports.matroskaElements.SegmentUUID]: {
|
||||
name: 'SegmentUUID',
|
||||
type: 'string',
|
||||
},
|
||||
[exports.matroskaElements.Duration]: exports.duration,
|
||||
[exports.matroskaElements.CodecID]: {
|
||||
name: 'CodecID',
|
||||
type: 'string',
|
||||
},
|
||||
[exports.matroskaElements.TrackType]: exports.trackType,
|
||||
[exports.matroskaElements.PixelWidth]: exports.widthType,
|
||||
[exports.matroskaElements.PixelHeight]: exports.heightType,
|
||||
[exports.matroskaElements.TimestampScale]: exports.timestampScale,
|
||||
[exports.matroskaElements.Info]: exports.infoType,
|
||||
[exports.matroskaElements.Title]: exports.titleType,
|
||||
[exports.matroskaElements.SamplingFrequency]: exports.samplingFrequency,
|
||||
[exports.matroskaElements.Channels]: exports.channels,
|
||||
[exports.matroskaElements.AlphaMode]: exports.alphaMode,
|
||||
[exports.matroskaElements.FlagInterlaced]: exports.interlaced,
|
||||
[exports.matroskaElements.BitDepth]: exports.bitDepth,
|
||||
[exports.matroskaElements.DisplayHeight]: exports.displayHeight,
|
||||
[exports.matroskaElements.DisplayWidth]: exports.displayWidth,
|
||||
[exports.matroskaElements.DisplayUnit]: exports.displayUnit,
|
||||
[exports.matroskaElements.FlagLacing]: exports.flagLacing,
|
||||
[exports.matroskaElements.Tags]: exports.tags,
|
||||
[exports.matroskaElements.Tag]: exports.tagSegment,
|
||||
[exports.matroskaElements.TrackNumber]: exports.trackNumber,
|
||||
[exports.matroskaElements.TrackUID]: exports.trackUID,
|
||||
[exports.matroskaElements.Colour]: exports.color,
|
||||
[exports.matroskaElements.Language]: exports.language,
|
||||
[exports.matroskaElements.DefaultDuration]: exports.defaultDuration,
|
||||
[exports.matroskaElements.CodecPrivate]: exports.codecPrivate,
|
||||
[exports.matroskaElements.BlockDuration]: exports.blockDurationSegment,
|
||||
[exports.matroskaElements.BlockAdditions]: exports.blockAdditionsSegment,
|
||||
[exports.matroskaElements.MaxBlockAdditionID]: exports.maxBlockAdditionIdSegment,
|
||||
[exports.matroskaElements.Audio]: exports.audioSegment,
|
||||
[exports.matroskaElements.Video]: exports.videoSegment,
|
||||
[exports.matroskaElements.FlagDefault]: exports.flagDefault,
|
||||
[exports.matroskaElements.ReferenceBlock]: exports.referenceBlock,
|
||||
[exports.matroskaElements.TrackEntry]: exports.trackEntry,
|
||||
[exports.matroskaElements.Timestamp]: {
|
||||
name: 'Timestamp',
|
||||
type: 'uint',
|
||||
},
|
||||
[exports.matroskaElements.Tracks]: exports.tracks,
|
||||
[exports.matroskaElements.Block]: exports.block,
|
||||
[exports.matroskaElements.SimpleBlock]: exports.simpleBlock,
|
||||
[exports.matroskaElements.BlockGroup]: exports.blockGroup,
|
||||
[exports.matroskaElements.Segment]: {
|
||||
name: 'Segment',
|
||||
type: 'children',
|
||||
},
|
||||
[exports.matroskaElements.Cluster]: {
|
||||
name: 'Cluster',
|
||||
type: 'children',
|
||||
},
|
||||
[exports.matroskaElements.TransferCharacteristics]: exports.transferCharacteristics,
|
||||
[exports.matroskaElements.MatrixCoefficients]: exports.matrixCoefficients,
|
||||
[exports.matroskaElements.Primaries]: exports.primaries,
|
||||
[exports.matroskaElements.Range]: exports.range,
|
||||
[exports.matroskaElements.ChromaSitingHorz]: exports.ChromaSitingHorz,
|
||||
[exports.matroskaElements.ChromaSitingVert]: exports.ChromaSitingVert,
|
||||
};
|
||||
9
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/block-simple-block-flags.d.ts
generated
vendored
Normal file
9
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/block-simple-block-flags.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { BufferIterator } from '../../../iterator/buffer-iterator';
|
||||
import { matroskaElements } from './all-segments';
|
||||
type BlockFlags = {
|
||||
invisible: boolean;
|
||||
lacing: number;
|
||||
keyframe: boolean | null;
|
||||
};
|
||||
export declare const parseBlockFlags: (iterator: BufferIterator, type: (typeof matroskaElements)["Block"] | (typeof matroskaElements)["SimpleBlock"]) => BlockFlags;
|
||||
export {};
|
||||
38
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/block-simple-block-flags.js
generated
vendored
Normal file
38
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/block-simple-block-flags.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseBlockFlags = void 0;
|
||||
const all_segments_1 = require("./all-segments");
|
||||
const parseBlockFlags = (iterator, type) => {
|
||||
if (type === all_segments_1.matroskaElements.Block) {
|
||||
iterator.startReadingBits();
|
||||
// Reserved
|
||||
iterator.getBits(4);
|
||||
const invisible = Boolean(iterator.getBits(1));
|
||||
const lacing = iterator.getBits(2);
|
||||
// unused
|
||||
iterator.getBits(1);
|
||||
iterator.stopReadingBits();
|
||||
return {
|
||||
invisible,
|
||||
lacing,
|
||||
keyframe: null,
|
||||
};
|
||||
}
|
||||
if (type === all_segments_1.matroskaElements.SimpleBlock) {
|
||||
iterator.startReadingBits();
|
||||
const keyframe = Boolean(iterator.getBits(1));
|
||||
// Reserved
|
||||
iterator.getBits(3);
|
||||
const invisible = Boolean(iterator.getBits(1));
|
||||
const lacing = iterator.getBits(2);
|
||||
iterator.getBits(1);
|
||||
iterator.stopReadingBits();
|
||||
return {
|
||||
invisible,
|
||||
lacing,
|
||||
keyframe,
|
||||
};
|
||||
}
|
||||
throw new Error('Unexpected type');
|
||||
};
|
||||
exports.parseBlockFlags = parseBlockFlags;
|
||||
9
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/track-entry.d.ts
generated
vendored
Normal file
9
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/track-entry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { TrackEntry } from './all-segments';
|
||||
export type TrackInfo = {
|
||||
codec: string;
|
||||
trackTimescale: number | null;
|
||||
};
|
||||
type TrackType = 'video' | 'audio' | 'complex' | 'subtitle' | 'button' | 'control' | 'metadata';
|
||||
export declare const trackTypeToString: (trackType: number) => TrackType;
|
||||
export type GetTracks = () => TrackEntry[];
|
||||
export {};
|
||||
24
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/track-entry.js
generated
vendored
Normal file
24
remotion/node_modules/@remotion/media-parser/dist/containers/webm/segments/track-entry.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.trackTypeToString = void 0;
|
||||
const trackTypeToString = (trackType) => {
|
||||
switch (trackType) {
|
||||
case 1:
|
||||
return 'video';
|
||||
case 2:
|
||||
return 'audio';
|
||||
case 3:
|
||||
return 'complex';
|
||||
case 4:
|
||||
return 'subtitle';
|
||||
case 5:
|
||||
return 'button';
|
||||
case 6:
|
||||
return 'control';
|
||||
case 7:
|
||||
return 'metadata';
|
||||
default:
|
||||
throw new Error(`Unknown track type: ${trackType}`);
|
||||
}
|
||||
};
|
||||
exports.trackTypeToString = trackTypeToString;
|
||||
17
remotion/node_modules/@remotion/media-parser/dist/containers/webm/state-for-processing.d.ts
generated
vendored
Normal file
17
remotion/node_modules/@remotion/media-parser/dist/containers/webm/state-for-processing.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { MediaParserLogLevel } from '../../log';
|
||||
import type { AvcState } from '../../state/avc/avc-state';
|
||||
import type { WebmState } from '../../state/matroska/webm';
|
||||
import type { ParserState } from '../../state/parser-state';
|
||||
import type { CallbacksState } from '../../state/sample-callbacks';
|
||||
import type { StructureState } from '../../state/structure';
|
||||
import type { MediaParserOnAudioTrack, MediaParserOnVideoTrack } from '../../webcodec-sample-types';
|
||||
export type WebmRequiredStatesForProcessing = {
|
||||
webmState: WebmState;
|
||||
callbacks: CallbacksState;
|
||||
logLevel: MediaParserLogLevel;
|
||||
onAudioTrack: MediaParserOnAudioTrack | null;
|
||||
onVideoTrack: MediaParserOnVideoTrack | null;
|
||||
structureState: StructureState;
|
||||
avcState: AvcState;
|
||||
};
|
||||
export declare const selectStatesForProcessing: ({ callbacks, logLevel, onAudioTrack, onVideoTrack, structure, webm, avc, }: ParserState) => WebmRequiredStatesForProcessing;
|
||||
15
remotion/node_modules/@remotion/media-parser/dist/containers/webm/state-for-processing.js
generated
vendored
Normal file
15
remotion/node_modules/@remotion/media-parser/dist/containers/webm/state-for-processing.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.selectStatesForProcessing = void 0;
|
||||
const selectStatesForProcessing = ({ callbacks, logLevel, onAudioTrack, onVideoTrack, structure, webm, avc, }) => {
|
||||
return {
|
||||
webmState: webm,
|
||||
callbacks,
|
||||
logLevel,
|
||||
onAudioTrack,
|
||||
onVideoTrack,
|
||||
structureState: structure,
|
||||
avcState: avc,
|
||||
};
|
||||
};
|
||||
exports.selectStatesForProcessing = selectStatesForProcessing;
|
||||
33
remotion/node_modules/@remotion/media-parser/dist/containers/webm/traversal.d.ts
generated
vendored
Normal file
33
remotion/node_modules/@remotion/media-parser/dist/containers/webm/traversal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { MatroskaSegment } from './segments';
|
||||
import type { AudioSegment, ClusterSegment, CodecIdSegment, ColourSegment, DisplayHeightSegment, DisplayWidthSegment, HeightSegment, MainSegment, MatrixCoefficientsSegment, PrimariesSegment, RangeSegment, TimestampScaleSegment, TrackEntry, TrackTypeSegment, TransferCharacteristicsSegment, VideoSegment, WidthSegment } from './segments/all-segments';
|
||||
export declare const getMainSegment: (segments: MatroskaSegment[]) => MainSegment | null;
|
||||
export declare const getTrackNumber: (track: TrackEntry) => import("./segments/all-segments").UintWithSize | null;
|
||||
export declare const getTrackCodec: (track: TrackEntry) => CodecIdSegment | null;
|
||||
export declare const getTrackTimestampScale: (track: TrackEntry) => import("./segments/all-segments").FloatWithSize | null;
|
||||
export declare const getTrackByNumber: (tracks: TrackEntry[], id: number) => TrackEntry | undefined;
|
||||
export declare const getTrackId: (track: TrackEntry) => number;
|
||||
export declare const getCodecSegment: (track: TrackEntry) => CodecIdSegment | null;
|
||||
export declare const getColourSegment: (track: TrackEntry) => ColourSegment | null;
|
||||
export declare const getTransferCharacteristicsSegment: (color: ColourSegment) => TransferCharacteristicsSegment | null;
|
||||
export declare const getMatrixCoefficientsSegment: (color: ColourSegment) => MatrixCoefficientsSegment | null;
|
||||
export declare const getPrimariesSegment: (color: ColourSegment) => PrimariesSegment | null;
|
||||
export declare const getRangeSegment: (color: ColourSegment) => RangeSegment | null;
|
||||
export declare const getDisplayHeightSegment: (track: TrackEntry) => DisplayHeightSegment | null;
|
||||
export declare const getTrackTypeSegment: (track: TrackEntry) => TrackTypeSegment | null;
|
||||
export declare const getWidthSegment: (track: TrackEntry) => WidthSegment | null;
|
||||
export declare const getHeightSegment: (track: TrackEntry) => HeightSegment | null;
|
||||
export declare const getDisplayWidthSegment: (track: TrackEntry) => DisplayWidthSegment | null;
|
||||
export declare const getTracksSegment: (segment: MainSegment) => {
|
||||
type: "Tracks";
|
||||
value: import("./segments/all-segments").PossibleEbml[];
|
||||
minVintWidth: number | null;
|
||||
} | null;
|
||||
export declare const getTrackWithUid: (segment: MainSegment, trackUid: string) => number | null;
|
||||
export declare const getTimescaleSegment: (segment: MainSegment) => TimestampScaleSegment | null;
|
||||
export declare const getVideoSegment: (track: TrackEntry) => VideoSegment | null;
|
||||
export declare const getAudioSegment: (track: TrackEntry) => AudioSegment | null;
|
||||
export declare const getSampleRate: (track: TrackEntry) => number | null;
|
||||
export declare const getNumberOfChannels: (track: TrackEntry) => number;
|
||||
export declare const getBitDepth: (track: TrackEntry) => number | null;
|
||||
export declare const getPrivateData: (track: TrackEntry) => Uint8Array | null;
|
||||
export declare const getClusterSegment: (segment: MainSegment) => ClusterSegment | null;
|
||||
266
remotion/node_modules/@remotion/media-parser/dist/containers/webm/traversal.js
generated
vendored
Normal file
266
remotion/node_modules/@remotion/media-parser/dist/containers/webm/traversal.js
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getClusterSegment = exports.getPrivateData = exports.getBitDepth = exports.getNumberOfChannels = exports.getSampleRate = exports.getAudioSegment = exports.getVideoSegment = exports.getTimescaleSegment = exports.getTrackWithUid = exports.getTracksSegment = exports.getDisplayWidthSegment = exports.getHeightSegment = exports.getWidthSegment = exports.getTrackTypeSegment = exports.getDisplayHeightSegment = exports.getRangeSegment = exports.getPrimariesSegment = exports.getMatrixCoefficientsSegment = exports.getTransferCharacteristicsSegment = exports.getColourSegment = exports.getCodecSegment = exports.getTrackId = exports.getTrackByNumber = exports.getTrackTimestampScale = exports.getTrackCodec = exports.getTrackNumber = exports.getMainSegment = void 0;
|
||||
const getMainSegment = (segments) => {
|
||||
var _a;
|
||||
return ((_a = segments.find((s) => s.type === 'Segment')) !== null && _a !== void 0 ? _a : null);
|
||||
};
|
||||
exports.getMainSegment = getMainSegment;
|
||||
const getTrackNumber = (track) => {
|
||||
var _a;
|
||||
const child = track.value.find((b) => b.type === 'TrackNumber');
|
||||
return (_a = child === null || child === void 0 ? void 0 : child.value) !== null && _a !== void 0 ? _a : null;
|
||||
};
|
||||
exports.getTrackNumber = getTrackNumber;
|
||||
const getTrackCodec = (track) => {
|
||||
const child = track.value.find((b) => b.type === 'CodecID');
|
||||
return child !== null && child !== void 0 ? child : null;
|
||||
};
|
||||
exports.getTrackCodec = getTrackCodec;
|
||||
const getTrackTimestampScale = (track) => {
|
||||
const child = track.value.find((b) => b.type === 'TrackTimestampScale');
|
||||
if (!child) {
|
||||
return null;
|
||||
}
|
||||
if (child.type !== 'TrackTimestampScale') {
|
||||
throw new Error('Expected TrackTimestampScale');
|
||||
}
|
||||
return child.value;
|
||||
};
|
||||
exports.getTrackTimestampScale = getTrackTimestampScale;
|
||||
const getTrackByNumber = (tracks, id) => {
|
||||
return tracks.find((track) => {
|
||||
const trackNumber = (0, exports.getTrackNumber)(track);
|
||||
return (trackNumber === null || trackNumber === void 0 ? void 0 : trackNumber.value) === id;
|
||||
});
|
||||
};
|
||||
exports.getTrackByNumber = getTrackByNumber;
|
||||
const getTrackId = (track) => {
|
||||
const trackId = track.value.find((b) => b.type === 'TrackNumber');
|
||||
if (!trackId || trackId.type !== 'TrackNumber') {
|
||||
throw new Error('Expected track number segment');
|
||||
}
|
||||
return trackId.value.value;
|
||||
};
|
||||
exports.getTrackId = getTrackId;
|
||||
const getCodecSegment = (track) => {
|
||||
const codec = track.value.find((b) => b.type === 'CodecID');
|
||||
if (!codec || codec.type !== 'CodecID') {
|
||||
return null;
|
||||
}
|
||||
return codec;
|
||||
};
|
||||
exports.getCodecSegment = getCodecSegment;
|
||||
const getColourSegment = (track) => {
|
||||
const videoSegment = (0, exports.getVideoSegment)(track);
|
||||
if (!videoSegment) {
|
||||
return null;
|
||||
}
|
||||
const colour = videoSegment.value.find((b) => b.type === 'Colour');
|
||||
if (!colour || colour.type !== 'Colour') {
|
||||
return null;
|
||||
}
|
||||
return colour;
|
||||
};
|
||||
exports.getColourSegment = getColourSegment;
|
||||
const getTransferCharacteristicsSegment = (color) => {
|
||||
if (!color || color.type !== 'Colour') {
|
||||
return null;
|
||||
}
|
||||
const box = color.value.find((b) => b.type === 'TransferCharacteristics');
|
||||
if (!box || box.type !== 'TransferCharacteristics') {
|
||||
return null;
|
||||
}
|
||||
return box;
|
||||
};
|
||||
exports.getTransferCharacteristicsSegment = getTransferCharacteristicsSegment;
|
||||
const getMatrixCoefficientsSegment = (color) => {
|
||||
if (!color || color.type !== 'Colour') {
|
||||
return null;
|
||||
}
|
||||
const box = color.value.find((b) => b.type === 'MatrixCoefficients');
|
||||
if (!box || box.type !== 'MatrixCoefficients') {
|
||||
return null;
|
||||
}
|
||||
return box;
|
||||
};
|
||||
exports.getMatrixCoefficientsSegment = getMatrixCoefficientsSegment;
|
||||
const getPrimariesSegment = (color) => {
|
||||
if (!color || color.type !== 'Colour') {
|
||||
return null;
|
||||
}
|
||||
const box = color.value.find((b) => b.type === 'Primaries');
|
||||
if (!box || box.type !== 'Primaries') {
|
||||
return null;
|
||||
}
|
||||
return box;
|
||||
};
|
||||
exports.getPrimariesSegment = getPrimariesSegment;
|
||||
const getRangeSegment = (color) => {
|
||||
if (!color || color.type !== 'Colour') {
|
||||
return null;
|
||||
}
|
||||
const box = color.value.find((b) => b.type === 'Range');
|
||||
if (!box || box.type !== 'Range') {
|
||||
return null;
|
||||
}
|
||||
return box;
|
||||
};
|
||||
exports.getRangeSegment = getRangeSegment;
|
||||
const getDisplayHeightSegment = (track) => {
|
||||
const videoSegment = (0, exports.getVideoSegment)(track);
|
||||
if (!videoSegment) {
|
||||
return null;
|
||||
}
|
||||
const displayHeight = videoSegment.value.find((b) => b.type === 'DisplayHeight');
|
||||
if (!displayHeight || displayHeight.type !== 'DisplayHeight') {
|
||||
return null;
|
||||
}
|
||||
return displayHeight;
|
||||
};
|
||||
exports.getDisplayHeightSegment = getDisplayHeightSegment;
|
||||
const getTrackTypeSegment = (track) => {
|
||||
const trackType = track.value.find((b) => b.type === 'TrackType');
|
||||
if (!trackType || trackType.type !== 'TrackType') {
|
||||
return null;
|
||||
}
|
||||
return trackType;
|
||||
};
|
||||
exports.getTrackTypeSegment = getTrackTypeSegment;
|
||||
const getWidthSegment = (track) => {
|
||||
const videoSegment = (0, exports.getVideoSegment)(track);
|
||||
if (!videoSegment) {
|
||||
return null;
|
||||
}
|
||||
const width = videoSegment.value.find((b) => b.type === 'PixelWidth');
|
||||
if (!width || width.type !== 'PixelWidth') {
|
||||
return null;
|
||||
}
|
||||
return width;
|
||||
};
|
||||
exports.getWidthSegment = getWidthSegment;
|
||||
const getHeightSegment = (track) => {
|
||||
const videoSegment = (0, exports.getVideoSegment)(track);
|
||||
if (!videoSegment) {
|
||||
return null;
|
||||
}
|
||||
const height = videoSegment.value.find((b) => b.type === 'PixelHeight');
|
||||
if (!height || height.type !== 'PixelHeight') {
|
||||
return null;
|
||||
}
|
||||
return height;
|
||||
};
|
||||
exports.getHeightSegment = getHeightSegment;
|
||||
const getDisplayWidthSegment = (track) => {
|
||||
const videoSegment = (0, exports.getVideoSegment)(track);
|
||||
if (!videoSegment) {
|
||||
return null;
|
||||
}
|
||||
const displayWidth = videoSegment.value.find((b) => b.type === 'DisplayWidth');
|
||||
if (!displayWidth || displayWidth.type !== 'DisplayWidth') {
|
||||
return null;
|
||||
}
|
||||
return displayWidth;
|
||||
};
|
||||
exports.getDisplayWidthSegment = getDisplayWidthSegment;
|
||||
const getTracksSegment = (segment) => {
|
||||
const tracksSegment = segment.value.find((b) => b.type === 'Tracks');
|
||||
if (!tracksSegment) {
|
||||
return null;
|
||||
}
|
||||
return tracksSegment;
|
||||
};
|
||||
exports.getTracksSegment = getTracksSegment;
|
||||
const getTrackWithUid = (segment, trackUid) => {
|
||||
var _a, _b;
|
||||
const tracksSegment = (0, exports.getTracksSegment)(segment);
|
||||
if (!tracksSegment) {
|
||||
return null;
|
||||
}
|
||||
const trackEntries = tracksSegment.value.filter((t) => t.type === 'TrackEntry');
|
||||
const trackEntry = trackEntries.find((entry) => {
|
||||
return entry === null || entry === void 0 ? void 0 : entry.value.find((t) => t.type === 'TrackUID' && t.value === trackUid);
|
||||
});
|
||||
if (!trackEntry) {
|
||||
return null;
|
||||
}
|
||||
return ((_b = (_a = trackEntry.value.find((t) => t.type === 'TrackNumber')) === null || _a === void 0 ? void 0 : _a.value.value) !== null && _b !== void 0 ? _b : null);
|
||||
};
|
||||
exports.getTrackWithUid = getTrackWithUid;
|
||||
const getTimescaleSegment = (segment) => {
|
||||
const infoSegment = segment.value.find((b) => b.type === 'Info');
|
||||
if (!infoSegment || infoSegment.type !== 'Info') {
|
||||
return null;
|
||||
}
|
||||
const timescale = infoSegment.value.find((b) => b.type === 'TimestampScale');
|
||||
if (!timescale || timescale.type !== 'TimestampScale') {
|
||||
return null;
|
||||
}
|
||||
return timescale;
|
||||
};
|
||||
exports.getTimescaleSegment = getTimescaleSegment;
|
||||
const getVideoSegment = (track) => {
|
||||
const videoSegment = track.value.find((b) => b.type === 'Video');
|
||||
if (!videoSegment || videoSegment.type !== 'Video') {
|
||||
return null;
|
||||
}
|
||||
return videoSegment !== null && videoSegment !== void 0 ? videoSegment : null;
|
||||
};
|
||||
exports.getVideoSegment = getVideoSegment;
|
||||
const getAudioSegment = (track) => {
|
||||
const audioSegment = track.value.find((b) => b.type === 'Audio');
|
||||
if (!audioSegment || audioSegment.type !== 'Audio') {
|
||||
return null;
|
||||
}
|
||||
return audioSegment !== null && audioSegment !== void 0 ? audioSegment : null;
|
||||
};
|
||||
exports.getAudioSegment = getAudioSegment;
|
||||
const getSampleRate = (track) => {
|
||||
const audioSegment = (0, exports.getAudioSegment)(track);
|
||||
if (!audioSegment) {
|
||||
return null;
|
||||
}
|
||||
const samplingFrequency = audioSegment.value.find((b) => b.type === 'SamplingFrequency');
|
||||
if (!samplingFrequency || samplingFrequency.type !== 'SamplingFrequency') {
|
||||
return null;
|
||||
}
|
||||
return samplingFrequency.value.value;
|
||||
};
|
||||
exports.getSampleRate = getSampleRate;
|
||||
const getNumberOfChannels = (track) => {
|
||||
const audioSegment = (0, exports.getAudioSegment)(track);
|
||||
if (!audioSegment) {
|
||||
throw new Error('Could not find audio segment');
|
||||
}
|
||||
const channels = audioSegment.value.find((b) => b.type === 'Channels');
|
||||
if (!channels || channels.type !== 'Channels') {
|
||||
return 1;
|
||||
}
|
||||
return channels.value.value;
|
||||
};
|
||||
exports.getNumberOfChannels = getNumberOfChannels;
|
||||
const getBitDepth = (track) => {
|
||||
const audioSegment = (0, exports.getAudioSegment)(track);
|
||||
if (!audioSegment) {
|
||||
return null;
|
||||
}
|
||||
const bitDepth = audioSegment.value.find((b) => b.type === 'BitDepth');
|
||||
if (!bitDepth || bitDepth.type !== 'BitDepth') {
|
||||
return null;
|
||||
}
|
||||
return bitDepth.value.value;
|
||||
};
|
||||
exports.getBitDepth = getBitDepth;
|
||||
const getPrivateData = (track) => {
|
||||
const privateData = track.value.find((b) => b.type === 'CodecPrivate');
|
||||
if (!privateData || privateData.type !== 'CodecPrivate') {
|
||||
return null;
|
||||
}
|
||||
return privateData.value;
|
||||
};
|
||||
exports.getPrivateData = getPrivateData;
|
||||
const getClusterSegment = (segment) => {
|
||||
const clusterSegment = segment.value.find((b) => b.type === 'Cluster');
|
||||
return clusterSegment !== null && clusterSegment !== void 0 ? clusterSegment : null;
|
||||
};
|
||||
exports.getClusterSegment = getClusterSegment;
|
||||
Reference in New Issue
Block a user