rtaglib 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/tagfile.rb
ADDED
data/swig/Doxyfile
CHANGED
File without changes
|
data/swig/Rakefile
CHANGED
@@ -1,14 +1,34 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
2
|
+
require 'fileutils'
|
3
3
|
require 'rake/testtask'
|
4
4
|
require 'rake/rdoctask'
|
5
|
+
pre_taglib="pre_taglib_"+PLATFORM
|
6
|
+
taglib_cxx="taglib_#{PLATFORM}.cxx"
|
7
|
+
extconf="rake_ext_conf.rb"
|
8
|
+
task :clean do |t|
|
9
|
+
["*.cxx", pre_taglib, "*.def","*.exp","*.lib","*.pdb","*.obj","*.manifest","Makefile", "*.so","*.o", "taglib.cxx","*.log"].each{|glob|
|
10
|
+
Dir.glob(glob) {|g|
|
11
|
+
FileUtils.rm(g)
|
12
|
+
}
|
13
|
+
}
|
14
|
+
FileUtils.rm_rf("doxygen/xml")
|
15
|
+
end
|
16
|
+
|
5
17
|
|
6
18
|
|
7
|
-
task :default => [:compile
|
19
|
+
task :default => [:compile, :test,:copy]
|
8
20
|
|
9
|
-
task :compile => ["TagLib.so"]
|
10
21
|
|
22
|
+
if(PLATFORM=~/mswin32/)
|
23
|
+
task :compile => ["TagLib.so", :manifest]
|
24
|
+
else
|
25
|
+
task :compile => ["TagLib.so"]
|
26
|
+
end
|
11
27
|
|
28
|
+
desc "Add manifest to TagLib.so"
|
29
|
+
task :manifest => ["TagLib.so", "Taglib.so.manifest"] do |t|
|
30
|
+
system %(mt.exe -manifest TagLib.so.manifest -outputresource:TagLib.so;2)
|
31
|
+
end
|
12
32
|
task :docs => ["TagLib_doc.rb"] do |t|
|
13
33
|
system %(rdoc -f html TagLib_doc.rb)
|
14
34
|
end
|
@@ -20,36 +40,41 @@ end
|
|
20
40
|
file "doxygen" => ["Doxyfile"] do |t|
|
21
41
|
system %(doxygen)
|
22
42
|
end
|
43
|
+
|
23
44
|
task :test => ["TagLib.so"] do |t|
|
24
45
|
system %(ruby "test.rb")
|
25
46
|
end
|
26
|
-
task :copy => [:test,
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
47
|
+
task :copy => [:test, "TagLib_doc.rb", "TagLib.so"] do |t|
|
48
|
+
FileUtils.cp extconf , "../ext/taglib/"
|
49
|
+
FileUtils.cp taglib_cxx , "../ext/taglib/"+"taglib_#{PLATFORM}.source"
|
50
|
+
FileUtils.cp("test.rb","../test/test_taglib.rb")
|
51
|
+
FileUtils.cp("TagLib_doc.rb", "../lib/")
|
52
|
+
FileUtils.cp("TagLib.so", "../ext/taglib/")
|
31
53
|
end
|
32
|
-
|
54
|
+
|
55
|
+
|
56
|
+
file "TagLib.so" => [taglib_cxx, "Makefile"] do |t|
|
57
|
+
if(PLATFORM=~/mswin32/)
|
58
|
+
system %(nmake)
|
59
|
+
else
|
33
60
|
system %(make)
|
34
61
|
end
|
62
|
+
end
|
35
63
|
|
36
|
-
file "Makefile" => [
|
37
|
-
system %(ruby extconf
|
64
|
+
file "Makefile" => [extconf] do |t|
|
65
|
+
system %(ruby #{extconf} )
|
38
66
|
end
|
39
|
-
|
67
|
+
|
68
|
+
file taglib_cxx => ["taglib.i", "process_cxx.rb"] do |t|
|
40
69
|
puts "Actualizando swig"
|
41
70
|
if
|
42
|
-
!system %(swig -fvirtual -Wall -c++ -o pre_taglib -ruby taglib.i)
|
43
|
-
|
44
|
-
|
71
|
+
!system %(swig -fvirtual -Wall -c++ -o #{pre_taglib} -ruby taglib.i)
|
72
|
+
system %(rm *.o *.so *.cxx)
|
73
|
+
exit 1
|
45
74
|
end
|
46
75
|
system %(ruby process_cxx.rb)
|
47
76
|
end
|
48
77
|
|
49
|
-
task :clean do |t|
|
50
|
-
system %(rm *.o *.so *.cxx *~ Makefile)
|
51
|
-
end
|
52
|
-
|
53
78
|
task :test_taglib => ["test_taglib.cxx"] do |t|
|
54
79
|
system %(gcc -c test_taglib.cxx)
|
55
80
|
system %(gcc -o test_taglib test_taglib.o -ltag)
|
data/swig/TagLib_doc.rb
ADDED
@@ -0,0 +1,2755 @@
|
|
1
|
+
# <b>
|
2
|
+
# A namespace for all TagLib related classes and functions. .</b>
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# This namespace contains everything in TagLib. For projects working with TagLib extensively it may be conveniten to add a usingnamespaceTagLib;
|
6
|
+
#
|
7
|
+
#
|
8
|
+
module TagLib
|
9
|
+
class TagLib::FrameList
|
10
|
+
def size()
|
11
|
+
end
|
12
|
+
def contains()
|
13
|
+
end
|
14
|
+
def isEmpty()
|
15
|
+
end
|
16
|
+
end
|
17
|
+
# <b>
|
18
|
+
# A byte vector. .</b>
|
19
|
+
#
|
20
|
+
#
|
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.
|
22
|
+
#
|
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()
|
37
|
+
end
|
38
|
+
def size()
|
39
|
+
end
|
40
|
+
def empty?()
|
41
|
+
end
|
42
|
+
def contains()
|
43
|
+
end
|
44
|
+
def isEmpty()
|
45
|
+
end
|
46
|
+
def insert()
|
47
|
+
end
|
48
|
+
def length()
|
49
|
+
end
|
50
|
+
def []()
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# <b>
|
54
|
+
# A wide string class suitable for unicode. .</b>
|
55
|
+
#
|
56
|
+
#
|
57
|
+
# This is an implicitly shared wide string. For storage it uses TagLib::wstring, but as this is an implementation detail this of course could change. Strings are stored internally as UTF-16BE. (Without the BOM (Byte Order Mark)The use of implicit sharing means that copying a string is cheap, the only cost comes into play when the copy is modified. Prior to that the string just has a pointer to the data of the parent String. This also makes this class suitable as a function return type.In addition to adding implicit sharing, this class keeps track of four possible encodings, which are the four supported by the ID3v2 standard.
|
58
|
+
#
|
59
|
+
class TagLib::String
|
60
|
+
#
|
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.
|
62
|
+
#
|
63
|
+
#
|
64
|
+
def toCString(unicode = false)
|
65
|
+
end
|
66
|
+
end
|
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()
|
77
|
+
end
|
78
|
+
def isEmpty()
|
79
|
+
end
|
80
|
+
end
|
81
|
+
class TagLib::ItemListMap
|
82
|
+
def clear()
|
83
|
+
end
|
84
|
+
def size()
|
85
|
+
end
|
86
|
+
def empty?()
|
87
|
+
end
|
88
|
+
def contains()
|
89
|
+
end
|
90
|
+
def isEmpty()
|
91
|
+
end
|
92
|
+
def insert()
|
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
|
146
|
+
def contains()
|
147
|
+
end
|
148
|
+
def isEmpty()
|
149
|
+
end
|
150
|
+
def insert()
|
151
|
+
end
|
152
|
+
def length()
|
153
|
+
end
|
154
|
+
def []()
|
155
|
+
end
|
156
|
+
end
|
157
|
+
# <b>
|
158
|
+
# This class provides a simple abstraction for creating and handling files. .</b>
|
159
|
+
#
|
160
|
+
#
|
161
|
+
# FileRef exists to provide a minimal, generic and value-based wrapper around a File. It is lightweight and implicitly shared, and as such suitable for pass-by-value use. This hides some of the uglier details of TagLib::File and the non-generic portions of the concrete file implementations.This class is useful in a "simple usage" situation where it is desirable to be able to get and set some of the tag information that is similar across file types.Also note that it is probably a good idea to plug this into your mime type system rather than using the constructor that accepts a file name using the FileTypeResolver.FileTypeResolver addFileTypeResolver()
|
162
|
+
#
|
163
|
+
#
|
164
|
+
class TagLib::FileRef
|
165
|
+
# Singleton methods
|
166
|
+
def self.defaultFileExtensions()
|
167
|
+
end
|
168
|
+
#
|
169
|
+
# Returns true if the file (and as such other pointers) are null.
|
170
|
+
#
|
171
|
+
def isNull()
|
172
|
+
end
|
173
|
+
#
|
174
|
+
# Returns a pointer to represented file's tag.This pointer will become invalid when this FileRef and all copies pass out of scope.
|
175
|
+
# File::tag()
|
176
|
+
#
|
177
|
+
#
|
178
|
+
def tag()
|
179
|
+
end
|
180
|
+
def null?()
|
181
|
+
end
|
182
|
+
#
|
183
|
+
# Returns the audio properties for this FileRef. If no audio properties were read then this will returns a null pointer.
|
184
|
+
#
|
185
|
+
def audioProperties()
|
186
|
+
end
|
187
|
+
#
|
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.
|
189
|
+
#
|
190
|
+
#
|
191
|
+
def file()
|
192
|
+
end
|
193
|
+
#
|
194
|
+
# Saves the file. Returns true on success.
|
195
|
+
#
|
196
|
+
def save()
|
197
|
+
end
|
198
|
+
end
|
199
|
+
class TagLib::FrameListMap
|
200
|
+
def clear()
|
201
|
+
end
|
202
|
+
def size()
|
203
|
+
end
|
204
|
+
def empty?()
|
205
|
+
end
|
206
|
+
def contains()
|
207
|
+
end
|
208
|
+
def isEmpty()
|
209
|
+
end
|
210
|
+
def insert()
|
211
|
+
end
|
212
|
+
def length()
|
213
|
+
end
|
214
|
+
def []()
|
215
|
+
end
|
216
|
+
end
|
217
|
+
# <b>
|
218
|
+
# A simple, generic interface to common audio meta data fields. .</b>
|
219
|
+
#
|
220
|
+
#
|
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.
|
222
|
+
#
|
223
|
+
class TagLib::Tag
|
224
|
+
def track=()
|
225
|
+
end
|
226
|
+
#
|
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.
|
228
|
+
#
|
229
|
+
def setGenre(s)
|
230
|
+
end
|
231
|
+
#
|
232
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
233
|
+
#
|
234
|
+
def title()
|
235
|
+
end
|
236
|
+
def title=()
|
237
|
+
end
|
238
|
+
#
|
239
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
240
|
+
#
|
241
|
+
def setTitle(s)
|
242
|
+
end
|
243
|
+
#
|
244
|
+
# Returns the year; if there is no year set, this will return 0.
|
245
|
+
#
|
246
|
+
def year()
|
247
|
+
end
|
248
|
+
#
|
249
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
250
|
+
#
|
251
|
+
def setYear(i)
|
252
|
+
end
|
253
|
+
#
|
254
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
255
|
+
#
|
256
|
+
def artist()
|
257
|
+
end
|
258
|
+
def year=()
|
259
|
+
end
|
260
|
+
def artist=()
|
261
|
+
end
|
262
|
+
#
|
263
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
264
|
+
#
|
265
|
+
def setArtist(s)
|
266
|
+
end
|
267
|
+
#
|
268
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
269
|
+
#
|
270
|
+
def comment()
|
271
|
+
end
|
272
|
+
#
|
273
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
274
|
+
#
|
275
|
+
def setTrack(i)
|
276
|
+
end
|
277
|
+
def comment=()
|
278
|
+
end
|
279
|
+
def empty?()
|
280
|
+
end
|
281
|
+
#
|
282
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
283
|
+
#
|
284
|
+
def album()
|
285
|
+
end
|
286
|
+
def album=()
|
287
|
+
end
|
288
|
+
#
|
289
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
290
|
+
#
|
291
|
+
def setAlbum(s)
|
292
|
+
end
|
293
|
+
#
|
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.
|
295
|
+
#
|
296
|
+
def isEmpty()
|
297
|
+
end
|
298
|
+
#
|
299
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
300
|
+
#
|
301
|
+
def genre()
|
302
|
+
end
|
303
|
+
def genre=()
|
304
|
+
end
|
305
|
+
#
|
306
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
307
|
+
#
|
308
|
+
def setComment(s)
|
309
|
+
end
|
310
|
+
#
|
311
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
312
|
+
#
|
313
|
+
def track()
|
314
|
+
end
|
315
|
+
end
|
316
|
+
# <b>
|
317
|
+
# A file class with some useful methods for tag manipulation. .</b>
|
318
|
+
#
|
319
|
+
#
|
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.
|
321
|
+
#
|
322
|
+
class TagLib::File
|
323
|
+
def isWritable()
|
324
|
+
end
|
325
|
+
#
|
326
|
+
# Returns the file name in the local file system encoding.
|
327
|
+
#
|
328
|
+
def name()
|
329
|
+
end
|
330
|
+
#
|
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
|
+
#
|
333
|
+
#
|
334
|
+
def seek(offset,p = Beginning)
|
335
|
+
end
|
336
|
+
def find3()
|
337
|
+
end
|
338
|
+
def read_only?()
|
339
|
+
end
|
340
|
+
#
|
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.
|
342
|
+
#
|
343
|
+
def isOpen()
|
344
|
+
end
|
345
|
+
#
|
346
|
+
# Reads a block of size length at the current get pointer.
|
347
|
+
#
|
348
|
+
def readBlock(length)
|
349
|
+
end
|
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
|
+
#
|
353
|
+
#
|
354
|
+
def rfind(pattern,fromOffset = 0,before = ByteVector::null)
|
355
|
+
end
|
356
|
+
#
|
357
|
+
# Reset the end-of-file and error flags on the file.
|
358
|
+
#
|
359
|
+
def clear()
|
360
|
+
end
|
361
|
+
#
|
362
|
+
# Returns a pointer to this file's tag. This should be reimplemented in the concrete subclasses.
|
363
|
+
#
|
364
|
+
def tag()
|
365
|
+
end
|
366
|
+
#
|
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[].
|
368
|
+
#
|
369
|
+
#
|
370
|
+
def writeBlock(data)
|
371
|
+
end
|
372
|
+
#
|
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.
|
374
|
+
#
|
375
|
+
#
|
376
|
+
def removeBlock(start = 0,length = 0)
|
377
|
+
end
|
378
|
+
def writable?()
|
379
|
+
end
|
380
|
+
def open?()
|
381
|
+
end
|
382
|
+
#
|
383
|
+
# Returns true if the file is open and readble and valid information for the Tag and / or AudioProperties was found.
|
384
|
+
#
|
385
|
+
def isValid()
|
386
|
+
end
|
387
|
+
def find1()
|
388
|
+
end
|
389
|
+
#
|
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
|
+
#
|
392
|
+
#
|
393
|
+
def insert(data,start = 0,replace = 0)
|
394
|
+
end
|
395
|
+
#
|
396
|
+
# Returns true if the file is read only (or if the file can not be opened).
|
397
|
+
#
|
398
|
+
def readOnly()
|
399
|
+
end
|
400
|
+
#
|
401
|
+
# Returns a pointer to this file's audio properties. This should be reimplemented in the concrete subclasses. If no audio properties were read then this will return a null pointer.
|
402
|
+
#
|
403
|
+
def audioProperties()
|
404
|
+
end
|
405
|
+
#
|
406
|
+
# Returns the current offset withing the file.
|
407
|
+
#
|
408
|
+
def tell()
|
409
|
+
end
|
410
|
+
def find2()
|
411
|
+
end
|
412
|
+
#
|
413
|
+
# Returns the length of the file.
|
414
|
+
#
|
415
|
+
def length()
|
416
|
+
end
|
417
|
+
def valid?()
|
418
|
+
end
|
419
|
+
#
|
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.
|
421
|
+
#
|
422
|
+
#
|
423
|
+
def save()
|
424
|
+
end
|
425
|
+
end
|
426
|
+
# <b>
|
427
|
+
# An implementation of TrueAudio metadata. .</b>
|
428
|
+
#
|
429
|
+
#
|
430
|
+
# This is implementation of TrueAudio metadata.This supports ID3v1 and ID3v2 tags as well as reading stream properties from the file.
|
431
|
+
#
|
432
|
+
module TagLib::TrueAudio
|
433
|
+
# <b>
|
434
|
+
# An implementation of audio property reading for TrueAudio. .</b>
|
435
|
+
#
|
436
|
+
#
|
437
|
+
# This reads the data from an TrueAudio stream found in the AudioProperties API.
|
438
|
+
#
|
439
|
+
class TagLib::TrueAudio::Properties < TagLib::AudioProperties
|
440
|
+
#
|
441
|
+
# Returns the major version number.
|
442
|
+
#
|
443
|
+
def ttaVersion()
|
444
|
+
end
|
445
|
+
#
|
446
|
+
# Returns the sample rate in Hz.
|
447
|
+
#
|
448
|
+
def sampleRate()
|
449
|
+
end
|
450
|
+
#
|
451
|
+
# Returns the number of audio channels.
|
452
|
+
#
|
453
|
+
def channels()
|
454
|
+
end
|
455
|
+
#
|
456
|
+
# Returns number of bits per sample.
|
457
|
+
#
|
458
|
+
def bitsPerSample()
|
459
|
+
end
|
460
|
+
#
|
461
|
+
# Returns the length of the file in seconds.
|
462
|
+
#
|
463
|
+
def length()
|
464
|
+
end
|
465
|
+
#
|
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.
|
467
|
+
#
|
468
|
+
def bitrate()
|
469
|
+
end
|
470
|
+
end
|
471
|
+
# <b>
|
472
|
+
# An implementation of TagLib::File with TrueAudio specific methods. .</b>
|
473
|
+
#
|
474
|
+
#
|
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.
|
476
|
+
#
|
477
|
+
class TagLib::TrueAudio::File < TagLib::File
|
478
|
+
def isWritable()
|
479
|
+
end
|
480
|
+
def name()
|
481
|
+
end
|
482
|
+
def seek()
|
483
|
+
end
|
484
|
+
def find3()
|
485
|
+
end
|
486
|
+
def read_only?()
|
487
|
+
end
|
488
|
+
def isOpen()
|
489
|
+
end
|
490
|
+
#
|
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
|
+
#
|
493
|
+
#
|
494
|
+
def ID3v1Tag(create = false)
|
495
|
+
end
|
496
|
+
def readBlock()
|
497
|
+
end
|
498
|
+
def rfind()
|
499
|
+
end
|
500
|
+
def clear()
|
501
|
+
end
|
502
|
+
#
|
503
|
+
# Returns the Tag for this file.
|
504
|
+
#
|
505
|
+
def tag()
|
506
|
+
end
|
507
|
+
def writeBlock()
|
508
|
+
end
|
509
|
+
#
|
510
|
+
# Set the ID3v2::FrameFactory to something other than the default.ID3v2FrameFactory
|
511
|
+
#
|
512
|
+
#
|
513
|
+
def setID3v2FrameFactory(factory)
|
514
|
+
end
|
515
|
+
def removeBlock()
|
516
|
+
end
|
517
|
+
def writable?()
|
518
|
+
end
|
519
|
+
def open?()
|
520
|
+
end
|
521
|
+
#
|
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
|
523
|
+
#
|
524
|
+
#
|
525
|
+
def strip(tags = AllTags)
|
526
|
+
end
|
527
|
+
def isValid()
|
528
|
+
end
|
529
|
+
def find1()
|
530
|
+
end
|
531
|
+
def insert()
|
532
|
+
end
|
533
|
+
def readOnly()
|
534
|
+
end
|
535
|
+
#
|
536
|
+
# Returns the TrueAudio::Properties for this file. If no audio properties were read then this will return a null pointer.
|
537
|
+
#
|
538
|
+
def audioProperties()
|
539
|
+
end
|
540
|
+
def tell()
|
541
|
+
end
|
542
|
+
def find2()
|
543
|
+
end
|
544
|
+
def length()
|
545
|
+
end
|
546
|
+
#
|
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.
|
548
|
+
#
|
549
|
+
#
|
550
|
+
def ID3v2Tag(create = false)
|
551
|
+
end
|
552
|
+
def valid?()
|
553
|
+
end
|
554
|
+
#
|
555
|
+
# Saves the file.
|
556
|
+
#
|
557
|
+
def save()
|
558
|
+
end
|
559
|
+
end
|
560
|
+
end
|
561
|
+
# <b>
|
562
|
+
# A namespace for the classes used by Ogg-based metadata files. .</b>
|
563
|
+
#
|
564
|
+
#
|
565
|
+
#
|
566
|
+
#
|
567
|
+
module TagLib::Ogg
|
568
|
+
# <b>
|
569
|
+
# An implementation of Ogg pages. .</b>
|
570
|
+
#
|
571
|
+
#
|
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.
|
573
|
+
#
|
574
|
+
class TagLib::Ogg::Page
|
575
|
+
#
|
576
|
+
# Returns the number of packets (whole or partial) in this page.
|
577
|
+
#
|
578
|
+
def packetCount()
|
579
|
+
end
|
580
|
+
#
|
581
|
+
# Returns a pointer to the header for this page. This pointer will become invalid when the page is deleted.
|
582
|
+
#
|
583
|
+
def header()
|
584
|
+
end
|
585
|
+
#
|
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
|
+
#
|
589
|
+
#
|
590
|
+
def packets()
|
591
|
+
end
|
592
|
+
#
|
593
|
+
# Returns the index of the first packet wholly or partially contained in this page.setFirstPacketIndex()
|
594
|
+
#
|
595
|
+
#
|
596
|
+
def firstPacketIndex()
|
597
|
+
end
|
598
|
+
#
|
599
|
+
# Returns the size of the page in bytes.
|
600
|
+
#
|
601
|
+
def size()
|
602
|
+
end
|
603
|
+
#
|
604
|
+
# Sets the index of the first packet in the page.firstPacketIndex()
|
605
|
+
#
|
606
|
+
#
|
607
|
+
def setFirstPacketIndex(index)
|
608
|
+
end
|
609
|
+
#
|
610
|
+
#
|
611
|
+
#
|
612
|
+
def render()
|
613
|
+
end
|
614
|
+
#
|
615
|
+
# Checks to see if the specified packet is contained in the current page.ContainsPacketFlags
|
616
|
+
#
|
617
|
+
#
|
618
|
+
def containsPacket(index)
|
619
|
+
end
|
620
|
+
#
|
621
|
+
# Returns the page's position within the file (in bytes).
|
622
|
+
#
|
623
|
+
def fileOffset()
|
624
|
+
end
|
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=()
|
635
|
+
end
|
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)
|
640
|
+
end
|
641
|
+
#
|
642
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
643
|
+
#
|
644
|
+
def title()
|
645
|
+
end
|
646
|
+
#
|
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.
|
648
|
+
#
|
649
|
+
def addField(key,value,replace = true)
|
650
|
+
end
|
651
|
+
def title=()
|
652
|
+
end
|
653
|
+
#
|
654
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
655
|
+
#
|
656
|
+
def setTitle(s)
|
657
|
+
end
|
658
|
+
#
|
659
|
+
# Returns the year; if there is no year set, this will return 0.
|
660
|
+
#
|
661
|
+
def year()
|
662
|
+
end
|
663
|
+
#
|
664
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
665
|
+
#
|
666
|
+
def setYear(i)
|
667
|
+
end
|
668
|
+
#
|
669
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
670
|
+
#
|
671
|
+
def artist()
|
672
|
+
end
|
673
|
+
def year=()
|
674
|
+
end
|
675
|
+
def artist=()
|
676
|
+
end
|
677
|
+
#
|
678
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
679
|
+
#
|
680
|
+
def setArtist(s)
|
681
|
+
end
|
682
|
+
#
|
683
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
684
|
+
#
|
685
|
+
def comment()
|
686
|
+
end
|
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)
|
691
|
+
end
|
692
|
+
#
|
693
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
694
|
+
#
|
695
|
+
def setTrack(i)
|
696
|
+
end
|
697
|
+
def comment=()
|
698
|
+
end
|
699
|
+
def empty?()
|
700
|
+
end
|
701
|
+
#
|
702
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
703
|
+
#
|
704
|
+
def album()
|
705
|
+
end
|
706
|
+
#
|
707
|
+
# Returns the number of fields present in the comment.
|
708
|
+
#
|
709
|
+
def fieldCount()
|
710
|
+
end
|
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)
|
715
|
+
end
|
716
|
+
def album=()
|
717
|
+
end
|
718
|
+
#
|
719
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
720
|
+
#
|
721
|
+
def setAlbum(s)
|
722
|
+
end
|
723
|
+
#
|
724
|
+
# Returns true if the field is contained within the comment.This is safer than checking for membership in the FieldListMap.
|
725
|
+
#
|
726
|
+
#
|
727
|
+
def contains(key)
|
728
|
+
end
|
729
|
+
#
|
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.
|
731
|
+
#
|
732
|
+
def isEmpty()
|
733
|
+
end
|
734
|
+
#
|
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:
|
736
|
+
#
|
737
|
+
# TITLE
|
738
|
+
#
|
739
|
+
# VERSION
|
740
|
+
#
|
741
|
+
# ALBUM
|
742
|
+
#
|
743
|
+
# ARTIST
|
744
|
+
#
|
745
|
+
# PERFORMER
|
746
|
+
#
|
747
|
+
# COPYRIGHT
|
748
|
+
#
|
749
|
+
# ORGANIZATION
|
750
|
+
#
|
751
|
+
# DESCRIPTION
|
752
|
+
#
|
753
|
+
# GENRE
|
754
|
+
#
|
755
|
+
# DATE
|
756
|
+
#
|
757
|
+
# LOCATION
|
758
|
+
#
|
759
|
+
# CONTACT
|
760
|
+
#
|
761
|
+
# ISRC
|
762
|
+
#
|
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().
|
765
|
+
#
|
766
|
+
#
|
767
|
+
def fieldListMap()
|
768
|
+
end
|
769
|
+
#
|
770
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
771
|
+
#
|
772
|
+
def genre()
|
773
|
+
end
|
774
|
+
def genre=()
|
775
|
+
end
|
776
|
+
#
|
777
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
778
|
+
#
|
779
|
+
def setComment(s)
|
780
|
+
end
|
781
|
+
#
|
782
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
783
|
+
#
|
784
|
+
def track()
|
785
|
+
end
|
786
|
+
#
|
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".
|
788
|
+
#
|
789
|
+
def vendorID()
|
790
|
+
end
|
791
|
+
end
|
792
|
+
# <b>
|
793
|
+
# An implementation of the page headers associated with each Ogg::Page. .</b>
|
794
|
+
#
|
795
|
+
#
|
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.
|
797
|
+
#
|
798
|
+
class TagLib::Ogg::PageHeader
|
799
|
+
#
|
800
|
+
# This returns true if this is the first page of the Ogg (logical) stream.setFirstPageOfStream()
|
801
|
+
#
|
802
|
+
#
|
803
|
+
def firstPageOfStream()
|
804
|
+
end
|
805
|
+
#
|
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()
|
807
|
+
#
|
808
|
+
#
|
809
|
+
def setAbsoluteGranularPosition(agp)
|
810
|
+
end
|
811
|
+
#
|
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()
|
813
|
+
#
|
814
|
+
#
|
815
|
+
def firstPacketContinued()
|
816
|
+
end
|
817
|
+
#
|
818
|
+
# Returns the size of the data portion of the page -- i.e. the size of the page less the header size.
|
819
|
+
#
|
820
|
+
def dataSize()
|
821
|
+
end
|
822
|
+
#
|
823
|
+
# Marks this page as the first page of the Ogg stream.firstPageOfStream()
|
824
|
+
#
|
825
|
+
#
|
826
|
+
def setFirstPageOfStream(first)
|
827
|
+
end
|
828
|
+
#
|
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
|
+
#
|
831
|
+
#
|
832
|
+
def streamSerialNumber()
|
833
|
+
end
|
834
|
+
#
|
835
|
+
# Returns the complete header size.
|
836
|
+
#
|
837
|
+
def size()
|
838
|
+
end
|
839
|
+
#
|
840
|
+
# Sets the internal flag indicating if the first packet in this page is continued to continued.firstPacketContinued()
|
841
|
+
#
|
842
|
+
#
|
843
|
+
def setFirstPacketContinued(continued)
|
844
|
+
end
|
845
|
+
#
|
846
|
+
# This returns true if this is the last page of the Ogg (logical) stream.setLastPageOfStream()
|
847
|
+
#
|
848
|
+
#
|
849
|
+
def lastPageOfStream()
|
850
|
+
end
|
851
|
+
#
|
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
|
+
#
|
854
|
+
#
|
855
|
+
def setStreamSerialNumber(n)
|
856
|
+
end
|
857
|
+
#
|
858
|
+
# Returns true if the header parsed properly and is valid.
|
859
|
+
#
|
860
|
+
def isValid()
|
861
|
+
end
|
862
|
+
#
|
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
|
+
#
|
865
|
+
#
|
866
|
+
def render()
|
867
|
+
end
|
868
|
+
#
|
869
|
+
# Returns true if the last packet of this page is completely contained in this page.firstPacketContinued() setLastPacketCompleted()
|
870
|
+
#
|
871
|
+
#
|
872
|
+
def lastPacketCompleted()
|
873
|
+
end
|
874
|
+
#
|
875
|
+
# Marks this page as the last page of the Ogg stream.lastPageOfStream()
|
876
|
+
#
|
877
|
+
#
|
878
|
+
def setLastPageOfStream(last)
|
879
|
+
end
|
880
|
+
#
|
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()
|
882
|
+
#
|
883
|
+
#
|
884
|
+
def packetSizes()
|
885
|
+
end
|
886
|
+
#
|
887
|
+
# Returns the index of the page within the Ogg stream. This helps make it possible to determine if pages have been lost.setPageSequenceNumber()
|
888
|
+
#
|
889
|
+
#
|
890
|
+
def pageSequenceNumber()
|
891
|
+
end
|
892
|
+
#
|
893
|
+
# Sets the internal flag indicating if the last packet in this page is complete to completed.lastPacketCompleted()
|
894
|
+
#
|
895
|
+
#
|
896
|
+
def setLastPacketCompleted(completed)
|
897
|
+
end
|
898
|
+
#
|
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()
|
900
|
+
#
|
901
|
+
#
|
902
|
+
def absoluteGranularPosition()
|
903
|
+
end
|
904
|
+
#
|
905
|
+
# Sets the sizes of the packets in this page to sizes. Internally this updates the lacing values in the header.packetSizes()
|
906
|
+
#
|
907
|
+
#
|
908
|
+
def setPacketSizes(sizes)
|
909
|
+
end
|
910
|
+
#
|
911
|
+
# Sets the page's position in the stream to sequenceNumber.pageSequenceNumber()
|
912
|
+
#
|
913
|
+
#
|
914
|
+
def setPageSequenceNumber(sequenceNumber)
|
915
|
+
end
|
916
|
+
end
|
917
|
+
# <b>
|
918
|
+
# An implementation of TagLib::File with some helpers for Ogg based formats. .</b>
|
919
|
+
#
|
920
|
+
#
|
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.
|
922
|
+
#
|
923
|
+
class TagLib::Ogg::File < TagLib::File
|
924
|
+
def isWritable()
|
925
|
+
end
|
926
|
+
def name()
|
927
|
+
end
|
928
|
+
def seek()
|
929
|
+
end
|
930
|
+
def find3()
|
931
|
+
end
|
932
|
+
#
|
933
|
+
# Returns a pointer to the PageHeader for the last page in the stream or null if the page could not be found.
|
934
|
+
#
|
935
|
+
def lastPageHeader()
|
936
|
+
end
|
937
|
+
def read_only?()
|
938
|
+
end
|
939
|
+
def isOpen()
|
940
|
+
end
|
941
|
+
def readBlock()
|
942
|
+
end
|
943
|
+
def rfind()
|
944
|
+
end
|
945
|
+
def clear()
|
946
|
+
end
|
947
|
+
def tag()
|
948
|
+
end
|
949
|
+
def writeBlock()
|
950
|
+
end
|
951
|
+
#
|
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.
|
953
|
+
#
|
954
|
+
#
|
955
|
+
def packet(i)
|
956
|
+
end
|
957
|
+
def removeBlock()
|
958
|
+
end
|
959
|
+
def writable?()
|
960
|
+
end
|
961
|
+
def open?()
|
962
|
+
end
|
963
|
+
def isValid()
|
964
|
+
end
|
965
|
+
def find1()
|
966
|
+
end
|
967
|
+
#
|
968
|
+
# Sets the packet with index i to the value p.
|
969
|
+
#
|
970
|
+
def setPacket(i,p)
|
971
|
+
end
|
972
|
+
def insert()
|
973
|
+
end
|
974
|
+
def readOnly()
|
975
|
+
end
|
976
|
+
def audioProperties()
|
977
|
+
end
|
978
|
+
def tell()
|
979
|
+
end
|
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()
|
986
|
+
end
|
987
|
+
def length()
|
988
|
+
end
|
989
|
+
def valid?()
|
990
|
+
end
|
991
|
+
#
|
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.
|
993
|
+
#
|
994
|
+
#
|
995
|
+
def save()
|
996
|
+
end
|
997
|
+
end
|
998
|
+
# <b>
|
999
|
+
# A namespace containing classes for Speex metadata. .</b>
|
1000
|
+
#
|
1001
|
+
#
|
1002
|
+
#
|
1003
|
+
#
|
1004
|
+
module TagLib::Ogg::Speex
|
1005
|
+
# <b>
|
1006
|
+
# An implementation of audio property reading for Ogg Speex. .</b>
|
1007
|
+
#
|
1008
|
+
#
|
1009
|
+
# This reads the data from an Ogg Speex stream found in the AudioProperties API.
|
1010
|
+
#
|
1011
|
+
class TagLib::Ogg::Speex::Properties < TagLib::AudioProperties
|
1012
|
+
#
|
1013
|
+
# Returns the Speex version, currently "0" (as specified by the spec).
|
1014
|
+
#
|
1015
|
+
def speexVersion()
|
1016
|
+
end
|
1017
|
+
#
|
1018
|
+
# Returns the sample rate in Hz.
|
1019
|
+
#
|
1020
|
+
def sampleRate()
|
1021
|
+
end
|
1022
|
+
#
|
1023
|
+
# Returns the number of audio channels.
|
1024
|
+
#
|
1025
|
+
def channels()
|
1026
|
+
end
|
1027
|
+
#
|
1028
|
+
# Returns the length of the file in seconds.
|
1029
|
+
#
|
1030
|
+
def length()
|
1031
|
+
end
|
1032
|
+
#
|
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.
|
1034
|
+
#
|
1035
|
+
def bitrate()
|
1036
|
+
end
|
1037
|
+
end
|
1038
|
+
# <b>
|
1039
|
+
# An implementation of Ogg::File with Speex specific methods. .</b>
|
1040
|
+
#
|
1041
|
+
#
|
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.
|
1043
|
+
#
|
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
|
1065
|
+
#
|
1066
|
+
# Returns the XiphComment for this file. XiphComment implements the tag interface, so this serves as the reimplementation of TagLib::File::tag().
|
1067
|
+
#
|
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
|
1090
|
+
#
|
1091
|
+
# Returns the Speex::Properties for this file. If no audio properties were read then this will return a null pointer.
|
1092
|
+
#
|
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.
|
1107
|
+
#
|
1108
|
+
#
|
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
|
1174
|
+
end
|
1175
|
+
end
|
1176
|
+
# <b>
|
1177
|
+
# An ID3v1 implementation. .</b>
|
1178
|
+
#
|
1179
|
+
#
|
1180
|
+
#
|
1181
|
+
#
|
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>
|
1194
|
+
#
|
1195
|
+
#
|
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
|
+
#
|
1199
|
+
#
|
1200
|
+
class TagLib::ID3v1::Tag < TagLib::Tag
|
1201
|
+
def track=()
|
1202
|
+
end
|
1203
|
+
#
|
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.
|
1205
|
+
#
|
1206
|
+
def setGenre(s)
|
1207
|
+
end
|
1208
|
+
#
|
1209
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
1210
|
+
#
|
1211
|
+
def title()
|
1212
|
+
end
|
1213
|
+
def title=()
|
1214
|
+
end
|
1215
|
+
#
|
1216
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
1217
|
+
#
|
1218
|
+
def setTitle(s)
|
1219
|
+
end
|
1220
|
+
#
|
1221
|
+
# Returns the year; if there is no year set, this will return 0.
|
1222
|
+
#
|
1223
|
+
def year()
|
1224
|
+
end
|
1225
|
+
#
|
1226
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
1227
|
+
#
|
1228
|
+
def setYear(i)
|
1229
|
+
end
|
1230
|
+
#
|
1231
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
1232
|
+
#
|
1233
|
+
def artist()
|
1234
|
+
end
|
1235
|
+
def year=()
|
1236
|
+
end
|
1237
|
+
def artist=()
|
1238
|
+
end
|
1239
|
+
#
|
1240
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
1241
|
+
#
|
1242
|
+
def setArtist(s)
|
1243
|
+
end
|
1244
|
+
#
|
1245
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
1246
|
+
#
|
1247
|
+
def comment()
|
1248
|
+
end
|
1249
|
+
#
|
1250
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
1251
|
+
#
|
1252
|
+
def setTrack(i)
|
1253
|
+
end
|
1254
|
+
def comment=()
|
1255
|
+
end
|
1256
|
+
def empty?()
|
1257
|
+
end
|
1258
|
+
#
|
1259
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
1260
|
+
#
|
1261
|
+
def album()
|
1262
|
+
end
|
1263
|
+
#
|
1264
|
+
# Renders the in memory values to a ByteVector suitable for writing to the file.
|
1265
|
+
#
|
1266
|
+
def render()
|
1267
|
+
end
|
1268
|
+
def album=()
|
1269
|
+
end
|
1270
|
+
#
|
1271
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
1272
|
+
#
|
1273
|
+
def setAlbum(s)
|
1274
|
+
end
|
1275
|
+
def isEmpty()
|
1276
|
+
end
|
1277
|
+
#
|
1278
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
1279
|
+
#
|
1280
|
+
def genre()
|
1281
|
+
end
|
1282
|
+
def genre=()
|
1283
|
+
end
|
1284
|
+
#
|
1285
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
1286
|
+
#
|
1287
|
+
def setComment(s)
|
1288
|
+
end
|
1289
|
+
#
|
1290
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
1291
|
+
#
|
1292
|
+
def track()
|
1293
|
+
end
|
1294
|
+
end
|
1295
|
+
end
|
1296
|
+
# <b>
|
1297
|
+
# A namespace containing classes for Vorbis metadata. .</b>
|
1298
|
+
#
|
1299
|
+
#
|
1300
|
+
#
|
1301
|
+
#
|
1302
|
+
module TagLib::Vorbis
|
1303
|
+
# <b>
|
1304
|
+
# An implementation of audio property reading for Ogg Vorbis. .</b>
|
1305
|
+
#
|
1306
|
+
#
|
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()
|
1314
|
+
end
|
1315
|
+
#
|
1316
|
+
# Returns the Vorbis version, currently "0" (as specified by the spec).
|
1317
|
+
#
|
1318
|
+
def vorbisVersion()
|
1319
|
+
end
|
1320
|
+
#
|
1321
|
+
# Returns the number of audio channels.
|
1322
|
+
#
|
1323
|
+
def channels()
|
1324
|
+
end
|
1325
|
+
#
|
1326
|
+
# Returns the maximum bitrate as read from the Vorbis identification header.
|
1327
|
+
#
|
1328
|
+
def bitrateMaximum()
|
1329
|
+
end
|
1330
|
+
#
|
1331
|
+
# Returns the nominal bitrate as read from the Vorbis identification header.
|
1332
|
+
#
|
1333
|
+
def bitrateNominal()
|
1334
|
+
end
|
1335
|
+
#
|
1336
|
+
# Returns the length of the file in seconds.
|
1337
|
+
#
|
1338
|
+
def length()
|
1339
|
+
end
|
1340
|
+
#
|
1341
|
+
# Returns the minimum bitrate as read from the Vorbis identification header.
|
1342
|
+
#
|
1343
|
+
def bitrateMinimum()
|
1344
|
+
end
|
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()
|
1349
|
+
end
|
1350
|
+
end
|
1351
|
+
# <b>
|
1352
|
+
# An implementation of Ogg::File with Vorbis specific methods. .</b>
|
1353
|
+
#
|
1354
|
+
#
|
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()
|
1359
|
+
end
|
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()
|
1377
|
+
end
|
1378
|
+
#
|
1379
|
+
# Returns the XiphComment for this file. XiphComment implements the tag interface, so this serves as the reimplementation of TagLib::File::tag().
|
1380
|
+
#
|
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()
|
1402
|
+
end
|
1403
|
+
#
|
1404
|
+
# Returns the Vorbis::Properties for this file. If no audio properties were read then this will return a null pointer.
|
1405
|
+
#
|
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
|
+
end
|
1418
|
+
#
|
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
|
+
#
|
1421
|
+
#
|
1422
|
+
def save()
|
1423
|
+
end
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
# <b>
|
1427
|
+
# An implementation of TagLib::File with MPEG (MP3) specific methods. .</b>
|
1428
|
+
#
|
1429
|
+
#
|
1430
|
+
#
|
1431
|
+
#
|
1432
|
+
module TagLib::MPEG
|
1433
|
+
# <b>
|
1434
|
+
# An implementation of the Xing VBR headers. .</b>
|
1435
|
+
#
|
1436
|
+
#
|
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.
|
1438
|
+
#
|
1439
|
+
class TagLib::MPEG::XingHeader
|
1440
|
+
#
|
1441
|
+
# Returns true if the data was parsed properly and if there is a valid Xing header present.
|
1442
|
+
#
|
1443
|
+
def isValid()
|
1444
|
+
end
|
1445
|
+
#
|
1446
|
+
# Returns the total number of frames.
|
1447
|
+
#
|
1448
|
+
def totalFrames()
|
1449
|
+
end
|
1450
|
+
#
|
1451
|
+
# Returns the total size of stream in bytes.
|
1452
|
+
#
|
1453
|
+
def totalSize()
|
1454
|
+
end
|
1455
|
+
end
|
1456
|
+
# <b>
|
1457
|
+
# An implementation of audio property reading for MP3. .</b>
|
1458
|
+
#
|
1459
|
+
#
|
1460
|
+
# This reads the data from an MPEG Layer III stream found in the AudioProperties API.
|
1461
|
+
#
|
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.
|
1465
|
+
#
|
1466
|
+
def xingHeader()
|
1467
|
+
end
|
1468
|
+
#
|
1469
|
+
# Returns the sample rate in Hz.
|
1470
|
+
#
|
1471
|
+
def sampleRate()
|
1472
|
+
end
|
1473
|
+
#
|
1474
|
+
# Returns the MPEG Version of the file.
|
1475
|
+
#
|
1476
|
+
def version()
|
1477
|
+
end
|
1478
|
+
#
|
1479
|
+
# Returns the number of audio channels.
|
1480
|
+
#
|
1481
|
+
def channels()
|
1482
|
+
end
|
1483
|
+
#
|
1484
|
+
# Returns the channel mode for this frame.
|
1485
|
+
#
|
1486
|
+
def channelMode()
|
1487
|
+
end
|
1488
|
+
#
|
1489
|
+
# Returns true if the copyrighted bit is set.
|
1490
|
+
#
|
1491
|
+
def isCopyrighted()
|
1492
|
+
end
|
1493
|
+
#
|
1494
|
+
# Returns the layer version. This will be between the values 1-3.
|
1495
|
+
#
|
1496
|
+
def layer()
|
1497
|
+
end
|
1498
|
+
#
|
1499
|
+
# Returns true if the "original" bit is set.
|
1500
|
+
#
|
1501
|
+
def isOriginal()
|
1502
|
+
end
|
1503
|
+
#
|
1504
|
+
# Returns the length of the file in seconds.
|
1505
|
+
#
|
1506
|
+
def length()
|
1507
|
+
end
|
1508
|
+
#
|
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.
|
1510
|
+
#
|
1511
|
+
def bitrate()
|
1512
|
+
end
|
1513
|
+
#
|
1514
|
+
# Returns true if the MPEG protection bit is enabled.
|
1515
|
+
#
|
1516
|
+
def protectionEnabled()
|
1517
|
+
end
|
1518
|
+
end
|
1519
|
+
# <b>
|
1520
|
+
# An implementation of MP3 frame headers. .</b>
|
1521
|
+
#
|
1522
|
+
#
|
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.
|
1524
|
+
#
|
1525
|
+
class TagLib::MPEG::Header
|
1526
|
+
#
|
1527
|
+
# Returns the frame length.
|
1528
|
+
#
|
1529
|
+
def frameLength()
|
1530
|
+
end
|
1531
|
+
#
|
1532
|
+
# Returns the sample rate in Hz.
|
1533
|
+
#
|
1534
|
+
def sampleRate()
|
1535
|
+
end
|
1536
|
+
#
|
1537
|
+
# Returns true if the frame is padded.
|
1538
|
+
#
|
1539
|
+
def isPadded()
|
1540
|
+
end
|
1541
|
+
#
|
1542
|
+
# Returns the MPEG Version of the header.
|
1543
|
+
#
|
1544
|
+
def version()
|
1545
|
+
end
|
1546
|
+
#
|
1547
|
+
# Returns the number of frames per sample.
|
1548
|
+
#
|
1549
|
+
def samplesPerFrame()
|
1550
|
+
end
|
1551
|
+
#
|
1552
|
+
# Returns the channel mode for this frame.
|
1553
|
+
#
|
1554
|
+
def channelMode()
|
1555
|
+
end
|
1556
|
+
#
|
1557
|
+
# Returns true if the frame is at least an appropriate size and has legal values.
|
1558
|
+
#
|
1559
|
+
def isValid()
|
1560
|
+
end
|
1561
|
+
#
|
1562
|
+
# Returns true if the copyrighted bit is set.
|
1563
|
+
#
|
1564
|
+
def isCopyrighted()
|
1565
|
+
end
|
1566
|
+
#
|
1567
|
+
# Returns the layer version. This will be between the values 1-3.
|
1568
|
+
#
|
1569
|
+
def layer()
|
1570
|
+
end
|
1571
|
+
#
|
1572
|
+
# Returns true if the "original" bit is set.
|
1573
|
+
#
|
1574
|
+
def isOriginal()
|
1575
|
+
end
|
1576
|
+
#
|
1577
|
+
# Returns the bitrate encoded in the header.
|
1578
|
+
#
|
1579
|
+
def bitrate()
|
1580
|
+
end
|
1581
|
+
#
|
1582
|
+
# Returns true if the MPEG protection bit is enabled.
|
1583
|
+
#
|
1584
|
+
def protectionEnabled()
|
1585
|
+
end
|
1586
|
+
end
|
1587
|
+
# <b>
|
1588
|
+
# An MPEG file class with some useful methods specific to MPEG. .</b>
|
1589
|
+
#
|
1590
|
+
#
|
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.
|
1592
|
+
#
|
1593
|
+
class TagLib::MPEG::File < TagLib::File
|
1594
|
+
def isWritable()
|
1595
|
+
end
|
1596
|
+
def name()
|
1597
|
+
end
|
1598
|
+
def seek()
|
1599
|
+
end
|
1600
|
+
def find3()
|
1601
|
+
end
|
1602
|
+
def read_only?()
|
1603
|
+
end
|
1604
|
+
def isOpen()
|
1605
|
+
end
|
1606
|
+
#
|
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
|
+
#
|
1609
|
+
#
|
1610
|
+
def ID3v1Tag(create = false)
|
1611
|
+
end
|
1612
|
+
def readBlock()
|
1613
|
+
end
|
1614
|
+
def rfind()
|
1615
|
+
end
|
1616
|
+
def clear()
|
1617
|
+
end
|
1618
|
+
#
|
1619
|
+
# Returns the position in the file of the first MPEG frame.
|
1620
|
+
#
|
1621
|
+
def firstFrameOffset()
|
1622
|
+
end
|
1623
|
+
#
|
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
|
+
#
|
1627
|
+
#
|
1628
|
+
def tag()
|
1629
|
+
end
|
1630
|
+
def writeBlock()
|
1631
|
+
end
|
1632
|
+
#
|
1633
|
+
# Set the ID3v2::FrameFactory to something other than the default.ID3v2FrameFactory
|
1634
|
+
#
|
1635
|
+
#
|
1636
|
+
def setID3v2FrameFactory(factory)
|
1637
|
+
end
|
1638
|
+
def removeBlock()
|
1639
|
+
end
|
1640
|
+
def writable?()
|
1641
|
+
end
|
1642
|
+
def open?()
|
1643
|
+
end
|
1644
|
+
#
|
1645
|
+
# Returns the position in the file of the next MPEG frame, using the current position as start
|
1646
|
+
#
|
1647
|
+
def nextFrameOffset(position)
|
1648
|
+
end
|
1649
|
+
#
|
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.
|
1651
|
+
#
|
1652
|
+
def strip(tags,freeMemory)
|
1653
|
+
end
|
1654
|
+
def isValid()
|
1655
|
+
end
|
1656
|
+
def find1()
|
1657
|
+
end
|
1658
|
+
#
|
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
|
+
#
|
1661
|
+
#
|
1662
|
+
def APETag(create = false)
|
1663
|
+
end
|
1664
|
+
def insert()
|
1665
|
+
end
|
1666
|
+
def readOnly()
|
1667
|
+
end
|
1668
|
+
#
|
1669
|
+
# Returns the MPEG::Properties for this file. If no audio properties were read then this will return a null pointer.
|
1670
|
+
#
|
1671
|
+
def audioProperties()
|
1672
|
+
end
|
1673
|
+
#
|
1674
|
+
# Returns the position in the file of the previous MPEG frame, using the current position as start
|
1675
|
+
#
|
1676
|
+
def previousFrameOffset(position)
|
1677
|
+
end
|
1678
|
+
def tell()
|
1679
|
+
end
|
1680
|
+
def find2()
|
1681
|
+
end
|
1682
|
+
def length()
|
1683
|
+
end
|
1684
|
+
#
|
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
|
+
#
|
1687
|
+
#
|
1688
|
+
def ID3v2Tag(create = false)
|
1689
|
+
end
|
1690
|
+
def valid?()
|
1691
|
+
end
|
1692
|
+
#
|
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.
|
1694
|
+
#
|
1695
|
+
def save(tags,stripOthers)
|
1696
|
+
end
|
1697
|
+
#
|
1698
|
+
# Returns the position in the file of the last MPEG frame.
|
1699
|
+
#
|
1700
|
+
def lastFrameOffset()
|
1701
|
+
end
|
1702
|
+
end
|
1703
|
+
end
|
1704
|
+
# <b>
|
1705
|
+
# An implementation of the APE tagging format. .</b>
|
1706
|
+
#
|
1707
|
+
#
|
1708
|
+
#
|
1709
|
+
#
|
1710
|
+
module TagLib::APE
|
1711
|
+
# <b>
|
1712
|
+
# An implementation of APE-items. .</b>
|
1713
|
+
#
|
1714
|
+
#
|
1715
|
+
# This class provides the features of items in the APEv2 standard.
|
1716
|
+
#
|
1717
|
+
class TagLib::APE::Item
|
1718
|
+
#
|
1719
|
+
# Returns the key.
|
1720
|
+
#
|
1721
|
+
def key()
|
1722
|
+
end
|
1723
|
+
#
|
1724
|
+
# Return true if the item is read-only.
|
1725
|
+
#
|
1726
|
+
def isReadOnly()
|
1727
|
+
end
|
1728
|
+
#
|
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.
|
1730
|
+
#
|
1731
|
+
def value()
|
1732
|
+
end
|
1733
|
+
#
|
1734
|
+
# Sets the key for the item to key.
|
1735
|
+
#
|
1736
|
+
def setKey(key)
|
1737
|
+
end
|
1738
|
+
#
|
1739
|
+
# Returns the list of values.
|
1740
|
+
#
|
1741
|
+
def values()
|
1742
|
+
end
|
1743
|
+
#
|
1744
|
+
# Returns the value as a single string. In case of multiple strings, the first is returned.
|
1745
|
+
#
|
1746
|
+
def toString()
|
1747
|
+
end
|
1748
|
+
#
|
1749
|
+
# Sets the type of the item to type.ItemTypes
|
1750
|
+
#
|
1751
|
+
#
|
1752
|
+
def setType(type)
|
1753
|
+
end
|
1754
|
+
#
|
1755
|
+
# Sets the value of the item to value and clears any previous contents.toString()
|
1756
|
+
#
|
1757
|
+
#
|
1758
|
+
def setValue(value)
|
1759
|
+
end
|
1760
|
+
#
|
1761
|
+
# Deprecatedvalues
|
1762
|
+
#
|
1763
|
+
#
|
1764
|
+
def toStringList()
|
1765
|
+
end
|
1766
|
+
#
|
1767
|
+
# Returns the size of the full item.
|
1768
|
+
#
|
1769
|
+
def size()
|
1770
|
+
end
|
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)
|
1776
|
+
end
|
1777
|
+
#
|
1778
|
+
# Render the item to a ByteVector.
|
1779
|
+
#
|
1780
|
+
def render()
|
1781
|
+
end
|
1782
|
+
#
|
1783
|
+
# Parse the item from the ByteVector data.
|
1784
|
+
#
|
1785
|
+
def parse(data)
|
1786
|
+
end
|
1787
|
+
#
|
1788
|
+
# Returns if the item has any real content.
|
1789
|
+
#
|
1790
|
+
def isEmpty()
|
1791
|
+
end
|
1792
|
+
#
|
1793
|
+
# Appends value to create (or extend) the current list of values.toString()
|
1794
|
+
#
|
1795
|
+
#
|
1796
|
+
def appendValue(value)
|
1797
|
+
end
|
1798
|
+
#
|
1799
|
+
# Set the item to read-only.
|
1800
|
+
#
|
1801
|
+
def setReadOnly(readOnly)
|
1802
|
+
end
|
1803
|
+
#
|
1804
|
+
# Appends values to extend the current list of values.toStringList()
|
1805
|
+
#
|
1806
|
+
#
|
1807
|
+
def appendValues(values)
|
1808
|
+
end
|
1809
|
+
end
|
1810
|
+
# <b>
|
1811
|
+
# An implementation of APE footers. .</b>
|
1812
|
+
#
|
1813
|
+
#
|
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()
|
1821
|
+
end
|
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()
|
1827
|
+
end
|
1828
|
+
#
|
1829
|
+
# Renders the header corresponding to the footer. If headerPresent is set to false, it returns an empty ByteVector.
|
1830
|
+
#
|
1831
|
+
def renderHeader()
|
1832
|
+
end
|
1833
|
+
#
|
1834
|
+
# Returns the version number. (Note: This is the 1000 or 2000.)
|
1835
|
+
#
|
1836
|
+
def version()
|
1837
|
+
end
|
1838
|
+
#
|
1839
|
+
# Returns true this is actually the header.
|
1840
|
+
#
|
1841
|
+
def isHeader()
|
1842
|
+
end
|
1843
|
+
#
|
1844
|
+
# Returns the tag size, including if present, the header size.tagSize()
|
1845
|
+
#
|
1846
|
+
#
|
1847
|
+
def completeTagSize()
|
1848
|
+
end
|
1849
|
+
#
|
1850
|
+
# Sets whether the header should be rendered or not
|
1851
|
+
#
|
1852
|
+
def setHeaderPresent(b)
|
1853
|
+
end
|
1854
|
+
#
|
1855
|
+
# Set the tag size to s. tagSize()
|
1856
|
+
#
|
1857
|
+
#
|
1858
|
+
def setTagSize(s)
|
1859
|
+
end
|
1860
|
+
#
|
1861
|
+
# Returns the number of items in the tag.
|
1862
|
+
#
|
1863
|
+
def itemCount()
|
1864
|
+
end
|
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)
|
1869
|
+
end
|
1870
|
+
#
|
1871
|
+
# Returns true if a header is present in the tag.
|
1872
|
+
#
|
1873
|
+
def headerPresent()
|
1874
|
+
end
|
1875
|
+
#
|
1876
|
+
# Set the item count to s. itemCount()
|
1877
|
+
#
|
1878
|
+
#
|
1879
|
+
def setItemCount(s)
|
1880
|
+
end
|
1881
|
+
#
|
1882
|
+
# Renders the footer back to binary format.
|
1883
|
+
#
|
1884
|
+
def renderFooter()
|
1885
|
+
end
|
1886
|
+
end
|
1887
|
+
# <b>
|
1888
|
+
# An APE tag implementation. .</b>
|
1889
|
+
#
|
1890
|
+
#
|
1891
|
+
#
|
1892
|
+
#
|
1893
|
+
class TagLib::APE::Tag < TagLib::Tag
|
1894
|
+
def track=()
|
1895
|
+
end
|
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.
|
1898
|
+
#
|
1899
|
+
def setGenre(s)
|
1900
|
+
end
|
1901
|
+
#
|
1902
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
1903
|
+
#
|
1904
|
+
def title()
|
1905
|
+
end
|
1906
|
+
#
|
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.
|
1908
|
+
#
|
1909
|
+
def addValue(key,value,replace = true)
|
1910
|
+
end
|
1911
|
+
def title=()
|
1912
|
+
end
|
1913
|
+
#
|
1914
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
1915
|
+
#
|
1916
|
+
def setTitle(s)
|
1917
|
+
end
|
1918
|
+
#
|
1919
|
+
# Returns the year; if there is no year set, this will return 0.
|
1920
|
+
#
|
1921
|
+
def year()
|
1922
|
+
end
|
1923
|
+
#
|
1924
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
1925
|
+
#
|
1926
|
+
def setYear(i)
|
1927
|
+
end
|
1928
|
+
#
|
1929
|
+
# Sets the key item to the value of item. If an item with the key is already present, it will be replaced.
|
1930
|
+
#
|
1931
|
+
def setItem(key,item)
|
1932
|
+
end
|
1933
|
+
#
|
1934
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
1935
|
+
#
|
1936
|
+
def artist()
|
1937
|
+
end
|
1938
|
+
def year=()
|
1939
|
+
end
|
1940
|
+
def artist=()
|
1941
|
+
end
|
1942
|
+
#
|
1943
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
1944
|
+
#
|
1945
|
+
def setArtist(s)
|
1946
|
+
end
|
1947
|
+
#
|
1948
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
1949
|
+
#
|
1950
|
+
def comment()
|
1951
|
+
end
|
1952
|
+
#
|
1953
|
+
# Returns a pointer to the tag's footer.
|
1954
|
+
#
|
1955
|
+
def footer()
|
1956
|
+
end
|
1957
|
+
#
|
1958
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
1959
|
+
#
|
1960
|
+
def setTrack(i)
|
1961
|
+
end
|
1962
|
+
def comment=()
|
1963
|
+
end
|
1964
|
+
def empty?()
|
1965
|
+
end
|
1966
|
+
#
|
1967
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
1968
|
+
#
|
1969
|
+
def album()
|
1970
|
+
end
|
1971
|
+
#
|
1972
|
+
# Renders the in memory values to a ByteVector suitable for writing to the file.
|
1973
|
+
#
|
1974
|
+
def render()
|
1975
|
+
end
|
1976
|
+
def album=()
|
1977
|
+
end
|
1978
|
+
#
|
1979
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
1980
|
+
#
|
1981
|
+
def setAlbum(s)
|
1982
|
+
end
|
1983
|
+
#
|
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
|
+
#
|
1986
|
+
#
|
1987
|
+
def itemListMap()
|
1988
|
+
end
|
1989
|
+
def isEmpty()
|
1990
|
+
end
|
1991
|
+
#
|
1992
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
1993
|
+
#
|
1994
|
+
def genre()
|
1995
|
+
end
|
1996
|
+
def genre=()
|
1997
|
+
end
|
1998
|
+
#
|
1999
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
2000
|
+
#
|
2001
|
+
def setComment(s)
|
2002
|
+
end
|
2003
|
+
#
|
2004
|
+
# Removes the key item from the tag
|
2005
|
+
#
|
2006
|
+
def removeItem(key)
|
2007
|
+
end
|
2008
|
+
#
|
2009
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
2010
|
+
#
|
2011
|
+
def track()
|
2012
|
+
end
|
2013
|
+
end
|
2014
|
+
end
|
2015
|
+
# <b>
|
2016
|
+
# An implementation of MPC metadata. .</b>
|
2017
|
+
#
|
2018
|
+
#
|
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.
|
2020
|
+
#
|
2021
|
+
module TagLib::MPC
|
2022
|
+
# <b>
|
2023
|
+
# An implementation of audio property reading for MPC. .</b>
|
2024
|
+
#
|
2025
|
+
#
|
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()
|
2033
|
+
end
|
2034
|
+
#
|
2035
|
+
# Returns the number of audio channels.
|
2036
|
+
#
|
2037
|
+
def channels()
|
2038
|
+
end
|
2039
|
+
#
|
2040
|
+
# Returns the length of the file in seconds.
|
2041
|
+
#
|
2042
|
+
def length()
|
2043
|
+
end
|
2044
|
+
#
|
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.
|
2046
|
+
#
|
2047
|
+
def bitrate()
|
2048
|
+
end
|
2049
|
+
#
|
2050
|
+
# Returns the version of the bitstream (SV4-SV7)
|
2051
|
+
#
|
2052
|
+
def mpcVersion()
|
2053
|
+
end
|
2054
|
+
end
|
2055
|
+
# <b>
|
2056
|
+
# An implementation of TagLib::File with MPC specific methods. .</b>
|
2057
|
+
#
|
2058
|
+
#
|
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()
|
2073
|
+
end
|
2074
|
+
#
|
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
|
+
#
|
2077
|
+
#
|
2078
|
+
def ID3v1Tag(create = false)
|
2079
|
+
end
|
2080
|
+
def readBlock()
|
2081
|
+
end
|
2082
|
+
def rfind()
|
2083
|
+
end
|
2084
|
+
def clear()
|
2085
|
+
end
|
2086
|
+
#
|
2087
|
+
# Returns the Tag for this file. This will be an APE tag, an ID3v1 tag or a combination of the two.
|
2088
|
+
#
|
2089
|
+
def tag()
|
2090
|
+
end
|
2091
|
+
def writeBlock()
|
2092
|
+
end
|
2093
|
+
def removeBlock()
|
2094
|
+
end
|
2095
|
+
def writable?()
|
2096
|
+
end
|
2097
|
+
def open?()
|
2098
|
+
end
|
2099
|
+
#
|
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
|
+
#
|
2103
|
+
#
|
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()
|
2125
|
+
end
|
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
|
+
#
|
2161
|
+
# Returns the sample rate in Hz.
|
2162
|
+
#
|
2163
|
+
def sampleRate()
|
2164
|
+
end
|
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
|
+
#
|
2176
|
+
# Returns the length of the file in seconds.
|
2177
|
+
#
|
2178
|
+
def length()
|
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
|
2185
|
+
end
|
2186
|
+
# <b>
|
2187
|
+
# An implementation of TagLib::File with FLAC specific methods. .</b>
|
2188
|
+
#
|
2189
|
+
#
|
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.
|
2191
|
+
#
|
2192
|
+
class TagLib::FLAC::File < TagLib::File
|
2193
|
+
def isWritable()
|
2194
|
+
end
|
2195
|
+
def name()
|
2196
|
+
end
|
2197
|
+
def seek()
|
2198
|
+
end
|
2199
|
+
def find3()
|
2200
|
+
end
|
2201
|
+
def read_only?()
|
2202
|
+
end
|
2203
|
+
def isOpen()
|
2204
|
+
end
|
2205
|
+
#
|
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.
|
2207
|
+
#
|
2208
|
+
#
|
2209
|
+
def ID3v1Tag(create = false)
|
2210
|
+
end
|
2211
|
+
def readBlock()
|
2212
|
+
end
|
2213
|
+
#
|
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
|
+
#
|
2216
|
+
#
|
2217
|
+
def xiphComment(create = false)
|
2218
|
+
end
|
2219
|
+
def rfind()
|
2220
|
+
end
|
2221
|
+
def clear()
|
2222
|
+
end
|
2223
|
+
#
|
2224
|
+
# Returns the Tag for this file. This will be a union of XiphComment, ID3v1 and ID3v2 tags.ID3v2Tag() ID3v1Tag() XiphComment()
|
2225
|
+
#
|
2226
|
+
#
|
2227
|
+
def tag()
|
2228
|
+
end
|
2229
|
+
def writeBlock()
|
2230
|
+
end
|
2231
|
+
#
|
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
|
2233
|
+
#
|
2234
|
+
#
|
2235
|
+
def setID3v2FrameFactory(factory)
|
2236
|
+
end
|
2237
|
+
def removeBlock()
|
2238
|
+
end
|
2239
|
+
def writable?()
|
2240
|
+
end
|
2241
|
+
def open?()
|
2242
|
+
end
|
2243
|
+
def isValid()
|
2244
|
+
end
|
2245
|
+
#
|
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.
|
2247
|
+
#
|
2248
|
+
def streamLength()
|
2249
|
+
end
|
2250
|
+
def find1()
|
2251
|
+
end
|
2252
|
+
def insert()
|
2253
|
+
end
|
2254
|
+
def readOnly()
|
2255
|
+
end
|
2256
|
+
#
|
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.
|
2258
|
+
#
|
2259
|
+
def streamInfoData()
|
2260
|
+
end
|
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()
|
2265
|
+
end
|
2266
|
+
def tell()
|
2267
|
+
end
|
2268
|
+
def find2()
|
2269
|
+
end
|
2270
|
+
def length()
|
2271
|
+
end
|
2272
|
+
#
|
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.
|
2274
|
+
#
|
2275
|
+
#
|
2276
|
+
def ID3v2Tag(create = false)
|
2277
|
+
end
|
2278
|
+
def valid?()
|
2279
|
+
end
|
2280
|
+
#
|
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.
|
2282
|
+
#
|
2283
|
+
def save()
|
2284
|
+
end
|
2285
|
+
end
|
2286
|
+
end
|
2287
|
+
# <b>
|
2288
|
+
# An implementation of WavPack metadata. .</b>
|
2289
|
+
#
|
2290
|
+
#
|
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.
|
2292
|
+
#
|
2293
|
+
module TagLib::WavPack
|
2294
|
+
# <b>
|
2295
|
+
# An implementation of audio property reading for WavPack. .</b>
|
2296
|
+
#
|
2297
|
+
#
|
2298
|
+
# This reads the data from an WavPack stream found in the AudioProperties API.
|
2299
|
+
#
|
2300
|
+
class TagLib::WavPack::Properties < TagLib::AudioProperties
|
2301
|
+
#
|
2302
|
+
# Returns the sample rate in Hz.
|
2303
|
+
#
|
2304
|
+
def sampleRate()
|
2305
|
+
end
|
2306
|
+
#
|
2307
|
+
# Returns WavPack version.
|
2308
|
+
#
|
2309
|
+
def version()
|
2310
|
+
end
|
2311
|
+
#
|
2312
|
+
# Returns the number of audio channels.
|
2313
|
+
#
|
2314
|
+
def channels()
|
2315
|
+
end
|
2316
|
+
#
|
2317
|
+
# Returns number of bits per sample.
|
2318
|
+
#
|
2319
|
+
def bitsPerSample()
|
2320
|
+
end
|
2321
|
+
#
|
2322
|
+
# Returns the length of the file in seconds.
|
2323
|
+
#
|
2324
|
+
def length()
|
2325
|
+
end
|
2326
|
+
#
|
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.
|
2328
|
+
#
|
2329
|
+
def bitrate()
|
2330
|
+
end
|
2331
|
+
end
|
2332
|
+
# <b>
|
2333
|
+
# An implementation of TagLib::File with WavPack specific methods. .</b>
|
2334
|
+
#
|
2335
|
+
#
|
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.
|
2337
|
+
#
|
2338
|
+
class TagLib::WavPack::File < TagLib::File
|
2339
|
+
def isWritable()
|
2340
|
+
end
|
2341
|
+
def name()
|
2342
|
+
end
|
2343
|
+
def seek()
|
2344
|
+
end
|
2345
|
+
def find3()
|
2346
|
+
end
|
2347
|
+
def read_only?()
|
2348
|
+
end
|
2349
|
+
def isOpen()
|
2350
|
+
end
|
2351
|
+
#
|
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.
|
2353
|
+
#
|
2354
|
+
#
|
2355
|
+
def ID3v1Tag(create = false)
|
2356
|
+
end
|
2357
|
+
def readBlock()
|
2358
|
+
end
|
2359
|
+
def rfind()
|
2360
|
+
end
|
2361
|
+
def clear()
|
2362
|
+
end
|
2363
|
+
#
|
2364
|
+
# Returns the Tag for this file. This will be an APE tag, an ID3v1 tag or a combination of the two.
|
2365
|
+
#
|
2366
|
+
def tag()
|
2367
|
+
end
|
2368
|
+
def writeBlock()
|
2369
|
+
end
|
2370
|
+
def removeBlock()
|
2371
|
+
end
|
2372
|
+
def writable?()
|
2373
|
+
end
|
2374
|
+
def open?()
|
2375
|
+
end
|
2376
|
+
#
|
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
|
+
#
|
2379
|
+
#
|
2380
|
+
def strip(tags = AllTags)
|
2381
|
+
end
|
2382
|
+
def isValid()
|
2383
|
+
end
|
2384
|
+
def find1()
|
2385
|
+
end
|
2386
|
+
#
|
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.
|
2388
|
+
#
|
2389
|
+
#
|
2390
|
+
def APETag(create = false)
|
2391
|
+
end
|
2392
|
+
def insert()
|
2393
|
+
end
|
2394
|
+
def readOnly()
|
2395
|
+
end
|
2396
|
+
#
|
2397
|
+
# Returns the MPC::Properties for this file. If no audio properties were read then this will return a null pointer.
|
2398
|
+
#
|
2399
|
+
def audioProperties()
|
2400
|
+
end
|
2401
|
+
def tell()
|
2402
|
+
end
|
2403
|
+
def find2()
|
2404
|
+
end
|
2405
|
+
def length()
|
2406
|
+
end
|
2407
|
+
def valid?()
|
2408
|
+
end
|
2409
|
+
#
|
2410
|
+
# Saves the file.
|
2411
|
+
#
|
2412
|
+
def save()
|
2413
|
+
end
|
2414
|
+
end
|
2415
|
+
end
|
2416
|
+
# <b>
|
2417
|
+
# An ID3v2 implementation. .</b>
|
2418
|
+
#
|
2419
|
+
#
|
2420
|
+
# This is a relatively complete and flexible framework for working with ID3v2 tags.ID3v2::Tag
|
2421
|
+
#
|
2422
|
+
#
|
2423
|
+
module TagLib::ID3v2
|
2424
|
+
# <b>
|
2425
|
+
# An implementation of ID3v2 comments. .</b>
|
2426
|
+
#
|
2427
|
+
#
|
2428
|
+
# This implements the ID3v2 comment format. An ID3v2 comment concists of a language encoding, a description and a single text field.
|
2429
|
+
#
|
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)
|
2436
|
+
end
|
2437
|
+
#
|
2438
|
+
# Sets the text portion of the comment to s.text()
|
2439
|
+
#
|
2440
|
+
#
|
2441
|
+
def setText(s)
|
2442
|
+
end
|
2443
|
+
#
|
2444
|
+
# Returns the text of this comment.text()
|
2445
|
+
#
|
2446
|
+
#
|
2447
|
+
def toString()
|
2448
|
+
end
|
2449
|
+
#
|
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
|
+
#
|
2452
|
+
#
|
2453
|
+
def textEncoding()
|
2454
|
+
end
|
2455
|
+
def frameID()
|
2456
|
+
end
|
2457
|
+
#
|
2458
|
+
# Returns the description of this comment.Most taggers simply ignore this value.
|
2459
|
+
# setDescription()
|
2460
|
+
#
|
2461
|
+
#
|
2462
|
+
def description()
|
2463
|
+
end
|
2464
|
+
def size()
|
2465
|
+
end
|
2466
|
+
#
|
2467
|
+
# Sets the text encoding to be used when rendering this frame to encoding.textEncoding() render()
|
2468
|
+
#
|
2469
|
+
#
|
2470
|
+
def setTextEncoding(encoding)
|
2471
|
+
end
|
2472
|
+
#
|
2473
|
+
# Returns the text of this comment.setText()
|
2474
|
+
#
|
2475
|
+
#
|
2476
|
+
def text()
|
2477
|
+
end
|
2478
|
+
#
|
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
|
+
#
|
2482
|
+
#
|
2483
|
+
def language()
|
2484
|
+
end
|
2485
|
+
#
|
2486
|
+
# Set the language using the 3 byte language code from ISO-639-2 to languageCode.language()
|
2487
|
+
#
|
2488
|
+
#
|
2489
|
+
def setLanguage(languageCode)
|
2490
|
+
end
|
2491
|
+
end
|
2492
|
+
# <b>
|
2493
|
+
# An ID3v2 general encapsulated object frame implementation. .</b>
|
2494
|
+
#
|
2495
|
+
#
|
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.
|
2497
|
+
#
|
2498
|
+
class TagLib::ID3v2::GeneralEncapsulatedObjectFrame
|
2499
|
+
end
|
2500
|
+
# <b>
|
2501
|
+
# ID3v2 frame implementation. .</b>
|
2502
|
+
#
|
2503
|
+
#
|
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.
|
2505
|
+
#
|
2506
|
+
class TagLib::ID3v2::Frame < TagLib::ID3v2::Header
|
2507
|
+
#
|
2508
|
+
# Returns the Frame ID (Structure, 4) (Frames, 4)
|
2509
|
+
#
|
2510
|
+
def frameID()
|
2511
|
+
end
|
2512
|
+
#
|
2513
|
+
# Returns the size of the frame.
|
2514
|
+
#
|
2515
|
+
def size()
|
2516
|
+
end
|
2517
|
+
end
|
2518
|
+
# <b>
|
2519
|
+
# An implementation of ID3v2 headers. .</b>
|
2520
|
+
#
|
2521
|
+
#
|
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)
|
2523
|
+
#
|
2524
|
+
class TagLib::ID3v2::Header
|
2525
|
+
end
|
2526
|
+
# <b>
|
2527
|
+
# An ID3v2 attached picture frame implementation. .</b>
|
2528
|
+
#
|
2529
|
+
#
|
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.
|
2531
|
+
#
|
2532
|
+
class TagLib::ID3v2::AttachedPictureFrame < TagLib::ID3v2::Frame
|
2533
|
+
# Singleton methods
|
2534
|
+
def self.new2()
|
2535
|
+
end
|
2536
|
+
#
|
2537
|
+
# Sets a textual description of the image to desc.description() textEncoding() setTextEncoding()
|
2538
|
+
#
|
2539
|
+
#
|
2540
|
+
def setDescription(desc)
|
2541
|
+
end
|
2542
|
+
#
|
2543
|
+
# Returns a string containing the description and mime-type
|
2544
|
+
#
|
2545
|
+
def toString()
|
2546
|
+
end
|
2547
|
+
#
|
2548
|
+
# Returns the text encoding used for the description.setTextEncoding() description()
|
2549
|
+
#
|
2550
|
+
#
|
2551
|
+
def textEncoding()
|
2552
|
+
end
|
2553
|
+
def frameID()
|
2554
|
+
end
|
2555
|
+
#
|
2556
|
+
# Sets the type for the image.Type type()
|
2557
|
+
#
|
2558
|
+
#
|
2559
|
+
def setType(t)
|
2560
|
+
end
|
2561
|
+
#
|
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()
|
2564
|
+
#
|
2565
|
+
#
|
2566
|
+
def picture()
|
2567
|
+
end
|
2568
|
+
#
|
2569
|
+
# Returns a text description of the image.setDescription() textEncoding() setTextEncoding()
|
2570
|
+
#
|
2571
|
+
#
|
2572
|
+
def description()
|
2573
|
+
end
|
2574
|
+
def size()
|
2575
|
+
end
|
2576
|
+
#
|
2577
|
+
# Set the text encoding used for the description.description()
|
2578
|
+
#
|
2579
|
+
#
|
2580
|
+
def setTextEncoding(t)
|
2581
|
+
end
|
2582
|
+
#
|
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
|
+
#
|
2585
|
+
#
|
2586
|
+
def setPicture(p)
|
2587
|
+
end
|
2588
|
+
#
|
2589
|
+
# Returns the mime type of the image. This should in most cases be "image/png" or "image/jpeg".
|
2590
|
+
#
|
2591
|
+
def mimeType()
|
2592
|
+
end
|
2593
|
+
#
|
2594
|
+
# Sets the mime type of the image. This should in most cases be "image/png" or "image/jpeg".
|
2595
|
+
#
|
2596
|
+
def setMimeType(m)
|
2597
|
+
end
|
2598
|
+
end
|
2599
|
+
# <b>
|
2600
|
+
# A factory for creating ID3v2 frames during parsing. .</b>
|
2601
|
+
#
|
2602
|
+
#
|
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
|
+
#
|
2606
|
+
#
|
2607
|
+
class TagLib::ID3v2::FrameFactory
|
2608
|
+
end
|
2609
|
+
# <b>
|
2610
|
+
# The main class in the ID3v2 implementation. .</b>
|
2611
|
+
#
|
2612
|
+
#
|
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
|
+
#
|
2616
|
+
#
|
2617
|
+
class TagLib::ID3v2::Tag < TagLib::Tag
|
2618
|
+
def track=()
|
2619
|
+
end
|
2620
|
+
#
|
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.
|
2622
|
+
#
|
2623
|
+
def setGenre(s)
|
2624
|
+
end
|
2625
|
+
#
|
2626
|
+
# Returns the track name; if no track name is present in the tag String::null will be returned.
|
2627
|
+
#
|
2628
|
+
def title()
|
2629
|
+
end
|
2630
|
+
#
|
2631
|
+
# Returns a pointer to the tag's header.
|
2632
|
+
#
|
2633
|
+
def header()
|
2634
|
+
end
|
2635
|
+
def title=()
|
2636
|
+
end
|
2637
|
+
#
|
2638
|
+
# Sets the title to s. If s is String::null then this value will be cleared.
|
2639
|
+
#
|
2640
|
+
def setTitle(s)
|
2641
|
+
end
|
2642
|
+
#
|
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
|
+
#
|
2646
|
+
#
|
2647
|
+
def frameList(frameID)
|
2648
|
+
end
|
2649
|
+
#
|
2650
|
+
# Returns the year; if there is no year set, this will return 0.
|
2651
|
+
#
|
2652
|
+
def year()
|
2653
|
+
end
|
2654
|
+
#
|
2655
|
+
# Sets the year to i. If s is 0 then this value will be cleared.
|
2656
|
+
#
|
2657
|
+
def setYear(i)
|
2658
|
+
end
|
2659
|
+
#
|
2660
|
+
# Returns the artist name; if no artist name is present in the tag String::null will be returned.
|
2661
|
+
#
|
2662
|
+
def artist()
|
2663
|
+
end
|
2664
|
+
def year=()
|
2665
|
+
end
|
2666
|
+
def artist=()
|
2667
|
+
end
|
2668
|
+
#
|
2669
|
+
# Sets the artist to s. If s is String::null then this value will be cleared.
|
2670
|
+
#
|
2671
|
+
def setArtist(s)
|
2672
|
+
end
|
2673
|
+
#
|
2674
|
+
# Returns the track comment; if no comment is present in the tag String::null will be returned.
|
2675
|
+
#
|
2676
|
+
def comment()
|
2677
|
+
end
|
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)
|
2683
|
+
end
|
2684
|
+
#
|
2685
|
+
# Sets the track to i. If s is 0 then this value will be cleared.
|
2686
|
+
#
|
2687
|
+
def setTrack(i)
|
2688
|
+
end
|
2689
|
+
def comment=()
|
2690
|
+
end
|
2691
|
+
def empty?()
|
2692
|
+
end
|
2693
|
+
#
|
2694
|
+
# Returns the album name; if no album name is present in the tag String::null will be returned.
|
2695
|
+
#
|
2696
|
+
def album()
|
2697
|
+
end
|
2698
|
+
def album=()
|
2699
|
+
end
|
2700
|
+
#
|
2701
|
+
# Sets the album to s. If s is String::null then this value will be cleared.
|
2702
|
+
#
|
2703
|
+
def setAlbum(s)
|
2704
|
+
end
|
2705
|
+
#
|
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.
|
2707
|
+
#
|
2708
|
+
def isEmpty()
|
2709
|
+
end
|
2710
|
+
#
|
2711
|
+
# Returns the genre name; if no genre is present in the tag String::null will be returned.
|
2712
|
+
#
|
2713
|
+
def genre()
|
2714
|
+
end
|
2715
|
+
#
|
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()
|
2717
|
+
#
|
2718
|
+
#
|
2719
|
+
def addFrame(frame)
|
2720
|
+
end
|
2721
|
+
def genre=()
|
2722
|
+
end
|
2723
|
+
#
|
2724
|
+
# Sets the comment to s. If s is String::null then this value will be cleared.
|
2725
|
+
#
|
2726
|
+
def setComment(s)
|
2727
|
+
end
|
2728
|
+
#
|
2729
|
+
# Returns the track number; if there is no track number set, this will return 0.
|
2730
|
+
#
|
2731
|
+
def track()
|
2732
|
+
end
|
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()
|
2752
|
+
end
|
2753
|
+
end
|
2754
|
+
end
|
2755
|
+
end
|