@remotion/media-parser 4.0.200 → 4.0.201

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.
Files changed (111) hide show
  1. package/dist/av1-codec-string.d.ts +5 -0
  2. package/dist/av1-codec-string.js +18 -1
  3. package/dist/bitstream/av1.d.ts +2 -0
  4. package/dist/bitstream/av1.js +12 -0
  5. package/dist/boxes/iso-base-media/avcc-hvcc.d.ts +20 -0
  6. package/dist/boxes/iso-base-media/avcc-hvcc.js +73 -0
  7. package/dist/boxes/iso-base-media/avcc.d.ts +18 -0
  8. package/dist/boxes/iso-base-media/avcc.js +27 -0
  9. package/dist/boxes/iso-base-media/esds-descriptors.d.ts +21 -0
  10. package/dist/boxes/iso-base-media/esds-descriptors.js +62 -0
  11. package/dist/boxes/iso-base-media/esds.d.ts +15 -0
  12. package/dist/boxes/iso-base-media/esds.js +27 -0
  13. package/dist/boxes/iso-base-media/mdat/mdat.js +2 -1
  14. package/dist/boxes/iso-base-media/moov/moov.js +1 -0
  15. package/dist/boxes/iso-base-media/process-box.d.ts +4 -2
  16. package/dist/boxes/iso-base-media/process-box.js +56 -40
  17. package/dist/boxes/iso-base-media/stsd/mebx.d.ts +2 -1
  18. package/dist/boxes/iso-base-media/stsd/mebx.js +2 -1
  19. package/dist/boxes/iso-base-media/stsd/samples.js +3 -0
  20. package/dist/boxes/iso-base-media/stsd/stco.d.ts +3 -2
  21. package/dist/boxes/iso-base-media/stsd/stco.js +2 -2
  22. package/dist/boxes/iso-base-media/trak/trak.js +1 -0
  23. package/dist/boxes/webm/bitstream/av1.js +10 -1
  24. package/dist/boxes/webm/ebml.d.ts +1 -1
  25. package/dist/boxes/webm/make-header.d.ts +8 -1
  26. package/dist/boxes/webm/make-header.js +65 -30
  27. package/dist/boxes/webm/parse-ebml.d.ts +7 -0
  28. package/dist/boxes/webm/parse-ebml.js +66 -0
  29. package/dist/boxes/webm/parse-webm-header.js +8 -9
  30. package/dist/boxes/webm/segments/all-segments.d.ts +258 -1
  31. package/dist/boxes/webm/segments/all-segments.js +126 -2
  32. package/dist/boxes/webm/segments/seek-position.js +1 -1
  33. package/dist/boxes/webm/segments/seek.d.ts +1 -1
  34. package/dist/boxes/webm/segments/seek.js +8 -2
  35. package/dist/boxes/webm/segments/timestamp-scale.js +1 -1
  36. package/dist/boxes/webm/segments/track-entry.d.ts +5 -1
  37. package/dist/boxes/webm/segments/track-entry.js +19 -20
  38. package/dist/boxes/webm/segments.d.ts +2 -2
  39. package/dist/boxes/webm/segments.js +30 -25
  40. package/dist/boxes/webm/traversal.d.ts +1 -0
  41. package/dist/boxes/webm/traversal.js +12 -1
  42. package/dist/buffer-iterator.d.ts +9 -6
  43. package/dist/buffer-iterator.js +83 -7
  44. package/dist/from-fetch.js +13 -3
  45. package/dist/from-input-type-file.d.ts +2 -0
  46. package/dist/from-input-type-file.js +37 -0
  47. package/dist/from-node.js +9 -2
  48. package/dist/from-web-file.js +6 -1
  49. package/dist/from-web.js +15 -6
  50. package/dist/get-audio-codec.d.ts +1 -1
  51. package/dist/get-codec.d.ts +4 -0
  52. package/dist/get-codec.js +22 -0
  53. package/dist/get-sample-positions.js +1 -1
  54. package/dist/has-all-info.js +1 -1
  55. package/dist/options.d.ts +3 -2
  56. package/dist/parse-media.js +13 -9
  57. package/dist/parse-video.js +16 -0
  58. package/dist/parser-state.d.ts +4 -3
  59. package/dist/parser-state.js +15 -3
  60. package/dist/reader.d.ts +1 -1
  61. package/dist/web-file.d.ts +2 -0
  62. package/dist/web-file.js +37 -0
  63. package/package.json +2 -2
  64. package/src/boxes/iso-base-media/mdat/mdat.ts +2 -1
  65. package/src/boxes/iso-base-media/moov/moov.ts +1 -0
  66. package/src/boxes/iso-base-media/process-box.ts +70 -40
  67. package/src/boxes/iso-base-media/stsd/mebx.ts +3 -0
  68. package/src/boxes/iso-base-media/stsd/samples.ts +3 -0
  69. package/src/boxes/iso-base-media/stsd/stco.ts +5 -3
  70. package/src/boxes/iso-base-media/trak/trak.ts +1 -0
  71. package/src/boxes/webm/make-header.ts +122 -32
  72. package/src/boxes/webm/parse-ebml.ts +93 -0
  73. package/src/boxes/webm/parse-webm-header.ts +8 -12
  74. package/src/boxes/webm/segments/all-segments.ts +222 -1
  75. package/src/boxes/webm/segments/seek-position.ts +1 -1
  76. package/src/boxes/webm/segments/seek.ts +12 -2
  77. package/src/boxes/webm/segments/timestamp-scale.ts +1 -1
  78. package/src/boxes/webm/segments/track-entry.ts +31 -26
  79. package/src/boxes/webm/segments.ts +37 -32
  80. package/src/boxes/webm/traversal.ts +13 -0
  81. package/src/buffer-iterator.ts +102 -9
  82. package/src/from-fetch.ts +22 -3
  83. package/src/from-node.ts +18 -4
  84. package/src/from-web-file.ts +11 -1
  85. package/src/get-sample-positions.ts +1 -1
  86. package/src/has-all-info.ts +1 -1
  87. package/src/options.ts +3 -2
  88. package/src/parse-media.ts +14 -8
  89. package/src/parse-video.ts +17 -0
  90. package/src/parser-state.ts +22 -5
  91. package/src/reader.ts +1 -0
  92. package/src/test/create-matroska.test.ts +36 -2
  93. package/src/test/matroska.test.ts +69 -27
  94. package/src/test/parse-stco.test.ts +2 -0
  95. package/src/test/stream-local.test.ts +23 -9
  96. package/src/test/stream-remote.test.ts +23 -19
  97. package/src/test/stsd.test.ts +2 -0
  98. package/tsconfig.tsbuildinfo +1 -1
  99. package/dist/boxes/iso-base-media/ftype.d.ts +0 -9
  100. package/dist/boxes/iso-base-media/ftype.js +0 -31
  101. package/dist/get-video-metadata.d.ts +0 -2
  102. package/dist/get-video-metadata.js +0 -44
  103. package/dist/read-and-increment-offset.d.ts +0 -28
  104. package/dist/read-and-increment-offset.js +0 -177
  105. package/dist/understand-vorbis.d.ts +0 -1
  106. package/dist/understand-vorbis.js +0 -12
  107. package/src/boxes/webm/segments/unknown.ts +0 -19
  108. /package/dist/{boxes/webm/bitstream/av1/frame.d.ts → get-samples.d.ts} +0 -0
  109. /package/dist/{boxes/webm/bitstream/av1/frame.js → get-samples.js} +0 -0
  110. /package/dist/{boxes/webm/bitstream/h264/get-h264-descriptor.d.ts → sample-aspect-ratio.d.ts} +0 -0
  111. /package/dist/{boxes/webm/bitstream/h264/get-h264-descriptor.js → sample-aspect-ratio.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseStco = void 0;
4
- const parseStco = ({ iterator, offset, size, }) => {
4
+ const parseStco = ({ iterator, offset, size, mode64Bit, }) => {
5
5
  const version = iterator.getUint8();
6
6
  if (version !== 0) {
7
7
  throw new Error(`Unsupported STSD version ${version}`);
@@ -14,7 +14,7 @@ const parseStco = ({ iterator, offset, size, }) => {
14
14
  if (bytesRemaining < 4) {
15
15
  break;
16
16
  }
17
- entries.push(iterator.getUint32());
17
+ entries.push(mode64Bit ? iterator.getUint64() : iterator.getUint32());
18
18
  }
19
19
  iterator.discard(size - (iterator.counter.getOffset() - offset));
20
20
  return {
@@ -10,6 +10,7 @@ const parseTrak = async ({ data, size, offsetAtStart, options, }) => {
10
10
  initialBoxes: [],
11
11
  options,
12
12
  continueMdat: false,
13
+ littleEndian: false,
13
14
  });
14
15
  if (children.status === 'incomplete') {
15
16
  throw new Error('Incomplete boxes are not allowed');
@@ -50,6 +50,15 @@ const av1Bitstream = ({ stream, length, onVideoSample, trackNumber, context, tim
50
50
  : {
51
51
  type: 'av1-bitstream-unimplemented',
52
52
  };
53
+ if (segment.type === 'av1-bitstream-header') {
54
+ if (!size) {
55
+ throw new Error('Expected size');
56
+ }
57
+ const toSample = bytesReadSoFar + size;
58
+ stream.counter.decrement(stream.counter.getOffset() - address);
59
+ const header = stream.getSlice(toSample);
60
+ context.parserState.setAv1BitstreamHeaderSegment(segment, header);
61
+ }
53
62
  if (obuType === 6) {
54
63
  const head = context.parserState.getAv1BitstreamHeaderSegment();
55
64
  if (!head) {
@@ -80,7 +89,7 @@ const av1Bitstream = ({ stream, length, onVideoSample, trackNumber, context, tim
80
89
  }
81
90
  }
82
91
  onVideoSample(trackNumber, {
83
- data: (0, combine_uint8array_1.combineUint8Arrays)(extraBytes, frame),
92
+ bytes: (0, combine_uint8array_1.combineUint8Arrays)(extraBytes, frame),
84
93
  timestamp: timecode + clusterTimestamp,
85
94
  duration: undefined,
86
95
  trackId: trackNumber,
@@ -1,2 +1,2 @@
1
- export declare const measureEBMLVarInt: (value: number) => 1 | 2 | 3 | 4 | 5 | 6;
1
+ export declare const measureEBMLVarInt: (value: number) => 1 | 2 | 5 | 3 | 6 | 4;
2
2
  export declare const getVariableInt: (value: number, width?: number) => Uint8Array;
@@ -1,2 +1,9 @@
1
+ import type { Ebml, EbmlWithChildren, EbmlWithHexString, EbmlWithString, EbmlWithUint8, EmblTypes, HeaderStructure } from './segments/all-segments';
1
2
  export declare const webmPattern: Uint8Array;
2
- export declare const makeMatroskaHeader: () => Uint8Array;
3
+ type Numbers = '0' | '1' | '2' | '3' | '4' | '5' | '6';
4
+ type ChildFields<Struct extends HeaderStructure> = {
5
+ [key in keyof Struct & Numbers as Struct[key]['name']]: EmblTypes[Struct[key]['type']];
6
+ };
7
+ type SerializeValue<Struct extends Ebml> = Struct extends EbmlWithChildren ? ChildFields<Struct['children']> : Struct extends EbmlWithString ? string : Struct extends EbmlWithUint8 ? number : Struct extends EbmlWithHexString ? string : undefined;
8
+ export declare const makeMatroskaHeader: <Struct extends Ebml>(struct: Struct, fields: SerializeValue<Struct>) => Uint8Array;
9
+ export {};
@@ -5,40 +5,75 @@ const ebml_1 = require("./ebml");
5
5
  const all_segments_1 = require("./segments/all-segments");
6
6
  exports.webmPattern = new Uint8Array([0x1a, 0x45, 0xdf, 0xa3]);
7
7
  const matroskaToHex = (matrId) => {
8
- const numbers = [];
8
+ const numbers = new Uint8Array((matrId.length - 2) / 2);
9
9
  for (let i = 2; i < matrId.length; i += 2) {
10
- const hex = matrId.substr(i, 2);
11
- numbers.push(parseInt(hex, 16));
10
+ const hex = matrId.substring(i, i + 2);
11
+ numbers[(i - 2) / 2] = parseInt(hex, 16);
12
12
  }
13
13
  return numbers;
14
14
  };
15
- const makeMatroskaHeader = () => {
16
- const size = 0x23;
17
- const array = new Uint8Array([
18
- ...exports.webmPattern,
19
- ...(0, ebml_1.getVariableInt)(size),
20
- ...matroskaToHex(all_segments_1.matroskaElements.EBMLVersion),
21
- ...(0, ebml_1.getVariableInt)(1),
22
- 1,
23
- ...matroskaToHex(all_segments_1.matroskaElements.EBMLReadVersion),
24
- ...(0, ebml_1.getVariableInt)(1),
25
- 1,
26
- ...matroskaToHex(all_segments_1.matroskaElements.EBMLMaxIDLength),
27
- ...(0, ebml_1.getVariableInt)(1),
28
- 4,
29
- ...matroskaToHex(all_segments_1.matroskaElements.EBMLMaxSizeLength),
30
- ...(0, ebml_1.getVariableInt)(1),
31
- 8,
32
- ...matroskaToHex(all_segments_1.matroskaElements.DocType),
33
- ...(0, ebml_1.getVariableInt)(8),
34
- ...new TextEncoder().encode('matroska'),
35
- ...matroskaToHex(all_segments_1.matroskaElements.DocTypeVersion),
36
- ...(0, ebml_1.getVariableInt)(1),
37
- 4,
38
- ...matroskaToHex(all_segments_1.matroskaElements.DocTypeReadVersion),
39
- ...(0, ebml_1.getVariableInt)(1),
40
- 2,
15
+ function putUintDynamic(number) {
16
+ if (number < 0) {
17
+ throw new Error('This function is designed for non-negative integers only.');
18
+ }
19
+ // Calculate the minimum number of bytes needed to store the integer
20
+ const length = Math.ceil(Math.log2(number + 1) / 8);
21
+ const bytes = new Uint8Array(length);
22
+ for (let i = 0; i < length; i++) {
23
+ // Extract each byte from the number
24
+ bytes[length - 1 - i] = (number >> (8 * i)) & 0xff;
25
+ }
26
+ return bytes;
27
+ }
28
+ const makeFromHeaderStructure = (struct, fields) => {
29
+ const arrays = [];
30
+ if (struct.type === 'children') {
31
+ for (const item of struct.children) {
32
+ arrays.push((0, exports.makeMatroskaHeader)(item,
33
+ // @ts-expect-error
34
+ fields[item.name]));
35
+ }
36
+ return combineUint8Arrays(arrays);
37
+ }
38
+ if (struct.type === 'string') {
39
+ return new TextEncoder().encode(fields);
40
+ }
41
+ if (struct.type === 'uint') {
42
+ return putUintDynamic(fields);
43
+ }
44
+ if (struct.type === 'hex-string') {
45
+ const hex = fields.substring(2);
46
+ const arr = new Uint8Array(hex.length / 2);
47
+ for (let i = 0; i < hex.length; i += 2) {
48
+ const byte = parseInt(hex.substring(i, i + 2), 16);
49
+ arr[i / 2] = byte;
50
+ }
51
+ return arr;
52
+ }
53
+ if (struct.type === 'void') {
54
+ throw new Error('Serializing Void is not implemented');
55
+ }
56
+ throw new Error('Unexpected type');
57
+ };
58
+ const makeMatroskaHeader = (struct, fields) => {
59
+ const value = makeFromHeaderStructure(struct, fields);
60
+ return combineUint8Arrays([
61
+ matroskaToHex((0, all_segments_1.getIdForName)(struct.name)),
62
+ (0, ebml_1.getVariableInt)(value.length),
63
+ value,
41
64
  ]);
42
- return array;
43
65
  };
44
66
  exports.makeMatroskaHeader = makeMatroskaHeader;
67
+ const combineUint8Arrays = (arrays) => {
68
+ let totalLength = 0;
69
+ for (const array of arrays) {
70
+ totalLength += array.length;
71
+ }
72
+ const result = new Uint8Array(totalLength);
73
+ let offset = 0;
74
+ for (const array of arrays) {
75
+ result.set(array, offset);
76
+ offset += array.length;
77
+ }
78
+ return result;
79
+ };
@@ -0,0 +1,7 @@
1
+ import type { BufferIterator } from '../../buffer-iterator';
2
+ import type { PossibleEbml } from './segments/all-segments';
3
+ type Prettify<T> = {
4
+ [K in keyof T]: T[K];
5
+ } & {};
6
+ export declare const parseEbml: (iterator: BufferIterator) => Prettify<PossibleEbml>;
7
+ export {};
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseEbml = void 0;
4
+ const all_segments_1 = require("./segments/all-segments");
5
+ const parseEbml = (iterator) => {
6
+ const hex = iterator.getMatroskaSegmentId();
7
+ if (hex === null) {
8
+ throw new Error('Not enough bytes left to parse EBML - this should not happen');
9
+ }
10
+ const hasInMap = all_segments_1.ebmlMap[hex];
11
+ if (!hasInMap) {
12
+ throw new Error(`Don't know how to parse EBML hex ID ${JSON.stringify(hex)}`);
13
+ }
14
+ const size = iterator.getVint();
15
+ if (size === null) {
16
+ throw new Error('Not enough bytes left to parse EBML - this should not happen');
17
+ }
18
+ if (hasInMap.type === 'uint') {
19
+ const value = iterator.getUint(size);
20
+ return { type: hasInMap.name, value, hex };
21
+ }
22
+ if (hasInMap.type === 'string') {
23
+ const value = iterator.getByteString(size);
24
+ return {
25
+ type: hasInMap.name,
26
+ value,
27
+ hex,
28
+ };
29
+ }
30
+ if (hasInMap.type === 'float') {
31
+ const value = size === 4 ? iterator.getFloat32() : iterator.getFloat64();
32
+ return {
33
+ type: hasInMap.name,
34
+ value,
35
+ hex,
36
+ };
37
+ }
38
+ if (hasInMap.type === 'void') {
39
+ iterator.discard(size);
40
+ return {
41
+ type: hasInMap.name,
42
+ value: undefined,
43
+ hex,
44
+ };
45
+ }
46
+ if (hasInMap.type === 'children') {
47
+ const children = [];
48
+ const startOffset = iterator.counter.getOffset();
49
+ // eslint-disable-next-line no-constant-condition
50
+ while (true) {
51
+ const value = (0, exports.parseEbml)(iterator);
52
+ children.push(value);
53
+ const offsetNow = iterator.counter.getOffset();
54
+ if (offsetNow - startOffset > size) {
55
+ throw new Error(`Offset ${offsetNow - startOffset} is larger than the length of the hex ${size}`);
56
+ }
57
+ if (offsetNow - startOffset === size) {
58
+ break;
59
+ }
60
+ }
61
+ return { type: hasInMap.name, value: children, hex };
62
+ }
63
+ // @ts-expect-error
64
+ throw new Error(`Unknown segment type ${hasInMap.type}`);
65
+ };
66
+ exports.parseEbml = parseEbml;
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseWebm = void 0;
4
- const segments_1 = require("./segments");
4
+ const parse_children_1 = require("./segments/parse-children");
5
5
  // Parsing according to https://darkcoding.net/software/reading-mediarecorders-webm-opus-output/
6
6
  const parseWebm = (counter, parserContext) => {
7
- counter.discard(4);
8
- const length = counter.getVint();
9
- if (length !== 31 && length !== 35) {
10
- throw new Error(`Expected header length 31 or 25, got ${length}`);
11
- }
12
- // Discard header for now
13
- counter.discard(length);
14
- return (0, segments_1.expectSegment)(counter, parserContext);
7
+ return (0, parse_children_1.expectChildren)({
8
+ iterator: counter,
9
+ length: Infinity,
10
+ initialChildren: [],
11
+ wrap: null,
12
+ parserContext,
13
+ });
15
14
  };
16
15
  exports.parseWebm = parseWebm;
@@ -1,7 +1,8 @@
1
1
  export declare const matroskaElements: {
2
+ readonly Header: "0x1a45dfa3";
2
3
  readonly EBMLMaxIDLength: "0x42f2";
3
4
  readonly EBMLVersion: "0x4286";
4
- readonly EBMLReadVersion: "0x42F7";
5
+ readonly EBMLReadVersion: "0x42f7";
5
6
  readonly EBMLMaxSizeLength: "0x42f3";
6
7
  readonly DocType: "0x4282";
7
8
  readonly DocTypeVersion: "0x4287";
@@ -272,3 +273,259 @@ export declare const knownIdsWithOneLength: string[];
272
273
  export declare const knownIdsWithTwoLength: string[];
273
274
  export declare const knownIdsWithThreeLength: string[];
274
275
  export declare const getSegmentName: (id: string) => string | undefined;
276
+ export declare const getIdForName: (name: string) => "0x1a45dfa3" | "0x42f2" | "0x4286" | "0x42f7" | "0x42f3" | "0x4282" | "0x4287" | "0x4285" | "0x18538067" | "0x114d9b74" | "0x4dbb" | "0x53ab" | "0x53ac" | "0x1549a966" | "0x73a4" | "0x7384" | "0x3cb923" | "0x3c83ab" | "0x3eb923" | "0x3e83bb" | "0x4444" | "0x6924" | "0x69a5" | "0x69bf" | "0x69fc" | "0x2ad7b1" | "0x4489" | "0x4461" | "0x7ba9" | "0x4d80" | "0x5741" | "0x1f43b675" | "0xe7" | "0x5854" | "0x58d7" | "0xa7" | "0xab" | "0xa3" | "0xa0" | "0xa1" | "0xa2" | "0x75a1" | "0xa6" | "0xa5" | "0xee" | "0x9b" | "0xfa" | "0xfb" | "0xfd" | "0xa4" | "0x75a2" | "0x8e" | "0xe8" | "0xcc" | "0xcd" | "0xcb" | "0xce" | "0xcf" | "0xc8" | "0xc9" | "0xca" | "0xaf" | "0x1654ae6b" | "0xae" | "0xd7" | "0x73c5" | "0x83" | "0xb9" | "0x88" | "0x55aa" | "0x55ab" | "0x55ac" | "0x55ad" | "0x55ae" | "0x55af" | "0x9c" | "0x6de7" | "0x6df8" | "0x23e383" | "0x234e7a" | "0x23314f" | "0x537f" | "0x55ee" | "0x41e4" | "0x41f0" | "0x41a4" | "0x41e7" | "0x41ed" | "0x536e" | "0x22b59c" | "0x22b59d" | "0x86" | "0x63a2" | "0x258688" | "0x7446" | "0x3a9697" | "0x3b4040" | "0x26b240" | "0xaa" | "0x6fab" | "0x56aa" | "0x56bb" | "0x6624" | "0x66a5" | "0x66bf" | "0x66fc" | "0xe0" | "0x9a" | "0x9d" | "0x53b8" | "0x53c0" | "0x53b9" | "0xb0" | "0xba" | "0x54aa" | "0x54bb" | "0x54cc" | "0x54dd" | "0x54b0" | "0x54ba" | "0x54b2" | "0x54b3" | "0x2eb524" | "0x2fb523" | "0x2383e3" | "0x55b0" | "0x55b1" | "0x55b2" | "0x55b3" | "0x55b4" | "0x55b5" | "0x55b6" | "0x55b7" | "0x55b8" | "0x55b9" | "0x55ba" | "0x55bb" | "0x55bc" | "0x55bd" | "0x55d0" | "0x55d1" | "0x55d2" | "0x55d3" | "0x55d4" | "0x55d5" | "0x55d6" | "0x55d7" | "0x55d8" | "0x55d9" | "0x55da" | "0x7670" | "0x7671" | "0x7672" | "0x7673" | "0x7674" | "0x7675" | "0xe1" | "0xb5" | "0x78b5" | "0x9f" | "0x7d7b" | "0x6264" | "0x52f1" | "0xe2" | "0xe3" | "0xe4" | "0xe5" | "0xe6" | "0xe9" | "0xed" | "0xc0" | "0xc1" | "0xc6" | "0xc7" | "0xc4" | "0x6d80" | "0x6240" | "0x5031" | "0x5032" | "0x5033" | "0x5034" | "0x4254" | "0x4255" | "0x5035" | "0x47e1" | "0x47e2" | "0x47e7" | "0x47e8" | "0x47e3" | "0x47e4" | "0x47e5" | "0x47e6" | "0x1c53bb6b" | "0xbb" | "0xb3" | "0xb7" | "0xf7" | "0xf1" | "0xf0" | "0xb2" | "0x5378" | "0xea" | "0xdb" | "0x96" | "0x97" | "0x535f" | "0xeb" | "0x1941a469" | "0x61a7" | "0x467e" | "0x466e" | "0x4660" | "0x465c" | "0x46ae" | "0x4675" | "0x4661" | "0x4662" | "0x1043a770" | "0x45b9" | "0x45bc" | "0x45bd" | "0x45db" | "0x45dd" | "0x4520" | "0x4521" | "0x45e4" | "0xb6" | "0x73c4" | "0x5654" | "0x91" | "0x92" | "0x98" | "0x4598" | "0x6e67" | "0x4588" | "0x6ebc" | "0x63c3" | "0x8f" | "0x89" | "0x80" | "0x85" | "0x437c" | "0x437d" | "0x437e" | "0x6944" | "0x6955" | "0x450d" | "0x6911" | "0x6922" | "0x6933" | "0x1254c367" | "0x7373" | "0x63c0" | "0x68ca" | "0x63ca" | "0x63c5" | "0x63c9" | "0x63c4" | "0x63c6" | "0x67c8" | "0x45a3" | "0x447a" | "0x447b" | "0x4484" | "0x44b4" | "0x4487" | "0x4485" | "0xec" | "0xbf";
277
+ export type MatroskaKey = keyof typeof matroskaElements;
278
+ export type MatroskaElement = (typeof matroskaElements)[MatroskaKey];
279
+ type EbmlType = 'string';
280
+ export type EbmlWithChildren = {
281
+ name: MatroskaKey;
282
+ type: 'children';
283
+ children: HeaderStructure;
284
+ };
285
+ export type EbmlWithUint8 = {
286
+ name: MatroskaKey;
287
+ type: 'uint';
288
+ };
289
+ export type EbmlWithHexString = {
290
+ name: MatroskaKey;
291
+ type: 'hex-string';
292
+ };
293
+ export type EbmlWithString = {
294
+ name: MatroskaKey;
295
+ type: EbmlType;
296
+ };
297
+ export type EbmlWithVoid = {
298
+ name: MatroskaKey;
299
+ type: 'void';
300
+ };
301
+ export type EbmlWithFloat = {
302
+ name: MatroskaKey;
303
+ type: 'float';
304
+ };
305
+ export type Ebml = EbmlWithString | EbmlWithUint8 | EbmlWithChildren | EbmlWithVoid | EbmlWithFloat | EbmlWithHexString;
306
+ export declare const ebmlVersion: {
307
+ name: "EBMLVersion";
308
+ type: "uint";
309
+ };
310
+ export declare const ebmlReadVersion: {
311
+ name: "EBMLReadVersion";
312
+ type: "uint";
313
+ };
314
+ export declare const ebmlMaxIdLength: {
315
+ name: "EBMLMaxIDLength";
316
+ type: "uint";
317
+ };
318
+ export declare const ebmlMaxSizeLength: {
319
+ name: "EBMLMaxSizeLength";
320
+ type: "uint";
321
+ };
322
+ export declare const docType: {
323
+ name: "DocType";
324
+ type: "string";
325
+ };
326
+ export declare const docTypeVersion: {
327
+ name: "DocTypeVersion";
328
+ type: "uint";
329
+ };
330
+ export declare const docTypeReadVersion: {
331
+ name: "DocTypeReadVersion";
332
+ type: "uint";
333
+ };
334
+ export declare const voidEbml: {
335
+ name: "Void";
336
+ type: "void";
337
+ };
338
+ export type EmblTypes = {
339
+ uint: number;
340
+ float: number;
341
+ string: string;
342
+ children: HeaderStructure;
343
+ void: undefined;
344
+ 'hex-string': string;
345
+ };
346
+ export type HeaderStructure = Ebml[];
347
+ export declare const matroskaHeaderStructure: [{
348
+ name: "EBMLVersion";
349
+ type: "uint";
350
+ }, {
351
+ name: "EBMLReadVersion";
352
+ type: "uint";
353
+ }, {
354
+ name: "EBMLMaxIDLength";
355
+ type: "uint";
356
+ }, {
357
+ name: "EBMLMaxSizeLength";
358
+ type: "uint";
359
+ }, {
360
+ name: "DocType";
361
+ type: "string";
362
+ }, {
363
+ name: "DocTypeVersion";
364
+ type: "uint";
365
+ }, {
366
+ name: "DocTypeReadVersion";
367
+ type: "uint";
368
+ }];
369
+ export declare const matroskaHeader: {
370
+ readonly name: "Header";
371
+ readonly type: "children";
372
+ readonly children: [{
373
+ name: "EBMLVersion";
374
+ type: "uint";
375
+ }, {
376
+ name: "EBMLReadVersion";
377
+ type: "uint";
378
+ }, {
379
+ name: "EBMLMaxIDLength";
380
+ type: "uint";
381
+ }, {
382
+ name: "EBMLMaxSizeLength";
383
+ type: "uint";
384
+ }, {
385
+ name: "DocType";
386
+ type: "string";
387
+ }, {
388
+ name: "DocTypeVersion";
389
+ type: "uint";
390
+ }, {
391
+ name: "DocTypeReadVersion";
392
+ type: "uint";
393
+ }];
394
+ };
395
+ export declare const seekId: {
396
+ readonly name: "SeekID";
397
+ readonly type: "hex-string";
398
+ };
399
+ export declare const seekPosition: {
400
+ readonly name: "SeekPosition";
401
+ readonly type: "uint";
402
+ };
403
+ export declare const seek: {
404
+ readonly name: "Seek";
405
+ readonly type: "children";
406
+ readonly children: [{
407
+ readonly name: "SeekID";
408
+ readonly type: "hex-string";
409
+ }, {
410
+ readonly name: "SeekPosition";
411
+ readonly type: "uint";
412
+ }];
413
+ };
414
+ export declare const voidHeader: {
415
+ readonly name: "Void";
416
+ readonly type: "void";
417
+ };
418
+ export type EbmlValue<T extends Ebml> = T extends EbmlWithUint8 ? number : T extends EbmlWithVoid ? undefined : T extends EbmlWithString ? string : T extends EbmlWithFloat ? number : EbmlParsed<Ebml>[];
419
+ export type EbmlParsed<T extends Ebml> = {
420
+ type: T['name'];
421
+ value: EbmlValue<T>;
422
+ hex: string;
423
+ };
424
+ export declare const ebmlMap: {
425
+ readonly "0x1a45dfa3": {
426
+ readonly name: "Header";
427
+ readonly type: "children";
428
+ readonly children: [{
429
+ name: "EBMLVersion";
430
+ type: "uint";
431
+ }, {
432
+ name: "EBMLReadVersion";
433
+ type: "uint";
434
+ }, {
435
+ name: "EBMLMaxIDLength";
436
+ type: "uint";
437
+ }, {
438
+ name: "EBMLMaxSizeLength";
439
+ type: "uint";
440
+ }, {
441
+ name: "DocType";
442
+ type: "string";
443
+ }, {
444
+ name: "DocTypeVersion";
445
+ type: "uint";
446
+ }, {
447
+ name: "DocTypeReadVersion";
448
+ type: "uint";
449
+ }];
450
+ };
451
+ readonly "0x4282": {
452
+ name: "DocType";
453
+ type: "string";
454
+ };
455
+ readonly "0x4287": {
456
+ name: "DocTypeVersion";
457
+ type: "uint";
458
+ };
459
+ readonly "0x4285": {
460
+ name: "DocTypeReadVersion";
461
+ type: "uint";
462
+ };
463
+ readonly "0x4286": {
464
+ name: "EBMLVersion";
465
+ type: "uint";
466
+ };
467
+ readonly "0x42f7": {
468
+ name: "EBMLReadVersion";
469
+ type: "uint";
470
+ };
471
+ readonly "0x42f2": {
472
+ name: "EBMLMaxIDLength";
473
+ type: "uint";
474
+ };
475
+ readonly "0x42f3": {
476
+ name: "EBMLMaxSizeLength";
477
+ type: "uint";
478
+ };
479
+ readonly "0xec": {
480
+ name: "Void";
481
+ type: "void";
482
+ };
483
+ readonly "0x1c53bb6b": {
484
+ readonly name: "Cues";
485
+ readonly type: "void";
486
+ };
487
+ readonly "0x4461": {
488
+ readonly name: "DateUTC";
489
+ readonly type: "void";
490
+ };
491
+ readonly "0x23314f": {
492
+ readonly name: "TrackTimestampScale";
493
+ readonly type: "float";
494
+ };
495
+ readonly "0x56aa": {
496
+ readonly name: "CodecDelay";
497
+ readonly type: "void";
498
+ };
499
+ readonly "0x56bb": {
500
+ readonly name: "SeekPreRoll";
501
+ readonly type: "void";
502
+ };
503
+ readonly "0x75a2": {
504
+ readonly name: "DiscardPadding";
505
+ readonly type: "void";
506
+ };
507
+ readonly "0x78b5": {
508
+ readonly name: "OutputSamplingFrequency";
509
+ readonly type: "void";
510
+ };
511
+ readonly "0x258688": {
512
+ readonly name: "CodecName";
513
+ readonly type: "void";
514
+ };
515
+ readonly "0xa7": {
516
+ readonly name: "Position";
517
+ readonly type: "void";
518
+ };
519
+ readonly "0xcf": {
520
+ readonly name: "SliceDuration";
521
+ readonly type: "void";
522
+ };
523
+ };
524
+ export type PossibleEbml = {
525
+ [key in keyof typeof ebmlMap]: {
526
+ type: (typeof ebmlMap)[key]['name'];
527
+ value: EbmlValue<(typeof ebmlMap)[key]>;
528
+ hex: string;
529
+ };
530
+ }[keyof typeof ebmlMap];
531
+ export {};