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,99 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2006 by Lukáš Lalinský
|
3
|
+
email : lalinsky@gmail.com
|
4
|
+
|
5
|
+
copyright : (C) 2002 - 2008 by Scott Wheeler
|
6
|
+
email : wheeler@kde.org
|
7
|
+
(original Vorbis implementation)
|
8
|
+
***************************************************************************/
|
9
|
+
|
10
|
+
/***************************************************************************
|
11
|
+
* This library is free software; you can redistribute it and/or modify *
|
12
|
+
* it under the terms of the GNU Lesser General Public License version *
|
13
|
+
* 2.1 as published by the Free Software Foundation. *
|
14
|
+
* *
|
15
|
+
* This library is distributed in the hope that it will be useful, but *
|
16
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
18
|
+
* Lesser General Public License for more details. *
|
19
|
+
* *
|
20
|
+
* You should have received a copy of the GNU Lesser General Public *
|
21
|
+
* License along with this library; if not, write to the Free Software *
|
22
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
23
|
+
* USA *
|
24
|
+
* *
|
25
|
+
* Alternatively, this file is available under the Mozilla Public *
|
26
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
27
|
+
* http://www.mozilla.org/MPL/ *
|
28
|
+
***************************************************************************/
|
29
|
+
|
30
|
+
#ifndef TAGLIB_SPEEXFILE_H
|
31
|
+
#define TAGLIB_SPEEXFILE_H
|
32
|
+
|
33
|
+
#include <oggfile.h>
|
34
|
+
#include <xiphcomment.h>
|
35
|
+
|
36
|
+
#include "speexproperties.h"
|
37
|
+
|
38
|
+
namespace TagLib {
|
39
|
+
|
40
|
+
namespace Ogg {
|
41
|
+
|
42
|
+
//! A namespace containing classes for Speex metadata
|
43
|
+
|
44
|
+
namespace Speex {
|
45
|
+
|
46
|
+
//! An implementation of Ogg::File with Speex specific methods
|
47
|
+
|
48
|
+
/*!
|
49
|
+
* This is the central class in the Ogg Speex metadata processing collection
|
50
|
+
* of classes. It's built upon Ogg::File which handles processing of the Ogg
|
51
|
+
* logical bitstream and breaking it down into pages which are handled by
|
52
|
+
* the codec implementations, in this case Speex specifically.
|
53
|
+
*/
|
54
|
+
|
55
|
+
class TAGLIB_EXPORT File : public Ogg::File
|
56
|
+
{
|
57
|
+
public:
|
58
|
+
/*!
|
59
|
+
* Contructs a Speex file from \a file. If \a readProperties is true the
|
60
|
+
* file's audio properties will also be read using \a propertiesStyle. If
|
61
|
+
* false, \a propertiesStyle is ignored.
|
62
|
+
*/
|
63
|
+
File(FileName file, bool readProperties = true,
|
64
|
+
Properties::ReadStyle propertiesStyle = Properties::Average);
|
65
|
+
|
66
|
+
/*!
|
67
|
+
* Destroys this instance of the File.
|
68
|
+
*/
|
69
|
+
virtual ~File();
|
70
|
+
|
71
|
+
/*!
|
72
|
+
* Returns the XiphComment for this file. XiphComment implements the tag
|
73
|
+
* interface, so this serves as the reimplementation of
|
74
|
+
* TagLib::File::tag().
|
75
|
+
*/
|
76
|
+
virtual Ogg::XiphComment *tag() const;
|
77
|
+
|
78
|
+
/*!
|
79
|
+
* Returns the Speex::Properties for this file. If no audio properties
|
80
|
+
* were read then this will return a null pointer.
|
81
|
+
*/
|
82
|
+
virtual Properties *audioProperties() const;
|
83
|
+
|
84
|
+
virtual bool save();
|
85
|
+
|
86
|
+
private:
|
87
|
+
File(const File &);
|
88
|
+
File &operator=(const File &);
|
89
|
+
|
90
|
+
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
|
91
|
+
|
92
|
+
class FilePrivate;
|
93
|
+
FilePrivate *d;
|
94
|
+
};
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
#endif
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2006 by Lukáš Lalinský
|
3
|
+
email : lalinsky@gmail.com
|
4
|
+
|
5
|
+
copyright : (C) 2002 - 2008 by Scott Wheeler
|
6
|
+
email : wheeler@kde.org
|
7
|
+
(original Vorbis implementation)
|
8
|
+
***************************************************************************/
|
9
|
+
|
10
|
+
/***************************************************************************
|
11
|
+
* This library is free software; you can redistribute it and/or modify *
|
12
|
+
* it under the terms of the GNU Lesser General Public License version *
|
13
|
+
* 2.1 as published by the Free Software Foundation. *
|
14
|
+
* *
|
15
|
+
* This library is distributed in the hope that it will be useful, but *
|
16
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
18
|
+
* Lesser General Public License for more details. *
|
19
|
+
* *
|
20
|
+
* You should have received a copy of the GNU Lesser General Public *
|
21
|
+
* License along with this library; if not, write to the Free Software *
|
22
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
23
|
+
* USA *
|
24
|
+
* *
|
25
|
+
* Alternatively, this file is available under the Mozilla Public *
|
26
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
27
|
+
* http://www.mozilla.org/MPL/ *
|
28
|
+
***************************************************************************/
|
29
|
+
|
30
|
+
#ifndef TAGLIB_SPEEXPROPERTIES_H
|
31
|
+
#define TAGLIB_SPEEXPROPERTIES_H
|
32
|
+
|
33
|
+
#include <audioproperties.h>
|
34
|
+
|
35
|
+
namespace TagLib {
|
36
|
+
|
37
|
+
namespace Ogg {
|
38
|
+
|
39
|
+
namespace Speex {
|
40
|
+
|
41
|
+
class File;
|
42
|
+
|
43
|
+
//! An implementation of audio property reading for Ogg Speex
|
44
|
+
|
45
|
+
/*!
|
46
|
+
* This reads the data from an Ogg Speex stream found in the AudioProperties
|
47
|
+
* API.
|
48
|
+
*/
|
49
|
+
|
50
|
+
class TAGLIB_EXPORT Properties : public AudioProperties
|
51
|
+
{
|
52
|
+
public:
|
53
|
+
/*!
|
54
|
+
* Create an instance of Speex::Properties with the data read from the
|
55
|
+
* Speex::File \a file.
|
56
|
+
*/
|
57
|
+
Properties(File *file, ReadStyle style = Average);
|
58
|
+
|
59
|
+
/*!
|
60
|
+
* Destroys this Speex::Properties instance.
|
61
|
+
*/
|
62
|
+
virtual ~Properties();
|
63
|
+
|
64
|
+
// Reimplementations.
|
65
|
+
|
66
|
+
virtual int length() const;
|
67
|
+
virtual int bitrate() const;
|
68
|
+
virtual int sampleRate() const;
|
69
|
+
virtual int channels() const;
|
70
|
+
|
71
|
+
/*!
|
72
|
+
* Returns the Speex version, currently "0" (as specified by the spec).
|
73
|
+
*/
|
74
|
+
int speexVersion() const;
|
75
|
+
|
76
|
+
private:
|
77
|
+
Properties(const Properties &);
|
78
|
+
Properties &operator=(const Properties &);
|
79
|
+
|
80
|
+
void read();
|
81
|
+
|
82
|
+
class PropertiesPrivate;
|
83
|
+
PropertiesPrivate *d;
|
84
|
+
};
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
#endif
|
@@ -0,0 +1,173 @@
|
|
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_TAG_H
|
27
|
+
#define TAGLIB_TAG_H
|
28
|
+
|
29
|
+
#include "taglib_export.h"
|
30
|
+
#include "tstring.h"
|
31
|
+
|
32
|
+
namespace TagLib {
|
33
|
+
|
34
|
+
//! A simple, generic interface to common audio meta data fields
|
35
|
+
|
36
|
+
/*!
|
37
|
+
* This is an attempt to abstract away the difference in the meta data formats
|
38
|
+
* of various audio codecs and tagging schemes. As such it is generally a
|
39
|
+
* subset of what is available in the specific formats but should be suitable
|
40
|
+
* for most applications. This is meant to compliment the generic APIs found
|
41
|
+
* in TagLib::AudioProperties, TagLib::File and TagLib::FileRef.
|
42
|
+
*/
|
43
|
+
|
44
|
+
class TAGLIB_EXPORT Tag
|
45
|
+
{
|
46
|
+
public:
|
47
|
+
|
48
|
+
/*!
|
49
|
+
* Detroys this Tag instance.
|
50
|
+
*/
|
51
|
+
virtual ~Tag();
|
52
|
+
|
53
|
+
/*!
|
54
|
+
* Returns the track name; if no track name is present in the tag
|
55
|
+
* String::null will be returned.
|
56
|
+
*/
|
57
|
+
virtual String title() const = 0;
|
58
|
+
|
59
|
+
/*!
|
60
|
+
* Returns the artist name; if no artist name is present in the tag
|
61
|
+
* String::null will be returned.
|
62
|
+
*/
|
63
|
+
virtual String artist() const = 0;
|
64
|
+
|
65
|
+
/*!
|
66
|
+
* Returns the album name; if no album name is present in the tag
|
67
|
+
* String::null will be returned.
|
68
|
+
*/
|
69
|
+
virtual String album() const = 0;
|
70
|
+
|
71
|
+
/*!
|
72
|
+
* Returns the track comment; if no comment is present in the tag
|
73
|
+
* String::null will be returned.
|
74
|
+
*/
|
75
|
+
virtual String comment() const = 0;
|
76
|
+
|
77
|
+
/*!
|
78
|
+
* Returns the genre name; if no genre is present in the tag String::null
|
79
|
+
* will be returned.
|
80
|
+
*/
|
81
|
+
virtual String genre() const = 0;
|
82
|
+
|
83
|
+
/*!
|
84
|
+
* Returns the year; if there is no year set, this will return 0.
|
85
|
+
*/
|
86
|
+
virtual uint year() const = 0;
|
87
|
+
|
88
|
+
/*!
|
89
|
+
* Returns the track number; if there is no track number set, this will
|
90
|
+
* return 0.
|
91
|
+
*/
|
92
|
+
virtual uint track() const = 0;
|
93
|
+
|
94
|
+
/*!
|
95
|
+
* Sets the title to \a s. If \a s is String::null then this value will be
|
96
|
+
* cleared.
|
97
|
+
*/
|
98
|
+
virtual void setTitle(const String &s) = 0;
|
99
|
+
|
100
|
+
/*!
|
101
|
+
* Sets the artist to \a s. If \a s is String::null then this value will be
|
102
|
+
* cleared.
|
103
|
+
*/
|
104
|
+
virtual void setArtist(const String &s) = 0;
|
105
|
+
|
106
|
+
/*!
|
107
|
+
* Sets the album to \a s. If \a s is String::null then this value will be
|
108
|
+
* cleared.
|
109
|
+
*/
|
110
|
+
virtual void setAlbum(const String &s) = 0;
|
111
|
+
|
112
|
+
/*!
|
113
|
+
* Sets the comment to \a s. If \a s is String::null then this value will be
|
114
|
+
* cleared.
|
115
|
+
*/
|
116
|
+
virtual void setComment(const String &s) = 0;
|
117
|
+
|
118
|
+
/*!
|
119
|
+
* Sets the genre to \a s. If \a s is String::null then this value will be
|
120
|
+
* cleared. For tag formats that use a fixed set of genres, the appropriate
|
121
|
+
* value will be selected based on a string comparison. A list of available
|
122
|
+
* genres for those formats should be available in that type's
|
123
|
+
* implementation.
|
124
|
+
*/
|
125
|
+
virtual void setGenre(const String &s) = 0;
|
126
|
+
|
127
|
+
/*!
|
128
|
+
* Sets the year to \a i. If \a s is 0 then this value will be cleared.
|
129
|
+
*/
|
130
|
+
virtual void setYear(uint i) = 0;
|
131
|
+
|
132
|
+
/*!
|
133
|
+
* Sets the track to \a i. If \a s is 0 then this value will be cleared.
|
134
|
+
*/
|
135
|
+
virtual void setTrack(uint i) = 0;
|
136
|
+
|
137
|
+
/*!
|
138
|
+
* Returns true if the tag does not contain any data. This should be
|
139
|
+
* reimplemented in subclasses that provide more than the basic tagging
|
140
|
+
* abilities in this class.
|
141
|
+
*/
|
142
|
+
virtual bool isEmpty() const;
|
143
|
+
|
144
|
+
/*!
|
145
|
+
* Copies the generic data from one tag to another.
|
146
|
+
*
|
147
|
+
* \note This will no affect any of the lower level details of the tag. For
|
148
|
+
* instance if any of the tag type specific data (maybe a URL for a band) is
|
149
|
+
* set, this will not modify or copy that. This just copies using the API
|
150
|
+
* in this class.
|
151
|
+
*
|
152
|
+
* If \a overwrite is true then the values will be unconditionally copied.
|
153
|
+
* If false only empty values will be overwritten.
|
154
|
+
*/
|
155
|
+
static void duplicate(const Tag *source, Tag *target, bool overwrite = true);
|
156
|
+
|
157
|
+
protected:
|
158
|
+
/*!
|
159
|
+
* Construct a Tag. This is protected since tags should only be instantiated
|
160
|
+
* through subclasses.
|
161
|
+
*/
|
162
|
+
Tag();
|
163
|
+
|
164
|
+
private:
|
165
|
+
Tag(const Tag &);
|
166
|
+
Tag &operator=(const Tag &);
|
167
|
+
|
168
|
+
class TagPrivate;
|
169
|
+
TagPrivate *d;
|
170
|
+
};
|
171
|
+
}
|
172
|
+
|
173
|
+
#endif
|
@@ -0,0 +1,288 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2003 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
|
+
|
22
|
+
#ifndef TAGLIB_TAG_C
|
23
|
+
#define TAGLIB_TAG_C
|
24
|
+
|
25
|
+
/* Do not include this in the main TagLib documentation. */
|
26
|
+
#ifndef DO_NOT_DOCUMENT
|
27
|
+
|
28
|
+
#ifdef __cplusplus
|
29
|
+
extern "C" {
|
30
|
+
#endif
|
31
|
+
|
32
|
+
#if defined(_WIN32) || defined(_WIN64)
|
33
|
+
#ifdef MAKE_TAGLIB_C_LIB
|
34
|
+
#define TAGLIB_C_EXPORT __declspec(dllexport)
|
35
|
+
#else
|
36
|
+
#define TAGLIB_C_EXPORT __declspec(dllimport)
|
37
|
+
#endif
|
38
|
+
#else
|
39
|
+
#define TAGLIB_C_EXPORT
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#ifndef BOOL
|
43
|
+
#define BOOL int
|
44
|
+
#endif
|
45
|
+
|
46
|
+
/*******************************************************************************
|
47
|
+
* [ TagLib C Binding ]
|
48
|
+
*
|
49
|
+
* This is an interface to TagLib's "simple" API, meaning that you can read and
|
50
|
+
* modify media files in a generic, but not specialized way. This is a rough
|
51
|
+
* representation of TagLib::File and TagLib::Tag, for which the documentation
|
52
|
+
* is somewhat more complete and worth consulting.
|
53
|
+
*******************************************************************************/
|
54
|
+
|
55
|
+
/*
|
56
|
+
* These are used for type provide some type safety to the C API (as opposed to
|
57
|
+
* using void *, but pointers to them are simply cast to the corresponding C++
|
58
|
+
* types in the implementation.
|
59
|
+
*/
|
60
|
+
|
61
|
+
typedef struct { int dummy; } TagLib_File;
|
62
|
+
typedef struct { int dummy; } TagLib_Tag;
|
63
|
+
typedef struct { int dummy; } TagLib_AudioProperties;
|
64
|
+
|
65
|
+
/*!
|
66
|
+
* By default all strings coming into or out of TagLib's C API are in UTF8.
|
67
|
+
* However, it may be desirable for TagLib to operate on Latin1 (ISO-8859-1)
|
68
|
+
* strings in which case this should be set to FALSE.
|
69
|
+
*/
|
70
|
+
TAGLIB_C_EXPORT void taglib_set_strings_unicode(BOOL unicode);
|
71
|
+
|
72
|
+
/*!
|
73
|
+
* TagLib can keep track of strings that are created when outputting tag values
|
74
|
+
* and clear them using taglib_tag_clear_strings(). This is enabled by default.
|
75
|
+
* However if you wish to do more fine grained management of strings, you can do
|
76
|
+
* so by setting \a management to FALSE.
|
77
|
+
*/
|
78
|
+
TAGLIB_C_EXPORT void taglib_set_string_management_enabled(BOOL management);
|
79
|
+
|
80
|
+
/*******************************************************************************
|
81
|
+
* File API
|
82
|
+
******************************************************************************/
|
83
|
+
|
84
|
+
typedef enum {
|
85
|
+
TagLib_File_MPEG,
|
86
|
+
TagLib_File_OggVorbis,
|
87
|
+
TagLib_File_FLAC,
|
88
|
+
TagLib_File_MPC,
|
89
|
+
TagLib_File_OggFlac,
|
90
|
+
TagLib_File_WavPack,
|
91
|
+
TagLib_File_Speex,
|
92
|
+
TagLib_File_TrueAudio
|
93
|
+
} TagLib_File_Type;
|
94
|
+
|
95
|
+
/*!
|
96
|
+
* Creates a TagLib file based on \a filename. TagLib will try to guess the file
|
97
|
+
* type.
|
98
|
+
*
|
99
|
+
* \returns NULL if the file type cannot be determined or the file cannot
|
100
|
+
* be opened.
|
101
|
+
*/
|
102
|
+
TAGLIB_C_EXPORT TagLib_File *taglib_file_new(const char *filename);
|
103
|
+
|
104
|
+
/*!
|
105
|
+
* Creates a TagLib file based on \a filename. Rather than attempting to guess
|
106
|
+
* the type, it will use the one specified by \a type.
|
107
|
+
*/
|
108
|
+
TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type);
|
109
|
+
|
110
|
+
/*!
|
111
|
+
* Frees and closes the file.
|
112
|
+
*/
|
113
|
+
TAGLIB_C_EXPORT void taglib_file_free(TagLib_File *file);
|
114
|
+
|
115
|
+
/*!
|
116
|
+
* Returns true if the file is open and readble and valid information for
|
117
|
+
* the Tag and / or AudioProperties was found.
|
118
|
+
*/
|
119
|
+
|
120
|
+
TAGLIB_C_EXPORT BOOL taglib_file_is_valid(const TagLib_File *file);
|
121
|
+
|
122
|
+
/*!
|
123
|
+
* Returns a pointer to the tag associated with this file. This will be freed
|
124
|
+
* automatically when the file is freed.
|
125
|
+
*/
|
126
|
+
TAGLIB_C_EXPORT TagLib_Tag *taglib_file_tag(const TagLib_File *file);
|
127
|
+
|
128
|
+
/*!
|
129
|
+
* Returns a pointer to the the audio properties associated with this file. This
|
130
|
+
* will be freed automatically when the file is freed.
|
131
|
+
*/
|
132
|
+
TAGLIB_C_EXPORT const TagLib_AudioProperties *taglib_file_audioproperties(const TagLib_File *file);
|
133
|
+
|
134
|
+
/*!
|
135
|
+
* Saves the \a file to disk.
|
136
|
+
*/
|
137
|
+
TAGLIB_C_EXPORT BOOL taglib_file_save(TagLib_File *file);
|
138
|
+
|
139
|
+
/******************************************************************************
|
140
|
+
* Tag API
|
141
|
+
******************************************************************************/
|
142
|
+
|
143
|
+
/*!
|
144
|
+
* Returns a string with this tag's title.
|
145
|
+
*
|
146
|
+
* \note By default this string should be UTF8 encoded and its memory should be
|
147
|
+
* freed using taglib_tag_free_strings().
|
148
|
+
*/
|
149
|
+
TAGLIB_C_EXPORT char *taglib_tag_title(const TagLib_Tag *tag);
|
150
|
+
|
151
|
+
/*!
|
152
|
+
* Returns a string with this tag's artist.
|
153
|
+
*
|
154
|
+
* \note By default this string should be UTF8 encoded and its memory should be
|
155
|
+
* freed using taglib_tag_free_strings().
|
156
|
+
*/
|
157
|
+
TAGLIB_C_EXPORT char *taglib_tag_artist(const TagLib_Tag *tag);
|
158
|
+
|
159
|
+
/*!
|
160
|
+
* Returns a string with this tag's album name.
|
161
|
+
*
|
162
|
+
* \note By default this string should be UTF8 encoded and its memory should be
|
163
|
+
* freed using taglib_tag_free_strings().
|
164
|
+
*/
|
165
|
+
TAGLIB_C_EXPORT char *taglib_tag_album(const TagLib_Tag *tag);
|
166
|
+
|
167
|
+
/*!
|
168
|
+
* Returns a string with this tag's comment.
|
169
|
+
*
|
170
|
+
* \note By default this string should be UTF8 encoded and its memory should be
|
171
|
+
* freed using taglib_tag_free_strings().
|
172
|
+
*/
|
173
|
+
TAGLIB_C_EXPORT char *taglib_tag_comment(const TagLib_Tag *tag);
|
174
|
+
|
175
|
+
/*!
|
176
|
+
* Returns a string with this tag's genre.
|
177
|
+
*
|
178
|
+
* \note By default this string should be UTF8 encoded and its memory should be
|
179
|
+
* freed using taglib_tag_free_strings().
|
180
|
+
*/
|
181
|
+
TAGLIB_C_EXPORT char *taglib_tag_genre(const TagLib_Tag *tag);
|
182
|
+
|
183
|
+
/*!
|
184
|
+
* Returns the tag's year or 0 if year is not set.
|
185
|
+
*/
|
186
|
+
TAGLIB_C_EXPORT unsigned int taglib_tag_year(const TagLib_Tag *tag);
|
187
|
+
|
188
|
+
/*!
|
189
|
+
* Returns the tag's track number or 0 if track number is not set.
|
190
|
+
*/
|
191
|
+
TAGLIB_C_EXPORT unsigned int taglib_tag_track(const TagLib_Tag *tag);
|
192
|
+
|
193
|
+
/*!
|
194
|
+
* Sets the tag's title.
|
195
|
+
*
|
196
|
+
* \note By default this string should be UTF8 encoded.
|
197
|
+
*/
|
198
|
+
TAGLIB_C_EXPORT void taglib_tag_set_title(TagLib_Tag *tag, const char *title);
|
199
|
+
|
200
|
+
/*!
|
201
|
+
* Sets the tag's artist.
|
202
|
+
*
|
203
|
+
* \note By default this string should be UTF8 encoded.
|
204
|
+
*/
|
205
|
+
TAGLIB_C_EXPORT void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist);
|
206
|
+
|
207
|
+
/*!
|
208
|
+
* Sets the tag's album.
|
209
|
+
*
|
210
|
+
* \note By default this string should be UTF8 encoded.
|
211
|
+
*/
|
212
|
+
TAGLIB_C_EXPORT void taglib_tag_set_album(TagLib_Tag *tag, const char *album);
|
213
|
+
|
214
|
+
/*!
|
215
|
+
* Sets the tag's comment.
|
216
|
+
*
|
217
|
+
* \note By default this string should be UTF8 encoded.
|
218
|
+
*/
|
219
|
+
TAGLIB_C_EXPORT void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment);
|
220
|
+
|
221
|
+
/*!
|
222
|
+
* Sets the tag's genre.
|
223
|
+
*
|
224
|
+
* \note By default this string should be UTF8 encoded.
|
225
|
+
*/
|
226
|
+
TAGLIB_C_EXPORT void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre);
|
227
|
+
|
228
|
+
/*!
|
229
|
+
* Sets the tag's year. 0 indicates that this field should be cleared.
|
230
|
+
*/
|
231
|
+
TAGLIB_C_EXPORT void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year);
|
232
|
+
|
233
|
+
/*!
|
234
|
+
* Sets the tag's track number. 0 indicates that this field should be cleared.
|
235
|
+
*/
|
236
|
+
TAGLIB_C_EXPORT void taglib_tag_set_track(TagLib_Tag *tag, unsigned int track);
|
237
|
+
|
238
|
+
/*!
|
239
|
+
* Frees all of the strings that have been created by the tag.
|
240
|
+
*/
|
241
|
+
TAGLIB_C_EXPORT void taglib_tag_free_strings(void);
|
242
|
+
|
243
|
+
/******************************************************************************
|
244
|
+
* Audio Properties API
|
245
|
+
******************************************************************************/
|
246
|
+
|
247
|
+
/*!
|
248
|
+
* Returns the length of the file in seconds.
|
249
|
+
*/
|
250
|
+
TAGLIB_C_EXPORT int taglib_audioproperties_length(const TagLib_AudioProperties *audioProperties);
|
251
|
+
|
252
|
+
/*!
|
253
|
+
* Returns the bitrate of the file in kb/s.
|
254
|
+
*/
|
255
|
+
TAGLIB_C_EXPORT int taglib_audioproperties_bitrate(const TagLib_AudioProperties *audioProperties);
|
256
|
+
|
257
|
+
/*!
|
258
|
+
* Returns the sample rate of the file in Hz.
|
259
|
+
*/
|
260
|
+
TAGLIB_C_EXPORT int taglib_audioproperties_samplerate(const TagLib_AudioProperties *audioProperties);
|
261
|
+
|
262
|
+
/*!
|
263
|
+
* Returns the number of channels in the audio stream.
|
264
|
+
*/
|
265
|
+
TAGLIB_C_EXPORT int taglib_audioproperties_channels(const TagLib_AudioProperties *audioProperties);
|
266
|
+
|
267
|
+
/*******************************************************************************
|
268
|
+
* Special convenience ID3v2 functions
|
269
|
+
*******************************************************************************/
|
270
|
+
|
271
|
+
typedef enum {
|
272
|
+
TagLib_ID3v2_Latin1,
|
273
|
+
TagLib_ID3v2_UTF16,
|
274
|
+
TagLib_ID3v2_UTF16BE,
|
275
|
+
TagLib_ID3v2_UTF8
|
276
|
+
} TagLib_ID3v2_Encoding;
|
277
|
+
|
278
|
+
/*!
|
279
|
+
* This sets the default encoding for ID3v2 frames that are written to tags.
|
280
|
+
*/
|
281
|
+
|
282
|
+
TAGLIB_C_EXPORT void taglib_id3v2_set_default_text_encoding(TagLib_ID3v2_Encoding encoding);
|
283
|
+
|
284
|
+
#ifdef __cplusplus
|
285
|
+
}
|
286
|
+
#endif
|
287
|
+
#endif /* DO_NOT_DOCUMENT */
|
288
|
+
#endif
|