<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd' []>
<rfc ipr="trust200902" category="std" docName="draft-ietf-cellar-ebml-03">
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc private=""?>
<?rfc topblock="yes"?>
<?rfc comments="no"?>
<front>
<title abbrev="EBML">Extensible Binary Meta Language</title>

<author initials="S." surname="Lhomme" fullname="Steve Lhomme">
<organization></organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>slhomme@matroska.org</email>
<uri></uri>
</address>
</author>
<author initials="D." surname="Rice" fullname="Dave Rice">
<organization></organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>dave@dericed.com</email>
<uri></uri>
</address>
</author>
<author initials="M." surname="Bunkus" fullname="Moritz Bunkus">
<organization></organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>moritz@bunkus.org</email>
<uri></uri>
</address>
</author>
<date year="2017" month="July" day="2"/>

<area>art</area>
<workgroup>cellar</workgroup>
<keyword></keyword>


<abstract>
<t>This document defines the Extensible Binary Meta Language (EBML) format as a generalized file format for any type of data in a hierarchical form. EBML is designed as a binary equivalent to XML and uses a storage-efficient approach to build nested Elements with identifiers, lengths, and values. Similar to how an XML Schema defines the structure and semantics of an XML Document, this document defines how EBML Schemas are created to convey the semantics of an EBML Document.
</t>
</abstract>


</front>

<middle>

<section anchor="introduction" title="Introduction">
<t><spanx style="verb">EBML</spanx>, short for Extensible Binary Meta Language, specifies a binary and octet (byte) aligned format inspired by the principle of XML (a framework for structuring data).
</t>
<t>The goal of this document is to define a generic, binary, space-efficient format that can be used to define more complex formats (such as containers for multimedia content) using an <spanx style="verb">EBML Schema</spanx>. The definition of the <spanx style="verb">EBML</spanx> format recognizes the idea behind HTML and XML as a good one: separate structure and semantics allowing the same structural layer to be used with multiple, possibly widely differing semantic layers. Except for the <spanx style="verb">EBML Header</spanx> and a few global elements this specification does not define particular <spanx style="verb">EBML</spanx> format semantics; however this specification is intended to define how other <spanx style="verb">EBML</spanx>-based formats can be defined.
</t>
<t><spanx style="verb">EBML</spanx> uses a simple approach of building <spanx style="verb">Elements</spanx> upon three pieces of data (tag, length, and value) as this approach is well known, easy to parse, and allows selective data parsing. The <spanx style="verb">EBML</spanx> structure additionally allows for hierarchical arrangement to support complex structural formats in an efficient manner.
</t>
</section>

<section anchor="notation-and-conventions" title="Notation and Conventions">
<t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in <xref target="RFC2119"/>.
</t>
<t>This document defines specific terms in order to define the format and application of <spanx style="verb">EBML</spanx>. Specific terms are defined below:
</t>
<t><spanx style="verb">EBML</spanx>: Extensible Binary Meta Language
</t>
<t><spanx style="verb">EBML Document Type</spanx>: An <spanx style="verb">EBML Document Type</spanx> is a name provided by an <spanx style="verb">EBML Schema</spanx> for a particular implementation of <spanx style="verb">EBML</spanx> for a data format (examples: matroska and webm).
</t>
<t><spanx style="verb">EBML Schema</spanx>: A standardized definition for the structure of an <spanx style="verb">EBML Document Type</spanx>.
</t>
<t><spanx style="verb">EBML Document</spanx>: An <spanx style="verb">EBML Document</spanx> is a datastream comprised of only two components, an <spanx style="verb">EBML Header</spanx> and an <spanx style="verb">EBML Body</spanx>.
</t>
<t><spanx style="verb">EBML Reader</spanx>: An <spanx style="verb">EBML Reader</spanx> is a data parser that interprets the semantics of an <spanx style="verb">EBML Document</spanx> and creates a way for programs to use <spanx style="verb">EBML</spanx>.
</t>
<t><spanx style="verb">EBML Stream</spanx>: An <spanx style="verb">EBML Stream</spanx> is a file that consists of one or more <spanx style="verb">EBML Documents</spanx> that are concatenated together.
</t>
<t><spanx style="verb">EBML Header</spanx>: The <spanx style="verb">EBML Header</spanx> is a declaration that provides processing instructions and identification of the <spanx style="verb">EBML Body</spanx>. The <spanx style="verb">EBML Header</spanx> may be considered as analogous to an XML Declaration <xref target="W3C.REC-xml-20081126"/> (see section 2.8 on Prolog and Document Type Declaration).
</t>
<t><spanx style="verb">EBML Body</spanx>: All data of an <spanx style="verb">EBML Document</spanx> following the <spanx style="verb">EBML Header</spanx> may be considered the <spanx style="verb">EBML Body</spanx>.
</t>
<t><spanx style="verb">Variable Size Integer</spanx>: A compact variable-length binary value which defines its own length.
</t>
<t><spanx style="verb">VINT</spanx>: Also known as <spanx style="verb">Variable Size Integer</spanx>.
</t>
<t><spanx style="verb">EBML Element</spanx>: A foundation block of data that contains three parts: an <spanx style="verb">Element ID</spanx>, an <spanx style="verb">Element Data Size</spanx>, and <spanx style="verb">Element Data</spanx>.
</t>
<t><spanx style="verb">Element ID</spanx>: The <spanx style="verb">Element ID</spanx> is a binary value, encoded as a <spanx style="verb">Variable Size Integer</spanx>, used to uniquely identify a defined <spanx style="verb">EBML Element</spanx> within a specific <spanx style="verb">EBML Schema</spanx>.
</t>
<t><spanx style="verb">EBML Class</spanx>: A representation of the octet length of an <spanx style="verb">Element ID</spanx>.
</t>
<t><spanx style="verb">Element Data Size</spanx>: An expression, encoded as a <spanx style="verb">Variable Size Integer</spanx>, of the length in octets of <spanx style="verb">Element Data</spanx>.
</t>
<t><spanx style="verb">VINTMAX</spanx>: The maximum possible value that can be stored as <spanx style="verb">Element Data Size</spanx>.
</t>
<t><spanx style="verb">Unknown-Sized Element</spanx>: An Element with an unknown <spanx style="verb">Element Data Size</spanx>.
</t>
<t><spanx style="verb">Element Data</spanx>: The value(s) of the <spanx style="verb">EBML Element</spanx> which is identified by its <spanx style="verb">Element ID</spanx> and <spanx style="verb">Element Data Size</spanx>. The form of the <spanx style="verb">Element Data</spanx> is defined by this document and the corresponding <spanx style="verb">EBML Schema</spanx> of the Element's <spanx style="verb">EBML Document Type</spanx>.
</t>
<t><spanx style="verb">Root Level</spanx>: The starting level in the hierarchy of an <spanx style="verb">EBML Document</spanx>.
</t>
<t><spanx style="verb">Root Element</spanx>: A mandatory, non-repeating <spanx style="verb">EBML Element</spanx> which occurs at the top level of the path hierarchy within an <spanx style="verb">EBML Body</spanx> and contains all other <spanx style="verb">EBML Elements</spanx> of the <spanx style="verb">EBML Body</spanx>, excepting optional <spanx style="verb">Void Elements</spanx>.
</t>
<t><spanx style="verb">Top-Level Element</spanx>: An <spanx style="verb">EBML Element</spanx> defined to only occur as a <spanx style="verb">Child Element</spanx> of the <spanx style="verb">Root Element</spanx>.
</t>
<t><spanx style="verb">Master Element</spanx>: The <spanx style="verb">Master Element</spanx> contains zero, one, or many other <spanx style="verb">EBML Elements</spanx>.
</t>
<t><spanx style="verb">Child Element</spanx>: A <spanx style="verb">Child Element</spanx> is a relative term to describe the <spanx style="verb">EBML Elements</spanx> immediately contained within a <spanx style="verb">Master Element</spanx>.
</t>
<t><spanx style="verb">Parent Element</spanx>: A relative term to describe the <spanx style="verb">Master Element</spanx> which contains a specified element. For any specified <spanx style="verb">EBML Element</spanx> that is not at <spanx style="verb">Root Level</spanx>, the <spanx style="verb">Parent Element</spanx> refers to the <spanx style="verb">Master Element</spanx> in which that <spanx style="verb">EBML Element</spanx> is contained.
</t>
<t><spanx style="verb">Descendant Element</spanx>: A <spanx style="verb">Descendant Element</spanx> is a relative term to describe any <spanx style="verb">EBML Elements</spanx> contained within a <spanx style="verb">Master Element</spanx>, including any of the <spanx style="verb">Child Elements</spanx> of its <spanx style="verb">Child Elements</spanx>, and so on.
</t>
<t><spanx style="verb">Element Name</spanx>: The official human-readable name of the <spanx style="verb">EBML Element</spanx>.
</t>
<t><spanx style="verb">Element Path</spanx>: The hierarchy of <spanx style="verb">Parent Element</spanx> where the <spanx style="verb">EBML Element</spanx> is expected to be found in the <spanx style="verb">EBML Body</spanx>.
</t>
<t><spanx style="verb">Empty Element</spanx>: An <spanx style="verb">Empty Element</spanx> is an <spanx style="verb">EBML Element</spanx> that has an <spanx style="verb">Element Data Size</spanx> with all <spanx style="verb">VINT_DATA</spanx> bits set to zero which indicates that the <spanx style="verb">Element Data</spanx> of the Element is zero octets in length.
</t>
</section>

<section anchor="security-considerations" title="Security Considerations">
<t><spanx style="verb">EBML</spanx> itself does not offer any kind of security and does not provide confidentiality. <spanx style="verb">EBML</spanx> does not provide any kind of authorization. <spanx style="verb">EBML</spanx> only offers marginally useful and effective data integrity options, such as CRC elements.
</t>
<t>Even if the semantic layer offers any kind of encryption, <spanx style="verb">EBML</spanx> itself could leak information at both the semantic layer (as declared via the DocType element) and within the <spanx style="verb">EBML</spanx> structure (you can derive the presence of <spanx style="verb">EBML Elements</spanx> even with an unknown semantic layer with a heuristic approach; not without errors, of course, but with a certain degree of confidence).
</t>
<t>Attacks on an <spanx style="verb">EBML Reader</spanx> could include:
</t>
<t>
<list style="symbols">
<t>Invalid <spanx style="verb">Element IDs</spanx> that are longer than the limit stated in the <spanx style="verb">EBMLMaxIDLength Element</spanx> of the <spanx style="verb">EBML Header</spanx>.</t>
<t>Invalid <spanx style="verb">Element IDs</spanx> that are not encoded in the shortest-possible way.</t>
<t>Invalid <spanx style="verb">Element IDs</spanx> comprised of reserved values.</t>
<t>Invalid <spanx style="verb">Element Data Size</spanx> values that are longer than the limit stated in the <spanx style="verb">EBMLMaxSizeLength Element</spanx> of the <spanx style="verb">EBML Header</spanx>.</t>
<t>Invalid <spanx style="verb">Element Data Size</spanx> values (e.g. extending the length of the <spanx style="verb">EBML Element</spanx> beyond the scope of the <spanx style="verb">Parent Element</spanx>; possibly triggering access-out-of-bounds issues).</t>
<t>Very high lengths in order to force out-of-memory situations resulting in a denial of service, access-out-of-bounds issues etc.</t>
<t>Missing <spanx style="verb">EBML Elements</spanx> that are mandatory and have no declared default value.</t>
<t>Usage of <spanx style="verb">0x00</spanx> octets in <spanx style="verb">EBML Elements</spanx> with a string type.</t>
<t>Usage of invalid UTF-8 encoding in <spanx style="verb">EBML Elements</spanx> of UTF-8 type (e.g. in order to trigger access-out-of-bounds or buffer overflow issues).</t>
<t>Usage of invalid data in <spanx style="verb">EBML Elements</spanx> with a date type.</t>
</list>
</t>
<t>Side channel attacks could exploit:
</t>
<t>
<list style="symbols">
<t>The semantic equivalence of the same string stored in a <spanx style="verb">String Element</spanx> or <spanx style="verb">UTF-8 Element</spanx> with and without zero-bit padding.</t>
<t>The semantic equivalence of <spanx style="verb">VINT_DATA</spanx> within <spanx style="verb">Element Data Size</spanx> with to different lengths due to left-padding zero bits.</t>
<t>Data contained within a <spanx style="verb">Master Element</spanx> which is not itself part of an <spanx style="verb">EBML Element</spanx>.</t>
<t>Extraneous copies of <spanx style="verb">Identically Recurring Element</spanx>.</t>
<t>Copies of <spanx style="verb">Identically Recurring Element</spanx> within a <spanx style="verb">Parent Element</spanx> that contain invalid <spanx style="verb">CRC-32 Elements</spanx>.</t>
<t>Use of <spanx style="verb">Void Elements</spanx>.</t>
</list>
</t>
</section>

