From 6df4f5e1deadb5ddbc59800d8e80167f5713b286 Mon Sep 17 00:00:00 2001 From: lonelyhentxi Date: Fri, 21 Mar 2025 01:53:06 +0800 Subject: [PATCH] feat: support matroska v4 and add codegen --- .gitignore | 4 +- README.md | 1 + assets/specification/ebml.xml | 77 + assets/specification/ebml_mkv.xml | 2477 ++++++++++++++++++++++ assets/specification/ebml_mkv_legacy.xml | 671 ++++++ biome.jsonc | 33 +- package.json | 16 +- pnpm-lock.yaml | 31 + rslib.config.ts | 8 +- scripts/codegen.ts | 384 ++++ src/decoder.ts | 2 +- src/encoder.ts | 2 +- src/factory.ts | 31 +- src/index.ts | 79 +- src/models/enums.ts | 1659 ++++++++------- src/models/schema.ts | 368 ---- src/models/tag-data.ts | 12 +- src/models/{tag.ts => tag-union.ts} | 2377 ++++++++++++--------- src/tools.ts | 12 +- tests/decoder.spec.ts | 2 +- tests/value.spec.ts | 6 +- tsconfig.json | 9 +- tsconfig.lib.json | 10 +- tsconfig.scripts.json | 13 + vitest.config.ts | 1 + 25 files changed, 6121 insertions(+), 2164 deletions(-) create mode 100644 assets/specification/ebml.xml create mode 100644 assets/specification/ebml_mkv.xml create mode 100644 assets/specification/ebml_mkv_legacy.xml create mode 100644 scripts/codegen.ts delete mode 100644 src/models/schema.ts rename src/models/{tag.ts => tag-union.ts} (75%) create mode 100644 tsconfig.scripts.json diff --git a/.gitignore b/.gitignore index 7913f61..bb0cd6c 100644 --- a/.gitignore +++ b/.gitignore @@ -191,4 +191,6 @@ lib/ **/target /.vitest **/dist -**/*.tsbuildinfo \ No newline at end of file +/lib +**/*.tsbuildinfo +**/temp \ No newline at end of file diff --git a/README.md b/README.md index 2b59ee2..2a3c271 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ This package is serving as a fork with extensive rewrites and enhancements to [ebml-web-stream][ebml-web-stream] and [ebml-stream][ebml-stream], providing: +- support new [ebml_matroska(v4)](https://github.com/cellar-wg/matroska-specification/blob/master/ebml_matroska.xml) while also support [legacy version](https://github.com/pymedusa/Medusa/blob/d99638720355ef047857735876ec37adcb6a94a5/ext/enzyme/parsers/ebml/specs/matroska.xml). - better [unknown size vint][unknown size vint] support - bigint support for vint, unsigned and signed int data type - better type system and type hints that depend on it diff --git a/assets/specification/ebml.xml b/assets/specification/ebml.xml new file mode 100644 index 0000000..5518827 --- /dev/null +++ b/assets/specification/ebml.xml @@ -0,0 +1,77 @@ + + + Set the EBML characteristics of the data to + follow. Each EBML document has to start with this. + + + The version of EBML parser used to create the + file. + + + The minimum EBML version a parser has to + support to read this file. + + + The maximum length of the IDs you'll find in + this file (4 or less in Matroska). + + + The maximum length of the sizes you'll find in + this file (8 or less in Matroska). This does not override the element size indicated at + the beginning of an element. Elements that have an indicated size which is larger than + what is allowed by EBMLMaxSizeLength shall be considered invalid. + + + A string that describes the type of document + that follows this EBML header, for example 'matroska' or 'webm'. + + + The version of DocType interpreter used to + create the file. + + + The minimum DocType version an interpreter has + to support to read this file. + + + A DocTypeExtension adds extra Elements to the + main DocType+DocTypeVersion tuple it's attached to. An EBML Reader **MAY** know these + extra Elements and how to use them. A DocTypeExtension **MAY** be used to iterate + between experimental Elements before they are integrated into a regular DocTypeVersion. + Reading one DocTypeExtension version of a DocType+DocTypeVersion tuple doesn't imply one + should be able to read upper versions of this DocTypeExtension. + + + The name of the DocTypeExtension to + differentiate it from other DocTypeExtensions of the same DocType+DocTypeVersion tuple. + A DocTypeExtensionName value **MUST** be unique within the EBML Header. + + + The version of the DocTypeExtension. Different + DocTypeExtensionVersion values of the same DocType + DocTypeVersion + + DocTypeExtensionName tuple **MAY** contain completely different sets of extra Elements. + An EBML Reader **MAY** support multiple versions of the same tuple, only one version of + the tuple, or not support the tuple at all. + + + + Used to void damaged data, to avoid unexpected + behaviors when using damaged data. The content is discarded. Also used to reserve space + in a sub-element for later use. + + + The CRC is computed on all the data of the + Master element it's in. The CRC element should be the first in it's parent master for + easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE + CRC32 Little Endian. + + \ No newline at end of file diff --git a/assets/specification/ebml_mkv.xml b/assets/specification/ebml_mkv.xml new file mode 100644 index 0000000..80dd5c3 --- /dev/null +++ b/assets/specification/ebml_mkv.xml @@ -0,0 +1,2477 @@ + + + + + + + The `Root Element` that contains all other + `Top-Level Elements`; see (#data-layout). + + + + Contains seeking information of `Top-Level + Elements`; see (#data-layout). + + + + Contains a single seek entry to an EBML + Element. + + + + The binary EBML ID of a `Top-Level Element`. + + + + The `Segment Position` ((#segment-position)) + of a `Top-Level Element`. + + + + Contains general information about the + `Segment`. + + + + A randomly generated UID that identifies the + `Segment` amongst many others (128 bits). It is equivalent to a Universally Unique + Identifier (UUID) v4 [@!RFC9562] with all bits randomly (or pseudorandomly) chosen. An + actual UUID v4 value, where some bits are not random, **MAY** also be used. + If the `Segment` is a part of a `Linked + Segment`, then this element is **REQUIRED**. + The value of the UID **MUST** contain at least one bit set to 1. + + + + A filename corresponding to this `Segment`. + + + An ID that identifies the previous `Segment` + of a `Linked Segment`. + If the `Segment` is a part of a `Linked + Segment` that uses + Hard Linking ((#hard-linking)), then either the + `PrevUUID` or the `NextUUID` element is + **REQUIRED**. If a `Segment` contains a `PrevUUID` + but not a `NextUUID`, then it **MAY** be considered as the + last `Segment` of the `Linked Segment`. The `PrevUUID` + **MUST NOT** be equal to the `SegmentUUID`. + + + + A filename corresponding to the file of the + previous `Linked Segment`. + Provision of the previous filename is for + display convenience, + but `PrevUUID` **SHOULD** be considered authoritative for identifying the previous + `Segment` in a `Linked Segment`. + + + An ID that identifies the next `Segment` of a + `Linked Segment`. + If the `Segment` is a part of a `Linked + Segment` that uses Hard Linking ((#hard-linking)), + then either the `PrevUUID` or the `NextUUID` element is **REQUIRED**. If a `Segment` + contains a `NextUUID` but not a `PrevUUID`, then it **MAY** be considered as the first + `Segment` of the `Linked Segment`. The `NextUUID` **MUST NOT** be equal to the + `SegmentUUID`. + + + + A filename corresponding to the file of the + next `Linked Segment`. + Provision of the next filename is for display + convenience, + but `NextUUID` **SHOULD** be considered authoritative for identifying the Next + `Segment`. + + + A UID that all `Segments` of a `Linked + Segment` **MUST** share (128 bits). It is equivalent to a UUID v4 [@!RFC9562] with all + bits randomly (or pseudorandomly) chosen. An actual UUID v4 value, where some bits are + not random, **MAY** also be used. + If the `Segment` `Info` contains a + `ChapterTranslate` element, this element is **REQUIRED**. + + + The mapping between this `Segment` and a + segment value in the given Chapter Codec. + Chapter Codecs may need to address different + segments, but they may not know of the way to identify such segments when stored in + Matroska. + This element and its child elements add a way to map the internal segments known to the + Chapter Codec to the `SegmentUUID`s in Matroska. + This allows remuxing a file with Chapter Codec without changing the content of the codec + data, just the `Segment` mapping. + + + The binary value used to represent this + `Segment` in the chapter codec data. + The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element). + + + Applies to the chapter codec of the given + chapter edition(s); see (#chapprocesscodecid-element). + + + + Specifies a chapter edition UID to which this + `ChapterTranslate` applies. + When no `ChapterTranslateEditionUID` is + specified in the `ChapterTranslate`, the `ChapterTranslate` applies to all chapter + editions found in the `Segment` using the given `ChapterTranslateCodec`. + + + Base unit for Segment Ticks and Track Ticks, + in nanoseconds. A `TimestampScale` value of 1000000 means scaled timestamps in the + `Segment` are expressed in milliseconds; see (#timestamps) on how to interpret + timestamps. + + + + + Duration of the `Segment`, expressed in + `Segment` Ticks, which are based on `TimestampScale`; see (#timestamp-ticks). + + + + The date and time that the `Segment` was + created by the muxing application or library. + + + + General name of the `Segment`. + + + + Muxing application or library (example: + "libmatroska-0.4.3"). + Include the full name of the application or + library followed by the version number. + + + + Writing application (example: + "mkvmerge-0.3.3"). + Include the full name of the application + followed by the version number. + + + + The `Top-Level Element` containing the + (monolithic) `Block` structure. + + + + Absolute timestamp of the cluster, expressed + in Segment Ticks, which are based on `TimestampScale`; see (#timestamp-ticks). + This element **SHOULD** be the first child + element of the `Cluster` it belongs to + or the second if that `Cluster` contains a `CRC-32` element ((#crc-32)). + + + + + The list of tracks that are not used in that + part of the stream. + It is useful when using overlay tracks for seeking or deciding what track to use. + + + + One of the track numbers that is not used from + now on in the stream. + It could change later if not specified as silent in a further `Cluster`. + + + + The `Segment Position` of the `Cluster` in the + `Segment` (0 in live streams). + It might help to resynchronize the offset on damaged streams. + + + + Size of the previous `Cluster`, in octets. Can + be useful for backward playing. + + + + + Similar to `Block` (see (#block-structure)) + but without all the extra information. + Mostly used to reduce overhead when no extra feature is needed; see + (#simpleblock-structure) on `SimpleBlock` Structure. + + + + + Basic container of information containing a + single `Block` and information specific to that `Block`. + + + + `Block` containing the actual data to be + rendered and a timestamp relative to the `Cluster` Timestamp; + see (#block-structure) on `Block` Structure. + + + + A `Block` with no data. It must be stored in + the stream at the place the real `Block` would be in display order. + + + + Contains additional binary data to complete + the `Block` element; see [@?I-D.ietf-cellar-codec, section 4.1.5] for more information. + An EBML parser that has no knowledge of the `Block` structure could still see and + use/skip these data. + + + + Contains the `BlockAdditional` and some + parameters. + + + + Interpreted by the codec as it wishes (using + the `BlockAddID`). + + + + An ID that identifies how to interpret the + `BlockAdditional` data; see [@?I-D.ietf-cellar-codec, section 4.1.5] for + more information. A value of 1 indicates that the `BlockAdditional` data is + defined by the codec. Any other value indicates that the `BlockAdditional` data + should be handled according to the `BlockAddIDType` that is located in the + `TrackEntry`. + Each `BlockAddID` value **MUST** be unique + between all `BlockMore` elements found in a `BlockAdditions` element. To keep + `MaxBlockAdditionID` as low as possible, small values **SHOULD** be used. + + + + The duration of the `Block`, expressed in + Track Ticks; see (#timestamp-ticks). + The `BlockDuration` element can be useful + at the end of a `Track` to define the duration of the last frame (as + there is no subsequent `Block` available) or when there is a break in a + track like for subtitle tracks. + `BlockDuration` **MUST** be set + (minOccurs=1) if the associated `TrackEntry` stores a `DefaultDuration` value. + If a value is not present and no + `DefaultDuration` is defined, the value is assumed to be the difference between the + timestamp of this `Block` and the timestamp of the next `Block` in "display" order (not + coding order). + + + + This frame is referenced and has the specified + cache priority. + In the cache, only a frame of the same or higher priority can replace this frame. A + value of 0 means the frame is not referenced. + + + A timestamp value, relative to the timestamp + of the `Block` in this `BlockGroup`, expressed in Track Ticks; see (#timestamp-ticks). + This is used to reference other frames necessary to decode this frame. + The relative value **SHOULD** correspond to a valid `Block` that this `Block` depends + on. + Historically, `Matroska Writers` didn't write the actual `Block(s)` that this `Block` + depends on, but they did write *some* `Block(s)` in the past. + + The value "0" **MAY** also be used to signify that this `Block` cannot be decoded on its + own, but the necessary reference `Block(s)` is unknown. In this case, other + `ReferenceBlock` elements **MUST NOT** be found in the same `BlockGroup`. If the + `BlockGroup` doesn't have a `ReferenceBlock` element, then the `Block` it contains can + be decoded without using any other `Block` data. + + + + The `Segment Position` of the data that would + otherwise be in position of the virtual block. + + + The new codec state to use. Data + interpretation is private to the codec. + This information **SHOULD** always be referenced by a seek entry. + + + Duration of the silent data added to the + `Block`, expressed in + Matroska Ticks -- i.e., in nanoseconds; see (#timestamp-ticks) + (padding at the end of the `Block` for positive values and at the + beginning of the `Block` for negative values). The duration of + `DiscardPadding` is not calculated in the duration of the + `TrackEntry` and **SHOULD** be discarded during + playback. + + + + Contains slices description. + + + Contains extra time information about the data + contained in the `Block`. + Being able to interpret this element is not required for playback. + + + The reverse number of the frame in the lace (0 + is the last frame, 1 is the next to last, etc.). + Being able to interpret this element is not required for playback. + + + + The number of the frame to generate from this + lace with this delay + (allows for the generation of many frames from the same Block/Frame). + + + + The ID of the `BlockAdditional` element (0 is + the main `Block`). + + + + The delay to apply to the element, expressed + in Track Ticks; see (#timestamp-ticks). + + + + The duration to apply to the element, + expressed in Track Ticks; see (#timestamp-ticks). + + + Contains information about the last reference + frame. See [@?DivXTrickTrack]. + + + + The relative offset, in bytes, from the + previous `BlockGroup` element for this Smooth FF/RW video track to the containing + `BlockGroup` + element. See [@?DivXTrickTrack]. + + + + The timestamp of the `BlockGroup` pointed to + by ReferenceOffset, expressed in Track Ticks; see (#timestamp-ticks). See + [@?DivXTrickTrack]. + + + + + Similar to `SimpleBlock` (see + (#simpleblock-structure)), + but the data inside the `Block` are Transformed (encrypted and/or signed). + + + A `Top-Level Element` of information with many + tracks described. + + + + Describes a track with all elements. + + + + The track number as used in the `Block` + Header. + + + + A UID that identifies the `Track`. + + + + + The `TrackType` defines the type of each frame + found in the `Track`. + The value **SHOULD** be stored on 1 octet. + + + + An image. + + + Audio samples. + + + A mix of different other `TrackType`. + The codec needs to define how the `Matroska Player` should interpret such data. + + + An image to be rendered over the video + track(s). + + + Subtitle or closed caption data to be + rendered over the video track(s). + + + Interactive button(s) to be rendered + over the video track(s). + + + Metadata used to control the player of + the `Matroska Player`. + + + Timed metadata that can be passed on + to the `Matroska Player`. + + + + + + + Set to 1 if the track is usable. It is + possible to turn a track that is not usable into a usable track using chapter codecs or + control tracks. + + + + + Set to 1 if the track (audio, video, or + subtitles) is eligible for automatic selection by the player; see + (#default-track-selection) for more details. + + + + + Applies only to subtitles. Set to 1 if the + track is eligible for automatic selection by the player if it matches the user's + language preference, + even if the user's preferences would not normally enable subtitles with the selected + audio track; + this can be used for tracks containing only translations of audio in foreign languages + or on-screen text. + See (#default-track-selection) for more details. + + + + + Set to 1 if and only if the track is suitable + for users with hearing impairments. + + + Set to 1 if and only if the track is suitable + for users with visual impairments. + + + Set to 1 if and only if the track contains + textual descriptions of video content. + + + Set to 1 if and only if the track is in the + content's original language. + + + Set to 1 if and only if the track contains + commentary. + + + Set to 1 if the track **MAY** contain blocks + that use lacing. + When set to 0, all blocks **MUST** have their lacing flags set to "no lacing"; see + (#block-lacing) on 'Block' Lacing. + + + + + The minimum number of frames a player should + be able to cache during playback. + If set to 0, the reference pseudo-cache system is not used. + + + + The maximum cache size necessary to store + referenced frames in and the current frame. + 0 means no cache is needed. + + + + Number of nanoseconds per frame, expressed in + Matroska Ticks -- i.e., in nanoseconds; see (#timestamp-ticks) + ("frame" in the Matroska sense -- one element put into a (Simple)Block). + + + + + + The period between two successive fields at + the output of the decoding process, expressed in Matroska Ticks -- i.e., in nanoseconds; + see (#timestamp-ticks). + See (#defaultdecodedfieldduration) for more information. + + + + + The scale to apply on this track to work at + normal speed in relation with other tracks + (mostly used to adjust video speed when the audio length differs). + + + + + A value to add to the `Block`'s Timestamp, + expressed in Matroska Ticks -- i.e., in nanoseconds; see (#timestamp-ticks). + This can be used to adjust the playback offset of a track. + + + + The maximum value of `BlockAddID` + ((#blockaddid-element)). + A value of 0 means there is no `BlockAdditions` ((#blockadditions-element)) for this + track. + + + Contains elements that extend the track format + by adding content either to each frame, + with `BlockAddID` ((#blockaddid-element)), or to the track as a whole + with `BlockAddIDExtraData`. + + + If the track format extension needs content + beside frames, + the value refers to the `BlockAddID` ((#blockaddid-element)) value being described. + To keep `MaxBlockAdditionID` as low as + possible, small values **SHOULD** be used. + + + A human-friendly name describing the type of + `BlockAdditional` data, + as defined by the associated `Block Additional Mapping`. + + + Stores the registered identifier of the `Block + Additional Mapping` + to define how the `BlockAdditional` data should be handled. + If `BlockAddIDType` is 0, the + `BlockAddIDValue` and corresponding `BlockAddID` values **MUST** be 1. + + + Extra binary data that the `BlockAddIDType` + can use to interpret the `BlockAdditional` data. + The interpretation of the binary data depends on the `BlockAddIDType` value and the + corresponding `Block Additional Mapping`. + + + A human-readable track name. + + + + + The language of the track, + in the Matroska languages form; see (#language-codes) on language codes. + This element **MUST** be ignored if the `LanguageBCP47` element is used in the same + `TrackEntry`. + + + + + The language of the track, + in the form defined in [@!RFC5646]; see (#language-codes) on language codes. + If this element is used, then any `Language` elements used in the same `TrackEntry` + **MUST** be ignored. + + + + An ID corresponding to the codec; + see [@?I-D.ietf-cellar-codec] for more info. + + + + + Private data only known to the codec. + + + + + A human-readable string specifying the codec. + + + + The UID of an attachment that is used by this + codec. + The value **MUST** match the `FileUID` value + of an attachment found in this `Segment`. + + + + A string describing the encoding setting used. + + + A URL to find information about the codec + used. + + + A URL to download information about the codec + used. + + + Set to 1 if the codec can decode potentially + damaged data. + + + Specify that this track is an overlay track + for the `Track` specified (in the u-integer). + This means that when this track has a gap on `SilentTracks`, the overlay track should be + used instead. The order of multiple `TrackOverlay` matters; the first one is the one + that should be used. + If the first one is not found, it should be the second, etc. + + + The built-in delay for the codec, expressed in + Matroska Ticks -- i.e., in nanoseconds; see (#timestamp-ticks). + It represents the number of codec samples that will be discarded by the decoder during + playback. + This timestamp value **MUST** be subtracted from each frame timestamp in order to get + the timestamp that will be actually played. + The value **SHOULD** be small so the muxing of tracks with the same actual timestamp are + in the same `Cluster`. + + + + + After a discontinuity, the duration of the + data + that the decoder **MUST** decode before the decoded data is valid, expressed in Matroska + Ticks -- i.e., in nanoseconds; see (#timestamp-ticks). + + + + + The mapping between this `TrackEntry` and a + track value in the given Chapter Codec. + Chapter Codecs may need to address content in a + specific track, but they may not know of the way to identify tracks in Matroska. + This element and its child elements add a way to map the internal tracks known to the + Chapter Codec to the track IDs in Matroska. + This allows remuxing a file with Chapter Codec without changing the content of the codec + data, just the track mapping. + + + The binary value used to represent this + `TrackEntry` in the chapter codec data. + The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element). + + + Applies to the chapter codec of the given + chapter edition(s); see (#chapprocesscodecid-element). + + + + Specifies a chapter edition UID to which this + `TrackTranslate` applies. + When no `TrackTranslateEditionUID` is + specified in the `TrackTranslate`, the `TrackTranslate` applies to all chapter editions + found in the `Segment` using the given `TrackTranslateCodec`. + + + Video settings. + + + + + Specifies whether the video frames in this + track are interlaced. + + + Unknown status. + This value **SHOULD** be avoided. + + + Interlaced frames. + + + No interlacing. + + + + + + + + Specifies the field ordering of video frames + in this track. + If `FlagInterlaced` is not set to 1, this + element **MUST** be ignored. + + + Interlaced frames. + This value **SHOULD** be avoided; + setting `FlagInterlaced` to 2 is sufficient. + + + Top field displayed first. Top field + stored first. + + + Unknown field order. + This value **SHOULD** be avoided. + + + Bottom field displayed first. Bottom + field stored first. + + + Top field displayed first. Fields are + interleaved in storage with the top line of the top field stored first. + + + Bottom field displayed first. Fields + are interleaved in storage with the top line of the top field stored first. + + + + + + + Stereo-3D video mode. See + (#multi-planar-and-3d-videos) for more details. + + + + + + + + + + + + + + + + + + + + + + + + Indicates whether the `BlockAdditional` + element with `BlockAddID` of "1" + contains Alpha data as defined by the Codec Mapping for the `CodecID`. + Undefined values (i.e., values other than 0 or 1) **SHOULD NOT** be used, as the + behavior of known implementations is different. + + + + The `BlockAdditional` element with + `BlockAddID` of "1" does not exist or **SHOULD NOT** be considered as containing + such data. + + + The `BlockAdditional` element with + `BlockAddID` of "1" contains alpha channel data. + + + + + + + + + Bogus `StereoMode` value used in old versions + of [@?libmatroska]. + This element **MUST NOT** be used. It was an + incorrect value used in libmatroska up to 0.9.0. + + + + + + + + + Width of the encoded video frames in pixels. + + + + + + Height of the encoded video frames in pixels. + + + + + + The number of video pixels to remove at the + bottom of the image. + + + + + + The number of video pixels to remove at the + top of the image. + + + + + + The number of video pixels to remove on the + left of the image. + + + + + + The number of video pixels to remove on the + right of the image. + + + + + + Width of the video frames to display. Applies + to the video frame after cropping (PixelCrop* Elements). + If the DisplayUnit of the same `TrackEntry` is + 0, then the default value for `DisplayWidth` is equal to `PixelWidth` - `PixelCropLeft` + - `PixelCropRight`; else, there is no default value. + + + + + + Height of the video frames to display. Applies + to the video frame after cropping (PixelCrop* Elements). + If the DisplayUnit of the same `TrackEntry` is + 0, then the default value for `DisplayHeight` is equal to `PixelHeight` - `PixelCropTop` + - `PixelCropBottom`; else, there is no default value. + + + + + + How `DisplayWidth` and `DisplayHeight` are + interpreted. + + + + + + + + + + + + + Specifies the possible modifications to the + aspect ratio. + + + + + + + + + Specifies the uncompressed pixel format used + for the `Track`'s data as a FourCC. + This value is similar in scope to the biCompression value of AVI's `BITMAPINFO` + [@?AVIFormat]. There is neither a definitive list of FourCC values nor an official + registry. Some common values for YUV pixel formats can be found at [@?MSYUV8], + [@?MSYUV16], and [@?FourCC-YUV]. Some common values for uncompressed RGB pixel formats + can be found at [@?MSRGB] and [@?FourCC-RGB]. + UncompressedFourCC **MUST** be set + (minOccurs=1) in `TrackEntry` when the `CodecID` element of the `TrackEntry` is set to + "V_UNCOMPRESSED". + + + + + Gamma value. + + + + Number of frames per second. This value is + informational only. It is intended for constant frame rate streams and should not be + used for a variable frame rate `TrackEntry`. + + + + Settings describing the color format. + + + + + + The Matrix Coefficients of the video used to + derive luma and chroma values from red, green, and blue color primaries. + For clarity, the value and meanings for `MatrixCoefficients` are adopted from Table 4 of + [@!ITU-H.273]. + + + + + + + + + + + + + + + + + + + + + + + Number of decoded bits per channel. A value of + 0 indicates that the `BitsPerChannel` is unspecified. + + + + + + The number of pixels to remove in the Cr and + Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 + chroma subsampling, the `ChromaSubsamplingHorz` + **SHOULD** be set to 1. + + + + + + The number of pixels to remove in the Cr and + Cb channels for every pixel not removed vertically. + Example: For video with 4:2:0 chroma subsampling, the `ChromaSubsamplingVert` + **SHOULD** be set to 1. + + + + + + The number of pixels to remove in the Cb + channel for every pixel not removed horizontally. + This is additive with `ChromaSubsamplingHorz`. + Example: For video with 4:2:1 chroma + subsampling, the `ChromaSubsamplingHorz` **SHOULD** be set to 1, and `CbSubsamplingHorz` + **SHOULD** be set to 1. + + + + + + The number of pixels to remove in the Cb + channel for every pixel not removed vertically. + This is additive with `ChromaSubsamplingVert`. + + + + + + How chroma is subsampled horizontally. + + + + + + + + + + + + How chroma is subsampled vertically. + + + + + + + + + + + + Clipping of the color ranges. + + + + + + + + + + + + + The transfer characteristics of the video. For + clarity, + the value and meanings for `TransferCharacteristics` are adopted from Table 3 of + [@!ITU-H.273]. + + + + + + + + + + + + + + + + + + + + + + + + + + + The color primaries of the video. For clarity, + the value and meanings for `Primaries` are adopted from Table 2 of [@!ITU-H.273]. + + + + + + + + + + + + + + + + + + + + + + Maximum brightness of a single pixel (Maximum + Content Light Level) + in candelas per square meter (cd/m^2^). + + + + + + Maximum brightness of a single full frame + (Maximum Frame-Average Light Level) + in candelas per square meter (cd/m^2^). + + + + + + SMPTE 2086 mastering data. + + + + + + Red X chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + Red Y chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + Green X chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + Green Y chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + Blue X chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + Blue Y chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + White X chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + White Y chromaticity coordinate, as defined by + [@!CIE-1931]. + + + + + + Maximum luminance. Represented in candelas per + square meter (cd/m^2^). + + + + + + Minimum luminance. Represented in candelas per + square meter (cd/m^2^). + + + + + + Describes the video projection details. Used + to render spherical or VR videos or to flip videos horizontally or vertically. + + + + + + Describes the projection used for this video + track. + + + + + + + + + + + + + Private data that only applies to a specific + projection. + * If `ProjectionType` equals 0 (rectangular), + then this element **MUST NOT** be present. + * If `ProjectionType` equals 1 (equirectangular), then this element **MUST** be present + and contain the same binary data that would be stored inside + an ISOBMFF Equirectangular Projection Box ("equi"). + * If `ProjectionType` equals 2 (cubemap), then this element **MUST** be present and + contain the same binary data that would be stored + inside an ISOBMFF Cubemap Projection Box ("cbmp"). + * If `ProjectionType` equals 3 (mesh), then this element **MUST** be present and contain + the same binary data that would be stored inside + an ISOBMFF Mesh Projection Box ("mshp"). + ISOBMFF box size and FourCC fields are not + included in the binary data, + but the FullBox version and flag fields are. This is to avoid + redundant framing information while preserving versioning and semantics between the two + container formats. + + + + + + Specifies a yaw rotation to the projection. + Value represents a clockwise rotation, in degrees, around the up vector. This rotation + must be applied + before any `ProjectionPosePitch` or `ProjectionPoseRoll` rotations. + The value of this element **MUST** be in the -180 to 180 degree range, both inclusive. + Setting `ProjectionPoseYaw` to 180 or -180 degrees with `ProjectionPoseRoll` and + `ProjectionPosePitch` set to 0 degrees flips the image horizontally. + + + + + + Specifies a pitch rotation to the projection. + Value represents a counter-clockwise rotation, in degrees, around the right vector. This + rotation must be applied + after the `ProjectionPoseYaw` rotation and before the `ProjectionPoseRoll` rotation. + The value of this element **MUST** be in the -90 to 90 degree range, both inclusive. + + + + + + Specifies a roll rotation to the projection. + Value represents a + counter-clockwise rotation, in degrees, around the forward vector. This + rotation must be applied after the `ProjectionPoseYaw` and + `ProjectionPosePitch` rotations. The value of this element + **MUST** be in the -180 to 180 degree range, both inclusive. Setting + `ProjectionPoseRoll` to 180 or -180 degrees and + `ProjectionPoseYaw` to 180 or -180 degrees with + `ProjectionPosePitch` set to 0 degrees flips the image vertically. + Setting `ProjectionPoseRoll` to 180 or -180 degrees with + `ProjectionPoseYaw` and `ProjectionPosePitch` set to 0 degrees + flips the image horizontally and vertically. + + + + + + Audio settings. + + + + + Sampling frequency in Hz. + + + + + + Real output sampling frequency in Hz that is + used for Spectral Band Replication (SBR) techniques. + The default value for + `OutputSamplingFrequency` of the same `TrackEntry` is equal to the `SamplingFrequency`. + + + + + Numbers of channels in the track. + + + + + + Table of horizontal angles for each successive + channel. + + + + Bits per sample, mostly used for PCM. + + + + + + Audio emphasis applied on audio samples. The + player **MUST** apply the inverse emphasis to get the proper audio samples. + + + + First order filter with zero point at + 50 microseconds and a pole at 15 microseconds. Also found on DVD Audio and MPEG + audio. + + + + Defined in [@!ITU-J.17]. + + + FM Radio in Europe. RC Filter with a + time constant of 50 microseconds. + + + FM Radio in the USA. RC Filter with a + time constant of 75 microseconds. + + + Phono filter with time constants of + t1=3180, t2=318 and t3=75 microseconds. [@!NAB1964] + + + Phono filter with time constants of + t1=3180, t2=450 and t3=50 microseconds. + + + Phono filter with time constants of + t1=3180, t2=318 and t3=50 microseconds. + + + Phono filter with time constants of + t1=2500, t2=500 and t3=70 microseconds. + + + Phono filter with time constants of + t1=1590, t2=318 and t3=100 microseconds. + + + Phono filter with time constants of + t1=1590, t2=318 and t3=50 microseconds. + + + Phono filter with time constants of + t1=3180, t2=318 and t3=100 microseconds. + + + + + + Operation that needs to be applied on tracks + to create this virtual track. For more details, see (#track-operation). + + + + Contains the list of all video plane tracks + that need to be combined to create this 3D track. + + + + Contains a video plane track that needs to be + combined to create this 3D track. + + + + The `TrackUID` number of the track + representing the plane. + + + + The kind of plane this track corresponds to. + + + + + + + + + + Contains the list of all tracks whose `Blocks` + need to be combined to create this virtual track. + + + + The `TrackUID` number of a track whose blocks + are used to create this virtual track. + + + + The `TrackUID` of the Smooth FF/RW video in + the paired EBML structure corresponding to this video track. See [@?DivXTrickTrack]. + + + + The `SegmentUUID` of the `Segment` containing + the track identified by TrickTrackUID. See [@?DivXTrickTrack]. + + + + Set to 1 if this video track is a Smooth FF/RW + track. If set to 1, `MasterTrackUID` and `MasterTrackSegUID` should be present, and + `BlockGroups` for this track must contain ReferenceFrame structures. + Otherwise, TrickTrackUID and TrickTrackSegUID must be present if this track has a + corresponding Smooth FF/RW track. See [@?DivXTrickTrack]. + + + + The `TrackUID` of the video track in the + paired EBML structure that corresponds to this Smooth FF/RW track. See + [@?DivXTrickTrack]. + + + + The `SegmentUUID` of the `Segment` containing + the track identified by MasterTrackUID. See [@?DivXTrickTrack]. + + + + Settings for several content encoding + mechanisms like compression or encryption. + + + + + Settings for one content encoding like + compression or encryption. + + + + + Defines the order to apply each + `ContentEncoding` of the `ContentEncodings`. + The decoder/demuxer **MUST** start with the `ContentEncoding` with the highest + `ContentEncodingOrder` and work its way down to the `ContentEncoding` with the lowest + `ContentEncodingOrder`. + This value **MUST** be unique for each `ContentEncoding` found in the `ContentEncodings` + of this `TrackEntry`. + + + + + A bit field that describes which elements have + been modified in this way. Values (big-endian) can be OR'ed. + + + + All frame contents, excluding lacing + data. + + + The track's `CodecPrivate` data. + + + The next ContentEncoding (next + `ContentEncodingOrder`; the data inside `ContentCompression` and/or + `ContentEncryption`). + This value **SHOULD NOT** be used, as + it's not supported by players. + + + + + + + A value describing the kind of transformation + that is applied. + + + + + + + + + + Settings describing the compression used. + This element **MUST** be present if the value of `ContentEncodingType` is 0 and absent + otherwise. + Each block **MUST** be decompressable, even if no previous block is available in order + to not prevent seeking. + + + + The compression algorithm used. + Compression method "1" (bzlib) and "2" + (lzo1x) lack proper documentation on the format, which limits implementation + possibilities. Due to licensing conflicts on commonly available libraries' compression + methods, "2" (lzo1x) does not offer widespread interoperability. A `Matroska Writer` + **SHOULD NOT** use these compression methods by default. A `Matroska Reader` **MAY** + support methods "1" and "2" and **SHOULD** support other methods. + + + + zlib compression [@!RFC1950]. + + + bzip2 compression [@?BZIP2] **SHOULD + NOT** be used; see usage notes. + + + Lempel-Ziv-Oberhumer compression + [@?LZO] **SHOULD NOT** be used; see usage notes. + + + Octets in `ContentCompSettings` + ((#contentcompsettings-element)) have been stripped from each frame. + + + + + + Settings that might be needed by the + decompressor. For Header Stripping (`ContentCompAlgo`=3), + the bytes that were removed from the beginning of each frame of the track. + + + + Settings describing the encryption used. + This element **MUST** be present if the value of `ContentEncodingType` is 1 (encryption) + and **MUST** be ignored otherwise. + A `Matroska Player` **MAY** support encryption. + + + + + The encryption algorithm used. + + + + The data are not encrypted. + + + Data Encryption Standard (DES) + [@?FIPS46-3]. + This value **SHOULD** be avoided. + + + Triple Data Encryption Algorithm + [@?SP800-67]. + This value **SHOULD** be avoided. + + + Twofish Encryption Algorithm + [@?Twofish]. + + + Blowfish Encryption Algorithm + [@?Blowfish]. + This value **SHOULD** be avoided. + + + Advanced Encryption Standard (AES) + [@?FIPS197]. + + + + + + + For public key algorithms, the ID of the + public key that the data was encrypted with. + + + + + Settings describing the encryption algorithm + used. + ContentEncAESSettings **MUST NOT** be set + (maxOccurs=0) if ContentEncAlgo is not AES (5). + + + + + The AES cipher mode used in the encryption. + AESSettingsCipherMode **MUST NOT** be set + (maxOccurs=0) if ContentEncAlgo is not AES (5). + + + + Counter [@?SP800-38A] + + + Cipher Block Chaining [@?SP800-38A] + + + + + + + A cryptographic signature of the contents. + + + This is the ID of the private key that the + data was signed with. + + + The algorithm used for the signature. + + + + + + + The hash algorithm used for the signature. + + + + + + + + A `Top-Level Element` to speed seeking access. + All entries are + local to the `Segment`. + This element **SHOULD** be set when the + `Segment` is not transmitted as a live stream; see (#livestreaming). + + + + Contains all information relative to a seek + point in the `Segment`. + + + + Absolute timestamp of the seek point, + expressed in Segment Ticks, which are based on `TimestampScale`; see (#timestamp-ticks). + + + + Contains positions for different tracks + corresponding to the timestamp. + + + + The track for which a position is given. + + + + The `Segment Position` ((#segment-position)) + of the `Cluster` containing the associated `Block`. + + + + The relative position inside the `Cluster` of + the referenced `SimpleBlock` or `BlockGroup` + with 0 being the first possible position for an element inside that `Cluster`. + + + + The duration of the block, expressed in + Segment Ticks, which are based on `TimestampScale`; see (#timestamp-ticks). + If missing, the track's `DefaultDuration` does not apply and no duration information is + available in terms of the cues. + + + + Number of the `Block` in the specified + `Cluster`. + + + + The `Segment Position` ((#segment-position)) + of the + Codec State corresponding to this `Cues` element. 0 means that the + data is taken from the initial `TrackEntry`. + + + The `Clusters` containing the referenced + `Blocks`. + + + Timestamp of the referenced `Block`, expressed + in Segment Ticks which is based on `TimestampScale`; see (#timestamp-ticks). + + + The `Segment Position` of the `Cluster` + containing the referenced `Block`. + + + Number of the referenced `Block` of Track X in + the specified `Cluster`. + + + The `Segment Position` of the Codec State + corresponding to this referenced element. + 0 means that the data is taken from the initial `TrackEntry`. + + + Contains attached files. + + + An attached file. + + + + A human-friendly name for the attached file. + + + Filename of the attached file. + + + Media type of the file following the format + described in [@!RFC6838]. + + + + + The data of the file. + + + + UID representing the file, as random as + possible. + + + + A binary value that a track/codec can refer to + when the attachment is needed. + + + The timestamp at which this optimized font + attachment comes into context, expressed in Segment Ticks, which are based on + `TimestampScale`. See [@?DivXWorldFonts]. + This element is reserved for future use and + if written **MUST** be the segment start timestamp. + + + + The timestamp at which this optimized font + attachment goes out of context, expressed in Segment Ticks, which are based on + `TimestampScale`. See [@?DivXWorldFonts]. + This element is reserved for future use and + if written **MUST** be the segment end timestamp. + + + + A system to define basic menus and partition + data. + For more detailed information, see (#chapters). + + + + Contains all information about a `Segment` + edition. + + + + A UID that identifies the edition. It's useful + for tagging an edition. + + + + Set to 1 if an edition is hidden. Hidden + editions **SHOULD NOT** be available to the user interface + (but still be available to Control Tracks; see (#chapter-flags) on `Chapter` flags). + + + + Set to 1 if the edition **SHOULD** be used as + the default one. + + + Set to 1 if the chapters can be defined + multiple times and the order to play them is enforced; see (#editionflagordered). + + + Contains a possible string to use for the + edition display for the given languages. + + + Contains the string to use as the edition + name. + + + One language corresponding to the + EditionString, + in the form defined in [@!RFC5646]; see (#language-codes) on language codes. + + + Contains the atom information to use as the + chapter atom (applies to all tracks). + + + + A UID that identifies the `Chapter`. + + + + + A unique string ID that identifies the + `Chapter`. + For example, it is used as the storage for cue identifier values [@?WebVTT]. + + + + Timestamp of the start of `Chapter`, expressed + in Matroska Ticks -- i.e., in nanoseconds; see (#timestamp-ticks). + + + + Timestamp of the end of `Chapter` (timestamp + excluded), expressed in Matroska Ticks -- i.e., in nanoseconds; see (#timestamp-ticks). + The value **MUST** be greater than or equal to the `ChapterTimeStart` of the same + `ChapterAtom`. + With the `ChapterTimeEnd` timestamp value + being excluded, it **MUST** take into account the duration of + the last frame it includes, especially for the `ChapterAtom` using the last frames of + the `Segment`. + ChapterTimeEnd **MUST** be set (minOccurs=1) + if the `Edition` is an ordered edition; see (#editionflagordered). If it's a `Parent + Chapter`, see (#nested-chapters). + + + + Set to 1 if a chapter is hidden. + Hidden chapters **SHOULD NOT** be available to the user interface + (but still be available to Control Tracks; see (#chapterflaghidden) on `Chapter` flags). + + + Set to 1 if the chapter is enabled. It can be + enabled/disabled by a Control Track. + When disabled, the movie **SHOULD** skip all the content between the TimeStart and + TimeEnd of this chapter; see (#chapter-flags) on `Chapter` flags. + + + + The `SegmentUUID` of another `Segment` to play + during this chapter. + The value **MUST NOT** be the `SegmentUUID` + value of the `Segment` it belongs to. + `ChapterSegmentUUID` **MUST** be set + (minOccurs=1) if `ChapterSegmentEditionUID` is used; see (#medium-linking) on + Medium-Linking `Segments`. + + + + Indicates what type of content the + `ChapterAtom` contains and might be skipped. + It can be used to automatically skip content based on the type. + If a `ChapterAtom` is inside a `ChapterAtom` that has a `ChapterSkipType` set, it + **MUST NOT** have a `ChapterSkipType` or have a `ChapterSkipType` with the same value as + it's parent `ChapterAtom`. + If the `ChapterAtom` doesn't contain a `ChapterTimeEnd`, the value of the + `ChapterSkipType` is only valid until the next `ChapterAtom` with a `ChapterSkipType` + value or the end of the file. + + + + + Content which should not be skipped. + + + Credits usually found at the beginning + of the content. + + + Credits usually found at the end of + the content. + + + Recap of previous episodes of the + content, usually found around the beginning. + + + Preview of the next episode of the + content, usually found around the end. It may contain spoilers the user wants to + avoid. + + + Preview of the current episode of the + content, usually found around the beginning. It may contain spoilers the user + want to avoid. + + + Advertisement within the content. + + + A pause of content between main parts + of the content. + + + + + The `EditionUID` to play from the `Segment` + linked in `ChapterSegmentUUID`. + If `ChapterSegmentEditionUID` is undeclared, then no `Edition` of the `Linked Segment` + is used; see (#medium-linking) on Medium-Linking `Segments`. + + + Specifies the physical equivalent of this + `ChapterAtom`, e.g., "DVD" (60) or "SIDE" (50); + see (#physical-types) for a complete list of values. + + + List of tracks on which the chapter applies. + If this element is not present, all tracks apply. + + + + UID of the `Track` to apply this chapter to. + In the absence of a control track, choosing this chapter will select the listed `Tracks` + and deselect unlisted tracks. + Absence of this element indicates that the `Chapter` **SHOULD** be applied to any + currently used `Tracks`. + + + + + Contains all possible strings to use for the + chapter display. + + + + Contains the string to use as the chapter + atom. + + + + + A language corresponding to the string, + in the Matroska languages form; see (#language-codes) on language codes. + This element **MUST** be ignored if a `ChapLanguageBCP47` element is used within the + same `ChapterDisplay` element. + + + + + A language corresponding to the `ChapString`, + in the form defined in [@!RFC5646]; see (#language-codes) on language codes. + If a `ChapLanguageBCP47` element is used, then any `ChapLanguage` and `ChapCountry` + elements used in the same `ChapterDisplay` **MUST** be ignored. + + + + A country corresponding to the string, + in the Matroska countries form; see (#country-codes) on country codes. + This element **MUST** be ignored if a `ChapLanguageBCP47` element is used within the + same `ChapterDisplay` element. + + + + + Contains all the commands associated with the + Atom. + + + + Contains the type of the codec used for + processing. + + + + Chapter commands using the Matroska + Script codec. + + + Chapter commands using the DVD-like + codec. + + + + + + Optional data attached to the + `ChapProcessCodecID` information. + For `ChapProcessCodecID` = 1, it is the "DVD level" equivalent; see (#menu-features) on + DVD menus. + + + + Contains all the commands associated with the + Atom. + + + + Defines when the process command **SHOULD** be + handled. + + + + + + + + + Contains the command information. + The data **SHOULD** be interpreted depending on the `ChapProcessCodecID` value. For + `ChapProcessCodecID` = 1, + the data correspond to the binary DVD cell pre/post commands; see (#menu-features) on + DVD menus. + + + + Element containing metadata describing + `Tracks`, `Editions`, `Chapters`, `Attachments`, or the `Segment` as a whole. + A list of valid tags can be found in [@?I-D.ietf-cellar-tags]. + + + + A single metadata descriptor. + + + + Specifies which other elements the metadata + represented by the tag value applies to. + If empty or omitted, then the tag value describes everything in the `Segment`. + + + + + A number to indicate the logical level of the + target. + The `TargetTypeValue` values are meant to be + compared. + Higher values **MUST** correspond to a logical level that contains the lower logical + level `TargetTypeValue` values. + + + + The lowest hierarchy found in music or + movies. + + + Corresponds to parts of a track for + audio, such as a movement or scene in a movie. + + + The common parts of an album or movie. + + + When an album or episode has different + logical parts. + + + The most common grouping level of + music and video (e.g., an episode for TV series). + + + A list of lower levels grouped + together. + + + The highest hierarchical level that + tags can describe. + + + + + + + An informational string that can be used to + display the logical level of the target, such as "ALBUM", "TRACK", "MOVIE", "CHAPTER", + etc. + + + + + + + + + + + + + + + + + + + + + + + + + + + + A UID that identifies the `Track(s)` that the + tags belong to. + If the value is 0 at this level, the tags + apply to all tracks in the `Segment`. + If set to any other value, it **MUST** match the `TrackUID` value of a track found in + this `Segment`. + + + + A UID that identifies the `EditionEntry(s)` + that the tags belong to. + If the value is 0 at this level, the tags + apply to all editions in the `Segment`. + If set to any other value, it **MUST** match the `EditionUID` value of an edition found + in this `Segment`. + + + A UID that identifies the `Chapter(s)` that + the tags belong to. + If the value is 0 at this level, the tags + apply to all chapters in the `Segment`. + If set to any other value, it **MUST** match the `ChapterUID` value of a chapter found + in this `Segment`. + + + A UID that identifies the Attachment(s) that + the tags belong to. + If the value is 0 at this level, the tags + apply to all the attachments in + the `Segment`. If set to any other value, it **MUST** match + the `FileUID` value of an attachment found in this `Segment`. + + + Contains general information about the target. + + + + + The name of the tag value that is going to be + stored. + + + + Specifies the language of the specified tag in + the Matroska languages form; see (#language-codes) on language codes. + This element **MUST** be ignored if the `TagLanguageBCP47` element is used within the + same `SimpleTag` element. + + + + + The language used in the `TagString`, + in the form defined in [@!RFC5646]; see (#language-codes) on language codes. + If this element is used, then any `TagLanguage` elements used in the same `SimpleTag` + **MUST** be ignored. + + + + A boolean value to indicate if this is the + default/original language to use for the given tag. + + + + A variant of the `TagDefault` element with a + bogus element ID; see (#tagdefault-element). + + + The tag value. + + + + The tag value if it is binary. Note that this + cannot be used in the same `SimpleTag` as `TagString`. + + + \ No newline at end of file diff --git a/assets/specification/ebml_mkv_legacy.xml b/assets/specification/ebml_mkv_legacy.xml new file mode 100644 index 0000000..794ae8e --- /dev/null +++ b/assets/specification/ebml_mkv_legacy.xml @@ -0,0 +1,671 @@ + + + Set the EBML characteristics of the data to follow. Each EBML document has to + start with this. + The version of EBML parser used to create the file. + The minimum EBML version a parser has to support to read this file. + The maximum length of the IDs you'll find in this file (4 or less in Matroska). + The maximum length of the sizes you'll find in this file (8 or less + in Matroska). This does not override the element size indicated at the beginning of an + element. Elements that have an indicated size which is larger than what is allowed by + EBMLMaxSizeLength shall be considered invalid. + A string that describes the type of document that follows this EBML header. + 'matroska' in our case or 'webm' for webm files. + The version of DocType interpreter used to create the file. + The minimum DocType version an interpreter has to support to read + this file. + Used to void damaged data, to + avoid unexpected behaviors when using damaged data. The content is discarded. Also used to + reserve space in a sub-element for later use. + The CRC is + computed on all the data of the Master element it's in. The CRC element should be the first + in it's parent master for easier reading. All level 1 elements should include a CRC-32. The + CRC in use is the IEEE CRC32 Little Endian + Contain + signature of some (coming) elements in the stream. + Signature algorithm + used (1=RSA, 2=elliptic). + Hash algorithm used + (1=SHA1-160, 2=MD5). + The public key + to use with the algorithm (in the case of a PKI-based signature). + The signature of the data + (until a new. + Contains elements + that will be used to compute the signature. + A + list consists of a number of consecutive elements that represent one case where data is used + in signature. Ex: Cluster|Block|BlockAdditional means that the BlockAdditional of all + Blocks in all Clusters is used for encryption. + An + element ID whose data will be used to compute the signature. + This element contains all other top-level (level 1) elements. Typically a + Matroska file is composed of 1 segment. + Contains the position + of other level 1 elements. + Contains a single seek entry to an EBML element. + The binary + ID corresponding to the element name. + The position + of the element in the segment in octets (0 = first level 1 element). + Contains miscellaneous general information and statistics on the file. + A randomly generated unique ID to identify the current segment between many + others (128 bits). + A + filename corresponding to this segment. + A + unique ID to identify the previous chained segment (128 bits). + An escaped + filename corresponding to the previous segment. + A + unique ID to identify the next chained segment (128 bits). + An escaped + filename corresponding to the next segment. + A randomly generated unique ID that all segments related to each + other must use (128 bits). + A tuple of corresponding ID used by chapter codecs to represent this segment. + Specify an edition UID on which this correspondance applies. When not + specified, it means for all editions found in the segment. + The chapter + codec using this ID (0: Matroska Script, 1: DVD-menu). + The binary value used to represent this segment in the chapter codec data. The + format depends on the + ChapProcessCodecID used. + Timecode scale in nanoseconds (1.000.000 means all timecodes in the + segment are expressed in milliseconds). + + Duration + of the segment (based on TimecodeScale). + Date of the origin of + timecode (value 0), i.e. production date. + General name of the + segment. + Muxing + application or library ("libmatroska-0.4.3"). + Writing + application ("mkvmerge-0.3.3"). + The + lower level element containing the (monolithic) Block structure. + Absolute timecode of the cluster (based on TimecodeScale). + The list of tracks that are not used in that part of the stream. It is + useful when using overlay tracks on seeking. Then you should decide what track to use. + One of the track number that are not used + from now on in the stream. It could change later if not specified as silent in a further + Cluster. + The Position + of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise + offset on damaged streams. + Size of the previous Cluster, in octets. Can be useful for backward playing. + Similar to Block + but without all the extra information, mostly used to reduced overhead when no extra feature + is needed. (see SimpleBlock + Structure) + Basic + container of information containing a single Block or BlockVirtual, and information specific + to that Block/VirtualBlock. + Block + containing the actual data to be rendered and a timecode relative to the Cluster Timecode. + (see Block + Structure) + A Block with no data. It + must be stored in the stream at the place the real Block should be in display order. (see Block Virtual + ) + Contain + additional blocks to complete the main one. An EBML parser that has no knowledge of the + Block structure could still see and use/skip these data. + Contain the BlockAdditional and some parameters. + An ID to identify the BlockAdditional level. + Interpreted by the codec as it wishes (using the BlockAddID). + The duration of the Block (based on TimecodeScale). This element is + mandatory when DefaultDuration is set for the track (but can be omitted as other default + values). When not written and with no DefaultDuration, the value is assumed to be the + difference between the timecode of this Block and the timecode of the next Block in + "display" order (not coding order). This element can be useful at the end of a Track (as + there is not other Block available), or when there is a break in a track like for subtitle + tracks. When set to 0 that means the frame is not a keyframe. + This frame is referenced and has the specified + cache priority. In cache only a frame of the same or higher priority can replace this frame. + A value of 0 means the frame is not referenced. + Timecode + of another frame used as a reference (ie: B or P frame). The timecode is relative to the + block it's attached to. + Relative position + of the data that should be in position of the virtual block. + The new codec + state to use. Data interpretation is private to the codec. This information should always be + referenced by a seek entry. + Contains slices + description. + Contains + extra time information about the data contained in the Block. While there are a few files in + the wild with this element, it is no longer in use and has been deprecated. Being able to + interpret this element is not required for playback. + The reverse number of the frame in the lace (0 is the last + frame, 1 is the next to last, etc). While there are a few files in the wild with this + element, it is no longer in use and has been deprecated. Being able to interpret this + element is not required for playback. + The number of the frame to generate from this lace with this delay (allow you to + generate many frames from the same Block/Frame). + The ID of the BlockAdditional element (0 is the main Block). + The + (scaled) delay to apply to the element. + The (scaled) + duration to apply to the element. + + DivX + trick track extenstions + + + DivX + trick track extenstions + + + DivX + trick track extenstions + + Similar + to SimpleBlock + but the data inside the Block are Transformed (encrypt and/or signed). (see EncryptedBlock + Structure) + A + top-level block of information with many tracks described. + Describes a track with all elements. + The track number as used in the Block Header (using more than 127 tracks is + not encouraged, though the design allows an unlimited number). + A unique ID to identify the Track. This should be kept the same when making a + direct stream copy of the Track to another file. + A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: + logo, 0x11: subtitle, 0x12: buttons, 0x20: control). + Set if the track is usable. (1 + bit) + Set if that track (audio, video or subs) + SHOULD be active if no language found matches the user preference. (1 bit) + Set if that track MUST be active during + playback. There can be many forced track for a kind (audio, video or subs), the player + should select the one which language matches the user preference or the default + forced + track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit) + Set if the track may contain blocks using + lacing. (1 bit) + The minimum number of frames a player should + be able to cache during playback. If set to 0, the reference pseudo-cache system is not + used. + The maximum cache size required to store referenced frames in and the + current frame. 0 means no cache is needed. + Number of nanoseconds (not scaled via + TimecodeScale) per frame ('frame' in the Matroska sense -- one element put into a + (Simple)Block). + DEPRECATED, DO NOT USE. The scale to apply + on this track to work at normal speed in relation with other tracks (mostly used to adjust + video speed when the audio length differs). + A value to + add to the Block's Timecode. This can be used to adjust the playback offset of a track. + The maximum value of BlockAddID. A + value 0 means there is no BlockAdditions + for this track. + A + human-readable track name. + Specifies the language of the track in the Matroska languages + form. + An ID + corresponding to the codec, see the codec page for + more info. + Private data only + known to the codec. + A human-readable + string specifying the codec. + The UID of an attachment that is used by + this codec. + A string describing + the encoding setting used. + A URL + to find information about the codec used. + A + URL to download about the codec used. + The codec can decode potentially damaged data (1 bit). + Specify that this track is an overlay track for the Track specified (in the + u-integer). That means when this track has a gap (see SilentTracks) + the overlay track should be used instead. The order of multiple TrackOverlay matters, the + first one is the one that should be used. If not found it should be the second, etc. + The track identification for the given Chapter Codec. + Specify an edition UID on which this translation applies. When not + specified, it means for all editions found in the segment. + The chapter + codec using this ID (0: Matroska Script, 1: DVD-menu). + The binary value used to represent this track in the chapter codec data. + The format depends on the + ChapProcessCodecID used. + Video + settings. + Set if the video is interlaced. (1 + bit) + Stereo-3D video mode (0: mono, 1: side by side (left eye is + first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard + (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row + interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved + (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is first), 12: + anaglyph (green/magenta), 13 both eyes laced in one Block (left eye is first), 14 both eyes + laced in one Block (right eye is first)) . There are some more details on 3D support in the + Specification Notes. + DEPRECATED, + DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right + eye, 2: left eye, 3: both eyes). + Width of the encoded video frames in pixels. + Height of the encoded video frames in pixels. + The number of video pixels to remove at the bottom of + the image (for HDTV content). + The number of video pixels to remove at the top of the image. + The number of video pixels to remove on the left of the image. + The number of video pixels to remove on the right of + the image. + Width of the video frames to display. The + default value is only valid when DisplayUnit is + 0. + Height of the video frames to display. The + default value is only valid when DisplayUnit is + 0. + How DisplayWidth & DisplayHeight should be interpreted (0: + pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio). + Specify the possible modifications to the aspect ratio (0: free + resizing, 1: keep aspect ratio, 2: fixed). + Same value as in AVI (32 bits). + Gamma Value. + Number of frames per second. Informational only. + Audio + settings. + Sampling frequency in Hz. + Real output sampling + frequency in Hz (used for SBR techniques). + Numbers of channels in the track. + Table of horizontal angles for each successive channel, see appendix. + Bits per sample, mostly used for PCM. + Operation + that needs to be applied on tracks to create this virtual track. For more details look at the + Specification Notes on the subject. + Contains + the list of all video plane tracks that need to be combined to create this 3D track + Contains a video plane track that need to be combined to create this 3D + track + The trackUID number of the track representing the plane. + The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: + background). + Contains + the list of all tracks whose Blocks need to be combined to create this virtual track + The trackUID number of a track whose blocks are used to + create this virtual track. + + DivX + trick track extenstions + + + DivX + trick track extenstions + + + DivX + trick track extenstions + + + DivX + trick track extenstions + + + DivX + trick track extenstions + + Settings + for several content encoding mechanisms like compression or encryption. + Settings for one content encoding like compression or encryption. + Tells when this modification was used during encoding/muxing + starting with 0 and counting upwards. The decoder/demuxer has to start with the highest + order number it finds and work its way down. This value has to be unique over all + ContentEncodingOrder elements in the segment. + A bit field that describes which elements have + been modified in this way. Values (big endian) can be OR'ed. Possible values:
1 - all + frame contents,
2 - the track's private data,
4 - the next ContentEncoding (next + ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)
+ A value describing what kind of transformation has been + done. Possible values:
0 - compression,
1 - encryption
+ Settings + describing the compression used. Must be present if the value of ContentEncodingType is 0 + and absent otherwise. Each block must be decompressable even if no previous block is + available in order not to prevent seeking. + The compression algorithm used. Algorithms that have been specified so + far are:
0 - zlib,
1 - bzlib,
2 - lzo1x
3 - + Header Stripping
+ Settings + that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the + bytes that were removed from the beggining of each frames of the track. + Settings + describing the encryption used. Must be present if the value of ContentEncodingType is 1 and + absent otherwise. + The encryption algorithm used. The value '0' means that the contents have not + been encrypted but only signed. Predefined values:
1 - DES, 2 - 3DES, 3 - Twofish, 4 - + Blowfish, 5 - AES
+ For + public key algorithms this is the ID of the public key the the data was encrypted with. + A + cryptographic signature of the contents. + This is + the ID of the private key the data was signed with. + The algorithm used for the signature. A value of '0' means that the contents + have not been signed but only encrypted. Predefined values:
1 - RSA
+ The hash algorithm used for the signature. A value of '0' means that the + contents have not been signed but only encrypted. Predefined values:
1 - SHA1-160
+ 2 - MD5
+ A top-level element to + speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams. + Contains + all information relative to a seek point in the segment. + Absolute + timecode according to the segment time base. + Contain positions for different tracks corresponding to the timecode. + The track for which a position is given. + + The + position of the Cluster containing the required Block. + The relative position of the referenced block inside the cluster with 0 being the + first possible position for an element inside that cluster. + The duration of the block according to the segment time base. If missing the + track's DefaultDuration does not apply and no duration information is available in terms of + the cues. + Number of the Block in the specified Cluster. + The position + of the Codec State corresponding to this Cue element. 0 means that the data is taken from + the initial Track Entry. + The + Clusters containing the required referenced Blocks. + Timecode + of the referenced Block. + The Position + of the Cluster containing the referenced Block. + Number of the referenced Block of Track X in the specified Cluster. + The position + of the Codec State corresponding to this referenced element. 0 means that the data is taken + from the initial Track Entry. + Contain + attached files. + An attached file. + A + human-friendly name for the attached file. + Filename + of the attached file. + MIME type of the file. + The + data of the file. + Unique ID representing the file, as random as possible. + A binary value that a + track/codec can refer to when the attachment is needed. + + DivX font + extension + + + DivX font + extension + + A system to + define basic menus and partition data. For more detailed information, look at the Chapters Explanation + . + Contains all information about a segment edition. + A unique ID to identify the edition. It's useful for tagging an edition. + If an edition is hidden (1), it should not be available to + the user interface (but still to Control Tracks). (1 bit) + If a flag is set (1) the edition should be used + as the default one. (1 bit) + Specify if the chapters can be defined multiple times and the order + to play them is enforced. (1 bit) + Contains the atom information to use as the chapter atom + (apply to all tracks). + A unique ID to identify the Chapter. + A unique string ID to identify the Chapter. Use for WebVTT cue identifier + storage. + Timecode of the start of Chapter (not scaled). + Timecode + of the end of Chapter (timecode excluded, not scaled). + If a chapter is hidden (1), it should not be available to + the user interface (but still to Control Tracks). (1 bit) + Specify wether the chapter is enabled. It can be + enabled/disabled by a Control Track. When disabled, the movie should skip all the content + between the TimeStart and TimeEnd of this chapter. (1 bit) + A segment to play in place of this chapter. Edition + ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. + The EditionUID to play from the segment linked in ChapterSegmentUID. + Specify + the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of + values. + List of + tracks on which the chapter applies. If this element is not present, all tracks apply + UID of the Track to apply this chapter too. + In the absense of a control track, choosing this chapter will select the listed Tracks and + deselect unlisted tracks. Absense of this element indicates that the Chapter should be + applied to any currently used Tracks. + Contains all possible strings to use for the chapter display. + Contains the string to use as the chapter atom. + The languages corresponding to + the string, in the bibliographic + ISO-639-2 form. + The countries corresponding to the string, same 2 octets as + in Internet domains. + Contains all the commands associated to the Atom. + Contains the type of the codec + used for the processing. A value of 0 means native Matroska processing (to be defined), a + value of 1 means the DVD command + set is used. More codec IDs can be added later. + Some optional data attached to the ChapProcessCodecID + information. For + ChapProcessCodecID = 1, it is the "DVD level" equivalent. + Contains all the commands associated to the + Atom. + Defines when the process command should be + handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the + chapter). + Contains the command information. The data should be + interpreted depending on the ChapProcessCodecID value. For + ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. + Element + containing elements specific to Tracks/Chapters. A list of valid tags can be found here. + Element containing elements specific to Tracks/Chapters. + Contain all UIDs where the specified meta data apply. It is empty to + describe everything in the segment. + A number to indicate the logical level of + the target (see TargetType + ). + An informational string that can be used to display the + logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType + ). + A unique ID to identify the Track(s) the tags belong to. If the value + is 0 at this level, the tags apply to all tracks in the Segment. + A unique ID to identify the EditionEntry(s) the tags belong to. If the + value is 0 at this level, the tags apply to all editions in the Segment. + A unique ID to identify the Chapter(s) the tags belong to. If the value + is 0 at this level, the tags apply to all chapters in the Segment. + A unique ID to identify the Attachment(s) the tags belong to. If the + value is 0 at this level, the tags apply to all the attachments in the Segment. + Contains general information about the + target. + The + name of the Tag that is going to be stored. + Specifies the language of the tag specified, in the Matroska languages + form. + Indication to know if this is the default/original language + to use for the given tag. (1 bit) + The value of + the Tag. + The values of + the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. +
\ No newline at end of file diff --git a/biome.jsonc b/biome.jsonc index 8b35ab3..288df61 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,6 +1,8 @@ { "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "extends": ["ultracite"], + "extends": [ + "ultracite" + ], "linter": { "rules": { "style": { @@ -32,13 +34,22 @@ } }, "files": { - "ignore": [".vscode/*.json"] + "ignore": [ + ".vscode/*.json" + ] }, "overrides": [ { - "include": ["tests/**"], + "include": [ + "tests/**" + ], "javascript": { - "globals": ["describe", "beforeEach", "it", "expect"] + "globals": [ + "describe", + "beforeEach", + "it", + "expect" + ] }, "linter": { "rules": { @@ -50,6 +61,18 @@ } } } + }, + { + "include": [ + "scripts/**" + ], + "linter": { + "rules": { + "suspicious": { + "noConsole": "off" + } + } + } } ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index 1e0bbbf..5c1f344 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { "name": "konoebml", - "version": "0.1.0", + "version": "0.1.1", "description": "A modern JavaScript implementation of EBML RFC8794", - "main": "./dist/index.cjs", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./lib/index.cjs", + "module": "./lib/index.js", + "types": "./lib/index.d.ts", "type": "module", "maintainers": [ "Yeheng Zhou " ], "files": [ - "dist", + "lib", "LICENSE", "README.md" ], @@ -22,7 +22,8 @@ "prepublishOnly": "npm run build", "lint": "biome lint", "lint-fix": "biome lint --fix", - "playground": "tsx --tsconfig=./tsconfig.example.json ./examples/playground.ts" + "playground": "tsx --tsconfig=./tsconfig.example.json ./examples/playground.ts", + "codegen": "tsx --tsconfig=./tsconfig.scripts.json ./scripts/codegen.ts" }, "repository": "github:dumtruck/konoebml", "engines": { @@ -49,11 +50,14 @@ "@rslib/core": "^0.5.4", "@swc/core": "^1.11.11", "@types/jasmine": "^5.1.7", + "@types/lodash-es": "^4.17.12", "@types/node": "^22.13.10", "@vitest/coverage-v8": "^3.0.9", "arktype": "^2.1.10", + "change-case": "^5.4.4", "cross-env": "^7.0.3", "happy-dom": "^17.4.4", + "lodash-es": "^4.17.21", "rimraf": "^6.0.1", "ts-node": "^10.9.2", "typescript": "^5.8.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2bf749d..6f4a595 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,6 +27,9 @@ importers: '@types/jasmine': specifier: ^5.1.7 version: 5.1.7 + '@types/lodash-es': + specifier: ^4.17.12 + version: 4.17.12 '@types/node': specifier: ^22.13.10 version: 22.13.10 @@ -36,12 +39,18 @@ importers: arktype: specifier: ^2.1.10 version: 2.1.10 + change-case: + specifier: ^5.4.4 + version: 5.4.4 cross-env: specifier: ^7.0.3 version: 7.0.3 happy-dom: specifier: ^17.4.4 version: 17.4.4 + lodash-es: + specifier: ^4.17.21 + version: 4.17.21 rimraf: specifier: ^6.0.1 version: 6.0.1 @@ -692,6 +701,12 @@ packages: '@types/jasmine@5.1.7': resolution: {integrity: sha512-DVOfk9FaClQfNFpSfaML15jjB5cjffDMvjtph525sroR5BEAW2uKnTOYUTqTFuZFjNvH0T5XMIydvIctnUKufw==} + '@types/lodash-es@4.17.12': + resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} + + '@types/lodash@4.17.16': + resolution: {integrity: sha512-HX7Em5NYQAXKW+1T+FiuG27NGwzJfCX3s1GjOa7ujxZa52kjJLOr4FUxT+giF6Tgxv1e+/czV/iTtBw27WTU9g==} + '@types/node@22.13.10': resolution: {integrity: sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==} @@ -785,6 +800,9 @@ packages: resolution: {integrity: sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==} engines: {node: '>=12'} + change-case@5.4.4: + resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} + check-error@2.1.1: resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} engines: {node: '>= 16'} @@ -946,6 +964,9 @@ packages: resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + lodash-es@4.17.21: + resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + loupe@3.1.3: resolution: {integrity: sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==} @@ -1749,6 +1770,12 @@ snapshots: '@types/jasmine@5.1.7': {} + '@types/lodash-es@4.17.12': + dependencies: + '@types/lodash': 4.17.16 + + '@types/lodash@4.17.16': {} + '@types/node@22.13.10': dependencies: undici-types: 6.20.0 @@ -1854,6 +1881,8 @@ snapshots: loupe: 3.1.3 pathval: 2.0.0 + change-case@5.4.4: {} + check-error@2.1.1: {} color-convert@2.0.1: @@ -2014,6 +2043,8 @@ snapshots: load-tsconfig@0.2.5: {} + lodash-es@4.17.21: {} + loupe@3.1.3: {} lru-cache@10.4.3: {} diff --git a/rslib.config.ts b/rslib.config.ts index c8fd53e..52c9ab8 100644 --- a/rslib.config.ts +++ b/rslib.config.ts @@ -12,7 +12,10 @@ export default defineConfig({ dts: { bundle: false, build: false, - distPath: './dist', + distPath: './lib', + }, + output: { + distPath: {}, }, source: { entry: { @@ -34,5 +37,8 @@ export default defineConfig({ ], output: { target: 'web', + distPath: { + root: './lib', + }, }, }); diff --git a/scripts/codegen.ts b/scripts/codegen.ts new file mode 100644 index 0000000..42f4d84 --- /dev/null +++ b/scripts/codegen.ts @@ -0,0 +1,384 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { Window, type Element } from 'happy-dom'; +import { type } from 'arktype'; +import { omitBy, isNil, isEqual } from 'lodash-es'; +import { kebabCase } from 'change-case'; + +export const AdHocType = { + SimpleBlock: { + type: 'SimpleBlock', + }, + Block: { + type: 'Block', + }, +}; + +export const ebmlTypeSchema = type( + '"uinteger" | "master" | "binary" | "float" | "utf-8" | "string" | "integer" | "date"' +); + +const RestrictionEntrySchema = type({ + value: 'string', + label: 'string', +}); + +const EbmlElementSchema = type({ + name: 'string', + type: ebmlTypeSchema, + path: 'string?', + id: 'string', + default: 'string?', + range: 'string?', + maxOccurs: 'string?', + minOccurs: 'string?', + minVer: 'string?', + maxVer: 'string?', + restriction: RestrictionEntrySchema.array().optional(), +}); + +type EbmlElementType = typeof EbmlElementSchema.infer; + +function extractElement(element: Element) { + const attrs = element.attributes; + const name = attrs.getNamedItem('name')?.value?.replace(/-/g, '')!; + const type = attrs.getNamedItem('type')?.value!; + const path = attrs.getNamedItem('path')?.value!; + const id = attrs.getNamedItem('id')?.value!; + const default_ = attrs.getNamedItem('default')?.value; + const range = attrs.getNamedItem('range')?.value; + const maxOccurs = attrs.getNamedItem('maxOccurs')?.value; + const minOccurs = attrs.getNamedItem('minOccurs')?.value; + const minVer = attrs.getNamedItem('minVer')?.value; + const maxVer = attrs.getNamedItem('maxVer')?.value; + const restriction = [...element.querySelectorAll('restriction>enum')].map( + (e) => { + const value = e.getAttribute('value'); + const label = e.getAttribute('label'); + return { + value, + label, + }; + } + ); + const el: EbmlElementType = { + name, + type: type as any, + path, + id, + default: default_, + range, + maxOccurs, + minOccurs, + minVer, + maxVer, + restriction: restriction.length >= 0 ? (restriction as any) : undefined, + }; + try { + return EbmlElementSchema.assert(omitBy(el, isNil)); + } catch (e) { + console.error('error element is: ', name); + throw e; + } +} + +function extractElementAll() { + const allElements = new Map(); + + // the later has the higher priority + const specs = ['ebml_mkv_legacy.xml', 'ebml.xml', 'ebml_mkv.xml']; + + for (const spec of specs) { + const window = new Window(); + + const xmlString = fs.readFileSync( + path.join(import.meta.dirname, '..', 'assets', 'specification', spec), + 'utf-8' + ); + + const domParser = new window.DOMParser(); + const xmlDoc = domParser.parseFromString(xmlString, 'application/xml'); + + const elements = Array.from(xmlDoc.querySelectorAll('element')); + + for (const el of elements) { + const extracted = extractElement(el); + if (BigInt(extracted.id) >= Number.MAX_SAFE_INTEGER) { + throw new Error('unsafe impl use int, should refactor'); + } + // if ( + // allElements.has(extracted.id) && + // !isEqual(extracted, allElements.get(extracted.id)) + // ) { + // console.warn( + // `conflicts id = 0x${extracted.id}, name = ${extracted.name}, overwriting...` + // ); + // } + allElements.set(extracted.id, extracted); + } + } + + return Array.from(allElements.values()); +} + +function generateEbmlLacingType(_elements: EbmlElementType[]) { + return `export enum EbmlBlockLacing { + None = 1, + Xiph = 2, + EBML = 3, + FixedSize = 4, +}`; +} + +function generateEbmlElementType(_elements: EbmlElementType[]) { + return `export enum EbmlElementType { + Master = 'm', + Uint = 'u', + Int = 'i', + Ascii = 's', + Utf8 = '8', + Binary = 'b', + Float = 'f', + Date = 'd', +}`; +} + +function generateEbmlTagPosition(_elements: EbmlElementType[]) { + return `export enum EbmlTagPosition { + Start = 1, + Content = 2, + End = 3, +}`; +} + +function generateEbmlTagIdEnum(elements: EbmlElementType[]) { + const lines = elements.map((e) => ` ${e.name} = ${e.id}`); + return `export enum EbmlTagIdEnum {\n${lines.join(',\n')}\n }`; +} + +const TypeCodeToEbmlType = { + Master: 'master', + Uint: 'uinteger', + Int: 'integer', + Ascii: 'string', + Utf8: 'utf-8', + Binary: 'binary', + Float: 'float', + Date: 'date', +}; + +const TypeCodeToTsType = { + Uint: 'number | bigint', + Int: 'number | bigint', + Ascii: 'string', + UTF8: 'string', + Binary: 'Uint8Array', + Float: 'number', + Date: 'Uint8Array', +}; + +function generateEbmlTypeTagIdType(elements: EbmlElementType[]) { + return [ + ...Object.entries(TypeCodeToEbmlType).map( + ([typeCode, type]) => + `export type Ebml${typeCode}TagIdType = \n${elements + .map((el) => { + const adhoc = AdHocType[el.name as keyof typeof AdHocType]; + if (adhoc || el.type !== type) { + return; + } + return ` | EbmlTagIdEnum.${el.name}`; + }) + .filter(Boolean) + .join('\n')}` + ), + ...Object.entries(AdHocType).map( + ([name]) => `export type Ebml${name}TagIdType = EbmlTagIdEnum.${name};` + ), + `export type EbmlDataTagIdType =\n${Object.keys(TypeCodeToEbmlType) + .filter((typeCode) => typeCode !== 'Master') + .map((k) => ` | Ebml${k}TagIdType`) + .join('\n')};`, + `export type EbmlAdhocTagIdType =\n${Object.keys(AdHocType) + .map((k) => ` | Ebml${k}TagIdType`) + .join('\n')}`, + 'export type EbmlUnknownTagIdType = number | bigint', + 'export type EbmlKnownTagIdType = EbmlDataTagIdType | EbmlMasterTagIdType | EbmlAdhocTagIdType;', + 'export type EbmlTagIdType = EbmlKnownTagIdType | EbmlUnknownTagIdType;', + ].join('\n\n'); +} + +function generateGetEbmlTypeByTagId(elements: EbmlElementType[]) { + return [ + '/* return undefined means unknown or ad-hoc */', + 'export function getEbmlTypeByTagId(id: EbmlTagIdType): EbmlElementType | undefined {', + ' switch (id) {', + Object.entries(TypeCodeToEbmlType) + .map( + ([typeCode, type]) => + `${elements + .map((el) => { + const adhoc = AdHocType[el.name as keyof typeof AdHocType]; + if (adhoc || el.type !== type) { + return; + } + return ` case EbmlTagIdEnum.${el.name}:`; + }) + .filter(Boolean) + .join('\n')}\n return EbmlElementType.${typeCode};` + ) + .join('\n'), + ' default:', + ' return;', + ' }', + '}', + ].join('\n'); +} + +function generateIsEbmlTypeTagId(_elements: EbmlElementType[]) { + return [ + ...Object.keys(TypeCodeToEbmlType).map( + (code) => `export function isEbml${code}TagId( + tagId: EbmlTagIdType +): tagId is Ebml${code}TagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.${code}; +}` + ), + ...Object.keys(AdHocType).map( + (name) => `export function isEbml${name}TagId( + tagId: EbmlTagIdType +): tagId is Ebml${name}TagIdType { + return tagId === EbmlTagIdEnum.${name}; +}` + ), + `export function isEbmlUnknownTagId(tagId: EbmlTagIdType): boolean { + return typeof tagId !== 'number' || !(tagId in EbmlTagIdEnum); +}`, + ].join('\n\n'); +} + +function generateTagUnionImports(_elements: EbmlElementType[]) { + return `import type { + ${Object.keys(AdHocType).map((typeCode) => `Ebml${typeCode}TagIdType`)}, + EbmlElementType, + EbmlTagIdEnum, + EbmlTagPosition, +} from './enums'; +import type { EbmlDataTag } from './tag-data'; +import type { EbmlMasterTag } from './tag-master'; +${Object.keys(AdHocType) + .map( + (typeCode) => + `import type { Ebml${typeCode}Tag } from './tag-${kebabCase(typeCode)}';` + ) + .join('\n')} + +export type EbmlTagExcludeField = + | 'id' + | 'position' + | 'parent' + | 'type' + | 'data' + | 'children'; +`; +} + +function generateTagUnionImpls(elements: EbmlElementType[]) { + return [ + ...Object.entries(TypeCodeToEbmlType) + .map(([typeCode]) => { + if (typeCode === 'Master') { + return; + } + return `export interface Ebml${typeCode}TagTypeBase + extends Omit { + position: EbmlTagPosition.Content; + parent?: EbmlMasterTag; + type: EbmlElementType.${typeCode}; + data: ${TypeCodeToTsType[typeCode as keyof typeof TypeCodeToTsType]}; + children?: []; + }`; + }) + .filter(Boolean), + `export interface EbmlMasterTagTypeBase + extends Omit { + type: EbmlElementType.Master; + position: EbmlTagPosition.Start | EbmlTagPosition.End; + parent?: EbmlMasterTag; + children: EbmlTagType[]; + data?: undefined; +}`, + + ...Object.entries(TypeCodeToEbmlType).map(([typeCode, type]) => { + const filteredElements = elements.filter( + (el) => + el.type === type && !AdHocType[el.name as keyof typeof AdHocType] + ); + return [ + ...filteredElements.map((el) => { + return `export interface Ebml${el.name}TagType extends Ebml${typeCode}TagTypeBase { + id: EbmlTagIdEnum.${el.name}; +}`; + }), + `export type Ebml${typeCode}TagType = \n${filteredElements.map((el) => ` | Ebml${el.name}TagType`).join('\n')};`, + ].join('\n\n'); + }), + ...Object.keys(AdHocType).map( + (typeCode) => `export type Ebml${typeCode}TagType = Omit< + Ebml${typeCode}Tag, + EbmlTagExcludeField +> & { + id: Ebml${typeCode}TagIdType; + position: EbmlTagPosition.Content; + parent?: EbmlMasterTag; + type?: undefined; + data?: undefined; + children?: []; +}` + ), + `export type EbmlDataTagType = \n${Object.keys(TypeCodeToEbmlType) + .filter((typeCode) => typeCode !== 'Master') + .map((typeCode) => ` | Ebml${typeCode}TagType`) + .join('\n')}`, + `export type EbmlAdhocTagType = \n${Object.keys(AdHocType) + .map((typeCode) => ` | Ebml${typeCode}TagType`) + .join('\n')}`, + `export type EbmlTagType = + | EbmlMasterTagType + | EbmlDataTagType + | EbmlAdhocTagType`, + ].join('\n\n'); +} + +function main() { + const elementSchemas = extractElementAll(); + + const files = { + 'enums.ts': [ + generateEbmlLacingType(elementSchemas), + generateEbmlElementType(elementSchemas), + generateEbmlTagPosition(elementSchemas), + generateEbmlTagIdEnum(elementSchemas), + generateEbmlTypeTagIdType(elementSchemas), + generateGetEbmlTypeByTagId(elementSchemas), + generateIsEbmlTypeTagId(elementSchemas), + ], + 'tag-union.ts': [ + generateTagUnionImports(elementSchemas), + generateTagUnionImpls(elementSchemas), + ], + }; + + const outDir = path.join(import.meta.dirname, '..', 'temp', 'codegen'); + fs.mkdirSync(outDir, { recursive: true }); + + for (const [filename, fragments] of Object.entries(files)) { + fs.writeFileSync( + path.join(outDir, filename), + fragments.join('\n\n'), + 'utf-8' + ); + } +} + +main(); diff --git a/src/decoder.ts b/src/decoder.ts index d2caad1..c55eeff 100644 --- a/src/decoder.ts +++ b/src/decoder.ts @@ -2,7 +2,7 @@ import { Queue } from 'mnemonist'; import type { FileDataViewController } from './adapters'; import { decodeEbmlContent } from './decode-utils'; import { StreamFlushReason, UnreachableOrLogicError } from './errors'; -import type { EbmlTagType } from './models/tag'; +import type { EbmlTagType } from './models/tag-union'; import type { DecodeContentCollectChildPredicate, EbmlTagTrait, diff --git a/src/encoder.ts b/src/encoder.ts index a4476e9..3404567 100644 --- a/src/encoder.ts +++ b/src/encoder.ts @@ -1,7 +1,7 @@ import { Stack } from 'mnemonist'; import { EbmlTreeMasterNotMatchError, UnreachableOrLogicError } from './errors'; import { EbmlTagPosition } from './models/enums'; -import type { EbmlTagType } from './models/tag'; +import type { EbmlTagType } from './models/tag-union'; import { EbmlMasterTag } from './models/tag-master'; import { EbmlTagTrait } from './models/tag-trait'; diff --git a/src/factory.ts b/src/factory.ts index fc9d4c8..2283286 100644 --- a/src/factory.ts +++ b/src/factory.ts @@ -6,16 +6,9 @@ import { type EbmlMasterTagIdType, type EbmlSimpleBlockTagIdType, EbmlTagIdEnum, - isEbmlBinaryDataTagId, isEbmlBlockTagId, - isEbmlDateDataTagId, - isEbmlFloatDataTagId, - isEbmlIntDataTagId, - isEbmlMasterTagId, isEbmlSimpleBlockTagId, - isEbmlStringDataTagId, - isEbmlUintDataTagId, - isEbmlUtf8DataTagId, + getEbmlTypeByTagId, } from './models/enums'; import { type CreateEbmlBlockTagOptions, @@ -57,36 +50,22 @@ export function createEbmlTag( options: Omit ): EbmlTagTrait; -// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: export function createEbmlTag(arg1: unknown, arg2: unknown): EbmlTagTrait { const id = arg1 as EbmlTagIdEnum; const options = arg2 as Omit; let type: EbmlElementType | undefined = options.type; if (EbmlTagIdEnum[id] !== undefined) { let foundType: EbmlElementType | undefined; + // adhoc start if (isEbmlBlockTagId(id)) { return new EbmlBlockTag({ ...options, id }); } if (isEbmlSimpleBlockTagId(id)) { return new EbmlSimpleBlockTag({ ...options }); } - if (isEbmlMasterTagId(id)) { - foundType = EbmlElementType.Master; - } else if (isEbmlUintDataTagId(id)) { - foundType = EbmlElementType.UnsignedInt; - } else if (isEbmlIntDataTagId(id)) { - foundType = EbmlElementType.Integer; - } else if (isEbmlFloatDataTagId(id)) { - foundType = EbmlElementType.Float; - } else if (isEbmlStringDataTagId(id)) { - foundType = EbmlElementType.Ascii; - } else if (isEbmlUtf8DataTagId(id)) { - foundType = EbmlElementType.UTF8; - } else if (isEbmlDateDataTagId(id)) { - foundType = EbmlElementType.Date; - } else if (isEbmlBinaryDataTagId(id)) { - foundType = EbmlElementType.Binary; - } + // adhoc end + + foundType = getEbmlTypeByTagId(id); if (type === undefined) { type = foundType; diff --git a/src/index.ts b/src/index.ts index 895a772..6a241cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ export { type CreateEbmlTagOptions, } from './models/tag-trait'; export { + type EncodeUselessCreateOptionsType, createEbmlTag, createEbmlTagForManuallyBuild, } from './factory'; @@ -31,39 +32,57 @@ export { type EbmlStreamDecoderChunkType, type EbmlStreamDecoderOptions, type EbmlDecodeStreamTransformerOptions, + type EbmlDecodeStreamTransformerBackpressure, } from './decoder'; export { EbmlStreamEncoder, EbmlEncodeStreamTransformer, + type EbmlEncodeStreamTransformerBackpressure, + type EbmlEncodeStreamTransformerOptions, + type EbmlStreamEncoderOptions, } from './encoder'; export { - EbmlBlockLacing, - EbmlTagIdEnum, - EbmlElementType, - EbmlTagPosition, - type EbmlBinaryDataTagIdType, - type EbmlMasterTagIdType, - type EbmlBlockTagIdType, - type EbmlDataTagIdType, - type EbmlDateDataTagIdType, - type EbmlFloatDataTagIdType, - type EbmlIntDataTagIdType, - type EbmlSimpleBlockTagIdType, - type EbmlAsciiDataTagIdType, - type EbmlUintDataTagIdType, - type EbmlUtf8DataTagIdType, - type EbmlTagIdType, - type EbmlUnknownTagIdType, - isEbmlBinaryDataTagId, - isEbmlBlockTagId, - isEbmlDateDataTagId, - isEbmlFloatDataTagId, - isEbmlIntDataTagId, - isEbmlMasterTagId, - isEbmlSimpleBlockTagId, - isEbmlStringDataTagId, - isEbmlUintDataTagId, - isEbmlUtf8DataTagId, - isUnknownTagId, -} from './models/enums'; -export type * from './models/tag'; + EbmlTreeMasterNotMatchError, + ElementIdVintDataAllOnesError, + ElementIdVintDataAllZerosError, + ElementIdVintDataNotShortestError, + VintLengthOutOfRangeError, + VintOutOfRangeError, + UnreachableOrLogicError, + UnsupportLengthForElementTypeError, + SizeUnitOutOfSafeIntegerRangeError, + StreamFlushReason, + OutOfRangeForElementTypeError, + InconsistentOffsetOnDecodingContentError, + InconsistentWellKnownEbmlTagTypeError, +} from './errors'; +export { + readAscii, + readElementIdVint, + readFloat, + readHexString, + readSigned, + readUnsigned, + readUtf8, + readVint, + readVintLength, + writeAscii, + writeElementIdVint, + writeFloat, + writeSigned, + writeUnsigned, + writeUtf8, + writeVint, + checkVintSafeSize, + concatArrayBuffers, + dataViewSlice, + dataViewSliceToBuf, + vintToHexString, + type Vint, + type SafeSizeVint, +} from './tools'; +export type { FileDataViewController } from './adapters'; +export * from './models/enums'; +export type * from './models/enums'; +export * from './models/tag-union'; +export type * from './models/tag-union'; diff --git a/src/models/enums.ts b/src/models/enums.ts index b2c9dda..c77b7aa 100644 --- a/src/models/enums.ts +++ b/src/models/enums.ts @@ -1,9 +1,16 @@ +export enum EbmlBlockLacing { + None = 1, + Xiph = 2, + EBML = 3, + FixedSize = 4, +} + export enum EbmlElementType { Master = 'm', - UnsignedInt = 'u', - Integer = 'i', + Uint = 'u', + Int = 'i', Ascii = 's', - UTF8 = '8', + Utf8 = '8', Binary = 'b', Float = 'f', Date = 'd', @@ -16,559 +23,947 @@ export enum EbmlTagPosition { } export enum EbmlTagIdEnum { - ChapterDisplay = 0x80, - TrackType = 0x83, - ChapString = 0x85, - CodecID = 0x86, - FlagDefault = 0x88, - ChapterTrackNumber = 0x89, - ChapterTimeStart = 0x91, - ChapterTimeEnd = 0x92, - CueRefTime = 0x96, - CueRefCluster = 0x97, - ChapterFlagHidden = 0x98, - ContentCompAlgo = 0x4254, - ContentCompSettings = 0x4255, - DocType = 0x4282, - DocTypeReadVersion = 0x4285, + EBML = 0x1a45dfa3, EBMLVersion = 0x4286, + EBMLReadVersion = 0x42f7, + EBMLMaxIDLength = 0x42f2, + EBMLMaxSizeLength = 0x42f3, + DocType = 0x4282, DocTypeVersion = 0x4287, + DocTypeReadVersion = 0x4285, + Void = 0xec, + CRC32 = 0xbf, + SignatureSlot = 0x1b538667, + SignatureAlgo = 0x7e8a, + SignatureHash = 0x7e9a, + SignaturePublicKey = 0x7ea5, + Signature = 0x7eb5, + SignatureElements = 0x7e5b, + SignatureElementList = 0x7e7b, + SignedElement = 0x6532, + Segment = 0x18538067, + SeekHead = 0x114d9b74, + Seek = 0x4dbb, + SeekID = 0x53ab, + SeekPosition = 0x53ac, + Info = 0x1549a966, + SegmentUUID = 0x73a4, + SegmentFilename = 0x7384, + PrevUUID = 0x3cb923, + PrevFilename = 0x3c83ab, + NextUUID = 0x3eb923, + NextFilename = 0x3e83bb, SegmentFamily = 0x4444, - DateUTC = 0x4461, - TagDefault = 0x4484, - TagBinary = 0x4485, - TagString = 0x4487, + ChapterTranslate = 0x6924, + ChapterTranslateEditionUID = 0x69fc, + ChapterTranslateCodec = 0x69bf, + ChapterTranslateID = 0x69a5, + TimestampScale = 0x2ad7b1, Duration = 0x4489, - ChapterFlagEnabled = 0x4598, - FileMimeType = 0x4660, - FileUsedStartTime = 0x4661, - FileUsedEndTime = 0x4662, - FileReferral = 0x4675, + DateUTC = 0x4461, + Title = 0x7ba9, + MuxingApp = 0x4d80, + WritingApp = 0x5741, + Cluster = 0x1f43b675, + Timestamp = 0xe7, + SilentTracks = 0x5854, + SilentTrackNumber = 0x58d7, + Position = 0xa7, + PrevSize = 0xab, + SimpleBlock = 0xa3, + BlockGroup = 0xa0, + Block = 0xa1, + BlockVirtual = 0xa2, + BlockAdditions = 0x75a1, + BlockMore = 0xa6, + BlockAddID = 0xee, + BlockAdditional = 0xa5, + BlockDuration = 0x9b, + ReferencePriority = 0xfa, + ReferenceBlock = 0xfb, + ReferenceVirtual = 0xfd, + CodecState = 0xa4, + Slices = 0x8e, + TimeSlice = 0xe8, + LaceNumber = 0xcc, + FrameNumber = 0xcd, + BlockAdditionID = 0xcb, + Delay = 0xce, + SliceDuration = 0xcf, + ReferenceFrame = 0xc8, + ReferenceOffset = 0xc9, + ReferenceTimestamp = 0xca, + EncryptedBlock = 0xaf, + Tracks = 0x1654ae6b, + TrackEntry = 0xae, + TrackNumber = 0xd7, + TrackUID = 0x73c5, + TrackType = 0x83, + FlagEnabled = 0xb9, + FlagDefault = 0x88, + FlagForced = 0x55aa, + FlagLacing = 0x9c, + MinCache = 0x6de7, + MaxCache = 0x6df8, + DefaultDuration = 0x23e383, + TrackTimestampScale = 0x23314f, + TrackOffset = 0x537f, + MaxBlockAdditionID = 0x55ee, + Name = 0x536e, + Language = 0x22b59c, + CodecID = 0x86, + CodecPrivate = 0x63a2, + CodecName = 0x258688, + AttachmentLink = 0x7446, + CodecSettings = 0x3a9697, + CodecInfoURL = 0x3b4040, + CodecDownloadURL = 0x26b240, + CodecDecodeAll = 0xaa, + TrackOverlay = 0x6fab, + TrackTranslate = 0x6624, + TrackTranslateEditionUID = 0x66fc, + TrackTranslateCodec = 0x66bf, + TrackTranslateTrackID = 0x66a5, + Video = 0xe0, + FlagInterlaced = 0x9a, + StereoMode = 0x53b8, + OldStereoMode = 0x53b9, + PixelWidth = 0xb0, + PixelHeight = 0xba, + PixelCropBottom = 0x54aa, + PixelCropTop = 0x54bb, + PixelCropLeft = 0x54cc, + PixelCropRight = 0x54dd, + DisplayWidth = 0x54b0, + DisplayHeight = 0x54ba, + DisplayUnit = 0x54b2, + AspectRatioType = 0x54b3, + UncompressedFourCC = 0x2eb524, + GammaValue = 0x2fb523, + FrameRate = 0x2383e3, + Audio = 0xe1, + SamplingFrequency = 0xb5, + OutputSamplingFrequency = 0x78b5, + Channels = 0x9f, + ChannelPositions = 0x7d7b, + BitDepth = 0x6264, + TrackOperation = 0xe2, + TrackCombinePlanes = 0xe3, + TrackPlane = 0xe4, + TrackPlaneUID = 0xe5, + TrackPlaneType = 0xe6, + TrackJoinBlocks = 0xe9, + TrackJoinUID = 0xed, + TrickTrackUID = 0xc0, + TrickTrackSegmentUID = 0xc1, + TrickTrackFlag = 0xc6, + TrickMasterTrackUID = 0xc7, + TrickMasterTrackSegmentUID = 0xc4, + ContentEncodings = 0x6d80, + ContentEncoding = 0x6240, ContentEncodingOrder = 0x5031, ContentEncodingScope = 0x5032, ContentEncodingType = 0x5033, ContentCompression = 0x5034, + ContentCompAlgo = 0x4254, + ContentCompSettings = 0x4255, ContentEncryption = 0x5035, + ContentEncAlgo = 0x47e1, + ContentEncKeyID = 0x47e2, + ContentSignature = 0x47e3, + ContentSigKeyID = 0x47e4, + ContentSigAlgo = 0x47e5, + ContentSigHashAlgo = 0x47e6, + Cues = 0x1c53bb6b, + CuePoint = 0xbb, + CueTime = 0xb3, + CueTrackPositions = 0xb7, + CueTrack = 0xf7, + CueClusterPosition = 0xf1, + CueRelativePosition = 0xf0, + CueDuration = 0xb2, CueBlockNumber = 0x5378, + CueCodecState = 0xea, + CueReference = 0xdb, + CueRefTime = 0x96, + CueRefCluster = 0x97, + CueRefNumber = 0x535f, + CueRefCodecState = 0xeb, + Attachments = 0x1941a469, + AttachedFile = 0x61a7, + FileDescription = 0x467e, + FileName = 0x466e, + FileMediaType = 0x4660, + FileData = 0x465c, + FileUID = 0x46ae, + FileReferral = 0x4675, + FileUsedStartTime = 0x4661, + FileUsedEndTime = 0x4662, + Chapters = 0x1043a770, + EditionEntry = 0x45b9, + EditionUID = 0x45bc, + EditionFlagHidden = 0x45bd, + EditionFlagDefault = 0x45db, + EditionFlagOrdered = 0x45dd, + ChapterAtom = 0xb6, + ChapterUID = 0x73c4, ChapterStringUID = 0x5654, - WritingApp = 0x5741, - SilentTracks = 0x5854, - ContentEncoding = 0x6240, - BitDepth = 0x6264, - SignedElement = 0x6532, - TrackTranslate = 0x6624, - ChapProcessCommand = 0x6911, - ChapProcessTime = 0x6922, - ChapterTranslate = 0x6924, - ChapProcessData = 0x6933, + ChapterTimeStart = 0x91, + ChapterTimeEnd = 0x92, + ChapterFlagHidden = 0x98, + ChapterFlagEnabled = 0x4598, + ChapterSegmentUUID = 0x6e67, + ChapterSegmentEditionUID = 0x6ebc, + ChapterPhysicalEquiv = 0x63c3, + ChapterTrack = 0x8f, + ChapterTrackUID = 0x89, + ChapterDisplay = 0x80, + ChapString = 0x85, + ChapLanguage = 0x437c, + ChapCountry = 0x437e, ChapProcess = 0x6944, ChapProcessCodecID = 0x6955, - Tag = 0x7373, - SegmentFilename = 0x7384, - AttachmentLink = 0x7446, - CodecName = 0x258688, - Segment = 0x18538067, - TagLanguage = 0x447a, - TagName = 0x45a3, - SimpleTag = 0x67c8, - TagAttachmentUID = 0x63c6, - TagChapterUID = 0x63c4, - TagEditionUID = 0x63c9, - TagTrackUID = 0x63c5, - TargetType = 0x63ca, - TargetTypeValue = 0x68ca, - Targets = 0x63c0, - Tags = 0x1254c367, ChapProcessPrivate = 0x450d, - ChapCountry = 0x437e, - ChapLanguage = 0x437c, - ChapterTrack = 0x8f, - ChapterPhysicalEquiv = 0x63c3, - ChapterSegmentEditionUID = 0x6ebc, - ChapterSegmentUID = 0x6e67, - ChapterUID = 0x73c4, - ChapterAtom = 0xb6, - EditionFlagOrdered = 0x45dd, - EditionFlagDefault = 0x45db, - EditionFlagHidden = 0x45bd, - EditionUID = 0x45bc, - EditionEntry = 0x45b9, - Chapters = 0x1043a770, - FileUID = 0x46ae, - FileData = 0x465c, - FileName = 0x466e, - FileDescription = 0x467e, - AttachedFile = 0x61a7, - Attachments = 0x1941a469, - CueRefCodecState = 0xeb, - CueRefNumber = 0x535f, - CueReference = 0xdb, - CueCodecState = 0xea, - CueDuration = 0xb2, - CueRelativePosition = 0xf0, - CueClusterPosition = 0xf1, - CueTrack = 0xf7, - CueTrackPositions = 0xb7, - CueTime = 0xb3, - CuePoint = 0xbb, - Cues = 0x1c53bb6b, - AESSettingsCipherMode = 0x47e8, - ContentEncAESSettings = 0x47e7, - ContentSigHashAlgo = 0x47e6, - ContentSigAlgo = 0x47e5, - ContentSigKeyID = 0x47e4, - ContentSignature = 0x47e3, - ContentEncKeyID = 0x47e2, - ContentEncAlgo = 0x47e1, - ContentEncodings = 0x6d80, - TrickMasterTrackSegmentUID = 0xc4, - TrickMasterTrackUID = 0xc7, - TrickTrackFlag = 0xc6, - TrickTrackSegmentUID = 0xc1, - TrickTrackUID = 0xc0, - TrackJoinUID = 0xed, - TrackJoinBlocks = 0xe9, - TrackPlaneType = 0xe6, - TrackPlaneUID = 0xe5, - TrackPlane = 0xe4, - TrackCombinePlanes = 0xe3, - TrackOperation = 0xe2, - ChannelPositions = 0x7d7b, - Channels = 0x9f, - OutputSamplingFrequency = 0x78b5, - SamplingFrequency = 0xb5, - Audio = 0xe1, - FrameRate = 0x2383e3, - GammaValue = 0x2fb523, - ColourSpace = 0x2eb524, - AspectRatioType = 0x54b3, - DisplayUnit = 0x54b2, - DisplayHeight = 0x54ba, - DisplayWidth = 0x54b0, - PixelCropRight = 0x54dd, - PixelCropLeft = 0x54cc, - PixelCropTop = 0x54bb, - PixelCropBottom = 0x54aa, - PixelHeight = 0xba, - PixelWidth = 0xb0, - OldStereoMode = 0x53b9, - AlphaMode = 0x53c0, - StereoMode = 0x53b8, - FlagInterlaced = 0x9a, - Video = 0xe0, - TrackTranslateTrackID = 0x66a5, - TrackTranslateCodec = 0x66bf, - TrackTranslateEditionUID = 0x66fc, - SeekPreRoll = 0x56bb, - CodecDelay = 0x56aa, - TrackOverlay = 0x6fab, - CodecDecodeAll = 0xaa, - CodecDownloadURL = 0x26b240, - CodecInfoURL = 0x3b4040, - CodecSettings = 0x3a9697, - CodecPrivate = 0x63a2, - Language = 0x22b59c, - Name = 0x536e, - MaxBlockAdditionID = 0x55ee, - TrackOffset = 0x537f, - TrackTimecodeScale = 0x23314f, - DefaultDecodedFieldDuration = 0x234e7a, - DefaultDuration = 0x23e383, - MaxCache = 0x6df8, - MinCache = 0x6de7, - FlagLacing = 0x9c, - FlagForced = 0x55aa, - FlagEnabled = 0xb9, - TrackUID = 0x73c5, - TrackNumber = 0xd7, - TrackEntry = 0xae, - Tracks = 0x1654ae6b, - EncryptedBlock = 0xaf, - ReferenceTimeCode = 0xca, - ReferenceOffset = 0xc9, - ReferenceFrame = 0xc8, - SliceDuration = 0xcf, - Delay = 0xce, - BlockAdditionID = 0xcb, - FrameNumber = 0xcd, - LaceNumber = 0xcc, - TimeSlice = 0xe8, - Slices = 0x8e, + ChapProcessCommand = 0x6911, + ChapProcessTime = 0x6922, + ChapProcessData = 0x6933, + Tags = 0x1254c367, + Tag = 0x7373, + Targets = 0x63c0, + TargetTypeValue = 0x68ca, + TargetType = 0x63ca, + TagTrackUID = 0x63c5, + TagEditionUID = 0x63c9, + TagChapterUID = 0x63c4, + TagAttachmentUID = 0x63c6, + SimpleTag = 0x67c8, + TagName = 0x45a3, + TagLanguage = 0x447a, + TagDefault = 0x4484, + TagString = 0x4487, + TagBinary = 0x4485, + DocTypeExtension = 0x4281, + DocTypeExtensionName = 0x4283, + DocTypeExtensionVersion = 0x4284, DiscardPadding = 0x75a2, - CodecState = 0xa4, - ReferenceVirtual = 0xfd, - ReferenceBlock = 0xfb, - ReferencePriority = 0xfa, - BlockDuration = 0x9b, - BlockAdditional = 0xa5, - BlockAddID = 0xee, - BlockMore = 0xa6, - BlockAdditions = 0x75a1, - BlockVirtual = 0xa2, - Block = 0xa1, - BlockGroup = 0xa0, - SimpleBlock = 0xa3, - PrevSize = 0xab, - Position = 0xa7, - SilentTrackNumber = 0x58d7, - Timecode = 0xe7, - Cluster = 0x1f43b675, - MuxingApp = 0x4d80, - Title = 0x7ba9, - TimecodeScaleDenominator = 0x2ad7b2, - TimecodeScale = 0x2ad7b1, - ChapterTranslateID = 0x69a5, - ChapterTranslateCodec = 0x69bf, - ChapterTranslateEditionUID = 0x69fc, - NextFilename = 0x3e83bb, - NextUID = 0x3eb923, - PrevFilename = 0x3c83ab, - PrevUID = 0x3cb923, - SegmentUID = 0x73a4, - Info = 0x1549a966, - SeekPosition = 0x53ac, - SeekID = 0x53ab, - Seek = 0x4dbb, - SeekHead = 0x114d9b74, - SignatureElementList = 0x7e7b, - SignatureElements = 0x7e5b, - Signature = 0x7eb5, - SignaturePublicKey = 0x7ea5, - SignatureHash = 0x7e9a, - SignatureAlgo = 0x7e8a, - SignatureSlot = 0x1b538667, - CRC32 = 0xbf, - Void = 0xec, - EBMLMaxSizeLength = 0x42f3, - EBMLMaxIDLength = 0x42f2, - EBMLReadVersion = 0x42f7, - EBML = 0x1a45dfa3, + FlagHearingImpaired = 0x55ab, + FlagVisualImpaired = 0x55ac, + FlagTextDescriptions = 0x55ad, + FlagOriginal = 0x55ae, + FlagCommentary = 0x55af, + DefaultDecodedFieldDuration = 0x234e7a, + BlockAdditionMapping = 0x41e4, + BlockAddIDValue = 0x41f0, + BlockAddIDName = 0x41a4, + BlockAddIDType = 0x41e7, + BlockAddIDExtraData = 0x41ed, + LanguageBCP47 = 0x22b59d, + CodecDelay = 0x56aa, + SeekPreRoll = 0x56bb, + FieldOrder = 0x9d, + AlphaMode = 0x53c0, + Colour = 0x55b0, + MatrixCoefficients = 0x55b1, + BitsPerChannel = 0x55b2, + ChromaSubsamplingHorz = 0x55b3, + ChromaSubsamplingVert = 0x55b4, + CbSubsamplingHorz = 0x55b5, + CbSubsamplingVert = 0x55b6, + ChromaSitingHorz = 0x55b7, + ChromaSitingVert = 0x55b8, + Range = 0x55b9, + TransferCharacteristics = 0x55ba, + Primaries = 0x55bb, + MaxCLL = 0x55bc, + MaxFALL = 0x55bd, + MasteringMetadata = 0x55d0, + PrimaryRChromaticityX = 0x55d1, + PrimaryRChromaticityY = 0x55d2, + PrimaryGChromaticityX = 0x55d3, + PrimaryGChromaticityY = 0x55d4, + PrimaryBChromaticityX = 0x55d5, + PrimaryBChromaticityY = 0x55d6, + WhitePointChromaticityX = 0x55d7, + WhitePointChromaticityY = 0x55d8, + LuminanceMax = 0x55d9, + LuminanceMin = 0x55da, + Projection = 0x7670, + ProjectionType = 0x7671, + ProjectionPrivate = 0x7672, + ProjectionPoseYaw = 0x7673, + ProjectionPosePitch = 0x7674, + ProjectionPoseRoll = 0x7675, + Emphasis = 0x52f1, + ContentEncAESSettings = 0x47e7, + AESSettingsCipherMode = 0x47e8, + EditionDisplay = 0x4520, + EditionString = 0x4521, + EditionLanguageIETF = 0x45e4, + ChapterSkipType = 0x4588, + ChapLanguageBCP47 = 0x437d, + TagLanguageBCP47 = 0x447b, + TagDefaultBogus = 0x44b4, } export type EbmlMasterTagIdType = - | EbmlTagIdEnum.ChapterDisplay + | EbmlTagIdEnum.EBML + | EbmlTagIdEnum.SignatureSlot + | EbmlTagIdEnum.SignatureElements + | EbmlTagIdEnum.SignatureElementList + | EbmlTagIdEnum.Segment + | EbmlTagIdEnum.SeekHead + | EbmlTagIdEnum.Seek + | EbmlTagIdEnum.Info + | EbmlTagIdEnum.ChapterTranslate + | EbmlTagIdEnum.Cluster + | EbmlTagIdEnum.SilentTracks + | EbmlTagIdEnum.BlockGroup + | EbmlTagIdEnum.BlockAdditions + | EbmlTagIdEnum.BlockMore + | EbmlTagIdEnum.Slices + | EbmlTagIdEnum.TimeSlice + | EbmlTagIdEnum.ReferenceFrame + | EbmlTagIdEnum.Tracks + | EbmlTagIdEnum.TrackEntry + | EbmlTagIdEnum.TrackTranslate + | EbmlTagIdEnum.Video + | EbmlTagIdEnum.Audio + | EbmlTagIdEnum.TrackOperation + | EbmlTagIdEnum.TrackCombinePlanes + | EbmlTagIdEnum.TrackPlane + | EbmlTagIdEnum.TrackJoinBlocks + | EbmlTagIdEnum.ContentEncodings + | EbmlTagIdEnum.ContentEncoding | EbmlTagIdEnum.ContentCompression | EbmlTagIdEnum.ContentEncryption - | EbmlTagIdEnum.SilentTracks - | EbmlTagIdEnum.ContentEncoding - | EbmlTagIdEnum.TrackTranslate - | EbmlTagIdEnum.ChapProcessCommand - | EbmlTagIdEnum.ChapterTranslate - | EbmlTagIdEnum.ChapProcess - | EbmlTagIdEnum.Tag - | EbmlTagIdEnum.Segment - | EbmlTagIdEnum.SimpleTag - | EbmlTagIdEnum.Targets - | EbmlTagIdEnum.Tags - | EbmlTagIdEnum.ChapterTrack - | EbmlTagIdEnum.ChapterAtom - | EbmlTagIdEnum.EditionEntry - | EbmlTagIdEnum.Chapters - | EbmlTagIdEnum.AttachedFile - | EbmlTagIdEnum.Attachments - | EbmlTagIdEnum.CueReference - | EbmlTagIdEnum.CueTrackPositions - | EbmlTagIdEnum.CuePoint | EbmlTagIdEnum.Cues + | EbmlTagIdEnum.CuePoint + | EbmlTagIdEnum.CueTrackPositions + | EbmlTagIdEnum.CueReference + | EbmlTagIdEnum.Attachments + | EbmlTagIdEnum.AttachedFile + | EbmlTagIdEnum.Chapters + | EbmlTagIdEnum.EditionEntry + | EbmlTagIdEnum.ChapterAtom + | EbmlTagIdEnum.ChapterTrack + | EbmlTagIdEnum.ChapterDisplay + | EbmlTagIdEnum.ChapProcess + | EbmlTagIdEnum.ChapProcessCommand + | EbmlTagIdEnum.Tags + | EbmlTagIdEnum.Tag + | EbmlTagIdEnum.Targets + | EbmlTagIdEnum.SimpleTag + | EbmlTagIdEnum.DocTypeExtension + | EbmlTagIdEnum.BlockAdditionMapping + | EbmlTagIdEnum.Colour + | EbmlTagIdEnum.MasteringMetadata + | EbmlTagIdEnum.Projection | EbmlTagIdEnum.ContentEncAESSettings - | EbmlTagIdEnum.ContentEncodings - | EbmlTagIdEnum.TrackJoinBlocks - | EbmlTagIdEnum.TrackPlane - | EbmlTagIdEnum.TrackCombinePlanes - | EbmlTagIdEnum.TrackOperation - | EbmlTagIdEnum.Audio - | EbmlTagIdEnum.Video - | EbmlTagIdEnum.TrackEntry - | EbmlTagIdEnum.Tracks - | EbmlTagIdEnum.ReferenceFrame - | EbmlTagIdEnum.TimeSlice - | EbmlTagIdEnum.Slices - | EbmlTagIdEnum.BlockMore - | EbmlTagIdEnum.BlockAdditions - | EbmlTagIdEnum.BlockGroup - | EbmlTagIdEnum.Cluster - | EbmlTagIdEnum.Info - | EbmlTagIdEnum.Seek - | EbmlTagIdEnum.SeekHead - | EbmlTagIdEnum.SignatureElementList - | EbmlTagIdEnum.SignatureElements - | EbmlTagIdEnum.SignatureSlot - | EbmlTagIdEnum.EBML; + | EbmlTagIdEnum.EditionDisplay; -export type EbmlBlockTagIdType = EbmlTagIdEnum.Block; - -export type EbmlSimpleBlockTagIdType = EbmlTagIdEnum.SimpleBlock; - -export type EbmlUintDataTagIdType = - | EbmlTagIdEnum.TrackType - | EbmlTagIdEnum.FlagDefault - | EbmlTagIdEnum.ChapterTrackNumber - | EbmlTagIdEnum.ChapterTimeStart - | EbmlTagIdEnum.ChapterTimeEnd - | EbmlTagIdEnum.CueRefTime - | EbmlTagIdEnum.CueRefCluster - | EbmlTagIdEnum.ChapterFlagHidden - | EbmlTagIdEnum.ContentCompAlgo - | EbmlTagIdEnum.DocTypeReadVersion +export type EbmlUintTagIdType = | EbmlTagIdEnum.EBMLVersion + | EbmlTagIdEnum.EBMLReadVersion + | EbmlTagIdEnum.EBMLMaxIDLength + | EbmlTagIdEnum.EBMLMaxSizeLength | EbmlTagIdEnum.DocTypeVersion - | EbmlTagIdEnum.TagDefault - | EbmlTagIdEnum.ChapterFlagEnabled - | EbmlTagIdEnum.FileUsedStartTime - | EbmlTagIdEnum.FileUsedEndTime + | EbmlTagIdEnum.DocTypeReadVersion + | EbmlTagIdEnum.SignatureAlgo + | EbmlTagIdEnum.SignatureHash + | EbmlTagIdEnum.SeekPosition + | EbmlTagIdEnum.ChapterTranslateEditionUID + | EbmlTagIdEnum.ChapterTranslateCodec + | EbmlTagIdEnum.TimestampScale + | EbmlTagIdEnum.Timestamp + | EbmlTagIdEnum.SilentTrackNumber + | EbmlTagIdEnum.Position + | EbmlTagIdEnum.PrevSize + | EbmlTagIdEnum.BlockAddID + | EbmlTagIdEnum.BlockDuration + | EbmlTagIdEnum.ReferencePriority + | EbmlTagIdEnum.LaceNumber + | EbmlTagIdEnum.FrameNumber + | EbmlTagIdEnum.BlockAdditionID + | EbmlTagIdEnum.Delay + | EbmlTagIdEnum.SliceDuration + | EbmlTagIdEnum.ReferenceOffset + | EbmlTagIdEnum.ReferenceTimestamp + | EbmlTagIdEnum.TrackNumber + | EbmlTagIdEnum.TrackUID + | EbmlTagIdEnum.TrackType + | EbmlTagIdEnum.FlagEnabled + | EbmlTagIdEnum.FlagDefault + | EbmlTagIdEnum.FlagForced + | EbmlTagIdEnum.FlagLacing + | EbmlTagIdEnum.MinCache + | EbmlTagIdEnum.MaxCache + | EbmlTagIdEnum.DefaultDuration + | EbmlTagIdEnum.MaxBlockAdditionID + | EbmlTagIdEnum.AttachmentLink + | EbmlTagIdEnum.CodecDecodeAll + | EbmlTagIdEnum.TrackOverlay + | EbmlTagIdEnum.TrackTranslateEditionUID + | EbmlTagIdEnum.TrackTranslateCodec + | EbmlTagIdEnum.FlagInterlaced + | EbmlTagIdEnum.StereoMode + | EbmlTagIdEnum.OldStereoMode + | EbmlTagIdEnum.PixelWidth + | EbmlTagIdEnum.PixelHeight + | EbmlTagIdEnum.PixelCropBottom + | EbmlTagIdEnum.PixelCropTop + | EbmlTagIdEnum.PixelCropLeft + | EbmlTagIdEnum.PixelCropRight + | EbmlTagIdEnum.DisplayWidth + | EbmlTagIdEnum.DisplayHeight + | EbmlTagIdEnum.DisplayUnit + | EbmlTagIdEnum.AspectRatioType + | EbmlTagIdEnum.Channels + | EbmlTagIdEnum.BitDepth + | EbmlTagIdEnum.TrackPlaneUID + | EbmlTagIdEnum.TrackPlaneType + | EbmlTagIdEnum.TrackJoinUID + | EbmlTagIdEnum.TrickTrackUID + | EbmlTagIdEnum.TrickTrackFlag + | EbmlTagIdEnum.TrickMasterTrackUID | EbmlTagIdEnum.ContentEncodingOrder | EbmlTagIdEnum.ContentEncodingScope | EbmlTagIdEnum.ContentEncodingType - | EbmlTagIdEnum.CueBlockNumber - | EbmlTagIdEnum.BitDepth - | EbmlTagIdEnum.ChapProcessTime - | EbmlTagIdEnum.ChapProcessCodecID - | EbmlTagIdEnum.AttachmentLink - | EbmlTagIdEnum.TagAttachmentUID - | EbmlTagIdEnum.TagChapterUID - | EbmlTagIdEnum.TagEditionUID - | EbmlTagIdEnum.TagTrackUID - | EbmlTagIdEnum.TargetTypeValue - | EbmlTagIdEnum.ChapterPhysicalEquiv - | EbmlTagIdEnum.ChapterSegmentEditionUID - | EbmlTagIdEnum.ChapterUID - | EbmlTagIdEnum.EditionFlagOrdered - | EbmlTagIdEnum.EditionFlagDefault - | EbmlTagIdEnum.EditionFlagHidden - | EbmlTagIdEnum.EditionUID - | EbmlTagIdEnum.FileUID - | EbmlTagIdEnum.CueRefCodecState - | EbmlTagIdEnum.CueRefNumber - | EbmlTagIdEnum.CueCodecState - | EbmlTagIdEnum.CueDuration - | EbmlTagIdEnum.CueRelativePosition - | EbmlTagIdEnum.CueClusterPosition - | EbmlTagIdEnum.CueTrack - | EbmlTagIdEnum.CueTime - | EbmlTagIdEnum.AESSettingsCipherMode - | EbmlTagIdEnum.ContentSigHashAlgo - | EbmlTagIdEnum.ContentSigAlgo + | EbmlTagIdEnum.ContentCompAlgo | EbmlTagIdEnum.ContentEncAlgo - | EbmlTagIdEnum.TrickMasterTrackUID - | EbmlTagIdEnum.TrickTrackFlag - | EbmlTagIdEnum.TrickTrackUID - | EbmlTagIdEnum.TrackJoinUID - | EbmlTagIdEnum.TrackPlaneType - | EbmlTagIdEnum.TrackPlaneUID - | EbmlTagIdEnum.Channels - | EbmlTagIdEnum.AspectRatioType - | EbmlTagIdEnum.DisplayUnit - | EbmlTagIdEnum.DisplayHeight - | EbmlTagIdEnum.DisplayWidth - | EbmlTagIdEnum.PixelCropRight - | EbmlTagIdEnum.PixelCropLeft - | EbmlTagIdEnum.PixelCropTop - | EbmlTagIdEnum.PixelCropBottom - | EbmlTagIdEnum.PixelHeight - | EbmlTagIdEnum.PixelWidth - | EbmlTagIdEnum.OldStereoMode - | EbmlTagIdEnum.AlphaMode - | EbmlTagIdEnum.StereoMode - | EbmlTagIdEnum.FlagInterlaced - | EbmlTagIdEnum.TrackTranslateCodec - | EbmlTagIdEnum.TrackTranslateEditionUID - | EbmlTagIdEnum.SeekPreRoll - | EbmlTagIdEnum.CodecDelay - | EbmlTagIdEnum.TrackOverlay - | EbmlTagIdEnum.CodecDecodeAll - | EbmlTagIdEnum.MaxBlockAdditionID + | EbmlTagIdEnum.ContentSigAlgo + | EbmlTagIdEnum.ContentSigHashAlgo + | EbmlTagIdEnum.CueTime + | EbmlTagIdEnum.CueTrack + | EbmlTagIdEnum.CueClusterPosition + | EbmlTagIdEnum.CueRelativePosition + | EbmlTagIdEnum.CueDuration + | EbmlTagIdEnum.CueBlockNumber + | EbmlTagIdEnum.CueCodecState + | EbmlTagIdEnum.CueRefTime + | EbmlTagIdEnum.CueRefCluster + | EbmlTagIdEnum.CueRefNumber + | EbmlTagIdEnum.CueRefCodecState + | EbmlTagIdEnum.FileUID + | EbmlTagIdEnum.FileUsedStartTime + | EbmlTagIdEnum.FileUsedEndTime + | EbmlTagIdEnum.EditionUID + | EbmlTagIdEnum.EditionFlagHidden + | EbmlTagIdEnum.EditionFlagDefault + | EbmlTagIdEnum.EditionFlagOrdered + | EbmlTagIdEnum.ChapterUID + | EbmlTagIdEnum.ChapterTimeStart + | EbmlTagIdEnum.ChapterTimeEnd + | EbmlTagIdEnum.ChapterFlagHidden + | EbmlTagIdEnum.ChapterFlagEnabled + | EbmlTagIdEnum.ChapterSegmentEditionUID + | EbmlTagIdEnum.ChapterPhysicalEquiv + | EbmlTagIdEnum.ChapterTrackUID + | EbmlTagIdEnum.ChapProcessCodecID + | EbmlTagIdEnum.ChapProcessTime + | EbmlTagIdEnum.TargetTypeValue + | EbmlTagIdEnum.TagTrackUID + | EbmlTagIdEnum.TagEditionUID + | EbmlTagIdEnum.TagChapterUID + | EbmlTagIdEnum.TagAttachmentUID + | EbmlTagIdEnum.TagDefault + | EbmlTagIdEnum.DocTypeExtensionVersion + | EbmlTagIdEnum.FlagHearingImpaired + | EbmlTagIdEnum.FlagVisualImpaired + | EbmlTagIdEnum.FlagTextDescriptions + | EbmlTagIdEnum.FlagOriginal + | EbmlTagIdEnum.FlagCommentary | EbmlTagIdEnum.DefaultDecodedFieldDuration - | EbmlTagIdEnum.DefaultDuration - | EbmlTagIdEnum.MaxCache - | EbmlTagIdEnum.MinCache - | EbmlTagIdEnum.FlagLacing - | EbmlTagIdEnum.FlagForced - | EbmlTagIdEnum.FlagEnabled - | EbmlTagIdEnum.TrackUID - | EbmlTagIdEnum.TrackNumber - | EbmlTagIdEnum.ReferenceTimeCode - | EbmlTagIdEnum.ReferenceOffset - | EbmlTagIdEnum.SliceDuration - | EbmlTagIdEnum.Delay - | EbmlTagIdEnum.BlockAdditionID - | EbmlTagIdEnum.FrameNumber - | EbmlTagIdEnum.LaceNumber - | EbmlTagIdEnum.ReferencePriority - | EbmlTagIdEnum.BlockDuration - | EbmlTagIdEnum.BlockAddID - | EbmlTagIdEnum.PrevSize - | EbmlTagIdEnum.Position - | EbmlTagIdEnum.SilentTrackNumber - | EbmlTagIdEnum.Timecode - | EbmlTagIdEnum.TimecodeScaleDenominator - | EbmlTagIdEnum.TimecodeScale - | EbmlTagIdEnum.ChapterTranslateCodec - | EbmlTagIdEnum.ChapterTranslateEditionUID - | EbmlTagIdEnum.SeekPosition - | EbmlTagIdEnum.SignatureHash - | EbmlTagIdEnum.SignatureAlgo - | EbmlTagIdEnum.EBMLMaxSizeLength - | EbmlTagIdEnum.EBMLMaxIDLength - | EbmlTagIdEnum.EBMLReadVersion; + | EbmlTagIdEnum.BlockAddIDValue + | EbmlTagIdEnum.BlockAddIDType + | EbmlTagIdEnum.CodecDelay + | EbmlTagIdEnum.SeekPreRoll + | EbmlTagIdEnum.FieldOrder + | EbmlTagIdEnum.AlphaMode + | EbmlTagIdEnum.MatrixCoefficients + | EbmlTagIdEnum.BitsPerChannel + | EbmlTagIdEnum.ChromaSubsamplingHorz + | EbmlTagIdEnum.ChromaSubsamplingVert + | EbmlTagIdEnum.CbSubsamplingHorz + | EbmlTagIdEnum.CbSubsamplingVert + | EbmlTagIdEnum.ChromaSitingHorz + | EbmlTagIdEnum.ChromaSitingVert + | EbmlTagIdEnum.Range + | EbmlTagIdEnum.TransferCharacteristics + | EbmlTagIdEnum.Primaries + | EbmlTagIdEnum.MaxCLL + | EbmlTagIdEnum.MaxFALL + | EbmlTagIdEnum.ProjectionType + | EbmlTagIdEnum.Emphasis + | EbmlTagIdEnum.AESSettingsCipherMode + | EbmlTagIdEnum.ChapterSkipType + | EbmlTagIdEnum.TagDefaultBogus; -export type EbmlIntDataTagIdType = - | EbmlTagIdEnum.TrackOffset - | EbmlTagIdEnum.DiscardPadding +export type EbmlIntTagIdType = + | EbmlTagIdEnum.ReferenceBlock | EbmlTagIdEnum.ReferenceVirtual - | EbmlTagIdEnum.ReferenceBlock; + | EbmlTagIdEnum.TrackOffset + | EbmlTagIdEnum.DiscardPadding; -export type EbmlAsciiDataTagIdType = - | EbmlTagIdEnum.CodecID +export type EbmlAsciiTagIdType = | EbmlTagIdEnum.DocType - | EbmlTagIdEnum.FileMimeType - | EbmlTagIdEnum.TagLanguage - | EbmlTagIdEnum.TargetType - | EbmlTagIdEnum.ChapCountry - | EbmlTagIdEnum.ChapLanguage - | EbmlTagIdEnum.CodecDownloadURL + | EbmlTagIdEnum.Language + | EbmlTagIdEnum.CodecID | EbmlTagIdEnum.CodecInfoURL - | EbmlTagIdEnum.Language; + | EbmlTagIdEnum.CodecDownloadURL + | EbmlTagIdEnum.FileMediaType + | EbmlTagIdEnum.ChapLanguage + | EbmlTagIdEnum.ChapCountry + | EbmlTagIdEnum.TargetType + | EbmlTagIdEnum.TagLanguage + | EbmlTagIdEnum.DocTypeExtensionName + | EbmlTagIdEnum.BlockAddIDName + | EbmlTagIdEnum.LanguageBCP47 + | EbmlTagIdEnum.EditionLanguageIETF + | EbmlTagIdEnum.ChapLanguageBCP47 + | EbmlTagIdEnum.TagLanguageBCP47; -export type EbmlUtf8DataTagIdType = - | EbmlTagIdEnum.ChapString - | EbmlTagIdEnum.TagString - | EbmlTagIdEnum.ChapterStringUID - | EbmlTagIdEnum.WritingApp +export type EbmlUtf8TagIdType = | EbmlTagIdEnum.SegmentFilename - | EbmlTagIdEnum.CodecName - | EbmlTagIdEnum.TagName - | EbmlTagIdEnum.FileName - | EbmlTagIdEnum.FileDescription - | EbmlTagIdEnum.CodecSettings - | EbmlTagIdEnum.Name - | EbmlTagIdEnum.MuxingApp - | EbmlTagIdEnum.Title + | EbmlTagIdEnum.PrevFilename | EbmlTagIdEnum.NextFilename - | EbmlTagIdEnum.PrevFilename; + | EbmlTagIdEnum.Title + | EbmlTagIdEnum.MuxingApp + | EbmlTagIdEnum.WritingApp + | EbmlTagIdEnum.Name + | EbmlTagIdEnum.CodecName + | EbmlTagIdEnum.CodecSettings + | EbmlTagIdEnum.FileDescription + | EbmlTagIdEnum.FileName + | EbmlTagIdEnum.ChapterStringUID + | EbmlTagIdEnum.ChapString + | EbmlTagIdEnum.TagName + | EbmlTagIdEnum.TagString + | EbmlTagIdEnum.EditionString; -export type EbmlFloatDataTagIdType = - | EbmlTagIdEnum.Duration - | EbmlTagIdEnum.OutputSamplingFrequency - | EbmlTagIdEnum.SamplingFrequency - | EbmlTagIdEnum.FrameRate - | EbmlTagIdEnum.GammaValue - | EbmlTagIdEnum.TrackTimecodeScale; - -export type EbmlDateDataTagIdType = EbmlTagIdEnum.DateUTC; - -export type EbmlBinaryDataTagIdType = - | EbmlTagIdEnum.ContentCompSettings - | EbmlTagIdEnum.SegmentFamily - | EbmlTagIdEnum.TagBinary - | EbmlTagIdEnum.FileReferral - | EbmlTagIdEnum.SignedElement - | EbmlTagIdEnum.ChapProcessData - | EbmlTagIdEnum.ChapProcessPrivate - | EbmlTagIdEnum.ChapterSegmentUID - | EbmlTagIdEnum.FileData - | EbmlTagIdEnum.ContentSigKeyID - | EbmlTagIdEnum.ContentSignature - | EbmlTagIdEnum.ContentEncKeyID - | EbmlTagIdEnum.TrickMasterTrackSegmentUID - | EbmlTagIdEnum.TrickTrackSegmentUID - | EbmlTagIdEnum.ChannelPositions - | EbmlTagIdEnum.ColourSpace - | EbmlTagIdEnum.TrackTranslateTrackID - | EbmlTagIdEnum.CodecPrivate - | EbmlTagIdEnum.EncryptedBlock - | EbmlTagIdEnum.CodecState - | EbmlTagIdEnum.BlockAdditional - | EbmlTagIdEnum.BlockVirtual - | EbmlTagIdEnum.ChapterTranslateID - | EbmlTagIdEnum.NextUID - | EbmlTagIdEnum.PrevUID - | EbmlTagIdEnum.SegmentUID - | EbmlTagIdEnum.SeekID - | EbmlTagIdEnum.Signature - | EbmlTagIdEnum.SignaturePublicKey +export type EbmlBinaryTagIdType = + | EbmlTagIdEnum.Void | EbmlTagIdEnum.CRC32 - | EbmlTagIdEnum.Void; + | EbmlTagIdEnum.SignaturePublicKey + | EbmlTagIdEnum.Signature + | EbmlTagIdEnum.SignedElement + | EbmlTagIdEnum.SeekID + | EbmlTagIdEnum.SegmentUUID + | EbmlTagIdEnum.PrevUUID + | EbmlTagIdEnum.NextUUID + | EbmlTagIdEnum.SegmentFamily + | EbmlTagIdEnum.ChapterTranslateID + | EbmlTagIdEnum.BlockVirtual + | EbmlTagIdEnum.BlockAdditional + | EbmlTagIdEnum.CodecState + | EbmlTagIdEnum.EncryptedBlock + | EbmlTagIdEnum.CodecPrivate + | EbmlTagIdEnum.TrackTranslateTrackID + | EbmlTagIdEnum.UncompressedFourCC + | EbmlTagIdEnum.ChannelPositions + | EbmlTagIdEnum.TrickTrackSegmentUID + | EbmlTagIdEnum.TrickMasterTrackSegmentUID + | EbmlTagIdEnum.ContentCompSettings + | EbmlTagIdEnum.ContentEncKeyID + | EbmlTagIdEnum.ContentSignature + | EbmlTagIdEnum.ContentSigKeyID + | EbmlTagIdEnum.FileData + | EbmlTagIdEnum.FileReferral + | EbmlTagIdEnum.ChapterSegmentUUID + | EbmlTagIdEnum.ChapProcessPrivate + | EbmlTagIdEnum.ChapProcessData + | EbmlTagIdEnum.TagBinary + | EbmlTagIdEnum.BlockAddIDExtraData + | EbmlTagIdEnum.ProjectionPrivate; + +export type EbmlFloatTagIdType = + | EbmlTagIdEnum.Duration + | EbmlTagIdEnum.TrackTimestampScale + | EbmlTagIdEnum.GammaValue + | EbmlTagIdEnum.FrameRate + | EbmlTagIdEnum.SamplingFrequency + | EbmlTagIdEnum.OutputSamplingFrequency + | EbmlTagIdEnum.PrimaryRChromaticityX + | EbmlTagIdEnum.PrimaryRChromaticityY + | EbmlTagIdEnum.PrimaryGChromaticityX + | EbmlTagIdEnum.PrimaryGChromaticityY + | EbmlTagIdEnum.PrimaryBChromaticityX + | EbmlTagIdEnum.PrimaryBChromaticityY + | EbmlTagIdEnum.WhitePointChromaticityX + | EbmlTagIdEnum.WhitePointChromaticityY + | EbmlTagIdEnum.LuminanceMax + | EbmlTagIdEnum.LuminanceMin + | EbmlTagIdEnum.ProjectionPoseYaw + | EbmlTagIdEnum.ProjectionPosePitch + | EbmlTagIdEnum.ProjectionPoseRoll; + +export type EbmlDateTagIdType = EbmlTagIdEnum.DateUTC; + +export type EbmlSimpleBlockTagIdType = EbmlTagIdEnum.SimpleBlock; + +export type EbmlBlockTagIdType = EbmlTagIdEnum.Block; + +export type EbmlDataTagIdType = + | EbmlUintTagIdType + | EbmlIntTagIdType + | EbmlAsciiTagIdType + | EbmlUtf8TagIdType + | EbmlBinaryTagIdType + | EbmlFloatTagIdType + | EbmlDateTagIdType; + +export type EbmlAdhocTagIdType = EbmlSimpleBlockTagIdType | EbmlBlockTagIdType; export type EbmlUnknownTagIdType = number | bigint; -export type EbmlDataTagIdType = - | EbmlBinaryDataTagIdType - | EbmlIntDataTagIdType - | EbmlUintDataTagIdType - | EbmlDateDataTagIdType - | EbmlFloatDataTagIdType - | EbmlAsciiDataTagIdType - | EbmlUtf8DataTagIdType; - -export type EbmlTagIdType = - | EbmlMasterTagIdType - | EbmlBlockTagIdType - | EbmlSimpleBlockTagIdType +export type EbmlKnownTagIdType = | EbmlDataTagIdType - | EbmlUnknownTagIdType; + | EbmlMasterTagIdType + | EbmlAdhocTagIdType; + +export type EbmlTagIdType = EbmlKnownTagIdType | EbmlUnknownTagIdType; + +/* return undefined means unknown or ad-hoc */ +export function getEbmlTypeByTagId( + id: EbmlTagIdType +): EbmlElementType | undefined { + switch (id) { + case EbmlTagIdEnum.EBML: + case EbmlTagIdEnum.SignatureSlot: + case EbmlTagIdEnum.SignatureElements: + case EbmlTagIdEnum.SignatureElementList: + case EbmlTagIdEnum.Segment: + case EbmlTagIdEnum.SeekHead: + case EbmlTagIdEnum.Seek: + case EbmlTagIdEnum.Info: + case EbmlTagIdEnum.ChapterTranslate: + case EbmlTagIdEnum.Cluster: + case EbmlTagIdEnum.SilentTracks: + case EbmlTagIdEnum.BlockGroup: + case EbmlTagIdEnum.BlockAdditions: + case EbmlTagIdEnum.BlockMore: + case EbmlTagIdEnum.Slices: + case EbmlTagIdEnum.TimeSlice: + case EbmlTagIdEnum.ReferenceFrame: + case EbmlTagIdEnum.Tracks: + case EbmlTagIdEnum.TrackEntry: + case EbmlTagIdEnum.TrackTranslate: + case EbmlTagIdEnum.Video: + case EbmlTagIdEnum.Audio: + case EbmlTagIdEnum.TrackOperation: + case EbmlTagIdEnum.TrackCombinePlanes: + case EbmlTagIdEnum.TrackPlane: + case EbmlTagIdEnum.TrackJoinBlocks: + case EbmlTagIdEnum.ContentEncodings: + case EbmlTagIdEnum.ContentEncoding: + case EbmlTagIdEnum.ContentCompression: + case EbmlTagIdEnum.ContentEncryption: + case EbmlTagIdEnum.Cues: + case EbmlTagIdEnum.CuePoint: + case EbmlTagIdEnum.CueTrackPositions: + case EbmlTagIdEnum.CueReference: + case EbmlTagIdEnum.Attachments: + case EbmlTagIdEnum.AttachedFile: + case EbmlTagIdEnum.Chapters: + case EbmlTagIdEnum.EditionEntry: + case EbmlTagIdEnum.ChapterAtom: + case EbmlTagIdEnum.ChapterTrack: + case EbmlTagIdEnum.ChapterDisplay: + case EbmlTagIdEnum.ChapProcess: + case EbmlTagIdEnum.ChapProcessCommand: + case EbmlTagIdEnum.Tags: + case EbmlTagIdEnum.Tag: + case EbmlTagIdEnum.Targets: + case EbmlTagIdEnum.SimpleTag: + case EbmlTagIdEnum.DocTypeExtension: + case EbmlTagIdEnum.BlockAdditionMapping: + case EbmlTagIdEnum.Colour: + case EbmlTagIdEnum.MasteringMetadata: + case EbmlTagIdEnum.Projection: + case EbmlTagIdEnum.ContentEncAESSettings: + case EbmlTagIdEnum.EditionDisplay: + return EbmlElementType.Master; + case EbmlTagIdEnum.EBMLVersion: + case EbmlTagIdEnum.EBMLReadVersion: + case EbmlTagIdEnum.EBMLMaxIDLength: + case EbmlTagIdEnum.EBMLMaxSizeLength: + case EbmlTagIdEnum.DocTypeVersion: + case EbmlTagIdEnum.DocTypeReadVersion: + case EbmlTagIdEnum.SignatureAlgo: + case EbmlTagIdEnum.SignatureHash: + case EbmlTagIdEnum.SeekPosition: + case EbmlTagIdEnum.ChapterTranslateEditionUID: + case EbmlTagIdEnum.ChapterTranslateCodec: + case EbmlTagIdEnum.TimestampScale: + case EbmlTagIdEnum.Timestamp: + case EbmlTagIdEnum.SilentTrackNumber: + case EbmlTagIdEnum.Position: + case EbmlTagIdEnum.PrevSize: + case EbmlTagIdEnum.BlockAddID: + case EbmlTagIdEnum.BlockDuration: + case EbmlTagIdEnum.ReferencePriority: + case EbmlTagIdEnum.LaceNumber: + case EbmlTagIdEnum.FrameNumber: + case EbmlTagIdEnum.BlockAdditionID: + case EbmlTagIdEnum.Delay: + case EbmlTagIdEnum.SliceDuration: + case EbmlTagIdEnum.ReferenceOffset: + case EbmlTagIdEnum.ReferenceTimestamp: + case EbmlTagIdEnum.TrackNumber: + case EbmlTagIdEnum.TrackUID: + case EbmlTagIdEnum.TrackType: + case EbmlTagIdEnum.FlagEnabled: + case EbmlTagIdEnum.FlagDefault: + case EbmlTagIdEnum.FlagForced: + case EbmlTagIdEnum.FlagLacing: + case EbmlTagIdEnum.MinCache: + case EbmlTagIdEnum.MaxCache: + case EbmlTagIdEnum.DefaultDuration: + case EbmlTagIdEnum.MaxBlockAdditionID: + case EbmlTagIdEnum.AttachmentLink: + case EbmlTagIdEnum.CodecDecodeAll: + case EbmlTagIdEnum.TrackOverlay: + case EbmlTagIdEnum.TrackTranslateEditionUID: + case EbmlTagIdEnum.TrackTranslateCodec: + case EbmlTagIdEnum.FlagInterlaced: + case EbmlTagIdEnum.StereoMode: + case EbmlTagIdEnum.OldStereoMode: + case EbmlTagIdEnum.PixelWidth: + case EbmlTagIdEnum.PixelHeight: + case EbmlTagIdEnum.PixelCropBottom: + case EbmlTagIdEnum.PixelCropTop: + case EbmlTagIdEnum.PixelCropLeft: + case EbmlTagIdEnum.PixelCropRight: + case EbmlTagIdEnum.DisplayWidth: + case EbmlTagIdEnum.DisplayHeight: + case EbmlTagIdEnum.DisplayUnit: + case EbmlTagIdEnum.AspectRatioType: + case EbmlTagIdEnum.Channels: + case EbmlTagIdEnum.BitDepth: + case EbmlTagIdEnum.TrackPlaneUID: + case EbmlTagIdEnum.TrackPlaneType: + case EbmlTagIdEnum.TrackJoinUID: + case EbmlTagIdEnum.TrickTrackUID: + case EbmlTagIdEnum.TrickTrackFlag: + case EbmlTagIdEnum.TrickMasterTrackUID: + case EbmlTagIdEnum.ContentEncodingOrder: + case EbmlTagIdEnum.ContentEncodingScope: + case EbmlTagIdEnum.ContentEncodingType: + case EbmlTagIdEnum.ContentCompAlgo: + case EbmlTagIdEnum.ContentEncAlgo: + case EbmlTagIdEnum.ContentSigAlgo: + case EbmlTagIdEnum.ContentSigHashAlgo: + case EbmlTagIdEnum.CueTime: + case EbmlTagIdEnum.CueTrack: + case EbmlTagIdEnum.CueClusterPosition: + case EbmlTagIdEnum.CueRelativePosition: + case EbmlTagIdEnum.CueDuration: + case EbmlTagIdEnum.CueBlockNumber: + case EbmlTagIdEnum.CueCodecState: + case EbmlTagIdEnum.CueRefTime: + case EbmlTagIdEnum.CueRefCluster: + case EbmlTagIdEnum.CueRefNumber: + case EbmlTagIdEnum.CueRefCodecState: + case EbmlTagIdEnum.FileUID: + case EbmlTagIdEnum.FileUsedStartTime: + case EbmlTagIdEnum.FileUsedEndTime: + case EbmlTagIdEnum.EditionUID: + case EbmlTagIdEnum.EditionFlagHidden: + case EbmlTagIdEnum.EditionFlagDefault: + case EbmlTagIdEnum.EditionFlagOrdered: + case EbmlTagIdEnum.ChapterUID: + case EbmlTagIdEnum.ChapterTimeStart: + case EbmlTagIdEnum.ChapterTimeEnd: + case EbmlTagIdEnum.ChapterFlagHidden: + case EbmlTagIdEnum.ChapterFlagEnabled: + case EbmlTagIdEnum.ChapterSegmentEditionUID: + case EbmlTagIdEnum.ChapterPhysicalEquiv: + case EbmlTagIdEnum.ChapterTrackUID: + case EbmlTagIdEnum.ChapProcessCodecID: + case EbmlTagIdEnum.ChapProcessTime: + case EbmlTagIdEnum.TargetTypeValue: + case EbmlTagIdEnum.TagTrackUID: + case EbmlTagIdEnum.TagEditionUID: + case EbmlTagIdEnum.TagChapterUID: + case EbmlTagIdEnum.TagAttachmentUID: + case EbmlTagIdEnum.TagDefault: + case EbmlTagIdEnum.DocTypeExtensionVersion: + case EbmlTagIdEnum.FlagHearingImpaired: + case EbmlTagIdEnum.FlagVisualImpaired: + case EbmlTagIdEnum.FlagTextDescriptions: + case EbmlTagIdEnum.FlagOriginal: + case EbmlTagIdEnum.FlagCommentary: + case EbmlTagIdEnum.DefaultDecodedFieldDuration: + case EbmlTagIdEnum.BlockAddIDValue: + case EbmlTagIdEnum.BlockAddIDType: + case EbmlTagIdEnum.CodecDelay: + case EbmlTagIdEnum.SeekPreRoll: + case EbmlTagIdEnum.FieldOrder: + case EbmlTagIdEnum.AlphaMode: + case EbmlTagIdEnum.MatrixCoefficients: + case EbmlTagIdEnum.BitsPerChannel: + case EbmlTagIdEnum.ChromaSubsamplingHorz: + case EbmlTagIdEnum.ChromaSubsamplingVert: + case EbmlTagIdEnum.CbSubsamplingHorz: + case EbmlTagIdEnum.CbSubsamplingVert: + case EbmlTagIdEnum.ChromaSitingHorz: + case EbmlTagIdEnum.ChromaSitingVert: + case EbmlTagIdEnum.Range: + case EbmlTagIdEnum.TransferCharacteristics: + case EbmlTagIdEnum.Primaries: + case EbmlTagIdEnum.MaxCLL: + case EbmlTagIdEnum.MaxFALL: + case EbmlTagIdEnum.ProjectionType: + case EbmlTagIdEnum.Emphasis: + case EbmlTagIdEnum.AESSettingsCipherMode: + case EbmlTagIdEnum.ChapterSkipType: + case EbmlTagIdEnum.TagDefaultBogus: + return EbmlElementType.Uint; + case EbmlTagIdEnum.ReferenceBlock: + case EbmlTagIdEnum.ReferenceVirtual: + case EbmlTagIdEnum.TrackOffset: + case EbmlTagIdEnum.DiscardPadding: + return EbmlElementType.Int; + case EbmlTagIdEnum.DocType: + case EbmlTagIdEnum.Language: + case EbmlTagIdEnum.CodecID: + case EbmlTagIdEnum.CodecInfoURL: + case EbmlTagIdEnum.CodecDownloadURL: + case EbmlTagIdEnum.FileMediaType: + case EbmlTagIdEnum.ChapLanguage: + case EbmlTagIdEnum.ChapCountry: + case EbmlTagIdEnum.TargetType: + case EbmlTagIdEnum.TagLanguage: + case EbmlTagIdEnum.DocTypeExtensionName: + case EbmlTagIdEnum.BlockAddIDName: + case EbmlTagIdEnum.LanguageBCP47: + case EbmlTagIdEnum.EditionLanguageIETF: + case EbmlTagIdEnum.ChapLanguageBCP47: + case EbmlTagIdEnum.TagLanguageBCP47: + return EbmlElementType.Ascii; + case EbmlTagIdEnum.SegmentFilename: + case EbmlTagIdEnum.PrevFilename: + case EbmlTagIdEnum.NextFilename: + case EbmlTagIdEnum.Title: + case EbmlTagIdEnum.MuxingApp: + case EbmlTagIdEnum.WritingApp: + case EbmlTagIdEnum.Name: + case EbmlTagIdEnum.CodecName: + case EbmlTagIdEnum.CodecSettings: + case EbmlTagIdEnum.FileDescription: + case EbmlTagIdEnum.FileName: + case EbmlTagIdEnum.ChapterStringUID: + case EbmlTagIdEnum.ChapString: + case EbmlTagIdEnum.TagName: + case EbmlTagIdEnum.TagString: + case EbmlTagIdEnum.EditionString: + return EbmlElementType.Utf8; + case EbmlTagIdEnum.Void: + case EbmlTagIdEnum.CRC32: + case EbmlTagIdEnum.SignaturePublicKey: + case EbmlTagIdEnum.Signature: + case EbmlTagIdEnum.SignedElement: + case EbmlTagIdEnum.SeekID: + case EbmlTagIdEnum.SegmentUUID: + case EbmlTagIdEnum.PrevUUID: + case EbmlTagIdEnum.NextUUID: + case EbmlTagIdEnum.SegmentFamily: + case EbmlTagIdEnum.ChapterTranslateID: + case EbmlTagIdEnum.BlockVirtual: + case EbmlTagIdEnum.BlockAdditional: + case EbmlTagIdEnum.CodecState: + case EbmlTagIdEnum.EncryptedBlock: + case EbmlTagIdEnum.CodecPrivate: + case EbmlTagIdEnum.TrackTranslateTrackID: + case EbmlTagIdEnum.UncompressedFourCC: + case EbmlTagIdEnum.ChannelPositions: + case EbmlTagIdEnum.TrickTrackSegmentUID: + case EbmlTagIdEnum.TrickMasterTrackSegmentUID: + case EbmlTagIdEnum.ContentCompSettings: + case EbmlTagIdEnum.ContentEncKeyID: + case EbmlTagIdEnum.ContentSignature: + case EbmlTagIdEnum.ContentSigKeyID: + case EbmlTagIdEnum.FileData: + case EbmlTagIdEnum.FileReferral: + case EbmlTagIdEnum.ChapterSegmentUUID: + case EbmlTagIdEnum.ChapProcessPrivate: + case EbmlTagIdEnum.ChapProcessData: + case EbmlTagIdEnum.TagBinary: + case EbmlTagIdEnum.BlockAddIDExtraData: + case EbmlTagIdEnum.ProjectionPrivate: + return EbmlElementType.Binary; + case EbmlTagIdEnum.Duration: + case EbmlTagIdEnum.TrackTimestampScale: + case EbmlTagIdEnum.GammaValue: + case EbmlTagIdEnum.FrameRate: + case EbmlTagIdEnum.SamplingFrequency: + case EbmlTagIdEnum.OutputSamplingFrequency: + case EbmlTagIdEnum.PrimaryRChromaticityX: + case EbmlTagIdEnum.PrimaryRChromaticityY: + case EbmlTagIdEnum.PrimaryGChromaticityX: + case EbmlTagIdEnum.PrimaryGChromaticityY: + case EbmlTagIdEnum.PrimaryBChromaticityX: + case EbmlTagIdEnum.PrimaryBChromaticityY: + case EbmlTagIdEnum.WhitePointChromaticityX: + case EbmlTagIdEnum.WhitePointChromaticityY: + case EbmlTagIdEnum.LuminanceMax: + case EbmlTagIdEnum.LuminanceMin: + case EbmlTagIdEnum.ProjectionPoseYaw: + case EbmlTagIdEnum.ProjectionPosePitch: + case EbmlTagIdEnum.ProjectionPoseRoll: + return EbmlElementType.Float; + case EbmlTagIdEnum.DateUTC: + return EbmlElementType.Date; + default: + return; + } +} export function isEbmlMasterTagId( tagId: EbmlTagIdType ): tagId is EbmlMasterTagIdType { - switch (tagId) { - case EbmlTagIdEnum.ChapterDisplay: - case EbmlTagIdEnum.ContentCompression: - case EbmlTagIdEnum.ContentEncryption: - case EbmlTagIdEnum.SilentTracks: - case EbmlTagIdEnum.ContentEncoding: - case EbmlTagIdEnum.TrackTranslate: - case EbmlTagIdEnum.ChapProcessCommand: - case EbmlTagIdEnum.ChapterTranslate: - case EbmlTagIdEnum.ChapProcess: - case EbmlTagIdEnum.Tag: - case EbmlTagIdEnum.Segment: - case EbmlTagIdEnum.SimpleTag: - case EbmlTagIdEnum.Targets: - case EbmlTagIdEnum.Tags: - case EbmlTagIdEnum.ChapterTrack: - case EbmlTagIdEnum.ChapterAtom: - case EbmlTagIdEnum.EditionEntry: - case EbmlTagIdEnum.Chapters: - case EbmlTagIdEnum.AttachedFile: - case EbmlTagIdEnum.Attachments: - case EbmlTagIdEnum.CueReference: - case EbmlTagIdEnum.CueTrackPositions: - case EbmlTagIdEnum.CuePoint: - case EbmlTagIdEnum.Cues: - case EbmlTagIdEnum.ContentEncAESSettings: - case EbmlTagIdEnum.ContentEncodings: - case EbmlTagIdEnum.TrackJoinBlocks: - case EbmlTagIdEnum.TrackPlane: - case EbmlTagIdEnum.TrackCombinePlanes: - case EbmlTagIdEnum.TrackOperation: - case EbmlTagIdEnum.Audio: - case EbmlTagIdEnum.Video: - case EbmlTagIdEnum.TrackEntry: - case EbmlTagIdEnum.Tracks: - case EbmlTagIdEnum.ReferenceFrame: - case EbmlTagIdEnum.TimeSlice: - case EbmlTagIdEnum.Slices: - case EbmlTagIdEnum.BlockMore: - case EbmlTagIdEnum.BlockAdditions: - case EbmlTagIdEnum.BlockGroup: - case EbmlTagIdEnum.Cluster: - case EbmlTagIdEnum.Info: - case EbmlTagIdEnum.Seek: - case EbmlTagIdEnum.SeekHead: - case EbmlTagIdEnum.SignatureElementList: - case EbmlTagIdEnum.SignatureElements: - case EbmlTagIdEnum.SignatureSlot: - case EbmlTagIdEnum.EBML: - return true; - default: - return false; - } + return getEbmlTypeByTagId(tagId) === EbmlElementType.Master; } -export function isEbmlBlockTagId( +export function isEbmlUintTagId( tagId: EbmlTagIdType -): tagId is EbmlBlockTagIdType { - return tagId === EbmlTagIdEnum.Block; +): tagId is EbmlUintTagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Uint; +} + +export function isEbmlIntTagId( + tagId: EbmlTagIdType +): tagId is EbmlIntTagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Int; +} + +export function isEbmlAsciiTagId( + tagId: EbmlTagIdType +): tagId is EbmlAsciiTagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Ascii; +} + +export function isEbmlUtf8TagId( + tagId: EbmlTagIdType +): tagId is EbmlUtf8TagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Utf8; +} + +export function isEbmlBinaryTagId( + tagId: EbmlTagIdType +): tagId is EbmlBinaryTagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Binary; +} + +export function isEbmlFloatTagId( + tagId: EbmlTagIdType +): tagId is EbmlFloatTagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Float; +} + +export function isEbmlDateTagId( + tagId: EbmlTagIdType +): tagId is EbmlDateTagIdType { + return getEbmlTypeByTagId(tagId) === EbmlElementType.Date; } export function isEbmlSimpleBlockTagId( @@ -577,256 +972,12 @@ export function isEbmlSimpleBlockTagId( return tagId === EbmlTagIdEnum.SimpleBlock; } -export function isEbmlUintDataTagId( +export function isEbmlBlockTagId( tagId: EbmlTagIdType -): tagId is EbmlUintDataTagIdType { - switch (tagId) { - case EbmlTagIdEnum.TrackType: - case EbmlTagIdEnum.FlagDefault: - case EbmlTagIdEnum.ChapterTrackNumber: - case EbmlTagIdEnum.ChapterTimeStart: - case EbmlTagIdEnum.ChapterTimeEnd: - case EbmlTagIdEnum.CueRefTime: - case EbmlTagIdEnum.CueRefCluster: - case EbmlTagIdEnum.ChapterFlagHidden: - case EbmlTagIdEnum.ContentCompAlgo: - case EbmlTagIdEnum.DocTypeReadVersion: - case EbmlTagIdEnum.EBMLVersion: - case EbmlTagIdEnum.DocTypeVersion: - case EbmlTagIdEnum.TagDefault: - case EbmlTagIdEnum.ChapterFlagEnabled: - case EbmlTagIdEnum.FileUsedStartTime: - case EbmlTagIdEnum.FileUsedEndTime: - case EbmlTagIdEnum.ContentEncodingOrder: - case EbmlTagIdEnum.ContentEncodingScope: - case EbmlTagIdEnum.ContentEncodingType: - case EbmlTagIdEnum.CueBlockNumber: - case EbmlTagIdEnum.BitDepth: - case EbmlTagIdEnum.ChapProcessTime: - case EbmlTagIdEnum.ChapProcessCodecID: - case EbmlTagIdEnum.AttachmentLink: - case EbmlTagIdEnum.TagAttachmentUID: - case EbmlTagIdEnum.TagChapterUID: - case EbmlTagIdEnum.TagEditionUID: - case EbmlTagIdEnum.TagTrackUID: - case EbmlTagIdEnum.TargetTypeValue: - case EbmlTagIdEnum.ChapterPhysicalEquiv: - case EbmlTagIdEnum.ChapterSegmentEditionUID: - case EbmlTagIdEnum.ChapterUID: - case EbmlTagIdEnum.EditionFlagOrdered: - case EbmlTagIdEnum.EditionFlagDefault: - case EbmlTagIdEnum.EditionFlagHidden: - case EbmlTagIdEnum.EditionUID: - case EbmlTagIdEnum.FileUID: - case EbmlTagIdEnum.CueRefCodecState: - case EbmlTagIdEnum.CueRefNumber: - case EbmlTagIdEnum.CueCodecState: - case EbmlTagIdEnum.CueDuration: - case EbmlTagIdEnum.CueRelativePosition: - case EbmlTagIdEnum.CueClusterPosition: - case EbmlTagIdEnum.CueTrack: - case EbmlTagIdEnum.CueTime: - case EbmlTagIdEnum.AESSettingsCipherMode: - case EbmlTagIdEnum.ContentSigHashAlgo: - case EbmlTagIdEnum.ContentSigAlgo: - case EbmlTagIdEnum.ContentEncAlgo: - case EbmlTagIdEnum.TrickMasterTrackUID: - case EbmlTagIdEnum.TrickTrackFlag: - case EbmlTagIdEnum.TrickTrackUID: - case EbmlTagIdEnum.TrackJoinUID: - case EbmlTagIdEnum.TrackPlaneType: - case EbmlTagIdEnum.TrackPlaneUID: - case EbmlTagIdEnum.Channels: - case EbmlTagIdEnum.AspectRatioType: - case EbmlTagIdEnum.DisplayUnit: - case EbmlTagIdEnum.DisplayHeight: - case EbmlTagIdEnum.DisplayWidth: - case EbmlTagIdEnum.PixelCropRight: - case EbmlTagIdEnum.PixelCropLeft: - case EbmlTagIdEnum.PixelCropTop: - case EbmlTagIdEnum.PixelCropBottom: - case EbmlTagIdEnum.PixelHeight: - case EbmlTagIdEnum.PixelWidth: - case EbmlTagIdEnum.OldStereoMode: - case EbmlTagIdEnum.AlphaMode: - case EbmlTagIdEnum.StereoMode: - case EbmlTagIdEnum.FlagInterlaced: - case EbmlTagIdEnum.TrackTranslateCodec: - case EbmlTagIdEnum.TrackTranslateEditionUID: - case EbmlTagIdEnum.SeekPreRoll: - case EbmlTagIdEnum.CodecDelay: - case EbmlTagIdEnum.TrackOverlay: - case EbmlTagIdEnum.CodecDecodeAll: - case EbmlTagIdEnum.MaxBlockAdditionID: - case EbmlTagIdEnum.DefaultDecodedFieldDuration: - case EbmlTagIdEnum.DefaultDuration: - case EbmlTagIdEnum.MaxCache: - case EbmlTagIdEnum.MinCache: - case EbmlTagIdEnum.FlagLacing: - case EbmlTagIdEnum.FlagForced: - case EbmlTagIdEnum.FlagEnabled: - case EbmlTagIdEnum.TrackUID: - case EbmlTagIdEnum.TrackNumber: - case EbmlTagIdEnum.ReferenceTimeCode: - case EbmlTagIdEnum.ReferenceOffset: - case EbmlTagIdEnum.SliceDuration: - case EbmlTagIdEnum.Delay: - case EbmlTagIdEnum.BlockAdditionID: - case EbmlTagIdEnum.FrameNumber: - case EbmlTagIdEnum.LaceNumber: - case EbmlTagIdEnum.ReferencePriority: - case EbmlTagIdEnum.BlockDuration: - case EbmlTagIdEnum.BlockAddID: - case EbmlTagIdEnum.PrevSize: - case EbmlTagIdEnum.Position: - case EbmlTagIdEnum.SilentTrackNumber: - case EbmlTagIdEnum.Timecode: - case EbmlTagIdEnum.TimecodeScaleDenominator: - case EbmlTagIdEnum.TimecodeScale: - case EbmlTagIdEnum.ChapterTranslateCodec: - case EbmlTagIdEnum.ChapterTranslateEditionUID: - case EbmlTagIdEnum.SeekPosition: - case EbmlTagIdEnum.SignatureHash: - case EbmlTagIdEnum.SignatureAlgo: - case EbmlTagIdEnum.EBMLMaxSizeLength: - case EbmlTagIdEnum.EBMLMaxIDLength: - case EbmlTagIdEnum.EBMLReadVersion: - return true; - default: - return false; - } +): tagId is EbmlBlockTagIdType { + return tagId === EbmlTagIdEnum.Block; } -export function isEbmlIntDataTagId( - tagId: EbmlTagIdType -): tagId is EbmlIntDataTagIdType { - switch (tagId) { - case EbmlTagIdEnum.TrackOffset: - case EbmlTagIdEnum.DiscardPadding: - case EbmlTagIdEnum.ReferenceVirtual: - case EbmlTagIdEnum.ReferenceBlock: - return true; - default: - return false; - } -} - -export function isEbmlFloatDataTagId( - tagId: EbmlTagIdType -): tagId is EbmlFloatDataTagIdType { - switch (tagId) { - case EbmlTagIdEnum.Duration: - case EbmlTagIdEnum.OutputSamplingFrequency: - case EbmlTagIdEnum.SamplingFrequency: - case EbmlTagIdEnum.FrameRate: - case EbmlTagIdEnum.GammaValue: - case EbmlTagIdEnum.TrackTimecodeScale: - return true; - default: - return false; - } -} - -export function isEbmlStringDataTagId( - tagId: EbmlTagIdType -): tagId is EbmlAsciiDataTagIdType { - switch (tagId) { - case EbmlTagIdEnum.CodecID: - case EbmlTagIdEnum.DocType: - case EbmlTagIdEnum.FileMimeType: - case EbmlTagIdEnum.TagLanguage: - case EbmlTagIdEnum.TargetType: - case EbmlTagIdEnum.ChapCountry: - case EbmlTagIdEnum.ChapLanguage: - case EbmlTagIdEnum.CodecDownloadURL: - case EbmlTagIdEnum.CodecInfoURL: - case EbmlTagIdEnum.Language: - return true; - default: - return false; - } -} - -export function isEbmlUtf8DataTagId( - tagId: EbmlTagIdType -): tagId is EbmlUtf8DataTagIdType { - switch (tagId) { - case EbmlTagIdEnum.ChapString: - case EbmlTagIdEnum.TagString: - case EbmlTagIdEnum.ChapterStringUID: - case EbmlTagIdEnum.WritingApp: - case EbmlTagIdEnum.SegmentFilename: - case EbmlTagIdEnum.CodecName: - case EbmlTagIdEnum.TagName: - case EbmlTagIdEnum.FileName: - case EbmlTagIdEnum.FileDescription: - case EbmlTagIdEnum.CodecSettings: - case EbmlTagIdEnum.Name: - case EbmlTagIdEnum.MuxingApp: - case EbmlTagIdEnum.Title: - case EbmlTagIdEnum.NextFilename: - case EbmlTagIdEnum.PrevFilename: - return true; - default: - return false; - } -} - -export function isEbmlDateDataTagId( - tagId: EbmlTagIdType -): tagId is EbmlDateDataTagIdType { - return tagId === EbmlTagIdEnum.DateUTC; -} - -export function isEbmlBinaryDataTagId( - tagId: EbmlTagIdType -): tagId is EbmlBinaryDataTagIdType { - switch (tagId) { - case EbmlTagIdEnum.ContentCompSettings: - case EbmlTagIdEnum.SegmentFamily: - case EbmlTagIdEnum.TagBinary: - case EbmlTagIdEnum.FileReferral: - case EbmlTagIdEnum.SignedElement: - case EbmlTagIdEnum.ChapProcessData: - case EbmlTagIdEnum.ChapProcessPrivate: - case EbmlTagIdEnum.ChapterSegmentUID: - case EbmlTagIdEnum.FileData: - case EbmlTagIdEnum.ContentSigKeyID: - case EbmlTagIdEnum.ContentSignature: - case EbmlTagIdEnum.ContentEncKeyID: - case EbmlTagIdEnum.TrickMasterTrackSegmentUID: - case EbmlTagIdEnum.TrickTrackSegmentUID: - case EbmlTagIdEnum.ChannelPositions: - case EbmlTagIdEnum.ColourSpace: - case EbmlTagIdEnum.TrackTranslateTrackID: - case EbmlTagIdEnum.CodecPrivate: - case EbmlTagIdEnum.EncryptedBlock: - case EbmlTagIdEnum.CodecState: - case EbmlTagIdEnum.BlockAdditional: - case EbmlTagIdEnum.BlockVirtual: - case EbmlTagIdEnum.ChapterTranslateID: - case EbmlTagIdEnum.NextUID: - case EbmlTagIdEnum.PrevUID: - case EbmlTagIdEnum.SegmentUID: - case EbmlTagIdEnum.SeekID: - case EbmlTagIdEnum.Signature: - case EbmlTagIdEnum.SignaturePublicKey: - case EbmlTagIdEnum.CRC32: - case EbmlTagIdEnum.Void: - return true; - default: - return false; - } -} - -export function isUnknownTagId( - tagId: EbmlDataTagIdType -): tagId is Exclude { - return !(tagId in EbmlTagIdEnum); -} -export enum EbmlBlockLacing { - None = 1, - Xiph = 2, - EBML = 3, - FixedSize = 4, +export function isEbmlUnknownTagId(tagId: EbmlTagIdType): boolean { + return typeof tagId !== 'number' || !(tagId in EbmlTagIdEnum); } diff --git a/src/models/schema.ts b/src/models/schema.ts deleted file mode 100644 index c2de126..0000000 --- a/src/models/schema.ts +++ /dev/null @@ -1,368 +0,0 @@ -import { type } from 'arktype'; -import { EbmlBlockTag } from './tag-block'; -import { EbmlSimpleBlockTag } from './tag-simple-block'; - -export const Binary = type.instanceOf(Uint8Array); - -export const EBML = type({ - EBMLMaxIDLength: 'number=4', - EBMLMaxSizeLength: 'number=8', -}); - -export const Seek = type({ - SeekID: Binary, - SeekPosition: 'number', -}); - -export const SeekHead = type({ - Seek: Seek.array(), -}); - -export const ChapterTranslate = type({ - ChapterTranslateID: Binary, - ChapterTranslateCodec: 'number', - ChapterTranslateEditionUID: 'number[]?', -}); - -export const SegmentInformation = type({ - SegmentUUID: Binary.optional(), - SegmentFilename: 'string?', - PrevUUID: Binary.optional(), - PrevFilename: 'string?', - NextUUID: Binary.optional(), - NextFilename: 'string?', - SegmentFamily: Binary.array().optional(), - ChapterTranslate: ChapterTranslate.array().optional(), - TimestampScale: 'number = 1000000', - Duration: 'number?', - DateUTC: Binary.optional(), - Title: 'string?', - MuxingApp: 'string', - WritingApp: 'string', -}); - -export const BlockMore = type({ - BlockAdditional: Binary, - BlockAddID: 'number=1', -}); - -export const BlockAddtions = type({ - BlockMore: BlockMore.array(), -}); - -export const BlockGroup = type({ - Block: type.instanceOf(EbmlBlockTag), - BlockAdditions: BlockAddtions.optional(), - /** - * @see [Matroska elements](https://www.matroska.org/technical/elements.html) - */ - BlockDuration: 'number?', - ReferencePriority: 'number=0', - ReferenceBlock: 'number[]?', - CodecState: Binary.optional(), - DiscardPadding: 'number?', -}); - -export const Cluster = type({ - Timestamp: 'number', - Position: 'number?', - PrevSize: 'number?', - SimpleBlock: type.instanceOf(EbmlSimpleBlockTag).array().optional(), - BlockGroup: BlockGroup.array().optional(), -}); - -export const CueReference = type({ - CueRefTime: 'number', -}); - -export const CueTrackPositions = type({ - CueTrack: 'number', - CueClusterPosition: 'number', - CueRelativePosition: 'number?', - CueDuration: 'number?', - CueBlockNumber: 'number?', - CueCodecState: 'number = 0', - cueReference: CueReference.array().optional(), -}); - -export const CuePoint = type({ - CueTime: 'number', - CueTrackPositions: CueTrackPositions.array(), -}); - -export const Cues = type({ - CuePoint: CuePoint.array(), -}); - -export const ContentEncAESSettings = type({ - AESSettingsCipherMode: 'number', -}); - -export const ContentEncryption = type({ - ContentEncAESSettings: ContentEncAESSettings.optional(), - ContentEncKeyID: Binary.optional(), - ContentEncAlgo: 'number=0', -}); - -export const ContentCompression = type({ - ContentCompSettings: Binary.optional(), - ContentCompAlgo: 'number=0', -}); - -export const ContentEncoding = type({ - ContentCompression: ContentCompression.optional(), - ContentEncryption: ContentEncryption.optional(), - ContentEncodingType: 'number=0', - ContentEncodingScope: 'number=1', - ContentEncodingOrder: 'number=0', -}); - -export const ContentEncodings = type({ - ContentEncoding: ContentEncoding.array(), -}); - -export const TrackPlane = type({ - TrackPlaneUID: 'number', - TrackPlaneType: 'number', -}); - -export const TrackJoinBlocks = type({ - TrackJoinUID: 'number[]', -}); - -export const TrackCombinePlanes = type({ - TrackPlane: TrackPlane.array(), -}); - -export const TrackOperation = type({ - TrackCombinePlanes: TrackCombinePlanes.optional(), - TrackJoinBlocks: TrackJoinBlocks.optional(), -}); - -export const Audio = type({ - SamplingFrequency: 'number=8000', - /** - * @see [Matroska elements](https://www.matroska.org/technical/elements.html) - */ - OutputSamplingFrequency: 'number?', - Channels: 'number=1', - BitDepth: 'number?', - Emphasis: 'number=0', -}); - -export const Projection = type({ - ProjectionType: 'number=0', - ProjectionPrivate: Binary.optional(), - ProjectionPoseYaw: 'number=0', - ProjectionPosePitch: 'number=0', - ProjectionPoseRoll: 'number=0', -}); - -export const MasteringMetadata = type({ - PrimaryRChromaticityX: 'number?', - PrimaryRChromaticityY: 'number?', - PrimaryGChromaticityX: 'number?', - PrimaryGChromaticityY: 'number?', - PrimaryBChromaticityX: 'number?', - PrimaryBChromaticityY: 'number?', - WhitePointChromaticityX: 'number?', - WhitePointChromaticityY: 'number?', - LuminanceMax: 'number?', - LuminanceMin: 'number?', -}); - -export const Colour = type({ - MatrixCoefficients: 'number=2', - BitsPerChannel: 'number=0', - ChromaSubsamplingHorz: 'number?', - ChromaSubsamplingVert: 'number?', - CbSubsamplingHorz: 'number?', - CbSubsamplingVert: 'number?', - ChromaSitingHorz: 'number=0', - ChromaSitingVert: 'number=0', - Range: 'number=0', - TransferCharacteristics: 'number=2', - Primaries: 'number=2', - MaxCLL: 'number?', - MaxFALL: 'number?', - MasteringMetadata: MasteringMetadata.optional(), -}); - -export const Video = type({ - FlagInterlaced: 'number=0', - FieldOrder: 'number=2', - StereoMode: 'number=0', - AlphaMode: 'number=0', - PixelWidth: 'number', - PixelHeight: 'number', - PixelCropBottom: 'number=0', - PixelCropTop: 'number=0', - PixelCropLeft: 'number=0', - PixelCropRight: 'number=0', - /** - * @see [Matroska elements](https://www.matroska.org/technical/elements.html) - */ - DisplayWidth: 'number?', - /** - * @see [Matroska elements](https://www.matroska.org/technical/elements.html) - */ - DisplayHeight: 'number?', - DisplayUnit: 'number=0', - UncompressedFourCC: Binary.optional(), - Colour: Colour.optional(), - Projection: Projection.optional(), -}); - -export const TrackTranslate = type({ - TrackTranslateTrackID: Binary, - TrackTranslateCodec: 'number', - TrackTranslateEditionUID: 'number[]?', -}); - -export const BlockAdditionMapping = type({ - BlockAddIDValue: 'number?', - BlockAddIDName: 'string?', - BlockAddIDType: 'number=0', - BlockAddIDExtraData: Binary.optional(), -}); - -export const TrackEntry = type({ - TrackNumber: 'number', - TrackUID: 'number', - TrackType: 'number', - FlagEnabled: 'number=1', - FlagDefault: 'number=1', - FlagForced: 'number=0', - FlagHearingImpaired: 'number?', - FlagVisualImpaired: 'number?', - FlagTextDescriptions: 'number?', - FlagOriginal: 'number?', - FlagCommentary: 'number?', - FlagLacing: 'number=1', - DefaultDuration: 'number?', - DefaultDecodedFieldDuration: 'number?', - MaxBlockAdditionID: 'number=0', - BlockAdditionMapping: BlockAdditionMapping.array().optional(), - Name: 'string?', - Language: 'string="eng"', - LanguageBCP47: 'string?', - CodecID: 'string', - CodecPrivate: Binary, - CodecName: 'string?', - CodecDelay: 'number=0', - SeekPreRoll: 'number=0', - TrackTranslate: TrackTranslate.array().optional(), - Video: Video.optional(), - Audio: Audio.optional(), - TrackOperation: TrackOperation.optional(), - ContentEncodings: ContentEncodings.optional(), -}); - -export const Tracks = type({ - TrackEntry: TrackEntry.array(), -}); - -export const AttachedFile = type({ - FileDescription: 'string?', - FileName: 'string', - FileMediaType: 'string', - FileData: Binary, - FileUID: 'number', -}); - -export const Attachments = type({ - AttachedFile: AttachedFile.array(), -}); - -export const EditionDisplay = type({ - EditionString: 'string', - EditionLanguageIETF: 'string[]?', -}); - -export const ChapterDisplay = type({ - ChapString: 'string', - ChapLanguage: 'string[]', - ChapLanguageBCP47: 'string[]?', - ChapCountry: 'string[]?', -}); - -export const ChapterTrack = type({ - ChapterTrackUID: 'number', -}); - -export const ChapProcessCommand = type({ - ChapProcessTime: 'number', - ChapProcessData: Binary, -}); - -export const ChapProcess = type({ - ChapProcessCodecID: 'number=0', - ChapProcessPrivate: Binary, - ChapProcessCommand: ChapProcessCommand.array().optional(), -}); - -export const ChapterAtom = type({ - ChapterUID: 'number', - ChapterStringUID: 'string?', - ChapterTimeStart: 'number', - ChapterTimeEnd: 'number?', - ChapterFlagHidden: 'number=0', - ChapterFlagEnabled: 'number=1', - ChapterSegmentUUID: Binary, - ChapterSkipType: 'number?', - ChapterSegmentEditionUID: 'number?', - ChapterPhysicalEquiv: 'number?', - ChapterTrack: ChapterTrack.optional(), - ChapterDisplay: ChapterDisplay.array().optional(), - ChapProcess: ChapProcess.array().optional(), -}); - -export const EditionEntry = type({ - EditionUID: 'number?', - EditionFlagHidden: 'number=0', - EditionFlagDefault: 'number=0', - EditionFlagOrdered: 'number=0', - EditionDisplay: EditionDisplay.array().optional(), -}); - -export const Chapters = type({ - EditionEntry: EditionEntry.array(), -}); - -export const Targets = type({ - TargetTypeValue: 'number=50', - TargetType: 'string?', - TagTrackUID: 'number[]?', - TagEditionUID: 'number[]?', - TagChapterUID: 'number[]?', - TagAttachmentUID: 'number[]?', -}); - -export const Tag = type({ - Targets: Targets, -}); - -export const SimpleTag = type({ - TagName: 'string', - TagLanguage: 'string="und"', - TagLanguageBCP47: 'string?', - TagDefault: 'number=1', - TagString: 'string?', - TagBinary: Binary, -}); - -export const Tags = type({ - Tag: Tag.array(), - SimpleTag: SimpleTag.array(), -}); - -export const Segment = type({ - SeekHead: SeekHead.array().optional(), - SegmentInformation: SegmentInformation, - Cluster: Cluster.array().optional(), - Tracks: Tracks.optional(), - Cues: Cues.optional(), - Attachments: Attachments.optional(), - Chapters: Chapters.optional(), - Tags: Tags.optional(), -}); diff --git a/src/models/tag-data.ts b/src/models/tag-data.ts index 5bf614f..376fb6a 100644 --- a/src/models/tag-data.ts +++ b/src/models/tag-data.ts @@ -41,19 +41,19 @@ export class EbmlDataTag extends EbmlTagTrait { const offset = controller.getOffset(); const view = await controller.read(offset, this.contentLength, true); switch (this.type) { - case EbmlElementType.UnsignedInt: + case EbmlElementType.Uint: this.data = readUnsigned(view); break; case EbmlElementType.Float: this.data = readFloat(view); break; - case EbmlElementType.Integer: + case EbmlElementType.Int: this.data = readSigned(view); break; case EbmlElementType.Ascii: this.data = readAscii(view); break; - case EbmlElementType.UTF8: + case EbmlElementType.Utf8: this.data = readUtf8(view); break; default: @@ -65,19 +65,19 @@ export class EbmlDataTag extends EbmlTagTrait { *encodeContent(): Generator { switch (this.type) { - case EbmlElementType.UnsignedInt: + case EbmlElementType.Uint: yield writeUnsigned(this.data as any); break; case EbmlElementType.Float: yield writeFloat(this.data as any); break; - case EbmlElementType.Integer: + case EbmlElementType.Int: yield writeSigned(this.data as any); break; case EbmlElementType.Ascii: yield writeAscii(this.data as any); break; - case EbmlElementType.UTF8: + case EbmlElementType.Utf8: yield writeUtf8(this.data as any); break; default: diff --git a/src/models/tag.ts b/src/models/tag-union.ts similarity index 75% rename from src/models/tag.ts rename to src/models/tag-union.ts index b6e9a7b..6da0485 100644 --- a/src/models/tag.ts +++ b/src/models/tag-union.ts @@ -1,14 +1,14 @@ import type { + EbmlSimpleBlockTagIdType, EbmlBlockTagIdType, EbmlElementType, - EbmlSimpleBlockTagIdType, EbmlTagIdEnum, EbmlTagPosition, } from './enums'; -import type { EbmlBlockTag } from './tag-block'; import type { EbmlDataTag } from './tag-data'; import type { EbmlMasterTag } from './tag-master'; import type { EbmlSimpleBlockTag } from './tag-simple-block'; +import type { EbmlBlockTag } from './tag-block'; export type EbmlTagExcludeField = | 'id' @@ -22,488 +22,20 @@ export interface EbmlUintTagTypeBase extends Omit { position: EbmlTagPosition.Content; parent?: EbmlMasterTag; - type: EbmlElementType.UnsignedInt; + type: EbmlElementType.Uint; data: number | bigint; children?: []; } -export interface EbmlTrackTypeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackType; -} - -export interface EbmlFlagDefaultTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FlagDefault; -} -export interface EbmlChapterTrackNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterTrackNumber; -} -export interface EbmlChapterTimeStartTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterTimeStart; -} -export interface EbmlChapterTimeEndTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterTimeEnd; -} -export interface EbmlCueRefTimeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueRefTime; -} -export interface EbmlCueRefClusterTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueRefCluster; -} -export interface EbmlChapterFlagHiddenTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterFlagHidden; -} -export interface EbmlContentCompAlgoTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentCompAlgo; -} -export interface EbmlDocTypeReadVersionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DocTypeReadVersion; -} -export interface EbmlEBMLVersionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EBMLVersion; -} -export interface EbmlDocTypeVersionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DocTypeVersion; -} -export interface EbmlTagDefaultTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TagDefault; -} -export interface EbmlChapterFlagEnabledTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterFlagEnabled; -} -export interface EbmlFileUsedStartTimeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FileUsedStartTime; -} -export interface EbmlFileUsedEndTimeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FileUsedEndTime; -} -export interface EbmlContentEncodingOrderTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentEncodingOrder; -} -export interface EbmlContentEncodingScopeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentEncodingScope; -} -export interface EbmlContentEncodingTypeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentEncodingType; -} -export interface EbmlCueBlockNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueBlockNumber; -} -export interface EbmlBitDepthTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.BitDepth; -} -export interface EbmlChapProcessTimeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapProcessTime; -} -export interface EbmlChapProcessCodecIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapProcessCodecID; -} -export interface EbmlAttachmentLinkTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.AttachmentLink; -} -export interface EbmlTagAttachmentUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TagAttachmentUID; -} -export interface EbmlTagChapterUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TagChapterUID; -} -export interface EbmlTagEditionUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TagEditionUID; -} -export interface EbmlTagTrackUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TagTrackUID; -} -export interface EbmlTargetTypeValueTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TargetTypeValue; -} -export interface EbmlChapterPhysicalEquivTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterPhysicalEquiv; -} -export interface EbmlChapterSegmentEditionUIDTagType - extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterSegmentEditionUID; -} -export interface EbmlChapterUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterUID; -} -export interface EbmlEditionFlagOrderedTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EditionFlagOrdered; -} -export interface EbmlEditionFlagDefaultTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EditionFlagDefault; -} -export interface EbmlEditionFlagHiddenTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EditionFlagHidden; -} -export interface EbmlEditionUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EditionUID; -} -export interface EbmlFileUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FileUID; -} -export interface EbmlCueRefCodecStateTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueRefCodecState; -} -export interface EbmlCueRefNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueRefNumber; -} -export interface EbmlCueCodecStateTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueCodecState; -} -export interface EbmlCueDurationTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueDuration; -} -export interface EbmlCueRelativePositionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueRelativePosition; -} -export interface EbmlCueClusterPositionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueClusterPosition; -} -export interface EbmlCueTrackTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueTrack; -} -export interface EbmlCueTimeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CueTime; -} -export interface EbmlAESSettingsCipherModeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.AESSettingsCipherMode; -} -export interface EbmlContentSigHashAlgoTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentSigHashAlgo; -} -export interface EbmlContentSigAlgoTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentSigAlgo; -} -export interface EbmlContentEncAlgoTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ContentEncAlgo; -} -export interface EbmlTrickMasterTrackUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrickMasterTrackUID; -} -export interface EbmlTrickTrackFlagTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrickTrackFlag; -} -export interface EbmlTrickTrackUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrickTrackUID; -} -export interface EbmlTrackJoinUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackJoinUID; -} -export interface EbmlTrackPlaneTypeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackPlaneType; -} -export interface EbmlTrackPlaneUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackPlaneUID; -} -export interface EbmlChannelsTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.Channels; -} -export interface EbmlAspectRatioTypeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.AspectRatioType; -} -export interface EbmlDisplayUnitTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DisplayUnit; -} -export interface EbmlDisplayHeightTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DisplayHeight; -} -export interface EbmlDisplayWidthTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DisplayWidth; -} -export interface EbmlPixelCropRightTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PixelCropRight; -} -export interface EbmlPixelCropLeftTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PixelCropLeft; -} -export interface EbmlPixelCropTopTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PixelCropTop; -} -export interface EbmlPixelCropBottomTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PixelCropBottom; -} -export interface EbmlPixelHeightTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PixelHeight; -} -export interface EbmlPixelWidthTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PixelWidth; -} -export interface EbmlOldStereoModeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.OldStereoMode; -} -export interface EbmlAlphaModeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.AlphaMode; -} -export interface EbmlStereoModeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.StereoMode; -} -export interface EbmlFlagInterlacedTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FlagInterlaced; -} -export interface EbmlTrackTranslateCodecTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackTranslateCodec; -} -export interface EbmlTrackTranslateEditionUIDTagType - extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackTranslateEditionUID; -} -export interface EbmlSeekPreRollTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.SeekPreRoll; -} -export interface EbmlCodecDelayTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CodecDelay; -} -export interface EbmlTrackOverlayTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackOverlay; -} -export interface EbmlCodecDecodeAllTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.CodecDecodeAll; -} -export interface EbmlMaxBlockAdditionIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.MaxBlockAdditionID; -} -export interface EbmlDefaultDecodedFieldDurationTagType - extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DefaultDecodedFieldDuration; -} -export interface EbmlDefaultDurationTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.DefaultDuration; -} -export interface EbmlMaxCacheTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.MaxCache; -} -export interface EbmlMinCacheTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.MinCache; -} -export interface EbmlFlagLacingTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FlagLacing; -} -export interface EbmlFlagForcedTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FlagForced; -} -export interface EbmlFlagEnabledTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FlagEnabled; -} -export interface EbmlTrackUIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackUID; -} -export interface EbmlTrackNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TrackNumber; -} -export interface EbmlReferenceTimeCodeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ReferenceTimeCode; -} -export interface EbmlReferenceOffsetTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ReferenceOffset; -} -export interface EbmlSliceDurationTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.SliceDuration; -} -export interface EbmlDelayTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.Delay; -} -export interface EbmlBlockAdditionIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.BlockAdditionID; -} -export interface EbmlFrameNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.FrameNumber; -} -export interface EbmlLaceNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.LaceNumber; -} -export interface EbmlReferencePriorityTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ReferencePriority; -} -export interface EbmlBlockDurationTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.BlockDuration; -} -export interface EbmlBlockAddIDTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.BlockAddID; -} -export interface EbmlPrevSizeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.PrevSize; -} -export interface EbmlPositionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.Position; -} -export interface EbmlSilentTrackNumberTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.SilentTrackNumber; -} -export interface EbmlTimecodeTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.Timecode; -} -export interface EbmlTimecodeScaleDenominatorTagType - extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TimecodeScaleDenominator; -} -export interface EbmlTimecodeScaleTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.TimecodeScale; -} -export interface EbmlChapterTranslateCodecTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterTranslateCodec; -} -export interface EbmlChapterTranslateEditionUIDTagType - extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.ChapterTranslateEditionUID; -} -export interface EbmlSeekPositionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.SeekPosition; -} -export interface EbmlSignatureHashTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.SignatureHash; -} -export interface EbmlSignatureAlgoTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.SignatureAlgo; -} -export interface EbmlEBMLMaxSizeLengthTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EBMLMaxSizeLength; -} -export interface EbmlEBMLMaxIDLengthTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EBMLMaxIDLength; -} -export interface EbmlEBMLReadVersionTagType extends EbmlUintTagTypeBase { - id: EbmlTagIdEnum.EBMLReadVersion; -} - -export type EbmlUintTagType = - | EbmlTrackTypeTagType - | EbmlFlagDefaultTagType - | EbmlChapterTrackNumberTagType - | EbmlChapterTimeStartTagType - | EbmlChapterTimeEndTagType - | EbmlCueRefTimeTagType - | EbmlCueRefClusterTagType - | EbmlChapterFlagHiddenTagType - | EbmlContentCompAlgoTagType - | EbmlDocTypeReadVersionTagType - | EbmlEBMLVersionTagType - | EbmlDocTypeVersionTagType - | EbmlTagDefaultTagType - | EbmlChapterFlagEnabledTagType - | EbmlFileUsedStartTimeTagType - | EbmlFileUsedEndTimeTagType - | EbmlContentEncodingOrderTagType - | EbmlContentEncodingScopeTagType - | EbmlContentEncodingTypeTagType - | EbmlCueBlockNumberTagType - | EbmlBitDepthTagType - | EbmlChapProcessTimeTagType - | EbmlChapProcessCodecIDTagType - | EbmlAttachmentLinkTagType - | EbmlTagAttachmentUIDTagType - | EbmlTagChapterUIDTagType - | EbmlTagEditionUIDTagType - | EbmlTagTrackUIDTagType - | EbmlTargetTypeValueTagType - | EbmlChapterPhysicalEquivTagType - | EbmlChapterSegmentEditionUIDTagType - | EbmlChapterUIDTagType - | EbmlEditionFlagOrderedTagType - | EbmlEditionFlagDefaultTagType - | EbmlEditionFlagHiddenTagType - | EbmlEditionUIDTagType - | EbmlFileUIDTagType - | EbmlCueRefCodecStateTagType - | EbmlCueRefNumberTagType - | EbmlCueCodecStateTagType - | EbmlCueDurationTagType - | EbmlCueRelativePositionTagType - | EbmlCueClusterPositionTagType - | EbmlCueTrackTagType - | EbmlCueTimeTagType - | EbmlAESSettingsCipherModeTagType - | EbmlContentSigHashAlgoTagType - | EbmlContentSigAlgoTagType - | EbmlContentEncAlgoTagType - | EbmlTrickMasterTrackUIDTagType - | EbmlTrickTrackFlagTagType - | EbmlTrickTrackUIDTagType - | EbmlTrackJoinUIDTagType - | EbmlTrackPlaneTypeTagType - | EbmlTrackPlaneUIDTagType - | EbmlChannelsTagType - | EbmlAspectRatioTypeTagType - | EbmlDisplayUnitTagType - | EbmlDisplayHeightTagType - | EbmlDisplayWidthTagType - | EbmlPixelCropRightTagType - | EbmlPixelCropLeftTagType - | EbmlPixelCropTopTagType - | EbmlPixelCropBottomTagType - | EbmlPixelHeightTagType - | EbmlPixelWidthTagType - | EbmlOldStereoModeTagType - | EbmlAlphaModeTagType - | EbmlStereoModeTagType - | EbmlFlagInterlacedTagType - | EbmlTrackTranslateCodecTagType - | EbmlTrackTranslateEditionUIDTagType - | EbmlSeekPreRollTagType - | EbmlCodecDelayTagType - | EbmlTrackOverlayTagType - | EbmlCodecDecodeAllTagType - | EbmlMaxBlockAdditionIDTagType - | EbmlDefaultDecodedFieldDurationTagType - | EbmlDefaultDurationTagType - | EbmlMaxCacheTagType - | EbmlMinCacheTagType - | EbmlFlagLacingTagType - | EbmlFlagForcedTagType - | EbmlFlagEnabledTagType - | EbmlTrackUIDTagType - | EbmlTrackNumberTagType - | EbmlReferenceTimeCodeTagType - | EbmlReferenceOffsetTagType - | EbmlSliceDurationTagType - | EbmlDelayTagType - | EbmlBlockAdditionIDTagType - | EbmlFrameNumberTagType - | EbmlLaceNumberTagType - | EbmlReferencePriorityTagType - | EbmlBlockDurationTagType - | EbmlBlockAddIDTagType - | EbmlPrevSizeTagType - | EbmlPositionTagType - | EbmlSilentTrackNumberTagType - | EbmlTimecodeTagType - | EbmlTimecodeScaleDenominatorTagType - | EbmlTimecodeScaleTagType - | EbmlChapterTranslateCodecTagType - | EbmlChapterTranslateEditionUIDTagType - | EbmlSeekPositionTagType - | EbmlSignatureHashTagType - | EbmlSignatureAlgoTagType - | EbmlEBMLMaxSizeLengthTagType - | EbmlEBMLMaxIDLengthTagType - | EbmlEBMLReadVersionTagType; - export interface EbmlIntTagTypeBase extends Omit { position: EbmlTagPosition.Content; parent?: EbmlMasterTag; - type: EbmlElementType.Integer; + type: EbmlElementType.Int; data: number | bigint; children?: []; } -export interface EbmlTrackOffsetTagType extends EbmlIntTagTypeBase { - id: EbmlTagIdEnum.TrackOffset; -} -export interface EbmlDiscardPaddingTagType extends EbmlIntTagTypeBase { - id: EbmlTagIdEnum.DiscardPadding; -} -export interface EbmlReferenceVirtualTagType extends EbmlIntTagTypeBase { - id: EbmlTagIdEnum.ReferenceVirtual; -} -export interface EbmlReferenceBlockTagType extends EbmlIntTagTypeBase { - id: EbmlTagIdEnum.ReferenceBlock; -} - -export type EbmlIntTagType = - | EbmlTrackOffsetTagType - | EbmlDiscardPaddingTagType - | EbmlReferenceVirtualTagType - | EbmlReferenceBlockTagType; - export interface EbmlAsciiTagTypeBase extends Omit { position: EbmlTagPosition.Content; @@ -513,171 +45,15 @@ export interface EbmlAsciiTagTypeBase children?: []; } -export interface EbmlCodecIDTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.CodecID; -} -export interface EbmlDocTypeTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.DocType; -} -export interface EbmlFileMimeTypeTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.FileMimeType; -} -export interface EbmlTagLanguageTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.TagLanguage; -} -export interface EbmlTargetTypeTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.TargetType; -} -export interface EbmlChapCountryTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.ChapCountry; -} -export interface EbmlChapLanguageTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.ChapLanguage; -} -export interface EbmlCodecDownloadURLTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.CodecDownloadURL; -} -export interface EbmlCodecInfoURLTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.CodecInfoURL; -} -export interface EbmlLanguageTagType extends EbmlAsciiTagTypeBase { - id: EbmlTagIdEnum.Language; -} - -export type EbmlAsciiTagType = - | EbmlCodecIDTagType - | EbmlDocTypeTagType - | EbmlFileMimeTypeTagType - | EbmlTagLanguageTagType - | EbmlTargetTypeTagType - | EbmlChapCountryTagType - | EbmlChapLanguageTagType - | EbmlCodecDownloadURLTagType - | EbmlCodecInfoURLTagType - | EbmlLanguageTagType; - -export type EbmlUtf8TagTypeBase = Omit & { - position: EbmlTagPosition.Content; - parent?: EbmlMasterTag; - type: EbmlElementType.UTF8; - data: string; - children?: []; -}; - -export interface EbmlChapStringTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.ChapString; -} -export interface EbmlTagStringTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.TagString; -} -export interface EbmlChapterStringUIDTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.ChapterStringUID; -} -export interface EbmlWritingAppTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.WritingApp; -} -export interface EbmlSegmentFilenameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.SegmentFilename; -} -export interface EbmlCodecNameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.CodecName; -} -export interface EbmlTagNameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.TagName; -} -export interface EbmlFileNameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.FileName; -} -export interface EbmlFileDescriptionTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.FileDescription; -} -export interface EbmlCodecSettingsTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.CodecSettings; -} -export interface EbmlNameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.Name; -} -export interface EbmlMuxingAppTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.MuxingApp; -} -export interface EbmlTitleTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.Title; -} -export interface EbmlNextFilenameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.NextFilename; -} -export interface EbmlPrevFilenameTagType extends EbmlUtf8TagTypeBase { - id: EbmlTagIdEnum.PrevFilename; -} - -export type EbmlUtf8TagType = - | EbmlChapStringTagType - | EbmlTagStringTagType - | EbmlChapterStringUIDTagType - | EbmlWritingAppTagType - | EbmlSegmentFilenameTagType - | EbmlCodecNameTagType - | EbmlTagNameTagType - | EbmlFileNameTagType - | EbmlFileDescriptionTagType - | EbmlCodecSettingsTagType - | EbmlNameTagType - | EbmlMuxingAppTagType - | EbmlTitleTagType - | EbmlNextFilenameTagType - | EbmlPrevFilenameTagType; - -export type EbmlDateTagTypeBase = Omit & { - position: EbmlTagPosition.Content; - parent?: EbmlMasterTag; - type: EbmlElementType.Date; - data: Uint8Array; - children?: []; -}; - -export interface EbmlDateUTCTagType extends EbmlDateTagTypeBase { - id: EbmlTagIdEnum.DateUTC; -} - -export type EbmlDateTagType = EbmlDateUTCTagType; - -export interface EbmlFloatTagTypeBase +export interface EbmlUtf8TagTypeBase extends Omit { position: EbmlTagPosition.Content; parent?: EbmlMasterTag; - type: EbmlElementType.Float; - data: number; + type: EbmlElementType.Utf8; + data: undefined; children?: []; } -export interface EbmlDurationTagType extends EbmlFloatTagTypeBase { - id: EbmlTagIdEnum.Duration; -} -export interface EbmlOutputSamplingFrequencyTagType - extends EbmlFloatTagTypeBase { - id: EbmlTagIdEnum.OutputSamplingFrequency; -} -export interface EbmlSamplingFrequencyTagType extends EbmlFloatTagTypeBase { - id: EbmlTagIdEnum.SamplingFrequency; -} -export interface EbmlFrameRateTagType extends EbmlFloatTagTypeBase { - id: EbmlTagIdEnum.FrameRate; -} -export interface EbmlGammaValueTagType extends EbmlFloatTagTypeBase { - id: EbmlTagIdEnum.GammaValue; -} -export interface EbmlTrackTimecodeScaleTagType extends EbmlFloatTagTypeBase { - id: EbmlTagIdEnum.TrackTimecodeScale; -} - -export type EbmlFloatTagType = - | EbmlDurationTagType - | EbmlOutputSamplingFrequencyTagType - | EbmlSamplingFrequencyTagType - | EbmlFrameRateTagType - | EbmlGammaValueTagType - | EbmlTrackTimecodeScaleTagType; - export interface EbmlBinaryTagTypeBase extends Omit { position: EbmlTagPosition.Content; @@ -687,160 +63,1449 @@ export interface EbmlBinaryTagTypeBase children?: []; } -export interface EbmlContentCompSettingsTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ContentCompSettings; +export interface EbmlFloatTagTypeBase + extends Omit { + position: EbmlTagPosition.Content; + parent?: EbmlMasterTag; + type: EbmlElementType.Float; + data: number; + children?: []; } -export interface EbmlSegmentFamilyTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.SegmentFamily; + +export interface EbmlDateTagTypeBase + extends Omit { + position: EbmlTagPosition.Content; + parent?: EbmlMasterTag; + type: EbmlElementType.Date; + data: Uint8Array; + children?: []; } -export interface EbmlTagBinaryTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.TagBinary; + +export interface EbmlMasterTagTypeBase + extends Omit { + type: EbmlElementType.Master; + position: EbmlTagPosition.Start | EbmlTagPosition.End; + parent?: EbmlMasterTag; + children: EbmlTagType[]; + data?: undefined; } -export interface EbmlFileReferralTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.FileReferral; + +export interface EbmlEBMLTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.EBML; } -export interface EbmlSignedElementTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.SignedElement; + +export interface EbmlSignatureSlotTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.SignatureSlot; } -export interface EbmlChapProcessDataTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ChapProcessData; + +export interface EbmlSignatureElementsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.SignatureElements; } -export interface EbmlChapProcessPrivateTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ChapProcessPrivate; + +export interface EbmlSignatureElementListTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.SignatureElementList; } -export interface EbmlChapterSegmentUIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ChapterSegmentUID; + +export interface EbmlSegmentTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Segment; } -export interface EbmlFileDataTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.FileData; + +export interface EbmlSeekHeadTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.SeekHead; } -export interface EbmlContentSigKeyIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ContentSigKeyID; + +export interface EbmlSeekTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Seek; } -export interface EbmlContentSignatureTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ContentSignature; + +export interface EbmlInfoTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Info; } -export interface EbmlContentEncKeyIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ContentEncKeyID; + +export interface EbmlChapterTranslateTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ChapterTranslate; } -export interface EbmlTrickMasterTrackSegmentUIDTagType - extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.TrickMasterTrackSegmentUID; + +export interface EbmlClusterTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Cluster; } -export interface EbmlTrickTrackSegmentUIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.TrickTrackSegmentUID; + +export interface EbmlSilentTracksTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.SilentTracks; } -export interface EbmlChannelPositionsTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ChannelPositions; + +export interface EbmlBlockGroupTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.BlockGroup; } -export interface EbmlColourSpaceTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ColourSpace; + +export interface EbmlBlockAdditionsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.BlockAdditions; } -export interface EbmlTrackTranslateTrackIDTagType - extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.TrackTranslateTrackID; + +export interface EbmlBlockMoreTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.BlockMore; } -export interface EbmlCodecPrivateTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.CodecPrivate; + +export interface EbmlSlicesTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Slices; } -export interface EbmlEncryptedBlockTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.EncryptedBlock; + +export interface EbmlTimeSliceTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TimeSlice; } -export interface EbmlCodecStateTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.CodecState; + +export interface EbmlReferenceFrameTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ReferenceFrame; } -export interface EbmlBlockAdditionalTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.BlockAdditional; + +export interface EbmlTracksTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Tracks; } -export interface EbmlBlockVirtualTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.BlockVirtual; + +export interface EbmlTrackEntryTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TrackEntry; } -export interface EbmlChapterTranslateIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.ChapterTranslateID; + +export interface EbmlTrackTranslateTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TrackTranslate; } -export interface EbmlNextUIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.NextUID; + +export interface EbmlVideoTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Video; } -export interface EbmlPrevUIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.PrevUID; + +export interface EbmlAudioTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Audio; } -export interface EbmlSegmentUIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.SegmentUID; + +export interface EbmlTrackOperationTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TrackOperation; } -export interface EbmlSeekIDTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.SeekID; + +export interface EbmlTrackCombinePlanesTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TrackCombinePlanes; } -export interface EbmlSignatureTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.Signature; + +export interface EbmlTrackPlaneTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TrackPlane; } -export interface EbmlSignaturePublicKeyTagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.SignaturePublicKey; + +export interface EbmlTrackJoinBlocksTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.TrackJoinBlocks; } -export interface EbmlCRC32TagType extends EbmlBinaryTagTypeBase { - id: EbmlTagIdEnum.CRC32; + +export interface EbmlContentEncodingsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ContentEncodings; } + +export interface EbmlContentEncodingTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ContentEncoding; +} + +export interface EbmlContentCompressionTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ContentCompression; +} + +export interface EbmlContentEncryptionTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ContentEncryption; +} + +export interface EbmlCuesTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Cues; +} + +export interface EbmlCuePointTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.CuePoint; +} + +export interface EbmlCueTrackPositionsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.CueTrackPositions; +} + +export interface EbmlCueReferenceTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.CueReference; +} + +export interface EbmlAttachmentsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Attachments; +} + +export interface EbmlAttachedFileTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.AttachedFile; +} + +export interface EbmlChaptersTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Chapters; +} + +export interface EbmlEditionEntryTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.EditionEntry; +} + +export interface EbmlChapterAtomTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ChapterAtom; +} + +export interface EbmlChapterTrackTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ChapterTrack; +} + +export interface EbmlChapterDisplayTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ChapterDisplay; +} + +export interface EbmlChapProcessTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ChapProcess; +} + +export interface EbmlChapProcessCommandTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ChapProcessCommand; +} + +export interface EbmlTagsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Tags; +} + +export interface EbmlTagTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Tag; +} + +export interface EbmlTargetsTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Targets; +} + +export interface EbmlSimpleTagTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.SimpleTag; +} + +export interface EbmlDocTypeExtensionTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.DocTypeExtension; +} + +export interface EbmlBlockAdditionMappingTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.BlockAdditionMapping; +} + +export interface EbmlColourTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Colour; +} + +export interface EbmlMasteringMetadataTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.MasteringMetadata; +} + +export interface EbmlProjectionTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.Projection; +} + +export interface EbmlContentEncAESSettingsTagType + extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.ContentEncAESSettings; +} + +export interface EbmlEditionDisplayTagType extends EbmlMasterTagTypeBase { + id: EbmlTagIdEnum.EditionDisplay; +} + +export type EbmlMasterTagType = + | EbmlEBMLTagType + | EbmlSignatureSlotTagType + | EbmlSignatureElementsTagType + | EbmlSignatureElementListTagType + | EbmlSegmentTagType + | EbmlSeekHeadTagType + | EbmlSeekTagType + | EbmlInfoTagType + | EbmlChapterTranslateTagType + | EbmlClusterTagType + | EbmlSilentTracksTagType + | EbmlBlockGroupTagType + | EbmlBlockAdditionsTagType + | EbmlBlockMoreTagType + | EbmlSlicesTagType + | EbmlTimeSliceTagType + | EbmlReferenceFrameTagType + | EbmlTracksTagType + | EbmlTrackEntryTagType + | EbmlTrackTranslateTagType + | EbmlVideoTagType + | EbmlAudioTagType + | EbmlTrackOperationTagType + | EbmlTrackCombinePlanesTagType + | EbmlTrackPlaneTagType + | EbmlTrackJoinBlocksTagType + | EbmlContentEncodingsTagType + | EbmlContentEncodingTagType + | EbmlContentCompressionTagType + | EbmlContentEncryptionTagType + | EbmlCuesTagType + | EbmlCuePointTagType + | EbmlCueTrackPositionsTagType + | EbmlCueReferenceTagType + | EbmlAttachmentsTagType + | EbmlAttachedFileTagType + | EbmlChaptersTagType + | EbmlEditionEntryTagType + | EbmlChapterAtomTagType + | EbmlChapterTrackTagType + | EbmlChapterDisplayTagType + | EbmlChapProcessTagType + | EbmlChapProcessCommandTagType + | EbmlTagsTagType + | EbmlTagTagType + | EbmlTargetsTagType + | EbmlSimpleTagTagType + | EbmlDocTypeExtensionTagType + | EbmlBlockAdditionMappingTagType + | EbmlColourTagType + | EbmlMasteringMetadataTagType + | EbmlProjectionTagType + | EbmlContentEncAESSettingsTagType + | EbmlEditionDisplayTagType; + +export interface EbmlEBMLVersionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EBMLVersion; +} + +export interface EbmlEBMLReadVersionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EBMLReadVersion; +} + +export interface EbmlEBMLMaxIDLengthTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EBMLMaxIDLength; +} + +export interface EbmlEBMLMaxSizeLengthTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EBMLMaxSizeLength; +} + +export interface EbmlDocTypeVersionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DocTypeVersion; +} + +export interface EbmlDocTypeReadVersionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DocTypeReadVersion; +} + +export interface EbmlSignatureAlgoTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.SignatureAlgo; +} + +export interface EbmlSignatureHashTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.SignatureHash; +} + +export interface EbmlSeekPositionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.SeekPosition; +} + +export interface EbmlChapterTranslateEditionUIDTagType + extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterTranslateEditionUID; +} + +export interface EbmlChapterTranslateCodecTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterTranslateCodec; +} + +export interface EbmlTimestampScaleTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TimestampScale; +} + +export interface EbmlTimestampTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Timestamp; +} + +export interface EbmlSilentTrackNumberTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.SilentTrackNumber; +} + +export interface EbmlPositionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Position; +} + +export interface EbmlPrevSizeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PrevSize; +} + +export interface EbmlBlockAddIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BlockAddID; +} + +export interface EbmlBlockDurationTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BlockDuration; +} + +export interface EbmlReferencePriorityTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ReferencePriority; +} + +export interface EbmlLaceNumberTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.LaceNumber; +} + +export interface EbmlFrameNumberTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FrameNumber; +} + +export interface EbmlBlockAdditionIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BlockAdditionID; +} + +export interface EbmlDelayTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Delay; +} + +export interface EbmlSliceDurationTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.SliceDuration; +} + +export interface EbmlReferenceOffsetTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ReferenceOffset; +} + +export interface EbmlReferenceTimestampTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ReferenceTimestamp; +} + +export interface EbmlTrackNumberTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackNumber; +} + +export interface EbmlTrackUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackUID; +} + +export interface EbmlTrackTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackType; +} + +export interface EbmlFlagEnabledTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagEnabled; +} + +export interface EbmlFlagDefaultTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagDefault; +} + +export interface EbmlFlagForcedTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagForced; +} + +export interface EbmlFlagLacingTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagLacing; +} + +export interface EbmlMinCacheTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.MinCache; +} + +export interface EbmlMaxCacheTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.MaxCache; +} + +export interface EbmlDefaultDurationTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DefaultDuration; +} + +export interface EbmlMaxBlockAdditionIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.MaxBlockAdditionID; +} + +export interface EbmlAttachmentLinkTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.AttachmentLink; +} + +export interface EbmlCodecDecodeAllTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CodecDecodeAll; +} + +export interface EbmlTrackOverlayTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackOverlay; +} + +export interface EbmlTrackTranslateEditionUIDTagType + extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackTranslateEditionUID; +} + +export interface EbmlTrackTranslateCodecTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackTranslateCodec; +} + +export interface EbmlFlagInterlacedTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagInterlaced; +} + +export interface EbmlStereoModeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.StereoMode; +} + +export interface EbmlOldStereoModeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.OldStereoMode; +} + +export interface EbmlPixelWidthTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PixelWidth; +} + +export interface EbmlPixelHeightTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PixelHeight; +} + +export interface EbmlPixelCropBottomTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PixelCropBottom; +} + +export interface EbmlPixelCropTopTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PixelCropTop; +} + +export interface EbmlPixelCropLeftTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PixelCropLeft; +} + +export interface EbmlPixelCropRightTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.PixelCropRight; +} + +export interface EbmlDisplayWidthTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DisplayWidth; +} + +export interface EbmlDisplayHeightTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DisplayHeight; +} + +export interface EbmlDisplayUnitTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DisplayUnit; +} + +export interface EbmlAspectRatioTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.AspectRatioType; +} + +export interface EbmlChannelsTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Channels; +} + +export interface EbmlBitDepthTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BitDepth; +} + +export interface EbmlTrackPlaneUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackPlaneUID; +} + +export interface EbmlTrackPlaneTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackPlaneType; +} + +export interface EbmlTrackJoinUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrackJoinUID; +} + +export interface EbmlTrickTrackUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrickTrackUID; +} + +export interface EbmlTrickTrackFlagTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrickTrackFlag; +} + +export interface EbmlTrickMasterTrackUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TrickMasterTrackUID; +} + +export interface EbmlContentEncodingOrderTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentEncodingOrder; +} + +export interface EbmlContentEncodingScopeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentEncodingScope; +} + +export interface EbmlContentEncodingTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentEncodingType; +} + +export interface EbmlContentCompAlgoTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentCompAlgo; +} + +export interface EbmlContentEncAlgoTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentEncAlgo; +} + +export interface EbmlContentSigAlgoTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentSigAlgo; +} + +export interface EbmlContentSigHashAlgoTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ContentSigHashAlgo; +} + +export interface EbmlCueTimeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueTime; +} + +export interface EbmlCueTrackTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueTrack; +} + +export interface EbmlCueClusterPositionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueClusterPosition; +} + +export interface EbmlCueRelativePositionTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueRelativePosition; +} + +export interface EbmlCueDurationTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueDuration; +} + +export interface EbmlCueBlockNumberTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueBlockNumber; +} + +export interface EbmlCueCodecStateTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueCodecState; +} + +export interface EbmlCueRefTimeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueRefTime; +} + +export interface EbmlCueRefClusterTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueRefCluster; +} + +export interface EbmlCueRefNumberTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueRefNumber; +} + +export interface EbmlCueRefCodecStateTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CueRefCodecState; +} + +export interface EbmlFileUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FileUID; +} + +export interface EbmlFileUsedStartTimeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FileUsedStartTime; +} + +export interface EbmlFileUsedEndTimeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FileUsedEndTime; +} + +export interface EbmlEditionUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EditionUID; +} + +export interface EbmlEditionFlagHiddenTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EditionFlagHidden; +} + +export interface EbmlEditionFlagDefaultTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EditionFlagDefault; +} + +export interface EbmlEditionFlagOrderedTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.EditionFlagOrdered; +} + +export interface EbmlChapterUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterUID; +} + +export interface EbmlChapterTimeStartTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterTimeStart; +} + +export interface EbmlChapterTimeEndTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterTimeEnd; +} + +export interface EbmlChapterFlagHiddenTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterFlagHidden; +} + +export interface EbmlChapterFlagEnabledTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterFlagEnabled; +} + +export interface EbmlChapterSegmentEditionUIDTagType + extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterSegmentEditionUID; +} + +export interface EbmlChapterPhysicalEquivTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterPhysicalEquiv; +} + +export interface EbmlChapterTrackUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterTrackUID; +} + +export interface EbmlChapProcessCodecIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapProcessCodecID; +} + +export interface EbmlChapProcessTimeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapProcessTime; +} + +export interface EbmlTargetTypeValueTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TargetTypeValue; +} + +export interface EbmlTagTrackUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TagTrackUID; +} + +export interface EbmlTagEditionUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TagEditionUID; +} + +export interface EbmlTagChapterUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TagChapterUID; +} + +export interface EbmlTagAttachmentUIDTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TagAttachmentUID; +} + +export interface EbmlTagDefaultTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TagDefault; +} + +export interface EbmlDocTypeExtensionVersionTagType + extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DocTypeExtensionVersion; +} + +export interface EbmlFlagHearingImpairedTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagHearingImpaired; +} + +export interface EbmlFlagVisualImpairedTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagVisualImpaired; +} + +export interface EbmlFlagTextDescriptionsTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagTextDescriptions; +} + +export interface EbmlFlagOriginalTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagOriginal; +} + +export interface EbmlFlagCommentaryTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FlagCommentary; +} + +export interface EbmlDefaultDecodedFieldDurationTagType + extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.DefaultDecodedFieldDuration; +} + +export interface EbmlBlockAddIDValueTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BlockAddIDValue; +} + +export interface EbmlBlockAddIDTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BlockAddIDType; +} + +export interface EbmlCodecDelayTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CodecDelay; +} + +export interface EbmlSeekPreRollTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.SeekPreRoll; +} + +export interface EbmlFieldOrderTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.FieldOrder; +} + +export interface EbmlAlphaModeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.AlphaMode; +} + +export interface EbmlMatrixCoefficientsTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.MatrixCoefficients; +} + +export interface EbmlBitsPerChannelTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.BitsPerChannel; +} + +export interface EbmlChromaSubsamplingHorzTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChromaSubsamplingHorz; +} + +export interface EbmlChromaSubsamplingVertTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChromaSubsamplingVert; +} + +export interface EbmlCbSubsamplingHorzTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CbSubsamplingHorz; +} + +export interface EbmlCbSubsamplingVertTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.CbSubsamplingVert; +} + +export interface EbmlChromaSitingHorzTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChromaSitingHorz; +} + +export interface EbmlChromaSitingVertTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChromaSitingVert; +} + +export interface EbmlRangeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Range; +} + +export interface EbmlTransferCharacteristicsTagType + extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TransferCharacteristics; +} + +export interface EbmlPrimariesTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Primaries; +} + +export interface EbmlMaxCLLTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.MaxCLL; +} + +export interface EbmlMaxFALLTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.MaxFALL; +} + +export interface EbmlProjectionTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ProjectionType; +} + +export interface EbmlEmphasisTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.Emphasis; +} + +export interface EbmlAESSettingsCipherModeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.AESSettingsCipherMode; +} + +export interface EbmlChapterSkipTypeTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.ChapterSkipType; +} + +export interface EbmlTagDefaultBogusTagType extends EbmlUintTagTypeBase { + id: EbmlTagIdEnum.TagDefaultBogus; +} + +export type EbmlUintTagType = + | EbmlEBMLVersionTagType + | EbmlEBMLReadVersionTagType + | EbmlEBMLMaxIDLengthTagType + | EbmlEBMLMaxSizeLengthTagType + | EbmlDocTypeVersionTagType + | EbmlDocTypeReadVersionTagType + | EbmlSignatureAlgoTagType + | EbmlSignatureHashTagType + | EbmlSeekPositionTagType + | EbmlChapterTranslateEditionUIDTagType + | EbmlChapterTranslateCodecTagType + | EbmlTimestampScaleTagType + | EbmlTimestampTagType + | EbmlSilentTrackNumberTagType + | EbmlPositionTagType + | EbmlPrevSizeTagType + | EbmlBlockAddIDTagType + | EbmlBlockDurationTagType + | EbmlReferencePriorityTagType + | EbmlLaceNumberTagType + | EbmlFrameNumberTagType + | EbmlBlockAdditionIDTagType + | EbmlDelayTagType + | EbmlSliceDurationTagType + | EbmlReferenceOffsetTagType + | EbmlReferenceTimestampTagType + | EbmlTrackNumberTagType + | EbmlTrackUIDTagType + | EbmlTrackTypeTagType + | EbmlFlagEnabledTagType + | EbmlFlagDefaultTagType + | EbmlFlagForcedTagType + | EbmlFlagLacingTagType + | EbmlMinCacheTagType + | EbmlMaxCacheTagType + | EbmlDefaultDurationTagType + | EbmlMaxBlockAdditionIDTagType + | EbmlAttachmentLinkTagType + | EbmlCodecDecodeAllTagType + | EbmlTrackOverlayTagType + | EbmlTrackTranslateEditionUIDTagType + | EbmlTrackTranslateCodecTagType + | EbmlFlagInterlacedTagType + | EbmlStereoModeTagType + | EbmlOldStereoModeTagType + | EbmlPixelWidthTagType + | EbmlPixelHeightTagType + | EbmlPixelCropBottomTagType + | EbmlPixelCropTopTagType + | EbmlPixelCropLeftTagType + | EbmlPixelCropRightTagType + | EbmlDisplayWidthTagType + | EbmlDisplayHeightTagType + | EbmlDisplayUnitTagType + | EbmlAspectRatioTypeTagType + | EbmlChannelsTagType + | EbmlBitDepthTagType + | EbmlTrackPlaneUIDTagType + | EbmlTrackPlaneTypeTagType + | EbmlTrackJoinUIDTagType + | EbmlTrickTrackUIDTagType + | EbmlTrickTrackFlagTagType + | EbmlTrickMasterTrackUIDTagType + | EbmlContentEncodingOrderTagType + | EbmlContentEncodingScopeTagType + | EbmlContentEncodingTypeTagType + | EbmlContentCompAlgoTagType + | EbmlContentEncAlgoTagType + | EbmlContentSigAlgoTagType + | EbmlContentSigHashAlgoTagType + | EbmlCueTimeTagType + | EbmlCueTrackTagType + | EbmlCueClusterPositionTagType + | EbmlCueRelativePositionTagType + | EbmlCueDurationTagType + | EbmlCueBlockNumberTagType + | EbmlCueCodecStateTagType + | EbmlCueRefTimeTagType + | EbmlCueRefClusterTagType + | EbmlCueRefNumberTagType + | EbmlCueRefCodecStateTagType + | EbmlFileUIDTagType + | EbmlFileUsedStartTimeTagType + | EbmlFileUsedEndTimeTagType + | EbmlEditionUIDTagType + | EbmlEditionFlagHiddenTagType + | EbmlEditionFlagDefaultTagType + | EbmlEditionFlagOrderedTagType + | EbmlChapterUIDTagType + | EbmlChapterTimeStartTagType + | EbmlChapterTimeEndTagType + | EbmlChapterFlagHiddenTagType + | EbmlChapterFlagEnabledTagType + | EbmlChapterSegmentEditionUIDTagType + | EbmlChapterPhysicalEquivTagType + | EbmlChapterTrackUIDTagType + | EbmlChapProcessCodecIDTagType + | EbmlChapProcessTimeTagType + | EbmlTargetTypeValueTagType + | EbmlTagTrackUIDTagType + | EbmlTagEditionUIDTagType + | EbmlTagChapterUIDTagType + | EbmlTagAttachmentUIDTagType + | EbmlTagDefaultTagType + | EbmlDocTypeExtensionVersionTagType + | EbmlFlagHearingImpairedTagType + | EbmlFlagVisualImpairedTagType + | EbmlFlagTextDescriptionsTagType + | EbmlFlagOriginalTagType + | EbmlFlagCommentaryTagType + | EbmlDefaultDecodedFieldDurationTagType + | EbmlBlockAddIDValueTagType + | EbmlBlockAddIDTypeTagType + | EbmlCodecDelayTagType + | EbmlSeekPreRollTagType + | EbmlFieldOrderTagType + | EbmlAlphaModeTagType + | EbmlMatrixCoefficientsTagType + | EbmlBitsPerChannelTagType + | EbmlChromaSubsamplingHorzTagType + | EbmlChromaSubsamplingVertTagType + | EbmlCbSubsamplingHorzTagType + | EbmlCbSubsamplingVertTagType + | EbmlChromaSitingHorzTagType + | EbmlChromaSitingVertTagType + | EbmlRangeTagType + | EbmlTransferCharacteristicsTagType + | EbmlPrimariesTagType + | EbmlMaxCLLTagType + | EbmlMaxFALLTagType + | EbmlProjectionTypeTagType + | EbmlEmphasisTagType + | EbmlAESSettingsCipherModeTagType + | EbmlChapterSkipTypeTagType + | EbmlTagDefaultBogusTagType; + +export interface EbmlReferenceBlockTagType extends EbmlIntTagTypeBase { + id: EbmlTagIdEnum.ReferenceBlock; +} + +export interface EbmlReferenceVirtualTagType extends EbmlIntTagTypeBase { + id: EbmlTagIdEnum.ReferenceVirtual; +} + +export interface EbmlTrackOffsetTagType extends EbmlIntTagTypeBase { + id: EbmlTagIdEnum.TrackOffset; +} + +export interface EbmlDiscardPaddingTagType extends EbmlIntTagTypeBase { + id: EbmlTagIdEnum.DiscardPadding; +} + +export type EbmlIntTagType = + | EbmlReferenceBlockTagType + | EbmlReferenceVirtualTagType + | EbmlTrackOffsetTagType + | EbmlDiscardPaddingTagType; + +export interface EbmlDocTypeTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.DocType; +} + +export interface EbmlLanguageTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.Language; +} + +export interface EbmlCodecIDTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.CodecID; +} + +export interface EbmlCodecInfoURLTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.CodecInfoURL; +} + +export interface EbmlCodecDownloadURLTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.CodecDownloadURL; +} + +export interface EbmlFileMediaTypeTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.FileMediaType; +} + +export interface EbmlChapLanguageTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.ChapLanguage; +} + +export interface EbmlChapCountryTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.ChapCountry; +} + +export interface EbmlTargetTypeTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.TargetType; +} + +export interface EbmlTagLanguageTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.TagLanguage; +} + +export interface EbmlDocTypeExtensionNameTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.DocTypeExtensionName; +} + +export interface EbmlBlockAddIDNameTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.BlockAddIDName; +} + +export interface EbmlLanguageBCP47TagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.LanguageBCP47; +} + +export interface EbmlEditionLanguageIETFTagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.EditionLanguageIETF; +} + +export interface EbmlChapLanguageBCP47TagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.ChapLanguageBCP47; +} + +export interface EbmlTagLanguageBCP47TagType extends EbmlAsciiTagTypeBase { + id: EbmlTagIdEnum.TagLanguageBCP47; +} + +export type EbmlAsciiTagType = + | EbmlDocTypeTagType + | EbmlLanguageTagType + | EbmlCodecIDTagType + | EbmlCodecInfoURLTagType + | EbmlCodecDownloadURLTagType + | EbmlFileMediaTypeTagType + | EbmlChapLanguageTagType + | EbmlChapCountryTagType + | EbmlTargetTypeTagType + | EbmlTagLanguageTagType + | EbmlDocTypeExtensionNameTagType + | EbmlBlockAddIDNameTagType + | EbmlLanguageBCP47TagType + | EbmlEditionLanguageIETFTagType + | EbmlChapLanguageBCP47TagType + | EbmlTagLanguageBCP47TagType; + +export interface EbmlSegmentFilenameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.SegmentFilename; +} + +export interface EbmlPrevFilenameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.PrevFilename; +} + +export interface EbmlNextFilenameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.NextFilename; +} + +export interface EbmlTitleTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.Title; +} + +export interface EbmlMuxingAppTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.MuxingApp; +} + +export interface EbmlWritingAppTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.WritingApp; +} + +export interface EbmlNameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.Name; +} + +export interface EbmlCodecNameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.CodecName; +} + +export interface EbmlCodecSettingsTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.CodecSettings; +} + +export interface EbmlFileDescriptionTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.FileDescription; +} + +export interface EbmlFileNameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.FileName; +} + +export interface EbmlChapterStringUIDTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.ChapterStringUID; +} + +export interface EbmlChapStringTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.ChapString; +} + +export interface EbmlTagNameTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.TagName; +} + +export interface EbmlTagStringTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.TagString; +} + +export interface EbmlEditionStringTagType extends EbmlUtf8TagTypeBase { + id: EbmlTagIdEnum.EditionString; +} + +export type EbmlUtf8TagType = + | EbmlSegmentFilenameTagType + | EbmlPrevFilenameTagType + | EbmlNextFilenameTagType + | EbmlTitleTagType + | EbmlMuxingAppTagType + | EbmlWritingAppTagType + | EbmlNameTagType + | EbmlCodecNameTagType + | EbmlCodecSettingsTagType + | EbmlFileDescriptionTagType + | EbmlFileNameTagType + | EbmlChapterStringUIDTagType + | EbmlChapStringTagType + | EbmlTagNameTagType + | EbmlTagStringTagType + | EbmlEditionStringTagType; + export interface EbmlVoidTagType extends EbmlBinaryTagTypeBase { id: EbmlTagIdEnum.Void; } +export interface EbmlCRC32TagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.CRC32; +} + +export interface EbmlSignaturePublicKeyTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.SignaturePublicKey; +} + +export interface EbmlSignatureTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.Signature; +} + +export interface EbmlSignedElementTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.SignedElement; +} + +export interface EbmlSeekIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.SeekID; +} + +export interface EbmlSegmentUUIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.SegmentUUID; +} + +export interface EbmlPrevUUIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.PrevUUID; +} + +export interface EbmlNextUUIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.NextUUID; +} + +export interface EbmlSegmentFamilyTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.SegmentFamily; +} + +export interface EbmlChapterTranslateIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ChapterTranslateID; +} + +export interface EbmlBlockVirtualTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.BlockVirtual; +} + +export interface EbmlBlockAdditionalTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.BlockAdditional; +} + +export interface EbmlCodecStateTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.CodecState; +} + +export interface EbmlEncryptedBlockTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.EncryptedBlock; +} + +export interface EbmlCodecPrivateTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.CodecPrivate; +} + +export interface EbmlTrackTranslateTrackIDTagType + extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.TrackTranslateTrackID; +} + +export interface EbmlUncompressedFourCCTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.UncompressedFourCC; +} + +export interface EbmlChannelPositionsTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ChannelPositions; +} + +export interface EbmlTrickTrackSegmentUIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.TrickTrackSegmentUID; +} + +export interface EbmlTrickMasterTrackSegmentUIDTagType + extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.TrickMasterTrackSegmentUID; +} + +export interface EbmlContentCompSettingsTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ContentCompSettings; +} + +export interface EbmlContentEncKeyIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ContentEncKeyID; +} + +export interface EbmlContentSignatureTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ContentSignature; +} + +export interface EbmlContentSigKeyIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ContentSigKeyID; +} + +export interface EbmlFileDataTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.FileData; +} + +export interface EbmlFileReferralTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.FileReferral; +} + +export interface EbmlChapterSegmentUUIDTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ChapterSegmentUUID; +} + +export interface EbmlChapProcessPrivateTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ChapProcessPrivate; +} + +export interface EbmlChapProcessDataTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ChapProcessData; +} + +export interface EbmlTagBinaryTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.TagBinary; +} + +export interface EbmlBlockAddIDExtraDataTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.BlockAddIDExtraData; +} + +export interface EbmlProjectionPrivateTagType extends EbmlBinaryTagTypeBase { + id: EbmlTagIdEnum.ProjectionPrivate; +} + export type EbmlBinaryTagType = - | EbmlContentCompSettingsTagType - | EbmlSegmentFamilyTagType - | EbmlTagBinaryTagType - | EbmlFileReferralTagType - | EbmlSignedElementTagType - | EbmlChapProcessDataTagType - | EbmlChapProcessPrivateTagType - | EbmlChapterSegmentUIDTagType - | EbmlFileDataTagType - | EbmlContentSigKeyIDTagType - | EbmlContentSignatureTagType - | EbmlContentEncKeyIDTagType - | EbmlTrickMasterTrackSegmentUIDTagType - | EbmlTrickTrackSegmentUIDTagType - | EbmlChannelPositionsTagType - | EbmlColourSpaceTagType - | EbmlTrackTranslateTrackIDTagType - | EbmlCodecPrivateTagType - | EbmlEncryptedBlockTagType - | EbmlCodecStateTagType - | EbmlBlockAdditionalTagType - | EbmlBlockVirtualTagType - | EbmlChapterTranslateIDTagType - | EbmlNextUIDTagType - | EbmlPrevUIDTagType - | EbmlSegmentUIDTagType - | EbmlSeekIDTagType - | EbmlSignatureTagType - | EbmlSignaturePublicKeyTagType + | EbmlVoidTagType | EbmlCRC32TagType - | EbmlVoidTagType; + | EbmlSignaturePublicKeyTagType + | EbmlSignatureTagType + | EbmlSignedElementTagType + | EbmlSeekIDTagType + | EbmlSegmentUUIDTagType + | EbmlPrevUUIDTagType + | EbmlNextUUIDTagType + | EbmlSegmentFamilyTagType + | EbmlChapterTranslateIDTagType + | EbmlBlockVirtualTagType + | EbmlBlockAdditionalTagType + | EbmlCodecStateTagType + | EbmlEncryptedBlockTagType + | EbmlCodecPrivateTagType + | EbmlTrackTranslateTrackIDTagType + | EbmlUncompressedFourCCTagType + | EbmlChannelPositionsTagType + | EbmlTrickTrackSegmentUIDTagType + | EbmlTrickMasterTrackSegmentUIDTagType + | EbmlContentCompSettingsTagType + | EbmlContentEncKeyIDTagType + | EbmlContentSignatureTagType + | EbmlContentSigKeyIDTagType + | EbmlFileDataTagType + | EbmlFileReferralTagType + | EbmlChapterSegmentUUIDTagType + | EbmlChapProcessPrivateTagType + | EbmlChapProcessDataTagType + | EbmlTagBinaryTagType + | EbmlBlockAddIDExtraDataTagType + | EbmlProjectionPrivateTagType; -export type EbmlDataTagType = - | EbmlAsciiTagType - | EbmlBinaryTagType - | EbmlUintTagType - | EbmlIntTagType - | EbmlFloatTagType - | EbmlDateTagType - | EbmlUtf8TagType; +export interface EbmlDurationTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.Duration; +} -export type EbmlUnknownTagType = Omit & { - position: EbmlTagPosition.Content; - parent?: EbmlMasterTag; - type?: undefined; - data: Uint8Array; - children?: []; -}; +export interface EbmlTrackTimestampScaleTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.TrackTimestampScale; +} -export type EbmlBlockTagType = Omit & { - id: EbmlBlockTagIdType; - position: EbmlTagPosition.Content; - parent?: EbmlMasterTag; - type?: undefined; - data?: undefined; - children?: []; -}; +export interface EbmlGammaValueTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.GammaValue; +} + +export interface EbmlFrameRateTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.FrameRate; +} + +export interface EbmlSamplingFrequencyTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.SamplingFrequency; +} + +export interface EbmlOutputSamplingFrequencyTagType + extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.OutputSamplingFrequency; +} + +export interface EbmlPrimaryRChromaticityXTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.PrimaryRChromaticityX; +} + +export interface EbmlPrimaryRChromaticityYTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.PrimaryRChromaticityY; +} + +export interface EbmlPrimaryGChromaticityXTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.PrimaryGChromaticityX; +} + +export interface EbmlPrimaryGChromaticityYTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.PrimaryGChromaticityY; +} + +export interface EbmlPrimaryBChromaticityXTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.PrimaryBChromaticityX; +} + +export interface EbmlPrimaryBChromaticityYTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.PrimaryBChromaticityY; +} + +export interface EbmlWhitePointChromaticityXTagType + extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.WhitePointChromaticityX; +} + +export interface EbmlWhitePointChromaticityYTagType + extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.WhitePointChromaticityY; +} + +export interface EbmlLuminanceMaxTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.LuminanceMax; +} + +export interface EbmlLuminanceMinTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.LuminanceMin; +} + +export interface EbmlProjectionPoseYawTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.ProjectionPoseYaw; +} + +export interface EbmlProjectionPosePitchTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.ProjectionPosePitch; +} + +export interface EbmlProjectionPoseRollTagType extends EbmlFloatTagTypeBase { + id: EbmlTagIdEnum.ProjectionPoseRoll; +} + +export type EbmlFloatTagType = + | EbmlDurationTagType + | EbmlTrackTimestampScaleTagType + | EbmlGammaValueTagType + | EbmlFrameRateTagType + | EbmlSamplingFrequencyTagType + | EbmlOutputSamplingFrequencyTagType + | EbmlPrimaryRChromaticityXTagType + | EbmlPrimaryRChromaticityYTagType + | EbmlPrimaryGChromaticityXTagType + | EbmlPrimaryGChromaticityYTagType + | EbmlPrimaryBChromaticityXTagType + | EbmlPrimaryBChromaticityYTagType + | EbmlWhitePointChromaticityXTagType + | EbmlWhitePointChromaticityYTagType + | EbmlLuminanceMaxTagType + | EbmlLuminanceMinTagType + | EbmlProjectionPoseYawTagType + | EbmlProjectionPosePitchTagType + | EbmlProjectionPoseRollTagType; + +export interface EbmlDateUTCTagType extends EbmlDateTagTypeBase { + id: EbmlTagIdEnum.DateUTC; +} + +export type EbmlDateTagType = EbmlDateUTCTagType; export type EbmlSimpleBlockTagType = Omit< EbmlSimpleBlockTag, @@ -854,213 +1519,27 @@ export type EbmlSimpleBlockTagType = Omit< children?: []; }; -export interface EbmlMasterTagTypeBase - extends Omit { - type: EbmlElementType.Master; - position: EbmlTagPosition.Start | EbmlTagPosition.End; +export type EbmlBlockTagType = Omit & { + id: EbmlBlockTagIdType; + position: EbmlTagPosition.Content; parent?: EbmlMasterTag; - children: EbmlTagType[]; + type?: undefined; data?: undefined; -} + children?: []; +}; -export interface EbmlChapterDisplayTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ChapterDisplay; -} -export interface EbmlContentCompressionTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ContentCompression; -} -export interface EbmlContentEncryptionTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ContentEncryption; -} -export interface EbmlSilentTracksTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.SilentTracks; -} -export interface EbmlContentEncodingTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ContentEncoding; -} -export interface EbmlTrackTranslateTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TrackTranslate; -} -export interface EbmlChapProcessCommandTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ChapProcessCommand; -} -export interface EbmlChapterTranslateTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ChapterTranslate; -} -export interface EbmlChapProcessTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ChapProcess; -} -export interface EbmlTagTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Tag; -} -export interface EbmlSegmentTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Segment; -} -export interface EbmlSimpleTagTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.SimpleTag; -} -export interface EbmlTargetsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Targets; -} -export interface EbmlTagsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Tags; -} -export interface EbmlChapterTrackTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ChapterTrack; -} -export interface EbmlChapterAtomTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ChapterAtom; -} -export interface EbmlEditionEntryTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.EditionEntry; -} -export interface EbmlChaptersTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Chapters; -} -export interface EbmlAttachedFileTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.AttachedFile; -} -export interface EbmlAttachmentsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Attachments; -} -export interface EbmlCueReferenceTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.CueReference; -} -export interface EbmlCueTrackPositionsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.CueTrackPositions; -} -export interface EbmlCuePointTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.CuePoint; -} -export interface EbmlCuesTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Cues; -} -export interface EbmlContentEncAESSettingsTagType - extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ContentEncAESSettings; -} -export interface EbmlContentEncodingsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ContentEncodings; -} -export interface EbmlTrackJoinBlocksTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TrackJoinBlocks; -} -export interface EbmlTrackPlaneTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TrackPlane; -} -export interface EbmlTrackCombinePlanesTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TrackCombinePlanes; -} -export interface EbmlTrackOperationTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TrackOperation; -} -export interface EbmlAudioTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Audio; -} -export interface EbmlVideoTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Video; -} -export interface EbmlTrackEntryTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TrackEntry; -} -export interface EbmlTracksTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Tracks; -} -export interface EbmlReferenceFrameTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.ReferenceFrame; -} -export interface EbmlTimeSliceTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.TimeSlice; -} -export interface EbmlSlicesTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Slices; -} -export interface EbmlBlockMoreTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.BlockMore; -} -export interface EbmlBlockAdditionsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.BlockAdditions; -} -export interface EbmlBlockGroupTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.BlockGroup; -} -export interface EbmlClusterTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Cluster; -} -export interface EbmlInfoTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Info; -} -export interface EbmlSeekTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.Seek; -} -export interface EbmlSeekHeadTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.SeekHead; -} -export interface EbmlSignatureElementListTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.SignatureElementList; -} -export interface EbmlSignatureElementsTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.SignatureElements; -} -export interface EbmlSignatureSlotTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.SignatureSlot; -} -export interface EbmlEBMLTagType extends EbmlMasterTagTypeBase { - id: EbmlTagIdEnum.EBML; -} +export type EbmlDataTagType = + | EbmlUintTagType + | EbmlIntTagType + | EbmlAsciiTagType + | EbmlUtf8TagType + | EbmlBinaryTagType + | EbmlFloatTagType + | EbmlDateTagType; -export type EbmlMasterTagType = - | EbmlChapterDisplayTagType - | EbmlContentCompressionTagType - | EbmlContentEncryptionTagType - | EbmlSilentTracksTagType - | EbmlContentEncodingTagType - | EbmlTrackTranslateTagType - | EbmlChapProcessCommandTagType - | EbmlChapterTranslateTagType - | EbmlChapProcessTagType - | EbmlTagTagType - | EbmlSegmentTagType - | EbmlSimpleTagTagType - | EbmlTargetsTagType - | EbmlTagsTagType - | EbmlChapterTrackTagType - | EbmlChapterAtomTagType - | EbmlEditionEntryTagType - | EbmlChaptersTagType - | EbmlAttachedFileTagType - | EbmlAttachmentsTagType - | EbmlCueReferenceTagType - | EbmlCueTrackPositionsTagType - | EbmlCuePointTagType - | EbmlCuesTagType - | EbmlContentEncAESSettingsTagType - | EbmlContentEncodingsTagType - | EbmlTrackJoinBlocksTagType - | EbmlTrackPlaneTagType - | EbmlTrackCombinePlanesTagType - | EbmlTrackOperationTagType - | EbmlAudioTagType - | EbmlVideoTagType - | EbmlTrackEntryTagType - | EbmlTracksTagType - | EbmlReferenceFrameTagType - | EbmlTimeSliceTagType - | EbmlSlicesTagType - | EbmlBlockMoreTagType - | EbmlBlockAdditionsTagType - | EbmlBlockGroupTagType - | EbmlClusterTagType - | EbmlInfoTagType - | EbmlSeekTagType - | EbmlSeekHeadTagType - | EbmlSignatureElementListTagType - | EbmlSignatureElementsTagType - | EbmlSignatureSlotTagType - | EbmlEBMLTagType; +export type EbmlAdhocTagType = EbmlSimpleBlockTagType | EbmlBlockTagType; export type EbmlTagType = | EbmlMasterTagType - | EbmlSimpleBlockTagType - | EbmlBlockTagType - | EbmlDataTagType; + | EbmlDataTagType + | EbmlAdhocTagType; diff --git a/src/tools.ts b/src/tools.ts index 329ea1f..5c7bc1e 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -307,7 +307,7 @@ export function readUnsigned(view: DataView): number | bigint { break; default: throw new UnsupportLengthForElementTypeError( - EbmlElementType.UnsignedInt, + EbmlElementType.Uint, '0~8', byteLength ); @@ -324,7 +324,7 @@ export function writeUnsigned( ): Uint8Array { if (num < 0 || num > MAX_UINT64) { throw new OutOfRangeForElementTypeError( - EbmlElementType.UnsignedInt, + EbmlElementType.Uint, `0-${MAX_UINT64}`, num ); @@ -418,7 +418,7 @@ export function writeUnsigned( } default: throw new UnsupportLengthForElementTypeError( - EbmlElementType.UnsignedInt, + EbmlElementType.Uint, '0~8', length ); @@ -430,7 +430,7 @@ export function readSigned(view: DataView): number | bigint { const byteLength = view.byteLength; if (byteLength < 0 || byteLength > 8) { throw new UnsupportLengthForElementTypeError( - EbmlElementType.Integer, + EbmlElementType.Int, '0~8', byteLength ); @@ -493,7 +493,7 @@ export function writeSigned( ): Uint8Array { if (num < MIN_INT64 || num > MAX_INT64) { throw new OutOfRangeForElementTypeError( - EbmlElementType.Integer, + EbmlElementType.Int, `${MIN_INT64}~${MAX_INT64}`, num ); @@ -518,7 +518,7 @@ export function writeSigned( if (length > 8) { throw new UnsupportLengthForElementTypeError( - EbmlElementType.Integer, + EbmlElementType.Int, '0~8', length ); diff --git a/tests/decoder.spec.ts b/tests/decoder.spec.ts index 13ab856..6f77bcb 100644 --- a/tests/decoder.spec.ts +++ b/tests/decoder.spec.ts @@ -90,7 +90,7 @@ describe('Ebml Decoder', () => { assert.strictEqual(tag.position, EbmlTagPosition.Content); assert.strictEqual(tag.id.toString(16), '4286'); assert.strictEqual(tag.contentLength, 0x01); - assert.strictEqual(tag.type, EbmlElementType.UnsignedInt); + assert.strictEqual(tag.type, EbmlElementType.Uint); assert.ok(tag instanceof EbmlDataTag); assert.deepStrictEqual(tag.data, 1); }); diff --git a/tests/value.spec.ts b/tests/value.spec.ts index ccb952b..1bf0ab6 100644 --- a/tests/value.spec.ts +++ b/tests/value.spec.ts @@ -66,7 +66,7 @@ describe('EBML Values in tags', () => { makeAVC1StreamTest((tag, done) => { if ( tag instanceof EbmlDataTag && - tag.id === EbmlTagIdEnum.TimecodeScale + tag.id === EbmlTagIdEnum.TimestampScale ) { assert.strictEqual(tag.data, 1000000); done(); @@ -142,11 +142,11 @@ describe('EBML Values in tags', () => { } })); - it('should get a correct TimeCodeScale value from a video/webm; codecs="vp8" file (3-byte unsigned int)', () => + it('should get a correct TimestamScale value from a video/webm; codecs="vp8" file (3-byte unsigned int)', () => makeVP8StreamTest((tag, done) => { if ( tag instanceof EbmlDataTag && - tag.id === EbmlTagIdEnum.TimecodeScale + tag.id === EbmlTagIdEnum.TimestampScale ) { assert.strictEqual(tag.data, 1000000); done(); diff --git a/tsconfig.json b/tsconfig.json index 1b99600..30eb113 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,9 @@ "extends": "./tsconfig.base.json", "files": [], "include": [], - "exclude": ["node_modules"], + "exclude": [ + "node_modules" + ], "references": [ { "path": "./tsconfig.lib.json" @@ -12,6 +14,9 @@ }, { "path": "./tsconfig.example.json" + }, + { + "path": "./tsconfig.scripts.json" } ] -} +} \ No newline at end of file diff --git a/tsconfig.lib.json b/tsconfig.lib.json index d327dbe..dd1d318 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -4,12 +4,14 @@ "composite": true, "rootDir": "./src", "baseUrl": ".", - "declarationDir": "./dist", - "outDir": "./dist", + "declarationDir": "./lib", + "outDir": "./lib", "declaration": true, "declarationMap": true, "emitDeclarationOnly": true }, - "include": ["src"], + "include": [ + "src" + ], "exclude": [] -} +} \ No newline at end of file diff --git a/tsconfig.scripts.json b/tsconfig.scripts.json new file mode 100644 index 0000000..31b6e89 --- /dev/null +++ b/tsconfig.scripts.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "composite": true, + "rootDir": "./scripts", + "baseUrl": ".", + "noEmit": true + }, + "include": [ + "scripts" + ], + "exclude": [] +} \ No newline at end of file diff --git a/vitest.config.ts b/vitest.config.ts index 2a7d59a..92979e5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -21,6 +21,7 @@ export default defineConfig({ 'scripts/**', 'examples/**', 'dist/**', + 'lib/**', ], }, },