summaryrefslogtreecommitdiffstats
path: root/libk3b/k3bimage.xsd
blob: ab7f36cbb8b637af6195642b29bdbd36b71f5c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!--
 This document describes the layout of the toc.xml file in a K3b image archive.
 A K3b image archive is a TAR archive with a simple layout as follows.

 Every K3b image archive contains the toc.xml file as described in this document
 which describes the layout of the CD or DVD saved in the K3b image archive.
 Additionally the K3b image archive contains an arbitrary number of files which
 contain the CD/DVD sector data. These files are referenced in the elements of
 type "file".

 The most simple K3b image archive may look as follows:
 Archive
   |- toc.xml
   |- image.iso
 and the toc.xml may look as follows:
   <image>
     <numsessions>1</numsessions>
     <numtracks>1</numtracks>
     <session number="1">
       <numtracks>1</numtracks>
       <track number="1" type="Data Mode1">
         <data sectorsize="2048">
           <file>image.iso</file>
         </data>
       </track>
     </session>
   </image>


 We used tar as a backend because K3b image archives tend to get really big when it
 comes to DVD images and ZIP does not support archives bigger than 2 GB.
 Although tar supports files bigger than 2 GB (inside the archive) K3b splits every
 track bigger than 1 GB into chunks of 1 GB to avoid any problems with big filesizes.
-->

   
<!-- FIXME: introduce a version field! -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	   targetNamespace="http://www.k3b.org"
	   xmlns="http://www.k3b.org"
	   elementFormDefault="qualified">

<!-- THE TYPES -->
	<xs:simpleType name="tracktype">
		<xs:restriction base="xs:string">
			<xs:enumeration value="Audio" />
			<xs:enumeration value="Data Mode1" />
			<xs:enumeration value="Data Mode2" />
			<xs:enumeration value="Data XA Form1" />
			<xs:enumeration value="Data XA Form2" />
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="sector_size">
		<xs:restriction base="xs:integer">
			<xs:enumeration value="2048" /> <!-- Mode1/Mode2 Form1/DVD: plain user data -->
			<xs:enumeration value="2056" /> <!-- Mode2 Form1: 2048 bytes user data + 8 bytes sub header FIXME: or does this include 4 bytes crc? -->
			<xs:enumeration value="2324" /> <!-- Mode2 Form2: plain user data -->
			<xs:enumeration value="2332" /> <!-- Mode2 Form2: 2324 bytes user data + 8 bytes sub header FIXME: or does this include 4 bytes crc? -->
			<xs:enumeration value="2352" /> <!-- Audio: 16bit, stereo, 44100Hz, big endian -->
			<xs:enumeration value="2448" /> <!-- Raw data -->
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="filecontents">
		<xs:simpleContent>
			<!-- Filename in the image archive. -->
			<xs:extension base="xs:string">
				<!-- The start_sector allows for multiple tracks including the CD-TEXT to be defined in one file. Default: 0 -->
				<xs:attribute name="start_offset" type="xs:nonNegativeInteger" use="optional" />
				
				<!-- The number of bytes to be used. Default: up to end of the file -->
				<xs:attribute name="length" type="xs:positiveInteger" use="optional" />		
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:simpleType name="catalogname">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{13}" />
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="isrcname">
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Z0-9]{5}[0-9]{7}" />
		</xs:restriction>
	</xs:simpleType>



<!-- THE IMAGE DEFINITION -->

	<xs:element name="image">
		<xs:complexType>
			<xs:sequence>
				<!-- Number of session for convinience -->
				<xs:element name="numsessions" type="xs:positiveInteger" />

				<!-- Number of tracks for convinience -->
				<xs:element name="numtracks" type="xs:positiveInteger" />

				<!-- CD-TEXT is always stored in binary form -->
				<xs:element name="cdtext" type="filecontents" minOccurs="0" />

				<!-- The optional catalog name. -->
				<xs:element name="catalog" type="catalogname" minOccurs="0" />

				<!-- The tracks are splitted into sessions. In most cases there will only be one session. -->
				<xs:element name="session" maxOccurs="99"> <!-- FIXME: what is the real max here? -->
					<xs:complexType>
						<xs:sequence>
							<!-- Number of tracks in this session for convinience -->
							<xs:element name="numtracks" type="xs:positiveInteger" />

							<!-- And here come the tracks. -->
							<xs:element name="track" maxOccurs="99">
								<xs:complexType>
									<xs:sequence>
										<!-- The data tag contains file elements specifying where to find the data for the track.
										     The data may span over multiple files but all need to have the same sector size. -->
										<xs:element name="data" minOccurs="1" maxOccurs="1">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="file" type="filecontents" />
												</xs:sequence>
												<xs:attribute name="sectorsize" type="sector_size" />
											</xs:complexType>
										</xs:element>
										
										<!-- The index tag contains the start sector of the index relative to the start of the track. -->
										<xs:element name="index" minOccurs="0" maxOccurs="100">
											<xs:complexType>
												<xs:simpleContent>
													<xs:extension base="xs:nonNegativeInteger">
														<xs:attribute name="number" type="xs:nonNegativeInteger" />
													</xs:extension>
												</xs:simpleContent>
											</xs:complexType>
										</xs:element>
										
										<!-- Pre emphasis. -->
										<xs:element name="preemp" type="xs:boolean" minOccurs="0" default="false" />
										
										<!-- Copy permitted. -->
										<xs:element name="copy" type="xs:boolean" minOccurs="0" default="true" />
										
										<!-- SCMS enabled (alternating copy control bit). Only useful in combination with
										     copy=true. -->
										<xs:element name="scms" type="xs:boolean" minOccurs="0" default="false" />
										
										<xs:element name="isrc" type="isrcname" minOccurs="0" />
									</xs:sequence>

									<!-- The track number for convinience. -->
									<xs:attribute name="number" type="xs:positiveInteger" />

									<!-- Type of the track as defined above. -->
									<xs:attribute name="type" type="tracktype" />
								</xs:complexType>
							</xs:element>
						</xs:sequence>

						<!-- The session number for convinience. There is one special case in which the first session's number may be
                                                     bigger than 1. It is used internally by K3b to indicate that the image contains a session to be appended
                                                     to a multisession CD or DVD. It cannot be used in another situation since the data does only fit for the
                                                     multisession CD or DVD it was created for. -->
						<xs:attribute name="number" type="xs:positiveInteger" />
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>