<section anchor="iana-considerations" title="IANA Considerations">
<t>This document has no IANA actions.
</t>
</section>

<section anchor="structure" title="Structure">
<t><spanx style="verb">EBML</spanx> uses a system of Elements to compose an <spanx style="verb">EBML Document</spanx>. <spanx style="verb">EBML Elements</spanx> incorporate three parts: an <spanx style="verb">Element ID</spanx>, an <spanx style="verb">Element Data Size</spanx>, and <spanx style="verb">Element Data</spanx>. The <spanx style="verb">Element Data</spanx>, which is described by the <spanx style="verb">Element ID</spanx>, includes either binary data, one or many other <spanx style="verb">EBML Elements</spanx>, or both.
</t>
</section>

<section anchor="variable-size-integer" title="Variable Size Integer">
<t>The <spanx style="verb">Element ID</spanx> and <spanx style="verb">Element Data Size</spanx> are both encoded as a <spanx style="verb">Variable Size Integer</spanx>, developed according to a UTF-8 like system. The <spanx style="verb">Variable Size Integer</spanx> is composed of a <spanx style="verb">VINT_WIDTH</spanx>, <spanx style="verb">VINT_MARKER</spanx>, and <spanx style="verb">VINT_DATA</spanx>, in that order. <spanx style="verb">Variable Size Integers</spanx> SHALL left-pad the <spanx style="verb">VINT_DATA</spanx> value with zero bits so that the whole <spanx style="verb">Variable Size Integer</spanx> is octet-aligned. <spanx style="verb">Variable Size Integers</spanx> SHALL be referred to as <spanx style="verb">VINT</spanx> for shorthand.
</t>

<section anchor="vintwidth" title="VINT_WIDTH">
<t>Each <spanx style="verb">Variable Size Integer</spanx> begins with a <spanx style="verb">VINT_WIDTH</spanx> which consists of zero or many zero-value bits. The count of consecutive zero-values of the <spanx style="verb">VINT_WIDTH</spanx> plus one equals the length in octets of the <spanx style="verb">Variable Size Integer</spanx>. For example, a <spanx style="verb">Variable Size Integer</spanx> that starts with a <spanx style="verb">VINT_WIDTH</spanx> which contains zero consecutive zero-value bits is one octet in length and a <spanx style="verb">Variable Size Integer</spanx> that starts with one consecutive zero-value bit is two octets in length. The <spanx style="verb">VINT_WIDTH</spanx> MUST only contain zero-value bits or be empty.
</t>
<t>Within the <spanx style="verb">EBML Header</spanx> the <spanx style="verb">VINT_WIDTH</spanx> MUST NOT exceed three bits in length (meaning that the <spanx style="verb">Variable Size Integer</spanx> MUST NOT exceed four octets in length). Within the <spanx style="verb">EBML Body</spanx>, when <spanx style="verb">VINTs</spanx> are used to express an <spanx style="verb">Element ID</spanx>, the maximum length allowed for the <spanx style="verb">VINT_WIDTH</spanx> is one less than the value set in the <spanx style="verb">EBMLMaxIDLength Element</spanx>. Within the <spanx style="verb">EBML Body</spanx>, when <spanx style="verb">VINTs</spanx> are used to express an <spanx style="verb">Element Data Size</spanx>, the maximum length allowed for the <spanx style="verb">VINT_WIDTH</spanx> is one less than the value set in the <spanx style="verb">EBMLMaxSizeLength Element</spanx>.
</t>
</section>

<section anchor="vintmarker" title="VINT_MARKER">
<t>The <spanx style="verb">VINT_MARKER</spanx> serves as a separator between the <spanx style="verb">VINT_WIDTH</spanx> and <spanx style="verb">VINT_DATA</spanx>. Each <spanx style="verb">Variable Size Integer</spanx> MUST contain exactly one <spanx style="verb">VINT_MARKER</spanx>. The <spanx style="verb">VINT_MARKER</spanx> MUST be one bit in length and contain a bit with a value of one. The first bit with a value of one within the <spanx style="verb">Variable Size Integer</spanx> is the <spanx style="verb">VINT_MARKER</spanx>.
</t>
</section>

<section anchor="vintdata" title="VINT_DATA">
<t>The <spanx style="verb">VINT_DATA</spanx> portion of the <spanx style="verb">Variable Size Integer</spanx> includes all data that follows (but not including) the <spanx style="verb">VINT_MARKER</spanx> until end of the <spanx style="verb">Variable Size Integer</spanx> whose length is derived from the <spanx style="verb">VINT_WIDTH</spanx>. The bits required for the <spanx style="verb">VINT_WIDTH</spanx> and the <spanx style="verb">VINT_MARKER</spanx> combined use one out of eight bits of the total length of the <spanx style="verb">Variable Size Integer</spanx>. Thus a <spanx style="verb">Variable Size Integer</spanx> of 1 octet length supplies 7 bits for <spanx style="verb">VINT_DATA</spanx>, a 2 octet length supplies 14 bits for <spanx style="verb">VINT_DATA</spanx>, and a 3 octet length supplies 21 bits for <spanx style="verb">VINT_DATA</spanx>. If the number of bits required for <spanx style="verb">VINT_DATA</spanx> are less than the bit size of <spanx style="verb">VINT_DATA</spanx>, then <spanx style="verb">VINT_DATA</spanx> SHOULD be zero-padded to the left to a size that fits. The <spanx style="verb">VINT_DATA</spanx> value MUST be expressed as a big-endian unsigned integer.
</t>
</section>

<section anchor="vint-examples" title="VINT Examples">
<t>This table shows examples of <spanx style="verb">Variable Size Integers</spanx> with lengths from 1 to 5 octets. The Size column refers to the size of the <spanx style="verb">VINT_DATA</spanx> in bits. The Representation column depicts a binary expression of <spanx style="verb">Variable Size Integers</spanx> where <spanx style="verb">VINT_WIDTH</spanx> is depicted by '0', the <spanx style="verb">VINT_MARKER</spanx> as '1', and the <spanx style="verb">VINT_DATA</spanx> as 'x'.
</t>
<texttable>
<ttcol align="center">Octet Length</ttcol>
<ttcol align="center">Size</ttcol>
<ttcol align="left">Representation</ttcol>

<c>1</c><c>2^7</c><c>1xxx xxxx</c>
<c>2</c><c>2^14</c><c>01xx xxxx xxxx xxxx</c>
<c>3</c><c>2^21</c><c>001x xxxx xxxx xxxx xxxx xxxx</c>
<c>4</c><c>2^28</c><c>0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx</c>
<c>5</c><c>2^35</c><c>0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx</c>
</texttable>
<t>Data encoded as a <spanx style="verb">Variable Size Integer</spanx> MAY be rendered at octet lengths larger than needed to store the data. In this table a binary value of <spanx style="verb">0b10</spanx> is shown encoded as different <spanx style="verb">Variable Size Integers</spanx> with lengths from one octet to four octet. All four encoded examples have identical semantic meaning though the <spanx style="verb">VINT_WIDTH</spanx> and the padding of the <spanx style="verb">VINT_DATA</spanx> vary.
</t>
<texttable>
<ttcol align="center">Binary Value</ttcol>
<ttcol align="center">Octet Length</ttcol>
<ttcol align="left">As Represented in Variable Size Integer</ttcol>

<c>10</c><c>1</c><c>1000 0010</c>
<c>10</c><c>2</c><c>0100 0000 0000 0010</c>
<c>10</c><c>3</c><c>0010 0000 0000 0000 0000 0010</c>
<c>10</c><c>4</c><c>0001 0000 0000 0000 0000 0000 0000 0010</c>
</texttable>
</section>
</section>

<section anchor="element-id" title="Element ID">
<t>The <spanx style="verb">Element ID</spanx> MUST be encoded as a <spanx style="verb">Variable Size Integer</spanx>. By default, <spanx style="verb">Element IDs</spanx> are encoded in lengths from one octet to four octets, although <spanx style="verb">Element IDs</spanx> of greater lengths are used if the octet length of the longest <spanx style="verb">Element ID</spanx> of the <spanx style="verb">EBML Document</spanx> is declared in the <spanx style="verb">EBMLMaxIDLength Element</spanx> of the <spanx style="verb">EBML Header</spanx> (see <xref target="ebmlmaxidlength-element"/>). The <spanx style="verb">VINT_DATA</spanx> component of the <spanx style="verb">Element ID</spanx> MUST NOT be either defined or written as either all zero values or all one values. Any <spanx style="verb">Element ID</spanx> with the <spanx style="verb">VINT_DATA</spanx> component set as all zero values or all one values MUST be ignored and MUST NOT be considered an error in the <spanx style="verb">EBML Document</spanx>. The <spanx style="verb">VINT_DATA</spanx> component of the <spanx style="verb">Element ID</spanx> MUST be encoded at the shortest valid length. For example, an <spanx style="verb">Element ID</spanx> with binary encoding of <spanx style="verb">1011 1111</spanx> is valid, whereas an <spanx style="verb">Element ID</spanx> with binary encoding of <spanx style="verb">0100 0000 0011 1111</spanx> stores a semantically equal <spanx style="verb">VINT_DATA</spanx> but is invalid because a shorter <spanx style="verb">VINT</spanx> encoding is possible. Additionally, an <spanx style="verb">Element ID</spanx> with binary encoding of <spanx style="verb">1111 1111</spanx> is invalid since the <spanx style="verb">VINT_DATA</spanx> section is set to all one values, whereas an <spanx style="verb">Element ID</spanx> with binary encoding of <spanx style="verb">0100 0000 0111 1111</spanx> stores a semantically equal <spanx style="verb">VINT_DATA</spanx> and is the shortest possible <spanx style="verb">VINT</spanx> encoding.
</t>
<t>The following table details these specific examples further:
</t>
<texttable>
<ttcol align="right">VINT_WIDTH</ttcol>
<ttcol align="right">VINT_MARKER</ttcol>
<ttcol align="right">VINT_DATA</ttcol>
<ttcol align="left">Element ID Status</ttcol>

<c></c><c>1</c><c>0000000</c><c>Invalid: <spanx style="verb">VINT_DATA</spanx> MUST NOT be set to all 0</c>
<c>0</c><c>1</c><c>00000000000000</c><c>Invalid: <spanx style="verb">VINT_DATA</spanx> MUST NOT be set to all 0</c>
<c></c><c>1</c><c>0000001</c><c>Valid</c>
<c>0</c><c>1</c><c>00000000000001</c><c>Invalid: A shorter <spanx style="verb">VINT_DATA</spanx> encoding is available.</c>
<c></c><c>1</c><c>0111111</c><c>Valid</c>
<c>0</c><c>1</c><c>00000000111111</c><c>Invalid: A shorter <spanx style="verb">VINT_DATA</spanx> encoding is available.</c>
<c></c><c>1</c><c>1111111</c><c>Invalid: <spanx style="verb">VINT_DATA</spanx> MUST NOT be set to all 1</c>
<c>0</c><c>1</c><c>00000001111111</c><c>Valid</c>
</texttable>
<t>The octet length of an <spanx style="verb">Element ID</spanx> determines its <spanx style="verb">EBML Class</spanx>.
</t>
<texttable>
<ttcol align="center">EBML Class</ttcol>
<ttcol align="center">Octet Length</ttcol>
<ttcol align="left">Number of Possible Element IDs</ttcol>

<c>Class A</c><c>1</c><c>2^7  - 2        =         126</c>
<c>Class B</c><c>2</c><c>2^14 - 2^7  - 1 =      16,255</c>
<c>Class C</c><c>3</c><c>2^21 - 2^14 - 1 =   2,080,767</c>
<c>Class D</c><c>4</c><c>2^28 - 2^21 - 1 = 266,338,303</c>
</texttable>
</section>

