id3 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,742 @@
1
+ <HTML>
2
+ <HEAD>
3
+ <TITLE>ID3 tag version 2.4.0 - Main Structure</TITLE>
4
+ </HEAD>
5
+ <BODY BGCOLOR="#FFFFFF" TEXT="#000000" VLINK="#051271" LINK="#0000B1" ALINK="#A21600">
6
+ <PRE>
7
+
8
+ Informal standard M. Nilsson
9
+ Document: id3v2.4.0-structure.txt 16 September 2001
10
+
11
+
12
+ ID3 tag version 2.4.0 - Main Structure
13
+
14
+ Status of this document
15
+
16
+ This document is an informal standard and replaces the ID3v2.3.0
17
+ standard [ID3v2]. A formal standard will use another revision number
18
+ even if the content is identical to document. The contents in this
19
+ document may change for clarifications but never for added or altered
20
+ functionallity.
21
+
22
+ Distribution of this document is unlimited.
23
+
24
+
25
+ Abstract
26
+
27
+ This document describes the main structure of ID3v2.4.0, which is a
28
+ revised version of the ID3v2 informal standard [ID3v2] version
29
+ 2.3.0. The ID3v2 offers a flexible way of storing audio meta
30
+ information within the audio file itself. The information may be
31
+ technical information, such as equalisation curves, as well as
32
+ title, performer, copyright etc.
33
+
34
+ ID3v2.4.0 is meant to be as close as possible to ID3v2.3.0 in order
35
+ to allow for implementations to be revised as easily as possible.
36
+
37
+
38
+ 1. Table of contents
39
+
40
+ Status of this document
41
+ Abstract
42
+ 1. Table of contents
43
+ 2. Conventions in this document
44
+ 2. Standard overview
45
+ 3. ID3v2 overview
46
+ 3.1. ID3v2 header
47
+ 3.2. ID3v2 extended header
48
+ 3.3. Padding
49
+ 3.4. ID3v2 footer
50
+ 4. ID3v2 frames overview
51
+ 4.1. Frame header flags
52
+ 4.1.1. Frame status flags
53
+ 4.1.2. Frame format flags
54
+ 5. Tag location
55
+ 6. Unsynchronisation
56
+ 6.1. The unsynchronisation scheme
57
+ 6.2. Synchsafe integers
58
+ 7. Copyright
59
+ 8. References
60
+ 9. Author's Address
61
+
62
+
63
+ 2. Conventions in this document
64
+
65
+ Text within "" is a text string exactly as it appears in a tag.
66
+ Numbers preceded with $ are hexadecimal and numbers preceded with %
67
+ are binary. $xx is used to indicate a byte with unknown content. %x
68
+ is used to indicate a bit with unknown content. The most significant
69
+ bit (MSB) of a byte is called 'bit 7' and the least significant bit
70
+ (LSB) is called 'bit 0'.
71
+
72
+ A tag is the whole tag described in this document. A frame is a block
73
+ of information in the tag. The tag consists of a header, frames and
74
+ optional padding. A field is a piece of information; one value, a
75
+ string etc. A numeric string is a string that consists of the
76
+ characters "0123456789" only.
77
+
78
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
79
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
80
+ document are to be interpreted as described in RFC 2119 [KEYWORDS].
81
+
82
+
83
+ 3. ID3v2 overview
84
+
85
+ ID3v2 is a general tagging format for audio, which makes it possible
86
+ to store meta data about the audio inside the audio file itself. The
87
+ ID3 tag described in this document is mainly targeted at files
88
+ encoded with MPEG-1/2 layer I, MPEG-1/2 layer II, MPEG-1/2 layer III
89
+ and MPEG-2.5, but may work with other types of encoded audio or as a
90
+ stand alone format for audio meta data.
91
+
92
+ ID3v2 is designed to be as flexible and expandable as possible to
93
+ meet new meta information needs that might arise. To achieve that
94
+ ID3v2 is constructed as a container for several information blocks,
95
+ called frames, whose format need not be known to the software that
96
+ encounters them. At the start of every frame is an unique and
97
+ predefined identifier, a size descriptor that allows software to skip
98
+ unknown frames and a flags field. The flags describes encoding
99
+ details and if the frame should remain in the tag, should it be
100
+ unknown to the software, if the file is altered.
101
+
102
+ The bitorder in ID3v2 is most significant bit first (MSB). The
103
+ byteorder in multibyte numbers is most significant byte first (e.g.
104
+ $12345678 would be encoded $12 34 56 78), also known as big endian
105
+ and network byte order.
106
+
107
+ Overall tag structure:
108
+
109
+ +-----------------------------+
110
+ | Header (10 bytes) |
111
+ +-----------------------------+
112
+ | Extended Header |
113
+ | (variable length, OPTIONAL) |
114
+ +-----------------------------+
115
+ | Frames (variable length) |
116
+ +-----------------------------+
117
+ | Padding |
118
+ | (variable length, OPTIONAL) |
119
+ +-----------------------------+
120
+ | Footer (10 bytes, OPTIONAL) |
121
+ +-----------------------------+
122
+
123
+ In general, padding and footer are mutually exclusive. See details in
124
+ sections 3.3, 3.4 and 5.
125
+
126
+
127
+ 3.1. ID3v2 header
128
+
129
+ The first part of the ID3v2 tag is the 10 byte tag header, laid out
130
+ as follows:
131
+
132
+ ID3v2/file identifier "ID3"
133
+ ID3v2 version $04 00
134
+ ID3v2 flags %abcd0000
135
+ ID3v2 size 4 * %0xxxxxxx
136
+
137
+ The first three bytes of the tag are always "ID3", to indicate that
138
+ this is an ID3v2 tag, directly followed by the two version bytes. The
139
+ first byte of ID3v2 version is its major version, while the second
140
+ byte is its revision number. In this case this is ID3v2.4.0. All
141
+ revisions are backwards compatible while major versions are not. If
142
+ software with ID3v2.4.0 and below support should encounter version
143
+ five or higher it should simply ignore the whole tag. Version or
144
+ revision will never be $FF.
145
+
146
+ The version is followed by the ID3v2 flags field, of which currently
147
+ four flags are used.
148
+
149
+
150
+ a - Unsynchronisation
151
+
152
+ Bit 7 in the 'ID3v2 flags' indicates whether or not
153
+ unsynchronisation is applied on all frames (see section 6.1 for
154
+ details); a set bit indicates usage.
155
+
156
+
157
+ b - Extended header
158
+
159
+ The second bit (bit 6) indicates whether or not the header is
160
+ followed by an extended header. The extended header is described in
161
+ section 3.2. A set bit indicates the presence of an extended
162
+ header.
163
+
164
+
165
+ c - Experimental indicator
166
+
167
+ The third bit (bit 5) is used as an 'experimental indicator'. This
168
+ flag SHALL always be set when the tag is in an experimental stage.
169
+
170
+
171
+ d - Footer present
172
+
173
+ Bit 4 indicates that a footer (section 3.4) is present at the very
174
+ end of the tag. A set bit indicates the presence of a footer.
175
+
176
+
177
+ All the other flags MUST be cleared. If one of these undefined flags
178
+ are set, the tag might not be readable for a parser that does not
179
+ know the flags function.
180
+
181
+ The ID3v2 tag size is stored as a 32 bit synchsafe integer (section
182
+ 6.2), making a total of 28 effective bits (representing up to 256MB).
183
+
184
+ The ID3v2 tag size is the sum of the byte length of the extended
185
+ header, the padding and the frames after unsynchronisation. If a
186
+ footer is present this equals to ('total size' - 20) bytes, otherwise
187
+ ('total size' - 10) bytes.
188
+
189
+ An ID3v2 tag can be detected with the following pattern:
190
+ $49 44 33 yy yy xx zz zz zz zz
191
+ Where yy is less than $FF, xx is the 'flags' byte and zz is less than
192
+ $80.
193
+
194
+
195
+ 3.2. Extended header
196
+
197
+ The extended header contains information that can provide further
198
+ insight in the structure of the tag, but is not vital to the correct
199
+ parsing of the tag information; hence the extended header is
200
+ optional.
201
+
202
+ Extended header size 4 * %0xxxxxxx
203
+ Number of flag bytes $01
204
+ Extended Flags $xx
205
+
206
+ Where the 'Extended header size' is the size of the whole extended
207
+ header, stored as a 32 bit synchsafe integer. An extended header can
208
+ thus never have a size of fewer than six bytes.
209
+
210
+ The extended flags field, with its size described by 'number of flag
211
+ bytes', is defined as:
212
+
213
+ %0bcd0000
214
+
215
+ Each flag that is set in the extended header has data attached, which
216
+ comes in the order in which the flags are encountered (i.e. the data
217
+ for flag 'b' comes before the data for flag 'c'). Unset flags cannot
218
+ have any attached data. All unknown flags MUST be unset and their
219
+ corresponding data removed when a tag is modified.
220
+
221
+ Every set flag's data starts with a length byte, which contains a
222
+ value between 0 and 127 ($00 - $7f), followed by data that has the
223
+ field length indicated by the length byte. If a flag has no attached
224
+ data, the value $00 is used as length byte.
225
+
226
+
227
+ b - Tag is an update
228
+
229
+ If this flag is set, the present tag is an update of a tag found
230
+ earlier in the present file or stream. If frames defined as unique
231
+ are found in the present tag, they are to override any
232
+ corresponding ones found in the earlier tag. This flag has no
233
+ corresponding data.
234
+
235
+ Flag data length $00
236
+
237
+ c - CRC data present
238
+
239
+ If this flag is set, a CRC-32 [ISO-3309] data is included in the
240
+ extended header. The CRC is calculated on all the data between the
241
+ header and footer as indicated by the header's tag length field,
242
+ minus the extended header. Note that this includes the padding (if
243
+ there is any), but excludes the footer. The CRC-32 is stored as an
244
+ 35 bit synchsafe integer, leaving the upper four bits always
245
+ zeroed.
246
+
247
+ Flag data length $05
248
+ Total frame CRC 5 * %0xxxxxxx
249
+
250
+ d - Tag restrictions
251
+
252
+ For some applications it might be desired to restrict a tag in more
253
+ ways than imposed by the ID3v2 specification. Note that the
254
+ presence of these restrictions does not affect how the tag is
255
+ decoded, merely how it was restricted before encoding. If this flag
256
+ is set the tag is restricted as follows:
257
+
258
+ Flag data length $01
259
+ Restrictions %ppqrrstt
260
+
261
+ p - Tag size restrictions
262
+
263
+ 00 No more than 128 frames and 1 MB total tag size.
264
+ 01 No more than 64 frames and 128 KB total tag size.
265
+ 10 No more than 32 frames and 40 KB total tag size.
266
+ 11 No more than 32 frames and 4 KB total tag size.
267
+
268
+ q - Text encoding restrictions
269
+
270
+ 0 No restrictions
271
+ 1 Strings are only encoded with ISO-8859-1 [ISO-8859-1] or
272
+ UTF-8 [UTF-8].
273
+
274
+ r - Text fields size restrictions
275
+
276
+ 00 No restrictions
277
+ 01 No string is longer than 1024 characters.
278
+ 10 No string is longer than 128 characters.
279
+ 11 No string is longer than 30 characters.
280
+
281
+ Note that nothing is said about how many bytes is used to
282
+ represent those characters, since it is encoding dependent. If a
283
+ text frame consists of more than one string, the sum of the
284
+ strungs is restricted as stated.
285
+
286
+ s - Image encoding restrictions
287
+
288
+ 0 No restrictions
289
+ 1 Images are encoded only with PNG [PNG] or JPEG [JFIF].
290
+
291
+ t - Image size restrictions
292
+
293
+ 00 No restrictions
294
+ 01 All images are 256x256 pixels or smaller.
295
+ 10 All images are 64x64 pixels or smaller.
296
+ 11 All images are exactly 64x64 pixels, unless required
297
+ otherwise.
298
+
299
+
300
+ 3.3. Padding
301
+
302
+ It is OPTIONAL to include padding after the final frame (at the end
303
+ of the ID3 tag), making the size of all the frames together smaller
304
+ than the size given in the tag header. A possible purpose of this
305
+ padding is to allow for adding a few additional frames or enlarge
306
+ existing frames within the tag without having to rewrite the entire
307
+ file. The value of the padding bytes must be $00. A tag MUST NOT have
308
+ any padding between the frames or between the tag header and the
309
+ frames. Furthermore it MUST NOT have any padding when a tag footer is
310
+ added to the tag.
311
+
312
+
313
+ 3.4. ID3v2 footer
314
+
315
+ To speed up the process of locating an ID3v2 tag when searching from
316
+ the end of a file, a footer can be added to the tag. It is REQUIRED
317
+ to add a footer to an appended tag, i.e. a tag located after all
318
+ audio data. The footer is a copy of the header, but with a different
319
+ identifier.
320
+
321
+ ID3v2 identifier "3DI"
322
+ ID3v2 version $04 00
323
+ ID3v2 flags %abcd0000
324
+ ID3v2 size 4 * %0xxxxxxx
325
+
326
+
327
+ 4. ID3v2 frame overview
328
+
329
+ All ID3v2 frames consists of one frame header followed by one or more
330
+ fields containing the actual information. The header is always 10
331
+ bytes and laid out as follows:
332
+
333
+ Frame ID $xx xx xx xx (four characters)
334
+ Size 4 * %0xxxxxxx
335
+ Flags $xx xx
336
+
337
+ The frame ID is made out of the characters capital A-Z and 0-9.
338
+ Identifiers beginning with "X", "Y" and "Z" are for experimental
339
+ frames and free for everyone to use, without the need to set the
340
+ experimental bit in the tag header. Bear in mind that someone else
341
+ might have used the same identifier as you. All other identifiers are
342
+ either used or reserved for future use.
343
+
344
+ The frame ID is followed by a size descriptor containing the size of
345
+ the data in the final frame, after encryption, compression and
346
+ unsynchronisation. The size is excluding the frame header ('total
347
+ frame size' - 10 bytes) and stored as a 32 bit synchsafe integer.
348
+
349
+ In the frame header the size descriptor is followed by two flag
350
+ bytes. These flags are described in section 4.1.
351
+
352
+ There is no fixed order of the frames' appearance in the tag,
353
+ although it is desired that the frames are arranged in order of
354
+ significance concerning the recognition of the file. An example of
355
+ such order: UFID, TIT2, MCDI, TRCK ...
356
+
357
+ A tag MUST contain at least one frame. A frame must be at least 1
358
+ byte big, excluding the header.
359
+
360
+ If nothing else is said, strings, including numeric strings and URLs
361
+ [URL], are represented as ISO-8859-1 [ISO-8859-1] characters in the
362
+ range $20 - $FF. Such strings are represented in frame descriptions
363
+ as <text string>, or <full text string> if newlines are allowed. If
364
+ nothing else is said newline character is forbidden. In ISO-8859-1 a
365
+ newline is represented, when allowed, with $0A only.
366
+
367
+ Frames that allow different types of text encoding contains a text
368
+ encoding description byte. Possible encodings:
369
+
370
+ $00 ISO-8859-1 [ISO-8859-1]. Terminated with $00.
371
+ $01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All
372
+ strings in the same frame SHALL have the same byteorder.
373
+ Terminated with $00 00.
374
+ $02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM.
375
+ Terminated with $00 00.
376
+ $03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.
377
+
378
+ Strings dependent on encoding are represented in frame descriptions
379
+ as <text string according to encoding>, or <full text string
380
+ according to encoding> if newlines are allowed. Any empty strings of
381
+ type $01 which are NULL-terminated may have the Unicode BOM followed
382
+ by a Unicode NULL ($FF FE 00 00 or $FE FF 00 00).
383
+
384
+ The timestamp fields are based on a subset of ISO 8601. When being as
385
+ precise as possible the format of a time string is
386
+ yyyy-MM-ddTHH:mm:ss (year, "-", month, "-", day, "T", hour (out of
387
+ 24), ":", minutes, ":", seconds), but the precision may be reduced by
388
+ removing as many time indicators as wanted. Hence valid timestamps
389
+ are
390
+ yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddTHH, yyyy-MM-ddTHH:mm and
391
+ yyyy-MM-ddTHH:mm:ss. All time stamps are UTC. For durations, use
392
+ the slash character as described in 8601, and for multiple non-
393
+ contiguous dates, use multiple strings, if allowed by the frame
394
+ definition.
395
+
396
+ The three byte language field, present in several frames, is used to
397
+ describe the language of the frame's content, according to ISO-639-2
398
+ [ISO-639-2]. The language should be represented in lower case. If the
399
+ language is not known the string "XXX" should be used.
400
+
401
+ All URLs [URL] MAY be relative, e.g. "picture.png", "../doc.txt".
402
+
403
+ If a frame is longer than it should be, e.g. having more fields than
404
+ specified in this document, that indicates that additions to the
405
+ frame have been made in a later version of the ID3v2 standard. This
406
+ is reflected by the revision number in the header of the tag.
407
+
408
+
409
+ 4.1. Frame header flags
410
+
411
+ In the frame header the size descriptor is followed by two flag
412
+ bytes. All unused flags MUST be cleared. The first byte is for
413
+ 'status messages' and the second byte is a format description. If an
414
+ unknown flag is set in the first byte the frame MUST NOT be changed
415
+ without that bit cleared. If an unknown flag is set in the second
416
+ byte the frame is likely to not be readable. Some flags in the second
417
+ byte indicates that extra information is added to the header. These
418
+ fields of extra information is ordered as the flags that indicates
419
+ them. The flags field is defined as follows (l and o left out because
420
+ ther resemblence to one and zero):
421
+
422
+ %0abc0000 %0h00kmnp
423
+
424
+ Some frame format flags indicate that additional information fields
425
+ are added to the frame. This information is added after the frame
426
+ header and before the frame data in the same order as the flags that
427
+ indicates them. I.e. the four bytes of decompressed size will precede
428
+ the encryption method byte. These additions affects the 'frame size'
429
+ field, but are not subject to encryption or compression.
430
+
431
+ The default status flags setting for a frame is, unless stated
432
+ otherwise, 'preserved if tag is altered' and 'preserved if file is
433
+ altered', i.e. %00000000.
434
+
435
+
436
+ 4.1.1. Frame status flags
437
+
438
+ a - Tag alter preservation
439
+
440
+ This flag tells the tag parser what to do with this frame if it is
441
+ unknown and the tag is altered in any way. This applies to all
442
+ kinds of alterations, including adding more padding and reordering
443
+ the frames.
444
+
445
+ 0 Frame should be preserved.
446
+ 1 Frame should be discarded.
447
+
448
+
449
+ b - File alter preservation
450
+
451
+ This flag tells the tag parser what to do with this frame if it is
452
+ unknown and the file, excluding the tag, is altered. This does not
453
+ apply when the audio is completely replaced with other audio data.
454
+
455
+ 0 Frame should be preserved.
456
+ 1 Frame should be discarded.
457
+
458
+
459
+ c - Read only
460
+
461
+ This flag, if set, tells the software that the contents of this
462
+ frame are intended to be read only. Changing the contents might
463
+ break something, e.g. a signature. If the contents are changed,
464
+ without knowledge of why the frame was flagged read only and
465
+ without taking the proper means to compensate, e.g. recalculating
466
+ the signature, the bit MUST be cleared.
467
+
468
+
469
+ 4.1.2. Frame format flags
470
+
471
+ h - Grouping identity
472
+
473
+ This flag indicates whether or not this frame belongs in a group
474
+ with other frames. If set, a group identifier byte is added to the
475
+ frame. Every frame with the same group identifier belongs to the
476
+ same group.
477
+
478
+ 0 Frame does not contain group information
479
+ 1 Frame contains group information
480
+
481
+
482
+ k - Compression
483
+
484
+ This flag indicates whether or not the frame is compressed.
485
+ A 'Data Length Indicator' byte MUST be included in the frame.
486
+
487
+ 0 Frame is not compressed.
488
+ 1 Frame is compressed using zlib [zlib] deflate method.
489
+ If set, this requires the 'Data Length Indicator' bit
490
+ to be set as well.
491
+
492
+
493
+ m - Encryption
494
+
495
+ This flag indicates whether or not the frame is encrypted. If set,
496
+ one byte indicating with which method it was encrypted will be
497
+ added to the frame. See description of the ENCR frame for more
498
+ information about encryption method registration. Encryption
499
+ should be done after compression. Whether or not setting this flag
500
+ requires the presence of a 'Data Length Indicator' depends on the
501
+ specific algorithm used.
502
+
503
+ 0 Frame is not encrypted.
504
+ 1 Frame is encrypted.
505
+
506
+ n - Unsynchronisation
507
+
508
+ This flag indicates whether or not unsynchronisation was applied
509
+ to this frame. See section 6 for details on unsynchronisation.
510
+ If this flag is set all data from the end of this header to the
511
+ end of this frame has been unsynchronised. Although desirable, the
512
+ presence of a 'Data Length Indicator' is not made mandatory by
513
+ unsynchronisation.
514
+
515
+ 0 Frame has not been unsynchronised.
516
+ 1 Frame has been unsyrchronised.
517
+
518
+ p - Data length indicator
519
+
520
+ This flag indicates that a data length indicator has been added to
521
+ the frame. The data length indicator is the value one would write
522
+ as the 'Frame length' if all of the frame format flags were
523
+ zeroed, represented as a 32 bit synchsafe integer.
524
+
525
+ 0 There is no Data Length Indicator.
526
+ 1 A data length Indicator has been added to the frame.
527
+
528
+
529
+ 5. Tag location
530
+
531
+ The default location of an ID3v2 tag is prepended to the audio so
532
+ that players can benefit from the information when the data is
533
+ streamed. It is however possible to append the tag, or make a
534
+ prepend/append combination. When deciding upon where an unembedded
535
+ tag should be located, the following order of preference SHOULD be
536
+ considered.
537
+
538
+ 1. Prepend the tag.
539
+
540
+ 2. Prepend a tag with all vital information and add a second tag at
541
+ the end of the file, before tags from other tagging systems. The
542
+ first tag is required to have a SEEK frame.
543
+
544
+ 3. Add a tag at the end of the file, before tags from other tagging
545
+ systems.
546
+
547
+ In case 2 and 3 the tag can simply be appended if no other known tags
548
+ are present. The suggested method to find ID3v2 tags are:
549
+
550
+ 1. Look for a prepended tag using the pattern found in section 3.1.
551
+
552
+ 2. If a SEEK frame was found, use its values to guide further
553
+ searching.
554
+
555
+ 3. Look for a tag footer, scanning from the back of the file.
556
+
557
+ For every new tag that is found, the old tag should be discarded
558
+ unless the update flag in the extended header (section 3.2) is set.
559
+
560
+
561
+ 6. Unsynchronisation
562
+
563
+ The only purpose of unsynchronisation is to make the ID3v2 tag as
564
+ compatible as possible with existing software and hardware. There is
565
+ no use in 'unsynchronising' tags if the file is only to be processed
566
+ only by ID3v2 aware software and hardware. Unsynchronisation is only
567
+ useful with tags in MPEG 1/2 layer I, II and III, MPEG 2.5 and AAC
568
+ files.
569
+
570
+
571
+ 6.1. The unsynchronisation scheme
572
+
573
+ Whenever a false synchronisation is found within the tag, one zeroed
574
+ byte is inserted after the first false synchronisation byte. The
575
+ format of synchronisations that should be altered by ID3 encoders is
576
+ as follows:
577
+
578
+ %11111111 111xxxxx
579
+
580
+ and should be replaced with:
581
+
582
+ %11111111 00000000 111xxxxx
583
+
584
+ This has the side effect that all $FF 00 combinations have to be
585
+ altered, so they will not be affected by the decoding process.
586
+ Therefore all the $FF 00 combinations have to be replaced with the
587
+ $FF 00 00 combination during the unsynchronisation.
588
+
589
+ To indicate usage of the unsynchronisation, the unsynchronisation
590
+ flag in the frame header should be set. This bit MUST be set if the
591
+ frame was altered by the unsynchronisation and SHOULD NOT be set if
592
+ unaltered. If all frames in the tag are unsynchronised the
593
+ unsynchronisation flag in the tag header SHOULD be set. It MUST NOT
594
+ be set if the tag has a frame which is not unsynchronised.
595
+
596
+ Assume the first byte of the audio to be $FF. The special case when
597
+ the last byte of the last frame is $FF and no padding nor footer is
598
+ used will then introduce a false synchronisation. This can be solved
599
+ by adding a footer, adding padding or unsynchronising the frame and
600
+ add $00 to the end of the frame data, thus adding more byte to the
601
+ frame size than a normal unsynchronisation would. Although not
602
+ preferred, it is allowed to apply the last method on all frames
603
+ ending with $FF.
604
+
605
+ It is preferred that the tag is either completely unsynchronised or
606
+ not unsynchronised at all. A completely unsynchronised tag has no
607
+ false synchonisations in it, as defined above, and does not end with
608
+ $FF. A completely non-unsynchronised tag contains no unsynchronised
609
+ frames, and thus the unsynchronisation flag in the header is cleared.
610
+
611
+ Do bear in mind, that if compression or encryption is used, the
612
+ unsynchronisation scheme MUST be applied afterwards. When decoding an
613
+ unsynchronised frame, the unsynchronisation scheme MUST be reversed
614
+ first, encryption and decompression afterwards.
615
+
616
+
617
+ 6.2. Synchsafe integers
618
+
619
+ In some parts of the tag it is inconvenient to use the
620
+ unsychronisation scheme because the size of unsynchronised data is
621
+ not known in advance, which is particularly problematic with size
622
+ descriptors. The solution in ID3v2 is to use synchsafe integers, in
623
+ which there can never be any false synchs. Synchsafe integers are
624
+ integers that keep its highest bit (bit 7) zeroed, making seven bits
625
+ out of eight available. Thus a 32 bit synchsafe integer can store 28
626
+ bits of information.
627
+
628
+ Example:
629
+
630
+ 255 (%11111111) encoded as a 16 bit synchsafe integer is 383
631
+ (%00000001 01111111).
632
+
633
+
634
+ 7. Copyright
635
+
636
+ Copyright (C) Martin Nilsson 2000. All Rights Reserved.
637
+
638
+ This document and translations of it may be copied and furnished to
639
+ others, and derivative works that comment on or otherwise explain it
640
+ or assist in its implementation may be prepared, copied, published
641
+ and distributed, in whole or in part, without restriction of any
642
+ kind, provided that a reference to this document is included on all
643
+ such copies and derivative works. However, this document itself may
644
+ not be modified in any way and reissued as the original document.
645
+
646
+ The limited permissions granted above are perpetual and will not be
647
+ revoked.
648
+
649
+ This document and the information contained herein is provided on an
650
+ 'AS IS' basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR
651
+ IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
652
+ THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
653
+ WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
654
+
655
+
656
+ 8. References
657
+
658
+ [ID3v2] Martin Nilsson, 'ID3v2 informal standard'.
659
+
660
+ http://www.id3lib.org/id3/id3v2.3.0.txt
661
+
662
+ [ISO-639-2] ISO/FDIS 639-2.
663
+ 'Codes for the representation of names of languages, Part 2: Alpha-3
664
+ code.' Technical committee / subcommittee: TC 37 / SC 2
665
+
666
+ [ISO-3309] ISO 3309
667
+ 'Information Processing Systems--Data Communication High-Level Data
668
+ Link Control Procedure--Frame Structure', IS 3309, October 1984, 3rd
669
+ Edition.
670
+
671
+ [ISO-8859-1] ISO/IEC DIS 8859-1.
672
+ '8-bit single-byte coded graphic character sets, Part 1: Latin
673
+ alphabet No. 1.' Technical committee / subcommittee: JTC 1 / SC 2
674
+
675
+ [JFIF] 'JPEG File Interchange Format, version 1.02'
676
+
677
+ http://www.w3.org/Graphics/JPEG/jfif.txt
678
+
679
+ [KEYWORDS] S. Bradner, 'Key words for use in RFCs to Indicate
680
+ Requirement Levels', RFC 2119, March 1997.
681
+
682
+ ftp://ftp.isi.edu/in-notes/rfc2119.txt
683
+
684
+ [MPEG] ISO/IEC 11172-3:1993.
685
+ 'Coding of moving pictures and associated audio for digital storage
686
+ media at up to about 1,5 Mbit/s, Part 3: Audio.'
687
+ Technical committee / subcommittee: JTC 1 / SC 29
688
+ and
689
+ ISO/IEC 13818-3:1995
690
+ 'Generic coding of moving pictures and associated audio information,
691
+ Part 3: Audio.'
692
+ Technical committee / subcommittee: JTC 1 / SC 29
693
+ and
694
+ ISO/IEC DIS 13818-3
695
+ 'Generic coding of moving pictures and associated audio information,
696
+ Part 3: Audio (Revision of ISO/IEC 13818-3:1995)'
697
+
698
+ [PNG] 'Portable Network Graphics, version 1.0'
699
+
700
+ http://www.w3.org/TR/REC-png-multi.html
701
+
702
+ [UNICODE] The Unicode Consortium,
703
+ 'The Unicode Standard Version 3.0', ISBN 0-201-61633-5.
704
+
705
+ http://www.unicode.org/unicode/standard/versions/Unicode3.0.htm">http://www.unicode.org/unicode/standard/versions/Unicode3.0.htm
706
+
707
+ [URL] T. Berners-Lee, L. Masinter & M. McCahill, 'Uniform Resource
708
+ Locators (URL)', RFC 1738, December 1994.
709
+
710
+ ftp://ftp.isi.edu/in-notes/rfc1738.txt
711
+
712
+ [UTF-8] F. Yergeau, 'UTF-8, a transformation format of ISO 10646',
713
+ RFC 2279, January 1998.
714
+
715
+ ftp://ftp.isi.edu/in-notes/rfc2279.txt">ftp://ftp.isi.edu/in-notes/rfc2279.txt
716
+
717
+ [UTF-16] F. Yergeau, 'UTF-16, an encoding of ISO 10646', RFC 2781,
718
+ February 2000.
719
+
720
+ ftp://ftp.isi.edu/in-notes/rfc2781.txt
721
+
722
+ [ZLIB] P. Deutsch, Aladdin Enterprises & J-L. Gailly, 'ZLIB
723
+ Compressed Data Format Specification version 3.3', RFC 1950,
724
+ May 1996.
725
+
726
+ ftp://ftp.isi.edu/in-notes/rfc1950.txt
727
+
728
+
729
+ 9. Author's Address
730
+
731
+ Written by
732
+
733
+ Martin Nilsson
734
+ Rydsv�gen 246 C. 30
735
+ SE-584 34 Link�ping
736
+ Sweden
737
+
738
+ Email: nilsson@id3.org
739
+
740
+ </PRE>
741
+ </BODY>
742
+ </HTML>