rtaglib 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/Manifest.txt +84 -9
- data/README.txt +0 -0
- data/Rakefile +30 -27
- data/{test/data → data}/440Hz-5sec.flac +0 -0
- data/{test/data → data}/440Hz-5sec.mp3 +0 -0
- data/{test/data → data}/440Hz-5sec.mpc +0 -0
- data/{test/data → data}/440Hz-5sec.ogg +0 -0
- data/{test/data → data}/440Hz-5sec.wv +0 -0
- data/data/test_jason.mp3 +0 -0
- data/data/test_jason.ogg +0 -0
- data/ext/Rakefile +10 -0
- data/ext/tagfile/Rakefile.rb +42 -0
- data/ext/tagfile/rake_ext_conf.rb +29 -0
- data/ext/tagfile/tagfile.c +11 -7
- data/ext/taglib/Rakefile.rb +48 -0
- data/ext/taglib/rake_ext_conf.rb +33 -0
- data/ext/taglib/taglib-mswin32/bin/tag.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/tag_c.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/tag_cd.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/tagd.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/taglib-config +55 -0
- data/ext/taglib/taglib-mswin32/include/taglib/apefooter.h +173 -0
- data/ext/taglib/taglib-mswin32/include/taglib/apeitem.h +204 -0
- data/ext/taglib/taglib-mswin32/include/taglib/apetag.h +162 -0
- data/ext/taglib/taglib-mswin32/include/taglib/attachedpictureframe.h +220 -0
- data/ext/taglib/taglib-mswin32/include/taglib/audioproperties.h +110 -0
- data/ext/taglib/taglib-mswin32/include/taglib/commentsframe.h +168 -0
- data/ext/taglib/taglib-mswin32/include/taglib/fileref.h +262 -0
- data/ext/taglib/taglib-mswin32/include/taglib/flacfile.h +201 -0
- data/ext/taglib/taglib-mswin32/include/taglib/flacproperties.h +92 -0
- data/ext/taglib/taglib-mswin32/include/taglib/generalencapsulatedobjectframe.h +174 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v1genres.h +66 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v1tag.h +180 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2extendedheader.h +93 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2footer.h +82 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2frame.h +414 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2framefactory.h +167 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2header.h +175 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2synchdata.h +70 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2tag.h +300 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpcfile.h +175 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpcproperties.h +85 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpegfile.h +277 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpegheader.h +166 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpegproperties.h +118 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggfile.h +112 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggflacfile.h +118 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggpage.h +203 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggpageheader.h +232 -0
- data/ext/taglib/taglib-mswin32/include/taglib/relativevolumeframe.h +274 -0
- data/ext/taglib/taglib-mswin32/include/taglib/speexfile.h +99 -0
- data/ext/taglib/taglib-mswin32/include/taglib/speexproperties.h +89 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tag.h +173 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tag_c.h +288 -0
- data/ext/taglib/taglib-mswin32/include/taglib/taglib.h +177 -0
- data/ext/taglib/taglib-mswin32/include/taglib/taglib_export.h +39 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tbytevector.h +409 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tbytevectorlist.h +91 -0
- data/ext/taglib/taglib-mswin32/include/taglib/textidentificationframe.h +258 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tfile.h +271 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tlist.h +252 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tlist.tcc +316 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tmap.h +200 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tmap.tcc +196 -0
- data/ext/taglib/taglib-mswin32/include/taglib/trueaudiofile.h +180 -0
- data/ext/taglib/taglib-mswin32/include/taglib/trueaudioproperties.h +93 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tstring.h +456 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tstringlist.h +115 -0
- data/ext/taglib/taglib-mswin32/include/taglib/uniquefileidentifierframe.h +113 -0
- data/ext/taglib/taglib-mswin32/include/taglib/unknownframe.h +79 -0
- data/ext/taglib/taglib-mswin32/include/taglib/unsynchronizedlyricsframe.h +157 -0
- data/ext/taglib/taglib-mswin32/include/taglib/urllinkframe.h +172 -0
- data/ext/taglib/taglib-mswin32/include/taglib/vorbisfile.h +118 -0
- data/ext/taglib/taglib-mswin32/include/taglib/vorbisproperties.h +125 -0
- data/ext/taglib/taglib-mswin32/include/taglib/wavpackfile.h +164 -0
- data/ext/taglib/taglib-mswin32/include/taglib/wavpackproperties.h +94 -0
- data/ext/taglib/taglib-mswin32/include/taglib/xingheader.h +100 -0
- data/ext/taglib/taglib-mswin32/include/taglib/xiphcomment.h +202 -0
- data/ext/taglib/taglib-mswin32/lib/pkgconfig/taglib_c.pc +12 -0
- data/ext/taglib/taglib-mswin32/lib/tag.lib +0 -0
- data/ext/taglib/taglib-mswin32/lib/tag_c.lib +0 -0
- data/ext/taglib/taglib_i386-mingw32.source +22645 -0
- data/ext/taglib/taglib_i386-mswin32.source +22645 -0
- data/ext/taglib/{taglib.cxx → taglib_x86_64-linux.source} +508 -75
- data/lib/TagLib.rb +3 -2
- data/lib/TagLib_doc.rb +1532 -1526
- data/lib/rtaglib_mswin32.rb +4 -0
- data/lib/tagfile.rb +6 -0
- data/swig/Doxyfile +0 -0
- data/swig/Rakefile +44 -19
- data/swig/TagLib_doc.rb +2755 -0
- data/swig/make_doc.rb +5 -4
- data/swig/process_cxx.rb +2 -2
- data/swig/rake_ext_conf.rb +33 -0
- data/swig/taglib.i +8 -5
- data/swig/test.rb +47 -39
- data/test/test_read.rb +4 -3
- data/test/test_taglib.rb +47 -39
- data/test/test_write.rb +4 -3
- metadata +96 -20
- data/ext/tagfile/extconf.rb +0 -14
- data/ext/taglib/extconf.rb +0 -22
- data/swig/extconf.rb +0 -22
@@ -0,0 +1,92 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2003 by Allan Sandfeld Jensen
|
3
|
+
email : kde@carewolf.org
|
4
|
+
***************************************************************************/
|
5
|
+
|
6
|
+
/***************************************************************************
|
7
|
+
* This library is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the GNU Lesser General Public License version *
|
9
|
+
* 2.1 as published by the Free Software Foundation. *
|
10
|
+
* *
|
11
|
+
* This library is distributed in the hope that it will be useful, but *
|
12
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
14
|
+
* Lesser General Public License for more details. *
|
15
|
+
* *
|
16
|
+
* You should have received a copy of the GNU Lesser General Public *
|
17
|
+
* License along with this library; if not, write to the Free Software *
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
19
|
+
* USA *
|
20
|
+
* *
|
21
|
+
* Alternatively, this file is available under the Mozilla Public *
|
22
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
23
|
+
* http://www.mozilla.org/MPL/ *
|
24
|
+
***************************************************************************/
|
25
|
+
|
26
|
+
#ifndef TAGLIB_FLACPROPERTIES_H
|
27
|
+
#define TAGLIB_FLACPROPERTIES_H
|
28
|
+
|
29
|
+
#include "taglib_export.h"
|
30
|
+
#include "audioproperties.h"
|
31
|
+
|
32
|
+
namespace TagLib {
|
33
|
+
|
34
|
+
namespace FLAC {
|
35
|
+
|
36
|
+
class File;
|
37
|
+
|
38
|
+
//! An implementation of audio property reading for FLAC
|
39
|
+
|
40
|
+
/*!
|
41
|
+
* This reads the data from an FLAC stream found in the AudioProperties
|
42
|
+
* API.
|
43
|
+
*/
|
44
|
+
|
45
|
+
class TAGLIB_EXPORT Properties : public AudioProperties
|
46
|
+
{
|
47
|
+
public:
|
48
|
+
/*!
|
49
|
+
* Create an instance of FLAC::Properties with the data read from the
|
50
|
+
* ByteVector \a data.
|
51
|
+
*/
|
52
|
+
// BIC: switch to const reference
|
53
|
+
Properties(ByteVector data, long streamLength, ReadStyle style = Average);
|
54
|
+
|
55
|
+
/*!
|
56
|
+
* Create an instance of FLAC::Properties with the data read from the
|
57
|
+
* FLAC::File \a file.
|
58
|
+
*/
|
59
|
+
// BIC: remove
|
60
|
+
Properties(File *file, ReadStyle style = Average);
|
61
|
+
|
62
|
+
/*!
|
63
|
+
* Destroys this FLAC::Properties instance.
|
64
|
+
*/
|
65
|
+
virtual ~Properties();
|
66
|
+
|
67
|
+
// Reimplementations.
|
68
|
+
|
69
|
+
virtual int length() const;
|
70
|
+
virtual int bitrate() const;
|
71
|
+
virtual int sampleRate() const;
|
72
|
+
virtual int channels() const;
|
73
|
+
|
74
|
+
/*!
|
75
|
+
* Returns the sample width as read from the FLAC identification
|
76
|
+
* header.
|
77
|
+
*/
|
78
|
+
int sampleWidth() const;
|
79
|
+
|
80
|
+
private:
|
81
|
+
Properties(const Properties &);
|
82
|
+
Properties &operator=(const Properties &);
|
83
|
+
|
84
|
+
void read();
|
85
|
+
|
86
|
+
class PropertiesPrivate;
|
87
|
+
PropertiesPrivate *d;
|
88
|
+
};
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
#endif
|
@@ -0,0 +1,174 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2002 - 2008 by Scott Wheeler
|
3
|
+
email : wheeler@kde.org
|
4
|
+
copyright : (C) 2006 by Aaron VonderHaar
|
5
|
+
email : avh4@users.sourceforge.net
|
6
|
+
***************************************************************************/
|
7
|
+
|
8
|
+
/***************************************************************************
|
9
|
+
* This library is free software; you can redistribute it and/or modify *
|
10
|
+
* it under the terms of the GNU Lesser General Public License version *
|
11
|
+
* 2.1 as published by the Free Software Foundation. *
|
12
|
+
* *
|
13
|
+
* This library is distributed in the hope that it will be useful, but *
|
14
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
16
|
+
* Lesser General Public License for more details. *
|
17
|
+
* *
|
18
|
+
* You should have received a copy of the GNU Lesser General Public *
|
19
|
+
* License along with this library; if not, write to the Free Software *
|
20
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
21
|
+
* USA *
|
22
|
+
* *
|
23
|
+
* Alternatively, this file is available under the Mozilla Public *
|
24
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
25
|
+
* http://www.mozilla.org/MPL/ *
|
26
|
+
***************************************************************************/
|
27
|
+
|
28
|
+
#ifndef TAGLIB_GENERALENCAPSULATEDOBJECT_H
|
29
|
+
#define TAGLIB_GENERALENCAPSULATEDOBJECT_H
|
30
|
+
|
31
|
+
#include <id3v2frame.h>
|
32
|
+
#include <id3v2header.h>
|
33
|
+
#include "taglib_export.h"
|
34
|
+
|
35
|
+
namespace TagLib {
|
36
|
+
|
37
|
+
namespace ID3v2 {
|
38
|
+
|
39
|
+
//! An ID3v2 general encapsulated object frame implementation
|
40
|
+
|
41
|
+
/*!
|
42
|
+
* This is an implementation of ID3v2 general encapsulated objects.
|
43
|
+
* Arbitrary binary data may be included in tags, stored in GEOB frames.
|
44
|
+
* There may be multiple GEOB frames in a single tag. Each GEOB it
|
45
|
+
* labelled with a content description (which may be blank), a required
|
46
|
+
* mime-type, and a file name (may be blank). The content description
|
47
|
+
* uniquely identifies the GEOB frame in the tag.
|
48
|
+
*/
|
49
|
+
|
50
|
+
class TAGLIB_EXPORT GeneralEncapsulatedObjectFrame : public Frame
|
51
|
+
{
|
52
|
+
friend class FrameFactory;
|
53
|
+
|
54
|
+
public:
|
55
|
+
|
56
|
+
/*!
|
57
|
+
* Constructs an empty object frame. The description, file name and text
|
58
|
+
* encoding should be set manually.
|
59
|
+
*/
|
60
|
+
GeneralEncapsulatedObjectFrame();
|
61
|
+
|
62
|
+
/*!
|
63
|
+
* Constructs a GeneralEncapsulatedObjectFrame frame based on \a data.
|
64
|
+
*/
|
65
|
+
explicit GeneralEncapsulatedObjectFrame(const ByteVector &data);
|
66
|
+
|
67
|
+
/*!
|
68
|
+
* Destroys the GeneralEncapsulatedObjectFrame instance.
|
69
|
+
*/
|
70
|
+
virtual ~GeneralEncapsulatedObjectFrame();
|
71
|
+
|
72
|
+
/*!
|
73
|
+
* Returns a string containing the description, file name and mime-type
|
74
|
+
*/
|
75
|
+
virtual String toString() const;
|
76
|
+
|
77
|
+
/*!
|
78
|
+
* Returns the text encoding used for the description and file name.
|
79
|
+
*
|
80
|
+
* \see setTextEncoding()
|
81
|
+
* \see description()
|
82
|
+
* \see fileName()
|
83
|
+
*/
|
84
|
+
String::Type textEncoding() const;
|
85
|
+
|
86
|
+
/*!
|
87
|
+
* Set the text encoding used for the description and file name.
|
88
|
+
*
|
89
|
+
* \see description()
|
90
|
+
* \see fileName()
|
91
|
+
*/
|
92
|
+
void setTextEncoding(String::Type encoding);
|
93
|
+
|
94
|
+
/*!
|
95
|
+
* Returns the mime type of the object.
|
96
|
+
*/
|
97
|
+
String mimeType() const;
|
98
|
+
|
99
|
+
/*!
|
100
|
+
* Sets the mime type of the object.
|
101
|
+
*/
|
102
|
+
void setMimeType(const String &type);
|
103
|
+
|
104
|
+
/*!
|
105
|
+
* Returns the file name of the object.
|
106
|
+
*
|
107
|
+
* \see setFileName()
|
108
|
+
*/
|
109
|
+
String fileName() const;
|
110
|
+
|
111
|
+
/*!
|
112
|
+
* Sets the file name for the object.
|
113
|
+
*
|
114
|
+
* \see fileName()
|
115
|
+
*/
|
116
|
+
void setFileName(const String &name);
|
117
|
+
|
118
|
+
/*!
|
119
|
+
* Returns the content description of the object.
|
120
|
+
*
|
121
|
+
* \see setDescription()
|
122
|
+
* \see textEncoding()
|
123
|
+
* \see setTextEncoding()
|
124
|
+
*/
|
125
|
+
|
126
|
+
String description() const;
|
127
|
+
|
128
|
+
/*!
|
129
|
+
* Sets the content description of the object to \a desc.
|
130
|
+
*
|
131
|
+
* \see description()
|
132
|
+
* \see textEncoding()
|
133
|
+
* \see setTextEncoding()
|
134
|
+
*/
|
135
|
+
|
136
|
+
void setDescription(const String &desc);
|
137
|
+
|
138
|
+
/*!
|
139
|
+
* Returns the object data as a ByteVector.
|
140
|
+
*
|
141
|
+
* \note ByteVector has a data() method that returns a const char * which
|
142
|
+
* should make it easy to export this data to external programs.
|
143
|
+
*
|
144
|
+
* \see setObject()
|
145
|
+
* \see mimeType()
|
146
|
+
*/
|
147
|
+
ByteVector object() const;
|
148
|
+
|
149
|
+
/*!
|
150
|
+
* Sets the object data to \a data. \a data should be of the type specified in
|
151
|
+
* this frame's mime-type specification.
|
152
|
+
*
|
153
|
+
* \see object()
|
154
|
+
* \see mimeType()
|
155
|
+
* \see setMimeType()
|
156
|
+
*/
|
157
|
+
void setObject(const ByteVector &object);
|
158
|
+
|
159
|
+
protected:
|
160
|
+
virtual void parseFields(const ByteVector &data);
|
161
|
+
virtual ByteVector renderFields() const;
|
162
|
+
|
163
|
+
private:
|
164
|
+
GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h);
|
165
|
+
GeneralEncapsulatedObjectFrame(const GeneralEncapsulatedObjectFrame &);
|
166
|
+
GeneralEncapsulatedObjectFrame &operator=(const GeneralEncapsulatedObjectFrame &);
|
167
|
+
|
168
|
+
class GeneralEncapsulatedObjectFramePrivate;
|
169
|
+
GeneralEncapsulatedObjectFramePrivate *d;
|
170
|
+
};
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
#endif
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2002 - 2008 by Scott Wheeler
|
3
|
+
email : wheeler@kde.org
|
4
|
+
***************************************************************************/
|
5
|
+
|
6
|
+
/***************************************************************************
|
7
|
+
* This library is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the GNU Lesser General Public License version *
|
9
|
+
* 2.1 as published by the Free Software Foundation. *
|
10
|
+
* *
|
11
|
+
* This library is distributed in the hope that it will be useful, but *
|
12
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
14
|
+
* Lesser General Public License for more details. *
|
15
|
+
* *
|
16
|
+
* You should have received a copy of the GNU Lesser General Public *
|
17
|
+
* License along with this library; if not, write to the Free Software *
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
19
|
+
* USA *
|
20
|
+
* *
|
21
|
+
* Alternatively, this file is available under the Mozilla Public *
|
22
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
23
|
+
* http://www.mozilla.org/MPL/ *
|
24
|
+
***************************************************************************/
|
25
|
+
|
26
|
+
#ifndef TAGLIB_ID3V1GENRE_H
|
27
|
+
#define TAGLIB_ID3V1GENRE_H
|
28
|
+
|
29
|
+
#include "tmap.h"
|
30
|
+
#include "tstringlist.h"
|
31
|
+
#include "taglib_export.h"
|
32
|
+
|
33
|
+
namespace TagLib {
|
34
|
+
namespace ID3v1 {
|
35
|
+
|
36
|
+
typedef Map<String, int> GenreMap;
|
37
|
+
|
38
|
+
/*!
|
39
|
+
* Returns the list of canonical ID3v1 genre names in the order that they
|
40
|
+
* are listed in the standard.
|
41
|
+
*/
|
42
|
+
StringList TAGLIB_EXPORT genreList();
|
43
|
+
|
44
|
+
/*!
|
45
|
+
* A "reverse mapping" that goes from the canonical ID3v1 genre name to the
|
46
|
+
* respective genre number. genreMap()["Rock"] ==
|
47
|
+
*/
|
48
|
+
GenreMap TAGLIB_EXPORT genreMap();
|
49
|
+
|
50
|
+
/*!
|
51
|
+
* Returns the name of the genre at \a index in the ID3v1 genre list. If
|
52
|
+
* \a index is out of range -- less than zero or greater than 146 -- a null
|
53
|
+
* string will be returned.
|
54
|
+
*/
|
55
|
+
String TAGLIB_EXPORT genre(int index);
|
56
|
+
|
57
|
+
/*!
|
58
|
+
* Returns the genre index for the (case sensitive) genre \a name. If the
|
59
|
+
* genre is not in the list 255 (which signifies an unknown genre in ID3v1)
|
60
|
+
* will be returned.
|
61
|
+
*/
|
62
|
+
int TAGLIB_EXPORT genreIndex(const String &name);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
#endif
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2002 - 2008 by Scott Wheeler
|
3
|
+
email : wheeler@kde.org
|
4
|
+
***************************************************************************/
|
5
|
+
|
6
|
+
/***************************************************************************
|
7
|
+
* This library is free software; you can redistribute it and/or modify *
|
8
|
+
* it under the terms of the GNU Lesser General Public License version *
|
9
|
+
* 2.1 as published by the Free Software Foundation. *
|
10
|
+
* *
|
11
|
+
* This library is distributed in the hope that it will be useful, but *
|
12
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
14
|
+
* Lesser General Public License for more details. *
|
15
|
+
* *
|
16
|
+
* You should have received a copy of the GNU Lesser General Public *
|
17
|
+
* License along with this library; if not, write to the Free Software *
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
19
|
+
* USA *
|
20
|
+
* *
|
21
|
+
* Alternatively, this file is available under the Mozilla Public *
|
22
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
23
|
+
* http://www.mozilla.org/MPL/ *
|
24
|
+
***************************************************************************/
|
25
|
+
|
26
|
+
#ifndef TAGLIB_ID3V1TAG_H
|
27
|
+
#define TAGLIB_ID3V1TAG_H
|
28
|
+
|
29
|
+
#include "tag.h"
|
30
|
+
#include "tbytevector.h"
|
31
|
+
#include "taglib_export.h"
|
32
|
+
|
33
|
+
namespace TagLib {
|
34
|
+
|
35
|
+
class File;
|
36
|
+
|
37
|
+
//! An ID3v1 implementation
|
38
|
+
|
39
|
+
namespace ID3v1 {
|
40
|
+
|
41
|
+
//! A abstraction for the string to data encoding in ID3v1 tags.
|
42
|
+
|
43
|
+
/*!
|
44
|
+
* ID3v1 should in theory always contain ISO-8859-1 (Latin1) data. In
|
45
|
+
* practice it does not. TagLib by default only supports ISO-8859-1 data
|
46
|
+
* in ID3v1 tags.
|
47
|
+
*
|
48
|
+
* However by subclassing this class and reimplementing parse() and render()
|
49
|
+
* and setting your reimplementation as the default with
|
50
|
+
* ID3v1::Tag::setStringHandler() you can define how you would like these
|
51
|
+
* transformations to be done.
|
52
|
+
*
|
53
|
+
* \warning It is advisable <b>not</b> to write non-ISO-8859-1 data to ID3v1
|
54
|
+
* tags. Please consider disabling the writing of ID3v1 tags in the case
|
55
|
+
* that the data is ISO-8859-1.
|
56
|
+
*
|
57
|
+
* \see ID3v1::Tag::setStringHandler()
|
58
|
+
*/
|
59
|
+
|
60
|
+
class TAGLIB_EXPORT StringHandler
|
61
|
+
{
|
62
|
+
public:
|
63
|
+
// BIC: Add virtual destructor.
|
64
|
+
|
65
|
+
/*!
|
66
|
+
* Decode a string from \a data. The default implementation assumes that
|
67
|
+
* \a data is an ISO-8859-1 (Latin1) character array.
|
68
|
+
*/
|
69
|
+
virtual String parse(const ByteVector &data) const;
|
70
|
+
|
71
|
+
/*!
|
72
|
+
* Encode a ByteVector with the data from \a s. The default implementation
|
73
|
+
* assumes that \a s is an ISO-8859-1 (Latin1) string. If the string is
|
74
|
+
* does not conform to ISO-8859-1, no value is written.
|
75
|
+
*
|
76
|
+
* \warning It is recommended that you <b>not</b> override this method, but
|
77
|
+
* instead do not write an ID3v1 tag in the case that the data is not
|
78
|
+
* ISO-8859-1.
|
79
|
+
*/
|
80
|
+
virtual ByteVector render(const String &s) const;
|
81
|
+
};
|
82
|
+
|
83
|
+
//! The main class in the ID3v1 implementation
|
84
|
+
|
85
|
+
/*!
|
86
|
+
* This is an implementation of the ID3v1 format. ID3v1 is both the simplist
|
87
|
+
* and most common of tag formats but is rather limited. Because of its
|
88
|
+
* pervasiveness and the way that applications have been written around the
|
89
|
+
* fields that it provides, the generic TagLib::Tag API is a mirror of what is
|
90
|
+
* provided by ID3v1.
|
91
|
+
*
|
92
|
+
* ID3v1 tags should generally only contain Latin1 information. However because
|
93
|
+
* many applications do not follow this rule there is now support for overriding
|
94
|
+
* the ID3v1 string handling using the ID3v1::StringHandler class. Please see
|
95
|
+
* the documentation for that class for more information.
|
96
|
+
*
|
97
|
+
* \see StringHandler
|
98
|
+
*
|
99
|
+
* \note Most fields are truncated to a maximum of 28-30 bytes. The
|
100
|
+
* truncation happens automatically when the tag is rendered.
|
101
|
+
*/
|
102
|
+
|
103
|
+
class TAGLIB_EXPORT Tag : public TagLib::Tag
|
104
|
+
{
|
105
|
+
public:
|
106
|
+
/*!
|
107
|
+
* Create an ID3v1 tag with default values.
|
108
|
+
*/
|
109
|
+
Tag();
|
110
|
+
|
111
|
+
/*!
|
112
|
+
* Create an ID3v1 tag and parse the data in \a file starting at
|
113
|
+
* \a tagOffset.
|
114
|
+
*/
|
115
|
+
Tag(File *file, long tagOffset);
|
116
|
+
|
117
|
+
/*!
|
118
|
+
* Destroys this Tag instance.
|
119
|
+
*/
|
120
|
+
virtual ~Tag();
|
121
|
+
|
122
|
+
/*!
|
123
|
+
* Renders the in memory values to a ByteVector suitable for writing to
|
124
|
+
* the file.
|
125
|
+
*/
|
126
|
+
ByteVector render() const;
|
127
|
+
|
128
|
+
/*!
|
129
|
+
* Returns the string "TAG" suitable for usage in locating the tag in a
|
130
|
+
* file.
|
131
|
+
*/
|
132
|
+
static ByteVector fileIdentifier();
|
133
|
+
|
134
|
+
// Reimplementations.
|
135
|
+
|
136
|
+
virtual String title() const;
|
137
|
+
virtual String artist() const;
|
138
|
+
virtual String album() const;
|
139
|
+
virtual String comment() const;
|
140
|
+
virtual String genre() const;
|
141
|
+
virtual uint year() const;
|
142
|
+
virtual uint track() const;
|
143
|
+
|
144
|
+
virtual void setTitle(const String &s);
|
145
|
+
virtual void setArtist(const String &s);
|
146
|
+
virtual void setAlbum(const String &s);
|
147
|
+
virtual void setComment(const String &s);
|
148
|
+
virtual void setGenre(const String &s);
|
149
|
+
virtual void setYear(uint i);
|
150
|
+
virtual void setTrack(uint i);
|
151
|
+
|
152
|
+
/*!
|
153
|
+
* Sets the string handler that decides how the ID3v1 data will be
|
154
|
+
* converted to and from binary data.
|
155
|
+
*
|
156
|
+
* \see StringHandler
|
157
|
+
*/
|
158
|
+
static void setStringHandler(const StringHandler *handler);
|
159
|
+
|
160
|
+
protected:
|
161
|
+
/*!
|
162
|
+
* Reads from the file specified in the constructor.
|
163
|
+
*/
|
164
|
+
void read();
|
165
|
+
/*!
|
166
|
+
* Pareses the body of the tag in \a data.
|
167
|
+
*/
|
168
|
+
void parse(const ByteVector &data);
|
169
|
+
|
170
|
+
private:
|
171
|
+
Tag(const Tag &);
|
172
|
+
Tag &operator=(const Tag &);
|
173
|
+
|
174
|
+
class TagPrivate;
|
175
|
+
TagPrivate *d;
|
176
|
+
};
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
#endif
|