<section anchor="element-data-size" title="Element Data Size">
<t>The <spanx style="verb">Element Data Size</spanx> expresses the length in octets of <spanx style="verb">Element Data</spanx>. The <spanx style="verb">Element Data Size</spanx> itself MUST be encoded as a <spanx style="verb">Variable Size Integer</spanx>. By default, <spanx style="verb">Element Data Sizes</spanx> can be encoded in lengths from one octet to eight octets, although <spanx style="verb">Element Data Sizes</spanx> of greater lengths MAY be used if the octet length of the longest <spanx style="verb">Element Data Size</spanx> of the <spanx style="verb">EBML Document</spanx> is declared in the <spanx style="verb">EBMLMaxSizeLength Element</spanx> of the <spanx style="verb">EBML Header</spanx> (see <xref target="ebmlmaxsizelength-element"/>). Unlike the <spanx style="verb">VINT_DATA</spanx> of the <spanx style="verb">Element ID</spanx>, the <spanx style="verb">VINT_DATA</spanx> component of the <spanx style="verb">Element Data Size</spanx> is not mandated to be encoded at the shortest valid length. For example, an <spanx style="verb">Element Data Size</spanx> with binary encoding of <spanx style="verb">1011 1111</spanx> or a binary encoding of <spanx style="verb">0100 0000 0011 1111</spanx> are both valid <spanx style="verb">Element Data Sizes</spanx> and both store a semantically equal value (both <spanx style="verb">0b00000000111111</spanx> and <spanx style="verb">0b0111111</spanx>, the <spanx style="verb">VINT_DATA</spanx> sections of the examples, represent the integer 63).
</t>
<t>Although an <spanx style="verb">Element ID</spanx> with all <spanx style="verb">VINT_DATA</spanx> bits set to zero is invalid, an <spanx style="verb">Element Data Size</spanx> with all <spanx style="verb">VINT_DATA</spanx> bits set to zero is allowed for <spanx style="verb">EBML Element Types</spanx> which do not mandate a non-zero length (see <xref target="ebml-element-types"/>). An <spanx style="verb">Element Data Size</spanx> with all <spanx style="verb">VINT_DATA</spanx> bits set to zero indicates that the <spanx style="verb">Element Data</spanx> is zero octets in length. Such an <spanx style="verb">EBML Element</spanx> is referred to as an <spanx style="verb">Empty Element</spanx>. If an <spanx style="verb">Empty Element</spanx> has a <spanx style="verb">default</spanx> value declared then the <spanx style="verb">EBML Reader</spanx> MUST interpret the value of the <spanx style="verb">Empty Element</spanx> as the <spanx style="verb">default</spanx> value. If an <spanx style="verb">Empty Element</spanx> has no <spanx style="verb">default</spanx> value declared then the <spanx style="verb">EBML Reader</spanx> MUST interpret the value of the <spanx style="verb">Empty Element</spanx> as defined as part of the definition of the corresponding <spanx style="verb">EBML Element Type</spanx> associated with the <spanx style="verb">Element ID</spanx>.
</t>
<t>An <spanx style="verb">Element Data Size</spanx> with all <spanx style="verb">VINT_DATA</spanx> bits set to one is reserved as an indicator that the size of the <spanx style="verb">EBML Element</spanx> is unknown. The only reserved value for the <spanx style="verb">VINT_DATA</spanx> of <spanx style="verb">Element Data Size</spanx> is all bits set to one. An <spanx style="verb">EBML Element</spanx> with an unknown <spanx style="verb">Element Data Size</spanx> is referred to as an <spanx style="verb">Unknown-Sized Element</spanx>. Only <spanx style="verb">Master Elements</spanx> SHALL be <spanx style="verb">Unknown-Sized Elements</spanx>. <spanx style="verb">Master Elements</spanx> MUST NOT use an unknown size unless the <spanx style="verb">unknownsizeallowed</spanx> attribute of their <spanx style="verb">EBML Schema</spanx> is set to true (see <xref target="unknownsizeallowed"/>). The use of <spanx style="verb">Unknown-Sized Elements</spanx> allows for an <spanx style="verb">EBML Element</spanx> to be written and read before the size of the <spanx style="verb">EBML Element</spanx> is known. <spanx style="verb">Unknown-Sized Element</spanx> MUST NOT be used or defined unnecessarily; however if the <spanx style="verb">Element Data Size</spanx> is not known before the <spanx style="verb">Element Data</spanx> is written, such as in some cases of data streaming, then <spanx style="verb">Unknown-Sized Elements</spanx> MAY be used. The end of an <spanx style="verb">Unknown-Sized Element</spanx> is determined by whichever comes first: the end of the file or the beginning of the next <spanx style="verb">EBML Element</spanx>, defined by this document or the corresponding <spanx style="verb">EBML Schema</spanx>, that is not independently valid as <spanx style="verb">Descendant Element</spanx> of the <spanx style="verb">Unknown-Sized Element</spanx>.
</t>
<t>For <spanx style="verb">Element Data Sizes</spanx> encoded at octet lengths from one to eight, this table depicts the range of possible values that can be encoded as an <spanx style="verb">Element Data Size</spanx>. An <spanx style="verb">Element Data Size</spanx> with an octet length of 8 is able to express a size of 2^56-2 or 72,057,594,037,927,934 octets (or about 72 petabytes). The maximum possible value that can be stored as <spanx style="verb">Element Data Size</spanx> is referred to as <spanx style="verb">VINTMAX</spanx>.
</t>
<texttable>
<ttcol align="center">Octet Length</ttcol>
<ttcol align="center">Possible Value Range</ttcol>

<c>1</c><c>0 to  2^7-2</c>
<c>2</c><c>0 to 2^14-2</c>
<c>3</c><c>0 to 2^21-2</c>
<c>4</c><c>0 to 2^28-2</c>
<c>5</c><c>0 to 2^35-2</c>
<c>6</c><c>0 to 2^42-2</c>
<c>7</c><c>0 to 2^49-2</c>
<c>8</c><c>0 to 2^56-2</c>
</texttable>
<t>If the length of <spanx style="verb">Element Data</spanx> equals <spanx style="verb">2^(n*7)-1</spanx> then the octet length of the <spanx style="verb">Element Data Size</spanx> MUST be at least <spanx style="verb">n+1</spanx>. This rule prevents an <spanx style="verb">Element Data Size</spanx> from being expressed as a reserved value. For example, an <spanx style="verb">EBML Element</spanx> with an octet length of 127 MUST NOT be encoded in an <spanx style="verb">Element Data Size</spanx> encoding with a one octet length. The following table clarifies this rule by showing a valid and invalid expression of an <spanx style="verb">Element Data Size</spanx> with a <spanx style="verb">VINT_DATA</spanx> of 127 (which is equal to 2^(1*7)-1).
</t>
<texttable>
<ttcol align="right">VINT_WIDTH</ttcol>
<ttcol align="right">VINT_MARKER</ttcol>
<ttcol align="right">VINT_DATA</ttcol>
<ttcol align="center">Element Data Size Status</ttcol>

<c></c><c>1</c><c>1111111</c><c>Reserved (meaning Unknown)</c>
<c>0</c><c>1</c><c>00000001111111</c><c>Valid (meaning 127 octets)</c>
</texttable>
</section>

<section anchor="ebml-element-types" title="EBML Element Types">
<t><spanx style="verb">EBML Elements</spanx> are defined by an <spanx style="verb">EBML Schema</spanx> which MUST declare one of the following <spanx style="verb">EBML Element Types</spanx> for each <spanx style="verb">EBML Element</spanx>. An <spanx style="verb">EBML Element Type</spanx> defines a concept of storing data within an <spanx style="verb">EBML Element</spanx> that describes such characteristics as length, endianness, and definition.
</t>
<t><spanx style="verb">EBML Elements</spanx> which are defined as a <spanx style="verb">Signed Integer Element</spanx>, <spanx style="verb">Unsigned Integer Element</spanx>, <spanx style="verb">Float Element</spanx>, or <spanx style="verb">Date Element</spanx> use big endian storage.
</t>

<section anchor="signed-integer-element" title="Signed Integer Element">
<t>A <spanx style="verb">Signed Integer Element</spanx> MUST declare a length from zero to eight octets. If the <spanx style="verb">EBML Element</spanx> is not defined to have a <spanx style="verb">default</spanx> value, then a <spanx style="verb">Signed Integer Element</spanx> with a zero-octet length represents an integer value of zero.
</t>
<t>A <spanx style="verb">Signed Integer Element</spanx> stores an integer (meaning that it can be written without a fractional component) which could be negative, positive, or zero. Signed Integers MUST be stored with two's complement notation with the leftmost bit being the sign bit. Because <spanx style="verb">EBML</spanx> limits Signed Integers to 8 octets in length a <spanx style="verb">Signed Integer Element</spanx> stores a number from −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.
</t>
</section>

<section anchor="unsigned-integer-element" title="Unsigned Integer Element">
<t>An <spanx style="verb">Unsigned Integer Element</spanx> MUST declare a length from zero to eight octets. If the <spanx style="verb">EBML Element</spanx> is not defined to have a <spanx style="verb">default</spanx> value, then an <spanx style="verb">Unsigned Integer Element</spanx> with a zero-octet length represents an integer value of zero.
</t>
<t>An <spanx style="verb">Unsigned Integer Element</spanx> stores an integer (meaning that it can be written without a fractional component) which could be positive or zero. Because <spanx style="verb">EBML</spanx> limits Unsigned Integers to 8 octets in length an <spanx style="verb">Unsigned Integer Element</spanx> stores a number from 0 to 18,446,744,073,709,551,615.
</t>
</section>

<section anchor="float-element" title="Float Element">
<t>A <spanx style="verb">Float Element</spanx> MUST declare a length of either zero octets (0 bit), four octets (32 bit) or eight octets (64 bit). If the <spanx style="verb">EBML Element</spanx> is not defined to have a <spanx style="verb">default</spanx> value, then a <spanx style="verb">Float Element</spanx> with a zero-octet length represents a numerical value of zero.
</t>
<t>A <spanx style="verb">Float Element</spanx> stores a floating-point number as defined in <xref target="IEEE.754.1985"/>.
</t>
</section>

<section anchor="string-element" title="String Element">
<t>A <spanx style="verb">String Element</spanx> MUST declare a length in octets from zero to <spanx style="verb">VINTMAX</spanx>. If the <spanx style="verb">EBML Element</spanx> is not defined to have a <spanx style="verb">default</spanx> value, then a <spanx style="verb">String Element</spanx> with a zero-octet length represents an empty string.
</t>
<t>A <spanx style="verb">String Element</spanx> MUST either be empty (zero-length) or contain printable ASCII characters <xref target="RFC0020"/> in the range of <spanx style="verb">0x20</spanx> to <spanx style="verb">0x7E</spanx>, with an exception made for termination (see <xref target="terminating-elements"/>).
</t>
</section>

<section anchor="utf8-element" title="UTF-8 Element">
<t>A <spanx style="verb">UTF-8 Element</spanx> MUST declare a length in octets from zero to <spanx style="verb">VINTMAX</spanx>. If the <spanx style="verb">EBML Element</spanx> is not defined to have a <spanx style="verb">default</spanx> value, then a <spanx style="verb">UTF-8 Element</spanx> with a zero-octet length represents an empty string.
</t>
<t>A <spanx style="verb">UTF-8 Element</spanx> contains only a valid Unicode string as defined in <xref target="RFC3629"/>, with an exception made for termination (see <xref target="terminating-elements"/>).
</t>
</section>

<section anchor="date-element" title="Date Element">
<t>A <spanx style="verb">Date Element</spanx> MUST declare a length of either zero octets or eight octets. If the <spanx style="verb">EBML Element</spanx> is not defined to have a <spanx style="verb">default</spanx> value, then a <spanx style="verb">Date Element</spanx> with a zero-octet length represents a timestamp of 2001-01-01T00:00:00.000000000 UTC <xref target="RFC3339"/>.
</t>
<t>The <spanx style="verb">Date Element</spanx> stores an integer in the same format as the <spanx style="verb">Signed Integer Element</spanx> that expresses a point in time referenced in nanoseconds from the precise beginning of the third millennium of the Gregorian Calendar in Coordinated Universal Time (also known as 2001-01-01T00:00:00.000000000 UTC). This provides a possible expression of time from 1708-09-11T00:12:44.854775808 UTC to 2293-04-11T11:47:16.854775807 UTC.
</t>
</section>

