draft-ietf-cellar-ebml-11.txt   draft-ietf-cellar-ebml-12.txt 
cellar S. Lhomme cellar S. Lhomme
Internet-Draft Internet-Draft D. Rice
Intended status: Standards Track D. Rice Intended status: Standards Track M. Bunkus
Expires: March 27, 2020 Expires: 23 April 2020 21 October 2019
M. Bunkus
September 24, 2019
Extensible Binary Meta Language Extensible Binary Meta Language
draft-ietf-cellar-ebml-11 draft-ietf-cellar-ebml-12
Abstract Abstract
This document defines the Extensible Binary Meta Language (EBML) This document defines the Extensible Binary Meta Language (EBML)
format as a generalized file format for any type of data in a format as a generalized file format for any type of data in a
hierarchical form. EBML is designed as a binary equivalent to XML hierarchical form. EBML is designed as a binary equivalent to XML
and uses a storage-efficient approach to build nested Elements with and uses a storage-efficient approach to build nested Elements with
identifiers, lengths, and values. Similar to how an XML Schema identifiers, lengths, and values. Similar to how an XML Schema
defines the structure and semantics of an XML Document, this document defines the structure and semantics of an XML Document, this document
defines how EBML Schemas are created to convey the semantics of an defines how EBML Schemas are created to convey the semantics of an
skipping to change at page 1, line 39 skipping to change at page 1, line 37
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on March 27, 2020. This Internet-Draft will expire on 23 April 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents (https://trustee.ietf.org/
(https://trustee.ietf.org/license-info) in effect on the date of license-info) in effect on the date of publication of this document.
publication of this document. Please review these documents Please review these documents carefully, as they describe your rights
carefully, as they describe your rights and restrictions with respect and restrictions with respect to this document. Code Components
to this document. Code Components extracted from this document must extracted from this document must include Simplified BSD License text
include Simplified BSD License text as described in Section 4.e of as described in Section 4.e of the Trust Legal Provisions and are
the Trust Legal Provisions and are provided without warranty as provided without warranty as described in the Simplified BSD License.
described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Notation and Conventions . . . . . . . . . . . . . . . . . . 4 2. Notation and Conventions . . . . . . . . . . . . . . . . . . 4
3. Structure . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3. Structure . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4. Variable Size Integer . . . . . . . . . . . . . . . . . . . . 7 4. Variable Size Integer . . . . . . . . . . . . . . . . . . . . 7
4.1. VINT_WIDTH . . . . . . . . . . . . . . . . . . . . . . . 7 4.1. VINT_WIDTH . . . . . . . . . . . . . . . . . . . . . . . 7
4.2. VINT_MARKER . . . . . . . . . . . . . . . . . . . . . . . 7 4.2. VINT_MARKER . . . . . . . . . . . . . . . . . . . . . . . 7
4.3. VINT_DATA . . . . . . . . . . . . . . . . . . . . . . . . 8 4.3. VINT_DATA . . . . . . . . . . . . . . . . . . . . . . . . 8
4.4. VINT Examples . . . . . . . . . . . . . . . . . . . . . . 8 4.4. VINT Examples . . . . . . . . . . . . . . . . . . . . . . 8
5. Element ID . . . . . . . . . . . . . . . . . . . . . . . . . 9 5. Element ID . . . . . . . . . . . . . . . . . . . . . . . . . 9
6. Element Data Size . . . . . . . . . . . . . . . . . . . . . . 10 6. Element Data Size . . . . . . . . . . . . . . . . . . . . . . 11
6.1. Data Size Format . . . . . . . . . . . . . . . . . . . . 10 6.1. Data Size Format . . . . . . . . . . . . . . . . . . . . 11
6.2. Unknown Data Size . . . . . . . . . . . . . . . . . . . . 11 6.2. Unknown Data Size . . . . . . . . . . . . . . . . . . . . 11
6.3. Data Size Values . . . . . . . . . . . . . . . . . . . . 12 6.3. Data Size Values . . . . . . . . . . . . . . . . . . . . 14
7. EBML Element Types . . . . . . . . . . . . . . . . . . . . . 13 7. EBML Element Types . . . . . . . . . . . . . . . . . . . . . 15
7.1. Signed Integer Element . . . . . . . . . . . . . . . . . 14 7.1. Signed Integer Element . . . . . . . . . . . . . . . . . 15
7.2. Unsigned Integer Element . . . . . . . . . . . . . . . . 14 7.2. Unsigned Integer Element . . . . . . . . . . . . . . . . 16
7.3. Float Element . . . . . . . . . . . . . . . . . . . . . . 14 7.3. Float Element . . . . . . . . . . . . . . . . . . . . . . 16
7.4. String Element . . . . . . . . . . . . . . . . . . . . . 15 7.4. String Element . . . . . . . . . . . . . . . . . . . . . 16
7.5. UTF-8 Element . . . . . . . . . . . . . . . . . . . . . . 15 7.5. UTF-8 Element . . . . . . . . . . . . . . . . . . . . . . 16
7.6. Date Element . . . . . . . . . . . . . . . . . . . . . . 15 7.6. Date Element . . . . . . . . . . . . . . . . . . . . . . 17
7.7. Master Element . . . . . . . . . . . . . . . . . . . . . 15 7.7. Master Element . . . . . . . . . . . . . . . . . . . . . 17
7.8. Binary Element . . . . . . . . . . . . . . . . . . . . . 16 7.8. Binary Element . . . . . . . . . . . . . . . . . . . . . 17
8. EBML Document . . . . . . . . . . . . . . . . . . . . . . . . 16 8. EBML Document . . . . . . . . . . . . . . . . . . . . . . . . 18
8.1. EBML Header . . . . . . . . . . . . . . . . . . . . . . . 16 8.1. EBML Header . . . . . . . . . . . . . . . . . . . . . . . 18
8.2. EBML Body . . . . . . . . . . . . . . . . . . . . . . . . 16 8.2. EBML Body . . . . . . . . . . . . . . . . . . . . . . . . 18
9. EBML Stream . . . . . . . . . . . . . . . . . . . . . . . . . 17 9. EBML Stream . . . . . . . . . . . . . . . . . . . . . . . . . 18
10. EBML Versioning . . . . . . . . . . . . . . . . . . . . . . . 17 10. EBML Versioning . . . . . . . . . . . . . . . . . . . . . . . 19
10.1. EBML Header Version . . . . . . . . . . . . . . . . . . 17 10.1. EBML Header Version . . . . . . . . . . . . . . . . . . 19
10.2. EBML Document Version . . . . . . . . . . . . . . . . . 17 10.2. EBML Document Version . . . . . . . . . . . . . . . . . 19
11. Elements semantic . . . . . . . . . . . . . . . . . . . . . . 17 11. Elements semantic . . . . . . . . . . . . . . . . . . . . . . 19
11.1. EBML Schema . . . . . . . . . . . . . . . . . . . . . . 17 11.1. EBML Schema . . . . . . . . . . . . . . . . . . . . . . 19
11.1.1. EBML Schema Example . . . . . . . . . . . . . . . . 18 11.1.1. EBML Schema Example . . . . . . . . . . . . . . . . 20
11.1.2. <EBMLSchema> Element . . . . . . . . . . . . . . . . 19 11.1.2. <EBMLSchema> Element . . . . . . . . . . . . . . . . 20
11.1.3. <EBMLSchema> Attributes . . . . . . . . . . . . . . 19 11.1.3. <EBMLSchema> Attributes . . . . . . . . . . . . . . 20
11.1.4. <element> Element . . . . . . . . . . . . . . . . . 20 11.1.4. <element> Element . . . . . . . . . . . . . . . . . 21
11.1.5. <element> Attributes . . . . . . . . . . . . . . . . 20 11.1.5. <element> Attributes . . . . . . . . . . . . . . . . 21
11.1.6. <documentation> Element . . . . . . . . . . . . . . 26 11.1.6. <documentation> Element . . . . . . . . . . . . . . 28
11.1.7. <documentation> Attributes . . . . . . . . . . . . . 26 11.1.7. <documentation> Attributes . . . . . . . . . . . . . 28
11.1.8. <implementation_note> Element . . . . . . . . . . . 26 11.1.8. <implementation_note> Element . . . . . . . . . . . 28
11.1.9. <implementation_note> Attributes . . . . . . . . . . 27 11.1.9. <implementation_note> Attributes . . . . . . . . . . 28
11.1.10. <restriction> Element . . . . . . . . . . . . . . . 27 11.1.10. <restriction> Element . . . . . . . . . . . . . . . 29
11.1.11. <enum> Element . . . . . . . . . . . . . . . . . . . 27 11.1.11. <enum> Element . . . . . . . . . . . . . . . . . . . 29
11.1.12. <enum> Attributes . . . . . . . . . . . . . . . . . 27 11.1.12. <enum> Attributes . . . . . . . . . . . . . . . . . 29
11.1.13. <extension> Element . . . . . . . . . . . . . . . . 28 11.1.13. <extension> Element . . . . . . . . . . . . . . . . 29
11.1.14. <extension> Attributes . . . . . . . . . . . . . . . 28 11.1.14. <extension> Attributes . . . . . . . . . . . . . . . 30
11.1.15. XML Schema for EBML Schema . . . . . . . . . . . . . 28 11.1.15. XML Schema for EBML Schema . . . . . . . . . . . . . 30
11.1.16. Identically Recurring Elements . . . . . . . . . . . 31 11.1.16. Identically Recurring Elements . . . . . . . . . . . 30
11.1.17. Textual expression of floats . . . . . . . . . . . . 31 11.1.17. Textual expression of floats . . . . . . . . . . . . 31
11.1.18. Note on the use of default attributes to define 11.1.18. Note on the use of default attributes to define
Mandatory EBML Elements . . . . . . . . . . . . . . 32 Mandatory EBML Elements . . . . . . . . . . . . . . . 31
11.2. EBML Header Elements . . . . . . . . . . . . . . . . . . 33 11.2. EBML Header Elements . . . . . . . . . . . . . . . . . . 32
11.2.1. EBML Element . . . . . . . . . . . . . . . . . . . . 33 11.2.1. EBML Element . . . . . . . . . . . . . . . . . . . . 32
11.2.2. EBMLVersion Element . . . . . . . . . . . . . . . . 33 11.2.2. EBMLVersion Element . . . . . . . . . . . . . . . . 33
11.2.3. EBMLReadVersion Element . . . . . . . . . . . . . . 34 11.2.3. EBMLReadVersion Element . . . . . . . . . . . . . . 33
11.2.4. EBMLMaxIDLength Element . . . . . . . . . . . . . . 34 11.2.4. EBMLMaxIDLength Element . . . . . . . . . . . . . . 34
11.2.5. EBMLMaxSizeLength Element . . . . . . . . . . . . . 35 11.2.5. EBMLMaxSizeLength Element . . . . . . . . . . . . . 34
11.2.6. DocType Element . . . . . . . . . . . . . . . . . . 35 11.2.6. DocType Element . . . . . . . . . . . . . . . . . . 35
11.2.7. DocTypeVersion Element . . . . . . . . . . . . . . . 36 11.2.7. DocTypeVersion Element . . . . . . . . . . . . . . . 35
11.2.8. DocTypeReadVersion Element . . . . . . . . . . . . . 36 11.2.8. DocTypeReadVersion Element . . . . . . . . . . . . . 35
11.2.9. DocTypeExtension Element . . . . . . . . . . . . . . 37 11.2.9. DocTypeExtension Element . . . . . . . . . . . . . . 36
11.2.10. DocTypeExtensionName Element . . . . . . . . . . . . 37 11.2.10. DocTypeExtensionName Element . . . . . . . . . . . . 36
11.2.11. DocTypeExtensionVersion Element . . . . . . . . . . 37 11.2.11. DocTypeExtensionVersion Element . . . . . . . . . . 37
11.3. Global Elements . . . . . . . . . . . . . . . . . . . . 38 11.3. Global Elements . . . . . . . . . . . . . . . . . . . . 37
11.3.1. CRC-32 Element . . . . . . . . . . . . . . . . . . . 38 11.3.1. CRC-32 Element . . . . . . . . . . . . . . . . . . . 38
11.3.2. Void Element . . . . . . . . . . . . . . . . . . . . 39 11.3.2. Void Element . . . . . . . . . . . . . . . . . . . . 38
12. Considerations for Reading EBML Data . . . . . . . . . . . . 39 12. Considerations for Reading EBML Data . . . . . . . . . . . . 39
13. Terminating Elements . . . . . . . . . . . . . . . . . . . . 39 13. Terminating Elements . . . . . . . . . . . . . . . . . . . . 39
14. Guidelines for Updating Elements . . . . . . . . . . . . . . 40 14. Guidelines for Updating Elements . . . . . . . . . . . . . . 40
14.1. Reducing a Element Data in Size . . . . . . . . . . . . 40 14.1. Reducing a Element Data in Size . . . . . . . . . . . . 40
14.1.1. Adding a Void Element . . . . . . . . . . . . . . . 40 14.1.1. Adding a Void Element . . . . . . . . . . . . . . . 40
14.1.2. Extending the Element Data Size . . . . . . . . . . 40 14.1.2. Extending the Element Data Size . . . . . . . . . . 40
14.1.3. Terminating Element Data . . . . . . . . . . . . . . 41 14.1.3. Terminating Element Data . . . . . . . . . . . . . . 41
14.2. Considerations when Updating Elements with Cyclic 14.2. Considerations when Updating Elements with Cyclic
Redundancy Check (CRC) . . . . . . . . . . . . . . . . . 42 Redundancy Check (CRC) . . . . . . . . . . . . . . . . . 42
15. Backward and Forward Compatibility . . . . . . . . . . . . . 42 15. Backward and Forward Compatibility . . . . . . . . . . . . . 42
15.1. Backward Compatibility . . . . . . . . . . . . . . . . . 42 15.1. Backward Compatibility . . . . . . . . . . . . . . . . . 42
15.2. Forward Compatibility . . . . . . . . . . . . . . . . . 42 15.2. Forward Compatibility . . . . . . . . . . . . . . . . . 43
16. Security Considerations . . . . . . . . . . . . . . . . . . . 43 16. Security Considerations . . . . . . . . . . . . . . . . . . . 43
17. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 44 17. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 44
17.1. CELLAR EBML Element ID Registry . . . . . . . . . . . . 44 17.1. CELLAR EBML Element ID Registry . . . . . . . . . . . . 44
17.2. CELLAR EBML DocType Registry . . . . . . . . . . . . . . 46 17.2. CELLAR EBML DocType Registry . . . . . . . . . . . . . . 48
18. References . . . . . . . . . . . . . . . . . . . . . . . . . 47 18. Normative References . . . . . . . . . . . . . . . . . . . . 48
18.1. Normative References . . . . . . . . . . . . . . . . . . 47 19. Informative References . . . . . . . . . . . . . . . . . . . 49
18.2. Informative References . . . . . . . . . . . . . . . . . 48 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 50
18.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 48
1. Introduction 1. Introduction
EBML, short for Extensible Binary Meta Language, specifies a binary EBML, short for Extensible Binary Meta Language, specifies a binary
and octet (byte) aligned format inspired by the principle of XML (a and octet (byte) aligned format inspired by the principle of XML (a
framework for structuring data). framework for structuring data).
The goal of this document is to define a generic, binary, space- The goal of this document is to define a generic, binary, space-
efficient format that can be used to define more complex formats efficient format that can be used to define more complex formats
using an EBML Schema. EBML is used by the multimedia container using an EBML Schema. EBML is used by the multimedia container
Matroska [1]. The applicability of EBML for other use cases is Matroska (https://github.com/Matroska-Org/matroska-specification/).
beyond the scope of this document. The applicability of EBML for other use cases is beyond the scope of
this document.
The definition of the EBML format recognizes the idea behind HTML and The definition of the EBML format recognizes the idea behind HTML and
XML as a good one: separate structure and semantics allowing the same XML as a good one: separate structure and semantics allowing the same
structural layer to be used with multiple, possibly widely differing structural layer to be used with multiple, possibly widely differing
semantic layers. Except for the EBML Header and a few Global semantic layers. Except for the EBML Header and a few Global
Elements this specification does not define particular EBML format Elements this specification does not define particular EBML format
semantics; however this specification is intended to define how other semantics; however this specification is intended to define how other
EBML-based formats can be defined, such as the audio-video container EBML-based formats can be defined, such as the audio-video container
formats Matroska and WebM. formats Matroska and WebM.
EBML uses a simple approach of building Elements upon three pieces of EBML uses a simple approach of building Elements upon three pieces of
data (tag, length, and value) as this approach is well known, easy to data (tag, length, and value) as this approach is well known, easy to
parse, and allows selective data parsing. The EBML structure parse, and allows selective data parsing. The EBML structure
additionally allows for hierarchical arrangement to support complex additionally allows for hierarchical arrangement to support complex
structural formats in an efficient manner. structural formats in an efficient manner.
A typical EBML file has the following structure: A typical EBML file has the following structure:
EBML Header (master) EBML Header (master)
+ DocType (string) + DocType (string)
+ DocTypeVersion (unsigned integer) + DocTypeVersion (unsigned integer)
EBML Body Root (master) EBML Body Root (master)
+ ElementA (utf-8) + ElementA (utf-8)
+ Parent (master) + Parent (master)
+ ElementB (integer) + ElementB (integer)
+ Parent (master) + Parent (master)
+ ElementB (integer) + ElementB (integer)
2. Notation and Conventions 2. Notation and Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
This document defines specific terms in order to define the format This document defines specific terms in order to define the format
skipping to change at page 7, line 37 skipping to change at page 7, line 37
Variable Size Integer. For example, a Variable Size Integer that Variable Size Integer. For example, a Variable Size Integer that
starts with a VINT_WIDTH which contains zero consecutive zero-value starts with a VINT_WIDTH which contains zero consecutive zero-value
bits is one octet in length and a Variable Size Integer that starts bits is one octet in length and a Variable Size Integer that starts
with one consecutive zero-value bit is two octets in length. The with one consecutive zero-value bit is two octets in length. The
VINT_WIDTH MUST only contain zero-value bits or be empty. VINT_WIDTH MUST only contain zero-value bits or be empty.
Within the EBML Header the VINT_WIDTH of a VINT MUST NOT exceed three Within the EBML Header the VINT_WIDTH of a VINT MUST NOT exceed three
bits in length (meaning that the Variable Size Integer MUST NOT bits in length (meaning that the Variable Size Integer MUST NOT
exceed four octets in length) except if said VINT is used to express exceed four octets in length) except if said VINT is used to express
the Element Data Size of an EBML Element with Element Name EBML and the Element Data Size of an EBML Element with Element Name EBML and
Element ID "0x1A45DFA3" (see Section 11.2.1) in which case the Element ID "0x1A45DFA3" (see the definition of the EBML Element
VINT_WIDTH MUST NOT exceed seven bits in length. Within the EBML (#ebml-element)) in which case the VINT_WIDTH MUST NOT exceed seven
Body, when a VINT is used to express an Element ID, the maximum bits in length. Within the EBML Body, when a VINT is used to express
length allowed for the VINT_WIDTH is one less than the value set in an Element ID, the maximum length allowed for the VINT_WIDTH is one
the EBMLMaxIDLength Element. Within the EBML Body, when a VINT is less than the value set in the EBMLMaxIDLength Element. Within the
used to express an Element Data Size, the maximum length allowed for EBML Body, when a VINT is used to express an Element Data Size, the
the VINT_WIDTH is one less than the value set in the maximum length allowed for the VINT_WIDTH is one less than the value
EBMLMaxSizeLength Element. set in the EBMLMaxSizeLength Element.
4.2. VINT_MARKER 4.2. VINT_MARKER
The VINT_MARKER serves as a separator between the VINT_WIDTH and The VINT_MARKER serves as a separator between the VINT_WIDTH and
VINT_DATA. Each Variable Size Integer MUST contain exactly one VINT_DATA. Each Variable Size Integer MUST contain exactly one
VINT_MARKER. The VINT_MARKER is one bit in length and contain a bit VINT_MARKER. The VINT_MARKER is one bit in length and contain a bit
with a value of one. The first bit with a value of one within the with a value of one. The first bit with a value of one within the
Variable Size Integer is the VINT_MARKER. Variable Size Integer is the VINT_MARKER.
4.3. VINT_DATA 4.3. VINT_DATA
skipping to change at page 8, line 27 skipping to change at page 8, line 27
VINT_DATA value MUST be expressed as a big-endian unsigned integer. VINT_DATA value MUST be expressed as a big-endian unsigned integer.
4.4. VINT Examples 4.4. VINT Examples
This table shows examples of Variable Size Integers with lengths from This table shows examples of Variable Size Integers with lengths from
1 to 5 octets. The Usable Bits column refers to the number of bits 1 to 5 octets. The Usable Bits column refers to the number of bits
that can be used in the VINT_DATA. The Representation column depicts that can be used in the VINT_DATA. The Representation column depicts
a binary expression of Variable Size Integers where VINT_WIDTH is a binary expression of Variable Size Integers where VINT_WIDTH is
depicted by "0", the VINT_MARKER as "1", and the VINT_DATA as "x". depicted by "0", the VINT_MARKER as "1", and the VINT_DATA as "x".
+------------+------------+-----------------------------------------+ +--------------+-------------+-------------------------------+
| Octet | Usable | Representation | | Octet Length | Usable Bits | Representation |
| Length | Bits | | +==============+=============+===============================+
+------------+------------+-----------------------------------------+ | 1 | 7 | 1xxx xxxx |
| 1 | 7 | 1xxx xxxx | +--------------+-------------+-------------------------------+
| 2 | 14 | 01xx xxxx xxxx xxxx | | 2 | 14 | 01xx xxxx xxxx xxxx |
| 3 | 21 | 001x xxxx xxxx xxxx xxxx xxxx | +--------------+-------------+-------------------------------+
| 4 | 28 | 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx | | 3 | 21 | 001x xxxx xxxx xxxx xxxx xxxx |
| 5 | 35 | 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx | +--------------+-------------+-------------------------------+
| | | xxxx xxxx | | 4 | 28 | 0001 xxxx xxxx xxxx xxxx xxxx |
+------------+------------+-----------------------------------------+ | | | xxxx xxxx |
+--------------+-------------+-------------------------------+
| 5 | 35 | 0000 1xxx xxxx xxxx xxxx xxxx |
| | | xxxx xxxx xxxx xxxx |
+--------------+-------------+-------------------------------+
Table 1
Data encoded as a Variable Size Integer may be rendered at octet Data encoded as a Variable Size Integer may be rendered at octet
lengths larger than needed to store the data in order to facilitate lengths larger than needed to store the data in order to facilitate
overwriting it at a later date, e.g. when its final size isn't known overwriting it at a later date, e.g. when its final size isn't known
in advance. In this table a binary value of 0b10 is shown encoded as in advance. In this table a binary value of 0b10 is shown encoded as
different Variable Size Integers with lengths from one octet to four different Variable Size Integers with lengths from one octet to four
octets. All four encoded examples have identical semantic meaning octets. All four encoded examples have identical semantic meaning
though the VINT_WIDTH and the padding of the VINT_DATA vary. though the VINT_WIDTH and the padding of the VINT_DATA vary.
+--------------+--------------+-------------------------------------+ +--------------+--------------+-----------------------+
| Binary Value | Octet Length | As Represented in Variable Size | | Binary Value | Octet Length | As Represented in |
| | | Integer | | | | Variable Size Integer |
+--------------+--------------+-------------------------------------+ +==============+==============+=======================+
| 10 | 1 | 1000 0010 | | 10 | 1 | 1000 0010 |
| 10 | 2 | 0100 0000 0000 0010 | +--------------+--------------+-----------------------+
| 10 | 3 | 0010 0000 0000 0000 0000 0010 | | 10 | 2 | 0100 0000 0000 0010 |
| 10 | 4 | 0001 0000 0000 0000 0000 0000 0000 | +--------------+--------------+-----------------------+
| | | 0010 | | 10 | 3 | 0010 0000 0000 0000 |
+--------------+--------------+-------------------------------------+ | | | 0000 0010 |
+--------------+--------------+-----------------------+
| 10 | 4 | 0001 0000 0000 0000 |
| | | 0000 0000 0000 0010 |
+--------------+--------------+-----------------------+
Table 2
5. Element ID 5. Element ID
The Element ID is encoded as a Variable Size Integer. By default, The Element ID is encoded as a Variable Size Integer. By default,
Element IDs are encoded in lengths from one octet to four octets, Element IDs are encoded in lengths from one octet to four octets,
although Element IDs of greater lengths MAY be used if the although Element IDs of greater lengths MAY be used if the
EBMLMaxIDLength Element of the EBML Header is set to a value greater EBMLMaxIDLength Element of the EBML Header is set to a value greater
than four (see Section 11.2.4). The VINT_DATA component of the than four (see the section on the EBMLMaxIDLength Element
Element ID MUST NOT be either defined or written as either all zero (#ebmlmaxidlength-element)). The VINT_DATA component of the Element
values or all one values. Any Element ID with the VINT_DATA ID MUST NOT be either defined or written as either all zero values or
component set as all zero values or all one values MUST be ignored. all one values. Any Element ID with the VINT_DATA component set as
The VINT_DATA component of the Element ID MUST be encoded at the all zero values or all one values MUST be ignored. The VINT_DATA
shortest valid length. For example, an Element ID with binary component of the Element ID MUST be encoded at the shortest valid
encoding of "1011 1111" is valid, whereas an Element ID with binary length. For example, an Element ID with binary encoding of "1011
encoding of "0100 0000 0011 1111" stores a semantically equal 1111" is valid, whereas an Element ID with binary encoding of "0100
VINT_DATA but is invalid because a shorter VINT encoding is possible. 0000 0011 1111" stores a semantically equal VINT_DATA but is invalid
Additionally, an Element ID with binary encoding of "1111 1111" is because a shorter VINT encoding is possible. Additionally, an
invalid since the VINT_DATA section is set to all one values, whereas Element ID with binary encoding of "1111 1111" is invalid since the
an Element ID with binary encoding of "0100 0000 0111 1111" stores a VINT_DATA section is set to all one values, whereas an Element ID
semantically equal VINT_DATA and is the shortest possible VINT with binary encoding of "0100 0000 0111 1111" stores a semantically
encoding. equal VINT_DATA and is the shortest possible VINT encoding.
The following table details these specific examples further: The following table details these specific examples further:
+------------+-------------+----------------+-----------------------+ +------------+-------------+----------------+--------------------+
| VINT_WIDTH | VINT_MARKER | VINT_DATA | Element ID Status | | VINT_WIDTH | VINT_MARKER | VINT_DATA | Element ID Status |
+------------+-------------+----------------+-----------------------+ +============+=============+================+====================+
| | 1 | 0000000 | Invalid: VINT_DATA | | | 1 | 0000000 | Invalid: VINT_DATA |
| | | | MUST NOT be set to | | | | | MUST NOT be set to |
| | | | all 0 | | | | | all 0 |
| 0 | 1 | 00000000000000 | Invalid: VINT_DATA | +------------+-------------+----------------+--------------------+
| | | | MUST NOT be set to | | 0 | 1 | 00000000000000 | Invalid: VINT_DATA |
| | | | all 0 | | | | | MUST NOT be set to |
| | 1 | 0000001 | Valid | | | | | all 0 |
| 0 | 1 | 00000000000001 | Invalid: A shorter | +------------+-------------+----------------+--------------------+
| | | | VINT_DATA encoding is | | | 1 | 0000001 | Valid |
| | | | available. | +------------+-------------+----------------+--------------------+
| | 1 | 0111111 | Valid | | 0 | 1 | 00000000000001 | Invalid: A shorter |
| 0 | 1 | 00000000111111 | Invalid: A shorter | | | | | VINT_DATA encoding |
| | | | VINT_DATA encoding is | | | | | is available. |
| | | | available. | +------------+-------------+----------------+--------------------+
| | 1 | 1111111 | Invalid: VINT_DATA | | | 1 | 0111111 | Valid |
| | | | MUST NOT be set to | +------------+-------------+----------------+--------------------+
| | | | all 1 | | 0 | 1 | 00000000111111 | Invalid: A shorter |
| 0 | 1 | 00000001111111 | Valid | | | | | VINT_DATA encoding |
+------------+-------------+----------------+-----------------------+ | | | | is available. |
+------------+-------------+----------------+--------------------+
| | 1 | 1111111 | Invalid: VINT_DATA |
| | | | MUST NOT be set to |
| | | | all 1 |
+------------+-------------+----------------+--------------------+
| 0 | 1 | 00000001111111 | Valid |
+------------+-------------+----------------+--------------------+
Table 3
The octet length of an Element ID determines its EBML Class. The octet length of an Element ID determines its EBML Class.
+------------+--------+-------------------------+---------------+ +------------+--------+-------------------------+---------------+
| EBML Class | Length | Possible IDs | Number of IDs | | EBML Class | Length | Possible IDs | Number of IDs |
+------------+--------+-------------------------+---------------+ +============+========+=========================+===============+
| Class A | 1 | 0x81 - 0xFE | 126 | | Class A | 1 | 0x81 - 0xFE | 126 |
+------------+--------+-------------------------+---------------+
| Class B | 2 | 0x407F - 0x7FFE | 16,256 | | Class B | 2 | 0x407F - 0x7FFE | 16,256 |
+------------+--------+-------------------------+---------------+
| Class C | 3 | 0x203FFF - 0x3FFFFE | 2,080,768 | | Class C | 3 | 0x203FFF - 0x3FFFFE | 2,080,768 |
+------------+--------+-------------------------+---------------+
| Class D | 4 | 0x101FFFFF - 0x1FFFFFFE | 268,338,304 | | Class D | 4 | 0x101FFFFF - 0x1FFFFFFE | 268,338,304 |
+------------+--------+-------------------------+---------------+ +------------+--------+-------------------------+---------------+
Table 4
6. Element Data Size 6. Element Data Size
6.1. Data Size Format 6.1. Data Size Format
The Element Data Size expresses the length in octets of Element Data. The Element Data Size expresses the length in octets of Element Data.
The Element Data Size itself is encoded as a Variable Size Integer. The Element Data Size itself is encoded as a Variable Size Integer.
By default, Element Data Sizes can be encoded in lengths from one By default, Element Data Sizes can be encoded in lengths from one
octet to eight octets, although Element Data Sizes of greater lengths octet to eight octets, although Element Data Sizes of greater lengths
MAY be used if the octet length of the longest Element Data Size of MAY be used if the octet length of the longest Element Data Size of
the EBML Document is declared in the EBMLMaxSizeLength Element of the the EBML Document is declared in the EBMLMaxSizeLength Element of the
EBML Header (see Section 11.2.5). Unlike the VINT_DATA of the EBML Header (see the section on the EBMLMaxSizeLength Element
Element ID, the VINT_DATA component of the Element Data Size is not (#ebmlmaxsizelength-element)). Unlike the VINT_DATA of the Element
mandated to be encoded at the shortest valid length. For example, an ID, the VINT_DATA component of the Element Data Size is not mandated
Element Data Size with binary encoding of 1011 1111 or a binary to be encoded at the shortest valid length. For example, an Element
encoding of 0100 0000 0011 1111 are both valid Element Data Sizes and Data Size with binary encoding of 1011 1111 or a binary encoding of
both store a semantically equal value (both 0b00000000111111 and 0100 0000 0011 1111 are both valid Element Data Sizes and both store
0b0111111, the VINT_DATA sections of the examples, represent the a semantically equal value (both 0b00000000111111 and 0b0111111, the
integer 63). VINT_DATA sections of the examples, represent the integer 63).
Although an Element ID with all VINT_DATA bits set to zero is Although an Element ID with all VINT_DATA bits set to zero is
invalid, an Element Data Size with all VINT_DATA bits set to zero is invalid, an Element Data Size with all VINT_DATA bits set to zero is
allowed for EBML Element Types which do not mandate a non-zero length allowed for EBML Element Types which do not mandate a non-zero length
(see Section 7). An Element Data Size with all VINT_DATA bits set to (see the section on EBML Element Types (#ebml-element-types)). An
zero indicates that the Element Data is zero octets in length. Such Element Data Size with all VINT_DATA bits set to zero indicates that
an EBML Element is referred to as an Empty Element. If an Empty the Element Data is zero octets in length. Such an EBML Element is
Element has a default value declared then the EBML Reader MUST referred to as an Empty Element. If an Empty Element has a default
interpret the value of the Empty Element as the default value. If an value declared then the EBML Reader MUST interpret the value of the
Empty Element has no default value declared then the EBML Reader MUST Empty Element as the default value. If an Empty Element has no
use the value of the Empty Element for the corresponding EBML Element default value declared then the EBML Reader MUST use the value of the
Type of the Element ID, 0 for numbers and an empty string for Empty Element for the corresponding EBML Element Type of the Element
strings. ID, 0 for numbers and an empty string for strings.
6.2. Unknown Data Size 6.2. Unknown Data Size
An Element Data Size with all VINT_DATA bits set to one is reserved An Element Data Size with all VINT_DATA bits set to one is reserved
as an indicator that the size of the EBML Element is unknown. The as an indicator that the size of the EBML Element is unknown. The
only reserved value for the VINT_DATA of Element Data Size is all only reserved value for the VINT_DATA of Element Data Size is all
bits set to one. An EBML Element with an unknown Element Data Size bits set to one. An EBML Element with an unknown Element Data Size
is referred to as an Unknown-Sized Element. A Master Element MAY be is referred to as an Unknown-Sized Element. A Master Element MAY be
an Unknown-Sized Element; however an EBML Element that is not a an Unknown-Sized Element; however an EBML Element that is not a
Master Element MUST NOT be an Unknown-Sized Element. Master Elements Master Element MUST NOT be an Unknown-Sized Element. Master Elements
MUST NOT use an unknown size unless the unknownsizeallowed attribute MUST NOT use an unknown size unless the unknownsizeallowed attribute
of their EBML Schema is set to true (see Section 11.1.5.10). of their EBML Schema is set to true (see the section on the
unknownsizeallowed attribute (#unknownsizeallowed)).
The use of Unknown-Sized Elements allows for an EBML Element to be The use of Unknown-Sized Elements allows for an EBML Element to be
written and read before the size of the EBML Element is known. written and read before the size of the EBML Element is known.
Unknown-Sized Element MUST NOT be used or defined unnecessarily; Unknown-Sized Element MUST NOT be used or defined unnecessarily;
however if the Element Data Size is not known before the Element Data however if the Element Data Size is not known before the Element Data
is written, such as in some cases of data streaming, then Unknown- is written, such as in some cases of data streaming, then Unknown-
Sized Elements MAY be used. The end of an Unknown-Sized Element is Sized Elements MAY be used. The end of an Unknown-Sized Element is
determined by whichever comes first: determined by whichever comes first:
o Any EBML Element that is a valid Parent Element of the Unknown- * Any EBML Element that is a valid Parent Element of the Unknown-
Sized Element according to the EBML Schema, Section 11.3 excluded. Sized Element according to the EBML Schema, Global Elements
(#global-elements) excluded.
o Any valid EBML Element according to the EBML Schema, Section 11.3 * Any valid EBML Element according to the EBML Schema, Global
excluded, that is not a Descendant Element of the Unknown-Sized Elements (#global-elements) excluded, that is not a Descendant
Element but share a common direct parent, such as a Top-Level Element of the Unknown-Sized Element but share a common direct
Element. parent, such as a Top-Level Element.
o Any EBML Element that is a valid Root Element according to the * Any EBML Element that is a valid Root Element according to the
EBML Schema, Section 11.3 excluded. EBML Schema, Global Elements (#global-elements) excluded.
o The end of the Parent Element with a known size has been reached. * The end of the Parent Element with a known size has been reached.
o The end of the EBML Document, either when reaching the end of the * The end of the EBML Document, either when reaching the end of the
file or because a new EBML Header started. file or because a new EBML Header started.
Consider an Unknown-Sized Element which EBML path is Consider an Unknown-Sized Element which EBML path is
"\root\level1\level2\elt". When reading a new Element ID, assuming "\root\level1\level2\elt". When reading a new Element ID, assuming
the EBML Path of that new Element is valid, here are some possible the EBML Path of that new Element is valid, here are some possible
and impossible ways that this new Element is ending "elt": and impossible ways that this new Element is ending "elt":
+------------------------------------+------------------------------+ +------------------------------------+----------------------------+
| EBML Path of new element | Status | | EBML Path of new element | Status |
+------------------------------------+------------------------------+ +====================================+============================+
| "\root\level1\level2" | Ends the Unknown-Sized | | "\root\level1\level2" | Ends the Unknown-Sized |
| | Element, as it is a new | | | Element, as it is a new |
| | Parent Element | | | Parent Element |
| "\root\level1" | Ends the Unknown-Sized | +------------------------------------+----------------------------+
| | Element, as it is a new | | "\root\level1" | Ends the Unknown-Sized |
| | Parent Element | | | Element, as it is a new |
| "\root" | Ends the Unknown-Sized | | | Parent Element |
| | Element, as it is a new Root | +------------------------------------+----------------------------+
| | Element | | "\root" | Ends the Unknown-Sized |
| "\root2" | Ends the Unknown-Sized | | | Element, as it is a new |
| | Element, as it is a new Root | | | Root Element |
| | Element | +------------------------------------+----------------------------+
| "\root\level1\level2\other" | Ends the Unknown-Sized | | "\root2" | Ends the Unknown-Sized |
| | Element, as they share the | | | Element, as it is a new |
| | same parent | | | Root Element |
| "\root\level1\level2\elt" | Ends the Unknown-Sized | +------------------------------------+----------------------------+
| | Element, as they share the | | "\root\level1\level2\other" | Ends the Unknown-Sized |
| | same parent | | | Element, as they share the |
| "\root\level1\level2\elt\inside" | Doesn't end the Unknown- | | | same parent |
| | Sized Element, it's a child | +------------------------------------+----------------------------+
| | of "elt" | | "\root\level1\level2\elt" | Ends the Unknown-Sized |
| "\root\level1\level2\elt\<global>" | Global Element is valid, | | | Element, as they share the |
| | it's a child of "elt" | | | same parent |
| "\root\level1\level2\<global>" | Global Element cannot be | +------------------------------------+----------------------------+
| | assumed to have this path, | | "\root\level1\level2\elt\inside" | Doesn't end the Unknown- |
| | while parsing "elt" it can | | | Sized Element, it's a |
| | only be a child of "elt" | | | child of "elt" |
+------------------------------------+------------------------------+ +------------------------------------+----------------------------+
| "\root\level1\level2\elt\<global>" | Global Element is valid, |
| | it's a child of "elt" |
+------------------------------------+----------------------------+
| "\root\level1\level2\<global>" | Global Element cannot be |
| | assumed to have this path, |
| | while parsing "elt" it can |
| | only be a child of "elt" |
+------------------------------------+----------------------------+
Table 5
6.3. Data Size Values 6.3. Data Size Values
For Element Data Sizes encoded at octet lengths from one to eight, For Element Data Sizes encoded at octet lengths from one to eight,
this table depicts the range of possible values that can be encoded this table depicts the range of possible values that can be encoded
as an Element Data Size. An Element Data Size with an octet length as an Element Data Size. An Element Data Size with an octet length
of 8 is able to express a size of 2^56-2 or 72,057,594,037,927,934 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 octets (or about 72 petabytes). The maximum possible value that can
be stored as Element Data Size is referred to as VINTMAX. be stored as Element Data Size is referred to as VINTMAX.
+--------------+----------------------+ +--------------+----------------------+
| Octet Length | Possible Value Range | | Octet Length | Possible Value Range |
+==============+======================+
| 1 | 0 to 2^(7-2) |
+--------------+----------------------+ +--------------+----------------------+
| 1 | 0 to 2^7-2 | | 2 | 0 to 2^(14-2) |
| 2 | 0 to 2^14-2 | +--------------+----------------------+
| 3 | 0 to 2^21-2 | | 3 | 0 to 2^(21-2) |
| 4 | 0 to 2^28-2 | +--------------+----------------------+
| 5 | 0 to 2^35-2 | | 4 | 0 to 2^(28-2) |
| 6 | 0 to 2^42-2 | +--------------+----------------------+
| 7 | 0 to 2^49-2 | | 5 | 0 to 2^(35-2) |
| 8 | 0 to 2^56-2 | +--------------+----------------------+
| 6 | 0 to 2^(42-2) |
+--------------+----------------------+
| 7 | 0 to 2^(49-2) |
+--------------+----------------------+
| 8 | 0 to 2^(56-2) |
+--------------+----------------------+ +--------------+----------------------+
Table 6
If the length of Element Data equals 2^(n*7)-1 then the octet length If the length of Element Data equals 2^(n*7)-1 then the octet length
of the Element Data Size MUST be at least n+1. This rule prevents an of the Element Data Size MUST be at least n+1. This rule prevents an
Element Data Size from being expressed as the unknown size value. Element Data Size from being expressed as the unknown size value.
The following table clarifies this rule by showing a valid and The following table clarifies this rule by showing a valid and
invalid expression of an Element Data Size with a VINT_DATA of 127 invalid expression of an Element Data Size with a VINT_DATA of 127
(which is equal to 2^(1*7)-1) and 16,383 (which is equal to 2^(2*7)- (which is equal to 2^(1*7)-1) and 16,383 (which is equal to 2^((2*7)-
1). 1).)
+------------+-------------+-----------------------+--------------+
| VINT_WIDTH | VINT_MARKER | VINT_DATA | Element Data |
| | | | Size Status |
+============+=============+=======================+==============+
| | 1 | 1111111 | Reserved |
| | | | (meaning |
| | | | Unknown) |
+------------+-------------+-----------------------+--------------+
| 0 | 1 | 00000001111111 | Valid |
| | | | (meaning 127 |
| | | | octets) |
+------------+-------------+-----------------------+--------------+
| 00 | 1 | 000000000000001111111 | Valid |
| | | | (meaning 127 |
| | | | octets) |
+------------+-------------+-----------------------+--------------+
| 0 | 1 | 11111111111111 | Reserved |
| | | | (meaning |
| | | | Unknown) |
+------------+-------------+-----------------------+--------------+
| 00 | 1 | 000000011111111111111 | Valid |
| | | | (16,383 |
| | | | octets) |
+------------+-------------+-----------------------+--------------+
+------------+-------------+-----------------------+----------------+ Table 7
| VINT_WIDTH | VINT_MARKER | VINT_DATA | Element Data |
| | | | Size Status |
+------------+-------------+-----------------------+----------------+
| | 1 | 1111111 | Reserved |
| | | | (meaning |
| | | | Unknown) |
| 0 | 1 | 00000001111111 | Valid (meaning |
| | | | 127 octets) |
| 00 | 1 | 000000000000001111111 | Valid (meaning |
| | | | 127 octets) |
| 0 | 1 | 11111111111111 | Reserved |
| | | | (meaning |
| | | | Unknown) |
| 00 | 1 | 000000011111111111111 | Valid (16,383 |
| | | | octets) |
+------------+-------------+-----------------------+----------------+
7. EBML Element Types 7. EBML Element Types
EBML Elements are defined by an EBML Schema (see Section 11.1) which EBML Elements are defined by an EBML Schema (see Section 11.1) which
MUST declare one of the following EBML Element Types for each EBML MUST declare one of the following EBML Element Types for each EBML
Element. An EBML Element Type defines a concept of storing data Element. An EBML Element Type defines a concept of storing data
within an EBML Element that describes such characteristics as length, within an EBML Element that describes such characteristics as length,
endianness, and definition. endianness, and definition.
EBML Elements which are defined as a Signed Integer Element, Unsigned EBML Elements which are defined as a Signed Integer Element, Unsigned
skipping to change at page 15, line 14 skipping to change at page 16, line 42
7.4. String Element 7.4. String Element
A String Element MUST declare a length in octets from zero to A String Element MUST declare a length in octets from zero to
VINTMAX. If the EBML Element is not defined to have a default value, VINTMAX. If the EBML Element is not defined to have a default value,
then a String Element with a zero-octet length represents an empty then a String Element with a zero-octet length represents an empty
string. string.
A String Element MUST either be empty (zero-length) or contain A String Element MUST either be empty (zero-length) or contain
printable ASCII characters [RFC0020] in the range of 0x20 to 0x7E, printable ASCII characters [RFC0020] in the range of 0x20 to 0x7E,
with an exception made for termination (see Section 13). with an exception made for termination (see the section on the
Terminating Elements (#terminating-elements)).
7.5. UTF-8 Element 7.5. UTF-8 Element
A UTF-8 Element MUST declare a length in octets from zero to VINTMAX. A UTF-8 Element MUST declare a length in octets from zero to VINTMAX.
If the EBML Element is not defined to have a default value, then a If the EBML Element is not defined to have a default value, then a
UTF-8 Element with a zero-octet length represents an empty string. UTF-8 Element with a zero-octet length represents an empty string.
A UTF-8 Element contains only a valid Unicode string as defined in A UTF-8 Element contains only a valid Unicode string as defined in
[RFC3629], with an exception made for termination (see Section 13). [RFC3629], with an exception made for termination (see the section on
the Terminating Elements (#terminating-elements)).
7.6. Date Element 7.6. Date Element
A Date Element MUST declare a length of either zero octets or eight A Date Element MUST declare a length of either zero octets or eight
octets. If the EBML Element is not defined to have a default value, octets. If the EBML Element is not defined to have a default value,
then a Date Element with a zero-octet length represents a timestamp then a Date Element with a zero-octet length represents a timestamp
of 2001-01-01T00:00:00.000000000 UTC [RFC3339]. of 2001-01-01T00:00:00.000000000 UTC [RFC3339].
The Date Element stores an integer in the same format as the Signed The Date Element stores an integer in the same format as the Signed
Integer Element that expresses a point in time referenced in Integer Element that expresses a point in time referenced in
nanoseconds from the precise beginning of the third millennium of the nanoseconds from the precise beginning of the third millennium of the
Gregorian Calendar in Coordinated Universal Time (also known as Gregorian Calendar in Coordinated Universal Time (also known as
2001-01-01T00:00:00.000000000 UTC). This provides a possible 2001-01-01T00:00:00.000000000 UTC). This provides a possible
expression of time from 1708-09-11T00:12:44.854775808 UTC to expression of time from 1708-09-11T00:12:44.854775808 UTC to
2293-04-11T11:47:16.854775807 UTC. 2293-04-11T11:47:16.854775807 UTC.
7.7. Master Element 7.7. Master Element
A Master Element MUST declare a length in octets from zero to A Master Element MUST declare a length in octets from zero to
VINTMAX. The Master Element MAY also use an unknown length. See VINTMAX. The Master Element MAY also use an unknown length. See the
Section 6 for rules that apply to elements of unknown length. section on Element Data Size (#element-data-size) for rules that
apply to elements of unknown length.
The Master Element contains zero, one, or many other elements. EBML The Master Element contains zero, one, or many other elements. EBML
Elements contained within a Master Element MUST have the Elements contained within a Master Element MUST have the
EBMLParentPath of their Element Path equal to the EBMLMasterPath of EBMLParentPath of their Element Path equal to the EBMLMasterPath of
the Master Element Element Path (see Section 11.1.5.2). Element Data the Master Element Element Path (see the section on the EBML Path
stored within Master Elements SHOULD only consist of EBML Elements (#path)). Element Data stored within Master Elements SHOULD only
and SHOULD NOT contain any data that is not part of an EBML Element. consist of EBML Elements and SHOULD NOT contain any data that is not
The EBML Schema identifies what Element IDs are valid within the part of an EBML Element. The EBML Schema identifies what Element IDs
Master Elements for that version of the EBML Document Type. Any data are valid within the Master Elements for that version of the EBML
contained within a Master Element that is not part of a Child Element Document Type. Any data contained within a Master Element that is
MUST be ignored. not part of a Child Element MUST be ignored.
7.8. Binary Element 7.8. Binary Element
A Binary Element MUST declare a length in octets from zero to A Binary Element MUST declare a length in octets from zero to
VINTMAX. VINTMAX.
The contents of a Binary Element should not be interpreted by the The contents of a Binary Element should not be interpreted by the
EBML Reader. EBML Reader.
8. EBML Document 8. EBML Document
skipping to change at page 16, line 39 skipping to change at page 18, line 28
Document. Document.
The EBML Header documents the EBML Schema (also known as the EBML The EBML Header documents the EBML Schema (also known as the EBML
DocType) that is used to semantically interpret the structure and DocType) that is used to semantically interpret the structure and
meaning of the EBML Document. Additionally the EBML Header documents meaning of the EBML Document. Additionally the EBML Header documents
the versions of both EBML and the EBML Schema that were used to write the versions of both EBML and the EBML Schema that were used to write
the EBML Document and the versions required to read the EBML the EBML Document and the versions required to read the EBML
Document. Document.
The EBML Header MUST contain a single Master Element with an Element The EBML Header MUST contain a single Master Element with an Element
Name of EBML and Element ID of 0x1A45DFA3 (see Section 11.2.1) and Name of EBML and Element ID of 0x1A45DFA3 (see the definition of the
any number of additional EBML Elements within it. The EBML Header of EBML Element (#ebml-element)) and any number of additional EBML
an EBML Document that uses an EBMLVersion of 1 MUST only contain EBML Elements within it. The EBML Header of an EBML Document that uses an
Elements that are defined as part of this document. EBMLVersion of 1 MUST only contain EBML Elements that are defined as
part of this document.
8.2. EBML Body 8.2. EBML Body
All data of an EBML Document following the EBML Header is the EBML All data of an EBML Document following the EBML Header is the EBML
Body. The end of the EBML Body, as well as the end of the EBML Body. The end of the EBML Body, as well as the end of the EBML
Document that contains the EBML Body, is reached at whichever comes Document that contains the EBML Body, is reached at whichever comes
first: the beginning of a new EBML Header at the Root Level or the first: the beginning of a new EBML Header at the Root Level or the
end of the file. The EBML Body MUST NOT contain any data that is not end of the file. The EBML Body MUST NOT contain any data that is not
part of an EBML Element. This document defines precisely which EBML part of an EBML Element. This document defines precisely which EBML
Elements are to be used within the EBML Header, but does not name or Elements are to be used within the EBML Header, but does not name or
skipping to change at page 17, line 48 skipping to change at page 19, line 38
11.1. EBML Schema 11.1. EBML Schema
An EBML Schema is a well-formed XML Document [W3C.REC-xml-20081126] An EBML Schema is a well-formed XML Document [W3C.REC-xml-20081126]
that defines the properties, arrangement, and usage of EBML Elements that defines the properties, arrangement, and usage of EBML Elements
that compose a specific EBML Document Type. The relationship of an that compose a specific EBML Document Type. The relationship of an
EBML Schema to an EBML Document is analogous to the relationship of EBML Schema to an EBML Document is analogous to the relationship of
an XML Schema [W3C.REC-xmlschema-0-20041028] to an XML Document an XML Schema [W3C.REC-xmlschema-0-20041028] to an XML Document
[W3C.REC-xml-20081126]. An EBML Schema MUST be clearly associated [W3C.REC-xml-20081126]. An EBML Schema MUST be clearly associated
with one or more EBML Document Types. An EBML Document Type is with one or more EBML Document Types. An EBML Document Type is
identified by a string stored within the EBML Header in the DocType identified by a string stored within the EBML Header in the DocType
Element; for example matroska or webm (see Section 11.2.6). The Element; for example matroska or webm (see the definition of the
DocType value for an EBML Document Type MUST be unique and DocType Element (#doctype-element)). The DocType value for an EBML
persistent. Document Type MUST be unique and persistent.
An EBML Schema MUST declare exactly one EBML Element at Root Level An EBML Schema MUST declare exactly one EBML Element at Root Level
(referred to as the Root Element) that occurs exactly once within an (referred to as the Root Element) that occurs exactly once within an
EBML Document. The Void Element MAY also occur at Root Level but is EBML Document. The Void Element MAY also occur at Root Level but is
not a Root Element (see Section 11.3.2). not a Root Element (see the definition of the Void Element (#void-
element)).
The EBML Schema MUST document all Elements of the EBML Body. The The EBML Schema MUST document all Elements of the EBML Body. The
EBML Schema does not document Global Elements that are defined by EBML Schema does not document Global Elements (#global-elements) that
this document (namely the Void Element and the CRC-32 Element). are defined by this document (namely the Void Element and the CRC-32
Element).
The EBML Schema MUST NOT use the Element ID "0x1A45DFA3" which is The EBML Schema MUST NOT use the Element ID "0x1A45DFA3" which is
reserved for the EBML Header for resynchronization purpose. reserved for the EBML Header for resynchronization purpose.
An EBML Schema MAY constrain the use of EBML Header Elements (see An EBML Schema MAY constrain the use of EBML Header Elements (see
Section 11.2) by adding or constraining that Element's "range" EBML Header Elements (#ebml-header-elements)) by adding or
attribute. For example, an EBML Schema MAY constrain the constraining that Element's "range" attribute. For example, an EBML
EBMLMaxSizeLength to a maximum value of "8" or MAY constrain the Schema MAY constrain the EBMLMaxSizeLength to a maximum value of "8"
EBMLVersion to only support a value of "1". If an EBML Schema adopts or MAY constrain the EBMLVersion to only support a value of "1". If
the EBML Header Element as-is, then it is not required to document an EBML Schema adopts the EBML Header Element as-is, then it is not
that Element within the EBML Schema. If an EBML Schema constrains required to document that Element within the EBML Schema. If an EBML
the range of an EBML Header Element, then that Element MUST be Schema constrains the range of an EBML Header Element, then that
documented within an "<element>" node of the EBML Schema. This Element MUST be documented within an "<element>" node of the EBML
document provides an example of an EBML Schema, see Section 11.1.1. Schema. This document provides an example of an EBML Schema, see
EBML Schema Example (#ebml-schema-example).
11.1.1. EBML Schema Example 11.1.1. EBML Schema Example
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?> <EBMLSchema xmlns="https://ietf.org/cellar/ebml" docType="files-in-ebml-demo" version="1"> <!-- constraints to the range of two EBML Header Elements --> <element name="EBMLReadVersion" path="1*1(\EBML\EBMLReadVersion)" id="0x42F7" minOccurs="1" maxOccurs="1" range="1" default="1" type="uinteger"/> <element name="EBMLMaxSizeLength" path="1*1(\EBML\EBMLMaxSizeLength)" id="0x42F3" minOccurs="1" maxOccurs="1" range="8" default="8" type="uinteger"/> <!-- Root Element--> <element name="Files" path="*1(\Files)" id="0x1946696C" type="master"> <documentation lang="en" purpose="definition">Container of data and attributes representing one or many files.</documentation> </element> <element name="File" path="1*(\Files\File)" id="0x6146" type="master" minOccurs="1"> <documentation lang="en" purpose="definition"> An attached file. </documentation> </element> <element name="FileName" path="1*1(\Files\File\FileName)" id="0x614E" type="utf-8" minOccurs="1"> <documentation lang="en" purpose="definition"> Filename of the attached file. </documentation> </element> <element name="MimeType" path="1*1(\Files\File\MimeType)" id="0x464D" type="string" minOccurs="1"> <documentation lang="en" purpose="definition"> MIME type of the file. </documentation> </element> <element name="ModificationTimestamp" path="1*1(\Files\File\ModificationTimestamp)" id="0x4654" type="date" minOccurs="1"> <documentation lang="en" purpose="definition"> Modification timestamp of the file. </documentation> </element> <element name="Data" path="1*1(\Files\File\Data)" id="0x4664" type="binary" minOccurs="1"> <documentation lang="en" purpose="definition"> The data of the file. </documentation> </element> </EBMLSchema>
<EBMLSchema xmlns="https://ietf.org/cellar/ebml"
docType="files-in-ebml-demo" version="1">
<!-- constraints to the range of two EBML Header Elements -->
<element name="EBMLReadVersion" path="1*1(\EBML\EBMLReadVersion)"
id="0x42F7" minOccurs="1" maxOccurs="1" range="1" default="1"
type="uinteger"/>
<element name="EBMLMaxSizeLength" path="1*1(\EBML\EBMLMaxSizeLength)"
id="0x42F3" minOccurs="1" maxOccurs="1" range="8" default="8"
type="uinteger"/>
<!-- Root Element-->
<element name="Files" path="*1(\Files)" id="0x1946696C" type="master">
<documentation lang="en" purpose="definition">Container of data and
attributes representing one or many files.</documentation>
</element>
<element name="File" path="1*(\Files\File)" id="0x6146" type="master"
minOccurs="1">
<documentation lang="en" purpose="definition">
An attached file.
</documentation>
</element>
<element name="FileName" path="1*1(\Files\File\FileName)"
id="0x614E" type="utf-8"
minOccurs="1">
<documentation lang="en" purpose="definition">
Filename of the attached file.
</documentation>
</element>
<element name="MimeType" path="1*1(\Files\File\MimeType)"
id="0x464D" type="string"
minOccurs="1">
<documentation lang="en" purpose="definition">
MIME type of the file.
</documentation>
</element>
<element name="ModificationTimestamp"
path="1*1(\Files\File\ModificationTimestamp)" id="0x4654"
type="date" minOccurs="1">
<documentation lang="en" purpose="definition">
Modification timestamp of the file.
</documentation>
</element>
<element name="Data" path="1*1(\Files\File\Data)" id="0x4664"
type="binary" minOccurs="1">
<documentation lang="en" purpose="definition">
The data of the file.
</documentation>
</element>
</EBMLSchema>
11.1.2. <EBMLSchema> Element 11.1.2. <EBMLSchema> Element
As an XML Document, the EBML Schema MUST use "<EBMLSchema>" as the As an XML Document, the EBML Schema MUST use "<EBMLSchema>" as the
top level element. The "<EBMLSchema>" element can contain top level element. The "<EBMLSchema>" element can contain
"<element>" sub-elements. "<element>" sub-elements.
11.1.3. <EBMLSchema> Attributes 11.1.3. <EBMLSchema> Attributes
Within an EBML Schema the "<EBMLSchema>" element uses the following Within an EBML Schema the "<EBMLSchema>" element uses the following
skipping to change at page 20, line 19 skipping to change at page 21, line 8
EBML Schema documents all versions of a docType's definition rather EBML Schema documents all versions of a docType's definition rather
than using separate EBML Schemas for each version of a docType. EBML than using separate EBML Schemas for each version of a docType. EBML
Elements may be introduced and deprecated by using the minver and Elements may be introduced and deprecated by using the minver and
maxver attributes of "<element>". maxver attributes of "<element>".
The version attribute is REQUIRED within the "<EBMLSchema>" Element. The version attribute is REQUIRED within the "<EBMLSchema>" Element.
11.1.4. <element> Element 11.1.4. <element> Element
Each "<element>" defines one EBML Element through the use of several Each "<element>" defines one EBML Element through the use of several
attributes that are defined in Section 11.1.3. EBML Schemas MAY attributes that are defined in EBML Schema Element Attributes
contain additional attributes to extend the semantics but MUST NOT (#ebmlschema-attributes). EBML Schemas MAY contain additional
conflict with the definitions of the "<element>" attributes defined attributes to extend the semantics but MUST NOT conflict with the
within this document. definitions of the "<element>" attributes defined within this
document.
The "<element>" nodes contain a description of the meaning and use of The "<element>" nodes contain a description of the meaning and use of
the EBML Element stored within one or more "<documentation>" sub- the EBML Element stored within one or more "<documentation>" sub-
elements, followed by optional "<implementation_note>" sub-elements, elements, followed by optional "<implementation_note>" sub-elements,
followed by zero or one "<restriction>" sub-element, followed by followed by zero or one "<restriction>" sub-element, followed by
optional "<extension>" sub-elements. All "<element>" nodes MUST be optional "<extension>" sub-elements. All "<element>" nodes MUST be
sub-elements of the "<EBMLSchema>". sub-elements of the "<EBMLSchema>".
11.1.5. <element> Attributes 11.1.5. <element> Attributes
skipping to change at page 21, line 7 skipping to change at page 22, line 5
The path defines the allowed storage locations of the EBML Element The path defines the allowed storage locations of the EBML Element
within an EBML Document. This path MUST be defined with the full within an EBML Document. This path MUST be defined with the full
hierarchy of EBML Elements separated with a "\". The top EBML hierarchy of EBML Elements separated with a "\". The top EBML
Element in the path hierarchy being the first in the value. The Element in the path hierarchy being the first in the value. The
syntax of the path attribute is defined using this Augmented Backus- syntax of the path attribute is defined using this Augmented Backus-
Naur Form (ABNF) [RFC5234] with the case sensitive update [RFC7405] Naur Form (ABNF) [RFC5234] with the case sensitive update [RFC7405]
notation: notation:
The path attribute is REQUIRED. The path attribute is REQUIRED.
EBMLFullPath = EBMLElementOccurrence "(" EBMLMasterPath ")" EBMLFullPath = EBMLEltOccurrence "(" EBMLMasterPath ")"
EBMLMasterPath = [EBMLParentPath] EBMLElementPath EBMLMasterPath = [EBMLParentPath] EBMLElementPath
EBMLParentPath = EBMLFixedParent EBMLLastParent EBMLParentPath = EBMLFixedParent EBMLLastParent
EBMLFixedParent = *(EBMLPathAtom) EBMLFixedParent = *(EBMLPathAtom)
EBMLElementPath = EBMLPathAtom / EBMLPathAtomRecursive EBMLElementPath = EBMLPathAtom / EBMLPathAtomRecursive
EBMLPathAtom = PathDelimiter EBMLAtomName EBMLPathAtom = PathDelimiter EBMLAtomName
EBMLPathAtomRecursive = "(1*(" EBMLPathAtom "))" EBMLPathAtomRecursive = "(1*(" EBMLPathAtom "))"
EBMLLastParent = EBMLPathAtom / EBMLVariableParent EBMLLastParent = EBMLPathAtom / EBMLGlobalParent
EBMLVariableParent = "(" VariableParentOccurrence "\)" EBMLGlobalParent = "(" GlobalParentOccurence "\)"
EBMLAtomName = 1*(EBMLNameChar) EBMLAtomName = 1*(EBMLNameChar)
EBMLNameChar = ALPHA / DIGIT / "-" / "." EBMLNameChar = ALPHA / DIGIT / "-" / "."
PathDelimiter = "\" PathDelimiter = "\"
EBMLElementOccurrence = [EBMLMinOccurrence] "*" [EBMLMaxOccurrence] EBMLEltOccurrence = [EBMLMinOccurrence] "*" [EBMLMaxOccurrence]
EBMLMinOccurrence = 1*DIGIT ; no upper limit EBMLMinOccurrence = 1*DIGIT ; no upper limit
EBMLMaxOccurrence = 1*DIGIT ; no upper limit EBMLMaxOccurrence = 1*DIGIT ; no upper limit
VariableParentOccurrence = [PathMinOccurrence] "*" [PathMaxOccurrence] GlobalParentOccurence = [PathMinOccurrence] "*" [PathMaxOccurrence]
PathMinOccurrence = 1*DIGIT ; no upper limit PathMinOccurrence = 1*DIGIT ; no upper limit
PathMaxOccurrence = 1*DIGIT ; no upper limit PathMaxOccurrence = 1*DIGIT ; no upper limit
The "*", "(" and ")" symbols are interpreted as defined in [RFC5234]. The "*", "(" and ")" symbols are interpreted as defined in [RFC5234].
The EBMLPathAtom part of the EBMLElementPath MUST be equal to the The EBMLPathAtom part of the EBMLElementPath MUST be equal to the
name attribute of the EBML Schema. name attribute of the EBML Schema.
The starting PathDelimiter of the path corresponds to the root of the The starting PathDelimiter of the path corresponds to the root of the
EBML Document. EBML Document.
The EBMLElementOccurrence part is interpreted as an ABNF Variable The EBMLEltOccurrence part is interpreted as an ABNF Variable
Repetition. The repetition amounts correspond to how many times the Repetition. The repetition amounts correspond to how many times the
EBML Element can be found in its Parent Element. EBML Element can be found in its Parent Element.
The EBMLMinOccurrence represents the minimum permitted number of The EBMLMinOccurrence represents the minimum permitted number of
occurrences of this EBML Element within its Parent Element. Each occurrences of this EBML Element within its Parent Element. Each
instance of the Parent Element MUST contain at least this many instance of the Parent Element MUST contain at least this many
instances of this EBML Element. If the EBML Element has an empty instances of this EBML Element. If the EBML Element has an empty
EBMLParentPath then EBMLMinOccurrence refers to constraints on the EBMLParentPath then EBMLMinOccurrence refers to constraints on the
occurrence of the EBML Element within the EBML Document. If occurrence of the EBML Element within the EBML Document. If
EBMLMinOccurrence is not present then that EBML Element has an EBMLMinOccurrence is not present then that EBML Element has an
EBMLMinOccurrence value of 0. The semantic meaning of EBMLMinOccurrence value of 0. The semantic meaning of
EBMLMinOccurrence within an EBML Schema is analogous to the meaning EBMLMinOccurrence within an EBML Schema is analogous to the meaning
of minOccurs within an XML Schema. EBML Elements with of minOccurs within an XML Schema. EBML Elements with
EBMLMinOccurrence set to "1" that also have a default value (see EBMLMinOccurrence set to "1" that also have a default value (see
Section 11.1.5.8) declared are not REQUIRED to be stored but are default (#default)) declared are not REQUIRED to be stored but are
REQUIRED to be interpreted, see Section 11.1.18. An EBML Element REQUIRED to be interpreted, see Note on the Use of default attributes
to define Mandatory EBML Elements (#note-on-the-use-of-default-
attributes-to-define-mandatory-ebml-elements). An EBML Element
defined with a EBMLMinOccurrence value greater than zero is called a defined with a EBMLMinOccurrence value greater than zero is called a
Mandatory EBML Element. Mandatory EBML Element.
The EBMLMaxOccurrence represents the maximum permitted number of The EBMLMaxOccurrence represents the maximum permitted number of
occurrences of this EBML Element within its Parent Element. Each occurrences of this EBML Element within its Parent Element. Each
instance of the Parent Element MUST contain at most this many instance of the Parent Element MUST contain at most this many
instances of this EBML Element. If the EBML Element has an empty instances of this EBML Element. If the EBML Element has an empty
EBMLParentPath then EBMLMaxOccurrence refers to constraints on the EBMLParentPath then EBMLMaxOccurrence refers to constraints on the
occurrence of the EBML Element within the EBML Document. If occurrence of the EBML Element within the EBML Document. If
EBMLMaxOccurrence is not present then there is no upper bound for the EBMLMaxOccurrence is not present then there is no upper bound for the
permitted number of occurrences of this EBML Element within its permitted number of occurrences of this EBML Element within its
Parent Element resp. within the EBML Document depending on whether Parent Element resp. within the EBML Document depending on whether
the EBMLParentPath of the EBML Element is empty or not. The semantic the EBMLParentPath of the EBML Element is empty or not. The semantic
meaning of EBMLMaxOccurrence within an EBML Schema path is analogous meaning of EBMLMaxOccurrence within an EBML Schema path is analogous
to the meaning of maxOccurs within an XML Schema. to the meaning of maxOccurs within an XML Schema.
The VariableParentOccurrence part is interpreted as an ABNF Variable In some cases the EBMLLastParent part of the path is an
EBMLGlobalParent. A path with a EBMLGlobalParent defines a Global
Element (#global-elements). Any path that starts with the
EBMLFixedParent of the Global Element and matches the occurrences
found in the GlobalParentOccurence is a valid path for the Global
Element.
The GlobalParentOccurence part is interpreted as an ABNF Variable
Repetition. The repetition amounts correspond to the amount of Repetition. The repetition amounts correspond to the amount of
unspecified Parent Element levels there can be between the unspecified Parent Element levels there can be between the
EBMLFixedParent and the actual EBMLElementPath. EBMLFixedParent and the actual EBMLElementPath.
PathMinOccurrence represents the minimum number of element path
required between the EBMLFixedParent and the Global Element
EBMLElementPath. For example 0 means the EBMLElementPath can be
right after the EBMLFixedParent, 1 means there has to be at least an
element between the EBMLFixedParent and the EBMLElementPath. If
PathMinOccurrence is not present then that EBML Element has an
PathMinOccurrence value of 0.
PathMaxOccurrence represents the maximum number of element path
possible between the EBMLFixedParent and the Global Element
EBMLElementPath. It cannot have the value 0 as it would be the
Global Element can only be found right after the EBMLFixedParent, in
which case it's not a Global Element anymore. If PathMaxOccurrence
is not present then there is no upper bound for the permitted number
of occurrences of element path possible between the EBMLFixedParent
and the Global Element EBMLElementPath.
If the path contains an EBMLPathAtomRecursive part, the EBML Element If the path contains an EBMLPathAtomRecursive part, the EBML Element
can occur within itself recursively (see the Section 11.1.5.11). can occur within itself recursively (see the recursive attribute
(#recursive)).
As an example, a "path" of "1*(\Segment\Info)" means the element Info As an example, a "path" of "1*(\Segment\Info)" means the element Info
is found inside the Segment elements at least once and with no is found inside the Segment elements at least once and with no
maximum iteration. An element SeekHead with path maximum iteration. An element SeekHead with path
"0*2(\Segment\SeekHead)" may not be found at all in its Segment "0*2(\Segment\SeekHead)" may not be found at all in its Segment
parent, once or twice but no more than that. parent, once or twice but no more than that.
11.1.5.3. id 11.1.5.3. id
The Element ID encoded as a Variable Size Integer expressed in The Element ID encoded as a Variable Size Integer expressed in
skipping to change at page 23, line 23 skipping to change at page 24, line 47
The maxOccurs attribute is OPTIONAL. If the maxOccurs attribute is The maxOccurs attribute is OPTIONAL. If the maxOccurs attribute is
not present then that EBML Element has no maximum occurrence, similar not present then that EBML Element has no maximum occurrence, similar
to unbounded in the XML world. to unbounded in the XML world.
11.1.5.6. range 11.1.5.6. range
A numerical range for EBML Elements which are of numerical types A numerical range for EBML Elements which are of numerical types
(Unsigned Integer, Signed Integer, Float, and Date). If specified (Unsigned Integer, Signed Integer, Float, and Date). If specified
the value of the EBML Element MUST be within the defined range. See the value of the EBML Element MUST be within the defined range. See
Section 11.1.5.6.1 for rules applied to expression of range values. section of Expressions of range (#expression-of-range) for rules
applied to expression of range values.
The range attribute is OPTIONAL. If the range attribute is not The range attribute is OPTIONAL. If the range attribute is not
present then any value legal for the type attribute is valid. present then any value legal for the type attribute is valid.
11.1.5.6.1. Expression of range 11.1.5.6.1. Expression of range
The range attribute MUST only be used with EBML Elements that are The range attribute MUST only be used with EBML Elements that are
either signed integer, unsigned integer, float, or date. The either signed integer, unsigned integer, float, or date. The
expression defines the upper, lower, exact or excluded value of the expression defines the upper, lower, exact or excluded value of the
EBML Element and optionally an upper boundary value combined with a EBML Element and optionally an upper boundary value combined with a
skipping to change at page 23, line 49 skipping to change at page 25, line 26
attribute value. For example "1234" means the EBML element always attribute value. For example "1234" means the EBML element always
has the value 1234. The value can be prefixed with "not" to indicate has the value 1234. The value can be prefixed with "not" to indicate
that the fixed value MUST NOT be used for that Element. For example that the fixed value MUST NOT be used for that Element. For example
"not 1234" means the Element can use all values of its type except "not 1234" means the Element can use all values of its type except
1234. 1234.
For an exclusive lower boundary the ">" sign is used and the ">=" For an exclusive lower boundary the ">" sign is used and the ">="
sign is used for an inclusive lower boundary. For example ">3" sign is used for an inclusive lower boundary. For example ">3"
meaning the Element value MUST be greater than 3 or ">=0x1p+0" meaning the Element value MUST be greater than 3 or ">=0x1p+0"
meaning the Element value MUST be greater than or equal to the meaning the Element value MUST be greater than or equal to the
floating value 1.0, see Section 11.1.17. floating value 1.0, see textual expression of floats (#textual-
expression-of-floats).
For an exclusive upper boundary the "<" sign is used and the "<=" For an exclusive upper boundary the "<" sign is used and the "<="
sign is used for an inclusive upper boundary. For example "<-2" sign is used for an inclusive upper boundary. For example "<-2"
meaning the Element value MUST be less than -2 or "<=10" meaning the meaning the Element value MUST be less than -2 or "<=10" meaning the
Element value MUST be less than or equal to the 10. Element value MUST be less than or equal to the 10.
The lower and upper bounds can be combined into an expression to form The lower and upper bounds can be combined into an expression to form
a closed boundary. The lower boundary coming first followed by the a closed boundary. The lower boundary coming first followed by the
upper boundary, separated by a comma. For example ">3,<= 20" means upper boundary, separated by a comma. For example ">3,<= 20" means
the Element value MUST be greater than 3 and less than or equal to the Element value MUST be greater than 3 and less than or equal to
skipping to change at page 24, line 25 skipping to change at page 26, line 11
first value and MUST be less than or equal to the second value. For first value and MUST be less than or equal to the second value. For
example "1-10" is equivalent to ">=1,<=10". If the upper boundary is example "1-10" is equivalent to ">=1,<=10". If the upper boundary is
negative, only the latter form MUST be used. negative, only the latter form MUST be used.
11.1.5.7. length 11.1.5.7. length
A value to express the valid length of the Element Data as written A value to express the valid length of the Element Data as written
measured in octets. The length provides a constraint in addition to measured in octets. The length provides a constraint in addition to
the Length value of the definition of the corresponding EBML Element the Length value of the definition of the corresponding EBML Element
Type. This length MUST be expressed as either a non-negative integer Type. This length MUST be expressed as either a non-negative integer
or a range (see Section 11.1.5.6.1) that consists of only non- or a range (see expression of range (#expression-of-range)) that
negative integers and valid operators. consists of only non-negative integers and valid operators.
The length attribute is OPTIONAL. If the length attribute is not The length attribute is OPTIONAL. If the length attribute is not
present for that EBML Element then that EBML Element is only limited present for that EBML Element then that EBML Element is only limited
in length by the definition of the associated EBML Element Type. in length by the definition of the associated EBML Element Type.
11.1.5.8. default 11.1.5.8. default
If an Element is mandatory (has a EBMLMinOccurrence value greater If an Element is mandatory (has a EBMLMinOccurrence value greater
than zero) but not written within its Parent Element or stored as an than zero) but not written within its Parent Element or stored as an
Empty Element, then the EBML Reader of the EBML Document MUST Empty Element, then the EBML Reader of the EBML Document MUST
skipping to change at page 24, line 49 skipping to change at page 26, line 35
Master Elements MUST NOT declare a default value. EBML Elements with Master Elements MUST NOT declare a default value. EBML Elements with
a minOccurs value greater than 1 MUST NOT declare a default value. a minOccurs value greater than 1 MUST NOT declare a default value.
The default attribute is OPTIONAL. The default attribute is OPTIONAL.
11.1.5.9. type 11.1.5.9. type
The type MUST be set to one of the following values: "integer" The type MUST be set to one of the following values: "integer"
(signed integer), "uinteger" (unsigned integer), "float", "string", (signed integer), "uinteger" (unsigned integer), "float", "string",
"date", "utf-8", "master", or "binary". The content of each type is "date", "utf-8", "master", or "binary". The content of each type is
defined within Section 7. defined within section on EBML Element Types (#ebml-element-types).
The type attribute is REQUIRED. The type attribute is REQUIRED.
11.1.5.10. unknownsizeallowed 11.1.5.10. unknownsizeallowed
A boolean to express if an EBML Element is permitted to be Unknown- A boolean to express if an EBML Element is permitted to be Unknown-
Sized Element (having all VINT_DATA bits of Element Data Size set to Sized Element (having all VINT_DATA bits of Element Data Size set to
1). EBML Elements that are not Master Elements MUST NOT set 1). EBML Elements that are not Master Elements MUST NOT set
unknownsizeallowed to true. An EBML Element that is defined with an unknownsizeallowed to true. An EBML Element that is defined with an
unknownsizeallowed attribute set to 1 MUST also have the unknownsizeallowed attribute set to 1 MUST also have the
skipping to change at page 27, line 6 skipping to change at page 28, line 42
In some cases within an EBML Document Type, the attributes of the In some cases within an EBML Document Type, the attributes of the
"<element>" element are not sufficient to clearly communicate how the "<element>" element are not sufficient to clearly communicate how the
defined EBML Element is intended to be implemented. For instance, defined EBML Element is intended to be implemented. For instance,
one EBML Element might only be mandatory if another EBML Element is one EBML Element might only be mandatory if another EBML Element is
present, or as another example, the default value of an EBML Element present, or as another example, the default value of an EBML Element
might derive from a related Element's content. In these cases where might derive from a related Element's content. In these cases where
the Element's definition is conditional or advanced implementation the Element's definition is conditional or advanced implementation
notes are needed, one or many "<implementation_note>" elements can be notes are needed, one or many "<implementation_note>" elements can be
used to store that information. The "<implementation_note>" refer to used to store that information. The "<implementation_note>" refer to
a specific attribute of the parent "<element>" as expressed by the a specific attribute of the parent "<element>" as expressed by the
"note_type" attribute Section 11.1.9.1. "note_attribute" attribute Section 11.1.9.1.
11.1.9. <implementation_note> Attributes 11.1.9. <implementation_note> Attributes
11.1.9.1. note_type 11.1.9.1. note_attribute
The note_type attribute references which of the "<element>"'s The note_attribute attribute references which of the "<element>"'s
attributes that the implementation_note is in regards to. The attributes that the implementation_note is in regards to. The
note_type attribute MUST be set to one of the following values note_attribute attribute MUST be set to one of the following values
(corresponding to that attribute of the parent "<element>"): (corresponding to that attribute of the parent "<element>"):
"minOccurs", "maxOccurs", "range", "length", "default", "minver", or "minOccurs", "maxOccurs", "range", "length", "default", "minver", or
"maxver". The "<implementation_note>" SHALL supersede the parent "maxver". The "<implementation_note>" SHALL supersede the parent
"<element>"'s attribute that is named in the "note_type" attribute. "<element>"'s attribute that is named in the "note_attribute"
An "<element>" SHALL NOT have more than one "<implementation_note>" attribute. An "<element>" SHALL NOT have more than one
of the same "note_type". "<implementation_note>" of the same "note_attribute".
The note_type attribute is REQUIRED. The note_attribute attribute is REQUIRED.
11.1.10. <restriction> Element 11.1.10. <restriction> Element
The "<restriction>" element provides information about restrictions The "<restriction>" element provides information about restrictions
to the allowable values for the EBML Element which are listed in to the allowable values for the EBML Element which are listed in
"<enum>" elements. "<enum>" elements.
11.1.11. <enum> Element 11.1.11. <enum> Element
The "<enum>" element stores a list of values allowed for storage in The "<enum>" element stores a list of values allowed for storage in
skipping to change at page 28, line 37 skipping to change at page 30, line 21
"<extension>" element. "<extension>" element.
The type attribute is REQUIRED. The type attribute is REQUIRED.
11.1.15. XML Schema for EBML Schema 11.1.15. XML Schema for EBML Schema
This following provides an XML Schema [W3C.REC-xmlschema-0-20041028] This following provides an XML Schema [W3C.REC-xmlschema-0-20041028]
for facilitating verification of an EBML Schema to the definition for facilitating verification of an EBML Schema to the definition
described in Section 8.1. described in Section 8.1.
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns="https://ietf.org/cellar/ebml" targetNamespace="https://ietf.org/cellar/ebml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" elementFormDefault="qualified" version="01"> <!-- for HTML in comments --> <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"/> <xs:element name="EBMLSchema" type="EBMLSchemaType"/> <xs:complexType name="EBMLSchemaType"> <xs:sequence> <xs:element name="element" type="elementType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="docType" use="required"/> <xs:attribute name="version" use="required"/> </xs:complexType> <xs:complexType name="elementType"> <xs:sequence> <xs:element name="documentation" type="documentationType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="implementation_note" type="noteType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="restriction" type="restrictionType" minOccurs="0" maxOccurs="1"/> <xs:element name="extension" type="extensionType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="name" use="required"/> <xs:attribute name="path" use="required"/> <xs:attribute name="id" use="required"/> <xs:attribute name="minOccurs" default="0"/> <xs:attribute name="maxOccurs" default="1"/> <xs:attribute name="range"/> <xs:attribute name="length"/> <xs:attribute name="default"/> <xs:attribute name="type" use="required"/> <xs:attribute name="unknownsizeallowed"/> <xs:attribute name="recurring"/> <xs:attribute name="minver" default="1"/> <xs:attribute name="maxver"/> </xs:complexType> <xs:complexType name="restrictionType"> <xs:sequence> <xs:element name="enum" type="enumType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="extensionType"> <xs:sequence> <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="type" use="required"/> <xs:anyAttribute processContents="skip"/> </xs:complexType> <xs:complexType name="enumType"> <xs:sequence> <xs:element name="documentation" type="documentationType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="label"/> <xs:attribute name="value" use="required"/> </xs:complexType> <xs:complexType name="documentationType" mixed="true"> <xs:sequence> <xs:element name="a" type="xhtml:xhtml.a.type" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="br" type="xhtml:xhtml.br.type" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="strong" type="xhtml:xhtml.strong.type" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="lang"/> <xs:attribute name="purpose" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="definition"/> <xs:enumeration value="rationale"/> <xs:enumeration value="references"/> <xs:enumeration value="usage notes"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> <xs:complexType name="noteType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="note_attribute" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="minOccurs"/> <xs:enumeration value="maxOccurs"/> <xs:enumeration value="range"/> <xs:enumeration value="length"/> <xs:enumeration value="default"/> <xs:enumeration value="minver"/> <xs:enumeration value="maxver"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:schema>
<xs:schema xmlns="https://ietf.org/cellar/ebml"
targetNamespace="https://ietf.org/cellar/ebml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
elementFormDefault="qualified" version="01">
<!-- for HTML in comments -->
<xs:import namespace="http://www.w3.org/1999/xhtml"
schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"/>
<xs:element name="EBMLSchema" type="EBMLSchemaType"/>
<xs:complexType name="EBMLSchemaType">
<xs:sequence>
<xs:element name="element" type="elementType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="docType" use="required"/>
<xs:attribute name="version" use="required"/>
</xs:complexType>
<xs:complexType name="elementType">
<xs:sequence>
<xs:element name="documentation" type="documentationType"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="implementation_note" type="noteType"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="restriction" type="restrictionType"
minOccurs="0" maxOccurs="1"/>
<xs:element name="extension" type="extensionType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required"/>
<xs:attribute name="path" use="required"/>
<xs:attribute name="id" use="required"/>
<xs:attribute name="minOccurs" default="0"/>
<xs:attribute name="maxOccurs" default="1"/>
<xs:attribute name="range"/>
<xs:attribute name="length"/>
<xs:attribute name="default"/>
<xs:attribute name="type" use="required"/>
<xs:attribute name="unknownsizeallowed"/>
<xs:attribute name="recurring"/>
<xs:attribute name="minver" default="1"/>
<xs:attribute name="maxver"/>
</xs:complexType>
<xs:complexType name="restrictionType">
<xs:sequence>
<xs:element name="enum" type="enumType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="extensionType">
<xs:sequence>
<xs:any processContents="skip"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" use="required"/>
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
<xs:complexType name="enumType">
<xs:sequence>
<xs:element name="documentation" type="documentationType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="label"/>
<xs:attribute name="value" use="required"/>
</xs:complexType>
<xs:complexType name="documentationType" mixed="true">
<xs:sequence>
<xs:element name="a" type="xhtml:xhtml.a.type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="br" type="xhtml:xhtml.br.type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="strong" type="xhtml:xhtml.strong.type"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="lang"/>
<xs:attribute name="purpose" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="definition"/>
<xs:enumeration value="rationale"/>
<xs:enumeration value="references"/>
<xs:enumeration value="usage notes"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="noteType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="note_type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="minOccurs"/>
<xs:enumeration value="maxOccurs"/>
<xs:enumeration value="range"/>
<xs:enumeration value="length"/>
<xs:enumeration value="default"/>
<xs:enumeration value="minver"/>
<xs:enumeration value="maxver"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
11.1.16. Identically Recurring Elements 11.1.16. Identically Recurring Elements
An Identically Recurring Element is an EBML Element that MAY occur An Identically Recurring Element is an EBML Element that MAY occur
within its Parent Element more than once but that each recurrence within its Parent Element more than once but that each recurrence
within that Parent Element MUST be identical both in storage and within that Parent Element MUST be identical both in storage and
semantics. Identically Recurring Elements are permitted to be stored semantics. Identically Recurring Elements are permitted to be stored
multiple times within the same Parent Element in order to increase multiple times within the same Parent Element in order to increase
data resilience and optimize the use of EBML in transmission. For data resilience and optimize the use of EBML in transmission. For
instance a pertinent Top-Level Element could be periodically resent instance a pertinent Top-Level Element could be periodically resent
skipping to change at page 31, line 43 skipping to change at page 31, line 16
When a float value is represented textually in an EBML Schema, such When a float value is represented textually in an EBML Schema, such
as within a default or range value, the float values MUST be as within a default or range value, the float values MUST be
expressed as Hexadecimal Floating-Point Constants as defined in the expressed as Hexadecimal Floating-Point Constants as defined in the
C11 standard [ISO.9899.2011] (see section 6.4.4.2 on Floating C11 standard [ISO.9899.2011] (see section 6.4.4.2 on Floating
Constants). The following table provides examples of expressions of Constants). The following table provides examples of expressions of
float ranges. float ranges.
+-------------------+-----------------------------------------+ +-------------------+-----------------------------------------+
| as decimal | as Hexadecimal Floating-Point Constants | | as decimal | as Hexadecimal Floating-Point Constants |
+-------------------+-----------------------------------------+ +===================+=========================================+
| 0.0 | "0x0p+1" | | 0.0 | "0x0p+1" |
+-------------------+-----------------------------------------+
| 0.0-1.0 | "0x0p+1-0x1p+0" | | 0.0-1.0 | "0x0p+1-0x1p+0" |
+-------------------+-----------------------------------------+
| 1.0-256.0 | "0x1p+0-0x1p+8" | | 1.0-256.0 | "0x1p+0-0x1p+8" |
+-------------------+-----------------------------------------+
| 0.857421875 | "0x1.b7p-1" | | 0.857421875 | "0x1.b7p-1" |
+-------------------+-----------------------------------------+
| -1.0--0.857421875 | "-0x1p+0--0x1.b7p-1" | | -1.0--0.857421875 | "-0x1p+0--0x1.b7p-1" |
+-------------------+-----------------------------------------+ +-------------------+-----------------------------------------+
Table 8
Within an expression of a float range, as in an integer range, the - Within an expression of a float range, as in an integer range, the -
(hyphen) character is the separator between the minimal and maximum (hyphen) character is the separator between the minimal and maximum
value permitted by the range. Hexadecimal Floating-Point Constants value permitted by the range. Hexadecimal Floating-Point Constants
also use a - (hyphen) when indicating a negative binary power. also use a - (hyphen) when indicating a negative binary power.
Within a float range, when a - (hyphen) is immediately preceded by a Within a float range, when a - (hyphen) is immediately preceded by a
letter p, then the - (hyphen) is a part of the Hexadecimal Floating- letter p, then the - (hyphen) is a part of the Hexadecimal Floating-
Point Constant which notes negative binary power. Within a float Point Constant which notes negative binary power. Within a float
range, when a - (hyphen) is not immediately preceded by a letter p, range, when a - (hyphen) is not immediately preceded by a letter p,
then the - (hyphen) represents the separator between the minimal and then the - (hyphen) represents the separator between the minimal and
maximum value permitted by the range. maximum value permitted by the range.
skipping to change at page 32, line 36 skipping to change at page 32, line 17
be present as well. If a Mandatory EBML Element has a default value be present as well. If a Mandatory EBML Element has a default value
declared by an EBML Schema and its Parent Element is present and the declared by an EBML Schema and its Parent Element is present and the
value of the EBML Element is NOT equal to the declared default value value of the EBML Element is NOT equal to the declared default value
then the EBML Element MUST be present. then the EBML Element MUST be present.
This table clarifies if a Mandatory EBML Element MUST be written, This table clarifies if a Mandatory EBML Element MUST be written,
according to if the default value is declared, if the value of the according to if the default value is declared, if the value of the
EBML Element is equal to the declared default value, and if the EBML Element is equal to the declared default value, and if the
Parent Element is used. Parent Element is used.
+---------------+---------------+---------------+-------------------+ +-----------------+-------------+---------------+------------------+
| Is the | Is the value | Is the Parent | Then is storing | | Is the default | Is the | Is the Parent | Then is storing |
| default value | equal to | Element | the EBML Element | | value declared? | value equal | Element | the EBML Element |
| declared? | default? | present? | REQUIRED? | | | to default? | present? | REQUIRED? |
+---------------+---------------+---------------+-------------------+ +=================+=============+===============+==================+
| Yes | Yes | Yes | No | | Yes | Yes | Yes | No |
| Yes | Yes | No | No | +-----------------+-------------+---------------+------------------+
| Yes | No | Yes | Yes | | Yes | Yes | No | No |
| Yes | No | No | No | +-----------------+-------------+---------------+------------------+
| No | n/a | Yes | Yes | | Yes | No | Yes | Yes |
| No | n/a | No | No | +-----------------+-------------+---------------+------------------+
+---------------+---------------+---------------+-------------------+ | Yes | No | No | No |
+-----------------+-------------+---------------+------------------+
| No | n/a | Yes | Yes |
+-----------------+-------------+---------------+------------------+
| No | n/a | No | No |
+-----------------+-------------+---------------+------------------+
Table 9
11.2. EBML Header Elements 11.2. EBML Header Elements
This document contains definitions of all EBML Elements of the EBML This document contains definitions of all EBML Elements of the EBML
Header. Header.
11.2.1. EBML Element 11.2.1. EBML Element
name: EBML name: EBML
skipping to change at page 38, line 21 skipping to change at page 37, line 37
description: The version of the DocTypeExtension. Different description: The version of the DocTypeExtension. Different
DocTypeExtensionVersion values of the same DocTypeExtensionVersion values of the same
DocType+DocTypeVersion+DocTypeExtensionName tuple MAY contain DocType+DocTypeVersion+DocTypeExtensionName tuple MAY contain
completely different sets of extra Elements. An EBML Reader MAY completely different sets of extra Elements. An EBML Reader MAY
support multiple versions of the same DocTypeExtension, only one or support multiple versions of the same DocTypeExtension, only one or
none. none.
11.3. Global Elements 11.3. Global Elements
EBML defines these Global Elements which MAY be stored within any EBML allows some special Elements to be found within more than one
Master Element of an EBML Document as defined by their Element Path. parent in an EBML Document or optionally at the Root Level of an EBML
Body. These Elements are called Global Elements. There are 2 Global
Elements that can be found in any EBML Document: the CRC-32 Element
and the Void Element. An EBML Schema MAY add other Global Elements
to the format it defines. These extra elements apply only to the
EBML Body, not the EBML Header.
Global Elements are EBML Elements whose path have a EBMLGlobalParent
as their EBMLLastParent. Because it is the last Parent part of the
path, a Global Element might also have non-EBMLGlobalParent parts in
its path. In this case the Global Element can only be found within
this non-EBMLGlobalParent path, i.e. it's not fully "global".
The EBMLEltOccurrence of a Global Element is the number of
occurrences the Element can be found in a Parent Element. But the
Global Element can be found in many Parent Elements, allowing the
same number of occurrences in each Parent where this Element is
found.
11.3.1. CRC-32 Element 11.3.1. CRC-32 Element
name: CRC-32 name: CRC-32
path: "*1((1*\)\CRC-32)" path: "*1((1*\)\CRC-32)"
id: 0xBF id: 0xBF
minOccurs: 0 minOccurs: 0
skipping to change at page 40, line 14 skipping to change at page 40, line 7
first Null Octet within that Element. A string value and a copy of first Null Octet within that Element. A string value and a copy of
that string value terminated by one or more Null Octets are that string value terminated by one or more Null Octets are
semantically equal. semantically equal.
The following table shows examples of semantics and validation for The following table shows examples of semantics and validation for
the use of Null Octets. Values to represent Stored Values and the the use of Null Octets. Values to represent Stored Values and the
Semantic Meaning as represented as hexadecimal values. Semantic Meaning as represented as hexadecimal values.
+---------------------+---------------------+ +---------------------+---------------------+
| Stored Value | Semantic Meaning | | Stored Value | Semantic Meaning |
+---------------------+---------------------+ +=====================+=====================+
| 0x65 0x62 0x6D 0x6C | 0x65 0x62 0x6D 0x6C | | 0x65 0x62 0x6D 0x6C | 0x65 0x62 0x6D 0x6C |
+---------------------+---------------------+
| 0x65 0x62 0x00 0x6C | 0x65 0x62 | | 0x65 0x62 0x00 0x6C | 0x65 0x62 |
+---------------------+---------------------+
| 0x65 0x62 0x00 0x00 | 0x65 0x62 | | 0x65 0x62 0x00 0x00 | 0x65 0x62 |
+---------------------+---------------------+
| 0x65 0x62 | 0x65 0x62 | | 0x65 0x62 | 0x65 0x62 |
+---------------------+---------------------+ +---------------------+---------------------+
Table 10
14. Guidelines for Updating Elements 14. Guidelines for Updating Elements
An EBML Document can be updated without requiring that the entire An EBML Document can be updated without requiring that the entire
EBML Document be rewritten. These recommendations describe EBML Document be rewritten. These recommendations describe
strategies to change the Element Data of a written EBML Element with strategies to change the Element Data of a written EBML Element with
minimal disruption to the rest of the EBML Document. minimal disruption to the rest of the EBML Document.
14.1. Reducing a Element Data in Size 14.1. Reducing a Element Data in Size
There are three methods to reduce the size of Element Data of a There are three methods to reduce the size of Element Data of a
skipping to change at page 41, line 8 skipping to change at page 41, line 6
Element that stores an Element ID (3 octets), Element Data Size (1 Element that stores an Element ID (3 octets), Element Data Size (1
octet), and Element Data (4 octets). If the Element Data is changed octet), and Element Data (4 octets). If the Element Data is changed
to reduce the length by one octet and if the current length of the to reduce the length by one octet and if the current length of the
Element Data Size is less than its maximum permitted length, then the Element Data Size is less than its maximum permitted length, then the
Element Data Size of that Element MAY be rewritten to increase its Element Data Size of that Element MAY be rewritten to increase its
length by one octet. Thus before and after the change the EBML length by one octet. Thus before and after the change the EBML
Element maintains the same length of 8 octets and data around the Element maintains the same length of 8 octets and data around the
Element does not need to be moved. Element does not need to be moved.
+-------------+------------+-------------------+--------------+ +-------------+------------+-------------------+--------------+
| Status | Element ID | Element Data Size | Element Data | | Status | Element ID | Element Data Size | Element Data |
+=============+============+===================+==============+
| Before edit | 0x3B4040 | 0x84 | 0x65626D6C |
+-------------+------------+-------------------+--------------+ +-------------+------------+-------------------+--------------+
| Before edit | 0x3B4040 | 0x84 | 0x65626D6C | | After edit | 0x3B4040 | 0x4003 | 0x6D6B76 |
| After edit | 0x3B4040 | 0x4003 | 0x6D6B76 |
+-------------+------------+-------------------+--------------+ +-------------+------------+-------------------+--------------+
Table 11
This method is RECOMMENDED when the Element Data is reduced by a This method is RECOMMENDED when the Element Data is reduced by a
single octet; for reductions by two or more octets it is RECOMMENDED single octet; for reductions by two or more octets it is RECOMMENDED
to fill the freed space with a Void Element. to fill the freed space with a Void Element.
Note that if the Element Data length needs to be rewritten as Note that if the Element Data length needs to be rewritten as
shortened by one octet and the Element Data Size could be rewritten shortened by one octet and the Element Data Size could be rewritten
as a shorter VINT then it is RECOMMENDED to rewrite the Element Data as a shorter VINT then it is RECOMMENDED to rewrite the Element Data
Size as one octet shorter, shorten the Element Data by one octet, and Size as one octet shorter, shorten the Element Data by one octet, and
follow that Element with a Void Element. For example, the following follow that Element with a Void Element. For example, the following
table depicts a String Element that stores an Element ID (3 octets), table depicts a String Element that stores an Element ID (3 octets),
Element Data Size (2 octets, but could be rewritten in one octet), Element Data Size (2 octets, but could be rewritten in one octet),
and Element Data (3 octets). If the Element Data is to be rewritten and Element Data (3 octets). If the Element Data is to be rewritten
to a two octet length, then another octet can be taken from Element to a two octet length, then another octet can be taken from Element
Data Size so that there is enough space to add a two octet Void Data Size so that there is enough space to add a two octet Void
Element. Element.
+--------+------------+-----------------+-------------+-------------+ +--------+------------+-------------------+--------------+---------+
| Status | Element ID | Element Data | Element | Void | | Status | Element ID | Element Data Size | Element Data | Void |
| | | Size | Data | Element | | | | | | Element |
+--------+------------+-----------------+-------------+-------------+ +========+============+===================+==============+=========+
| Before | 0x3B4040 | 0x4003 | 0x6D6B76 | | | Before | 0x3B4040 | 0x4003 | 0x6D6B76 | |
| After | 0x3B4040 | 0x82 | 0x6869 | 0xEC80 | +--------+------------+-------------------+--------------+---------+
+--------+------------+-----------------+-------------+-------------+ | After | 0x3B4040 | 0x82 | 0x6869 | 0xEC80 |
+--------+------------+-------------------+--------------+---------+
Table 12
14.1.3. Terminating Element Data 14.1.3. Terminating Element Data
For String Elements and UTF-8 Elements the length of Element Data MAY For String Elements and UTF-8 Elements the length of Element Data MAY
be reduced by adding Null Octets to terminate the Element Data (see be reduced by adding Null Octets to terminate the Element Data (see
Section 13). the section on Terminating Elements (#terminating-elements)).
In the following table, a four octets long Element Data is changed to In the following table, a four octets long Element Data is changed to
a three octet long value followed by a Null Octet; the Element Data a three octet long value followed by a Null Octet; the Element Data
Size includes any Null Octets used to terminate Element Data so Size includes any Null Octets used to terminate Element Data so
remains unchanged. remains unchanged.
+-------------+------------+-------------------+--------------+ +-------------+------------+-------------------+--------------+
| Status | Element ID | Element Data Size | Element Data | | Status | Element ID | Element Data Size | Element Data |
+=============+============+===================+==============+
| Before edit | 0x3B4040 | 0x84 | 0x65626D6C |
+-------------+------------+-------------------+--------------+ +-------------+------------+-------------------+--------------+
| Before edit | 0x3B4040 | 0x84 | 0x65626D6C | | After edit | 0x3B4040 | 0x84 | 0x6D6B7600 |
| After edit | 0x3B4040 | 0x84 | 0x6D6B7600 |
+-------------+------------+-------------------+--------------+ +-------------+------------+-------------------+--------------+
Table 13
Note that this method is NOT RECOMMENDED. For reductions of one Note that this method is NOT RECOMMENDED. For reductions of one
octet, the method for Extending the Element Data Size SHOULD be used. octet, the method for Extending the Element Data Size SHOULD be used.
For reduction by more than one octet, the method for Adding a Void For reduction by more than one octet, the method for Adding a Void
Element SHOULD be used. Element SHOULD be used.
14.2. Considerations when Updating Elements with Cyclic Redundancy 14.2. Considerations when Updating Elements with Cyclic Redundancy
Check (CRC) Check (CRC)
If the Element to be changed is a Descendant Element of any Master If the Element to be changed is a Descendant Element of any Master
Element that contains a CRC-32 Element (see Section 11.3.1) then the Element that contains a CRC-32 Element (see Section 11.3.1) then the
skipping to change at page 43, line 23 skipping to change at page 43, line 30
could leak information at both the semantic layer (as declared via could leak information at both the semantic layer (as declared via
the DocType Element) and within the EBML structure (the presence of the DocType Element) and within the EBML structure (the presence of
EBML Elements can be derived even with an unknown semantic layer EBML Elements can be derived even with an unknown semantic layer
using a heuristic approach; not without errors, of course, but with a using a heuristic approach; not without errors, of course, but with a
certain degree of confidence). certain degree of confidence).
An EBML Document that has the following issues may still be handled An EBML Document that has the following issues may still be handled
by the EBML Reader and the data accepted as such, depending on how by the EBML Reader and the data accepted as such, depending on how
strict the EBML Reader wants to be: strict the EBML Reader wants to be:
o Invalid Element IDs that are longer than the limit stated in the * Invalid Element IDs that are longer than the limit stated in the
EBMLMaxIDLength Element of the EBML Header. EBMLMaxIDLength Element of the EBML Header.
o Invalid Element IDs that are not encoded in the shortest-possible * Invalid Element IDs that are not encoded in the shortest-possible
way. way.
o Invalid Element Data Size values that are longer than the limit * Invalid Element Data Size values that are longer than the limit
stated in the EBMLMaxSizeLength Element of the EBML Header. stated in the EBMLMaxSizeLength Element of the EBML Header.
Element IDs that are unknown to the EBML Reader MAY be accepted as Element IDs that are unknown to the EBML Reader MAY be accepted as
valid EBML IDs in order to skip such elements. valid EBML IDs in order to skip such elements.
EBML Elements with a string type may contain extra data after the EBML Elements with a string type may contain extra data after the
first 0x00. These data MUST be discarded according to the Section 13 first 0x00. These data MUST be discarded according to the Section 13
rules. rules.
An EBML Reader may discard some or all data if the following errors An EBML Reader may discard some or all data if the following errors
are found in the EBML Document: are found in the EBML Document:
o Invalid Element Data Size values (e.g. extending the length of the * Invalid Element Data Size values (e.g. extending the length of the
EBML Element beyond the scope of the Parent Element; possibly EBML Element beyond the scope of the Parent Element; possibly
triggering access-out-of-bounds issues). triggering access-out-of-bounds issues).
o Very high lengths in order to force out-of-memory situations * Very high lengths in order to force out-of-memory situations
resulting in a denial of service, access-out-of-bounds issues etc. resulting in a denial of service, access-out-of-bounds issues etc.
o Missing EBML Elements that are mandatory in a Master Element and * Missing EBML Elements that are mandatory in a Master Element and
have no declared default value, making the semantic invalid at have no declared default value, making the semantic invalid at
that Master Element level. that Master Element level.
o Usage of invalid UTF-8 encoding in EBML Elements of UTF-8 type * Usage of invalid UTF-8 encoding in EBML Elements of UTF-8 type
(e.g. in order to trigger access-out-of-bounds or buffer overflow (e.g. in order to trigger access-out-of-bounds or buffer overflow
issues). issues).
o Usage of invalid data in EBML Elements with a date type, * Usage of invalid data in EBML Elements with a date type,
triggering bogus date accesses. triggering bogus date accesses.
Side channel attacks could exploit: Side channel attacks could exploit:
o The semantic equivalence of the same string stored in a String * The semantic equivalence of the same string stored in a String
Element or UTF-8 Element with and without zero-bit padding, making Element or UTF-8 Element with and without zero-bit padding, making
comparison at the semantic level invalid. comparison at the semantic level invalid.
o The semantic equivalence of VINT_DATA within Element Data Size * The semantic equivalence of VINT_DATA within Element Data Size
with two different lengths due to left-padding zero bits, making with two different lengths due to left-padding zero bits, making
comparison at the semantic level invalid. comparison at the semantic level invalid.
o Data contained within a Master Element which is not itself part of * Data contained within a Master Element which is not itself part of
a Child Element can trigger incorrect parsing behavior in EBML a Child Element can trigger incorrect parsing behavior in EBML
Readers. Readers.
o Extraneous copies of Identically Recurring Element, making parsing * Extraneous copies of Identically Recurring Element, making parsing
unnecessarily slow to the point of not being usable. unnecessarily slow to the point of not being usable.
o Copies of Identically Recurring Element within a Parent Element * Copies of Identically Recurring Element within a Parent Element
that contain invalid CRC-32 Elements. EBML Readers not checking that contain invalid CRC-32 Elements. EBML Readers not checking
the CRC-32 might use the version of the element with mismatching the CRC-32 might use the version of the element with mismatching
CRC-32. CRC-32.
o Use of Void Elements which could be used to hide content or create * Use of Void Elements which could be used to hide content or create
bogus resynchronization points seen by some EBML Reader and not bogus resynchronization points seen by some EBML Reader and not
others. others.
17. IANA Considerations 17. IANA Considerations
17.1. CELLAR EBML Element ID Registry 17.1. CELLAR EBML Element ID Registry
This document creates a new IANA Registry called "CELLAR EBML Element This document creates a new IANA Registry called "CELLAR EBML Element
ID Registry". ID Registry".
Element IDs are described in section Element ID. Element IDs are Element IDs are described in section Element ID. Element IDs are
encoded using the VINT mechanism described in section Section 4 can encoded using the VINT mechanism described in section Section 4 can
be between one and five octets long. Five octet long Element IDs are be between one and five octets long. Five octet long Element IDs are
possible only if declared in the header. possible only if declared in the header.
This IANA Registry only applies to Elements that can be contained in This IANA Registry only applies to Elements that can be contained in
the EBML Header, thus including Global Elements. Elements only found the EBML Header, thus including Global Elements (#global-elements).
in the EBML Body have their own set of independent Element IDs and Elements only found in the EBML Body have their own set of
are not part of this IANA Registry. independent Element IDs and are not part of this IANA Registry.
The VINT Data value of one-octet Element IDs MUST be between 0x01 and The VINT Data value of one-octet Element IDs MUST be between 0x01 and
0x7E. These items are valuable because they are short, and need to 0x7E. These items are valuable because they are short, and need to
be used for commonly repeated elements. Values from 1 to 126 are to be used for commonly repeated elements. Values from 1 to 126 are to
be allocated according to the "RFC Required" policy [RFC8126]. be allocated according to the "RFC Required" policy [RFC8126].
The VINT Data value of two-octet Element IDs MUST be between 0x007F The VINT Data value of two-octet Element IDs MUST be between 0x007F
and 0x3FFE. Numbers are to be allocated within this range according and 0x3FFE. Numbers are to be allocated within this range according
to the "Specification Required" policy [RFC8126]. to the "Specification Required" policy [RFC8126].
skipping to change at page 46, line 5 skipping to change at page 47, line 5
The numbers 0xFFFFFFF and 0x1000000 are RESERVED. The numbers 0xFFFFFFF and 0x1000000 are RESERVED.
Five octet Element IDs (values from 0x10000001 upwards) are RESERVED Five octet Element IDs (values from 0x10000001 upwards) are RESERVED
according to the "Experimental Use" policy [RFC8126]: they may be according to the "Experimental Use" policy [RFC8126]: they may be
used by anyone at any time, but there is no coordination. used by anyone at any time, but there is no coordination.
ID Values found in this document are assigned as initial values as ID Values found in this document are assigned as initial values as
follows: follows:
+------------+-------------------------+----------------------------+ +------------+-------------------------+-----------------+
| ID | Element Name | Reference | | ID | Element Name | Reference |
+------------+-------------------------+----------------------------+ +============+=========================+=================+
| 0x1A45DFA3 | EBML | Described in Section | | 0x1A45DFA3 | EBML | Described in |
| | | 11.2.1 | | | | Section 11.2.1 |
| 0x4286 | EBMLVersion | Described in Section | +------------+-------------------------+-----------------+
| | | 11.2.2 | | 0x4286 | EBMLVersion | Described in |
| 0x42F7 | EBMLReadVersion | Described in Section | | | | Section 11.2.2 |
| | | 11.2.3 | +------------+-------------------------+-----------------+
| 0x42F2 | EBMLMaxIDLength | Described in Section | | 0x42F7 | EBMLReadVersion | Described in |
| | | 11.2.4 | | | | Section 11.2.3 |
| 0x42F3 | EBMLMaxSizeLength | Described in Section | +------------+-------------------------+-----------------+
| | | 11.2.5 | | 0x42F2 | EBMLMaxIDLength | Described in |
| 0x4282 | DocType | Described in Section | | | | Section 11.2.4 |
| | | 11.2.6 | +------------+-------------------------+-----------------+
| 0x4287 | DocTypeVersion | Described in Section | | 0x42F3 | EBMLMaxSizeLength | Described in |
| | | 11.2.7 | | | | Section 11.2.5 |
| 0x4285 | DocTypeReadVersion | Described in Section | +------------+-------------------------+-----------------+
| | | 11.2.8 | | 0x4282 | DocType | Described in |
| 0x4281 | DocTypeExtension | Described in Section | | | | Section 11.2.6 |
| | | 11.2.9 | +------------+-------------------------+-----------------+
| 0x4283 | DocTypeExtensionName | Described in Section | | 0x4287 | DocTypeVersion | Described in |
| | | 11.2.10 | | | | Section 11.2.7 |
| 0x4284 | DocTypeExtensionVersion | Described in Section | +------------+-------------------------+-----------------+
| | | 11.2.11 | | 0x4285 | DocTypeReadVersion | Described in |
| 0xBF | CRC-32 | Described in Section | | | | Section 11.2.8 |
| | | 11.3.1 | +------------+-------------------------+-----------------+
| 0xEC | Void | Described in Section | | 0x4281 | DocTypeExtension | Described in |
| | | 11.3.2 | | | | Section 11.2.9 |
+------------+-------------------------+----------------------------+ +------------+-------------------------+-----------------+
| 0x4283 | DocTypeExtensionName | Described in |
| | | Section 11.2.10 |
+------------+-------------------------+-----------------+
| 0x4284 | DocTypeExtensionVersion | Described in |
| | | Section 11.2.11 |
+------------+-------------------------+-----------------+
| 0xBF | CRC-32 | Described in |
| | | Section 11.3.1 |
+------------+-------------------------+-----------------+
| 0xEC | Void | Described in |
| | | Section 11.3.2 |
+------------+-------------------------+-----------------+
Table 14
17.2. CELLAR EBML DocType Registry 17.2. CELLAR EBML DocType Registry
This document creates a new IANA Registry called "CELLAR EBML DocType This document creates a new IANA Registry called "CELLAR EBML DocType
Registry". Registry".
To register a new DocType in this registry one needs a DocType name, To register a new DocType in this registry one needs a DocType name,
a Description of the DocType, a Change Controller (IESG or email of a Description of the DocType, a Change Controller (IESG or email of
registrant) and an optional Reference to a document describing the registrant) and an optional Reference to a document describing the
DocType. DocType.
DocType values are described in Section 11.1.3.1. DocTypes are ASCII DocType values are described in this section (#doctype). DocTypes
strings, defined in Section 7.4, which label the official name of the are ASCII strings, defined in the String Element section (#string-
EBML Document Type. The strings may be allocated according to the element), which label the official name of the EBML Document Type.
"First Come First Served" policy. The strings may be allocated according to the "First Come First
Served" policy.
The use of ASCII corresponds to the types and code already in use, The use of ASCII corresponds to the types and code already in use,
the value is not meant to be visible to the user. the value is not meant to be visible to the user.
DocType string values of "matroska" and "webm" are RESERVED to the DocType string values of "matroska" and "webm" are RESERVED to the
IETF for future use. These can be assigned via the "IESG Approval" IETF for future use. These can be assigned via the "IESG Approval"
or "RFC Required" policies [RFC8126]. or "RFC Required" policies [RFC8126].
18. References 18. Normative References
18.1. Normative References
[IEEE.754.1985] [IEEE.754.1985]
Institute of Electrical and Electronics Engineers, Institute of Electrical and Electronics Engineers,
"Standard for Binary Floating-Point Arithmetic", "Standard for Binary Floating-Point Arithmetic", August
IEEE Standard 754, August 1985. 1985.
[ISO.3309.1979] [ISO.3309.1979]
International Organization for Standardization, "Data International Organization for Standardization, "Data
communication - High-level data link control procedures - communication - High-level data link control procedures -
Frame structure", ISO Standard 3309, 1979. Frame structure", 1979.
[ISO.9899.2011] [ISO.9899.2011]
International Organization for Standardization, International Organization for Standardization,
"Programming languages - C", ISO Standard 9899, 2011. "Programming languages - C", 2011.
[ITU.V42.1994] [ITU.V42.1994]
International Telecommunications Union, "Error-correcting International Telecommunications Union, "Error-correcting
Procedures for DCEs Using Asynchronous-to-Synchronous Procedures for DCEs Using Asynchronous-to-Synchronous
Conversion", ITU-T Recommendation V.42, 1994. Conversion", 1994.
[RFC0020] Cerf, V., "ASCII format for network interchange", STD 80, [RFC0020] Cerf, V., "ASCII format for network interchange", STD 80,
RFC 20, DOI 10.17487/RFC0020, October 1969, RFC 20, DOI 10.17487/RFC0020, October 1969,
<https://www.rfc-editor.org/info/rfc20>. <https://www.rfc-editor.org/info/rfc20>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
skipping to change at page 48, line 26 skipping to change at page 49, line 44
<https://www.rfc-editor.org/info/rfc8126>. <https://www.rfc-editor.org/info/rfc8126>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[W3C.REC-xml-20081126] [W3C.REC-xml-20081126]
Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and
F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth
Edition)", World Wide Web Consortium Recommendation REC- Edition)", World Wide Web Consortium Recommendation REC-
xml-20081126, November 2008, xml-20081126, 26 November 2008,
<http://www.w3.org/TR/2008/REC-xml-20081126>. <http://www.w3.org/TR/2008/REC-xml-20081126>.
[W3C.SPSD-xhtml-basic-20180327] [W3C.SPSD-xhtml-basic-20180327]
McCarron, S., "XHTMLa&#132;[cents] Basic 1.1 - Second McCarron, S., "XHTML(tm) Basic 1.1 - Second Edition", 27
Edition", World Wide Web Consortium Recommendation SPSD- March 2018.
xhtml-basic-20180327, March 2018,
<http://www.w3.org/TR/2018/SPSD-xhtml-basic-20180327>.
18.2. Informative References 19. Informative References
[W3C.REC-xmlschema-0-20041028] [W3C.REC-xmlschema-0-20041028]
Fallside, D. and P. Walmsley, "XML Schema Part 0: Primer Fallside, D. and P. Walmsley, "XML Schema Part 0: Primer
Second Edition", World Wide Web Consortium Recommendation Second Edition", World Wide Web Consortium Recommendation
REC-xmlschema-0-20041028, October 2004, REC-xmlschema-0-20041028, 28 October 2004,
<http://www.w3.org/TR/2004/REC-xmlschema-0-20041028>. <http://www.w3.org/TR/2004/REC-xmlschema-0-20041028>.
18.3. URIs
[1] https://github.com/Matroska-Org/matroska-specification/
Authors' Addresses Authors' Addresses
Steve Lhomme Steve Lhomme
Email: slhomme@matroska.org Email: slhomme@matroska.org
Dave Rice Dave Rice
Email: dave@dericed.com Email: dave@dericed.com
Moritz Bunkus Moritz Bunkus
Email: moritz@bunkus.org Email: moritz@bunkus.org
 End of changes. 118 change blocks. 
568 lines changed or deleted 546 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/