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