<section anchor="master-element" title="Master Element">
<t>A <spanx style="verb">Master Element</spanx> MUST declare a length in octets from zero to <spanx style="verb">VINTMAX</spanx>. The <spanx style="verb">Master Element</spanx> MAY also use an unknown length. See <xref target="element-data-size"/> for rules that apply to elements of unknown length.
</t>
<t>The <spanx style="verb">Master Element</spanx> contains zero, one, or many other elements. <spanx style="verb">EBML Elements</spanx> contained within a <spanx style="verb">Master Element</spanx> MUST have the <spanx style="verb">EBMLParentPath</spanx> of their <spanx style="verb">Element Path</spanx> equals to the <spanx style="verb">EBMLReferencePath</spanx> of the <spanx style="verb">Master Element</spanx> <spanx style="verb">Element Path</spanx> (see <xref target="path"/>). <spanx style="verb">Element Data</spanx> stored within <spanx style="verb">Master Elements</spanx> SHOULD only consist of <spanx style="verb">EBML Elements</spanx> and SHOULD NOT contain any data that is not part of an <spanx style="verb">EBML Element</spanx>. When <spanx style="verb">EBML</spanx> is used in transmission or streaming, data that is not part of an <spanx style="verb">EBML Element</spanx> is permitted to be present within a <spanx style="verb">Master Element</spanx> if <spanx style="verb">unknownsizeallowed</spanx> is enabled within the definition for that <spanx style="verb">Master Element</spanx>. In this case, the <spanx style="verb">EBML Reader</spanx> should skip data until a valid <spanx style="verb">Element ID</spanx> of the same <spanx style="verb">EBMLParentPath</spanx> or the next upper level <spanx style="verb">Element Path</spanx> of the <spanx style="verb">Master Element</spanx> is found. What <spanx style="verb">Element IDs</spanx> are considered valid within a <spanx style="verb">Master Element</spanx> is identified by the <spanx style="verb">EBML Schema</spanx> for that version of the <spanx style="verb">EBML Document Type</spanx>. Any data contained within a <spanx style="verb">Master Element</spanx> that is not part of a <spanx style="verb">Child Element</spanx> MUST be ignored.
</t>
</section>

<section anchor="binary-element" title="Binary Element">
<t>A <spanx style="verb">Binary Element</spanx> MUST declare a length in octets from zero to <spanx style="verb">VINTMAX</spanx>.
</t>
<t>The contents of a <spanx style="verb">Binary Element</spanx> should not be interpreted by the <spanx style="verb">EBML Reader</spanx>.
</t>
</section>
</section>

<section anchor="terminating-elements" title="Terminating Elements">
<t><spanx style="verb">Null Octets</spanx>, which are octets with all bits set to zero, MAY follow the value of a <spanx style="verb">String Element</spanx> or <spanx style="verb">UTF-8 Element</spanx> to serve as a terminator. An <spanx style="verb">EBML Writer</spanx> MAY terminate a <spanx style="verb">String Element</spanx> or <spanx style="verb">UTF-8 Element</spanx> with <spanx style="verb">Null Octets</spanx> in order to overwrite a stored value with a new value of lesser length while maintaining the same <spanx style="verb">Element Data Size</spanx> (this can prevent the need to rewrite large portions of an <spanx style="verb">EBML Document</spanx>); otherwise the use of <spanx style="verb">Null Octets</spanx> within a <spanx style="verb">String Element</spanx> or <spanx style="verb">UTF-8 Element</spanx> is NOT RECOMMENDED. An <spanx style="verb">EBML Reader</spanx> MUST consider the value of the <spanx style="verb">String Element</spanx> or <spanx style="verb">UTF-8 Element</spanx> to be terminated upon the first read <spanx style="verb">Null Octet</spanx> and MUST ignore any data following the first <spanx style="verb">Null Octet</spanx> within that <spanx style="verb">Element</spanx>. A string value and a copy of that string value terminated by one or more <spanx style="verb">Null Octets</spanx> are semantically equal.
</t>
<t>The following table shows examples of semantics and validation for the use of <spanx style="verb">Null Octets</spanx>. Values to represent <spanx style="verb">Stored Values</spanx> and the <spanx style="verb">Semantic Meaning</spanx> as represented as hexidecimal values.
</t>
<texttable>
<ttcol align="left">Stored Value</ttcol>
<ttcol align="left">Semantic Meaning</ttcol>

<c>0x65 0x62 0x6d 0x6c</c><c>0x65 0x62 0x6d 0x6c</c>
<c>0x65 0x62 0x00 0x6c</c><c>0x65 0x62</c>
<c>0x65 0x62 0x00 0x00</c><c>0x65 0x62</c>
<c>0x65 0x62</c><c>0x65 0x62</c>
</texttable>
</section>

<section anchor="guidelines-for-updating-elements" title="Guidelines for Updating Elements">
<t>An EBML Document can be updated without requiring that the entire EBML Document be rewritten. These recommendations describe strategies to change the <spanx style="verb">Element Data</spanx> of a written <spanx style="verb">EBML Element</spanx> with minimal disruption to the rest of the <spanx style="verb">EBML Document</spanx>.
</t>

<section anchor="reducing-a-element-data-in-size" title="Reducing a Element Data in Size">
<t>There are three methods to reduce the size of <spanx style="verb">Element Data</spanx> of a written <spanx style="verb">EBML Element</spanx>.
</t>

<section anchor="adding-a-void-element" title="Adding a Void Element">
<t>When an <spanx style="verb">EBML Element</spanx> is changed to reduce its total length by more than one octet, an <spanx style="verb">EBML Writer</spanx> SHOULD fill the freed space with a <spanx style="verb">Void Element</spanx>.
</t>
</section>

<section anchor="extending-the-element-data-size" title="Extending the Element Data Size">
<t>The same value for <spanx style="verb">Element Data Size</spanx> MAY be written in variable lengths, so for minor reductions in octet length the <spanx style="verb">Element Data Size</spanx> MAY be written to a longer octet length to fill the freed space.
</t>
<t>For example, the first row of the following table depicts a <spanx style="verb">String Element</spanx> that stores an <spanx style="verb">Element ID</spanx> (3 octets), <spanx style="verb">Element Data Size</spanx> (1 octet), and <spanx style="verb">Element Data</spanx> (4 octets). If the <spanx style="verb">Element Data</spanx> is changed to reduce the length by one octet and if the current length of the <spanx style="verb">Element Data Size</spanx> is less than its maximum permitted length, then the <spanx style="verb">Element Data Size</spanx> of that <spanx style="verb">Element</spanx> MAY be rewritten to increase its length by one octet. Thus before and after the change the <spanx style="verb">EBML Element</spanx> maintains the same length of 8 octets and data around the <spanx style="verb">Element</spanx> does not need to be moved.
</t>
<texttable>
<ttcol align="center">Status</ttcol>
<ttcol align="center">Element ID</ttcol>
<ttcol align="center">Element Data Size</ttcol>
<ttcol align="center">Element Data</ttcol>

<c>Before edit</c><c>0x3B4040</c><c>0x84</c><c>0x65626d6c</c>
<c>After edit</c><c>0x3B4040</c><c>0x4003</c><c>0x6d6b76</c>
</texttable>
<t>This method is only RECOMMENDED for reducing <spanx style="verb">Element Data</spanx> by a single octet; for reductions by two or more octets it is RECOMMENDED to fill the freed space with a <spanx style="verb">Void Element</spanx>.
</t>
<t>Note that if the <spanx style="verb">Element Data</spanx> length needs to be rewritten as shortened by one octet and the <spanx style="verb">Element Data Size</spanx> could be rewritten as a shorter <spanx style="verb">VINT</spanx> then it is RECOMMENDED to rewrite the <spanx style="verb">Element Data Size</spanx> as one octet shorter, shorten the <spanx style="verb">Element Data</spanx> by one octet, and follow that <spanx style="verb">Element</spanx> with a <spanx style="verb">Void Element</spanx>. For example, the following table depicts a <spanx style="verb">String Element</spanx> that stores an <spanx style="verb">Element ID</spanx> (3 octets), <spanx style="verb">Element Data Size</spanx> (2 octets, but could be rewritten in one octet), and <spanx style="verb">Element Data</spanx> (3 octets). If the <spanx style="verb">Element Data</spanx> is to be rewritten to a two octet length, then another octet can be taken from <spanx style="verb">Element Data Size</spanx> so that there is enough space to add a two octent <spanx style="verb">Void Element</spanx>.
</t>
<texttable>
<ttcol align="center">Status</ttcol>
<ttcol align="center">Element ID</ttcol>
<ttcol align="center">Element Data Size</ttcol>
<ttcol align="center">Element Data</ttcol>
<ttcol align="center">Void Element</ttcol>

<c>Before</c><c>0x3B4040</c><c>0x4003</c><c>0x6d6b76</c><c></c>
<c>After</c><c>0x3B4040</c><c>0x82</c><c>0x6869</c><c>0xEC80</c>
</texttable>
</section>

<section anchor="terminating-element-data" title="Terminating Element Data">
<t>For <spanx style="verb">String Elements</spanx> and <spanx style="verb">UTF-8 Elements</spanx> the length of <spanx style="verb">Element Data</spanx> MAY be reduced by adding <spanx style="verb">Null Octets</spanx> to terminate the <spanx style="verb">Element Data</spanx> (see <xref target="terminating-elements"/>).
</t>
<t>In the following table, a four octet long <spanx style="verb">Element Data</spanx> is changed to a three octet long value followed by a <spanx style="verb">Null Octet</spanx>; the <spanx style="verb">Element Data Size</spanx> includes any <spanx style="verb">Null Octets</spanx> used to terminate <spanx style="verb">Element Data</spanx> so remains unchanged.
</t>
<texttable>
<ttcol align="center">Status</ttcol>
<ttcol align="center">Element ID</ttcol>
<ttcol align="center">Element Data Size</ttcol>
<ttcol align="center">Element Data</ttcol>

<c>Before edit</c><c>0x3B4040</c><c>0x84</c><c>0x65626d6c</c>
<c>After edit</c><c>0x3B4040</c><c>0x84</c><c>0x6d6b7600</c>
</texttable>
<t>Note that this method is NOT RECOMMENDED. For reductions of one octet, the method for <spanx style="verb">Extending the Element Data Size</spanx> SHOULD be used. For reduction by more than one octet, the method for <spanx style="verb">Adding a Void Element</spanx> SHOULD be used.
</t>
</section>
</section>

<section anchor="considerations-when-updating-elements-with-crc" title="Considerations when Updating Elements with CRC">
<t>If the <spanx style="verb">Element</spanx> to be changed is a <spanx style="verb">Descendant Element</spanx> of any <spanx style="verb">Master Element</spanx> that contains an <spanx style="verb">CRC-32 Element</spanx> then the <spanx style="verb">CRC-32 Element</spanx> MUST be verified before permitting the change. Additionally the <spanx style="verb">CRC-32 Element</spanx> value MUST be subsequently updated to reflect the changed data.
</t>
</section>
</section>

<section anchor="ebml-document" title="EBML Document">
<t>An <spanx style="verb">EBML Document</spanx> is comprised of only two components, an <spanx style="verb">EBML Header</spanx> and an <spanx style="verb">EBML Body</spanx>. An <spanx style="verb">EBML Document</spanx> MUST start with an <spanx style="verb">EBML Header</spanx> that declares significant characteristics of the entire <spanx style="verb">EBML Body</spanx>. An <spanx style="verb">EBML Document</spanx> consists of <spanx style="verb">EBML Elements</spanx> and MUST NOT contain any data that is not part of an <spanx style="verb">EBML Element</spanx>.
</t>

<section anchor="ebml-header" title="EBML Header">
<t>The <spanx style="verb">EBML Header</spanx> is a declaration that provides processing instructions and identification of the <spanx style="verb">EBML Body</spanx>. The <spanx style="verb">EBML Header</spanx> of an <spanx style="verb">EBML Document</spanx> is analogous to the XML Declaration of an XML Document.
</t>
<t>The <spanx style="verb">EBML Header</spanx> documents the <spanx style="verb">EBML Schema</spanx> (also known as the <spanx style="verb">EBML DocType</spanx>) that is used to semantically interpret the structure and meaning of the <spanx style="verb">EBML Document</spanx>. Additionally the <spanx style="verb">EBML Header</spanx> documents the versions of both <spanx style="verb">EBML</spanx> and the <spanx style="verb">EBML Schema</spanx> that were used to write the <spanx style="verb">EBML Document</spanx> and the versions required to read the <spanx style="verb">EBML Document</spanx>.
</t>
<t>The <spanx style="verb">EBML Header</spanx> MUST contain a single <spanx style="verb">Master Element</spanx> with an <spanx style="verb">Element Name</spanx> of <spanx style="verb">EBML</spanx> and <spanx style="verb">Element ID</spanx> of <spanx style="verb">0x1A45DFA3</spanx> (see <xref target="ebml-element"/>) and any number of additional <spanx style="verb">EBML Elements</spanx> within it. The <spanx style="verb">EBML Header</spanx> MUST only contain <spanx style="verb">EBML Elements</spanx> that are defined as part of this document.
</t>
<t>All <spanx style="verb">EBML Elements</spanx> within the <spanx style="verb">EBML Header</spanx> MUST NOT use any <spanx style="verb">Element ID</spanx> with a length greater than 4 octets. All <spanx style="verb">EBML Elements</spanx> within the <spanx style="verb">EBML Header</spanx> MUST NOT use any <spanx style="verb">Element Data Size</spanx> with a length greater than 4 octets.
</t>
</section>

