rtaglib 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -3
- data/README.txt +21 -2
- data/Rakefile +15 -10
- data/ext/tagfile/extconf.rb +6 -0
- data/ext/taglib/extconf.rb +11 -4
- data/ext/taglib/taglib.cxx +1670 -548
- data/lib/TagLib.rb +7 -2
- data/lib/TagLib_doc.rb +1489 -1369
- data/swig/Rakefile +2 -5
- data/swig/extconf.rb +11 -4
- data/swig/taglib.i +105 -43
- data/swig/test.rb +59 -3
- data/test/test_taglib.rb +59 -3
- data/test/test_write.rb +9 -2
- metadata +2 -2
data/lib/TagLib.rb
CHANGED
data/lib/TagLib_doc.rb
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
#
|
7
7
|
#
|
8
8
|
module TagLib
|
9
|
-
class TagLib::
|
9
|
+
class TagLib::ItemListMap
|
10
10
|
def clear()
|
11
11
|
end
|
12
|
+
def isEmpty()
|
13
|
+
end
|
12
14
|
def size()
|
13
15
|
end
|
14
16
|
def empty?()
|
@@ -17,75 +19,122 @@
|
|
17
19
|
end
|
18
20
|
def contains()
|
19
21
|
end
|
20
|
-
def isEmpty()
|
21
|
-
end
|
22
22
|
def length()
|
23
23
|
end
|
24
24
|
end
|
25
25
|
# <b>
|
26
|
-
# A
|
26
|
+
# A list of strings. .</b>
|
27
27
|
#
|
28
28
|
#
|
29
|
-
# This is
|
29
|
+
# This is a spcialization of the List class with some members convention for string operations.
|
30
30
|
#
|
31
|
-
class TagLib::
|
32
|
-
def
|
31
|
+
class TagLib::StringList
|
32
|
+
def isEmpty()
|
33
|
+
end
|
34
|
+
def size()
|
35
|
+
end
|
36
|
+
def contains()
|
33
37
|
end
|
38
|
+
end
|
39
|
+
# <b>
|
40
|
+
# A wide string class suitable for unicode. .</b>
|
34
41
|
#
|
35
|
-
# Sets the comment to s. If s is String::null then this value will be cleared.
|
36
42
|
#
|
37
|
-
|
38
|
-
end
|
43
|
+
# This is an implicitly shared wide string. For storage it uses TagLib::wstring, but as this is an implementation detail this of course could change. Strings are stored internally as UTF-16BE. (Without the BOM (Byte Order Mark)The use of implicit sharing means that copying a string is cheap, the only cost comes into play when the copy is modified. Prior to that the string just has a pointer to the data of the parent String. This also makes this class suitable as a function return type.In addition to adding implicit sharing, this class keeps track of four possible encodings, which are the four supported by the ID3v2 standard.
|
39
44
|
#
|
40
|
-
|
45
|
+
class TagLib::String
|
41
46
|
#
|
42
|
-
|
47
|
+
# Creates and returns a C-String based on the data. This string is still owned by the String (class) and as such should not be deleted by the user.If unicode if false (the default) this string will be encoded in Latin1. If it is true the returned C-String will be UTF-8 encoded.This string remains valid until the String instance is destroyed or another export method is called.This however has the side effect that this C-String will remain in memory in addition to other memory that is consumed by the String instance. So, this method should not be used on large strings or where memory is critical.
|
48
|
+
#
|
49
|
+
#
|
50
|
+
def toCString(bool unicode = false)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
class TagLib::FieldListMap
|
54
|
+
def clear()
|
55
|
+
end
|
56
|
+
def isEmpty()
|
57
|
+
end
|
58
|
+
def size()
|
59
|
+
end
|
60
|
+
def empty?()
|
61
|
+
end
|
62
|
+
def insert()
|
63
|
+
end
|
64
|
+
def contains()
|
65
|
+
end
|
66
|
+
def length()
|
67
|
+
end
|
68
|
+
def []()
|
43
69
|
end
|
70
|
+
end
|
71
|
+
# <b>
|
72
|
+
# This class provides a simple abstraction for creating and handling files. .</b>
|
44
73
|
#
|
45
|
-
# Returns the year; if there is no year set, this will return 0.
|
46
74
|
#
|
47
|
-
|
75
|
+
# FileRef exists to provide a minimal, generic and value-based wrapper around a File. It is lightweight and implicitly shared, and as such suitable for pass-by-value use. This hides some of the uglier details of TagLib::File and the non-generic portions of the concrete file implementations.This class is useful in a "simple usage" situation where it is desirable to be able to get and set some of the tag information that is similar across file types.Also note that it is probably a good idea to plug this into your mime type system rather than using the constructor that accepts a file name using the FileTypeResolver.FileTypeResolver addFileTypeResolver()
|
76
|
+
#
|
77
|
+
#
|
78
|
+
class TagLib::FileRef
|
79
|
+
# Singleton methods
|
80
|
+
def self.defaultFileExtensions()
|
48
81
|
end
|
49
|
-
def
|
82
|
+
def null?()
|
50
83
|
end
|
51
84
|
#
|
52
|
-
#
|
85
|
+
# Returns a pointer to represented file's tag.This pointer will become invalid when this FileRef and all copies pass out of scope.
|
86
|
+
# File::tag()
|
87
|
+
#
|
53
88
|
#
|
54
|
-
def
|
89
|
+
def tag()
|
55
90
|
end
|
56
91
|
#
|
57
|
-
# Returns the
|
92
|
+
# Returns the audio properties for this FileRef. If no audio properties were read then this will returns a null pointer.
|
58
93
|
#
|
59
|
-
def
|
60
|
-
end
|
61
|
-
def year=()
|
62
|
-
end
|
63
|
-
def title=()
|
94
|
+
def audioProperties()
|
64
95
|
end
|
65
96
|
#
|
66
|
-
#
|
97
|
+
# Saves the file. Returns true on success.
|
67
98
|
#
|
68
|
-
def
|
99
|
+
def save()
|
69
100
|
end
|
70
101
|
#
|
71
|
-
#
|
102
|
+
# Returns true if the file (and as such other pointers) are null.
|
72
103
|
#
|
73
|
-
def
|
104
|
+
def isNull()
|
74
105
|
end
|
75
106
|
#
|
76
|
-
# Returns the
|
107
|
+
# Returns a pointer to the file represented by this handler class.As a general rule this call should be avoided since if you need to work with file objects directly, you are probably better served instantiating the File subclasses (i.e. MPEG::File) manually and working with their APIs.This handle exists to provide a minimal, generic and value-based wrapper around a File. Accessing the file directly generally indicates a moving away from this simplicity (and into things beyond the scope of FileRef).This pointer will become invalid when this FileRef and all copies pass out of scope.
|
108
|
+
#
|
77
109
|
#
|
78
|
-
def
|
110
|
+
def file()
|
111
|
+
end
|
112
|
+
end
|
113
|
+
class TagLib::FrameListMap
|
114
|
+
def clear()
|
115
|
+
end
|
116
|
+
def isEmpty()
|
117
|
+
end
|
118
|
+
def size()
|
79
119
|
end
|
80
120
|
def empty?()
|
81
121
|
end
|
82
|
-
|
83
|
-
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
84
|
-
#
|
85
|
-
def artist()
|
122
|
+
def insert()
|
86
123
|
end
|
87
|
-
def
|
124
|
+
def contains()
|
125
|
+
end
|
126
|
+
def length()
|
88
127
|
end
|
128
|
+
def []()
|
129
|
+
end
|
130
|
+
end
|
131
|
+
# <b>
|
132
|
+
# A simple, generic interface to common audio meta data fields. .</b>
|
133
|
+
#
|
134
|
+
#
|
135
|
+
# This is an attempt to abstract away the difference in the meta data formats of various audio codecs and tagging schemes. As such it is generally a subset of what is available in the specific formats but should be suitable for most applications. This is meant to compliment the generic APIs found in TagLib::AudioProperties, TagLib::File and TagLib::FileRef.
|
136
|
+
#
|
137
|
+
class TagLib::Tag
|
89
138
|
def artist=()
|
90
139
|
end
|
91
140
|
#
|
@@ -103,6 +152,11 @@
|
|
103
152
|
#
|
104
153
|
def album()
|
105
154
|
end
|
155
|
+
#
|
156
|
+
# Returns the year; if there is no year set, this will return 0.
|
157
|
+
#
|
158
|
+
def year()
|
159
|
+
end
|
106
160
|
def album=()
|
107
161
|
end
|
108
162
|
#
|
@@ -110,6 +164,8 @@
|
|
110
164
|
#
|
111
165
|
def setAlbum( s)
|
112
166
|
end
|
167
|
+
def year=()
|
168
|
+
end
|
113
169
|
#
|
114
170
|
# Returns true if the tag does not contain any data. This should be reimplemented in subclasses that provide more than the basic tagging abilities in this class.
|
115
171
|
#
|
@@ -120,14 +176,64 @@
|
|
120
176
|
#
|
121
177
|
def genre()
|
122
178
|
end
|
179
|
+
def genre=()
|
180
|
+
end
|
181
|
+
#
|
182
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
183
|
+
#
|
184
|
+
def setComment( s)
|
185
|
+
end
|
186
|
+
#
|
187
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
188
|
+
#
|
189
|
+
def comment()
|
190
|
+
end
|
191
|
+
def empty?()
|
192
|
+
end
|
193
|
+
def comment=()
|
194
|
+
end
|
195
|
+
#
|
196
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
197
|
+
#
|
198
|
+
def track()
|
199
|
+
end
|
200
|
+
def track=()
|
201
|
+
end
|
202
|
+
#
|
203
|
+
# Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.
|
204
|
+
#
|
205
|
+
def setGenre( s)
|
206
|
+
end
|
207
|
+
#
|
208
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
209
|
+
#
|
210
|
+
def title()
|
211
|
+
end
|
212
|
+
def title=()
|
213
|
+
end
|
214
|
+
#
|
215
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
216
|
+
#
|
217
|
+
def setTitle( s)
|
218
|
+
end
|
219
|
+
#
|
220
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
221
|
+
#
|
222
|
+
def setYear(uint i)
|
223
|
+
end
|
224
|
+
#
|
225
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
226
|
+
#
|
227
|
+
def artist()
|
228
|
+
end
|
123
229
|
end
|
124
230
|
class TagLib::FrameList
|
231
|
+
def isEmpty()
|
232
|
+
end
|
125
233
|
def size()
|
126
234
|
end
|
127
235
|
def contains()
|
128
236
|
end
|
129
|
-
def isEmpty()
|
130
|
-
end
|
131
237
|
end
|
132
238
|
# <b>
|
133
239
|
# A simple, abstract interface to common audio properties. .</b>
|
@@ -137,6 +243,11 @@
|
|
137
243
|
#
|
138
244
|
class TagLib::AudioProperties
|
139
245
|
#
|
246
|
+
# Returns the number of audio channels.
|
247
|
+
#
|
248
|
+
def channels()
|
249
|
+
end
|
250
|
+
#
|
140
251
|
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
141
252
|
#
|
142
253
|
def bitrate()
|
@@ -147,31 +258,12 @@
|
|
147
258
|
def sampleRate()
|
148
259
|
end
|
149
260
|
#
|
150
|
-
# Returns the number of audio channels.
|
151
|
-
#
|
152
|
-
def channels()
|
153
|
-
end
|
154
|
-
#
|
155
261
|
# Returns the length of the file in seconds.
|
156
262
|
#
|
157
263
|
def length()
|
158
264
|
end
|
159
265
|
end
|
160
266
|
# <b>
|
161
|
-
# A wide string class suitable for unicode. .</b>
|
162
|
-
#
|
163
|
-
#
|
164
|
-
# This is an implicitly shared wide string. For storage it uses TagLib::wstring, but as this is an implementation detail this of course could change. Strings are stored internally as UTF-16BE. (Without the BOM (Byte Order Mark)The use of implicit sharing means that copying a string is cheap, the only cost comes into play when the copy is modified. Prior to that the string just has a pointer to the data of the parent String. This also makes this class suitable as a function return type.In addition to adding implicit sharing, this class keeps track of four possible encodings, which are the four supported by the ID3v2 standard.
|
165
|
-
#
|
166
|
-
class TagLib::String
|
167
|
-
#
|
168
|
-
# Creates and returns a C-String based on the data. This string is still owned by the String (class) and as such should not be deleted by the user.If unicode if false (the default) this string will be encoded in Latin1. If it is true the returned C-String will be UTF-8 encoded.This string remains valid until the String instance is destroyed or another export method is called.This however has the side effect that this C-String will remain in memory in addition to other memory that is consumed by the String instance. So, this method should not be used on large strings or where memory is critical.
|
169
|
-
#
|
170
|
-
#
|
171
|
-
def toCString(bool unicode = false)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
# <b>
|
175
267
|
# A byte vector. .</b>
|
176
268
|
#
|
177
269
|
#
|
@@ -192,6 +284,8 @@
|
|
192
284
|
class TagLib::GenreMap
|
193
285
|
def clear()
|
194
286
|
end
|
287
|
+
def isEmpty()
|
288
|
+
end
|
195
289
|
def size()
|
196
290
|
end
|
197
291
|
def empty?()
|
@@ -200,95 +294,74 @@
|
|
200
294
|
end
|
201
295
|
def contains()
|
202
296
|
end
|
203
|
-
def isEmpty()
|
204
|
-
end
|
205
297
|
def length()
|
206
298
|
end
|
207
299
|
def []()
|
208
300
|
end
|
209
301
|
end
|
210
302
|
# <b>
|
211
|
-
# A
|
303
|
+
# A file class with some useful methods for tag manipulation. .</b>
|
212
304
|
#
|
213
305
|
#
|
214
|
-
#
|
306
|
+
# This class is a basic file class with some methods that are particularly useful for tag editors. It has methods to take advantage of ByteVector and a binary search method for finding patterns in a file.
|
215
307
|
#
|
216
|
-
class TagLib::
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
def isEmpty()
|
222
|
-
end
|
223
|
-
end
|
224
|
-
class TagLib::ItemListMap
|
225
|
-
def clear()
|
308
|
+
class TagLib::File
|
309
|
+
#
|
310
|
+
# Returns the file name in the local file system encoding.
|
311
|
+
#
|
312
|
+
def name()
|
226
313
|
end
|
227
|
-
|
314
|
+
#
|
315
|
+
# Move the I/O pointer to offset in the file from position p. This defaults to seeking from the beginning of the file.Position
|
316
|
+
#
|
317
|
+
#
|
318
|
+
def seek(long offset,Position p = Beginning)
|
228
319
|
end
|
229
|
-
|
320
|
+
#
|
321
|
+
# Attempts to write the block data at the current get pointer. If the file is currently only opened read only -- i.e. readOnly() returns true -- this attempts to reopen the file in read/write mode.This should be used instead of using the streaming output operator for a ByteVector. And even this function is significantly slower than doing output with a char[].
|
322
|
+
#
|
323
|
+
#
|
324
|
+
def writeBlock( ByteVector data)
|
230
325
|
end
|
231
|
-
|
326
|
+
#
|
327
|
+
# Removes a block of the file starting a start and continuing for length bytes.This method is slow since it involves rewriting all of the file after the removed portion.
|
328
|
+
#
|
329
|
+
#
|
330
|
+
def removeBlock(ulong start = 0,ulong length = 0)
|
232
331
|
end
|
233
|
-
def
|
332
|
+
def open?()
|
234
333
|
end
|
235
|
-
|
334
|
+
#
|
335
|
+
# Returns true if the file is open and readble and valid information for the Tag and / or AudioProperties was found.
|
336
|
+
#
|
337
|
+
def isValid()
|
236
338
|
end
|
237
|
-
def
|
339
|
+
def find1()
|
238
340
|
end
|
239
|
-
end
|
240
|
-
# <b>
|
241
|
-
# A list of strings. .</b>
|
242
341
|
#
|
342
|
+
# Reset the end-of-file and error flags on the file.
|
243
343
|
#
|
244
|
-
|
344
|
+
def clear()
|
345
|
+
end
|
245
346
|
#
|
246
|
-
|
247
|
-
def size()
|
248
|
-
end
|
249
|
-
def contains()
|
250
|
-
end
|
251
|
-
def isEmpty()
|
252
|
-
end
|
253
|
-
end
|
254
|
-
class TagLib::FieldListMap
|
255
|
-
def clear()
|
256
|
-
end
|
257
|
-
def size()
|
258
|
-
end
|
259
|
-
def empty?()
|
260
|
-
end
|
261
|
-
def insert()
|
262
|
-
end
|
263
|
-
def contains()
|
264
|
-
end
|
265
|
-
def isEmpty()
|
266
|
-
end
|
267
|
-
def length()
|
268
|
-
end
|
269
|
-
def []()
|
270
|
-
end
|
271
|
-
end
|
272
|
-
# <b>
|
273
|
-
# A file class with some useful methods for tag manipulation. .</b>
|
274
|
-
#
|
275
|
-
#
|
276
|
-
# This class is a basic file class with some methods that are particularly useful for tag editors. It has methods to take advantage of ByteVector and a binary search method for finding patterns in a file.
|
347
|
+
# Returns a pointer to this file's tag. This should be reimplemented in the concrete subclasses.
|
277
348
|
#
|
278
|
-
|
349
|
+
def tag()
|
350
|
+
end
|
279
351
|
#
|
280
|
-
# Returns the file
|
352
|
+
# Returns true if the file is read only (or if the file can not be opened).
|
281
353
|
#
|
282
|
-
def
|
354
|
+
def readOnly()
|
283
355
|
end
|
284
356
|
#
|
285
|
-
#
|
286
|
-
#
|
357
|
+
# Returns a pointer to this file's audio properties. This should be reimplemented in the concrete subclasses. If no audio properties were read then this will return a null pointer.
|
287
358
|
#
|
288
|
-
def
|
359
|
+
def audioProperties()
|
289
360
|
end
|
290
361
|
def find2()
|
291
362
|
end
|
363
|
+
def writable?()
|
364
|
+
end
|
292
365
|
def valid?()
|
293
366
|
end
|
294
367
|
#
|
@@ -299,19 +372,15 @@
|
|
299
372
|
end
|
300
373
|
def isWritable()
|
301
374
|
end
|
302
|
-
def find3()
|
303
|
-
end
|
304
375
|
#
|
305
|
-
#
|
376
|
+
# Insert data at position start in the file overwriting replace bytes of the original content.This method is slow since it requires rewriting all of the file after the insertion point.
|
377
|
+
#
|
306
378
|
#
|
307
|
-
def
|
379
|
+
def insert( ByteVector data,ulong start = 0,ulong replace = 0)
|
308
380
|
end
|
309
|
-
def
|
381
|
+
def find3()
|
310
382
|
end
|
311
|
-
|
312
|
-
# Returns a pointer to this file's tag. This should be reimplemented in the concrete subclasses.
|
313
|
-
#
|
314
|
-
def tag()
|
383
|
+
def read_only?()
|
315
384
|
end
|
316
385
|
#
|
317
386
|
# Since the file can currently only be opened as an argument to the constructor (sort-of by design), this returns if that open succeeded.
|
@@ -319,1601 +388,1798 @@
|
|
319
388
|
def isOpen()
|
320
389
|
end
|
321
390
|
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
def readBlock(ulong length)
|
325
|
-
end
|
326
|
-
#
|
327
|
-
# Returns the offset in the file that pattern occurs at or -1 if it can not be found. If before is set, the search will only continue until the pattern before is found. This is useful for tagging purposes to search for a tag before the synch frame.Searching starts at fromOffset and proceeds from the that point to the beginning of the file and defaults to the end of the file.This has the practial limitation that pattern can not be longer than the buffer size used by readBlock(). Currently this is 1024 bytes.
|
328
|
-
#
|
391
|
+
# Returns the current offset withing the file.
|
329
392
|
#
|
330
|
-
def
|
331
|
-
end
|
332
|
-
def writable?()
|
393
|
+
def tell()
|
333
394
|
end
|
334
395
|
#
|
335
|
-
#
|
336
|
-
#
|
396
|
+
# Reads a block of size length at the current get pointer.
|
337
397
|
#
|
338
|
-
def
|
398
|
+
def readBlock(ulong length)
|
339
399
|
end
|
340
400
|
#
|
341
|
-
#
|
342
|
-
#
|
401
|
+
# Returns the length of the file.
|
343
402
|
#
|
344
|
-
def
|
403
|
+
def length()
|
345
404
|
end
|
346
405
|
#
|
347
|
-
#
|
406
|
+
# Returns the offset in the file that pattern occurs at or -1 if it can not be found. If before is set, the search will only continue until the pattern before is found. This is useful for tagging purposes to search for a tag before the synch frame.Searching starts at fromOffset and proceeds from the that point to the beginning of the file and defaults to the end of the file.This has the practial limitation that pattern can not be longer than the buffer size used by readBlock(). Currently this is 1024 bytes.
|
348
407
|
#
|
349
408
|
#
|
350
|
-
def
|
351
|
-
end
|
352
|
-
def open?()
|
353
|
-
end
|
354
|
-
#
|
355
|
-
# Returns true if the file is open and readble and valid information for the Tag and / or AudioProperties was found.
|
356
|
-
#
|
357
|
-
def isValid()
|
409
|
+
def rfind( ByteVector pattern,long fromOffset = 0, ByteVector before = ByteVector::null)
|
358
410
|
end
|
411
|
+
end
|
412
|
+
# <b>
|
413
|
+
# A list of ByteVectors. .</b>
|
359
414
|
#
|
360
|
-
# Returns the current offset withing the file.
|
361
|
-
#
|
362
|
-
def tell()
|
363
|
-
end
|
364
|
-
def find1()
|
365
|
-
end
|
366
415
|
#
|
367
|
-
#
|
416
|
+
# A List specialization with some handy features useful for ByteVectors.
|
368
417
|
#
|
369
|
-
|
418
|
+
class TagLib::ByteVectorList
|
419
|
+
def isEmpty()
|
370
420
|
end
|
371
|
-
|
372
|
-
# Returns true if the file is read only (or if the file can not be opened).
|
373
|
-
#
|
374
|
-
def readOnly()
|
421
|
+
def size()
|
375
422
|
end
|
376
|
-
|
377
|
-
# Returns a pointer to this file's audio properties. This should be reimplemented in the concrete subclasses. If no audio properties were read then this will return a null pointer.
|
378
|
-
#
|
379
|
-
def audioProperties()
|
423
|
+
def contains()
|
380
424
|
end
|
381
425
|
end
|
382
426
|
# <b>
|
383
|
-
#
|
427
|
+
# An implementation of FLAC metadata. .</b>
|
384
428
|
#
|
385
429
|
#
|
386
|
-
#
|
387
|
-
#
|
430
|
+
# This is implementation of FLAC metadata for non-Ogg FLAC files. At some point when Ogg / FLAC is more common there will be a similar implementation under the Ogg hiearchy.This supports ID3v1, ID3v2 and Xiph style comments as well as reading stream properties from the file.
|
388
431
|
#
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
end
|
432
|
+
module TagLib::FLAC
|
433
|
+
# <b>
|
434
|
+
# An implementation of audio property reading for FLAC. .</b>
|
393
435
|
#
|
394
|
-
# Saves the file. Returns true on success.
|
395
436
|
#
|
396
|
-
|
397
|
-
end
|
437
|
+
# This reads the data from an FLAC stream found in the AudioProperties API.
|
398
438
|
#
|
399
|
-
|
400
|
-
# File::tag()
|
401
|
-
#
|
439
|
+
class TagLib::FLAC::Properties < TagLib::AudioProperties
|
402
440
|
#
|
403
|
-
|
404
|
-
end
|
441
|
+
# Returns the sample width as read from the FLAC identification header.
|
405
442
|
#
|
406
|
-
|
443
|
+
def sampleWidth()
|
444
|
+
end
|
407
445
|
#
|
408
|
-
|
409
|
-
end
|
410
|
-
def null?()
|
411
|
-
end
|
446
|
+
# Returns the number of audio channels.
|
412
447
|
#
|
413
|
-
|
414
|
-
|
448
|
+
def channels()
|
449
|
+
end
|
415
450
|
#
|
416
|
-
|
417
|
-
end
|
451
|
+
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
418
452
|
#
|
419
|
-
|
453
|
+
def bitrate()
|
454
|
+
end
|
420
455
|
#
|
421
|
-
|
422
|
-
end
|
423
|
-
end
|
424
|
-
# <b>
|
425
|
-
# An ID3v1 implementation. .</b>
|
456
|
+
# Returns the sample rate in Hz.
|
426
457
|
#
|
458
|
+
def sampleRate()
|
459
|
+
end
|
427
460
|
#
|
428
|
-
#
|
461
|
+
# Returns the length of the file in seconds.
|
429
462
|
#
|
430
|
-
|
431
|
-
|
432
|
-
def self.genreList()
|
433
|
-
end
|
434
|
-
def self.genreIndex()
|
435
|
-
end
|
436
|
-
def self.genre()
|
437
|
-
end
|
438
|
-
def self.genreMap()
|
463
|
+
def length()
|
464
|
+
end
|
439
465
|
end
|
440
466
|
# <b>
|
441
|
-
#
|
467
|
+
# An implementation of TagLib::File with FLAC specific methods. .</b>
|
442
468
|
#
|
443
469
|
#
|
444
|
-
# This
|
445
|
-
# Most fields are truncated to a maximum of 28-30 bytes. The truncation happens automatically when the tag is rendered.
|
446
|
-
#
|
470
|
+
# This implements and provides an interface for FLAC files to the TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing the abstract TagLib::File API as well as providing some additional information specific to FLAC files.
|
447
471
|
#
|
448
|
-
class TagLib::
|
449
|
-
def
|
472
|
+
class TagLib::FLAC::File < TagLib::File
|
473
|
+
def name()
|
450
474
|
end
|
451
|
-
|
452
|
-
# Sets the comment to s. If s is String::null then this value will be cleared.
|
453
|
-
#
|
454
|
-
def setComment( s)
|
475
|
+
def seek()
|
455
476
|
end
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
def track()
|
477
|
+
def writeBlock()
|
478
|
+
end
|
479
|
+
def removeBlock()
|
460
480
|
end
|
461
481
|
#
|
462
|
-
# Returns the
|
482
|
+
# Returns the block of data used by FLAC::Properties for parsing the stream properties.DeprecatedThis method will not be public in a future release.
|
463
483
|
#
|
464
|
-
def
|
484
|
+
def streamInfoData()
|
465
485
|
end
|
466
|
-
def
|
486
|
+
def open?()
|
467
487
|
end
|
468
|
-
|
469
|
-
# Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.
|
470
|
-
#
|
471
|
-
def setGenre( s)
|
488
|
+
def isValid()
|
472
489
|
end
|
473
490
|
#
|
474
|
-
# Returns the
|
491
|
+
# Returns the length of the audio-stream, used by FLAC::Properties for calculating the bitrate.DeprecatedThis method will not be public in a future release.
|
475
492
|
#
|
476
|
-
def
|
493
|
+
def streamLength()
|
477
494
|
end
|
478
|
-
def
|
495
|
+
def find1()
|
479
496
|
end
|
480
|
-
def
|
497
|
+
def clear()
|
481
498
|
end
|
482
499
|
#
|
483
|
-
#
|
500
|
+
# Returns the Tag for this file. This will be a union of XiphComment, ID3v1 and ID3v2 tags.ID3v2Tag() ID3v1Tag() XiphComment()
|
501
|
+
#
|
484
502
|
#
|
485
|
-
def
|
503
|
+
def tag()
|
486
504
|
end
|
487
|
-
|
488
|
-
# Sets the year to i. If s is 0 then this value will be cleared.
|
489
|
-
#
|
490
|
-
def setYear(uint i)
|
505
|
+
def readOnly()
|
491
506
|
end
|
492
507
|
#
|
493
|
-
# Returns the
|
508
|
+
# Returns a pointer to the ID3v2 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v2 tag. If create is true it will create an ID3v2 tag if one does not exist.The Tag is still owned by the FLAC::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
509
|
+
#
|
494
510
|
#
|
495
|
-
def
|
496
|
-
end
|
497
|
-
def empty?()
|
511
|
+
def ID3v2Tag(bool create = false)
|
498
512
|
end
|
499
513
|
#
|
500
|
-
# Returns the
|
514
|
+
# Returns the FLAC::Properties for this file. If no audio properties were read then this will return a null pointer.
|
501
515
|
#
|
502
|
-
def
|
516
|
+
def audioProperties()
|
503
517
|
end
|
504
|
-
def
|
518
|
+
def find2()
|
505
519
|
end
|
506
|
-
def
|
520
|
+
def writable?()
|
507
521
|
end
|
508
|
-
|
509
|
-
# Sets the artist to s. If s is String::null then this value will be cleared.
|
510
|
-
#
|
511
|
-
def setArtist( s)
|
522
|
+
def valid?()
|
512
523
|
end
|
513
524
|
#
|
514
|
-
#
|
525
|
+
# Returns a pointer to the ID3v1 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v1 tag. If create is true it will create an ID3v1 tag if one does not exist.The Tag is still owned by the FLAC::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
526
|
+
#
|
515
527
|
#
|
516
|
-
def
|
528
|
+
def ID3v1Tag(bool create = false)
|
517
529
|
end
|
518
530
|
#
|
519
|
-
#
|
531
|
+
# Save the file. This will primarily save the XiphComment, but will also keep any old ID3-tags up to date. If the file has no XiphComment, one will be constructed from the ID3-tags.This returns true if the save was successful.
|
520
532
|
#
|
521
|
-
def
|
533
|
+
def save()
|
522
534
|
end
|
523
|
-
|
524
|
-
# Renders the in memory values to a ByteVector suitable for writing to the file.
|
525
|
-
#
|
526
|
-
def render()
|
535
|
+
def isWritable()
|
527
536
|
end
|
528
|
-
def
|
537
|
+
def insert()
|
529
538
|
end
|
530
539
|
#
|
531
|
-
#
|
540
|
+
# Returns a pointer to the XiphComment for the file.If create is false (the default) this will return a null pointer if there is no valid XiphComment. If create is true it will create a XiphComment if one does not exist.The Tag is still owned by the FLAC::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
541
|
+
#
|
532
542
|
#
|
533
|
-
def
|
543
|
+
def xiphComment(bool create = false)
|
534
544
|
end
|
535
|
-
def
|
545
|
+
def find3()
|
546
|
+
end
|
547
|
+
def read_only?()
|
548
|
+
end
|
549
|
+
def isOpen()
|
550
|
+
end
|
551
|
+
def tell()
|
552
|
+
end
|
553
|
+
def readBlock()
|
554
|
+
end
|
555
|
+
def length()
|
536
556
|
end
|
537
557
|
#
|
538
|
-
#
|
558
|
+
# Set the ID3v2::FrameFactory to something other than the default. This can be used to specify the way that ID3v2 frames will be interpreted whenID3v2FrameFactory
|
559
|
+
#
|
539
560
|
#
|
540
|
-
def
|
561
|
+
def setID3v2FrameFactory( ID3v2::FrameFactory factory)
|
562
|
+
end
|
563
|
+
def rfind()
|
541
564
|
end
|
542
565
|
end
|
543
566
|
end
|
544
567
|
# <b>
|
545
|
-
#
|
568
|
+
# An implementation of WavPack metadata. .</b>
|
546
569
|
#
|
547
570
|
#
|
548
|
-
#
|
571
|
+
# This is implementation of WavPack metadata.This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream properties from the file.
|
549
572
|
#
|
550
|
-
module TagLib::
|
573
|
+
module TagLib::WavPack
|
551
574
|
# <b>
|
552
|
-
# An implementation of audio property reading for
|
553
|
-
#
|
554
|
-
#
|
555
|
-
# This reads the data from an Ogg Vorbis stream found in the AudioProperties API.
|
575
|
+
# An implementation of audio property reading for WavPack. .</b>
|
556
576
|
#
|
557
|
-
class TagLib::Vorbis::Properties < TagLib::AudioProperties
|
558
577
|
#
|
559
|
-
#
|
578
|
+
# This reads the data from an WavPack stream found in the AudioProperties API.
|
560
579
|
#
|
561
|
-
|
562
|
-
end
|
580
|
+
class TagLib::WavPack::Properties < TagLib::AudioProperties
|
563
581
|
#
|
564
|
-
# Returns the
|
582
|
+
# Returns the number of audio channels.
|
565
583
|
#
|
566
|
-
def
|
584
|
+
def channels()
|
567
585
|
end
|
568
586
|
#
|
569
|
-
# Returns
|
587
|
+
# Returns WavPack version.
|
570
588
|
#
|
571
|
-
def
|
589
|
+
def version()
|
572
590
|
end
|
573
591
|
#
|
574
|
-
# Returns
|
592
|
+
# Returns number of bits per sample.
|
575
593
|
#
|
576
|
-
def
|
594
|
+
def bitsPerSample()
|
577
595
|
end
|
578
596
|
#
|
579
|
-
# Returns the
|
597
|
+
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
580
598
|
#
|
581
|
-
def
|
599
|
+
def bitrate()
|
582
600
|
end
|
583
601
|
#
|
584
|
-
# Returns the
|
602
|
+
# Returns the sample rate in Hz.
|
585
603
|
#
|
586
|
-
def
|
604
|
+
def sampleRate()
|
587
605
|
end
|
588
606
|
#
|
589
607
|
# Returns the length of the file in seconds.
|
590
608
|
#
|
591
609
|
def length()
|
592
610
|
end
|
593
|
-
#
|
594
|
-
# Returns the nominal bitrate as read from the Vorbis identification header.
|
595
|
-
#
|
596
|
-
def bitrateNominal()
|
597
|
-
end
|
598
611
|
end
|
599
612
|
# <b>
|
600
|
-
# An implementation of
|
613
|
+
# An implementation of TagLib::File with WavPack specific methods. .</b>
|
601
614
|
#
|
602
615
|
#
|
603
|
-
# This
|
616
|
+
# This implements and provides an interface for WavPack files to the TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing the abstract TagLib::File API as well as providing some additional information specific to WavPack files.
|
604
617
|
#
|
605
|
-
class TagLib::
|
618
|
+
class TagLib::WavPack::File < TagLib::File
|
606
619
|
def name()
|
607
620
|
end
|
608
621
|
def seek()
|
609
622
|
end
|
610
|
-
def
|
611
|
-
end
|
612
|
-
def firstPageHeader()
|
613
|
-
end
|
614
|
-
def valid?()
|
623
|
+
def writeBlock()
|
615
624
|
end
|
616
625
|
#
|
617
|
-
#
|
626
|
+
# Returns a pointer to the APE tag of the file.If create is false (the default) this will return a null pointer if there is no valid APE tag. If create is true it will create a APE tag if one does not exist.The Tag is still owned by the APE::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
618
627
|
#
|
619
628
|
#
|
620
|
-
def
|
629
|
+
def APETag(bool create = false)
|
621
630
|
end
|
622
|
-
def
|
631
|
+
def removeBlock()
|
623
632
|
end
|
624
|
-
def
|
633
|
+
def open?()
|
625
634
|
end
|
626
|
-
def
|
635
|
+
def isValid()
|
627
636
|
end
|
628
|
-
def
|
637
|
+
def find1()
|
629
638
|
end
|
630
|
-
def
|
639
|
+
def clear()
|
631
640
|
end
|
632
641
|
#
|
633
|
-
# Returns the
|
642
|
+
# Returns the Tag for this file. This will be an APE tag, an ID3v1 tag or a combination of the two.
|
634
643
|
#
|
635
644
|
def tag()
|
636
645
|
end
|
637
|
-
def
|
646
|
+
def readOnly()
|
638
647
|
end
|
639
|
-
|
648
|
+
#
|
649
|
+
# Returns the MPC::Properties for this file. If no audio properties were read then this will return a null pointer.
|
650
|
+
#
|
651
|
+
def audioProperties()
|
640
652
|
end
|
641
|
-
def
|
653
|
+
def find2()
|
642
654
|
end
|
643
655
|
def writable?()
|
644
656
|
end
|
645
|
-
|
657
|
+
#
|
658
|
+
# This will remove the tags that match the OR-ed together TagTypes from the file. By default it removes all tags.This will also invalidate pointers to the tags as their memory will be freed. In order to make the removal permanent save() still needs to be called
|
659
|
+
#
|
660
|
+
#
|
661
|
+
def strip(int tags = AllTags)
|
646
662
|
end
|
647
|
-
def
|
663
|
+
def valid?()
|
664
|
+
end
|
665
|
+
#
|
666
|
+
# Returns a pointer to the ID3v1 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v1 tag. If create is true it will create an ID3v1 tag if one does not exist. If there is already an APE tag, the new ID3v1 tag will be placed after it.The Tag is still owned by the APE::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
667
|
+
#
|
668
|
+
#
|
669
|
+
def ID3v1Tag(bool create = false)
|
670
|
+
end
|
671
|
+
#
|
672
|
+
# Saves the file.
|
673
|
+
#
|
674
|
+
def save()
|
675
|
+
end
|
676
|
+
def isWritable()
|
648
677
|
end
|
649
678
|
def insert()
|
650
679
|
end
|
651
|
-
def
|
680
|
+
def find3()
|
652
681
|
end
|
653
|
-
def
|
682
|
+
def read_only?()
|
654
683
|
end
|
655
|
-
def
|
684
|
+
def isOpen()
|
656
685
|
end
|
657
686
|
def tell()
|
658
687
|
end
|
659
|
-
def
|
660
|
-
end
|
661
|
-
def setPacket()
|
688
|
+
def readBlock()
|
662
689
|
end
|
663
690
|
def length()
|
664
691
|
end
|
665
|
-
def
|
666
|
-
end
|
667
|
-
#
|
668
|
-
# Returns the Vorbis::Properties for this file. If no audio properties were read then this will return a null pointer.
|
669
|
-
#
|
670
|
-
def audioProperties()
|
692
|
+
def rfind()
|
671
693
|
end
|
672
694
|
end
|
673
695
|
end
|
674
696
|
# <b>
|
675
|
-
# An implementation
|
697
|
+
# An ID3v2 implementation. .</b>
|
676
698
|
#
|
677
699
|
#
|
700
|
+
# This is a relatively complete and flexible framework for working with ID3v2 tags.ID3v2::Tag
|
678
701
|
#
|
679
702
|
#
|
680
|
-
module TagLib::
|
703
|
+
module TagLib::ID3v2
|
681
704
|
# <b>
|
682
|
-
#
|
705
|
+
# ID3v2 frame implementation. .</b>
|
683
706
|
#
|
684
707
|
#
|
685
|
-
# This is
|
708
|
+
# ID3v2 frame header implementation.This class is the main ID3v2 frame implementation. In ID3v2, a tag is split between a collection of frames (which are in turn split into fields (Structure, 4) (Frames). This class provides an API for gathering information about and modifying ID3v2 frames. Funtionallity specific to a given frame type is handed in one of the many subclasses.The ID3v2 Frame Header (Structure, 4)Every ID3v2::Frame has an associated header that gives some general properties of the frame and also makes it possible to identify the frame type.As such when reading an ID3v2 tag ID3v2::FrameFactory first creates the frame headers and then creates the appropriate Frame subclass based on the type and attaches the header.
|
686
709
|
#
|
687
|
-
class TagLib::
|
710
|
+
class TagLib::ID3v2::Frame < TagLib::ID3v2::Header
|
688
711
|
#
|
689
|
-
# Returns
|
712
|
+
# Returns the size of the frame.
|
690
713
|
#
|
691
|
-
def
|
714
|
+
def size()
|
692
715
|
end
|
693
716
|
#
|
694
|
-
# Returns the
|
717
|
+
# Returns the Frame ID (Structure, 4) (Frames, 4)
|
695
718
|
#
|
696
|
-
def
|
719
|
+
def frameID()
|
697
720
|
end
|
721
|
+
end
|
722
|
+
# <b>
|
723
|
+
# An implementation of ID3v2 headers. .</b>
|
698
724
|
#
|
699
|
-
# Returns the bitrate encoded in the header.
|
700
725
|
#
|
701
|
-
|
726
|
+
# This class implements ID3v2 headers. It attempts to follow, both semantically and programatically, the structure specified in the ID3v2 standard. The API is based on the properties of ID3v2 headers specified there. If any of the terms used in this documentation are unclear please check the specification in the linked section. (Structure, 3.1)
|
727
|
+
#
|
728
|
+
class TagLib::ID3v2::Header
|
729
|
+
end
|
730
|
+
# <b>
|
731
|
+
# An ID3v2 attached picture frame implementation. .</b>
|
732
|
+
#
|
733
|
+
#
|
734
|
+
# This is an implementation of ID3v2 attached pictures. Pictures may be included in tags, one per APIC frame (but there may be multiple APIC frames in a single tag). These pictures are usually in either JPEG or PNG format.
|
735
|
+
#
|
736
|
+
class TagLib::ID3v2::AttachedPictureFrame < TagLib::ID3v2::Frame
|
737
|
+
# Singleton methods
|
738
|
+
def self.new2()
|
702
739
|
end
|
703
740
|
#
|
704
|
-
#
|
741
|
+
# Set the text encoding used for the description.description()
|
742
|
+
#
|
705
743
|
#
|
706
|
-
def
|
744
|
+
def setTextEncoding(::Type t)
|
707
745
|
end
|
708
746
|
#
|
709
|
-
#
|
747
|
+
# Sets the image data to p. p should be of the type specified in this frame's mime-type specification.picture() mimeType() setMimeType()
|
748
|
+
#
|
710
749
|
#
|
711
|
-
def
|
750
|
+
def setPicture( ByteVector p)
|
712
751
|
end
|
713
752
|
#
|
714
|
-
# Returns the
|
753
|
+
# Returns the mime type of the image. This should in most cases be "image/png" or "image/jpeg".
|
715
754
|
#
|
716
|
-
def
|
755
|
+
def mimeType()
|
756
|
+
end
|
757
|
+
def size()
|
717
758
|
end
|
718
759
|
#
|
719
|
-
#
|
760
|
+
# Sets the mime type of the image. This should in most cases be "image/png" or "image/jpeg".
|
720
761
|
#
|
721
|
-
def
|
762
|
+
def setMimeType( m)
|
722
763
|
end
|
723
764
|
#
|
724
|
-
#
|
765
|
+
# Sets a textual description of the image to desc.description() textEncoding() setTextEncoding()
|
766
|
+
#
|
725
767
|
#
|
726
|
-
def
|
768
|
+
def setDescription( desc)
|
727
769
|
end
|
728
770
|
#
|
729
|
-
# Returns
|
771
|
+
# Returns a text description of the image.setDescription() textEncoding() setTextEncoding()
|
772
|
+
#
|
730
773
|
#
|
731
|
-
def
|
774
|
+
def description()
|
732
775
|
end
|
733
776
|
#
|
734
|
-
# Returns
|
777
|
+
# Returns a string containing the description and mime-type
|
735
778
|
#
|
736
|
-
def
|
779
|
+
def toString()
|
737
780
|
end
|
738
781
|
#
|
739
|
-
# Returns
|
782
|
+
# Returns the text encoding used for the description.setTextEncoding() description()
|
783
|
+
#
|
740
784
|
#
|
741
|
-
def
|
785
|
+
def textEncoding()
|
786
|
+
end
|
787
|
+
def frameID()
|
742
788
|
end
|
743
789
|
#
|
744
|
-
#
|
790
|
+
# Sets the type for the image.Type type()
|
791
|
+
#
|
745
792
|
#
|
746
|
-
def
|
793
|
+
def setType(Type t)
|
794
|
+
end
|
795
|
+
#
|
796
|
+
# Returns the image data as a ByteVector.ByteVector has a data() method that returns a const char * which should make it easy to export this data to external programs.
|
797
|
+
# setPicture() mimeType()
|
798
|
+
#
|
799
|
+
#
|
800
|
+
def picture()
|
747
801
|
end
|
748
802
|
end
|
749
803
|
# <b>
|
750
|
-
#
|
751
|
-
#
|
804
|
+
# A factory for creating ID3v2 frames during parsing. .</b>
|
752
805
|
#
|
753
|
-
# This reads the data from an MPEG Layer III stream found in the AudioProperties API.
|
754
806
|
#
|
755
|
-
|
807
|
+
# This factory abstracts away the frame creation process and instantiates the appropriate ID3v2::Frame subclasses based on the contents of the data.Reimplementing this factory is the key to adding support for frame types not directly supported by TagLib to your application. To do so you would subclass this factory reimplement createFrame(). Then by setting your factory to be the default factory in ID3v2::Tag constructor or with MPEG::File::setID3v2FrameFactory() you can implement behavior that will allow for new ID3v2::Frame subclasses (also provided by you) to be used.This implements both abstract factory and singleton patterns of which more information is available on the web and in software design textbooks (Notably Design Patters).You do not need to use this factory to create new frames to add to an ID3v2::Tag. You can instantiate frame subclasses directly (with new) and add them to a tag using ID3v2::Tag::addFrame()
|
808
|
+
# ID3v2::Tag::addFrame()
|
809
|
+
#
|
756
810
|
#
|
757
|
-
|
811
|
+
class TagLib::ID3v2::FrameFactory
|
812
|
+
end
|
813
|
+
# <b>
|
814
|
+
# The main class in the ID3v2 implementation. .</b>
|
758
815
|
#
|
759
|
-
def isCopyrighted()
|
760
|
-
end
|
761
816
|
#
|
762
|
-
#
|
817
|
+
# This is the main class in the ID3v2 implementation. It serves two functions. This first, as is obvious from the public API, is to provide a container for the other ID3v2 related classes. In addition, through the read() and parse() protected methods, it provides the most basic level of parsing. In these methods the ID3v2 tag is extracted from the file and split into data components.ID3v2 tags have several parts, TagLib attempts to provide an interface for them all. header(), footer() and extendedHeader() corespond to those data structures in the ID3v2 standard and the APIs for the classes that they return attempt to reflect this.Also ID3v2 tags are built up from a list of frames, which are in turn have a header and a list of fields. TagLib provides two ways of accessing the list of frames that are in a given ID3v2 tag. The first is simply via the frameList() method. This is just a list of pointers to the frames. The second is a map from the frame type -- i.e. "COMM" for comments -- and a list of frames of that type. (In some cases ID3v2 allows for multiple frames of the same type, hence this being a map to a list rather than just a map to an individual frame.)More information on the structure of frames can be found in the ID3v2::Frame class.read() and parse() pass binary data to the other ID3v2 class structures, they do not handle parsing of flags or fields, for instace. Those are handled by similar functions within those classes.All pointers to data structures within the tag will become invalid when the tag is destroyed.
|
818
|
+
# Dealing with the nasty details of ID3v2 is not for the faint of heart and should not be done without much meditation on the spec. It's rather long, but if you're planning on messing with this class and others that deal with the details of ID3v2 (rather than the nice, safe, abstract TagLib::Tag and friends), it's worth your time to familiarize yourself with said spec (which is distrubuted with the TagLib sources). TagLib tries to do most of the work, but with a little luck, you can still convince it to generate invalid ID3v2 tags. The APIs for ID3v2 assume a working knowledge of ID3v2 structure. You're been warned.
|
819
|
+
#
|
763
820
|
#
|
764
|
-
|
821
|
+
class TagLib::ID3v2::Tag < TagLib::Tag
|
822
|
+
def artist=()
|
765
823
|
end
|
766
824
|
#
|
767
|
-
#
|
825
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
768
826
|
#
|
769
|
-
def
|
827
|
+
def setArtist( s)
|
770
828
|
end
|
771
829
|
#
|
772
|
-
#
|
830
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
773
831
|
#
|
774
|
-
def
|
832
|
+
def setTrack(uint i)
|
775
833
|
end
|
776
834
|
#
|
777
|
-
# Returns
|
835
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
778
836
|
#
|
779
|
-
def
|
837
|
+
def album()
|
780
838
|
end
|
781
839
|
#
|
782
|
-
# Returns the
|
840
|
+
# Returns the year; if there is no year set, this will return 0.
|
783
841
|
#
|
784
|
-
def
|
842
|
+
def year()
|
785
843
|
end
|
786
|
-
|
787
|
-
# Returns true if the MPEG protection bit is enabled.
|
788
|
-
#
|
789
|
-
def protectionEnabled()
|
844
|
+
def album=()
|
790
845
|
end
|
791
846
|
#
|
792
|
-
#
|
847
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
793
848
|
#
|
794
|
-
def
|
849
|
+
def setAlbum( s)
|
850
|
+
end
|
851
|
+
def year=()
|
795
852
|
end
|
796
853
|
#
|
797
|
-
# Returns the
|
854
|
+
# Returns true if the tag does not contain any data. This should be reimplemented in subclasses that provide more than the basic tagging abilities in this class.
|
798
855
|
#
|
799
|
-
def
|
856
|
+
def isEmpty()
|
800
857
|
end
|
801
858
|
#
|
802
|
-
# Returns the
|
859
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
803
860
|
#
|
804
|
-
def
|
861
|
+
def genre()
|
805
862
|
end
|
806
863
|
#
|
807
|
-
#
|
864
|
+
# Add a frame to the tag. At this point the tag takes ownership of the frame and will handle freeing its memory.Using this method will invalidate any pointers on the list returned by frameList()
|
865
|
+
#
|
808
866
|
#
|
809
|
-
def
|
867
|
+
def addFrame(Frame frame)
|
868
|
+
end
|
869
|
+
def genre=()
|
810
870
|
end
|
811
|
-
end
|
812
|
-
# <b>
|
813
|
-
# An implementation of the Xing VBR headers. .</b>
|
814
|
-
#
|
815
871
|
#
|
816
|
-
#
|
872
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
817
873
|
#
|
818
|
-
|
874
|
+
def setComment( s)
|
875
|
+
end
|
819
876
|
#
|
820
|
-
# Returns the
|
877
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
821
878
|
#
|
822
|
-
def
|
879
|
+
def comment()
|
880
|
+
end
|
881
|
+
def empty?()
|
882
|
+
end
|
883
|
+
def comment=()
|
823
884
|
end
|
824
885
|
#
|
825
|
-
# Returns the
|
886
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
826
887
|
#
|
827
|
-
def
|
888
|
+
def track()
|
828
889
|
end
|
829
890
|
#
|
830
|
-
# Returns
|
891
|
+
# Returns a reference to the frame list map. This is an FrameListMap of all of the frames in the tag.This is the most convenient structure for accessing the tag's frames. Many frame types allow multiple instances of the same frame type so this is a map of lists. In most cases however there will only be a single frame of a certain type.Let's say for instance that you wanted to access the frame for total beats per minute -- the TBPM frame.TagLib::MPEG::Filef("foo.mp3");
|
831
892
|
#
|
832
|
-
|
833
|
-
end
|
834
|
-
end
|
835
|
-
# <b>
|
836
|
-
# An MPEG file class with some useful methods specific to MPEG. .</b>
|
893
|
+
# //ChecktomakesurethatithasanID3v2tag
|
837
894
|
#
|
895
|
+
# if(f.ID3v2Tag()){
|
838
896
|
#
|
839
|
-
#
|
897
|
+
# //Getthelistofframesforaspecificframetype
|
840
898
|
#
|
841
|
-
|
842
|
-
def name()
|
843
|
-
end
|
899
|
+
# TagLib::ID3v2::FrameListl=f.ID3v2Tag()->frameListMap()["TBPM"];
|
844
900
|
#
|
845
|
-
#
|
901
|
+
# if(!l.isEmpty())
|
902
|
+
# std::cout<<l.front()->toString()<<std::endl;
|
903
|
+
# }
|
904
|
+
# You should not modify this data structure directly, instead use addFrame() and removeFrame().
|
905
|
+
# frameList()
|
906
|
+
#
|
846
907
|
#
|
847
|
-
def
|
848
|
-
end
|
849
|
-
def seek()
|
908
|
+
def frameListMap()
|
850
909
|
end
|
851
|
-
def
|
910
|
+
def track=()
|
852
911
|
end
|
853
|
-
|
912
|
+
#
|
913
|
+
# Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.
|
914
|
+
#
|
915
|
+
def setGenre( s)
|
854
916
|
end
|
855
917
|
#
|
856
|
-
# Returns
|
857
|
-
#
|
918
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
858
919
|
#
|
859
|
-
def
|
920
|
+
def title()
|
860
921
|
end
|
861
922
|
#
|
862
|
-
#
|
923
|
+
# Returns a pointer to the tag's header.
|
863
924
|
#
|
864
|
-
def
|
925
|
+
def header()
|
865
926
|
end
|
866
|
-
def
|
927
|
+
def title=()
|
867
928
|
end
|
868
929
|
#
|
869
|
-
#
|
930
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
870
931
|
#
|
871
|
-
def
|
932
|
+
def setTitle( s)
|
872
933
|
end
|
873
|
-
|
934
|
+
#
|
935
|
+
# Returns the frame list for frames with the id frameID or an empty list if there are no frames of that type. This is just a convenience and is equivalent to:frameListMap()[frameID];
|
936
|
+
# frameListMap()
|
937
|
+
#
|
938
|
+
#
|
939
|
+
def frameList( ByteVector frameID)
|
874
940
|
end
|
875
|
-
|
941
|
+
#
|
942
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
943
|
+
#
|
944
|
+
def setYear(uint i)
|
876
945
|
end
|
877
|
-
|
946
|
+
#
|
947
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
948
|
+
#
|
949
|
+
def artist()
|
878
950
|
end
|
951
|
+
end
|
952
|
+
# <b>
|
953
|
+
# An implementation of ID3v2 comments. .</b>
|
879
954
|
#
|
880
|
-
#
|
881
|
-
#
|
955
|
+
#
|
956
|
+
# This implements the ID3v2 comment format. An ID3v2 comment concists of a language encoding, a description and a single text field.
|
957
|
+
#
|
958
|
+
class TagLib::ID3v2::CommentsFrame < TagLib::ID3v2::Frame
|
959
|
+
#
|
960
|
+
# Sets the text encoding to be used when rendering this frame to encoding.textEncoding() render()
|
882
961
|
#
|
883
962
|
#
|
884
|
-
def
|
885
|
-
end
|
886
|
-
def isOpen()
|
963
|
+
def setTextEncoding(::Type encoding)
|
887
964
|
end
|
888
|
-
def
|
965
|
+
def size()
|
889
966
|
end
|
890
967
|
#
|
891
|
-
# Returns
|
968
|
+
# Returns the text of this comment.setText()
|
892
969
|
#
|
893
970
|
#
|
894
|
-
def
|
971
|
+
def text()
|
895
972
|
end
|
896
973
|
#
|
897
|
-
#
|
974
|
+
# Set the language using the 3 byte language code from ISO-639-2 to languageCode.language()
|
975
|
+
#
|
898
976
|
#
|
899
|
-
def
|
900
|
-
end
|
901
|
-
def rfind()
|
902
|
-
end
|
903
|
-
def writable?()
|
977
|
+
def setLanguage( ByteVector languageCode)
|
904
978
|
end
|
905
979
|
#
|
906
|
-
#
|
980
|
+
# Sets the description of the comment to s.decription()
|
981
|
+
#
|
907
982
|
#
|
908
|
-
def
|
909
|
-
end
|
910
|
-
def writeBlock()
|
983
|
+
def setDescription( s)
|
911
984
|
end
|
912
985
|
#
|
913
|
-
# Returns
|
986
|
+
# Returns the description of this comment.Most taggers simply ignore this value.
|
987
|
+
# setDescription()
|
914
988
|
#
|
915
989
|
#
|
916
|
-
def
|
917
|
-
end
|
918
|
-
def insert()
|
919
|
-
end
|
920
|
-
def removeBlock()
|
921
|
-
end
|
922
|
-
def open?()
|
923
|
-
end
|
924
|
-
def isValid()
|
990
|
+
def description()
|
925
991
|
end
|
926
992
|
#
|
927
|
-
# Returns the
|
993
|
+
# Returns the language encoding as a 3 byte encoding as specified by ISO-639-2.Most taggers simply ignore this value.
|
994
|
+
# setLanguage()
|
995
|
+
#
|
928
996
|
#
|
929
|
-
def
|
930
|
-
end
|
931
|
-
def tell()
|
997
|
+
def language()
|
932
998
|
end
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
def
|
999
|
+
#
|
1000
|
+
# Sets the text portion of the comment to s.text()
|
1001
|
+
#
|
1002
|
+
#
|
1003
|
+
def setText( s)
|
938
1004
|
end
|
939
1005
|
#
|
940
|
-
#
|
1006
|
+
# Returns the text of this comment.text()
|
941
1007
|
#
|
942
1008
|
#
|
943
|
-
def
|
1009
|
+
def toString()
|
944
1010
|
end
|
945
1011
|
#
|
946
|
-
# Returns the
|
1012
|
+
# Returns the text encoding that will be used in rendering this frame. This defaults to the type that was either specified in the constructor or read from the frame when parsed.setTextEncoding() render()
|
1013
|
+
#
|
947
1014
|
#
|
948
|
-
def
|
1015
|
+
def textEncoding()
|
1016
|
+
end
|
1017
|
+
def frameID()
|
949
1018
|
end
|
950
1019
|
end
|
1020
|
+
# <b>
|
1021
|
+
# An ID3v2 general encapsulated object frame implementation. .</b>
|
1022
|
+
#
|
1023
|
+
#
|
1024
|
+
# This is an implementation of ID3v2 general encapsulated objects. Arbitrary binary data may be included in tags, stored in GEOB frames. There may be multiple GEOB frames in a single tag. Each GEOB it labelled with a content description (which may be blank), a required mime-type, and a file name (may be blank). The content description uniquely identifies the GEOB frame in the tag.
|
1025
|
+
#
|
1026
|
+
class TagLib::ID3v2::GeneralEncapsulatedObjectFrame
|
1027
|
+
end
|
951
1028
|
end
|
952
1029
|
# <b>
|
953
|
-
# An implementation of
|
1030
|
+
# An implementation of TrueAudio metadata. .</b>
|
954
1031
|
#
|
955
1032
|
#
|
956
|
-
#
|
1033
|
+
# This is implementation of TrueAudio metadata.This supports ID3v1 and ID3v2 tags as well as reading stream properties from the file.
|
957
1034
|
#
|
958
|
-
module TagLib::
|
1035
|
+
module TagLib::TrueAudio
|
959
1036
|
# <b>
|
960
|
-
# An
|
1037
|
+
# An implementation of audio property reading for TrueAudio. .</b>
|
961
1038
|
#
|
962
1039
|
#
|
963
|
-
#
|
1040
|
+
# This reads the data from an TrueAudio stream found in the AudioProperties API.
|
964
1041
|
#
|
965
|
-
class TagLib::
|
966
|
-
def genre=()
|
967
|
-
end
|
1042
|
+
class TagLib::TrueAudio::Properties < TagLib::AudioProperties
|
968
1043
|
#
|
969
|
-
#
|
1044
|
+
# Returns the number of audio channels.
|
970
1045
|
#
|
971
|
-
def
|
1046
|
+
def channels()
|
972
1047
|
end
|
973
1048
|
#
|
974
|
-
#
|
1049
|
+
# Returns number of bits per sample.
|
975
1050
|
#
|
976
|
-
def
|
1051
|
+
def bitsPerSample()
|
977
1052
|
end
|
978
1053
|
#
|
979
|
-
# Returns the
|
1054
|
+
# Returns the major version number.
|
980
1055
|
#
|
981
|
-
def
|
1056
|
+
def ttaVersion()
|
982
1057
|
end
|
983
1058
|
#
|
984
|
-
# Returns the
|
1059
|
+
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
985
1060
|
#
|
986
|
-
def
|
987
|
-
end
|
988
|
-
def track=()
|
1061
|
+
def bitrate()
|
989
1062
|
end
|
990
1063
|
#
|
991
|
-
#
|
1064
|
+
# Returns the sample rate in Hz.
|
992
1065
|
#
|
993
|
-
def
|
1066
|
+
def sampleRate()
|
994
1067
|
end
|
995
1068
|
#
|
996
|
-
#
|
1069
|
+
# Returns the length of the file in seconds.
|
997
1070
|
#
|
998
|
-
def
|
1071
|
+
def length()
|
999
1072
|
end
|
1073
|
+
end
|
1074
|
+
# <b>
|
1075
|
+
# An implementation of TagLib::File with TrueAudio specific methods. .</b>
|
1000
1076
|
#
|
1001
|
-
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
1002
1077
|
#
|
1003
|
-
|
1078
|
+
# This implements and provides an interface for TrueAudio files to the TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing the abstract TagLib::File API as well as providing some additional information specific to TrueAudio files.
|
1079
|
+
#
|
1080
|
+
class TagLib::TrueAudio::File < TagLib::File
|
1081
|
+
def name()
|
1004
1082
|
end
|
1005
|
-
def
|
1083
|
+
def seek()
|
1006
1084
|
end
|
1007
|
-
def
|
1085
|
+
def writeBlock()
|
1008
1086
|
end
|
1009
|
-
|
1010
|
-
# Sets the title to s. If s is String::null then this value will be cleared.
|
1011
|
-
#
|
1012
|
-
def setTitle( s)
|
1087
|
+
def removeBlock()
|
1013
1088
|
end
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1089
|
+
def open?()
|
1090
|
+
end
|
1091
|
+
def isValid()
|
1092
|
+
end
|
1093
|
+
def find1()
|
1094
|
+
end
|
1095
|
+
def clear()
|
1018
1096
|
end
|
1019
1097
|
#
|
1020
|
-
# Returns the
|
1098
|
+
# Returns the Tag for this file.
|
1021
1099
|
#
|
1022
|
-
def
|
1100
|
+
def tag()
|
1023
1101
|
end
|
1024
|
-
def
|
1102
|
+
def readOnly()
|
1025
1103
|
end
|
1026
1104
|
#
|
1027
|
-
# Returns the
|
1105
|
+
# Returns a pointer to the ID3v1 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v1 tag. If create is true it will create an ID3v1 tag if one does not exist. If there is already an APE tag, the new ID3v1 tag will be placed after it.The Tag is still owned by the TrueAudio::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
1106
|
+
#
|
1028
1107
|
#
|
1029
|
-
def
|
1108
|
+
def ID3v2Tag(bool create = false)
|
1030
1109
|
end
|
1031
1110
|
#
|
1032
|
-
#
|
1111
|
+
# Returns the TrueAudio::Properties for this file. If no audio properties were read then this will return a null pointer.
|
1033
1112
|
#
|
1034
|
-
def
|
1113
|
+
def audioProperties()
|
1035
1114
|
end
|
1036
|
-
def
|
1115
|
+
def find2()
|
1037
1116
|
end
|
1038
|
-
def
|
1117
|
+
def writable?()
|
1039
1118
|
end
|
1040
1119
|
#
|
1041
|
-
#
|
1120
|
+
# This will remove the tags that match the OR-ed together TagTypes from the file. By default it removes all tags.This will also invalidate pointers to the tags as their memory will be freed. In order to make the removal permanent save() still needs to be called
|
1121
|
+
#
|
1042
1122
|
#
|
1043
|
-
def
|
1123
|
+
def strip(int tags = AllTags)
|
1044
1124
|
end
|
1045
|
-
|
1046
|
-
# Returns a pointer to the tag's footer.
|
1047
|
-
#
|
1048
|
-
def footer()
|
1125
|
+
def valid?()
|
1049
1126
|
end
|
1050
1127
|
#
|
1051
|
-
#
|
1128
|
+
# Returns a pointer to the ID3v2 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v2 tag. If create is true it will create an ID3v1 tag if one does not exist. If there is already an APE tag, the new ID3v1 tag will be placed after it.The Tag is still owned by the TrueAudio::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
1129
|
+
#
|
1052
1130
|
#
|
1053
|
-
def
|
1131
|
+
def ID3v1Tag(bool create = false)
|
1054
1132
|
end
|
1055
1133
|
#
|
1056
|
-
#
|
1134
|
+
# Saves the file.
|
1057
1135
|
#
|
1058
|
-
def
|
1136
|
+
def save()
|
1059
1137
|
end
|
1060
|
-
|
1061
|
-
# Renders the in memory values to a ByteVector suitable for writing to the file.
|
1062
|
-
#
|
1063
|
-
def render()
|
1138
|
+
def isWritable()
|
1064
1139
|
end
|
1065
|
-
def
|
1140
|
+
def insert()
|
1066
1141
|
end
|
1067
|
-
|
1068
|
-
# Sets the album to s. If s is String::null then this value will be cleared.
|
1069
|
-
#
|
1070
|
-
def setAlbum( s)
|
1142
|
+
def find3()
|
1071
1143
|
end
|
1072
|
-
|
1073
|
-
# Returns a reference to the item list map. This is an ItemListMap of all of the items in the tag.This is the most powerfull structure for accessing the items of the tag.You should not modify this data structure directly, instead use setItem() and removeItem().
|
1074
|
-
#
|
1075
|
-
#
|
1076
|
-
def itemListMap()
|
1144
|
+
def read_only?()
|
1077
1145
|
end
|
1078
|
-
def
|
1146
|
+
def isOpen()
|
1147
|
+
end
|
1148
|
+
def tell()
|
1149
|
+
end
|
1150
|
+
def readBlock()
|
1151
|
+
end
|
1152
|
+
def length()
|
1079
1153
|
end
|
1080
1154
|
#
|
1081
|
-
#
|
1155
|
+
# Set the ID3v2::FrameFactory to something other than the default.ID3v2FrameFactory
|
1156
|
+
#
|
1082
1157
|
#
|
1083
|
-
def
|
1158
|
+
def setID3v2FrameFactory( ID3v2::FrameFactory factory)
|
1159
|
+
end
|
1160
|
+
def rfind()
|
1084
1161
|
end
|
1085
1162
|
end
|
1163
|
+
end
|
1086
1164
|
# <b>
|
1087
|
-
#
|
1088
|
-
#
|
1165
|
+
# A namespace for the classes used by Ogg-based metadata files. .</b>
|
1089
1166
|
#
|
1090
|
-
# This class provides the features of items in the APEv2 standard.
|
1091
1167
|
#
|
1092
|
-
|
1168
|
+
#
|
1093
1169
|
#
|
1094
|
-
|
1170
|
+
module TagLib::Ogg
|
1171
|
+
# <b>
|
1172
|
+
# An implementation of the page headers associated with each Ogg::Page. .</b>
|
1095
1173
|
#
|
1096
|
-
def setReadOnly(bool readOnly)
|
1097
|
-
end
|
1098
1174
|
#
|
1099
|
-
#
|
1175
|
+
# This class implements Ogg page headers which contain the information about Ogg pages needed to break them into packets which can be passed on to the codecs.
|
1100
1176
|
#
|
1101
|
-
|
1102
|
-
end
|
1177
|
+
class TagLib::Ogg::PageHeader
|
1103
1178
|
#
|
1104
|
-
#
|
1179
|
+
# Sets the internal flag indicating if the first packet in this page is continued to continued.firstPacketContinued()
|
1180
|
+
#
|
1105
1181
|
#
|
1106
|
-
def
|
1182
|
+
def setFirstPacketContinued(bool continued)
|
1107
1183
|
end
|
1108
1184
|
#
|
1109
|
-
#
|
1185
|
+
# This returns true if this is the last page of the Ogg (logical) stream.setLastPageOfStream()
|
1186
|
+
#
|
1110
1187
|
#
|
1111
|
-
def
|
1188
|
+
def lastPageOfStream()
|
1112
1189
|
end
|
1113
1190
|
#
|
1114
|
-
#
|
1191
|
+
# Every Ogg logical stream is given a random serial number which is common to every page in that logical stream. This sets this pages serial number. This method should be used when adding new pages to a logical stream.streamSerialNumber()
|
1115
1192
|
#
|
1116
1193
|
#
|
1117
|
-
def
|
1194
|
+
def setStreamSerialNumber(uint n)
|
1118
1195
|
end
|
1119
1196
|
#
|
1120
|
-
# Returns the
|
1197
|
+
# Returns true if the header parsed properly and is valid.
|
1121
1198
|
#
|
1122
|
-
def
|
1199
|
+
def isValid()
|
1123
1200
|
end
|
1124
1201
|
#
|
1125
|
-
#
|
1202
|
+
# Render the page header to binary data.The checksum -- bytes 22 - 25 -- will be left empty and must be filled in when rendering the entire page.
|
1203
|
+
#
|
1126
1204
|
#
|
1127
|
-
def
|
1205
|
+
def render()
|
1128
1206
|
end
|
1129
1207
|
#
|
1130
|
-
#
|
1208
|
+
# Returns true if the last packet of this page is completely contained in this page.firstPacketContinued() setLastPacketCompleted()
|
1209
|
+
#
|
1131
1210
|
#
|
1132
|
-
def
|
1211
|
+
def lastPacketCompleted()
|
1133
1212
|
end
|
1134
1213
|
#
|
1135
|
-
#
|
1214
|
+
# Marks this page as the last page of the Ogg stream.lastPageOfStream()
|
1215
|
+
#
|
1136
1216
|
#
|
1137
|
-
def
|
1217
|
+
def setLastPageOfStream(bool last)
|
1138
1218
|
end
|
1139
1219
|
#
|
1140
|
-
# Returns the
|
1220
|
+
# Returns the complete header size.
|
1141
1221
|
#
|
1142
1222
|
def size()
|
1143
1223
|
end
|
1144
1224
|
#
|
1145
|
-
#
|
1225
|
+
# Ogg pages contain a list of packets (which are used by the contained codecs). The sizes of these pages is encoded in the page header. This returns a list of the packet sizes in bytes.setPacketSizes()
|
1146
1226
|
#
|
1147
1227
|
#
|
1148
|
-
def
|
1228
|
+
def packetSizes()
|
1149
1229
|
end
|
1150
1230
|
#
|
1151
|
-
#
|
1231
|
+
# Returns the index of the page within the Ogg stream. This helps make it possible to determine if pages have been lost.setPageSequenceNumber()
|
1152
1232
|
#
|
1153
1233
|
#
|
1154
|
-
def
|
1234
|
+
def pageSequenceNumber()
|
1155
1235
|
end
|
1156
1236
|
#
|
1157
|
-
#
|
1237
|
+
# Sets the internal flag indicating if the last packet in this page is complete to completed.lastPacketCompleted()
|
1158
1238
|
#
|
1159
1239
|
#
|
1160
|
-
def
|
1240
|
+
def setLastPacketCompleted(bool completed)
|
1161
1241
|
end
|
1162
1242
|
#
|
1163
|
-
#
|
1243
|
+
# A special value of containing the position of the packet to be interpreted by the codec. In the case of Vorbis this contains the PCM value and is used to calculate the length of the stream.setAbsoluteGranularPosition()
|
1164
1244
|
#
|
1165
1245
|
#
|
1166
|
-
def
|
1246
|
+
def absoluteGranularPosition()
|
1167
1247
|
end
|
1168
1248
|
#
|
1169
|
-
#
|
1249
|
+
# Sets the sizes of the packets in this page to sizes. Internally this updates the lacing values in the header.packetSizes()
|
1250
|
+
#
|
1170
1251
|
#
|
1171
|
-
def
|
1252
|
+
def setPacketSizes( List< int > sizes)
|
1172
1253
|
end
|
1173
1254
|
#
|
1174
|
-
#
|
1255
|
+
# Sets the page's position in the stream to sequenceNumber.pageSequenceNumber()
|
1256
|
+
#
|
1175
1257
|
#
|
1176
|
-
def
|
1258
|
+
def setPageSequenceNumber(int sequenceNumber)
|
1177
1259
|
end
|
1178
1260
|
#
|
1179
|
-
#
|
1261
|
+
# This returns true if this is the first page of the Ogg (logical) stream.setFirstPageOfStream()
|
1180
1262
|
#
|
1181
1263
|
#
|
1182
|
-
def
|
1264
|
+
def firstPageOfStream()
|
1183
1265
|
end
|
1184
|
-
end
|
1185
|
-
# <b>
|
1186
|
-
# An implementation of APE footers. .</b>
|
1187
1266
|
#
|
1267
|
+
# A special value of containing the position of the packet to be interpreted by the codec. It is only supported here so that it may be coppied from one page to another.absoluteGranularPosition()
|
1268
|
+
#
|
1188
1269
|
#
|
1189
|
-
|
1270
|
+
def setAbsoluteGranularPosition(long long agp)
|
1271
|
+
end
|
1190
1272
|
#
|
1191
|
-
|
1273
|
+
# Some packets can be continued across multiple pages. If the first packet in the current page is a continuation this will return true. If this is page starts with a new packet this will return false.lastPacketCompleted() setFirstPacketContinued()
|
1274
|
+
#
|
1192
1275
|
#
|
1193
|
-
|
1276
|
+
def firstPacketContinued()
|
1277
|
+
end
|
1194
1278
|
#
|
1195
|
-
|
1279
|
+
# Returns the size of the data portion of the page -- i.e. the size of the page less the header size.
|
1280
|
+
#
|
1281
|
+
def dataSize()
|
1196
1282
|
end
|
1197
1283
|
#
|
1198
|
-
#
|
1284
|
+
# Marks this page as the first page of the Ogg stream.firstPageOfStream()
|
1199
1285
|
#
|
1200
1286
|
#
|
1201
|
-
def
|
1287
|
+
def setFirstPageOfStream(bool first)
|
1202
1288
|
end
|
1203
1289
|
#
|
1204
|
-
#
|
1290
|
+
# Every Ogg logical stream is given a random serial number which is common to every page in that logical stream. This returns the serial number of the stream associated with this packet.setStreamSerialNumber()
|
1291
|
+
#
|
1205
1292
|
#
|
1206
|
-
def
|
1293
|
+
def streamSerialNumber()
|
1207
1294
|
end
|
1295
|
+
end
|
1296
|
+
# <b>
|
1297
|
+
# An implementation of Ogg pages. .</b>
|
1208
1298
|
#
|
1209
|
-
# Returns the version number. (Note: This is the 1000 or 2000.)
|
1210
1299
|
#
|
1211
|
-
|
1212
|
-
end
|
1300
|
+
# This is an implementation of the pages that make up an Ogg stream. This handles parsing pages and breaking them down into packets and handles the details of packets spanning multiple pages and pages that contiain multiple packets.In most Xiph.org formats the comments are found in the first few packets, this however is a reasonably complete implementation of Ogg pages that could potentially be useful for non-meta data purposes.
|
1213
1301
|
#
|
1214
|
-
|
1302
|
+
class TagLib::Ogg::Page
|
1215
1303
|
#
|
1216
|
-
|
1304
|
+
# Returns the index of the first packet wholly or partially contained in this page.setFirstPacketIndex()
|
1305
|
+
#
|
1306
|
+
#
|
1307
|
+
def firstPacketIndex()
|
1217
1308
|
end
|
1218
1309
|
#
|
1219
|
-
# Returns the tag size in bytes. This is the size of the frame content and footer. The size of the entire tag will be this plus the header size, if present.completeTagSize()
|
1220
1310
|
#
|
1221
1311
|
#
|
1222
|
-
def
|
1312
|
+
def render()
|
1223
1313
|
end
|
1224
1314
|
#
|
1225
|
-
#
|
1315
|
+
# Sets the index of the first packet in the page.firstPacketIndex()
|
1316
|
+
#
|
1226
1317
|
#
|
1227
|
-
def
|
1318
|
+
def setFirstPacketIndex(int index)
|
1228
1319
|
end
|
1229
1320
|
#
|
1230
|
-
# Returns
|
1321
|
+
# Returns the size of the page in bytes.
|
1231
1322
|
#
|
1232
|
-
def
|
1323
|
+
def size()
|
1233
1324
|
end
|
1234
1325
|
#
|
1235
|
-
#
|
1326
|
+
# Checks to see if the specified packet is contained in the current page.ContainsPacketFlags
|
1236
1327
|
#
|
1237
1328
|
#
|
1238
|
-
def
|
1329
|
+
def containsPacket(int index)
|
1239
1330
|
end
|
1240
1331
|
#
|
1241
|
-
#
|
1332
|
+
# Returns the page's position within the file (in bytes).
|
1242
1333
|
#
|
1243
|
-
def
|
1334
|
+
def fileOffset()
|
1244
1335
|
end
|
1245
1336
|
#
|
1246
|
-
#
|
1247
|
-
#
|
1337
|
+
# Returns the number of packets (whole or partial) in this page.
|
1248
1338
|
#
|
1249
|
-
def
|
1339
|
+
def packetCount()
|
1250
1340
|
end
|
1251
1341
|
#
|
1252
|
-
# Returns the
|
1342
|
+
# Returns a pointer to the header for this page. This pointer will become invalid when the page is deleted.
|
1253
1343
|
#
|
1254
|
-
def
|
1344
|
+
def header()
|
1255
1345
|
end
|
1256
1346
|
#
|
1257
|
-
#
|
1347
|
+
# Returns a list of the packets in this page.Either or both the first and last packets may be only partial.
|
1348
|
+
# PageHeader::firstPacketContinued()
|
1349
|
+
#
|
1258
1350
|
#
|
1259
|
-
def
|
1351
|
+
def packets()
|
1260
1352
|
end
|
1261
1353
|
end
|
1262
|
-
end
|
1263
1354
|
# <b>
|
1264
|
-
#
|
1265
|
-
#
|
1355
|
+
# Ogg Vorbis comment implementation. .</b>
|
1266
1356
|
#
|
1267
|
-
# This is implementation of MPC metadata.This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream properties from the file. ID3v2 tags are invalid in MPC-files, but will be skipped and ignored.
|
1268
1357
|
#
|
1269
|
-
|
1270
|
-
|
1271
|
-
# An implementation of audio property reading for MPC. .</b>
|
1358
|
+
# This class is an implementation of the Ogg Vorbis comment specification, to be found in section 5 of the Ogg Vorbis specification. Because this format is also used in other (currently unsupported) Xiph.org formats, it has been made part of a generic implementation rather than being limited to strictly Vorbis.Vorbis comments are a simple vector of keys and values, called fields. Multiple values for a given key are supported.fieldListMap()
|
1359
|
+
#
|
1272
1360
|
#
|
1361
|
+
class TagLib::Ogg::XiphComment < TagLib::Tag
|
1362
|
+
def artist=()
|
1363
|
+
end
|
1273
1364
|
#
|
1274
|
-
#
|
1365
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
1275
1366
|
#
|
1276
|
-
|
1367
|
+
def setArtist( s)
|
1368
|
+
end
|
1277
1369
|
#
|
1278
|
-
#
|
1370
|
+
# Remove the field specified by key with the data value. If value is null, all of the fields with the given key will be removed.
|
1279
1371
|
#
|
1280
|
-
def
|
1372
|
+
def removeField( key, value = String::null)
|
1281
1373
|
end
|
1282
1374
|
#
|
1283
|
-
#
|
1375
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
1284
1376
|
#
|
1285
|
-
def
|
1377
|
+
def setTrack(uint i)
|
1286
1378
|
end
|
1287
1379
|
#
|
1288
|
-
# Returns the
|
1380
|
+
# Returns the number of fields present in the comment.
|
1289
1381
|
#
|
1290
|
-
def
|
1382
|
+
def fieldCount()
|
1291
1383
|
end
|
1292
1384
|
#
|
1293
|
-
# Returns the
|
1385
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
1294
1386
|
#
|
1295
|
-
def
|
1387
|
+
def album()
|
1296
1388
|
end
|
1297
1389
|
#
|
1298
|
-
#
|
1390
|
+
# Renders the comment to a ByteVector suitable for inserting into a file.If addFramingBit is true the standard Vorbis comment framing bit will be appended. However some formats (notably FLAC) do not work with this in place.
|
1299
1391
|
#
|
1300
|
-
def
|
1392
|
+
def render(bool addFramingBit)
|
1301
1393
|
end
|
1302
|
-
end
|
1303
|
-
# <b>
|
1304
|
-
# An implementation of TagLib::File with MPC specific methods. .</b>
|
1305
1394
|
#
|
1395
|
+
# Returns the year; if there is no year set, this will return 0.
|
1306
1396
|
#
|
1307
|
-
|
1308
|
-
#
|
1309
|
-
class TagLib::MPC::File < TagLib::File
|
1310
|
-
def name()
|
1397
|
+
def year()
|
1311
1398
|
end
|
1312
|
-
def
|
1399
|
+
def album=()
|
1313
1400
|
end
|
1314
|
-
|
1401
|
+
#
|
1402
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
1403
|
+
#
|
1404
|
+
def setAlbum( s)
|
1315
1405
|
end
|
1316
|
-
def
|
1406
|
+
def year=()
|
1317
1407
|
end
|
1318
1408
|
#
|
1319
|
-
# Returns
|
1320
|
-
#
|
1409
|
+
# Returns true if the tag does not contain any data. This should be reimplemented in subclasses that provide more than the basic tagging abilities in this class.
|
1321
1410
|
#
|
1322
|
-
def
|
1411
|
+
def isEmpty()
|
1323
1412
|
end
|
1324
1413
|
#
|
1325
|
-
#
|
1414
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
1326
1415
|
#
|
1327
|
-
def
|
1328
|
-
end
|
1329
|
-
def isWritable()
|
1330
|
-
end
|
1331
|
-
def find3()
|
1332
|
-
end
|
1333
|
-
def clear()
|
1334
|
-
end
|
1335
|
-
def read_only?()
|
1416
|
+
def genre()
|
1336
1417
|
end
|
1337
1418
|
#
|
1338
|
-
# Returns the
|
1419
|
+
# Returns a reference to the map of field lists. Because Xiph comments support multiple fields with the same key, a pure Map would not work. As such this is a Map of string lists, keyed on the comment field name.The standard set of Xiph/Vorbis fields (which may or may not be contained in any specific comment) is:
|
1339
1420
|
#
|
1340
|
-
|
1341
|
-
end
|
1342
|
-
def isOpen()
|
1343
|
-
end
|
1344
|
-
def readBlock()
|
1345
|
-
end
|
1346
|
-
def rfind()
|
1347
|
-
end
|
1421
|
+
# TITLE
|
1348
1422
|
#
|
1349
|
-
#
|
1350
|
-
#
|
1423
|
+
# VERSION
|
1351
1424
|
#
|
1352
|
-
|
1353
|
-
end
|
1354
|
-
def writable?()
|
1355
|
-
end
|
1425
|
+
# ALBUM
|
1356
1426
|
#
|
1357
|
-
#
|
1358
|
-
# In order to make the removal permanent save() still needs to be called.
|
1359
|
-
#
|
1427
|
+
# ARTIST
|
1360
1428
|
#
|
1361
|
-
|
1362
|
-
end
|
1363
|
-
def writeBlock()
|
1364
|
-
end
|
1429
|
+
# PERFORMER
|
1365
1430
|
#
|
1366
|
-
#
|
1431
|
+
# COPYRIGHT
|
1432
|
+
#
|
1433
|
+
# ORGANIZATION
|
1434
|
+
#
|
1435
|
+
# DESCRIPTION
|
1436
|
+
#
|
1437
|
+
# GENRE
|
1438
|
+
#
|
1439
|
+
# DATE
|
1440
|
+
#
|
1441
|
+
# LOCATION
|
1442
|
+
#
|
1443
|
+
# CONTACT
|
1444
|
+
#
|
1445
|
+
# ISRC
|
1446
|
+
#
|
1447
|
+
# For a more detailed description of these fields, please see the Ogg Vorbis specification, section 5.2.2.1.The Ogg Vorbis comment specification does allow these key values to be either upper or lower case. However, it is conventional for them to be upper case. As such, TagLib, when parsing a Xiph/Vorbis comment, converts all fields to uppercase. When you are using this data structure, you will need to specify the field name in upper case.
|
1448
|
+
# You should not modify this data structure directly, instead use addField() and removeField().
|
1367
1449
|
#
|
1368
1450
|
#
|
1369
|
-
def
|
1370
|
-
end
|
1371
|
-
def insert()
|
1372
|
-
end
|
1373
|
-
def removeBlock()
|
1374
|
-
end
|
1375
|
-
def open?()
|
1451
|
+
def fieldListMap()
|
1376
1452
|
end
|
1377
|
-
def
|
1453
|
+
def genre=()
|
1378
1454
|
end
|
1379
|
-
|
1455
|
+
#
|
1456
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
1457
|
+
#
|
1458
|
+
def setComment( s)
|
1380
1459
|
end
|
1381
|
-
|
1460
|
+
#
|
1461
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
1462
|
+
#
|
1463
|
+
def comment()
|
1382
1464
|
end
|
1383
|
-
def
|
1465
|
+
def empty?()
|
1384
1466
|
end
|
1385
|
-
def
|
1467
|
+
def comment=()
|
1386
1468
|
end
|
1387
1469
|
#
|
1388
|
-
# Returns the
|
1470
|
+
# Returns the vendor ID of the Ogg Vorbis encoder. libvorbis 1.0 as the most common case always returns "Xiph.Org libVorbis I 20020717".
|
1389
1471
|
#
|
1390
|
-
def
|
1472
|
+
def vendorID()
|
1391
1473
|
end
|
1392
|
-
end
|
1393
|
-
end
|
1394
|
-
# <b>
|
1395
|
-
# An implementation of FLAC metadata. .</b>
|
1396
1474
|
#
|
1475
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
1397
1476
|
#
|
1398
|
-
|
1477
|
+
def track()
|
1478
|
+
end
|
1479
|
+
def track=()
|
1480
|
+
end
|
1399
1481
|
#
|
1400
|
-
|
1401
|
-
# <b>
|
1402
|
-
# An implementation of audio property reading for FLAC. .</b>
|
1482
|
+
# Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.
|
1403
1483
|
#
|
1484
|
+
def setGenre( s)
|
1485
|
+
end
|
1404
1486
|
#
|
1405
|
-
#
|
1487
|
+
# Returns true if the field is contained within the comment.This is safer than checking for membership in the FieldListMap.
|
1488
|
+
#
|
1406
1489
|
#
|
1407
|
-
|
1490
|
+
def contains( key)
|
1491
|
+
end
|
1408
1492
|
#
|
1409
|
-
# Returns the
|
1493
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
1410
1494
|
#
|
1411
|
-
def
|
1495
|
+
def title()
|
1496
|
+
end
|
1497
|
+
def title=()
|
1412
1498
|
end
|
1413
1499
|
#
|
1414
|
-
#
|
1500
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
1415
1501
|
#
|
1416
|
-
def
|
1502
|
+
def setTitle( s)
|
1417
1503
|
end
|
1418
1504
|
#
|
1419
|
-
#
|
1505
|
+
# Add the field specified by key with the data value. If replace is true, then all of the other fields with the same key will be removed first.If the field value is empty, the field will be removed.
|
1420
1506
|
#
|
1421
|
-
def
|
1507
|
+
def addField( key, value,bool replace = true)
|
1422
1508
|
end
|
1423
1509
|
#
|
1424
|
-
#
|
1510
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
1425
1511
|
#
|
1426
|
-
def
|
1512
|
+
def setYear(uint i)
|
1427
1513
|
end
|
1428
1514
|
#
|
1429
|
-
# Returns the
|
1515
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
1430
1516
|
#
|
1431
|
-
def
|
1517
|
+
def artist()
|
1432
1518
|
end
|
1433
1519
|
end
|
1434
1520
|
# <b>
|
1435
|
-
# An implementation of TagLib::File with
|
1521
|
+
# An implementation of TagLib::File with some helpers for Ogg based formats. .</b>
|
1436
1522
|
#
|
1437
1523
|
#
|
1438
|
-
# This
|
1524
|
+
# This is an implementation of Ogg file page and packet rendering and is of use to Ogg based formats. While the API is small this handles the non-trivial details of breaking up an Ogg stream into packets and makes these available (via subclassing) to the codec meta data implementations.
|
1439
1525
|
#
|
1440
|
-
class TagLib::
|
1526
|
+
class TagLib::Ogg::File < TagLib::File
|
1441
1527
|
def name()
|
1442
1528
|
end
|
1443
1529
|
def seek()
|
1444
1530
|
end
|
1445
|
-
def
|
1446
|
-
end
|
1447
|
-
def valid?()
|
1531
|
+
def writeBlock()
|
1448
1532
|
end
|
1449
1533
|
#
|
1450
|
-
# Returns the
|
1534
|
+
# Returns the packet contents for the i-th packet (starting from zero) in the Ogg bitstream.The requires reading at least the packet header for every page up to the requested page.
|
1535
|
+
#
|
1451
1536
|
#
|
1452
|
-
def
|
1537
|
+
def packet(uint i)
|
1453
1538
|
end
|
1454
|
-
|
1455
|
-
# Save the file. This will primarily save the XiphComment, but will also keep any old ID3-tags up to date. If the file has no XiphComment, one will be constructed from the ID3-tags.This returns true if the save was successful.
|
1456
|
-
#
|
1457
|
-
def save()
|
1539
|
+
def removeBlock()
|
1458
1540
|
end
|
1459
|
-
def
|
1541
|
+
def open?()
|
1460
1542
|
end
|
1461
|
-
def
|
1543
|
+
def isValid()
|
1462
1544
|
end
|
1463
|
-
def
|
1545
|
+
def find1()
|
1464
1546
|
end
|
1465
|
-
def
|
1547
|
+
def clear()
|
1466
1548
|
end
|
1467
1549
|
#
|
1468
|
-
#
|
1469
|
-
#
|
1550
|
+
# Sets the packet with index i to the value p.
|
1470
1551
|
#
|
1471
|
-
def
|
1552
|
+
def setPacket(uint i, ByteVector p)
|
1472
1553
|
end
|
1473
|
-
def
|
1554
|
+
def tag()
|
1474
1555
|
end
|
1475
|
-
def
|
1556
|
+
def readOnly()
|
1476
1557
|
end
|
1477
|
-
|
1478
|
-
# Returns a pointer to the ID3v2 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v2 tag. If create is true it will create an ID3v2 tag if one does not exist.The Tag is still owned by the FLAC::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
1479
|
-
#
|
1480
|
-
#
|
1481
|
-
def ID3v2Tag(bool create = false)
|
1558
|
+
def audioProperties()
|
1482
1559
|
end
|
1483
|
-
def
|
1560
|
+
def find2()
|
1484
1561
|
end
|
1485
1562
|
def writable?()
|
1486
1563
|
end
|
1487
|
-
def writeBlock()
|
1488
|
-
end
|
1489
1564
|
#
|
1490
|
-
# Returns a pointer to the
|
1491
|
-
#
|
1565
|
+
# Returns a pointer to the PageHeader for the first page in the stream or null if the page could not be found.
|
1492
1566
|
#
|
1493
|
-
def
|
1494
|
-
end
|
1495
|
-
def insert()
|
1496
|
-
end
|
1497
|
-
def removeBlock()
|
1567
|
+
def firstPageHeader()
|
1498
1568
|
end
|
1499
|
-
def
|
1569
|
+
def valid?()
|
1500
1570
|
end
|
1501
1571
|
#
|
1502
|
-
#
|
1572
|
+
# Save the file and its associated tags. This should be reimplemented in the concrete subclasses. Returns true if the save succeeds.On UNIX multiple processes are able to write to the same file at the same time. This can result in serious file corruption. If you are developing a program that makes use of TagLib from multiple processes you must insure that you are only doing writes to a particular file from one of them.
|
1503
1573
|
#
|
1504
1574
|
#
|
1505
|
-
def
|
1575
|
+
def save()
|
1506
1576
|
end
|
1507
|
-
def
|
1577
|
+
def isWritable()
|
1508
1578
|
end
|
1509
|
-
def
|
1579
|
+
def insert()
|
1580
|
+
end
|
1581
|
+
def find3()
|
1510
1582
|
end
|
1511
1583
|
#
|
1512
|
-
# Returns
|
1584
|
+
# Returns a pointer to the PageHeader for the last page in the stream or null if the page could not be found.
|
1513
1585
|
#
|
1514
|
-
def
|
1586
|
+
def lastPageHeader()
|
1515
1587
|
end
|
1516
|
-
def
|
1588
|
+
def read_only?()
|
1517
1589
|
end
|
1518
|
-
def
|
1590
|
+
def isOpen()
|
1519
1591
|
end
|
1520
|
-
def
|
1592
|
+
def tell()
|
1521
1593
|
end
|
1522
|
-
|
1523
|
-
# Set the ID3v2::FrameFactory to something other than the default. This can be used to specify the way that ID3v2 frames will be interpreted whenID3v2FrameFactory
|
1524
|
-
#
|
1525
|
-
#
|
1526
|
-
def setID3v2FrameFactory( ID3v2::FrameFactory factory)
|
1594
|
+
def readBlock()
|
1527
1595
|
end
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
def audioProperties()
|
1596
|
+
def length()
|
1597
|
+
end
|
1598
|
+
def rfind()
|
1532
1599
|
end
|
1533
1600
|
end
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1601
|
+
module TagLib::Ogg::Flac
|
1602
|
+
class TagLib::Ogg::Flac::File < TagLib::Ogg::File
|
1603
|
+
def name()
|
1604
|
+
end
|
1605
|
+
def seek()
|
1606
|
+
end
|
1607
|
+
def writeBlock()
|
1608
|
+
end
|
1609
|
+
def packet()
|
1610
|
+
end
|
1611
|
+
def removeBlock()
|
1612
|
+
end
|
1613
|
+
def open?()
|
1614
|
+
end
|
1615
|
+
def isValid()
|
1616
|
+
end
|
1617
|
+
def streamLength()
|
1618
|
+
end
|
1619
|
+
def find1()
|
1620
|
+
end
|
1621
|
+
def clear()
|
1622
|
+
end
|
1623
|
+
def setPacket()
|
1624
|
+
end
|
1625
|
+
def tag()
|
1626
|
+
end
|
1627
|
+
def readOnly()
|
1628
|
+
end
|
1629
|
+
def audioProperties()
|
1630
|
+
end
|
1631
|
+
def find2()
|
1632
|
+
end
|
1633
|
+
def writable?()
|
1634
|
+
end
|
1635
|
+
def firstPageHeader()
|
1636
|
+
end
|
1637
|
+
def valid?()
|
1638
|
+
end
|
1639
|
+
def save()
|
1640
|
+
end
|
1641
|
+
def isWritable()
|
1642
|
+
end
|
1643
|
+
def insert()
|
1644
|
+
end
|
1645
|
+
def find3()
|
1646
|
+
end
|
1647
|
+
def lastPageHeader()
|
1648
|
+
end
|
1649
|
+
def read_only?()
|
1650
|
+
end
|
1651
|
+
def isOpen()
|
1652
|
+
end
|
1653
|
+
def tell()
|
1654
|
+
end
|
1655
|
+
def readBlock()
|
1656
|
+
end
|
1657
|
+
def length()
|
1658
|
+
end
|
1659
|
+
def rfind()
|
1660
|
+
end
|
1661
|
+
end
|
1662
|
+
end
|
1663
|
+
# <b>
|
1664
|
+
# A namespace containing classes for Speex metadata. .</b>
|
1544
1665
|
#
|
1545
1666
|
#
|
1546
|
-
#
|
1667
|
+
#
|
1547
1668
|
#
|
1548
|
-
|
1669
|
+
module TagLib::Ogg::Speex
|
1670
|
+
# <b>
|
1671
|
+
# An implementation of audio property reading for Ogg Speex. .</b>
|
1549
1672
|
#
|
1550
|
-
# Returns WavPack version.
|
1551
1673
|
#
|
1552
|
-
|
1553
|
-
|
1674
|
+
# This reads the data from an Ogg Speex stream found in the AudioProperties API.
|
1675
|
+
#
|
1676
|
+
class TagLib::Ogg::Speex::Properties < TagLib::AudioProperties
|
1677
|
+
#
|
1678
|
+
# Returns the number of audio channels.
|
1679
|
+
#
|
1680
|
+
def channels()
|
1681
|
+
end
|
1554
1682
|
#
|
1555
1683
|
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
1556
1684
|
#
|
1557
|
-
|
1558
|
-
|
1685
|
+
def bitrate()
|
1686
|
+
end
|
1559
1687
|
#
|
1560
|
-
# Returns
|
1688
|
+
# Returns the Speex version, currently "0" (as specified by the spec).
|
1561
1689
|
#
|
1562
|
-
|
1563
|
-
|
1690
|
+
def speexVersion()
|
1691
|
+
end
|
1564
1692
|
#
|
1565
1693
|
# Returns the sample rate in Hz.
|
1566
1694
|
#
|
1567
|
-
|
1568
|
-
|
1695
|
+
def sampleRate()
|
1696
|
+
end
|
1569
1697
|
#
|
1570
|
-
# Returns the
|
1698
|
+
# Returns the length of the file in seconds.
|
1571
1699
|
#
|
1572
|
-
|
1573
|
-
|
1700
|
+
def length()
|
1701
|
+
end
|
1702
|
+
end
|
1703
|
+
# <b>
|
1704
|
+
# An implementation of Ogg::File with Speex specific methods. .</b>
|
1574
1705
|
#
|
1575
|
-
# Returns the length of the file in seconds.
|
1576
1706
|
#
|
1577
|
-
|
1707
|
+
# This is the central class in the Ogg Speex metadata processing collection of classes. It's built upon Ogg::File which handles processing of the Ogg logical bitstream and breaking it down into pages which are handled by the codec implementations, in this case Speex specifically.
|
1708
|
+
#
|
1709
|
+
class TagLib::Ogg::Speex::File < TagLib::Ogg::File
|
1710
|
+
def name()
|
1711
|
+
end
|
1712
|
+
def seek()
|
1713
|
+
end
|
1714
|
+
def writeBlock()
|
1715
|
+
end
|
1716
|
+
def packet()
|
1717
|
+
end
|
1718
|
+
def removeBlock()
|
1719
|
+
end
|
1720
|
+
def open?()
|
1721
|
+
end
|
1722
|
+
def isValid()
|
1723
|
+
end
|
1724
|
+
def find1()
|
1725
|
+
end
|
1726
|
+
def clear()
|
1727
|
+
end
|
1728
|
+
def setPacket()
|
1729
|
+
end
|
1730
|
+
#
|
1731
|
+
# Returns the XiphComment for this file. XiphComment implements the tag interface, so this serves as the reimplementation of TagLib::File::tag().
|
1732
|
+
#
|
1733
|
+
def tag()
|
1734
|
+
end
|
1735
|
+
def readOnly()
|
1736
|
+
end
|
1737
|
+
#
|
1738
|
+
# Returns the Speex::Properties for this file. If no audio properties were read then this will return a null pointer.
|
1739
|
+
#
|
1740
|
+
def audioProperties()
|
1741
|
+
end
|
1742
|
+
def find2()
|
1743
|
+
end
|
1744
|
+
def writable?()
|
1745
|
+
end
|
1746
|
+
def firstPageHeader()
|
1747
|
+
end
|
1748
|
+
def valid?()
|
1749
|
+
end
|
1750
|
+
#
|
1751
|
+
# Save the file and its associated tags. This should be reimplemented in the concrete subclasses. Returns true if the save succeeds.On UNIX multiple processes are able to write to the same file at the same time. This can result in serious file corruption. If you are developing a program that makes use of TagLib from multiple processes you must insure that you are only doing writes to a particular file from one of them.
|
1752
|
+
#
|
1753
|
+
#
|
1754
|
+
def save()
|
1755
|
+
end
|
1756
|
+
def isWritable()
|
1757
|
+
end
|
1758
|
+
def insert()
|
1759
|
+
end
|
1760
|
+
def find3()
|
1761
|
+
end
|
1762
|
+
def lastPageHeader()
|
1763
|
+
end
|
1764
|
+
def read_only?()
|
1765
|
+
end
|
1766
|
+
def isOpen()
|
1767
|
+
end
|
1768
|
+
def tell()
|
1769
|
+
end
|
1770
|
+
def readBlock()
|
1771
|
+
end
|
1772
|
+
def length()
|
1773
|
+
end
|
1774
|
+
def rfind()
|
1775
|
+
end
|
1776
|
+
end
|
1578
1777
|
end
|
1778
|
+
end
|
1779
|
+
# <b>
|
1780
|
+
# An ID3v1 implementation. .</b>
|
1781
|
+
#
|
1782
|
+
#
|
1783
|
+
#
|
1784
|
+
#
|
1785
|
+
module TagLib::ID3v1
|
1786
|
+
# Singleton methods
|
1787
|
+
def self.genre()
|
1788
|
+
end
|
1789
|
+
def self.genreMap()
|
1790
|
+
end
|
1791
|
+
def self.genreList()
|
1792
|
+
end
|
1793
|
+
def self.genreIndex()
|
1579
1794
|
end
|
1580
1795
|
# <b>
|
1581
|
-
#
|
1796
|
+
# The main class in the ID3v1 implementation. .</b>
|
1582
1797
|
#
|
1583
1798
|
#
|
1584
|
-
# This
|
1799
|
+
# This is an implementation of the ID3v1 format. ID3v1 is both the simplist and most common of tag formats but is rather limited. Because of its pervasiveness and the way that applications have been written around the fields that it provides, the generic TagLib::Tag API is a mirror of what is provided by ID3v1.ID3v1 tags should generally only contain Latin1 information. However because many applications do not follow this rule there is now support for overriding the ID3v1 string handling using the ID3v1::StringHandler class. Please see the documentation for that class for more information.StringHandler
|
1800
|
+
# Most fields are truncated to a maximum of 28-30 bytes. The truncation happens automatically when the tag is rendered.
|
1801
|
+
#
|
1585
1802
|
#
|
1586
|
-
class TagLib::
|
1587
|
-
def
|
1588
|
-
end
|
1589
|
-
def seek()
|
1590
|
-
end
|
1591
|
-
def find2()
|
1592
|
-
end
|
1593
|
-
def valid?()
|
1803
|
+
class TagLib::ID3v1::Tag < TagLib::Tag
|
1804
|
+
def artist=()
|
1594
1805
|
end
|
1595
1806
|
#
|
1596
|
-
#
|
1597
|
-
#
|
1807
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
1598
1808
|
#
|
1599
|
-
def
|
1809
|
+
def setArtist( s)
|
1600
1810
|
end
|
1601
1811
|
#
|
1602
|
-
#
|
1812
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
1603
1813
|
#
|
1604
|
-
def
|
1605
|
-
end
|
1606
|
-
def isWritable()
|
1607
|
-
end
|
1608
|
-
def find3()
|
1814
|
+
def setTrack(uint i)
|
1609
1815
|
end
|
1610
|
-
|
1816
|
+
#
|
1817
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
1818
|
+
#
|
1819
|
+
def album()
|
1611
1820
|
end
|
1612
|
-
|
1821
|
+
#
|
1822
|
+
# Renders the in memory values to a ByteVector suitable for writing to the file.
|
1823
|
+
#
|
1824
|
+
def render()
|
1613
1825
|
end
|
1614
1826
|
#
|
1615
|
-
# Returns the
|
1827
|
+
# Returns the year; if there is no year set, this will return 0.
|
1616
1828
|
#
|
1617
|
-
def
|
1829
|
+
def year()
|
1618
1830
|
end
|
1619
|
-
def
|
1831
|
+
def album=()
|
1620
1832
|
end
|
1621
|
-
|
1833
|
+
#
|
1834
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
1835
|
+
#
|
1836
|
+
def setAlbum( s)
|
1622
1837
|
end
|
1623
|
-
def
|
1838
|
+
def year=()
|
1624
1839
|
end
|
1625
|
-
def
|
1840
|
+
def isEmpty()
|
1626
1841
|
end
|
1627
1842
|
#
|
1628
|
-
#
|
1629
|
-
#
|
1843
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
1630
1844
|
#
|
1631
|
-
def
|
1845
|
+
def genre()
|
1632
1846
|
end
|
1633
|
-
def
|
1847
|
+
def genre=()
|
1634
1848
|
end
|
1635
1849
|
#
|
1636
|
-
#
|
1637
|
-
#
|
1850
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
1638
1851
|
#
|
1639
|
-
def
|
1852
|
+
def setComment( s)
|
1640
1853
|
end
|
1641
|
-
|
1854
|
+
#
|
1855
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
1856
|
+
#
|
1857
|
+
def comment()
|
1642
1858
|
end
|
1643
|
-
def
|
1859
|
+
def empty?()
|
1644
1860
|
end
|
1645
|
-
def
|
1861
|
+
def comment=()
|
1646
1862
|
end
|
1647
|
-
|
1863
|
+
#
|
1864
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
1865
|
+
#
|
1866
|
+
def track()
|
1648
1867
|
end
|
1649
|
-
def
|
1868
|
+
def track=()
|
1650
1869
|
end
|
1651
|
-
|
1870
|
+
#
|
1871
|
+
# Sets the genre to s. If s is String::null then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.
|
1872
|
+
#
|
1873
|
+
def setGenre( s)
|
1652
1874
|
end
|
1653
|
-
|
1875
|
+
#
|
1876
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
1877
|
+
#
|
1878
|
+
def title()
|
1654
1879
|
end
|
1655
|
-
def
|
1880
|
+
def title=()
|
1656
1881
|
end
|
1657
1882
|
#
|
1658
|
-
#
|
1883
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
1659
1884
|
#
|
1660
|
-
def
|
1885
|
+
def setTitle( s)
|
1886
|
+
end
|
1887
|
+
#
|
1888
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
1889
|
+
#
|
1890
|
+
def setYear(uint i)
|
1891
|
+
end
|
1892
|
+
#
|
1893
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
1894
|
+
#
|
1895
|
+
def artist()
|
1661
1896
|
end
|
1662
1897
|
end
|
1663
1898
|
end
|
1664
1899
|
# <b>
|
1665
|
-
#
|
1900
|
+
# A namespace containing classes for Vorbis metadata. .</b>
|
1666
1901
|
#
|
1667
1902
|
#
|
1668
|
-
# This is a relatively complete and flexible framework for working with ID3v2 tags.ID3v2::Tag
|
1669
1903
|
#
|
1670
1904
|
#
|
1671
|
-
module TagLib::
|
1905
|
+
module TagLib::Vorbis
|
1672
1906
|
# <b>
|
1673
|
-
# An implementation of
|
1674
|
-
#
|
1907
|
+
# An implementation of audio property reading for Ogg Vorbis. .</b>
|
1675
1908
|
#
|
1676
|
-
# This implements the ID3v2 comment format. An ID3v2 comment concists of a language encoding, a description and a single text field.
|
1677
1909
|
#
|
1678
|
-
|
1679
|
-
end
|
1680
|
-
# <b>
|
1681
|
-
# The main class in the ID3v2 implementation. .</b>
|
1910
|
+
# This reads the data from an Ogg Vorbis stream found in the AudioProperties API.
|
1682
1911
|
#
|
1912
|
+
class TagLib::Vorbis::Properties < TagLib::AudioProperties
|
1683
1913
|
#
|
1684
|
-
#
|
1685
|
-
# Dealing with the nasty details of ID3v2 is not for the faint of heart and should not be done without much meditation on the spec. It's rather long, but if you're planning on messing with this class and others that deal with the details of ID3v2 (rather than the nice, safe, abstract TagLib::Tag and friends), it's worth your time to familiarize yourself with said spec (which is distrubuted with the TagLib sources). TagLib tries to do most of the work, but with a little luck, you can still convince it to generate invalid ID3v2 tags. The APIs for ID3v2 assume a working knowledge of ID3v2 structure. You're been warned.
|
1686
|
-
#
|
1914
|
+
# Returns the number of audio channels.
|
1687
1915
|
#
|
1688
|
-
|
1689
|
-
def genre=()
|
1916
|
+
def channels()
|
1690
1917
|
end
|
1691
1918
|
#
|
1692
|
-
#
|
1919
|
+
# Returns the maximum bitrate as read from the Vorbis identification header.
|
1693
1920
|
#
|
1694
|
-
def
|
1921
|
+
def bitrateMaximum()
|
1695
1922
|
end
|
1696
1923
|
#
|
1697
|
-
# Returns the
|
1924
|
+
# Returns the nominal bitrate as read from the Vorbis identification header.
|
1698
1925
|
#
|
1699
|
-
def
|
1926
|
+
def bitrateNominal()
|
1700
1927
|
end
|
1701
1928
|
#
|
1702
|
-
# Returns the
|
1929
|
+
# Returns the minimum bitrate as read from the Vorbis identification header.
|
1703
1930
|
#
|
1704
|
-
def
|
1705
|
-
end
|
1706
|
-
def track=()
|
1931
|
+
def bitrateMinimum()
|
1707
1932
|
end
|
1708
1933
|
#
|
1709
|
-
#
|
1934
|
+
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
1710
1935
|
#
|
1711
|
-
def
|
1936
|
+
def bitrate()
|
1712
1937
|
end
|
1713
1938
|
#
|
1714
|
-
# Returns the
|
1939
|
+
# Returns the sample rate in Hz.
|
1715
1940
|
#
|
1716
|
-
def
|
1717
|
-
end
|
1718
|
-
def year=()
|
1941
|
+
def sampleRate()
|
1719
1942
|
end
|
1720
1943
|
#
|
1721
|
-
# Returns
|
1944
|
+
# Returns the length of the file in seconds.
|
1722
1945
|
#
|
1723
|
-
def
|
1724
|
-
end
|
1725
|
-
def title=()
|
1946
|
+
def length()
|
1726
1947
|
end
|
1727
1948
|
#
|
1728
|
-
#
|
1949
|
+
# Returns the Vorbis version, currently "0" (as specified by the spec).
|
1729
1950
|
#
|
1730
|
-
def
|
1951
|
+
def vorbisVersion()
|
1731
1952
|
end
|
1953
|
+
end
|
1954
|
+
# <b>
|
1955
|
+
# An implementation of Ogg::File with Vorbis specific methods. .</b>
|
1732
1956
|
#
|
1733
|
-
# Sets the year to i. If s is 0 then this value will be cleared.
|
1734
|
-
#
|
1735
|
-
def setYear(uint i)
|
1736
|
-
end
|
1737
1957
|
#
|
1738
|
-
#
|
1958
|
+
# This is the central class in the Ogg Vorbis metadata processing collection of classes. It's built upon Ogg::File which handles processing of the Ogg logical bitstream and breaking it down into pages which are handled by the codec implementations, in this case Vorbis specifically.
|
1739
1959
|
#
|
1740
|
-
|
1960
|
+
class TagLib::Vorbis::File < TagLib::Ogg::File
|
1961
|
+
def name()
|
1741
1962
|
end
|
1742
|
-
def
|
1963
|
+
def seek()
|
1743
1964
|
end
|
1744
|
-
|
1745
|
-
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
1746
|
-
#
|
1747
|
-
def artist()
|
1965
|
+
def writeBlock()
|
1748
1966
|
end
|
1749
|
-
def
|
1967
|
+
def packet()
|
1750
1968
|
end
|
1751
|
-
def
|
1969
|
+
def removeBlock()
|
1752
1970
|
end
|
1753
|
-
|
1754
|
-
# Sets the artist to s. If s is String::null then this value will be cleared.
|
1755
|
-
#
|
1756
|
-
def setArtist( s)
|
1971
|
+
def open?()
|
1757
1972
|
end
|
1758
|
-
|
1759
|
-
# Sets the track to i. If s is 0 then this value will be cleared.
|
1760
|
-
#
|
1761
|
-
def setTrack(uint i)
|
1973
|
+
def isValid()
|
1762
1974
|
end
|
1763
|
-
|
1764
|
-
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
1765
|
-
#
|
1766
|
-
def album()
|
1975
|
+
def find1()
|
1767
1976
|
end
|
1768
|
-
def
|
1977
|
+
def clear()
|
1978
|
+
end
|
1979
|
+
def setPacket()
|
1769
1980
|
end
|
1770
1981
|
#
|
1771
|
-
#
|
1982
|
+
# Returns the XiphComment for this file. XiphComment implements the tag interface, so this serves as the reimplementation of TagLib::File::tag().
|
1772
1983
|
#
|
1773
|
-
def
|
1984
|
+
def tag()
|
1985
|
+
end
|
1986
|
+
def readOnly()
|
1774
1987
|
end
|
1775
1988
|
#
|
1776
|
-
# Returns
|
1989
|
+
# Returns the Vorbis::Properties for this file. If no audio properties were read then this will return a null pointer.
|
1777
1990
|
#
|
1778
|
-
def
|
1991
|
+
def audioProperties()
|
1992
|
+
end
|
1993
|
+
def find2()
|
1994
|
+
end
|
1995
|
+
def writable?()
|
1996
|
+
end
|
1997
|
+
def firstPageHeader()
|
1998
|
+
end
|
1999
|
+
def valid?()
|
1779
2000
|
end
|
1780
2001
|
#
|
1781
|
-
#
|
2002
|
+
# Save the file and its associated tags. This should be reimplemented in the concrete subclasses. Returns true if the save succeeds.On UNIX multiple processes are able to write to the same file at the same time. This can result in serious file corruption. If you are developing a program that makes use of TagLib from multiple processes you must insure that you are only doing writes to a particular file from one of them.
|
2003
|
+
#
|
1782
2004
|
#
|
1783
|
-
def
|
2005
|
+
def save()
|
2006
|
+
end
|
2007
|
+
def isWritable()
|
2008
|
+
end
|
2009
|
+
def insert()
|
2010
|
+
end
|
2011
|
+
def find3()
|
2012
|
+
end
|
2013
|
+
def lastPageHeader()
|
2014
|
+
end
|
2015
|
+
def read_only?()
|
2016
|
+
end
|
2017
|
+
def isOpen()
|
2018
|
+
end
|
2019
|
+
def tell()
|
2020
|
+
end
|
2021
|
+
def readBlock()
|
2022
|
+
end
|
2023
|
+
def length()
|
2024
|
+
end
|
2025
|
+
def rfind()
|
1784
2026
|
end
|
1785
2027
|
end
|
2028
|
+
end
|
1786
2029
|
# <b>
|
1787
|
-
# An implementation of
|
2030
|
+
# An implementation of TagLib::File with MPEG (MP3) specific methods. .</b>
|
1788
2031
|
#
|
1789
2032
|
#
|
1790
|
-
#
|
2033
|
+
#
|
1791
2034
|
#
|
1792
|
-
|
1793
|
-
|
1794
|
-
#
|
1795
|
-
# A factory for creating ID3v2 frames during parsing. .</b>
|
2035
|
+
module TagLib::MPEG
|
2036
|
+
# <b>
|
2037
|
+
# An implementation of the Xing VBR headers. .</b>
|
1796
2038
|
#
|
1797
2039
|
#
|
1798
|
-
# This
|
1799
|
-
# ID3v2::Tag::addFrame()
|
1800
|
-
#
|
2040
|
+
# This is a minimalistic implementation of the Xing VBR headers. Xing headers are often added to VBR (variable bit rate) MP3 streams to make it easy to compute the length and quality of a VBR stream. Our implementation is only concerned with the total size of the stream (so that we can calculate the total playing time and the average bitrate). It uses this text and the XMMS sources as references.
|
1801
2041
|
#
|
1802
|
-
class TagLib::
|
1803
|
-
end
|
1804
|
-
# <b>
|
1805
|
-
# An ID3v2 general encapsulated object frame implementation. .</b>
|
2042
|
+
class TagLib::MPEG::XingHeader
|
1806
2043
|
#
|
2044
|
+
# Returns the total number of frames.
|
1807
2045
|
#
|
1808
|
-
|
2046
|
+
def totalFrames()
|
2047
|
+
end
|
1809
2048
|
#
|
1810
|
-
|
2049
|
+
# Returns true if the data was parsed properly and if there is a valid Xing header present.
|
2050
|
+
#
|
2051
|
+
def isValid()
|
2052
|
+
end
|
2053
|
+
#
|
2054
|
+
# Returns the total size of stream in bytes.
|
2055
|
+
#
|
2056
|
+
def totalSize()
|
2057
|
+
end
|
1811
2058
|
end
|
1812
2059
|
# <b>
|
1813
|
-
# An
|
2060
|
+
# An implementation of MP3 frame headers. .</b>
|
1814
2061
|
#
|
1815
2062
|
#
|
1816
|
-
# This is an implementation of
|
2063
|
+
# This is an implementation of MPEG Layer III headers. The API follows more or less the binary format of these headers. I've used this document as a reference.
|
1817
2064
|
#
|
1818
|
-
class TagLib::
|
2065
|
+
class TagLib::MPEG::Header
|
1819
2066
|
#
|
1820
|
-
#
|
1821
|
-
#
|
2067
|
+
# Returns true if the copyrighted bit is set.
|
1822
2068
|
#
|
1823
|
-
def
|
2069
|
+
def isCopyrighted()
|
1824
2070
|
end
|
1825
2071
|
#
|
1826
|
-
# Returns the
|
2072
|
+
# Returns the layer version. This will be between the values 1-3.
|
1827
2073
|
#
|
1828
|
-
def
|
2074
|
+
def layer()
|
1829
2075
|
end
|
1830
2076
|
#
|
1831
|
-
# Returns
|
2077
|
+
# Returns the MPEG Version of the header.
|
1832
2078
|
#
|
1833
|
-
def
|
2079
|
+
def version()
|
1834
2080
|
end
|
1835
2081
|
#
|
1836
|
-
#
|
2082
|
+
# Returns true if the frame is at least an appropriate size and has legal values.
|
1837
2083
|
#
|
1838
|
-
def
|
2084
|
+
def isValid()
|
1839
2085
|
end
|
1840
2086
|
#
|
1841
|
-
#
|
1842
|
-
#
|
2087
|
+
# Returns true if the "original" bit is set.
|
1843
2088
|
#
|
1844
|
-
def
|
2089
|
+
def isOriginal()
|
1845
2090
|
end
|
1846
2091
|
#
|
1847
|
-
#
|
1848
|
-
#
|
2092
|
+
# Returns true if the MPEG protection bit is enabled.
|
1849
2093
|
#
|
1850
|
-
def
|
2094
|
+
def protectionEnabled()
|
1851
2095
|
end
|
1852
2096
|
#
|
1853
|
-
# Returns
|
1854
|
-
#
|
2097
|
+
# Returns the frame length.
|
1855
2098
|
#
|
1856
|
-
def
|
2099
|
+
def frameLength()
|
1857
2100
|
end
|
1858
2101
|
#
|
1859
|
-
# Returns
|
1860
|
-
#
|
2102
|
+
# Returns true if the frame is padded.
|
1861
2103
|
#
|
1862
|
-
def
|
2104
|
+
def isPadded()
|
1863
2105
|
end
|
1864
2106
|
#
|
1865
|
-
# Returns the
|
1866
|
-
# setPicture() mimeType()
|
1867
|
-
#
|
2107
|
+
# Returns the bitrate encoded in the header.
|
1868
2108
|
#
|
1869
|
-
def
|
2109
|
+
def bitrate()
|
1870
2110
|
end
|
1871
2111
|
#
|
1872
|
-
#
|
1873
|
-
#
|
2112
|
+
# Returns the number of frames per sample.
|
1874
2113
|
#
|
1875
|
-
def
|
2114
|
+
def samplesPerFrame()
|
2115
|
+
end
|
2116
|
+
#
|
2117
|
+
# Returns the channel mode for this frame.
|
2118
|
+
#
|
2119
|
+
def channelMode()
|
2120
|
+
end
|
2121
|
+
#
|
2122
|
+
# Returns the sample rate in Hz.
|
2123
|
+
#
|
2124
|
+
def sampleRate()
|
1876
2125
|
end
|
1877
2126
|
end
|
1878
|
-
end
|
1879
2127
|
# <b>
|
1880
|
-
# An implementation of
|
2128
|
+
# An implementation of audio property reading for MP3. .</b>
|
1881
2129
|
#
|
1882
2130
|
#
|
1883
|
-
# This
|
2131
|
+
# This reads the data from an MPEG Layer III stream found in the AudioProperties API.
|
1884
2132
|
#
|
1885
|
-
|
1886
|
-
# <b>
|
1887
|
-
# An implementation of audio property reading for TrueAudio. .</b>
|
2133
|
+
class TagLib::MPEG::Properties < TagLib::AudioProperties
|
1888
2134
|
#
|
2135
|
+
# Returns true if the copyrighted bit is set.
|
1889
2136
|
#
|
1890
|
-
|
2137
|
+
def isCopyrighted()
|
2138
|
+
end
|
1891
2139
|
#
|
1892
|
-
|
2140
|
+
# Returns the number of audio channels.
|
1893
2141
|
#
|
1894
|
-
|
2142
|
+
def channels()
|
2143
|
+
end
|
1895
2144
|
#
|
1896
|
-
|
2145
|
+
# Returns the layer version. This will be between the values 1-3.
|
2146
|
+
#
|
2147
|
+
def layer()
|
1897
2148
|
end
|
1898
2149
|
#
|
1899
|
-
# Returns
|
2150
|
+
# Returns the MPEG Version of the file.
|
1900
2151
|
#
|
1901
|
-
def
|
2152
|
+
def version()
|
1902
2153
|
end
|
1903
2154
|
#
|
1904
|
-
# Returns the
|
2155
|
+
# Returns true if the "original" bit is set.
|
1905
2156
|
#
|
1906
|
-
def
|
2157
|
+
def isOriginal()
|
1907
2158
|
end
|
1908
2159
|
#
|
1909
|
-
# Returns the
|
2160
|
+
# Returns true if the MPEG protection bit is enabled.
|
1910
2161
|
#
|
1911
|
-
def
|
2162
|
+
def protectionEnabled()
|
1912
2163
|
end
|
1913
2164
|
#
|
1914
|
-
# Returns the
|
2165
|
+
# Returns a pointer to the XingHeader if one exists or null if no XingHeader was found.
|
1915
2166
|
#
|
1916
|
-
def
|
2167
|
+
def xingHeader()
|
2168
|
+
end
|
2169
|
+
#
|
2170
|
+
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
2171
|
+
#
|
2172
|
+
def bitrate()
|
2173
|
+
end
|
2174
|
+
#
|
2175
|
+
# Returns the channel mode for this frame.
|
2176
|
+
#
|
2177
|
+
def channelMode()
|
2178
|
+
end
|
2179
|
+
#
|
2180
|
+
# Returns the sample rate in Hz.
|
2181
|
+
#
|
2182
|
+
def sampleRate()
|
1917
2183
|
end
|
1918
2184
|
#
|
1919
2185
|
# Returns the length of the file in seconds.
|
@@ -1922,293 +2188,267 @@
|
|
1922
2188
|
end
|
1923
2189
|
end
|
1924
2190
|
# <b>
|
1925
|
-
# An
|
2191
|
+
# An MPEG file class with some useful methods specific to MPEG. .</b>
|
1926
2192
|
#
|
1927
2193
|
#
|
1928
|
-
# This implements
|
2194
|
+
# This implements the generic TagLib::File API and additionally provides access to properties that are distinct to MPEG files, notably access to the different ID3 tags.
|
1929
2195
|
#
|
1930
|
-
class TagLib::
|
2196
|
+
class TagLib::MPEG::File < TagLib::File
|
1931
2197
|
def name()
|
1932
2198
|
end
|
1933
2199
|
def seek()
|
1934
2200
|
end
|
1935
|
-
def
|
2201
|
+
def writeBlock()
|
1936
2202
|
end
|
1937
|
-
|
2203
|
+
#
|
2204
|
+
# Returns a pointer to the APE tag of the file.If create is false (the default) this will return a null pointer if there is no valid APE tag. If create is true it will create an APE tag if one does not exist.The Tag is still owned by the MPEG::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
2205
|
+
#
|
2206
|
+
#
|
2207
|
+
def APETag(bool create = false)
|
2208
|
+
end
|
2209
|
+
def removeBlock()
|
2210
|
+
end
|
2211
|
+
def open?()
|
1938
2212
|
end
|
1939
2213
|
#
|
1940
|
-
#
|
2214
|
+
# Returns the position in the file of the previous MPEG frame, using the current position as start
|
1941
2215
|
#
|
1942
|
-
def
|
2216
|
+
def previousFrameOffset(long position)
|
1943
2217
|
end
|
1944
|
-
def
|
2218
|
+
def isValid()
|
1945
2219
|
end
|
1946
|
-
def
|
2220
|
+
def find1()
|
1947
2221
|
end
|
1948
2222
|
def clear()
|
1949
2223
|
end
|
1950
|
-
def read_only?()
|
1951
|
-
end
|
1952
2224
|
#
|
1953
|
-
# Returns the
|
2225
|
+
# Returns a pointer to a tag that is the union of the ID3v2 and ID3v1 tags. The ID3v2 tag is given priority in reading the information -- if requested information exists in both the ID3v2 tag and the ID3v1 tag, the information from the ID3v2 tag will be returned.If you would like more granular control over the content of the tags, with the concession of generality, use the tag-type specific calls.As this tag is not implemented as an ID3v2 tag or an ID3v1 tag, but a union of the two this pointer may not be cast to the specific tag types.
|
2226
|
+
# ID3v1Tag() ID3v2Tag() APETag()
|
2227
|
+
#
|
1954
2228
|
#
|
1955
2229
|
def tag()
|
1956
2230
|
end
|
1957
|
-
def
|
1958
|
-
end
|
1959
|
-
def readBlock()
|
2231
|
+
def readOnly()
|
1960
2232
|
end
|
1961
2233
|
#
|
1962
|
-
# Returns a pointer to the
|
2234
|
+
# Returns a pointer to the ID3v2 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v2 tag. If create is true it will create an ID3v2 tag if one does not exist.The Tag is still owned by the MPEG::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
1963
2235
|
#
|
1964
2236
|
#
|
1965
2237
|
def ID3v2Tag(bool create = false)
|
1966
2238
|
end
|
1967
|
-
|
2239
|
+
#
|
2240
|
+
# Returns the MPEG::Properties for this file. If no audio properties were read then this will return a null pointer.
|
2241
|
+
#
|
2242
|
+
def audioProperties()
|
2243
|
+
end
|
2244
|
+
#
|
2245
|
+
# Returns the position in the file of the last MPEG frame.
|
2246
|
+
#
|
2247
|
+
def lastFrameOffset()
|
2248
|
+
end
|
2249
|
+
def find2()
|
1968
2250
|
end
|
1969
2251
|
def writable?()
|
1970
2252
|
end
|
1971
2253
|
#
|
1972
|
-
# This will
|
1973
|
-
#
|
2254
|
+
# This will strip the tags that match the OR-ed together TagTypes from the file. By default it strips all tags. It returns true if the tags are successfully stripped.If freeMemory is true the ID3 and APE tags will be deleted and pointers to them will be invalidated.
|
1974
2255
|
#
|
1975
|
-
def strip(int tags
|
2256
|
+
def strip(int tags,bool freeMemory)
|
1976
2257
|
end
|
1977
|
-
def
|
2258
|
+
def valid?()
|
1978
2259
|
end
|
1979
2260
|
#
|
1980
|
-
# Returns a pointer to the
|
2261
|
+
# Returns a pointer to the ID3v1 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v1 tag. If create is true it will create an ID3v1 tag if one does not exist.The Tag is still owned by the MPEG::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
1981
2262
|
#
|
1982
2263
|
#
|
1983
2264
|
def ID3v1Tag(bool create = false)
|
1984
2265
|
end
|
2266
|
+
#
|
2267
|
+
# Save the file. This will attempt to save all of the tag types that are specified by OR-ing together TagTypes values. The save() method above uses AllTags. This returns true if saving was successful.If stripOthers is true this strips all tags not included in the mask, but does not modify them in memory, so later calls to save() which make use of these tags will remain valid. This also strips empty tags.
|
2268
|
+
#
|
2269
|
+
def save(int tags,bool stripOthers)
|
2270
|
+
end
|
2271
|
+
def isWritable()
|
2272
|
+
end
|
1985
2273
|
def insert()
|
1986
2274
|
end
|
1987
|
-
def
|
2275
|
+
def find3()
|
1988
2276
|
end
|
1989
|
-
def
|
2277
|
+
def read_only?()
|
1990
2278
|
end
|
1991
|
-
|
2279
|
+
#
|
2280
|
+
# Returns the position in the file of the first MPEG frame.
|
2281
|
+
#
|
2282
|
+
def firstFrameOffset()
|
2283
|
+
end
|
2284
|
+
def isOpen()
|
1992
2285
|
end
|
1993
2286
|
def tell()
|
1994
2287
|
end
|
1995
|
-
def
|
2288
|
+
def readBlock()
|
1996
2289
|
end
|
1997
2290
|
def length()
|
1998
2291
|
end
|
1999
|
-
def readOnly()
|
2000
|
-
end
|
2001
2292
|
#
|
2002
2293
|
# Set the ID3v2::FrameFactory to something other than the default.ID3v2FrameFactory
|
2003
2294
|
#
|
2004
2295
|
#
|
2005
2296
|
def setID3v2FrameFactory( ID3v2::FrameFactory factory)
|
2006
2297
|
end
|
2298
|
+
def rfind()
|
2299
|
+
end
|
2007
2300
|
#
|
2008
|
-
# Returns the
|
2301
|
+
# Returns the position in the file of the next MPEG frame, using the current position as start
|
2009
2302
|
#
|
2010
|
-
def
|
2303
|
+
def nextFrameOffset(long position)
|
2011
2304
|
end
|
2012
2305
|
end
|
2013
2306
|
end
|
2014
2307
|
# <b>
|
2015
|
-
#
|
2308
|
+
# An implementation of the APE tagging format. .</b>
|
2016
2309
|
#
|
2017
2310
|
#
|
2018
2311
|
#
|
2019
2312
|
#
|
2020
|
-
module TagLib::
|
2313
|
+
module TagLib::APE
|
2021
2314
|
# <b>
|
2022
|
-
# An implementation of
|
2315
|
+
# An implementation of APE footers. .</b>
|
2023
2316
|
#
|
2024
2317
|
#
|
2025
|
-
# This class implements
|
2318
|
+
# This class implements APE footers (and headers). It attempts to follow, both semantically and programatically, the structure specified in the APE v2.0 standard. The API is based on the properties of APE footer and headers specified there.
|
2026
2319
|
#
|
2027
|
-
class TagLib::
|
2320
|
+
class TagLib::APE::Footer
|
2028
2321
|
#
|
2029
|
-
# Sets
|
2030
|
-
#
|
2322
|
+
# Sets whether the header should be rendered or not
|
2031
2323
|
#
|
2032
|
-
def
|
2324
|
+
def setHeaderPresent(bool b)
|
2033
2325
|
end
|
2034
2326
|
#
|
2035
|
-
#
|
2327
|
+
# Set the tag size to s. tagSize()
|
2036
2328
|
#
|
2037
2329
|
#
|
2038
|
-
def
|
2330
|
+
def setTagSize(uint s)
|
2039
2331
|
end
|
2040
2332
|
#
|
2041
|
-
#
|
2042
|
-
#
|
2333
|
+
# Returns the version number. (Note: This is the 1000 or 2000.)
|
2043
2334
|
#
|
2044
|
-
def
|
2335
|
+
def version()
|
2045
2336
|
end
|
2046
2337
|
#
|
2047
|
-
#
|
2048
|
-
#
|
2338
|
+
# Returns the number of items in the tag.
|
2049
2339
|
#
|
2050
|
-
def
|
2340
|
+
def itemCount()
|
2051
2341
|
end
|
2052
2342
|
#
|
2053
|
-
#
|
2054
|
-
#
|
2343
|
+
# Sets the data that will be used as the footer. 32 bytes, starting from data will be used.
|
2055
2344
|
#
|
2056
|
-
def
|
2345
|
+
def setData( ByteVector data)
|
2057
2346
|
end
|
2058
2347
|
#
|
2059
|
-
#
|
2060
|
-
#
|
2348
|
+
# Returns true if a header is present in the tag.
|
2061
2349
|
#
|
2062
|
-
def
|
2350
|
+
def headerPresent()
|
2063
2351
|
end
|
2064
2352
|
#
|
2065
|
-
#
|
2353
|
+
# Set the item count to s. itemCount()
|
2354
|
+
#
|
2066
2355
|
#
|
2067
|
-
def
|
2356
|
+
def setItemCount(uint s)
|
2068
2357
|
end
|
2069
2358
|
#
|
2070
|
-
#
|
2071
|
-
#
|
2359
|
+
# Renders the footer back to binary format.
|
2072
2360
|
#
|
2073
|
-
def
|
2361
|
+
def renderFooter()
|
2074
2362
|
end
|
2075
2363
|
#
|
2076
|
-
# Returns
|
2364
|
+
# Returns true if a footer is present in the tag.
|
2077
2365
|
#
|
2078
|
-
def
|
2366
|
+
def footerPresent()
|
2079
2367
|
end
|
2080
2368
|
#
|
2081
|
-
#
|
2369
|
+
# Returns the tag size in bytes. This is the size of the frame content and footer. The size of the entire tag will be this plus the header size, if present.completeTagSize()
|
2082
2370
|
#
|
2083
2371
|
#
|
2084
|
-
def
|
2372
|
+
def tagSize()
|
2085
2373
|
end
|
2086
2374
|
#
|
2087
|
-
#
|
2088
|
-
#
|
2375
|
+
# Renders the header corresponding to the footer. If headerPresent is set to false, it returns an empty ByteVector.
|
2089
2376
|
#
|
2090
|
-
def
|
2377
|
+
def renderHeader()
|
2091
2378
|
end
|
2092
2379
|
#
|
2093
|
-
#
|
2094
|
-
#
|
2380
|
+
# Returns true this is actually the header.
|
2095
2381
|
#
|
2096
|
-
def
|
2382
|
+
def isHeader()
|
2097
2383
|
end
|
2098
2384
|
#
|
2099
|
-
#
|
2385
|
+
# Returns the tag size, including if present, the header size.tagSize()
|
2100
2386
|
#
|
2101
2387
|
#
|
2102
|
-
def
|
2388
|
+
def completeTagSize()
|
2103
2389
|
end
|
2390
|
+
end
|
2391
|
+
# <b>
|
2392
|
+
# An APE tag implementation. .</b>
|
2104
2393
|
#
|
2105
|
-
# Every Ogg logical stream is given a random serial number which is common to every page in that logical stream. This sets this pages serial number. This method should be used when adding new pages to a logical stream.streamSerialNumber()
|
2106
|
-
#
|
2107
2394
|
#
|
2108
|
-
|
2395
|
+
#
|
2396
|
+
#
|
2397
|
+
class TagLib::APE::Tag < TagLib::Tag
|
2398
|
+
def artist=()
|
2109
2399
|
end
|
2110
2400
|
#
|
2111
|
-
#
|
2112
|
-
#
|
2401
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
2113
2402
|
#
|
2114
|
-
def
|
2403
|
+
def setArtist( s)
|
2115
2404
|
end
|
2116
2405
|
#
|
2117
|
-
# Returns
|
2406
|
+
# Returns a pointer to the tag's footer.
|
2118
2407
|
#
|
2119
|
-
def
|
2408
|
+
def footer()
|
2120
2409
|
end
|
2121
2410
|
#
|
2122
|
-
#
|
2123
|
-
#
|
2124
|
-
#
|
2125
|
-
def lastPacketCompleted()
|
2126
|
-
end
|
2127
|
-
#
|
2128
|
-
# Marks this page as the last page of the Ogg stream.lastPageOfStream()
|
2129
|
-
#
|
2130
|
-
#
|
2131
|
-
def setLastPageOfStream(bool last)
|
2132
|
-
end
|
2133
|
-
#
|
2134
|
-
# Ogg pages contain a list of packets (which are used by the contained codecs). The sizes of these pages is encoded in the page header. This returns a list of the packet sizes in bytes.setPacketSizes()
|
2135
|
-
#
|
2136
|
-
#
|
2137
|
-
def packetSizes()
|
2138
|
-
end
|
2139
|
-
#
|
2140
|
-
# Returns the index of the page within the Ogg stream. This helps make it possible to determine if pages have been lost.setPageSequenceNumber()
|
2141
|
-
#
|
2411
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
2142
2412
|
#
|
2143
|
-
def
|
2413
|
+
def setTrack(uint i)
|
2144
2414
|
end
|
2145
|
-
end
|
2146
|
-
# <b>
|
2147
|
-
# An implementation of Ogg pages. .</b>
|
2148
|
-
#
|
2149
|
-
#
|
2150
|
-
# This is an implementation of the pages that make up an Ogg stream. This handles parsing pages and breaking them down into packets and handles the details of packets spanning multiple pages and pages that contiain multiple packets.In most Xiph.org formats the comments are found in the first few packets, this however is a reasonably complete implementation of Ogg pages that could potentially be useful for non-meta data purposes.
|
2151
|
-
#
|
2152
|
-
class TagLib::Ogg::Page
|
2153
2415
|
#
|
2154
|
-
#
|
2155
|
-
#
|
2416
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
2156
2417
|
#
|
2157
|
-
def
|
2418
|
+
def album()
|
2158
2419
|
end
|
2159
2420
|
#
|
2160
|
-
#
|
2421
|
+
# Renders the in memory values to a ByteVector suitable for writing to the file.
|
2161
2422
|
#
|
2162
|
-
def
|
2423
|
+
def render()
|
2163
2424
|
end
|
2164
2425
|
#
|
2165
|
-
# Returns the
|
2426
|
+
# Returns the year; if there is no year set, this will return 0.
|
2166
2427
|
#
|
2167
|
-
def
|
2428
|
+
def year()
|
2168
2429
|
end
|
2169
|
-
|
2170
|
-
# Returns a pointer to the header for this page. This pointer will become invalid when the page is deleted.
|
2171
|
-
#
|
2172
|
-
def header()
|
2430
|
+
def album=()
|
2173
2431
|
end
|
2174
2432
|
#
|
2175
|
-
#
|
2433
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
2176
2434
|
#
|
2177
|
-
def
|
2435
|
+
def setAlbum( s)
|
2178
2436
|
end
|
2179
2437
|
#
|
2180
|
-
# Returns a list of the
|
2181
|
-
# PageHeader::firstPacketContinued()
|
2438
|
+
# Returns a reference to the item list map. This is an ItemListMap of all of the items in the tag.This is the most powerfull structure for accessing the items of the tag.You should not modify this data structure directly, instead use setItem() and removeItem().
|
2182
2439
|
#
|
2183
2440
|
#
|
2184
|
-
def
|
2441
|
+
def itemListMap()
|
2185
2442
|
end
|
2186
|
-
|
2187
|
-
# Returns the index of the first packet wholly or partially contained in this page.setFirstPacketIndex()
|
2188
|
-
#
|
2189
|
-
#
|
2190
|
-
def firstPacketIndex()
|
2443
|
+
def year=()
|
2191
2444
|
end
|
2192
|
-
|
2193
|
-
#
|
2194
|
-
#
|
2195
|
-
def render()
|
2445
|
+
def isEmpty()
|
2196
2446
|
end
|
2197
2447
|
#
|
2198
|
-
#
|
2199
|
-
#
|
2448
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
2200
2449
|
#
|
2201
|
-
def
|
2450
|
+
def genre()
|
2202
2451
|
end
|
2203
|
-
end
|
2204
|
-
# <b>
|
2205
|
-
# Ogg Vorbis comment implementation. .</b>
|
2206
|
-
#
|
2207
|
-
#
|
2208
|
-
# This class is an implementation of the Ogg Vorbis comment specification, to be found in section 5 of the Ogg Vorbis specification. Because this format is also used in other (currently unsupported) Xiph.org formats, it has been made part of a generic implementation rather than being limited to strictly Vorbis.Vorbis comments are a simple vector of keys and values, called fields. Multiple values for a given key are supported.fieldListMap()
|
2209
|
-
#
|
2210
|
-
#
|
2211
|
-
class TagLib::Ogg::XiphComment < TagLib::Tag
|
2212
2452
|
def genre=()
|
2213
2453
|
end
|
2214
2454
|
#
|
@@ -2217,19 +2457,23 @@
|
|
2217
2457
|
def setComment( s)
|
2218
2458
|
end
|
2219
2459
|
#
|
2220
|
-
# Returns the
|
2460
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
2221
2461
|
#
|
2222
|
-
def
|
2462
|
+
def comment()
|
2463
|
+
end
|
2464
|
+
def empty?()
|
2223
2465
|
end
|
2224
2466
|
#
|
2225
|
-
#
|
2467
|
+
# Removes the key item from the tag
|
2226
2468
|
#
|
2227
|
-
def
|
2469
|
+
def removeItem( key)
|
2470
|
+
end
|
2471
|
+
def comment=()
|
2228
2472
|
end
|
2229
2473
|
#
|
2230
|
-
# Returns the
|
2474
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
2231
2475
|
#
|
2232
|
-
def
|
2476
|
+
def track()
|
2233
2477
|
end
|
2234
2478
|
def track=()
|
2235
2479
|
end
|
@@ -2239,12 +2483,15 @@
|
|
2239
2483
|
def setGenre( s)
|
2240
2484
|
end
|
2241
2485
|
#
|
2486
|
+
# Adds to the item specified by key the data value. If replace is true, then all of the other values on the same key will be removed first.
|
2487
|
+
#
|
2488
|
+
def addValue( key, value,bool replace = true)
|
2489
|
+
end
|
2490
|
+
#
|
2242
2491
|
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
2243
2492
|
#
|
2244
2493
|
def title()
|
2245
2494
|
end
|
2246
|
-
def year=()
|
2247
|
-
end
|
2248
2495
|
def title=()
|
2249
2496
|
end
|
2250
2497
|
#
|
@@ -2253,178 +2500,179 @@
|
|
2253
2500
|
def setTitle( s)
|
2254
2501
|
end
|
2255
2502
|
#
|
2256
|
-
# Add the field specified by key with the data value. If replace is true, then all of the other fields with the same key will be removed first.If the field value is empty, the field will be removed.
|
2257
|
-
#
|
2258
|
-
def addField( key, value,bool replace = true)
|
2259
|
-
end
|
2260
|
-
#
|
2261
2503
|
# Sets the year to i. If s is 0 then this value will be cleared.
|
2262
2504
|
#
|
2263
2505
|
def setYear(uint i)
|
2264
2506
|
end
|
2265
2507
|
#
|
2266
|
-
#
|
2508
|
+
# Sets the key item to the value of item. If an item with the key is already present, it will be replaced.
|
2267
2509
|
#
|
2268
|
-
def
|
2269
|
-
end
|
2270
|
-
def empty?()
|
2510
|
+
def setItem( key, Item item)
|
2271
2511
|
end
|
2272
2512
|
#
|
2273
2513
|
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
2274
2514
|
#
|
2275
2515
|
def artist()
|
2276
2516
|
end
|
2277
|
-
|
2278
|
-
|
2517
|
+
end
|
2518
|
+
# <b>
|
2519
|
+
# An implementation of APE-items. .</b>
|
2279
2520
|
#
|
2280
|
-
# Remove the field specified by key with the data value. If value is null, all of the fields with the given key will be removed.
|
2281
2521
|
#
|
2282
|
-
|
2283
|
-
end
|
2284
|
-
def artist=()
|
2285
|
-
end
|
2522
|
+
# This class provides the features of items in the APEv2 standard.
|
2286
2523
|
#
|
2287
|
-
|
2524
|
+
class TagLib::APE::Item
|
2288
2525
|
#
|
2289
|
-
|
2526
|
+
# Deprecatedvalues
|
2527
|
+
#
|
2528
|
+
#
|
2529
|
+
def toStringList()
|
2290
2530
|
end
|
2291
2531
|
#
|
2292
|
-
#
|
2532
|
+
# Returns the binary value.DeprecatedThis will be removed in the next binary incompatible version as it is not kept in sync with the things that are set using setValue() and friends.
|
2293
2533
|
#
|
2294
|
-
def
|
2534
|
+
def value()
|
2295
2535
|
end
|
2296
2536
|
#
|
2297
|
-
#
|
2298
|
-
#
|
2537
|
+
# Parse the item from the ByteVector data.
|
2299
2538
|
#
|
2300
|
-
def
|
2539
|
+
def parse( ByteVector data)
|
2301
2540
|
end
|
2302
2541
|
#
|
2303
|
-
# Returns the
|
2542
|
+
# Returns the list of values.
|
2304
2543
|
#
|
2305
|
-
def
|
2544
|
+
def values()
|
2306
2545
|
end
|
2307
2546
|
#
|
2308
|
-
#
|
2547
|
+
# Sets the value of the item to the list of values in value and clears any previous contents.toStringList()
|
2548
|
+
#
|
2309
2549
|
#
|
2310
|
-
def
|
2550
|
+
def setValues( List values)
|
2311
2551
|
end
|
2312
2552
|
#
|
2313
|
-
#
|
2553
|
+
# Returns the key.
|
2314
2554
|
#
|
2315
|
-
def
|
2316
|
-
end
|
2317
|
-
def album=()
|
2555
|
+
def key()
|
2318
2556
|
end
|
2319
2557
|
#
|
2320
|
-
#
|
2558
|
+
# Render the item to a ByteVector.
|
2321
2559
|
#
|
2322
|
-
def
|
2560
|
+
def render()
|
2323
2561
|
end
|
2324
2562
|
#
|
2325
|
-
# Returns
|
2563
|
+
# Returns if the item has any real content.
|
2326
2564
|
#
|
2327
2565
|
def isEmpty()
|
2328
2566
|
end
|
2329
2567
|
#
|
2330
|
-
#
|
2568
|
+
# Appends value to create (or extend) the current list of values.toString()
|
2569
|
+
#
|
2331
2570
|
#
|
2332
|
-
def
|
2571
|
+
def appendValue( value)
|
2333
2572
|
end
|
2334
2573
|
#
|
2335
|
-
# Returns
|
2574
|
+
# Returns the size of the full item.
|
2336
2575
|
#
|
2337
|
-
|
2576
|
+
def size()
|
2577
|
+
end
|
2338
2578
|
#
|
2339
|
-
#
|
2579
|
+
# Set the item to read-only.
|
2340
2580
|
#
|
2341
|
-
|
2581
|
+
def setReadOnly(bool readOnly)
|
2582
|
+
end
|
2342
2583
|
#
|
2343
|
-
#
|
2584
|
+
# Appends values to extend the current list of values.toStringList()
|
2585
|
+
#
|
2344
2586
|
#
|
2345
|
-
|
2587
|
+
def appendValues( List values)
|
2588
|
+
end
|
2346
2589
|
#
|
2347
|
-
#
|
2590
|
+
# Return true if the item is read-only.
|
2348
2591
|
#
|
2349
|
-
|
2592
|
+
def isReadOnly()
|
2593
|
+
end
|
2350
2594
|
#
|
2351
|
-
#
|
2595
|
+
# Sets the key for the item to key.
|
2352
2596
|
#
|
2353
|
-
|
2597
|
+
def setKey( key)
|
2598
|
+
end
|
2354
2599
|
#
|
2355
|
-
#
|
2600
|
+
# Returns the value as a single string. In case of multiple strings, the first is returned.
|
2356
2601
|
#
|
2357
|
-
|
2602
|
+
def toString()
|
2603
|
+
end
|
2358
2604
|
#
|
2359
|
-
#
|
2605
|
+
# Sets the type of the item to type.ItemTypes
|
2606
|
+
#
|
2360
2607
|
#
|
2361
|
-
|
2608
|
+
def setType(ItemTypes type)
|
2609
|
+
end
|
2362
2610
|
#
|
2363
|
-
#
|
2364
|
-
# You should not modify this data structure directly, instead use addField() and removeField().
|
2611
|
+
# Sets the value of the item to value and clears any previous contents.toString()
|
2365
2612
|
#
|
2366
2613
|
#
|
2367
|
-
def
|
2614
|
+
def setValue( value)
|
2368
2615
|
end
|
2369
2616
|
end
|
2617
|
+
end
|
2370
2618
|
# <b>
|
2371
|
-
# An implementation of
|
2619
|
+
# An implementation of MPC metadata. .</b>
|
2372
2620
|
#
|
2373
2621
|
#
|
2374
|
-
# This is
|
2622
|
+
# This is implementation of MPC metadata.This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream properties from the file. ID3v2 tags are invalid in MPC-files, but will be skipped and ignored.
|
2375
2623
|
#
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2379
|
-
def seek()
|
2380
|
-
end
|
2381
|
-
def find2()
|
2382
|
-
end
|
2624
|
+
module TagLib::MPC
|
2625
|
+
# <b>
|
2626
|
+
# An implementation of audio property reading for MPC. .</b>
|
2383
2627
|
#
|
2384
|
-
# Returns a pointer to the PageHeader for the first page in the stream or null if the page could not be found.
|
2385
2628
|
#
|
2386
|
-
|
2387
|
-
end
|
2388
|
-
def valid?()
|
2389
|
-
end
|
2629
|
+
# This reads the data from an MPC stream found in the AudioProperties API.
|
2390
2630
|
#
|
2391
|
-
|
2392
|
-
#
|
2631
|
+
class TagLib::MPC::Properties < TagLib::AudioProperties
|
2393
2632
|
#
|
2394
|
-
|
2395
|
-
|
2396
|
-
def
|
2397
|
-
end
|
2398
|
-
def find3()
|
2399
|
-
end
|
2400
|
-
def clear()
|
2633
|
+
# Returns the number of audio channels.
|
2634
|
+
#
|
2635
|
+
def channels()
|
2401
2636
|
end
|
2402
2637
|
#
|
2403
|
-
# Returns
|
2638
|
+
# Returns the version of the bitstream (SV4-SV7)
|
2404
2639
|
#
|
2405
|
-
def
|
2406
|
-
end
|
2407
|
-
def read_only?()
|
2640
|
+
def mpcVersion()
|
2408
2641
|
end
|
2409
|
-
|
2642
|
+
#
|
2643
|
+
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
2644
|
+
#
|
2645
|
+
def bitrate()
|
2410
2646
|
end
|
2411
|
-
|
2647
|
+
#
|
2648
|
+
# Returns the sample rate in Hz.
|
2649
|
+
#
|
2650
|
+
def sampleRate()
|
2412
2651
|
end
|
2413
|
-
|
2652
|
+
#
|
2653
|
+
# Returns the length of the file in seconds.
|
2654
|
+
#
|
2655
|
+
def length()
|
2414
2656
|
end
|
2415
|
-
|
2657
|
+
end
|
2658
|
+
# <b>
|
2659
|
+
# An implementation of TagLib::File with MPC specific methods. .</b>
|
2660
|
+
#
|
2661
|
+
#
|
2662
|
+
# This implements and provides an interface for MPC files to the TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing the abstract TagLib::File API as well as providing some additional information specific to MPC files. The only invalid tag combination supported is an ID3v1 tag after an APE tag.
|
2663
|
+
#
|
2664
|
+
class TagLib::MPC::File < TagLib::File
|
2665
|
+
def name()
|
2416
2666
|
end
|
2417
|
-
def
|
2667
|
+
def seek()
|
2418
2668
|
end
|
2419
2669
|
def writeBlock()
|
2420
2670
|
end
|
2421
2671
|
#
|
2422
|
-
# Returns the
|
2672
|
+
# Returns a pointer to the APE tag of the file.If create is false (the default) this will return a null pointer if there is no valid APE tag. If create is true it will create a APE tag if one does not exist. If there is already an ID3v1 tag, thes new APE tag will be placed before it.The Tag is still owned by the APE::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
2423
2673
|
#
|
2424
2674
|
#
|
2425
|
-
def
|
2426
|
-
end
|
2427
|
-
def insert()
|
2675
|
+
def APETag(bool create = false)
|
2428
2676
|
end
|
2429
2677
|
def removeBlock()
|
2430
2678
|
end
|
@@ -2432,198 +2680,70 @@
|
|
2432
2680
|
end
|
2433
2681
|
def isValid()
|
2434
2682
|
end
|
2435
|
-
def tell()
|
2436
|
-
end
|
2437
2683
|
def find1()
|
2438
2684
|
end
|
2685
|
+
def clear()
|
2686
|
+
end
|
2439
2687
|
#
|
2440
|
-
#
|
2688
|
+
# Returns the Tag for this file. This will be an APE tag, an ID3v1 tag or a combination of the two.
|
2441
2689
|
#
|
2442
|
-
def
|
2443
|
-
end
|
2444
|
-
def length()
|
2690
|
+
def tag()
|
2445
2691
|
end
|
2446
2692
|
def readOnly()
|
2447
2693
|
end
|
2448
|
-
def audioProperties()
|
2449
|
-
end
|
2450
|
-
end
|
2451
|
-
# <b>
|
2452
|
-
# A namespace containing classes for Speex metadata. .</b>
|
2453
|
-
#
|
2454
|
-
#
|
2455
|
-
#
|
2456
|
-
#
|
2457
|
-
module TagLib::Ogg::Speex
|
2458
|
-
# <b>
|
2459
|
-
# An implementation of audio property reading for Ogg Speex. .</b>
|
2460
|
-
#
|
2461
|
-
#
|
2462
|
-
# This reads the data from an Ogg Speex stream found in the AudioProperties API.
|
2463
|
-
#
|
2464
|
-
class TagLib::Ogg::Speex::Properties < TagLib::AudioProperties
|
2465
|
-
#
|
2466
|
-
# Returns the most appropriate bit rate for the file in kb/s. For constant bitrate formats this is simply the bitrate of the file. For variable bitrate formats this is either the average or nominal bitrate.
|
2467
|
-
#
|
2468
|
-
def bitrate()
|
2469
|
-
end
|
2470
|
-
#
|
2471
|
-
# Returns the Speex version, currently "0" (as specified by the spec).
|
2472
|
-
#
|
2473
|
-
def speexVersion()
|
2474
|
-
end
|
2475
|
-
#
|
2476
|
-
# Returns the sample rate in Hz.
|
2477
|
-
#
|
2478
|
-
def sampleRate()
|
2479
|
-
end
|
2480
|
-
#
|
2481
|
-
# Returns the number of audio channels.
|
2482
|
-
#
|
2483
|
-
def channels()
|
2484
|
-
end
|
2485
|
-
#
|
2486
|
-
# Returns the length of the file in seconds.
|
2487
2694
|
#
|
2488
|
-
|
2489
|
-
end
|
2490
|
-
end
|
2491
|
-
# <b>
|
2492
|
-
# An implementation of Ogg::File with Speex specific methods. .</b>
|
2695
|
+
# Returns the MPC::Properties for this file. If no audio properties were read then this will return a null pointer.
|
2493
2696
|
#
|
2697
|
+
def audioProperties()
|
2698
|
+
end
|
2699
|
+
def find2()
|
2700
|
+
end
|
2494
2701
|
#
|
2495
|
-
#
|
2702
|
+
# Deprecatedstrip
|
2703
|
+
#
|
2496
2704
|
#
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
end
|
2502
|
-
def find2()
|
2503
|
-
end
|
2504
|
-
def firstPageHeader()
|
2505
|
-
end
|
2506
|
-
def valid?()
|
2507
|
-
end
|
2705
|
+
def remove(int tags = AllTags)
|
2706
|
+
end
|
2707
|
+
def writable?()
|
2708
|
+
end
|
2508
2709
|
#
|
2509
|
-
#
|
2710
|
+
# This will remove the tags that match the OR-ed together TagTypes from the file. By default it removes all tags.This will also invalidate pointers to the tags as their memory will be freed.
|
2711
|
+
# In order to make the removal permanent save() still needs to be called.
|
2510
2712
|
#
|
2511
2713
|
#
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
def find3()
|
2517
|
-
end
|
2518
|
-
def clear()
|
2519
|
-
end
|
2520
|
-
def lastPageHeader()
|
2521
|
-
end
|
2522
|
-
def read_only?()
|
2523
|
-
end
|
2714
|
+
def strip(int tags = AllTags)
|
2715
|
+
end
|
2716
|
+
def valid?()
|
2717
|
+
end
|
2524
2718
|
#
|
2525
|
-
# Returns the
|
2719
|
+
# Returns a pointer to the ID3v1 tag of the file.If create is false (the default) this will return a null pointer if there is no valid ID3v1 tag. If create is true it will create an ID3v1 tag if one does not exist. If there is already an APE tag, the new ID3v1 tag will be placed after it.The Tag is still owned by the APE::File and should not be deleted by the user. It will be deleted when the file (object) is destroyed.
|
2720
|
+
#
|
2526
2721
|
#
|
2527
|
-
|
2528
|
-
|
2529
|
-
def isOpen()
|
2530
|
-
end
|
2531
|
-
def readBlock()
|
2532
|
-
end
|
2533
|
-
def rfind()
|
2534
|
-
end
|
2535
|
-
def writable?()
|
2536
|
-
end
|
2537
|
-
def writeBlock()
|
2538
|
-
end
|
2539
|
-
def packet()
|
2540
|
-
end
|
2541
|
-
def insert()
|
2542
|
-
end
|
2543
|
-
def removeBlock()
|
2544
|
-
end
|
2545
|
-
def open?()
|
2546
|
-
end
|
2547
|
-
def isValid()
|
2548
|
-
end
|
2549
|
-
def tell()
|
2550
|
-
end
|
2551
|
-
def find1()
|
2552
|
-
end
|
2553
|
-
def setPacket()
|
2554
|
-
end
|
2555
|
-
def length()
|
2556
|
-
end
|
2557
|
-
def readOnly()
|
2558
|
-
end
|
2722
|
+
def ID3v1Tag(bool create = false)
|
2723
|
+
end
|
2559
2724
|
#
|
2560
|
-
#
|
2725
|
+
# Saves the file.
|
2561
2726
|
#
|
2562
|
-
|
2563
|
-
end
|
2564
|
-
end
|
2727
|
+
def save()
|
2565
2728
|
end
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
end
|
2570
|
-
def seek()
|
2571
|
-
end
|
2572
|
-
def find2()
|
2573
|
-
end
|
2574
|
-
def firstPageHeader()
|
2575
|
-
end
|
2576
|
-
def valid?()
|
2577
|
-
end
|
2578
|
-
def save()
|
2579
|
-
end
|
2580
|
-
def isWritable()
|
2581
|
-
end
|
2582
|
-
def find3()
|
2583
|
-
end
|
2584
|
-
def clear()
|
2585
|
-
end
|
2586
|
-
def lastPageHeader()
|
2587
|
-
end
|
2588
|
-
def read_only?()
|
2589
|
-
end
|
2590
|
-
def tag()
|
2591
|
-
end
|
2592
|
-
def isOpen()
|
2593
|
-
end
|
2594
|
-
def readBlock()
|
2595
|
-
end
|
2596
|
-
def rfind()
|
2597
|
-
end
|
2598
|
-
def writable?()
|
2599
|
-
end
|
2600
|
-
def writeBlock()
|
2601
|
-
end
|
2602
|
-
def packet()
|
2603
|
-
end
|
2604
|
-
def insert()
|
2605
|
-
end
|
2606
|
-
def removeBlock()
|
2607
|
-
end
|
2608
|
-
def open?()
|
2609
|
-
end
|
2610
|
-
def isValid()
|
2611
|
-
end
|
2612
|
-
def tell()
|
2613
|
-
end
|
2614
|
-
def streamLength()
|
2615
|
-
end
|
2616
|
-
def find1()
|
2617
|
-
end
|
2618
|
-
def setPacket()
|
2619
|
-
end
|
2620
|
-
def length()
|
2621
|
-
end
|
2622
|
-
def readOnly()
|
2623
|
-
end
|
2624
|
-
def audioProperties()
|
2625
|
-
end
|
2626
|
-
end
|
2729
|
+
def isWritable()
|
2730
|
+
end
|
2731
|
+
def insert()
|
2627
2732
|
end
|
2733
|
+
def find3()
|
2734
|
+
end
|
2735
|
+
def read_only?()
|
2736
|
+
end
|
2737
|
+
def isOpen()
|
2738
|
+
end
|
2739
|
+
def tell()
|
2740
|
+
end
|
2741
|
+
def readBlock()
|
2742
|
+
end
|
2743
|
+
def length()
|
2744
|
+
end
|
2745
|
+
def rfind()
|
2746
|
+
end
|
2747
|
+
end
|
2628
2748
|
end
|
2629
2749
|
end
|