id3tag 0.10.1 → 0.14.0

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