<section anchor="ebml-body" title="EBML Body">
<t>All data of an <spanx style="verb">EBML Document</spanx> following the <spanx style="verb">EBML Header</spanx> is the <spanx style="verb">EBML Body</spanx>. The end of the <spanx style="verb">EBML Body</spanx>, as well as the end of the <spanx style="verb">EBML Document</spanx> that contains the <spanx style="verb">EBML Body</spanx>, is considered as whichever comes first: the beginning of a new <spanx style="verb">EBML Header</spanx> at the <spanx style="verb">Root Level</spanx> or the end of the file. The <spanx style="verb">EBML Body</spanx> MUST consist only of <spanx style="verb">EBML Elements</spanx> and MUST NOT contain any data that is not part of an <spanx style="verb">EBML Element</spanx>. This document defines precisely what <spanx style="verb">EBML Elements</spanx> are to be used within the <spanx style="verb">EBML Header</spanx>, but does not name or define what <spanx style="verb">EBML Elements</spanx> are to be used within the <spanx style="verb">EBML Body</spanx>. The definition of what <spanx style="verb">EBML Elements</spanx> are to be used within the <spanx style="verb">EBML Body</spanx> is defined by an <spanx style="verb">EBML Schema</spanx>.
</t>
</section>
</section>

<section anchor="ebml-stream" title="EBML Stream">
<t>An <spanx style="verb">EBML Stream</spanx> is a file that consists of one or many <spanx style="verb">EBML Documents</spanx> that are concatenated together. An occurrence of a <spanx style="verb">EBML Header</spanx> at the <spanx style="verb">Root Level</spanx> marks the beginning of an <spanx style="verb">EBML Document</spanx>.
</t>
</section>

<section anchor="elements-semantic" title="Elements semantic">

<section anchor="ebml-schema" title="EBML Schema">
<t>An <spanx style="verb">EBML Schema</spanx> is an XML Document that defines the properties, arrangement, and usage of <spanx style="verb">EBML Elements</spanx> that compose a specific <spanx style="verb">EBML Document Type</spanx>. The relationship of an <spanx style="verb">EBML Schema</spanx> to an <spanx style="verb">EBML Document</spanx> may be considered analogous to the relationship of an XML Schema <xref target="W3C.REC-xmlschema-0-20010502"/> to an XML Document <xref target="W3C.REC-xml-20081126"/>. An <spanx style="verb">EBML Schema</spanx> MUST be clearly associated with one or many <spanx style="verb">EBML Document Types</spanx>. An <spanx style="verb">EBML Schema</spanx> must be expressed as well-formed XML. An <spanx style="verb">EBML Document Type</spanx> is identified by a string stored within the <spanx style="verb">EBML Header</spanx> in the <spanx style="verb">DocType Element</spanx>; for example <spanx style="verb">matroska</spanx> or <spanx style="verb">webm</spanx> (see <xref target="doctype-element"/>). The <spanx style="verb">DocType</spanx> value for an <spanx style="verb">EBML Document Type</spanx> SHOULD be unique and persistent.
</t>
<t>An <spanx style="verb">EBML Schema</spanx> MUST declare exactly one <spanx style="verb">EBML Element</spanx> at <spanx style="verb">Root Level</spanx> (referred to as the <spanx style="verb">Root Element</spanx>) that MUST occur exactly once within an <spanx style="verb">EBML Document</spanx>. The <spanx style="verb">Void Element</spanx> MAY also occur at <spanx style="verb">Root Level</spanx> but is not considered to be <spanx style="verb">Root Elements</spanx> (see <xref target="void-element"/>).
</t>
<t>The <spanx style="verb">EBML Schema</spanx> MUST document all Elements of the <spanx style="verb">EBML Body</spanx>. The <spanx style="verb">EBML Schema</spanx> does not document <spanx style="verb">Global Elements</spanx> that are defined by this document (namely the <spanx style="verb">Void Element</spanx> and the <spanx style="verb">CRC-32 Element</spanx>).
</t>
<t>An <spanx style="verb">EBML Schema</spanx> MAY constrain the use of <spanx style="verb">EBML Header Elements</spanx> (see <xref target="ebml-header-elements"/>) by adding or constraining that Element's <spanx style="verb">range</spanx> attribute. For example, an <spanx style="verb">EBML Schema</spanx> MAY constrain the <spanx style="verb">EBMLMaxSizeLength</spanx> to a maximum value of <spanx style="verb">8</spanx> or MAY constain the <spanx style="verb">EBMLVersion</spanx> to only support a value of <spanx style="verb">1</spanx>. If an <spanx style="verb">EBML Schema</spanx> adopts the <spanx style="verb">EBML Header Element</spanx> as-is, then it is not REQUIRED to document that Element within the <spanx style="verb">EBML Schema</spanx>. If an <spanx style="verb">EBML Schema</spanx> constrains the range of an <spanx style="verb">EBML Header Element</spanx>, then that <spanx style="verb">Element</spanx> MUST be documented within an <spanx style="verb">&lt;element&gt;</spanx> node of the <spanx style="verb">EBML Schema</spanx>. This document provides an example of an <spanx style="verb">EBML Schema</spanx>, see <xref target="ebml-schema-example"/>.
</t>

<section anchor="ebmlschema-element" title=" Element">
<t>As an XML Document, the <spanx style="verb">EBML Schema</spanx> MUST use <spanx style="verb">&lt;EBMLSchema&gt;</spanx> as the top level element. The <spanx style="verb">&lt;EBMLSchema&gt;</spanx> element MAY contain <spanx style="verb">&lt;element&gt;</spanx> sub-elements.
</t>
</section>

<section anchor="ebmlschema-attributes" title=" Attributes">
<t>Within an <spanx style="verb">EBML Schema</spanx> the <spanx style="verb">&lt;EBMLSchema&gt;</spanx> element uses the following attributes:
</t>

<section anchor="doctype" title="docType">
<t>The <spanx style="verb">docType</spanx> lists the official name of the <spanx style="verb">EBML Document Type</spanx> that is defined by the <spanx style="verb">EBML Schema</spanx>; for example, <spanx style="verb">&lt;EBMLSchema docType="matroska"&gt;</spanx>.
</t>
<t>The <spanx style="verb">docType</spanx> attribute is REQUIRED within the <spanx style="verb">&lt;EBMLSchema&gt;</spanx> Element.
</t>
</section>

<section anchor="version" title="version">
<t>The <spanx style="verb">version</spanx> lists an incremental non-negative integer that specifies the version of the docType documented by the <spanx style="verb">EBML Schema</spanx>. Unlike XML Schemas, an <spanx style="verb">EBML Schema</spanx> documents all versions of a docType's definition rather than using separate <spanx style="verb">EBML Schemas</spanx> for each version of a <spanx style="verb">docType</spanx>. <spanx style="verb">EBML Elements</spanx> may be introduced and deprecated by using the <spanx style="verb">minver</spanx> and <spanx style="verb">maxver</spanx> attributes of <spanx style="verb">&lt;element&gt;</spanx>.
</t>
<t>The <spanx style="verb">version</spanx> attribute is REQUIRED within the <spanx style="verb">&lt;EBMLSchema&gt;</spanx> Element.
</t>
</section>
</section>

<section anchor="element-element" title=" Element">
<t>Each <spanx style="verb">&lt;element&gt;</spanx> defines one <spanx style="verb">EBML Element</spanx> through the use of several attributes that are defined in <xref target="ebmlschema-attributes"/>. <spanx style="verb">EBML Schemas</spanx> MAY contain additional attributes to extend the semantics but MUST NOT conflict with the definitions of the <spanx style="verb">&lt;element&gt;</spanx> attributes defined within this document.
</t>
<t>The <spanx style="verb">&lt;element&gt;</spanx> nodes contain a description of the meaning and use of the <spanx style="verb">EBML Element</spanx> stored within one or many <spanx style="verb">&lt;documentation&gt;</spanx> sub-elements and zero or one <spanx style="verb">&lt;restriction&gt;</spanx> sub-element. All <spanx style="verb">&lt;element&gt;</spanx> nodes MUST be sub-elements of the <spanx style="verb">&lt;EBMLSchema&gt;</spanx>.
</t>
</section>

<section anchor="element-attributes" title=" Attributes">
<t>Within an <spanx style="verb">EBML Schema</spanx> the <spanx style="verb">&lt;element&gt;</spanx> uses the following attributes to define an <spanx style="verb">EBML Element</spanx>:
</t>

<section anchor="name" title="name">
<t>The <spanx style="verb">name</spanx> provides the official human-readable name of the <spanx style="verb">EBML Element</spanx>. The value of the name MUST be in the form of characters &quot;A&quot; to &quot;Z&quot;, &quot;a&quot; to &quot;z&quot;, &quot;0&quot; to &quot;9&quot;, &quot;-&quot; and &quot;.&quot;.
</t>
<t>The <spanx style="verb">name</spanx> attribute is REQUIRED.
</t>
</section>

<section anchor="path" title="path">
<t>The path defines the allowed storage locations of the <spanx style="verb">EBML Element</spanx> within an <spanx style="verb">EBML Document</spanx>. This path MUST be defined with the full hierarchy of <spanx style="verb">EBML Elements</spanx> separated with a <spanx style="verb">/</spanx>. The top <spanx style="verb">EBML Element</spanx> in the path hierarchy being the first in the value. The syntax of the <spanx style="verb">path</spanx> attribute is defined using this Augmented Backus-Naur Form (ABNF) <xref target="RFC5234"/> with the case sensitive update <xref target="RFC7405"/> notation:
</t>
<t>The <spanx style="verb">path</spanx> attribute is REQUIRED.
</t>

