Overhauled the schema system to make more sense. Implemented a dump_structure utility.
[~jspiros/python-ebml.git] / ebml / schema / ebml.py
1 from .base import *
2
3
4 class CRC32Element(Element):
5         id = 0xBF
6         name = 'CRC-32'
7         type = BINARY
8
9
10 class VoidElement(Element):
11         id = 0xEC
12         name = 'Void'
13         type = BINARY
14
15
16 class SignatureAlgoElement(Element):
17         id = 0x7E8A
18         name = 'SignatureAlgo'
19         type = UINT
20         multiple = True
21
22
23 class SignatureHashElement(Element):
24         id = 0x7E9A
25         name = 'SignatureHash'
26         type = UINT
27
28
29 class SignaturePublicKeyElement(Element):
30         id = 0x7EA5
31         name = 'SignaturePublicKey'
32         type = BINARY
33
34
35 class SignatureElement(Element):
36         id = 0x7EB5
37         name = 'Signature'
38         type = BINARY
39
40
41 class SignedElementElement(Element):
42         id = 0x6532
43         name = 'SignedElement'
44         type = BINARY
45
46
47 class SignatureElementListElement(Element):
48         id = 0x7E7B
49         name = 'SignatureElementList'
50         children = (SignedElementElement,)
51         type = CONTAINER
52         multiple = True
53
54
55 class SignatureElementsElement(Element):
56         id = 0x7E5B
57         name = 'SignatureElements'
58         children = (SignatureElementListElement)
59         type = CONTAINER
60
61
62 class SignatureSlotElement(Element):
63         id = 0x1B538667
64         name = 'SignatureSlot'
65         children = (SignatureAlgoElement, SignatureHashElement, SignaturePublicKeyElement, SignatureElement, SignatureElementsElement)
66         type = CONTAINER
67
68
69 class EBMLVersionElement(Element):
70         id = 0x4286
71         name = 'EBMLVersion'
72         type = UINT
73         mandatory = True
74         default = 1
75
76
77 class EBMLReadVersionElement(Element):
78         id = 0x42F7
79         name = 'EBMLReadVersion'
80         type = UINT
81         mandatory = True
82         default = 1
83
84
85 class EBMLMaxIDLengthElement(Element):
86         id = 0x42F2
87         name = 'EBMLMaxIDLength'
88         type = UINT
89         mandatory = True
90         default = 4
91
92
93 class EBMLMaxSizeLengthElement(Element):
94         id = 0x42F3
95         name = 'EBMLMaxSizeLength'
96         type = UINT
97         mandatory = True
98         default = 8
99
100
101 class DocTypeElement(Element):
102         id = 0x4282
103         name = 'DocType'
104         type = STRING
105         mandatory = True
106
107
108 class DocTypeVersionElement(Element):
109         id = 0x4287
110         name = 'DocTypeVersion'
111         type = UINT
112         mandatory = True
113
114
115 class DocTypeReadVersionElement(Element):
116         id = 0x4285
117         name = 'DocTypeReadVersion'
118         type = UINT
119         mandatory = True
120
121
122 class EBMLElement(Element):
123         id = 0x1A45DFA3
124         name = 'EBML'
125         type = CONTAINER
126         children = (EBMLVersionElement, EBMLReadVersionElement, EBMLMaxIDLengthElement, EBMLMaxSizeLengthElement, DocTypeElement, DocTypeVersionElement, DocTypeReadVersionElement)
127         mandatory = True
128         multiple = True
129
130
131 class EBMLDocument(Document):
132         children = (EBMLElement,)
133         globals = (CRC32Element, VoidElement, SignatureSlotElement)