@remotion/media-parser 4.0.201 → 4.0.202

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 (113) hide show
  1. package/dist/boxes/iso-base-media/mvhd.js +2 -2
  2. package/dist/boxes/iso-base-media/stsd/keys.js +1 -1
  3. package/dist/boxes/webm/av1-codec-private.js +1 -1
  4. package/dist/boxes/webm/description.d.ts +2 -2
  5. package/dist/boxes/webm/description.js +2 -2
  6. package/dist/boxes/webm/ebml.d.ts +2 -2
  7. package/dist/boxes/webm/ebml.js +23 -1
  8. package/dist/boxes/webm/get-ready-tracks.d.ts +1 -1
  9. package/dist/boxes/webm/get-ready-tracks.js +3 -3
  10. package/dist/boxes/webm/get-sample-from-block.d.ts +17 -0
  11. package/dist/boxes/webm/get-sample-from-block.js +78 -0
  12. package/dist/boxes/webm/get-track.d.ts +2 -2
  13. package/dist/boxes/webm/get-track.js +26 -25
  14. package/dist/boxes/webm/make-header.d.ts +3 -8
  15. package/dist/boxes/webm/make-header.js +43 -20
  16. package/dist/boxes/webm/parse-ebml.d.ts +9 -4
  17. package/dist/boxes/webm/parse-ebml.js +122 -13
  18. package/dist/boxes/webm/segments/all-segments.d.ts +421 -107
  19. package/dist/boxes/webm/segments/all-segments.js +260 -33
  20. package/dist/boxes/webm/segments/seek-position.js +1 -1
  21. package/dist/boxes/webm/segments/seek.d.ts +1 -1
  22. package/dist/boxes/webm/segments/seek.js +2 -8
  23. package/dist/boxes/webm/segments/timestamp-scale.js +1 -1
  24. package/dist/boxes/webm/segments/track-entry.d.ts +3 -191
  25. package/dist/boxes/webm/segments/track-entry.js +2 -456
  26. package/dist/boxes/webm/segments.d.ts +3 -16
  27. package/dist/boxes/webm/segments.js +12 -196
  28. package/dist/boxes/webm/traversal.d.ts +5 -6
  29. package/dist/boxes/webm/traversal.js +6 -6
  30. package/dist/buffer-iterator.d.ts +1 -1
  31. package/dist/buffer-iterator.js +3 -3
  32. package/dist/create/create-media.d.ts +2 -0
  33. package/dist/create/create-media.js +36 -0
  34. package/dist/create/matroska-header.d.ts +1 -0
  35. package/dist/create/matroska-header.js +66 -0
  36. package/dist/create/matroska-info.d.ts +4 -0
  37. package/dist/create/matroska-info.js +39 -0
  38. package/dist/create/matroska-segment.d.ts +1 -0
  39. package/dist/create/matroska-segment.js +12 -0
  40. package/dist/create/matroska-trackentry.d.ts +21 -0
  41. package/dist/create/matroska-trackentry.js +191 -0
  42. package/dist/create-media.d.ts +1 -0
  43. package/dist/create-media.js +78 -0
  44. package/dist/get-audio-codec.d.ts +1 -1
  45. package/dist/get-audio-codec.js +13 -13
  46. package/dist/get-duration.js +12 -14
  47. package/dist/get-tracks.js +2 -2
  48. package/dist/get-video-codec.js +13 -13
  49. package/dist/parse-media.js +4 -1
  50. package/dist/parser-context.d.ts +1 -0
  51. package/dist/parser-state.js +3 -2
  52. package/dist/readers/from-fetch.d.ts +2 -0
  53. package/dist/readers/from-fetch.js +64 -0
  54. package/dist/readers/from-node.d.ts +2 -0
  55. package/dist/readers/from-node.js +40 -0
  56. package/dist/readers/from-web-file.d.ts +2 -0
  57. package/dist/readers/from-web-file.js +39 -0
  58. package/dist/readers/reader.d.ts +11 -0
  59. package/dist/readers/reader.js +2 -0
  60. package/dist/traversal.d.ts +19 -17
  61. package/dist/traversal.js +38 -39
  62. package/dist/writers/web-fs.d.ts +2 -0
  63. package/dist/writers/web-fs.js +28 -0
  64. package/dist/writers/writer.d.ts +9 -0
  65. package/dist/writers/writer.js +2 -0
  66. package/input.webm +0 -0
  67. package/package.json +2 -2
  68. package/src/boxes/iso-base-media/mvhd.ts +2 -2
  69. package/src/boxes/iso-base-media/stsd/keys.ts +1 -1
  70. package/src/boxes/webm/av1-codec-private.ts +1 -1
  71. package/src/boxes/webm/description.ts +7 -4
  72. package/src/boxes/webm/ebml.ts +24 -4
  73. package/src/boxes/webm/get-ready-tracks.ts +4 -4
  74. package/src/boxes/webm/get-sample-from-block.ts +125 -0
  75. package/src/boxes/webm/get-track.ts +38 -31
  76. package/src/boxes/webm/make-header.ts +58 -51
  77. package/src/boxes/webm/parse-ebml.ts +170 -16
  78. package/src/boxes/webm/segments/all-segments.ts +379 -62
  79. package/src/boxes/webm/segments/track-entry.ts +3 -846
  80. package/src/boxes/webm/segments.ts +18 -410
  81. package/src/boxes/webm/traversal.ts +17 -17
  82. package/src/buffer-iterator.ts +5 -4
  83. package/src/get-audio-codec.ts +14 -16
  84. package/src/get-duration.ts +15 -16
  85. package/src/get-tracks.ts +2 -2
  86. package/src/get-video-codec.ts +13 -15
  87. package/src/parse-media.ts +6 -1
  88. package/src/parser-context.ts +1 -0
  89. package/src/parser-state.ts +2 -2
  90. package/src/test/create-matroska.test.ts +237 -23
  91. package/src/test/matroska.test.ts +283 -348
  92. package/src/test/mvhd.test.ts +1 -1
  93. package/src/test/parse-esds.test.ts +2 -2
  94. package/src/test/parse-stco.test.ts +2 -2
  95. package/src/test/parse-stsc.test.ts +2 -2
  96. package/src/test/parse-stsz.test.ts +2 -2
  97. package/src/test/parse-stts.test.ts +1 -1
  98. package/src/test/stsd.test.ts +4 -2
  99. package/src/test/tkhd.test.ts +1 -1
  100. package/src/traversal.ts +62 -85
  101. package/tsconfig.tsbuildinfo +1 -1
  102. package/src/boxes/webm/segments/duration.ts +0 -29
  103. package/src/boxes/webm/segments/info.ts +0 -34
  104. package/src/boxes/webm/segments/main.ts +0 -6
  105. package/src/boxes/webm/segments/muxing.ts +0 -18
  106. package/src/boxes/webm/segments/seek-head.ts +0 -34
  107. package/src/boxes/webm/segments/seek-position.ts +0 -18
  108. package/src/boxes/webm/segments/seek.ts +0 -55
  109. package/src/boxes/webm/segments/timestamp-scale.ts +0 -17
  110. package/src/boxes/webm/segments/tracks.ts +0 -32
  111. package/src/boxes/webm/segments/void.ts +0 -18
  112. package/src/boxes/webm/segments/writing.ts +0 -18
  113. package/src/combine-uint8array.ts +0 -13