<figure align="center"><artwork align="center">
EBMLFullPath           = EBMLElementOccurrence "(" EBMLReferencePath ")"
EBMLReferencePath        = [EBMLParentPath] EBMLElementPath
EBMLParentPath           = EBMLFixedParent EBMLLastParent
EBMLFixedParent          = *(EBMLPathAtom)
EBMLElementPath          = EBMLPathAtom / EBMLPathAtomRecursive
EBMLPathAtom             = PathDelimiter EBMLAtomName
EBMLPathAtomRecursive    = "(1*(" EBMLPathAtom "))"
EBMLLastParent           = EBMLPathAtom / EBMLVariableParent
EBMLVariableParent       = "(" VariableParentOccurrence "\)"
EBMLAtomName             = 1*(EBMLNameChar)
EBMLNameChar             = ALPHA / DIGIT / "-" / "."
PathDelimiter            = "\"
EBMLElementOccurrence    = [EBMLMinOccurrence] "*" [EBMLMaxOccurrence]
EBMLMinOccurrence        = 1*DIGIT
EBMLMaxOccurrence        = 1*DIGIT
VariableParentOccurrence = [PathMinOccurrence] "*" [PathMaxOccurrence]
PathMinOccurrence        = 1*DIGIT
PathMaxOccurrence        = 1*DIGIT
</artwork></figure>
<t>The <spanx style="verb">"*"</spanx>, <spanx style="verb">"("</spanx> and <spanx style="verb">")"</spanx> symbols MUST be interpreted as they are defined in the ABNF.
</t>
<t>The <spanx style="verb">EBMLPathAtom</spanx> part of the <spanx style="verb">EBMLElementPath</spanx> MUST be equal to the <spanx style="verb">name</spanx> attribute of the <spanx style="verb">EBML Schema</spanx>.
</t>
<t>The starting <spanx style="verb">PathDelimiter</spanx> of the path corresponds to the root of the <spanx style="verb">EBML Document</spanx>.
</t>
<t>The <spanx style="verb">EBMLElementOccurrence</spanx> part is interpreted as an ABNF Variable Repetition. The repetition amounts correspond to how many times the <spanx style="verb">EBML Element</spanx> can be found in its <spanx style="verb">Parent Element</spanx>.
</t>
<t>The <spanx style="verb">EBMLMinOccurrence</spanx> represents the minimum number of occurrences of this <spanx style="verb">EBML Element</spanx> within its <spanx style="verb">Parent Element</spanx>. Each instance of the <spanx style="verb">Parent Element</spanx> MUST contain at least this many instances of this <spanx style="verb">EBML Element</spanx>. If the <spanx style="verb">EBML Element</spanx> has an empty <spanx style="verb">EBMLParentPath</spanx> then <spanx style="verb">EBMLMinOccurrence</spanx> refers to constraints on the occurrence of the <spanx style="verb">EBML Element</spanx> within the <spanx style="verb">EBML Document</spanx>. If <spanx style="verb">EBMLMinOccurrence</spanx> is not present then that <spanx style="verb">EBML Element</spanx> is considered to have a <spanx style="verb">EBMLMinOccurrence</spanx> value of 0. The semantic meaning of <spanx style="verb">EBMLMinOccurrence</spanx> within an <spanx style="verb">EBML Schema</spanx> is considered analogous to the meaning of <spanx style="verb">minOccurs</spanx> within an <spanx style="verb">XML Schema</spanx>. <spanx style="verb">EBML Elements</spanx> with <spanx style="verb">EBMLMinOccurrence</spanx> set to &quot;1&quot; that also have a <spanx style="verb">default</spanx> value (see <xref target="default"/>) declared are not REQUIRED to be stored but are REQUIRED to be interpreted, see <xref target="note-on-the-use-of-default-attributes-to-define-mandatory-ebml-elements"/>. An <spanx style="verb">EBML Element</spanx> defined with a <spanx style="verb">EBMLMinOccurrence</spanx> value greater than zero is called a <spanx style="verb">Mandatory EBML Element</spanx>.
</t>
<t>The <spanx style="verb">EBMLMaxOccurrence</spanx> represents the maximum number of occurrences of this <spanx style="verb">EBML Element</spanx> within its <spanx style="verb">Parent Element</spanx>. Each instance of the <spanx style="verb">Parent Element</spanx> MUST contain at most this many instances of this <spanx style="verb">EBML Element</spanx>. If the <spanx style="verb">EBML Element</spanx> has an empty <spanx style="verb">EBMLParentPath</spanx> then <spanx style="verb">EBMLMaxOccurrence</spanx> refers to constraints on the occurrence of the <spanx style="verb">EBML Element</spanx> within the <spanx style="verb">EBML Document</spanx>. If <spanx style="verb">EBMLMaxOccurrence</spanx> is not present then that <spanx style="verb">EBML Element</spanx> is considered to have no maximum occurrence. The semantic meaning of <spanx style="verb">EBMLMaxOccurrence</spanx> within an <spanx style="verb">EBML Schema path</spanx> is considered analogous to the meaning of <spanx style="verb">maxOccurs</spanx> within an <spanx style="verb">XML Schema</spanx>.
</t>
<t>The <spanx style="verb">VariableParentOccurrence</spanx> part is interpreted as an ABNF Variable Repetition. The repetition amounts correspond to the amount of unspecified <spanx style="verb">Parent Element</spanx> levels there can be between the <spanx style="verb">EBMLFixedParent</spanx> and the actual <spanx style="verb">EBMLElementPath</spanx>.
</t>
<t>If the path contains a <spanx style="verb">EBMLPathAtomRecursive</spanx> part, the <spanx style="verb">EBML Element</spanx> can occur within itself recursively (see the <xref target="recursive"/>).
</t>
</section>

<section anchor="id" title="id">
<t>The <spanx style="verb">Element ID</spanx> encoded as a <spanx style="verb">Variable Size Integer</spanx> expressed in hexadecimal notation prefixed by a <spanx style="verb">0x</spanx> that is read and stored in big-endian order. To reduce the risk of false positives while parsing <spanx style="verb">EBML Streams</spanx>, the <spanx style="verb">Element IDs</spanx> of the <spanx style="verb">Root Element</spanx> and <spanx style="verb">Top-Level Elements</spanx> SHOULD be at least 4 octets in length. <spanx style="verb">Element IDs</spanx> defined for use at <spanx style="verb">Root Level</spanx> or directly under the <spanx style="verb">Root Level</spanx> MAY use shorter octet lengths to facilitate padding and optimize edits to <spanx style="verb">EBML Documents</spanx>; for instance, the <spanx style="verb">Void Element</spanx> uses an <spanx style="verb">Element ID</spanx> with a one octet length to allow its usage in more writing and editing scenarios.
</t>
<t>The <spanx style="verb">id</spanx> attribute is REQUIRED.
</t>
</section>

<section anchor="minoccurs" title="minOccurs">
<t>An integer expressing the minimum number of occurrences of this <spanx style="verb">EBML Element</spanx> within its <spanx style="verb">Parent Element</spanx>. The <spanx style="verb">minOccurs</spanx> value MUST be equal to the <spanx style="verb">EBMLMinOccurrence</spanx> value of the <spanx style="verb">path</spanx>.
</t>
<t>The <spanx style="verb">minOccurs</spanx> attribute is OPTIONAL. If the <spanx style="verb">minOccurs</spanx> attribute is not present then that <spanx style="verb">EBML Element</spanx> is considered to have a <spanx style="verb">minOccurs</spanx> value of 0.
</t>
</section>

<section anchor="maxoccurs" title="maxOccurs">
<t>An integer expressing the maximum number of occurrences of this <spanx style="verb">EBML Element</spanx> within its <spanx style="verb">Parent Element</spanx>. The <spanx style="verb">maxOccurs</spanx> value MUST be equal to the <spanx style="verb">EBMLMaxOccurrence</spanx> value of the <spanx style="verb">path</spanx>.
</t>
<t>The <spanx style="verb">maxOccurs</spanx> attribute is OPTIONAL. If the <spanx style="verb">maxOccurs</spanx> attribute is not present then that <spanx style="verb">EBML Element</spanx> is considered to have no maximum occurrence, similar to <spanx style="verb">unbounded</spanx> in the XML world.
</t>
</section>

<section anchor="range" title="range">
<t>A numerical range for <spanx style="verb">EBML Elements</spanx> which are of numerical types (Unsigned Integer, Signed Integer, Float, and Date). If specified the value of the <spanx style="verb">EBML Element</spanx> MUST be within the defined range. See <xref target="expression-of-range"/> for rules applied to expression of range values.
</t>
<t>The <spanx style="verb">range</spanx> attribute is OPTIONAL. If the <spanx style="verb">range</spanx> attribute is not present then any value legal for the <spanx style="verb">type</spanx> attribute is valid.
</t>
</section>

<section anchor="size" title="size">
<t>A value to express the valid length of the <spanx style="verb">Element Data</spanx> as written measured in octets. The <spanx style="verb">size</spanx> provides a constraint in addition to the Length value of the definition of the corresponding <spanx style="verb">EBML Element Type</spanx>. This <spanx style="verb">size</spanx> MUST be expressed as either a non-negative integer or a range (see <xref target="expression-of-range"/>) that consists of only non-negative integers and valid operators.
</t>
<t>The <spanx style="verb">size</spanx> attribute is OPTIONAL. If the <spanx style="verb">size</spanx> attribute is not present for that <spanx style="verb">EBML Element</spanx> then that <spanx style="verb">EBML Element</spanx> is only limited in size by the definition of the associated <spanx style="verb">EBML Element Type</spanx>.
</t>
</section>

<section anchor="default" title="default">
<t>If an Element is mandatory (has a <spanx style="verb">EBMLMinOccurrence</spanx> value greater than zero) but not written within its <spanx style="verb">Parent Element</spanx> or stored as an <spanx style="verb">Empty Element</spanx>, then the <spanx style="verb">EBML Reader</spanx> of the <spanx style="verb">EBML Document</spanx> MUST semantically interpret the <spanx style="verb">EBML Element</spanx> as present with this specified default value for the <spanx style="verb">EBML Element</spanx>. <spanx style="verb">EBML Elements</spanx> that are <spanx style="verb">Master Elements</spanx> MUST NOT declare a <spanx style="verb">default</spanx> value. <spanx style="verb">EBML Elements</spanx> with a <spanx style="verb">minOccurs</spanx> value greater than 1 MUST NOT declare a <spanx style="verb">default</spanx> value.
</t>
<t>The <spanx style="verb">default</spanx> attribute is OPTIONAL.
</t>
</section>

<section anchor="type" title="type">
<t>The <spanx style="verb">type</spanx> MUST be set to one of the following values: 'integer' (signed integer), 'uinteger' (unsigned integer), 'float', 'string', 'date', 'utf-8', 'master', or 'binary'. The content of each <spanx style="verb">type</spanx> is defined within <xref target="ebml-element-types"/>.
</t>
<t>The <spanx style="verb">type</spanx> attribute is REQUIRED.
</t>
</section>

<section anchor="unknownsizeallowed" title="unknownsizeallowed">
<t>A boolean to express if an <spanx style="verb">EBML Element</spanx> MAY be used as an <spanx style="verb">Unknown-Sized Element</spanx> (having all <spanx style="verb">VINT_DATA</spanx> bits of <spanx style="verb">Element Data Size</spanx> set to 1). <spanx style="verb">EBML Elements</spanx> that are not <spanx style="verb">Master Elements</spanx> MUST NOT set <spanx style="verb">unknownsizeallowed</spanx> to true. An <spanx style="verb">EBML Element</spanx> that is defined with an <spanx style="verb">unknownsizeallowed</spanx> attribute set to 1 MUST also have the <spanx style="verb">unknownsizeallowed</spanx> attribute of its <spanx style="verb">Parent Element</spanx> set to 1.
</t>
<t>The <spanx style="verb">unknownsizeallowed</spanx> attribute is OPTIONAL. If the <spanx style="verb">unknownsizeallowed</spanx> attribute is not used then that <spanx style="verb">EBML Element</spanx> is not allowed to use an unknown <spanx style="verb">Element Data Size</spanx>.
</t>
</section>

<section anchor="recursive" title="recursive">
<t>A boolean to express if an <spanx style="verb">EBML Element</spanx> MAY be stored recursively. In this case the <spanx style="verb">EBML Element</spanx> MAY be stored within another <spanx style="verb">EBML Element</spanx> that has the same <spanx style="verb">Element ID</spanx>. Which itself can be stored in an <spanx style="verb">EBML Element</spanx> that has the same <spanx style="verb">Element ID</spanx>, and so on. <spanx style="verb">EBML Elements</spanx> that are not <spanx style="verb">Master Elements</spanx> MUST NOT set <spanx style="verb">recursive</spanx> to true.
</t>
<t>If the <spanx style="verb">path</spanx> contains a <spanx style="verb">EBMLPathAtomRecursive</spanx> part then the <spanx style="verb">recursive</spanx> value MUST be true and false otherwise.
</t>
<t>The <spanx style="verb">recursive</spanx> attribute is OPTIONAL. If the <spanx style="verb">recursive</spanx> attribute is not present then the <spanx style="verb">EBML Element</spanx> MUST NOT be used recursively.
</t>
</section>

<section anchor="minver" title="minver">
<t>The <spanx style="verb">minver</spanx> (minimum version) attribute stores a non-negative integer that represents the first version of the <spanx style="verb">docType</spanx> to support the <spanx style="verb">EBML Element</spanx>.
</t>
<t>The <spanx style="verb">minver</spanx> attribute is OPTIONAL. If the <spanx style="verb">minver</spanx> attribute is not present then the <spanx style="verb">EBML Element</spanx> has a minimum version of &quot;1&quot;.
</t>
</section>

<section anchor="maxver" title="maxver">
<t>The <spanx style="verb">maxver</spanx> (maximum version) attribute stores a non-negative integer that represents the last or most recent version of the <spanx style="verb">docType</spanx> to support the element. <spanx style="verb">maxver</spanx> MUST be greater than or equal to <spanx style="verb">minver</spanx>.
</t>
<t>The <spanx style="verb">maxver</spanx> attribute is OPTIONAL. If the <spanx style="verb">maxver</spanx> attribute is not present then the <spanx style="verb">EBML Element</spanx> has a maximum version equal to the value stored in the <spanx style="verb">version</spanx> attribute of <spanx style="verb">&lt;EBMLSchema&gt;</spanx>.
</t>
</section>
</section>

<section anchor="documentation-element" title=" Element">
<t>The <spanx style="verb">&lt;documentation&gt;</spanx> element provides additional information about the <spanx style="verb">EBML Element</spanx>.
</t>
</section>

<section anchor="documentation-attributes" title=" Attributes">

