@remotion/media-parser 4.0.314 → 4.0.316

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,8 +69,9 @@ const parseXing = (data) => {
69
69
  vbrScale = extractI4(data, offset);
70
70
  offset += 4;
71
71
  }
72
- if (offset !== data.length) {
73
- throw new Error('xing header was parsed wrong: ' + JSON.stringify(data));
72
+ // Allow extra data after the standard Xing fields, as some encoders add additional information
73
+ if (offset > data.length) {
74
+ throw new Error('xing header was parsed wrong: read beyond available data');
74
75
  }
75
76
  return {
76
77
  sampleRate,
@@ -1,5 +1,6 @@
1
1
  import type { ParseResult } from '../../parse-result';
2
2
  import type { ParserState } from '../../state/parser-state';
3
+ export declare function getChannelsFromMask(channelMask: number): string[];
3
4
  export declare const parseFmt: ({ state, }: {
4
5
  state: ParserState;
5
6
  }) => Promise<ParseResult>;
@@ -1,14 +1,51 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseFmt = void 0;
4
+ exports.getChannelsFromMask = getChannelsFromMask;
4
5
  const register_track_1 = require("../../register-track");
5
6
  const webcodecs_timescale_1 = require("../../webcodecs-timescale");
7
+ const CHANNELS = {
8
+ 0: 'Front Left',
9
+ 1: 'Front Right',
10
+ 2: 'Front Center',
11
+ 3: 'Low Frequency',
12
+ 4: 'Back Left',
13
+ 5: 'Back Right',
14
+ 6: 'Front Left of Center',
15
+ 7: 'Front Right of Center',
16
+ 8: 'Back Center',
17
+ 9: 'Side Left',
18
+ 10: 'Side Right',
19
+ 11: 'Top Center',
20
+ 12: 'Top Front Left',
21
+ 13: 'Top Front Center',
22
+ 14: 'Top Front Right',
23
+ 15: 'Top Back Left',
24
+ 16: 'Top Back Center',
25
+ 17: 'Top Back Right',
26
+ // Add more if needed as per the spec
27
+ };
28
+ function getChannelsFromMask(channelMask) {
29
+ const channels = [];
30
+ for (let bit = 0; bit < 18; bit++) {
31
+ if ((channelMask & (1 << bit)) !== 0) {
32
+ const channelName = CHANNELS[bit];
33
+ if (channelName) {
34
+ channels.push(channelName);
35
+ }
36
+ else {
37
+ channels.push(`Unknown Channel (bit ${bit})`);
38
+ }
39
+ }
40
+ }
41
+ return channels;
42
+ }
6
43
  const parseFmt = async ({ state, }) => {
7
44
  const { iterator } = state;
8
45
  const ckSize = iterator.getUint32Le(); // chunkSize
9
46
  const box = iterator.startBox(ckSize);
10
47
  const audioFormat = iterator.getUint16Le();
11
- if (audioFormat !== 1) {
48
+ if (audioFormat !== 1 && audioFormat !== 65534) {
12
49
  throw new Error(`Only supporting WAVE with PCM audio format, but got ${audioFormat}`);
13
50
  }
14
51
  const numberOfChannels = iterator.getUint16Le();
@@ -35,6 +72,27 @@ const parseFmt = async ({ state, }) => {
35
72
  type: 'wav-fmt',
36
73
  };
37
74
  state.structure.getWavStructure().boxes.push(wavHeader);
75
+ if (audioFormat === 65534) {
76
+ const extraSize = iterator.getUint16Le();
77
+ if (extraSize !== 22) {
78
+ throw new Error(`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`);
79
+ }
80
+ iterator.getUint16Le(); // valid bits per sample
81
+ const channelMask = iterator.getUint32Le();
82
+ const subFormat = iterator.getSlice(16);
83
+ // check if same as [ 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 ]
84
+ if (subFormat.length !== 16) {
85
+ throw new Error(`Only supporting WAVE with PCM audio format, but got ${subFormat.length}`);
86
+ }
87
+ for (let i = 0; i < 16; i++) {
88
+ if (subFormat[i] !==
89
+ [1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113][i]) {
90
+ throw new Error(`Only supporting WAVE with PCM audio format, but got subformat ${subFormat[i]}`);
91
+ }
92
+ }
93
+ const channels = getChannelsFromMask(channelMask);
94
+ wavHeader.numberOfChannels = channels.length;
95
+ }
38
96
  await (0, register_track_1.registerAudioTrack)({
39
97
  track: {
40
98
  type: 'audio',
@@ -0,0 +1,5 @@
1
+ import type { ParseResult } from '../../parse-result';
2
+ import type { ParserState } from '../../state/parser-state';
3
+ export declare const parseJunk: ({ state, }: {
4
+ state: ParserState;
5
+ }) => Promise<ParseResult>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseJunk = void 0;
4
+ const log_1 = require("../../log");
5
+ const parseJunk = ({ state, }) => {
6
+ const { iterator } = state;
7
+ const ckSize = iterator.getUint32Le(); // chunkSize
8
+ log_1.Log.trace(state.logLevel, `Skipping JUNK chunk of size ${ckSize}`);
9
+ iterator.discard(ckSize);
10
+ return Promise.resolve(null);
11
+ };
12
+ exports.parseJunk = parseJunk;
@@ -6,6 +6,7 @@ const parse_data_1 = require("./parse-data");
6
6
  const parse_fmt_1 = require("./parse-fmt");
7
7
  const parse_header_1 = require("./parse-header");
8
8
  const parse_id3_1 = require("./parse-id3");
9
+ const parse_junk_1 = require("./parse-junk");
9
10
  const parse_list_1 = require("./parse-list");
10
11
  const parse_media_section_1 = require("./parse-media-section");
11
12
  const parseWav = (state) => {
@@ -31,6 +32,9 @@ const parseWav = (state) => {
31
32
  if (type === 'id3' || type === 'ID3') {
32
33
  return (0, parse_id3_1.parseId3)({ state });
33
34
  }
35
+ if (type === 'JUNK' || type === 'FLLR') {
36
+ return (0, parse_junk_1.parseJunk)({ state });
37
+ }
34
38
  if (type === '\u0000') {
35
39
  return Promise.resolve(null);
36
40
  }
@@ -1,10 +1,11 @@
1
1
  import type { BufferIterator } from '../../iterator/buffer-iterator';
2
+ import type { MediaParserLogLevel } from '../../log';
2
3
  import type { PossibleEbml } from './segments/all-segments';
3
4
  import type { WebmRequiredStatesForProcessing } from './state-for-processing';
4
5
  export type Prettify<T> = {
5
6
  [K in keyof T]: T[K];
6
7
  } & {};
7
- export declare const parseEbml: (iterator: BufferIterator, statesForProcessing: WebmRequiredStatesForProcessing | null) => Promise<Prettify<PossibleEbml>>;
8
+ export declare const parseEbml: (iterator: BufferIterator, statesForProcessing: WebmRequiredStatesForProcessing | null, logLevel: MediaParserLogLevel) => Promise<Prettify<PossibleEbml> | null>;
8
9
  export declare const postprocessEbml: ({ offset, ebml, statesForProcessing: { webmState, callbacks, logLevel, onAudioTrack, onVideoTrack, structureState, avcState, }, }: {
9
10
  offset: number;
10
11
  ebml: Prettify<PossibleEbml>;
@@ -1,25 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.postprocessEbml = exports.parseEbml = void 0;
4
+ const log_1 = require("../../log");
4
5
  const register_track_1 = require("../../register-track");
5
6
  const get_sample_from_block_1 = require("./get-sample-from-block");
6
7
  const make_track_1 = require("./make-track");
7
8
  const all_segments_1 = require("./segments/all-segments");
8
- const parseEbml = async (iterator, statesForProcessing) => {
9
+ const parseEbml = async (iterator, statesForProcessing, logLevel) => {
9
10
  const hex = iterator.getMatroskaSegmentId();
10
11
  if (hex === null) {
11
12
  throw new Error('Not enough bytes left to parse EBML - this should not happen');
12
13
  }
13
- const hasInMap = all_segments_1.ebmlMap[hex];
14
- if (!hasInMap) {
15
- throw new Error(`Don't know how to parse EBML hex ID ${JSON.stringify(hex)}`);
16
- }
17
14
  const off = iterator.counter.getOffset();
18
15
  const size = iterator.getVint();
19
16
  const minVintWidth = iterator.counter.getOffset() - off;
20
17
  if (size === null) {
21
18
  throw new Error('Not enough bytes left to parse EBML - this should not happen');
22
19
  }
20
+ const hasInMap = all_segments_1.ebmlMap[hex];
21
+ if (!hasInMap) {
22
+ log_1.Log.verbose(logLevel, `Unknown EBML hex ID ${JSON.stringify(hex)}`);
23
+ iterator.discard(size);
24
+ return null;
25
+ }
23
26
  if (hasInMap.type === 'uint') {
24
27
  const beforeUintOffset = iterator.counter.getOffset();
25
28
  const value = size === 0 ? 0 : iterator.getUint(size);
@@ -83,16 +86,18 @@ const parseEbml = async (iterator, statesForProcessing) => {
83
86
  break;
84
87
  }
85
88
  const offset = iterator.counter.getOffset();
86
- const value = await (0, exports.parseEbml)(iterator, statesForProcessing);
87
- const remapped = statesForProcessing
88
- ? // eslint-disable-next-line @typescript-eslint/no-use-before-define
89
- await (0, exports.postprocessEbml)({
90
- offset,
91
- ebml: value,
92
- statesForProcessing,
93
- })
94
- : value;
95
- children.push(remapped);
89
+ const value = await (0, exports.parseEbml)(iterator, statesForProcessing, logLevel);
90
+ if (value) {
91
+ const remapped = statesForProcessing
92
+ ? // eslint-disable-next-line @typescript-eslint/no-use-before-define
93
+ await (0, exports.postprocessEbml)({
94
+ offset,
95
+ ebml: value,
96
+ statesForProcessing,
97
+ })
98
+ : value;
99
+ children.push(remapped);
100
+ }
96
101
  const offsetNow = iterator.counter.getOffset();
97
102
  if (offsetNow - startOffset > size) {
98
103
  throw new Error(`Offset ${offsetNow - startOffset} is larger than the length of the hex ${size}`);
@@ -75,17 +75,21 @@ const expectSegment = async ({ statesForProcessing, isInsideSegment, iterator, l
75
75
  headerReadSoFar: iterator.counter.getOffset() - offset,
76
76
  statesForProcessing,
77
77
  iterator,
78
+ logLevel,
78
79
  });
79
80
  return segment;
80
81
  };
81
82
  exports.expectSegment = expectSegment;
82
- const parseSegment = async ({ segmentId, length, iterator, headerReadSoFar, statesForProcessing, }) => {
83
+ const parseSegment = async ({ segmentId, length, iterator, headerReadSoFar, statesForProcessing, logLevel, }) => {
83
84
  if (length < 0) {
84
85
  throw new Error(`Expected length of ${segmentId} to be greater or equal 0`);
85
86
  }
86
87
  iterator.counter.decrement(headerReadSoFar);
87
88
  const offset = iterator.counter.getOffset();
88
- const ebml = await (0, parse_ebml_1.parseEbml)(iterator, statesForProcessing);
89
+ const ebml = await (0, parse_ebml_1.parseEbml)(iterator, statesForProcessing, logLevel);
90
+ if (ebml === null) {
91
+ return null;
92
+ }
89
93
  if (!statesForProcessing) {
90
94
  return ebml;
91
95
  }
package/dist/errors.js CHANGED
@@ -53,6 +53,8 @@ exports.MediaParserAbortError = MediaParserAbortError;
53
53
  const hasBeenAborted = (error) => {
54
54
  return (error instanceof MediaParserAbortError ||
55
55
  // On worker it is not the same instance, but same name
56
- error.name === 'MediaParserAbortError');
56
+ error.name === 'MediaParserAbortError' ||
57
+ // fetch gives BodyStreamBuffer was aborted
58
+ error.name === 'AbortError');
57
59
  };
58
60
  exports.hasBeenAborted = hasBeenAborted;
@@ -6473,21 +6473,23 @@ var getSampleFromBlock = async ({
6473
6473
  };
6474
6474
 
6475
6475
  // src/containers/webm/parse-ebml.ts
6476
- var parseEbml = async (iterator, statesForProcessing) => {
6476
+ var parseEbml = async (iterator, statesForProcessing, logLevel) => {
6477
6477
  const hex = iterator.getMatroskaSegmentId();
6478
6478
  if (hex === null) {
6479
6479
  throw new Error("Not enough bytes left to parse EBML - this should not happen");
6480
6480
  }
6481
- const hasInMap = ebmlMap[hex];
6482
- if (!hasInMap) {
6483
- throw new Error(`Don't know how to parse EBML hex ID ${JSON.stringify(hex)}`);
6484
- }
6485
6481
  const off = iterator.counter.getOffset();
6486
6482
  const size = iterator.getVint();
6487
6483
  const minVintWidth = iterator.counter.getOffset() - off;
6488
6484
  if (size === null) {
6489
6485
  throw new Error("Not enough bytes left to parse EBML - this should not happen");
6490
6486
  }
6487
+ const hasInMap = ebmlMap[hex];
6488
+ if (!hasInMap) {
6489
+ Log.verbose(logLevel, `Unknown EBML hex ID ${JSON.stringify(hex)}`);
6490
+ iterator.discard(size);
6491
+ return null;
6492
+ }
6491
6493
  if (hasInMap.type === "uint") {
6492
6494
  const beforeUintOffset = iterator.counter.getOffset();
6493
6495
  const value = size === 0 ? 0 : iterator.getUint(size);
@@ -6542,13 +6544,15 @@ var parseEbml = async (iterator, statesForProcessing) => {
6542
6544
  break;
6543
6545
  }
6544
6546
  const offset = iterator.counter.getOffset();
6545
- const value = await parseEbml(iterator, statesForProcessing);
6546
- const remapped = statesForProcessing ? await postprocessEbml({
6547
- offset,
6548
- ebml: value,
6549
- statesForProcessing
6550
- }) : value;
6551
- children.push(remapped);
6547
+ const value = await parseEbml(iterator, statesForProcessing, logLevel);
6548
+ if (value) {
6549
+ const remapped = statesForProcessing ? await postprocessEbml({
6550
+ offset,
6551
+ ebml: value,
6552
+ statesForProcessing
6553
+ }) : value;
6554
+ children.push(remapped);
6555
+ }
6552
6556
  const offsetNow = iterator.counter.getOffset();
6553
6557
  if (offsetNow - startOffset > size) {
6554
6558
  throw new Error(`Offset ${offsetNow - startOffset} is larger than the length of the hex ${size}`);
@@ -6766,7 +6770,7 @@ class MediaParserAbortError extends Error {
6766
6770
  }
6767
6771
  }
6768
6772
  var hasBeenAborted = (error) => {
6769
- return error instanceof MediaParserAbortError || error.name === "MediaParserAbortError";
6773
+ return error instanceof MediaParserAbortError || error.name === "MediaParserAbortError" || error.name === "AbortError";
6770
6774
  };
6771
6775
 
6772
6776
  // src/with-resolvers.ts
@@ -8760,8 +8764,8 @@ var parseXing = (data) => {
8760
8764
  vbrScale = extractI4(data, offset);
8761
8765
  offset += 4;
8762
8766
  }
8763
- if (offset !== data.length) {
8764
- throw new Error("xing header was parsed wrong: " + JSON.stringify(data));
8767
+ if (offset > data.length) {
8768
+ throw new Error("xing header was parsed wrong: read beyond available data");
8765
8769
  }
8766
8770
  return {
8767
8771
  sampleRate,
@@ -15071,6 +15075,40 @@ var parseData = ({
15071
15075
  };
15072
15076
 
15073
15077
  // src/containers/wav/parse-fmt.ts
15078
+ var CHANNELS = {
15079
+ 0: "Front Left",
15080
+ 1: "Front Right",
15081
+ 2: "Front Center",
15082
+ 3: "Low Frequency",
15083
+ 4: "Back Left",
15084
+ 5: "Back Right",
15085
+ 6: "Front Left of Center",
15086
+ 7: "Front Right of Center",
15087
+ 8: "Back Center",
15088
+ 9: "Side Left",
15089
+ 10: "Side Right",
15090
+ 11: "Top Center",
15091
+ 12: "Top Front Left",
15092
+ 13: "Top Front Center",
15093
+ 14: "Top Front Right",
15094
+ 15: "Top Back Left",
15095
+ 16: "Top Back Center",
15096
+ 17: "Top Back Right"
15097
+ };
15098
+ function getChannelsFromMask(channelMask) {
15099
+ const channels2 = [];
15100
+ for (let bit = 0;bit < 18; bit++) {
15101
+ if ((channelMask & 1 << bit) !== 0) {
15102
+ const channelName = CHANNELS[bit];
15103
+ if (channelName) {
15104
+ channels2.push(channelName);
15105
+ } else {
15106
+ channels2.push(`Unknown Channel (bit ${bit})`);
15107
+ }
15108
+ }
15109
+ }
15110
+ return channels2;
15111
+ }
15074
15112
  var parseFmt = async ({
15075
15113
  state
15076
15114
  }) => {
@@ -15078,7 +15116,7 @@ var parseFmt = async ({
15078
15116
  const ckSize = iterator.getUint32Le();
15079
15117
  const box = iterator.startBox(ckSize);
15080
15118
  const audioFormat = iterator.getUint16Le();
15081
- if (audioFormat !== 1) {
15119
+ if (audioFormat !== 1 && audioFormat !== 65534) {
15082
15120
  throw new Error(`Only supporting WAVE with PCM audio format, but got ${audioFormat}`);
15083
15121
  }
15084
15122
  const numberOfChannels = iterator.getUint16Le();
@@ -15099,6 +15137,25 @@ var parseFmt = async ({
15099
15137
  type: "wav-fmt"
15100
15138
  };
15101
15139
  state.structure.getWavStructure().boxes.push(wavHeader);
15140
+ if (audioFormat === 65534) {
15141
+ const extraSize = iterator.getUint16Le();
15142
+ if (extraSize !== 22) {
15143
+ throw new Error(`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`);
15144
+ }
15145
+ iterator.getUint16Le();
15146
+ const channelMask = iterator.getUint32Le();
15147
+ const subFormat = iterator.getSlice(16);
15148
+ if (subFormat.length !== 16) {
15149
+ throw new Error(`Only supporting WAVE with PCM audio format, but got ${subFormat.length}`);
15150
+ }
15151
+ for (let i = 0;i < 16; i++) {
15152
+ if (subFormat[i] !== [1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113][i]) {
15153
+ throw new Error(`Only supporting WAVE with PCM audio format, but got subformat ${subFormat[i]}`);
15154
+ }
15155
+ }
15156
+ const channels2 = getChannelsFromMask(channelMask);
15157
+ wavHeader.numberOfChannels = channels2.length;
15158
+ }
15102
15159
  await registerAudioTrack({
15103
15160
  track: {
15104
15161
  type: "audio",
@@ -15154,6 +15211,17 @@ var parseId32 = ({
15154
15211
  return Promise.resolve(null);
15155
15212
  };
15156
15213
 
15214
+ // src/containers/wav/parse-junk.ts
15215
+ var parseJunk = ({
15216
+ state
15217
+ }) => {
15218
+ const { iterator } = state;
15219
+ const ckSize = iterator.getUint32Le();
15220
+ Log.trace(state.logLevel, `Skipping JUNK chunk of size ${ckSize}`);
15221
+ iterator.discard(ckSize);
15222
+ return Promise.resolve(null);
15223
+ };
15224
+
15157
15225
  // src/containers/wav/parse-list.ts
15158
15226
  var parseList = ({
15159
15227
  state
@@ -15252,6 +15320,9 @@ var parseWav = (state) => {
15252
15320
  if (type === "id3" || type === "ID3") {
15253
15321
  return parseId32({ state });
15254
15322
  }
15323
+ if (type === "JUNK" || type === "FLLR") {
15324
+ return parseJunk({ state });
15325
+ }
15255
15326
  if (type === "\x00") {
15256
15327
  return Promise.resolve(null);
15257
15328
  }
@@ -15363,7 +15434,8 @@ var expectSegment = async ({
15363
15434
  length: size,
15364
15435
  headerReadSoFar: iterator.counter.getOffset() - offset,
15365
15436
  statesForProcessing,
15366
- iterator
15437
+ iterator,
15438
+ logLevel
15367
15439
  });
15368
15440
  return segment;
15369
15441
  };
@@ -15372,14 +15444,18 @@ var parseSegment = async ({
15372
15444
  length,
15373
15445
  iterator,
15374
15446
  headerReadSoFar,
15375
- statesForProcessing
15447
+ statesForProcessing,
15448
+ logLevel
15376
15449
  }) => {
15377
15450
  if (length < 0) {
15378
15451
  throw new Error(`Expected length of ${segmentId} to be greater or equal 0`);
15379
15452
  }
15380
15453
  iterator.counter.decrement(headerReadSoFar);
15381
15454
  const offset = iterator.counter.getOffset();
15382
- const ebml = await parseEbml(iterator, statesForProcessing);
15455
+ const ebml = await parseEbml(iterator, statesForProcessing, logLevel);
15456
+ if (ebml === null) {
15457
+ return null;
15458
+ }
15383
15459
  if (!statesForProcessing) {
15384
15460
  return ebml;
15385
15461
  }
@@ -17870,7 +17946,7 @@ var downloadAndParseMedia = async (options) => {
17870
17946
  return returnValue;
17871
17947
  };
17872
17948
  // src/version.ts
17873
- var VERSION = "4.0.314";
17949
+ var VERSION = "4.0.316";
17874
17950
 
17875
17951
  // src/index.ts
17876
17952
  var MediaParserInternals = {
@@ -6467,8 +6467,8 @@ var parseXing = (data) => {
6467
6467
  vbrScale = extractI4(data, offset);
6468
6468
  offset += 4;
6469
6469
  }
6470
- if (offset !== data.length) {
6471
- throw new Error("xing header was parsed wrong: " + JSON.stringify(data));
6470
+ if (offset > data.length) {
6471
+ throw new Error("xing header was parsed wrong: read beyond available data");
6472
6472
  }
6473
6473
  return {
6474
6474
  sampleRate,
@@ -14810,6 +14810,40 @@ var parseData = ({
14810
14810
  };
14811
14811
 
14812
14812
  // src/containers/wav/parse-fmt.ts
14813
+ var CHANNELS = {
14814
+ 0: "Front Left",
14815
+ 1: "Front Right",
14816
+ 2: "Front Center",
14817
+ 3: "Low Frequency",
14818
+ 4: "Back Left",
14819
+ 5: "Back Right",
14820
+ 6: "Front Left of Center",
14821
+ 7: "Front Right of Center",
14822
+ 8: "Back Center",
14823
+ 9: "Side Left",
14824
+ 10: "Side Right",
14825
+ 11: "Top Center",
14826
+ 12: "Top Front Left",
14827
+ 13: "Top Front Center",
14828
+ 14: "Top Front Right",
14829
+ 15: "Top Back Left",
14830
+ 16: "Top Back Center",
14831
+ 17: "Top Back Right"
14832
+ };
14833
+ function getChannelsFromMask(channelMask) {
14834
+ const channels2 = [];
14835
+ for (let bit = 0;bit < 18; bit++) {
14836
+ if ((channelMask & 1 << bit) !== 0) {
14837
+ const channelName = CHANNELS[bit];
14838
+ if (channelName) {
14839
+ channels2.push(channelName);
14840
+ } else {
14841
+ channels2.push(`Unknown Channel (bit ${bit})`);
14842
+ }
14843
+ }
14844
+ }
14845
+ return channels2;
14846
+ }
14813
14847
  var parseFmt = async ({
14814
14848
  state
14815
14849
  }) => {
@@ -14817,7 +14851,7 @@ var parseFmt = async ({
14817
14851
  const ckSize = iterator.getUint32Le();
14818
14852
  const box = iterator.startBox(ckSize);
14819
14853
  const audioFormat = iterator.getUint16Le();
14820
- if (audioFormat !== 1) {
14854
+ if (audioFormat !== 1 && audioFormat !== 65534) {
14821
14855
  throw new Error(`Only supporting WAVE with PCM audio format, but got ${audioFormat}`);
14822
14856
  }
14823
14857
  const numberOfChannels = iterator.getUint16Le();
@@ -14838,6 +14872,25 @@ var parseFmt = async ({
14838
14872
  type: "wav-fmt"
14839
14873
  };
14840
14874
  state.structure.getWavStructure().boxes.push(wavHeader);
14875
+ if (audioFormat === 65534) {
14876
+ const extraSize = iterator.getUint16Le();
14877
+ if (extraSize !== 22) {
14878
+ throw new Error(`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`);
14879
+ }
14880
+ iterator.getUint16Le();
14881
+ const channelMask = iterator.getUint32Le();
14882
+ const subFormat = iterator.getSlice(16);
14883
+ if (subFormat.length !== 16) {
14884
+ throw new Error(`Only supporting WAVE with PCM audio format, but got ${subFormat.length}`);
14885
+ }
14886
+ for (let i = 0;i < 16; i++) {
14887
+ if (subFormat[i] !== [1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113][i]) {
14888
+ throw new Error(`Only supporting WAVE with PCM audio format, but got subformat ${subFormat[i]}`);
14889
+ }
14890
+ }
14891
+ const channels2 = getChannelsFromMask(channelMask);
14892
+ wavHeader.numberOfChannels = channels2.length;
14893
+ }
14841
14894
  await registerAudioTrack({
14842
14895
  track: {
14843
14896
  type: "audio",
@@ -14893,6 +14946,17 @@ var parseId32 = ({
14893
14946
  return Promise.resolve(null);
14894
14947
  };
14895
14948
 
14949
+ // src/containers/wav/parse-junk.ts
14950
+ var parseJunk = ({
14951
+ state
14952
+ }) => {
14953
+ const { iterator } = state;
14954
+ const ckSize = iterator.getUint32Le();
14955
+ Log.trace(state.logLevel, `Skipping JUNK chunk of size ${ckSize}`);
14956
+ iterator.discard(ckSize);
14957
+ return Promise.resolve(null);
14958
+ };
14959
+
14896
14960
  // src/containers/wav/parse-list.ts
14897
14961
  var parseList = ({
14898
14962
  state
@@ -14991,6 +15055,9 @@ var parseWav = (state) => {
14991
15055
  if (type === "id3" || type === "ID3") {
14992
15056
  return parseId32({ state });
14993
15057
  }
15058
+ if (type === "JUNK" || type === "FLLR") {
15059
+ return parseJunk({ state });
15060
+ }
14994
15061
  if (type === "\x00") {
14995
15062
  return Promise.resolve(null);
14996
15063
  }
@@ -15200,21 +15267,23 @@ var getSampleFromBlock = async ({
15200
15267
  };
15201
15268
 
15202
15269
  // src/containers/webm/parse-ebml.ts
15203
- var parseEbml = async (iterator, statesForProcessing) => {
15270
+ var parseEbml = async (iterator, statesForProcessing, logLevel) => {
15204
15271
  const hex = iterator.getMatroskaSegmentId();
15205
15272
  if (hex === null) {
15206
15273
  throw new Error("Not enough bytes left to parse EBML - this should not happen");
15207
15274
  }
15208
- const hasInMap = ebmlMap[hex];
15209
- if (!hasInMap) {
15210
- throw new Error(`Don't know how to parse EBML hex ID ${JSON.stringify(hex)}`);
15211
- }
15212
15275
  const off = iterator.counter.getOffset();
15213
15276
  const size = iterator.getVint();
15214
15277
  const minVintWidth = iterator.counter.getOffset() - off;
15215
15278
  if (size === null) {
15216
15279
  throw new Error("Not enough bytes left to parse EBML - this should not happen");
15217
15280
  }
15281
+ const hasInMap = ebmlMap[hex];
15282
+ if (!hasInMap) {
15283
+ Log.verbose(logLevel, `Unknown EBML hex ID ${JSON.stringify(hex)}`);
15284
+ iterator.discard(size);
15285
+ return null;
15286
+ }
15218
15287
  if (hasInMap.type === "uint") {
15219
15288
  const beforeUintOffset = iterator.counter.getOffset();
15220
15289
  const value = size === 0 ? 0 : iterator.getUint(size);
@@ -15269,13 +15338,15 @@ var parseEbml = async (iterator, statesForProcessing) => {
15269
15338
  break;
15270
15339
  }
15271
15340
  const offset = iterator.counter.getOffset();
15272
- const value = await parseEbml(iterator, statesForProcessing);
15273
- const remapped = statesForProcessing ? await postprocessEbml({
15274
- offset,
15275
- ebml: value,
15276
- statesForProcessing
15277
- }) : value;
15278
- children.push(remapped);
15341
+ const value = await parseEbml(iterator, statesForProcessing, logLevel);
15342
+ if (value) {
15343
+ const remapped = statesForProcessing ? await postprocessEbml({
15344
+ offset,
15345
+ ebml: value,
15346
+ statesForProcessing
15347
+ }) : value;
15348
+ children.push(remapped);
15349
+ }
15279
15350
  const offsetNow = iterator.counter.getOffset();
15280
15351
  if (offsetNow - startOffset > size) {
15281
15352
  throw new Error(`Offset ${offsetNow - startOffset} is larger than the length of the hex ${size}`);
@@ -15491,7 +15562,8 @@ var expectSegment = async ({
15491
15562
  length: size,
15492
15563
  headerReadSoFar: iterator.counter.getOffset() - offset,
15493
15564
  statesForProcessing,
15494
- iterator
15565
+ iterator,
15566
+ logLevel
15495
15567
  });
15496
15568
  return segment;
15497
15569
  };
@@ -15500,14 +15572,18 @@ var parseSegment = async ({
15500
15572
  length,
15501
15573
  iterator,
15502
15574
  headerReadSoFar,
15503
- statesForProcessing
15575
+ statesForProcessing,
15576
+ logLevel
15504
15577
  }) => {
15505
15578
  if (length < 0) {
15506
15579
  throw new Error(`Expected length of ${segmentId} to be greater or equal 0`);
15507
15580
  }
15508
15581
  iterator.counter.decrement(headerReadSoFar);
15509
15582
  const offset = iterator.counter.getOffset();
15510
- const ebml = await parseEbml(iterator, statesForProcessing);
15583
+ const ebml = await parseEbml(iterator, statesForProcessing, logLevel);
15584
+ if (ebml === null) {
15585
+ return null;
15586
+ }
15511
15587
  if (!statesForProcessing) {
15512
15588
  return ebml;
15513
15589
  }
@@ -6364,8 +6364,8 @@ var parseXing = (data) => {
6364
6364
  vbrScale = extractI4(data, offset);
6365
6365
  offset += 4;
6366
6366
  }
6367
- if (offset !== data.length) {
6368
- throw new Error("xing header was parsed wrong: " + JSON.stringify(data));
6367
+ if (offset > data.length) {
6368
+ throw new Error("xing header was parsed wrong: read beyond available data");
6369
6369
  }
6370
6370
  return {
6371
6371
  sampleRate,
@@ -14679,6 +14679,40 @@ var parseData = ({
14679
14679
  };
14680
14680
 
14681
14681
  // src/containers/wav/parse-fmt.ts
14682
+ var CHANNELS = {
14683
+ 0: "Front Left",
14684
+ 1: "Front Right",
14685
+ 2: "Front Center",
14686
+ 3: "Low Frequency",
14687
+ 4: "Back Left",
14688
+ 5: "Back Right",
14689
+ 6: "Front Left of Center",
14690
+ 7: "Front Right of Center",
14691
+ 8: "Back Center",
14692
+ 9: "Side Left",
14693
+ 10: "Side Right",
14694
+ 11: "Top Center",
14695
+ 12: "Top Front Left",
14696
+ 13: "Top Front Center",
14697
+ 14: "Top Front Right",
14698
+ 15: "Top Back Left",
14699
+ 16: "Top Back Center",
14700
+ 17: "Top Back Right"
14701
+ };
14702
+ function getChannelsFromMask(channelMask) {
14703
+ const channels2 = [];
14704
+ for (let bit = 0;bit < 18; bit++) {
14705
+ if ((channelMask & 1 << bit) !== 0) {
14706
+ const channelName = CHANNELS[bit];
14707
+ if (channelName) {
14708
+ channels2.push(channelName);
14709
+ } else {
14710
+ channels2.push(`Unknown Channel (bit ${bit})`);
14711
+ }
14712
+ }
14713
+ }
14714
+ return channels2;
14715
+ }
14682
14716
  var parseFmt = async ({
14683
14717
  state
14684
14718
  }) => {
@@ -14686,7 +14720,7 @@ var parseFmt = async ({
14686
14720
  const ckSize = iterator.getUint32Le();
14687
14721
  const box = iterator.startBox(ckSize);
14688
14722
  const audioFormat = iterator.getUint16Le();
14689
- if (audioFormat !== 1) {
14723
+ if (audioFormat !== 1 && audioFormat !== 65534) {
14690
14724
  throw new Error(`Only supporting WAVE with PCM audio format, but got ${audioFormat}`);
14691
14725
  }
14692
14726
  const numberOfChannels = iterator.getUint16Le();
@@ -14707,6 +14741,25 @@ var parseFmt = async ({
14707
14741
  type: "wav-fmt"
14708
14742
  };
14709
14743
  state.structure.getWavStructure().boxes.push(wavHeader);
14744
+ if (audioFormat === 65534) {
14745
+ const extraSize = iterator.getUint16Le();
14746
+ if (extraSize !== 22) {
14747
+ throw new Error(`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`);
14748
+ }
14749
+ iterator.getUint16Le();
14750
+ const channelMask = iterator.getUint32Le();
14751
+ const subFormat = iterator.getSlice(16);
14752
+ if (subFormat.length !== 16) {
14753
+ throw new Error(`Only supporting WAVE with PCM audio format, but got ${subFormat.length}`);
14754
+ }
14755
+ for (let i = 0;i < 16; i++) {
14756
+ if (subFormat[i] !== [1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113][i]) {
14757
+ throw new Error(`Only supporting WAVE with PCM audio format, but got subformat ${subFormat[i]}`);
14758
+ }
14759
+ }
14760
+ const channels2 = getChannelsFromMask(channelMask);
14761
+ wavHeader.numberOfChannels = channels2.length;
14762
+ }
14710
14763
  await registerAudioTrack({
14711
14764
  track: {
14712
14765
  type: "audio",
@@ -14762,6 +14815,17 @@ var parseId32 = ({
14762
14815
  return Promise.resolve(null);
14763
14816
  };
14764
14817
 
14818
+ // src/containers/wav/parse-junk.ts
14819
+ var parseJunk = ({
14820
+ state
14821
+ }) => {
14822
+ const { iterator } = state;
14823
+ const ckSize = iterator.getUint32Le();
14824
+ Log.trace(state.logLevel, `Skipping JUNK chunk of size ${ckSize}`);
14825
+ iterator.discard(ckSize);
14826
+ return Promise.resolve(null);
14827
+ };
14828
+
14765
14829
  // src/containers/wav/parse-list.ts
14766
14830
  var parseList = ({
14767
14831
  state
@@ -14860,6 +14924,9 @@ var parseWav = (state) => {
14860
14924
  if (type === "id3" || type === "ID3") {
14861
14925
  return parseId32({ state });
14862
14926
  }
14927
+ if (type === "JUNK" || type === "FLLR") {
14928
+ return parseJunk({ state });
14929
+ }
14863
14930
  if (type === "\x00") {
14864
14931
  return Promise.resolve(null);
14865
14932
  }
@@ -15069,21 +15136,23 @@ var getSampleFromBlock = async ({
15069
15136
  };
15070
15137
 
15071
15138
  // src/containers/webm/parse-ebml.ts
15072
- var parseEbml = async (iterator, statesForProcessing) => {
15139
+ var parseEbml = async (iterator, statesForProcessing, logLevel) => {
15073
15140
  const hex = iterator.getMatroskaSegmentId();
15074
15141
  if (hex === null) {
15075
15142
  throw new Error("Not enough bytes left to parse EBML - this should not happen");
15076
15143
  }
15077
- const hasInMap = ebmlMap[hex];
15078
- if (!hasInMap) {
15079
- throw new Error(`Don't know how to parse EBML hex ID ${JSON.stringify(hex)}`);
15080
- }
15081
15144
  const off = iterator.counter.getOffset();
15082
15145
  const size = iterator.getVint();
15083
15146
  const minVintWidth = iterator.counter.getOffset() - off;
15084
15147
  if (size === null) {
15085
15148
  throw new Error("Not enough bytes left to parse EBML - this should not happen");
15086
15149
  }
15150
+ const hasInMap = ebmlMap[hex];
15151
+ if (!hasInMap) {
15152
+ Log.verbose(logLevel, `Unknown EBML hex ID ${JSON.stringify(hex)}`);
15153
+ iterator.discard(size);
15154
+ return null;
15155
+ }
15087
15156
  if (hasInMap.type === "uint") {
15088
15157
  const beforeUintOffset = iterator.counter.getOffset();
15089
15158
  const value = size === 0 ? 0 : iterator.getUint(size);
@@ -15138,13 +15207,15 @@ var parseEbml = async (iterator, statesForProcessing) => {
15138
15207
  break;
15139
15208
  }
15140
15209
  const offset = iterator.counter.getOffset();
15141
- const value = await parseEbml(iterator, statesForProcessing);
15142
- const remapped = statesForProcessing ? await postprocessEbml({
15143
- offset,
15144
- ebml: value,
15145
- statesForProcessing
15146
- }) : value;
15147
- children.push(remapped);
15210
+ const value = await parseEbml(iterator, statesForProcessing, logLevel);
15211
+ if (value) {
15212
+ const remapped = statesForProcessing ? await postprocessEbml({
15213
+ offset,
15214
+ ebml: value,
15215
+ statesForProcessing
15216
+ }) : value;
15217
+ children.push(remapped);
15218
+ }
15148
15219
  const offsetNow = iterator.counter.getOffset();
15149
15220
  if (offsetNow - startOffset > size) {
15150
15221
  throw new Error(`Offset ${offsetNow - startOffset} is larger than the length of the hex ${size}`);
@@ -15360,7 +15431,8 @@ var expectSegment = async ({
15360
15431
  length: size,
15361
15432
  headerReadSoFar: iterator.counter.getOffset() - offset,
15362
15433
  statesForProcessing,
15363
- iterator
15434
+ iterator,
15435
+ logLevel
15364
15436
  });
15365
15437
  return segment;
15366
15438
  };
@@ -15369,14 +15441,18 @@ var parseSegment = async ({
15369
15441
  length,
15370
15442
  iterator,
15371
15443
  headerReadSoFar,
15372
- statesForProcessing
15444
+ statesForProcessing,
15445
+ logLevel
15373
15446
  }) => {
15374
15447
  if (length < 0) {
15375
15448
  throw new Error(`Expected length of ${segmentId} to be greater or equal 0`);
15376
15449
  }
15377
15450
  iterator.counter.decrement(headerReadSoFar);
15378
15451
  const offset = iterator.counter.getOffset();
15379
- const ebml = await parseEbml(iterator, statesForProcessing);
15452
+ const ebml = await parseEbml(iterator, statesForProcessing, logLevel);
15453
+ if (ebml === null) {
15454
+ return null;
15455
+ }
15380
15456
  if (!statesForProcessing) {
15381
15457
  return ebml;
15382
15458
  }
package/dist/index.d.ts CHANGED
@@ -1260,7 +1260,7 @@ export declare const MediaParserInternals: {
1260
1260
  size: number;
1261
1261
  offset: number;
1262
1262
  }) => import("./containers/iso-base-media/ftyp").FtypBox;
1263
- parseEbml: (iterator: import("./iterator/buffer-iterator").BufferIterator, statesForProcessing: import("./containers/webm/state-for-processing").WebmRequiredStatesForProcessing | null) => Promise<import("./containers/webm/parse-ebml").Prettify<PossibleEbml>>;
1263
+ parseEbml: (iterator: import("./iterator/buffer-iterator").BufferIterator, statesForProcessing: import("./containers/webm/state-for-processing").WebmRequiredStatesForProcessing | null, logLevel: MediaParserLogLevel) => Promise<import("./containers/webm/parse-ebml").Prettify<PossibleEbml> | null>;
1264
1264
  parseMvhd: ({ iterator, offset, size, }: {
1265
1265
  iterator: import("./iterator/buffer-iterator").BufferIterator;
1266
1266
  offset: number;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.314";
1
+ export declare const VERSION = "4.0.316";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '4.0.314';
5
+ exports.VERSION = '4.0.316';
package/package.json CHANGED
@@ -3,15 +3,15 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-parser"
4
4
  },
5
5
  "name": "@remotion/media-parser",
6
- "version": "4.0.314",
6
+ "version": "4.0.316",
7
7
  "main": "dist/index.js",
8
8
  "sideEffects": false,
9
9
  "devDependencies": {
10
10
  "@types/wicg-file-system-access": "2023.10.5",
11
11
  "eslint": "9.19.0",
12
12
  "@types/bun": "1.2.8",
13
- "@remotion/example-videos": "4.0.314",
14
- "@remotion/eslint-config-internal": "4.0.314"
13
+ "@remotion/example-videos": "4.0.316",
14
+ "@remotion/eslint-config-internal": "4.0.316"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public"
@@ -1,30 +0,0 @@
1
- import type { BufferIterator } from '../../iterator/buffer-iterator';
2
- import type { BaseBox } from './base-type';
3
- export type ThreeDMatrix = [
4
- number,
5
- number,
6
- number,
7
- number,
8
- number,
9
- number,
10
- number,
11
- number,
12
- number
13
- ];
14
- export interface MvhdBox extends BaseBox {
15
- durationInUnits: number;
16
- durationInSeconds: number;
17
- creationTime: number | null;
18
- modificationTime: number | null;
19
- timeScale: number;
20
- rate: number;
21
- volume: number;
22
- matrix: ThreeDMatrix;
23
- nextTrackId: number;
24
- type: 'mvhd-box';
25
- }
26
- export declare const parseMvhd: ({ iterator, offset, size, }: {
27
- iterator: BufferIterator;
28
- offset: number;
29
- size: number;
30
- }) => MvhdBox;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseMvhd = void 0;
4
- const buffer_iterator_1 = require("../../iterator/buffer-iterator");
5
- const to_date_1 = require("./to-date");
6
- const parseMvhd = ({ iterator, offset, size, }) => {
7
- const version = iterator.getUint8();
8
- // Flags, we discard them
9
- iterator.discard(3);
10
- const creationTime = version === 1 ? iterator.getUint64() : iterator.getUint32();
11
- const modificationTime = version === 1 ? iterator.getUint64() : iterator.getUint32();
12
- const timeScale = iterator.getUint32();
13
- const durationInUnits = version === 1 ? iterator.getUint64() : iterator.getUint32();
14
- const durationInSeconds = Number(durationInUnits) / timeScale;
15
- const rateArray = iterator.getSlice(4);
16
- const rateView = (0, buffer_iterator_1.getArrayBufferIterator)(rateArray, rateArray.length);
17
- const rate = rateView.getInt8() * 10 +
18
- rateView.getInt8() +
19
- rateView.getInt8() * 0.1 +
20
- rateView.getInt8() * 0.01;
21
- const volumeArray = iterator.getSlice(2);
22
- const volumeView = (0, buffer_iterator_1.getArrayBufferIterator)(volumeArray, volumeArray.length);
23
- const volume = volumeView.getInt8() + volumeView.getInt8() * 0.1;
24
- // reserved 16bit
25
- iterator.discard(2);
26
- // reserved 32bit x2
27
- iterator.discard(4);
28
- iterator.discard(4);
29
- // matrix
30
- const matrix = [
31
- iterator.getFixedPointSigned1616Number(),
32
- iterator.getFixedPointSigned1616Number(),
33
- iterator.getFixedPointSigned230Number(),
34
- iterator.getFixedPointSigned1616Number(),
35
- iterator.getFixedPointSigned1616Number(),
36
- iterator.getFixedPointSigned230Number(),
37
- iterator.getFixedPointSigned1616Number(),
38
- iterator.getFixedPointSigned1616Number(),
39
- iterator.getFixedPointSigned230Number(),
40
- ];
41
- // pre-defined
42
- iterator.discard(4 * 6);
43
- // next track id
44
- const nextTrackId = iterator.getUint32();
45
- volumeView.destroy();
46
- const bytesRemaining = size - (iterator.counter.getOffset() - offset);
47
- if (bytesRemaining !== 0) {
48
- throw new Error('expected 0 bytes ' + bytesRemaining);
49
- }
50
- return {
51
- creationTime: (0, to_date_1.toUnixTimestamp)(Number(creationTime)),
52
- modificationTime: (0, to_date_1.toUnixTimestamp)(Number(modificationTime)),
53
- timeScale,
54
- durationInUnits: Number(durationInUnits),
55
- durationInSeconds,
56
- rate,
57
- volume,
58
- matrix: matrix,
59
- nextTrackId,
60
- type: 'mvhd-box',
61
- boxSize: size,
62
- offset,
63
- };
64
- };
65
- exports.parseMvhd = parseMvhd;
package/dist/index.cjs DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WEBCODECS_TIMESCALE = exports.VERSION = exports.mediaParserController = exports.defaultSelectM3uStreamFn = exports.defaultSelectM3uAssociatedPlaylists = exports.MediaParserInternals = exports.downloadAndParseMedia = exports.MediaParserAbortError = exports.IsAPdfError = exports.IsAnUnsupportedFileTypeError = exports.IsAnImageError = exports.hasBeenAborted = exports.parseMedia = void 0;
4
- const aac_codecprivate_1 = require("./aac-codecprivate");
5
- const ftyp_1 = require("./containers/iso-base-media/ftyp");
6
- const mvhd_1 = require("./containers/iso-base-media/mvhd");
7
- const samples_1 = require("./containers/iso-base-media/stsd/samples");
8
- const stsd_1 = require("./containers/iso-base-media/stsd/stsd");
9
- const tkhd_1 = require("./containers/iso-base-media/tkhd");
10
- const parse_ebml_1 = require("./containers/webm/parse-ebml");
11
- const all_segments_1 = require("./containers/webm/segments/all-segments");
12
- const internal_parse_media_1 = require("./internal-parse-media");
13
- const buffer_iterator_1 = require("./iterator/buffer-iterator");
14
- const log_1 = require("./log");
15
- const need_samples_for_fields_1 = require("./state/need-samples-for-fields");
16
- const parser_state_1 = require("./state/parser-state");
17
- var parse_media_1 = require("./parse-media");
18
- Object.defineProperty(exports, "parseMedia", { enumerable: true, get: function () { return parse_media_1.parseMedia; } });
19
- var errors_1 = require("./errors");
20
- Object.defineProperty(exports, "hasBeenAborted", { enumerable: true, get: function () { return errors_1.hasBeenAborted; } });
21
- Object.defineProperty(exports, "IsAnImageError", { enumerable: true, get: function () { return errors_1.IsAnImageError; } });
22
- Object.defineProperty(exports, "IsAnUnsupportedFileTypeError", { enumerable: true, get: function () { return errors_1.IsAnUnsupportedFileTypeError; } });
23
- Object.defineProperty(exports, "IsAPdfError", { enumerable: true, get: function () { return errors_1.IsAPdfError; } });
24
- Object.defineProperty(exports, "MediaParserAbortError", { enumerable: true, get: function () { return errors_1.MediaParserAbortError; } });
25
- var download_and_parse_media_1 = require("./download-and-parse-media");
26
- Object.defineProperty(exports, "downloadAndParseMedia", { enumerable: true, get: function () { return download_and_parse_media_1.downloadAndParseMedia; } });
27
- /**
28
- * @deprecated Dont use these yet.
29
- */
30
- exports.MediaParserInternals = {
31
- Log: log_1.Log,
32
- createAacCodecPrivate: aac_codecprivate_1.createAacCodecPrivate,
33
- matroskaElements: all_segments_1.matroskaElements,
34
- ebmlMap: all_segments_1.ebmlMap,
35
- parseTkhd: tkhd_1.parseTkhd,
36
- getArrayBufferIterator: buffer_iterator_1.getArrayBufferIterator,
37
- parseStsd: stsd_1.parseStsd,
38
- makeParserState: parser_state_1.makeParserState,
39
- processSample: samples_1.processIsoFormatBox,
40
- parseFtyp: ftyp_1.parseFtyp,
41
- parseEbml: parse_ebml_1.parseEbml,
42
- parseMvhd: mvhd_1.parseMvhd,
43
- internalParseMedia: internal_parse_media_1.internalParseMedia,
44
- fieldsNeedSamplesMap: need_samples_for_fields_1.fieldsNeedSamplesMap,
45
- };
46
- var select_stream_1 = require("./containers/m3u/select-stream");
47
- Object.defineProperty(exports, "defaultSelectM3uAssociatedPlaylists", { enumerable: true, get: function () { return select_stream_1.defaultSelectM3uAssociatedPlaylists; } });
48
- Object.defineProperty(exports, "defaultSelectM3uStreamFn", { enumerable: true, get: function () { return select_stream_1.defaultSelectM3uStreamFn; } });
49
- var media_parser_controller_1 = require("./controller/media-parser-controller");
50
- Object.defineProperty(exports, "mediaParserController", { enumerable: true, get: function () { return media_parser_controller_1.mediaParserController; } });
51
- var version_1 = require("./version");
52
- Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
53
- var webcodecs_timescale_1 = require("./webcodecs-timescale");
54
- Object.defineProperty(exports, "WEBCODECS_TIMESCALE", { enumerable: true, get: function () { return webcodecs_timescale_1.WEBCODECS_TIMESCALE; } });