@@ -1,3 +1,5 @@
1
+ import type {Prettify} from '../parse-ebml';
2
+
1
3
  export const matroskaElements = {
2
4
  Header: '0x1a45dfa3',
3
5
  EBMLMaxIDLength: '0x42f2',
@@ -290,7 +292,7 @@ export const getSegmentName = (id: string) => {
290
292
  )?.[0];
291
293
  };
292
294
 
293
- export const getIdForName = (name: string) => {
295
+ export const getIdForName = (name: string): EbmlMapKey => {
294
296
  const value = Object.entries(matroskaElements).find(
295
297
  ([key]) => key === name,
296
298
  )?.[1];
@@ -298,7 +300,7 @@ export const getIdForName = (name: string) => {
298
300
  throw new Error(`Could not find id for name ${name}`);
299
301
  }
300
302
 
301
- return value;
303
+ return value as EbmlMapKey;
302
304
  };
303
305
 
304
306
  export type MatroskaKey = keyof typeof matroskaElements;
@@ -310,10 +312,9 @@ type EbmlType = 'string';
310
312
  export type EbmlWithChildren = {
311
313
  name: MatroskaKey;
312
314
  type: 'children';
313
- children: HeaderStructure;
314
315
  };
315
316
 
316
- export type EbmlWithUint8 = {
317
+ export type EbmlWithUint = {
317
318
  name: MatroskaKey;
318
319
  type: 'uint';
319
320
  };
@@ -328,23 +329,23 @@ export type EbmlWithString = {
328
329
  type: EbmlType;
329
330
  };
330
331
 
331
- export type EbmlWithVoid = {
332
+ export type EbmlWithFloat = {
332
333
  name: MatroskaKey;
333
- type: 'void';
334
+ type: 'float';
334
335
  };
335
336
 
336
- export type EbmlWithFloat = {
337
+ export type EbmlWithUint8Array = {
337
338
  name: MatroskaKey;
338
- type: 'float';
339
+ type: 'uint8array';
339
340
  };
340
341
 
341
342
  export type Ebml =
342
343
  | EbmlWithString
343
- | EbmlWithUint8
344
+ | EbmlWithUint
344
345
  | EbmlWithChildren
345
- | EbmlWithVoid
346
346
  | EbmlWithFloat
347
- | EbmlWithHexString;
347
+ | EbmlWithHexString
348
+ | EbmlWithUint8Array;
348
349
 
349
350
  export const ebmlVersion = {
350
351
  name: 'EBMLVersion',
@@ -381,36 +382,24 @@ export const docTypeReadVersion = {
381
382
  type: 'uint',
382
383
  } satisfies Ebml;
383
384
 
384
- export const voidEbml = {
385
+ const voidEbml = {
385
386
  name: 'Void',
386
- type: 'void',
387
+ type: 'uint8array',
387
388
  } satisfies Ebml;
388
389
 
389
390
  export type EmblTypes = {
390
391
  uint: number;
391
392
  float: number;
392
393
  string: string;
393
- children: HeaderStructure;
394
+ children: Ebml[];
394
395
  void: undefined;
395
396
  'hex-string': string;
397
+ uint8array: Uint8Array;
396
398
  };
397
399
 
398
- export type HeaderStructure = Ebml[];
399
-
400
- export const matroskaHeaderStructure = [
401
- ebmlVersion,
402
- ebmlReadVersion,
403
- ebmlMaxIdLength,
404
- ebmlMaxSizeLength,
405
- docType,
406
- docTypeVersion,
407
- docTypeReadVersion,
408
- ] as const satisfies HeaderStructure;
409
-
410
400
  export const matroskaHeader = {
411
401
  name: 'Header',
412
402
  type: 'children',
413
- children: matroskaHeaderStructure,
414
403
  } as const satisfies Ebml;
415
404
 
416
405
  export const seekId = {
@@ -426,28 +415,285 @@ export const seekPosition = {
426
415
  export const seek = {
427
416
  name: 'Seek',
428
417
  type: 'children',
429
- children: [seekId, seekPosition],
418
+ } as const satisfies Ebml;
419
+
420
+ export const seekHead = {
421
+ name: 'SeekHead',
422
+ type: 'children',
430
423
  } as const satisfies Ebml;
431
424
 
432
425
  export const voidHeader = {
433
426
  name: 'Void',
434
- type: 'void',
427
+ type: 'uint8array',
428
+ } as const satisfies Ebml;
429
+
430
+ export const codecID = {
431
+ name: 'CodecID',
432
+ type: 'string',
433
+ } as const satisfies Ebml;
434
+
435
+ export const trackType = {
436
+ name: 'TrackType',
437
+ type: 'uint',
438
+ } as const satisfies Ebml;
439
+
440
+ export const widthType = {
441
+ name: 'PixelWidth',
442
+ type: 'uint',
443
+ } as const satisfies Ebml;
444
+
445
+ export const heightType = {
446
+ name: 'PixelHeight',
447
+ type: 'uint',
448
+ } as const satisfies Ebml;
449
+
450
+ export const muxingApp = {
451
+ name: 'MuxingApp',
452
+ type: 'string',
453
+ } as const satisfies Ebml;
454
+
455
+ export const duration = {
456
+ name: 'Duration',
457
+ type: 'float',
458
+ } as const satisfies Ebml;
459
+
460
+ export const timestampScale = {
461
+ name: 'TimestampScale',
462
+ type: 'uint',
463
+ } as const satisfies Ebml;
464
+
465
+ export const writingApp = {
466
+ name: 'WritingApp',
467
+ type: 'string',
468
+ } as const satisfies Ebml;
469
+
470
+ export const infoType = {
471
+ name: 'Info',
472
+ type: 'children',
473
+ } as const satisfies Ebml;
474
+
475
+ export const titleType = {
476
+ name: 'Title',
477
+ type: 'string',
478
+ } as const satisfies Ebml;
479
+
480
+ export const samplingFrequency = {
481
+ name: 'SamplingFrequency',
482
+ type: 'float',
483
+ } as const satisfies Ebml;
484
+
485
+ export const channels = {
486
+ name: 'Channels',
487
+ type: 'uint',
488
+ } as const satisfies Ebml;
489
+
490
+ export const alphaMode = {
491
+ name: 'AlphaMode',
492
+ type: 'uint',
493
+ } as const satisfies Ebml;
494
+
495
+ export const interlaced = {
496
+ name: 'FlagInterlaced',
497
+ type: 'uint',
498
+ } as const satisfies Ebml;
499
+
500
+ export const bitDepth = {
501
+ name: 'BitDepth',
502
+ type: 'uint',
503
+ } as const satisfies Ebml;
504
+
505
+ export const displayWidth = {
506
+ name: 'DisplayWidth',
507
+ type: 'uint',
508
+ } as const satisfies Ebml;
509
+
510
+ export const displayHeight = {
511
+ name: 'DisplayHeight',
512
+ type: 'uint',
513
+ } as const satisfies Ebml;
514
+
515
+ export const flagLacing = {
516
+ name: 'FlagLacing',
517
+ type: 'uint',
518
+ } as const satisfies Ebml;
519
+
520
+ export const tagSegment = {
521
+ name: 'Tag',
522
+ type: 'uint8array',
523
+ } as const satisfies Ebml;
524
+
525
+ export const tags = {
526
+ name: 'Tags',
527
+ type: 'children',
528
+ } as const satisfies Ebml;
529
+
530
+ export const trackNumber = {
531
+ name: 'TrackNumber',
532
+ type: 'uint',
435
533
  } as const satisfies Ebml;
436
534
 
437
- export type EbmlValue<T extends Ebml> = T extends EbmlWithUint8
438
- ? number
439
- : T extends EbmlWithVoid
440
- ? undefined
441
- : T extends EbmlWithString
442
- ? string
443
- : T extends EbmlWithFloat
444
- ? number
445
- : EbmlParsed<Ebml>[];
535
+ export const trackUID = {
536
+ name: 'TrackUID',
537
+ type: 'hex-string',
538
+ } as const satisfies Ebml;
539
+
540
+ export const color = {
541
+ name: 'Colour',
542
+ type: 'uint8array',
543
+ } as const satisfies Ebml;
544
+
545
+ export const language = {
546
+ name: 'Language',
547
+ type: 'string',
548
+ } as const satisfies Ebml;
549
+
550
+ export const defaultDuration = {
551
+ name: 'DefaultDuration',
552
+ type: 'uint',
553
+ } as const satisfies Ebml;
554
+
555
+ export const codecPrivate = {
556
+ name: 'CodecPrivate',
557
+ type: 'uint8array',
558
+ } as const satisfies Ebml;
559
+
560
+ export const blockAdditionsSegment = {
561
+ name: 'BlockAdditions',
562
+ type: 'uint8array',
563
+ } as const satisfies Ebml;
564
+
565
+ export const maxBlockAdditionIdSegment = {
566
+ name: 'MaxBlockAdditionID',
567
+ type: 'uint',
568
+ } as const satisfies Ebml;
569
+
570
+ export const audioSegment = {
571
+ name: 'Audio',
572
+ type: 'children',
573
+ } as const satisfies Ebml;
574
+
575
+ export const videoSegment = {
576
+ name: 'Video',
577
+ type: 'children',
578
+ } as const satisfies Ebml;
579
+
580
+ export const flagDefault = {
581
+ name: 'FlagDefault',
582
+ type: 'uint8array',
583
+ } as const satisfies Ebml;
584
+
585
+ export const referenceBlock = {
586
+ name: 'ReferenceBlock',
587
+ type: 'uint',
588
+ } as const satisfies Ebml;
589
+
590
+ export const blockElement = {
591
+ name: 'Block',
592
+ type: 'uint8array',
593
+ } as const satisfies Ebml;
594
+
595
+ export const codecName = {
596
+ name: 'CodecName',
597
+ type: 'string',
598
+ } as const satisfies Ebml;
599
+
600
+ export const trackTimestampScale = {
601
+ name: 'TrackTimestampScale',
602
+ type: 'float',
603
+ } as const satisfies Ebml;
604
+
605
+ export const trackEntry = {
606
+ name: 'TrackEntry',
607
+ type: 'children',
608
+ } as const satisfies Ebml;
609
+
610
+ export const tracks = {
611
+ name: 'Tracks',
612
+ type: 'children',
613
+ } as const satisfies Ebml;
614
+
615
+ export const timestampEntry = {
616
+ name: 'Timestamp',
617
+ type: 'uint',
618
+ } as const satisfies Ebml;
619
+
620
+ export const block = {
621
+ name: 'Block',
622
+ type: 'uint8array',
623
+ } as const satisfies Ebml;
624
+
625
+ export const simpleBlock = {
626
+ name: 'SimpleBlock',
627
+ type: 'uint8array',
628
+ } as const satisfies Ebml;
629
+
630
+ export const blockGroup = {
631
+ name: 'BlockGroup',
632
+ type: 'children',
633
+ } as const satisfies Ebml;
634
+
635
+ export const segment = {
636
+ name: 'Segment',
637
+ type: 'children',
638
+ } as const satisfies Ebml;
639
+
640
+ export const cluster = {
641
+ name: 'Cluster',
642
+ type: 'children',
643
+ } as const satisfies Ebml;
644
+
645
+ export type CodecIdSegment = EbmlParsed<typeof codecID>;
646
+ export type TrackTypeSegment = EbmlParsed<typeof trackType>;
647
+ export type WidthSegment = EbmlParsed<typeof widthType>;
648
+ export type HeightSegment = EbmlParsed<typeof heightType>;
649
+ export type TimestampScaleSegment = EbmlParsed<typeof timestampScale>;
650
+ export type DurationSegment = EbmlParsed<typeof duration>;
651
+ export type DisplayWidthSegment = EbmlParsed<typeof displayWidth>;
652
+ export type DisplayHeightSegment = EbmlParsed<typeof displayHeight>;
653
+ export type TrackNumberSegment = EbmlParsed<typeof trackNumber>;
654
+ export type AudioSegment = EbmlParsed<typeof audioSegment>;
655
+ export type VideoSegment = EbmlParsed<typeof videoSegment>;
656
+ export type TrackEntry = EbmlParsed<typeof trackEntry>;
657
+ export type BlockSegment = EbmlParsed<typeof block>;
658
+ export type SimpleBlockSegment = EbmlParsed<typeof simpleBlock>;
659
+ export type MainSegment = EbmlParsed<typeof segment>;
660
+ export type ClusterSegment = EbmlParsed<typeof cluster>;
661
+ export type Tracks = EbmlParsed<typeof tracks>;
662
+
663
+ export type FloatWithSize = {value: number; size: '32' | '64'};
664
+ export type UintWithSize = {value: number; byteLength: number};
665
+
666
+ export type EbmlValue<
667
+ T extends Ebml,
668
+ Child = PossibleEbml,
669
+ > = T extends EbmlWithUint
670
+ ? UintWithSize
671
+ : T extends EbmlWithString
672
+ ? string
673
+ : T extends EbmlWithFloat
674
+ ? FloatWithSize
675
+ : T extends EbmlWithHexString
676
+ ? string
677
+ : T extends EbmlWithUint8Array
678
+ ? Uint8Array
679
+ : T extends EbmlWithChildren
680
+ ? Child[]
681
+ : never;
682
+
683
+ export type EbmlValueOrUint8Array<T extends Ebml> =
684
+ | Uint8Array
685
+ | EbmlValue<T, PossibleEbmlOrUint8Array>;
446
686
 
447
687
  export type EbmlParsed<T extends Ebml> = {
448
688
  type: T['name'];
449
689
  value: EbmlValue<T>;
450
- hex: string;
690
+ minVintWidth: number;
691
+ };
692
+
693
+ export type EbmlParsedOrUint8Array<T extends Ebml> = {
694
+ type: T['name'];
695
+ value: EbmlValueOrUint8Array<T>;
696
+ minVintWidth: number;
451
697
  };
452
698
 
453
699
  export const ebmlMap = {
@@ -462,50 +708,121 @@ export const ebmlMap = {
462
708
  [matroskaElements.Void]: voidEbml,
463
709
  [matroskaElements.Cues]: {
464
710
  name: 'Cues',
465
- type: 'void',
711
+ type: 'uint8array',
466
712
  },
467
713
  [matroskaElements.DateUTC]: {
468
714
  name: 'DateUTC',
469
- type: 'void',
470
- },
471
- [matroskaElements.TrackTimestampScale]: {
472
- name: 'TrackTimestampScale',
473
- type: 'float',
715
+ type: 'uint8array',
474
716
  },
717
+ [matroskaElements.TrackTimestampScale]: trackTimestampScale,
475
718
  [matroskaElements.CodecDelay]: {
476
719
  name: 'CodecDelay',
477
- type: 'void',
720
+ type: 'uint8array',
478
721
  },
479
722
  [matroskaElements.SeekPreRoll]: {
480
723
  name: 'SeekPreRoll',
481
- type: 'void',
724
+ type: 'uint8array',
482
725
  },
483
726
  [matroskaElements.DiscardPadding]: {
484
727
  name: 'DiscardPadding',
485
- type: 'void',
728
+ type: 'uint8array',
486
729
  },
487
730
  [matroskaElements.OutputSamplingFrequency]: {
488
731
  name: 'OutputSamplingFrequency',
489
- type: 'void',
490
- },
491
- [matroskaElements.CodecName]: {
492
- name: 'CodecName',
493
- type: 'void',
732
+ type: 'uint8array',
494
733
  },
734
+ [matroskaElements.CodecName]: codecName,
495
735
  [matroskaElements.Position]: {
496
736
  name: 'Position',
497
- type: 'void',
737
+ type: 'uint8array',
498
738
  },
499
739
  [matroskaElements.SliceDuration]: {
500
740
  name: 'SliceDuration',
501
- type: 'void',
741
+ type: 'uint8array',
742
+ },
743
+ [matroskaElements.SeekHead]: seekHead,
744
+ [matroskaElements.Seek]: seek,
745
+ [matroskaElements.SeekID]: seekId,
746
+ [matroskaElements.SeekPosition]: seekPosition,
747
+ [matroskaElements.Crc32]: {
748
+ name: 'Crc32',
749
+ type: 'uint8array',
750
+ },
751
+ [matroskaElements.MuxingApp]: muxingApp,
752
+ [matroskaElements.WritingApp]: {
753
+ name: 'WritingApp',
754
+ type: 'string',
755
+ },
756
+ [matroskaElements.SegmentUUID]: {
757
+ name: 'SegmentUUID',
758
+ type: 'string',
759
+ },
760
+ [matroskaElements.Duration]: duration,
761
+ [matroskaElements.CodecID]: {
762
+ name: 'CodecID',
763
+ type: 'string',
764
+ },
765
+ [matroskaElements.TrackType]: trackType,
766
+ [matroskaElements.PixelWidth]: widthType,
767
+ [matroskaElements.PixelHeight]: heightType,
768
+ [matroskaElements.TimestampScale]: timestampScale,
769
+ [matroskaElements.Info]: infoType,
770
+ [matroskaElements.Title]: titleType,
771
+ [matroskaElements.SamplingFrequency]: samplingFrequency,
772
+ [matroskaElements.Channels]: channels,
773
+ [matroskaElements.AlphaMode]: alphaMode,
774
+ [matroskaElements.FlagInterlaced]: interlaced,
775
+ [matroskaElements.BitDepth]: bitDepth,
776
+ [matroskaElements.DisplayHeight]: displayHeight,
777
+ [matroskaElements.DisplayWidth]: displayWidth,
778
+ [matroskaElements.FlagLacing]: flagLacing,
779
+ [matroskaElements.Tags]: tags,
780
+ [matroskaElements.Tag]: tagSegment,
781
+ [matroskaElements.TrackNumber]: trackNumber,
782
+ [matroskaElements.TrackUID]: trackUID,
783
+ [matroskaElements.Colour]: color,
784
+ [matroskaElements.Language]: language,
785
+ [matroskaElements.DefaultDuration]: defaultDuration,
786
+ [matroskaElements.CodecPrivate]: codecPrivate,
787
+ [matroskaElements.BlockAdditions]: blockAdditionsSegment,
788
+ [matroskaElements.MaxBlockAdditionID]: maxBlockAdditionIdSegment,
789
+ [matroskaElements.Audio]: audioSegment,
790
+ [matroskaElements.Video]: videoSegment,
791
+ [matroskaElements.FlagDefault]: flagDefault,
792
+ [matroskaElements.ReferenceBlock]: referenceBlock,
793
+ [matroskaElements.TrackEntry]: trackEntry,
794
+ [matroskaElements.Timestamp]: {
795
+ name: 'Timestamp',
796
+ type: 'uint',
797
+ },
798
+ [matroskaElements.Tracks]: tracks,
799
+ [matroskaElements.Block]: block,
800
+ [matroskaElements.SimpleBlock]: simpleBlock,
801
+ [matroskaElements.BlockGroup]: blockGroup,
802
+ [matroskaElements.Segment]: {
803
+ name: 'Segment',
804
+ type: 'children',
805
+ },
806
+ [matroskaElements.Cluster]: {
807
+ name: 'Cluster',
808
+ type: 'children',
502
809
  },
503
810
  } as const satisfies Partial<Record<MatroskaElement, Ebml>>;
504
811
 
505
- export type PossibleEbml = {
506
- [key in keyof typeof ebmlMap]: {
507
- type: (typeof ebmlMap)[key]['name'];
508
- value: EbmlValue<(typeof ebmlMap)[key]>;
509
- hex: string;
510
- };
511
- }[keyof typeof ebmlMap];
812
+ export type PossibleEbml = Prettify<
813
+ {
814
+ [key in keyof typeof ebmlMap]: EbmlParsed<(typeof ebmlMap)[key]>;
815
+ }[keyof typeof ebmlMap]
816
+ >;
817
+
818
+ export type PossibleEbmlOrUint8Array =
819
+ | Prettify<
820
+ {
821
+ [key in keyof typeof ebmlMap]: EbmlParsedOrUint8Array<
822
+ (typeof ebmlMap)[key]
823
+ >;
824
+ }[keyof typeof ebmlMap]
825
+ >
826
+ | Uint8Array;
827
+
828
+ export type EbmlMapKey = keyof typeof ebmlMap;