<section anchor="lang" title="lang">
<t>A <spanx style="verb">lang</spanx> attribute which is set to the <xref target="RFC5646"/> value of the language of the element's documentation.
</t>
<t>The <spanx style="verb">lang</spanx> attribute is OPTIONAL.
</t>
</section>

<section anchor="type-1" title="type">
<t>A <spanx style="verb">type</spanx> attribute distinguishes the meaning of the documentation. Values for the <spanx style="verb">&lt;documentation&gt;</spanx> sub-element's <spanx style="verb">type</spanx> attribute MUST include one of the following: <spanx style="verb">definition</spanx>, <spanx style="verb">rationale</spanx>, <spanx style="verb">usage notes</spanx>, and <spanx style="verb">references</spanx>.
</t>
<t>The <spanx style="verb">type</spanx> attribute is OPTIONAL.
</t>
</section>
</section>

<section anchor="restriction-element" title=" Element">
<t>The <spanx style="verb">&lt;restriction&gt;</spanx> element provides information about restrictions to the allowable values for the <spanx style="verb">EBML Element</spanx> which are listed in <spanx style="verb">&lt;enum&gt;</spanx> elements.
</t>
</section>

<section anchor="enum-element" title=" Element">
<t>The <spanx style="verb">&lt;enum&gt;</spanx> element stores a list of values allowed for storage in the <spanx style="verb">EBML Element</spanx>. The values MUST match the <spanx style="verb">type</spanx> of the <spanx style="verb">EBML Element</spanx> (for example <spanx style="verb">&lt;enum value="Yes"&gt;</spanx> can not be a valid value for a <spanx style="verb">EBML Element</spanx> that is defined as an unsigned integer). An <spanx style="verb">&lt;enum&gt;</spanx> element MAY also store <spanx style="verb">&lt;documentation&gt;</spanx> elements to further describe the <spanx style="verb">&lt;enum&gt;</spanx>.
</t>
</section>

<section anchor="enum-attributes" title=" Attributes">

<section anchor="label" title="label">
<t>The <spanx style="verb">label</spanx> provides a concise expression for human consumption that describes what the <spanx style="verb">value</spanx> of the <spanx style="verb">&lt;enum&gt;</spanx> represents.
</t>
<t>The <spanx style="verb">label</spanx> attribute is OPTIONAL.
</t>
</section>

<section anchor="value" title="value">
<t>The <spanx style="verb">value</spanx> represents data that MAY be stored within the <spanx style="verb">EBML Element</spanx>.
</t>
<t>The <spanx style="verb">value</spanx> attribute is REQUIRED.
</t>
</section>
</section>

<section anchor="xml-schema-for-ebml-schema" title="XML Schema for EBML Schema">
<t>
<figure align="center"><artwork align="center">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsd:schema xmlns="https://ietf.org/cellar/ebml"
  targetNamespace="https://ietf.org/cellar/ebml"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified" version="01"&gt;
  &lt;xsd:element name="EBMLSchema" type="EBMLSchemaType"/&gt;
  &lt;xsd:complexType name="EBMLSchemaType"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="element" type="elementType" minOccurs="0"
        maxOccurs="unbounded"/&gt;
    &lt;/xsd:sequence&gt;
    &lt;xsd:attribute name="docType" use="required"/&gt;
    &lt;xsd:attribute name="version" use="required"/&gt;
  &lt;/xsd:complexType&gt;
  &lt;xsd:complexType name="elementType"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="documentation" type="documentationType"
        minOccurs="0" maxOccurs="unbounded"/&gt;
      &lt;xsd:element name="restriction" type="restrictionType"
        minOccurs="0" maxOccurs="1"/&gt;
    &lt;/xsd:sequence&gt;
    &lt;xsd:attribute name="name" use="required"/&gt;
    &lt;xsd:attribute name="path" use="required"/&gt;
    &lt;xsd:attribute name="id" use="required"/&gt;
    &lt;xsd:attribute name="minOccurs" default="0"/&gt;
    &lt;xsd:attribute name="maxOccurs" default="1"/&gt;
    &lt;xsd:attribute name="range"/&gt;
    &lt;xsd:attribute name="size"/&gt;
    &lt;xsd:attribute name="default"/&gt;
    &lt;xsd:attribute name="type" use="required"/&gt;
    &lt;xsd:attribute name="unknownsizeallowed"/&gt;
    &lt;xsd:attribute name="recursive"/&gt;
    &lt;xsd:attribute name="minver" default="1"/&gt;
    &lt;xsd:attribute name="maxver"/&gt;
  &lt;/xsd:complexType&gt;
  &lt;xsd:complexType name="restrictionType"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="enum" type="enumType" minOccurs="0"
        maxOccurs="unbounded"/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  &lt;xsd:complexType name="enumType"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name="documentation" type="documentationType"
        minOccurs="0" maxOccurs="unbounded"/&gt;
    &lt;/xsd:sequence&gt;
    &lt;xsd:attribute name="label"/&gt;
    &lt;xsd:attribute name="value" use="required"/&gt;
  &lt;/xsd:complexType&gt;
  &lt;xsd:complexType name="documentationType" mixed="true"&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/&gt;
    &lt;/xsd:sequence&gt;
    &lt;xsd:attribute name="lang"/&gt;
    &lt;xsd:attribute name="type"/&gt;
  &lt;/xsd:complexType&gt;
&lt;/xsd:schema&gt;
</artwork></figure>

</t>
</section>

<section anchor="ebml-schema-example" title="EBML Schema Example">
<t>
<figure align="center"><artwork align="center" type="xml">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;EBMLSchema xmlns="https://ietf.org/cellar/ebml"
  docType="files-in-ebml-demo" version="1"&gt;
 &lt;!-- constraints to the range of two EBML Header Elements --&gt;
 &lt;element name="EBMLReadVersion" path="1*1(\EBML\EBMLReadVersion)"
   id="0x42F7" minOccurs="1" maxOccurs="1" range="1" default="1"
   type="uinteger"/&gt;
 &lt;element name="EBMLMaxSizeLength" path="1*1(\EBML\EBMLMaxSizeLength)"
   id="0x42F3" minOccurs="1" maxOccurs="1" range="8" default="8"
   type="uinteger"/&gt;
 &lt;!-- Root Element--&gt;
 &lt;element name="Files" path="*1(\Files)" id="0x1946696C" type="master"&gt;
  &lt;documentation lang="en" type="definition"&gt;Container of data and
  attributes representing one or many files.&lt;/documentation&gt;
 &lt;/element&gt;
 &lt;element name="File" path="1*(\Files\File)" id="0x6146" type="master"
   minOccurs="1"&gt;
  &lt;documentation lang="en" type="definition"&gt;
    An attached file.
  &lt;/documentation&gt;
 &lt;/element&gt;
 &lt;element name="FileName" path="1*1(\Files\File\FileName)"
   id="0x614E" type="utf-8"
   minOccurs="1"&gt;
  &lt;documentation lang="en" type="definition"&gt;
    Filename of the attached file.
  &lt;/documentation&gt;
 &lt;/element&gt;
 &lt;element name="MimeType" path="1*1(\Files\File\MimeType)"
   id="0x464D" type="string"
     minOccurs="1"&gt;
  &lt;documentation lang="en" type="definition"&gt;
    MIME type of the file.
  &lt;/documentation&gt;
 &lt;/element&gt;
 &lt;element name="ModificationTimestamp"
   path="1*1(\Files\File\ModificationTimestamp)" id="0x4654"
   type="date" minOccurs="1"&gt;
  &lt;documentation lang="en" type="definition"&gt;
    Modification timestamp of the file.
  &lt;/documentation&gt;
 &lt;/element&gt;
 &lt;element name="Data" path="1*1(\Files\File\Data)" id="0x4664" 
   type="binary" minOccurs="1"&gt;
  &lt;documentation lang="en" type="definition"&gt;
    The data of the file.
  &lt;/documentation&gt;
 &lt;/element&gt;
&lt;/EBMLSchema&gt;
</artwork></figure>

</t>
</section>

<section anchor="identically-recurring-elements" title="Identically Recurring Elements">
<t>An <spanx style="verb">Identically Recurring Element</spanx> is an <spanx style="verb">EBML Element</spanx> that MAY occur within its <spanx style="verb">Parent Element</spanx> more than once but that each recurrence within that <spanx style="verb">Parent Element</spanx> MUST be identical both in storage and semantics. <spanx style="verb">Identically Recurring Elements</spanx> are permitted to be stored multiple times within the same <spanx style="verb">Parent Element</spanx> in order to increase data resilience and optimize the use of <spanx style="verb">EBML</spanx> in transmission. For instance a pertinent <spanx style="verb">Top-Level Element</spanx> could be periodically resent within a data stream so that an <spanx style="verb">EBML Reader</spanx> which starts reading the stream from the middle could better interpret the contents. <spanx style="verb">Identically Recurring Elements</spanx> SHOULD include a <spanx style="verb">CRC-32 Element</spanx> as a <spanx style="verb">Child Element</spanx>; this is especially recommended when <spanx style="verb">EBML</spanx> is used for long-term storage or transmission. If a <spanx style="verb">Parent Element</spanx> contains more than one copy of an <spanx style="verb">Identically Recurring Element</spanx> which includes a <spanx style="verb">CRC-32 Element</spanx> as a <spanx style="verb">Child Element</spanx> then the first instance of the <spanx style="verb">Identically Recurring Element</spanx> with a valid CRC-32 value should be used for interpretation. If a <spanx style="verb">Parent Element</spanx> contains more than one copy of an <spanx style="verb">Identically Recurring Element</spanx> which does not contain a <spanx style="verb">CRC-32 Element</spanx> or if <spanx style="verb">CRC-32 Elements</spanx> are present but none are valid then the first instance of the <spanx style="verb">Identically Recurring Element</spanx> should be used for interpretation.
</t>
</section>

<section anchor="expression-of-range" title="Expression of range">
<t>The <spanx style="verb">range</spanx> attribute MUST only be used with <spanx style="verb">EBML Elements</spanx> that are either <spanx style="verb">signed integer</spanx>, <spanx style="verb">unsigned integer</spanx>, <spanx style="verb">float</spanx>, or <spanx style="verb">date</spanx>. The <spanx style="verb">range</spanx> expression may contain whitespace for readability but whitespace within a <spanx style="verb">range</spanx> expression MUST NOT convey meaning. The expression of the <spanx style="verb">range</spanx> MUST adhere to one of the following forms:
</t>
<t>
<list style="symbols">
<t><spanx style="verb">x-y</spanx> where x and y are integers or floats and <spanx style="verb">y</spanx> MUST be greater than <spanx style="verb">x</spanx>, meaning that the value MUST be greater than or equal to <spanx style="verb">x</spanx> and less than or equal to <spanx style="verb">y</spanx>. <spanx style="verb">x</spanx> MUST be less than <spanx style="verb">y</spanx>.</t>
<t><spanx style="verb">&gt;x</spanx> where <spanx style="verb">x</spanx> is an integer or float, meaning that the value MUST be greater than <spanx style="verb">x</spanx>.</t>
<t><spanx style="verb">&gt;=x</spanx> where <spanx style="verb">x</spanx> is an integer or float, meaning that the value MUST be greater than or equal to <spanx style="verb">x</spanx>.</t>
<t><spanx style="verb">&lt;x</spanx> where <spanx style="verb">x</spanx> is an integer or float, meaning that the value MUST be less than <spanx style="verb">x</spanx>.</t>
<t><spanx style="verb">&lt;=x</spanx> where <spanx style="verb">x</spanx> is an integer or float, meaning that the value MUST be less than or equal to <spanx style="verb">x</spanx>.</t>
<t><spanx style="verb">x</spanx> where <spanx style="verb">x</spanx> is an integer or float, meaning that the value MUST be equal <spanx style="verb">x</spanx>.</t>
</list>
</t>
<t>The <spanx style="verb">range</spanx> may use the prefix <spanx style="verb">not</spanx> to indicate that the expressed range is negated. Please also see <xref target="textual-expression-of-floats"/>.
</t>
</section>

<section anchor="textual-expression-of-floats" title="Textual expression of Floats">
<t>When a float value is represented textually in an <spanx style="verb">EBML Schema</spanx>, such as within a <spanx style="verb">default</spanx> or <spanx style="verb">range</spanx> value, the float values MUST be expressed as Hexadecimal Floating-Point Constants as defined in the C11 standard <xref target="ISO.9899.2011"/> (see section 6.4.4.2 on Floating Constants). The following table provides examples of expressions of float ranges.
</t>
<texttable>
<ttcol align="left">as decimal</ttcol>
<ttcol align="left">as Hexadecimal Floating-Point Constants</ttcol>

<c>0.0-1.0</c><c><spanx style="verb">0x0p+1-0x1p+0</spanx></c>
<c>1.0-256.0</c><c><spanx style="verb">0x1p+0-0x1p+8</spanx></c>
<c>0.857421875</c><c><spanx style="verb">0x1.b7p-1</spanx></c>
<c>-1.0--0.857421875</c><c><spanx style="verb">-0x1p+0--0x1.b7p-1</spanx></c>
</texttable>
<t>Within an expression of a float range, as in an integer range, the <spanx style="verb">-</spanx> (hyphen) character is the separator between the minimal and maximum value permitted by the range. Hexadecimal Floating-Point Constants also use a <spanx style="verb">-</spanx> (hyphen) when indicating a negative binary power. Within a float range, when a <spanx style="verb">-</spanx> (hyphen) is immediately preceded by a letter <spanx style="verb">p</spanx>, then the <spanx style="verb">-</spanx> (hyphen) is a part of the Hexadecimal Floating-Point Constant which notes negative binary power. Within a float range, when a <spanx style="verb">-</spanx> (hyphen) is not immediately preceded by a letter <spanx style="verb">p</spanx>, then the <spanx style="verb">-</spanx> (hyphen) represents the separator between the minimal and maximum value permitted by the range.
</t>
</section>

<section anchor="note-on-the-use-of-default-attributes-to-define-mandatory-ebml-elements" title="Note on the Use of default attributes to define Mandatory EBML Elements">
<t>If a <spanx style="verb">Mandatory EBML Element</spanx> has a default value declared by an <spanx style="verb">EBML Schema</spanx> and the value of the <spanx style="verb">EBML Element</spanx> is equal to the declared default value then that <spanx style="verb">EBML Element</spanx> is not required to be present within the <spanx style="verb">EBML Document</spanx> if its <spanx style="verb">Parent Element</spanx> is present. In this case, the default value of the <spanx style="verb">Mandatory EBML Element</spanx> MUST be interpreted by the <spanx style="verb">EBML Reader</spanx> although the <spanx style="verb">EBML Element</spanx> is not present within its <spanx style="verb">Parent Element</spanx>.
</t>
<t>If a <spanx style="verb">Mandatory EBML Element</spanx> has no default value declared by an <spanx style="verb">EBML Schema</spanx> and its <spanx style="verb">Parent Element</spanx> is present then the <spanx style="verb">EBML Element</spanx> MUST be present as well. If a <spanx style="verb">Mandatory EBML Element</spanx> has a default value declared by an <spanx style="verb">EBML Schema</spanx> and its <spanx style="verb">Parent Element</spanx> is present and the value of the <spanx style="verb">EBML Element</spanx> is NOT equal to the declared default value then the <spanx style="verb">EBML Element</spanx> MUST be present.
</t>
<t>This table clarifies if a <spanx style="verb">Mandatory EBML Element</spanx> MUST be written, according to if the <spanx style="verb">default</spanx> value is declared, if the value of the <spanx style="verb">EBML Element</spanx> is equal to the declared <spanx style="verb">default</spanx> value, and if the <spanx style="verb">Parent Element</spanx> is used.
</t>
<texttable>
<ttcol align="center">Is the default value declared?</ttcol>
<ttcol align="center">Is the value equal to default?</ttcol>
<ttcol align="center">Is the Parent Element present?</ttcol>
<ttcol align="center">Then is storing the EBML Element REQUIRED?</ttcol>

<c>Yes</c><c>Yes</c><c>Yes</c><c>No</c>
<c>Yes</c><c>Yes</c><c>No</c><c>No</c>
<c>Yes</c><c>No</c><c>Yes</c><c>Yes</c>
<c>Yes</c><c>No</c><c>No</c><c>No</c>
<c>No</c><c>n/a</c><c>Yes</c><c>Yes</c>
<c>No</c><c>n/a</c><c>No</c><c>No</c>
</texttable>
</section>
</section>

<section anchor="ebml-header-elements" title="EBML Header Elements">
<t>This document contains definitions of all <spanx style="verb">EBML Elements</spanx> of the <spanx style="verb">EBML Header</spanx>.
</t>

<section anchor="ebml-element" title="EBML Element">
<t>name: <spanx style="verb">EBML</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML)</spanx>
</t>
<t>id: <spanx style="verb">0x1A45DFA3</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>type: <spanx style="verb">Master Element</spanx>
</t>
<t>description: Set the <spanx style="verb">EBML</spanx> characteristics of the data to follow. Each <spanx style="verb">EBML Document</spanx> has to start with this.
</t>
</section>

<section anchor="ebmlversion-element" title="EBMLVersion Element">
<t>name: <spanx style="verb">EBMLVersion</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML\EBMLVersion)</spanx>
</t>
<t>id <spanx style="verb">0x4286</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>range:  not 0
</t>
<t>default: 1
</t>
<t>type: Unsigned Integer
</t>
<t>description: The version of <spanx style="verb">EBML</spanx> specifications used to create the <spanx style="verb">EBML Document</spanx>. The version of <spanx style="verb">EBML</spanx> defined in this document is 1, so <spanx style="verb">EBMLVersion</spanx> SHOULD be 1.
</t>
</section>

<section anchor="ebmlreadversion-element" title="EBMLReadVersion Element">
<t>name: <spanx style="verb">EBMLReadVersion</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML\EBMLReadVersion)</spanx>
</t>
<t>id: <spanx style="verb">0x42F7</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>range:  1
</t>
<t>default: 1
</t>
<t>type: Unsigned Integer
</t>
<t>description: The minimum <spanx style="verb">EBML</spanx> version an <spanx style="verb">EBML Reader</spanx> has to support to read this <spanx style="verb">EBML Document</spanx>. The <spanx style="verb">EBMLReadVersion Element</spanx> MUST be less than or equal to <spanx style="verb">EBMLVersion</spanx>.
</t>
</section>

<section anchor="ebmlmaxidlength-element" title="EBMLMaxIDLength Element">
<t>name: <spanx style="verb">EBMLMaxIDLength</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML\EBMLMaxIDLength)</spanx>
</t>
<t>id <spanx style="verb">0x42F2</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>range:  &gt;=4
</t>
<t>default: 4
</t>
<t>type: Unsigned Integer
</t>
<t>description: The <spanx style="verb">EBMLMaxIDLength Element</spanx> stores the maximum length in octets of the <spanx style="verb">Element IDs</spanx> to be found within the <spanx style="verb">EBML Body</spanx>. An <spanx style="verb">EBMLMaxIDLength Element</spanx> value of four is RECOMMENDED, though larger values are allowed.
</t>
</section>

<section anchor="ebmlmaxsizelength-element" title="EBMLMaxSizeLength Element">
<t>name: <spanx style="verb">EBMLMaxSizeLength</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML\EBMLMaxSizeLength)</spanx>
</t>
<t>id <spanx style="verb">0x42F3</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>range:  not 0
</t>
<t>default: 8
</t>
<t>type: Unsigned Integer
</t>
<t>description: The <spanx style="verb">EBMLMaxSizeLength Element</spanx> stores the maximum length in octets of the expression of all <spanx style="verb">Element Data Sizes</spanx> to be found within the <spanx style="verb">EBML Body</spanx>. To be clear the <spanx style="verb">EBMLMaxSizeLength Element</spanx> documents the maximum 'length' of all <spanx style="verb">Element Data Size</spanx> expressions within the <spanx style="verb">EBML Body</spanx> and not the maximum 'value' of all <spanx style="verb">Element Data Size</spanx> expressions within the <spanx style="verb">EBML Body</spanx>. <spanx style="verb">EBML Elements</spanx> that have an <spanx style="verb">Element Data Size</spanx> expression which is larger in octets than what is expressed by <spanx style="verb">EBMLMaxSizeLength ELEMENT</spanx> SHALL be considered invalid.
</t>
</section>

<section anchor="doctype-element" title="DocType Element">
<t>name: <spanx style="verb">DocType</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML\DocType)</spanx>
</t>
<t>id <spanx style="verb">0x4282</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>size: &gt;0
</t>
<t>type: String
</t>
<t>description: A string that describes and identifies the content of the <spanx style="verb">EBML Body</spanx> that follows this <spanx style="verb">EBML Header</spanx>.
</t>
</section>

<section anchor="doctypeversion-element" title="DocTypeVersion Element">
<t>name: <spanx style="verb">DocTypeVersion</spanx>
</t>
<t>path: <spanx style="verb">1*1(\EBML\DocTypeVersion)</spanx>
</t>
<t>id <spanx style="verb">0x4287</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>default: 1
</t>
<t>type: Unsigned Integer
</t>
<t>description: The version of <spanx style="verb">DocType</spanx> interpreter used to create the <spanx style="verb">EBML Document</spanx>.
</t>
</section>

<section anchor="doctypereadversion-element" title="DocTypeReadVersion Element">
<t>name: DocTypeReadVersion
</t>
<t>path: <spanx style="verb">1*1(\EBML\DocTypeReadVersion)</spanx>
</t>
<t>id <spanx style="verb">0x4285</spanx>
</t>
<t>minOccurs: 1
</t>
<t>maxOccurs: 1
</t>
<t>default: 1
</t>
<t>type: Unsigned Integer
</t>
<t>description: The minimum <spanx style="verb">DocType</spanx> version an <spanx style="verb">EBML Reader</spanx> has to support to read this <spanx style="verb">EBML Document</spanx>. The value of the <spanx style="verb">DocTypeReadVersion Element</spanx> MUST be less than or equal to the value of the <spanx style="verb">DocTypeVersion Element</spanx>.
</t>
</section>
</section>

<section anchor="global-elements-used-everywhere-in-the-format" title="Global elements (used everywhere in the format)">
<t>name: CRC-32
</t>
<t>path: <spanx style="verb">*1((1*\)\CRC-32)</spanx>
</t>
<t>id: <spanx style="verb">0xBF</spanx>
</t>
<t>minOccurs: 0
</t>
<t>maxOccurs: 1
</t>
<t>size: 4
</t>
<t>type: Binary
</t>
<t>description: The <spanx style="verb">CRC-32 Element</spanx> contains a 32-bit Cyclic Redundancy Check value of all the <spanx style="verb">Element Data</spanx> of the <spanx style="verb">Parent Element</spanx> as stored except for the <spanx style="verb">CRC-32 Element</spanx> itself. When the <spanx style="verb">CRC-32 Element</spanx> is present, the <spanx style="verb">CRC-32 Element</spanx> MUST be the first ordered <spanx style="verb">EBML Element</spanx> within its <spanx style="verb">Parent Element</spanx> for easier reading. All <spanx style="verb">Top-Level Elements</spanx> of an <spanx style="verb">EBML Document</spanx> that are <spanx style="verb">Master Elements</spanx> SHOULD include a <spanx style="verb">CRC-32 Element</spanx> as a <spanx style="verb">Child Element</spanx>. The CRC in use is the IEEE-CRC-32 algorithm as used in the <xref target="ISO.3309.1979"/> standard and in section 8.1.1.6.2 of <xref target="ITU.V42.1994"/>, with initial value of <spanx style="verb">0xFFFFFFFF</spanx>. The CRC value MUST be computed on a little endian bitstream and MUST use little endian storage.
</t>

<section anchor="void-element" title="Void Element">
<t>name: Void
</t>
<t>path: <spanx style="verb">*((*\)\Void)</spanx>
</t>
<t>id: <spanx style="verb">0xEC</spanx>
</t>
<t>minOccurs: 0
</t>
<t>type: Binary
</t>
<t>description: 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.
</t>
</section>
</section>
</section>

</middle>
<back>
<references title="Normative References">
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml2/reference.IEEE.754.1985.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml2/reference.ISO.3309.1979.xml"?>
<reference anchor="ISO.9899.2011">
  <front>
    <title>Programming languages - C</title>
    <author>
      <organization>International Organization for Standardization</organization>
    </author>
    <date month="" year="2011" />
  </front>
  <seriesInfo name="ISO" value="Standard 9899" />
</reference>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml2/reference.ITU.V42.1994.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.0020.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3339.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3629.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5646.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7405.xml"?>
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml4/reference.W3C.REC-xml-20081126.xml"?>
</references>
<references title="Informative References">
<?rfc include="https://xml2rfc.tools.ietf.org/public/rfc/bibxml4/reference.W3C.REC-xmlschema-0-20010502.xml"?>
</references>

</back>
</rfc>
