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
@@ -0,0 +1,93 @@
|
|
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_ID3V2EXTENDEDHEADER_H
|
27
|
+
#define TAGLIB_ID3V2EXTENDEDHEADER_H
|
28
|
+
|
29
|
+
#include "taglib_export.h"
|
30
|
+
#include "tbytevector.h"
|
31
|
+
#include "taglib.h"
|
32
|
+
|
33
|
+
namespace TagLib {
|
34
|
+
|
35
|
+
namespace ID3v2 {
|
36
|
+
|
37
|
+
//! ID3v2 extended header implementation
|
38
|
+
|
39
|
+
/*!
|
40
|
+
* This class implements ID3v2 extended headers. It attempts to follow,
|
41
|
+
* both semantically and programatically, the structure specified in
|
42
|
+
* the ID3v2 standard. The API is based on the properties of ID3v2 extended
|
43
|
+
* headers specified there. If any of the terms used in this documentation
|
44
|
+
* are unclear please check the specification in the linked section.
|
45
|
+
* (Structure, <a href="id3v2-structure.html#3.2">3.2</a>)
|
46
|
+
*/
|
47
|
+
|
48
|
+
class TAGLIB_EXPORT ExtendedHeader
|
49
|
+
{
|
50
|
+
public:
|
51
|
+
/*!
|
52
|
+
* Constructs an empty ID3v2 extended header.
|
53
|
+
*/
|
54
|
+
ExtendedHeader();
|
55
|
+
|
56
|
+
/*!
|
57
|
+
* Destroys the extended header.
|
58
|
+
*/
|
59
|
+
virtual ~ExtendedHeader();
|
60
|
+
|
61
|
+
/*!
|
62
|
+
* Returns the size of the extended header. This is variable for the
|
63
|
+
* extended header.
|
64
|
+
*/
|
65
|
+
uint size() const;
|
66
|
+
|
67
|
+
/*!
|
68
|
+
* Sets the data that will be used as the extended header. Since the
|
69
|
+
* length is not known before the extended header has been parsed, this
|
70
|
+
* should just be a pointer to the first byte of the extended header. It
|
71
|
+
* will determine the length internally and make that available through
|
72
|
+
* size().
|
73
|
+
*/
|
74
|
+
void setData(const ByteVector &data);
|
75
|
+
|
76
|
+
protected:
|
77
|
+
/*!
|
78
|
+
* Called by setData() to parse the extended header data. It makes this
|
79
|
+
* information available through the public API.
|
80
|
+
*/
|
81
|
+
void parse(const ByteVector &data);
|
82
|
+
|
83
|
+
private:
|
84
|
+
ExtendedHeader(const ExtendedHeader &);
|
85
|
+
ExtendedHeader &operator=(const ExtendedHeader &);
|
86
|
+
|
87
|
+
class ExtendedHeaderPrivate;
|
88
|
+
ExtendedHeaderPrivate *d;
|
89
|
+
};
|
90
|
+
|
91
|
+
}
|
92
|
+
}
|
93
|
+
#endif
|
@@ -0,0 +1,82 @@
|
|
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_ID3V2FOOTER_H
|
27
|
+
#define TAGLIB_ID3V2FOOTER_H
|
28
|
+
|
29
|
+
#include "taglib_export.h"
|
30
|
+
#include "tbytevector.h"
|
31
|
+
|
32
|
+
namespace TagLib {
|
33
|
+
|
34
|
+
namespace ID3v2 {
|
35
|
+
|
36
|
+
class Header;
|
37
|
+
|
38
|
+
//! ID3v2 footer implementation
|
39
|
+
|
40
|
+
/*!
|
41
|
+
* Per the ID3v2 specification, the tag's footer is just a copy of the
|
42
|
+
* information in the header. As such there is no API for reading the
|
43
|
+
* data from the header, it can just as easily be done from the header.
|
44
|
+
*
|
45
|
+
* In fact, at this point, TagLib does not even parse the footer since
|
46
|
+
* it is not useful internally. However, if the flag to include a footer
|
47
|
+
* has been set in the ID3v2::Tag, TagLib will render a footer.
|
48
|
+
*/
|
49
|
+
|
50
|
+
class TAGLIB_EXPORT Footer
|
51
|
+
{
|
52
|
+
public:
|
53
|
+
/*!
|
54
|
+
* Constructs an empty ID3v2 footer.
|
55
|
+
*/
|
56
|
+
Footer();
|
57
|
+
/*!
|
58
|
+
* Destroys the footer.
|
59
|
+
*/
|
60
|
+
virtual ~Footer();
|
61
|
+
|
62
|
+
/*!
|
63
|
+
* Returns the size of the footer. Presently this is always 10 bytes.
|
64
|
+
*/
|
65
|
+
static const unsigned int size();
|
66
|
+
|
67
|
+
/*!
|
68
|
+
* Renders the footer based on the data in \a header.
|
69
|
+
*/
|
70
|
+
ByteVector render(const Header *header) const;
|
71
|
+
|
72
|
+
private:
|
73
|
+
Footer(const Footer &);
|
74
|
+
Footer &operator=(const Footer &);
|
75
|
+
|
76
|
+
class FooterPrivate;
|
77
|
+
FooterPrivate *d;
|
78
|
+
};
|
79
|
+
|
80
|
+
}
|
81
|
+
}
|
82
|
+
#endif
|
@@ -0,0 +1,414 @@
|
|
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_ID3V2FRAME_H
|
27
|
+
#define TAGLIB_ID3V2FRAME_H
|
28
|
+
|
29
|
+
#include "tstring.h"
|
30
|
+
#include "tbytevector.h"
|
31
|
+
#include "taglib_export.h"
|
32
|
+
|
33
|
+
namespace TagLib {
|
34
|
+
|
35
|
+
class StringList;
|
36
|
+
|
37
|
+
namespace ID3v2 {
|
38
|
+
|
39
|
+
class Tag;
|
40
|
+
class FrameFactory;
|
41
|
+
|
42
|
+
//! ID3v2 frame implementation
|
43
|
+
|
44
|
+
/*!
|
45
|
+
* This class is the main ID3v2 frame implementation. In ID3v2, a tag is
|
46
|
+
* split between a collection of frames (which are in turn split into fields
|
47
|
+
* (Structure, <a href="id3v2-structure.html#4">4</a>)
|
48
|
+
* (<a href="id3v2-frames.html">Frames</a>). This class provides an API for
|
49
|
+
* gathering information about and modifying ID3v2 frames. Funtionallity
|
50
|
+
* specific to a given frame type is handed in one of the many subclasses.
|
51
|
+
*/
|
52
|
+
|
53
|
+
class TAGLIB_EXPORT Frame
|
54
|
+
{
|
55
|
+
friend class Tag;
|
56
|
+
friend class FrameFactory;
|
57
|
+
|
58
|
+
public:
|
59
|
+
/*!
|
60
|
+
* Destroys this Frame instance.
|
61
|
+
*/
|
62
|
+
virtual ~Frame();
|
63
|
+
|
64
|
+
/*!
|
65
|
+
* Returns the Frame ID (Structure, <a href="id3v2-structure.html#4">4</a>)
|
66
|
+
* (Frames, <a href="id3v2-frames.html#4">4</a>)
|
67
|
+
*/
|
68
|
+
ByteVector frameID() const;
|
69
|
+
|
70
|
+
/*!
|
71
|
+
* Returns the size of the frame.
|
72
|
+
*/
|
73
|
+
uint size() const;
|
74
|
+
|
75
|
+
/*!
|
76
|
+
* Returns the size of the frame header
|
77
|
+
*
|
78
|
+
* \deprecated This is only accurate for ID3v2.3 or ID3v2.4. Please use
|
79
|
+
* the call below which accepts an ID3v2 version number. In the next
|
80
|
+
* non-binary compatible release this will be made into a non-static
|
81
|
+
* member that checks the internal ID3v2 version.
|
82
|
+
*/
|
83
|
+
static uint headerSize(); // BIC: remove and make non-static
|
84
|
+
|
85
|
+
/*!
|
86
|
+
* Returns the size of the frame header for the given ID3v2 version.
|
87
|
+
*
|
88
|
+
* \deprecated Please see the explanation above.
|
89
|
+
*/
|
90
|
+
static uint headerSize(uint version); // BIC: remove and make non-static
|
91
|
+
|
92
|
+
/*!
|
93
|
+
* Sets the data that will be used as the frame. Since the length is not
|
94
|
+
* known before the frame has been parsed, this should just be a pointer to
|
95
|
+
* the first byte of the frame. It will determine the length internally
|
96
|
+
* and make that available through size().
|
97
|
+
*/
|
98
|
+
void setData(const ByteVector &data);
|
99
|
+
|
100
|
+
/*!
|
101
|
+
* Set the text of frame in the sanest way possible. This should only be
|
102
|
+
* reimplemented in frames where there is some logical mapping to text.
|
103
|
+
*
|
104
|
+
* \note If the frame type supports multiple text encodings, this will not
|
105
|
+
* change the text encoding of the frame; the string will be converted to
|
106
|
+
* that frame's encoding. Please use the specific APIs of the frame types
|
107
|
+
* to set the encoding if that is desired.
|
108
|
+
*/
|
109
|
+
virtual void setText(const String &text);
|
110
|
+
|
111
|
+
/*!
|
112
|
+
* This returns the textual representation of the data in the frame.
|
113
|
+
* Subclasses must reimplement this method to provide a string
|
114
|
+
* representation of the frame's data.
|
115
|
+
*/
|
116
|
+
virtual String toString() const = 0;
|
117
|
+
|
118
|
+
/*!
|
119
|
+
* Render the frame back to its binary format in a ByteVector.
|
120
|
+
*/
|
121
|
+
ByteVector render() const;
|
122
|
+
|
123
|
+
/*!
|
124
|
+
* Returns the text delimiter that is used between fields for the string
|
125
|
+
* type \a t.
|
126
|
+
*/
|
127
|
+
static ByteVector textDelimiter(String::Type t);
|
128
|
+
|
129
|
+
protected:
|
130
|
+
class Header;
|
131
|
+
|
132
|
+
/*!
|
133
|
+
* Constructs an ID3v2 frame using \a data to read the header information.
|
134
|
+
* All other processing of \a data should be handled in a subclass.
|
135
|
+
*
|
136
|
+
* \note This need not contain anything more than a frame ID, but
|
137
|
+
* \e must constain at least that.
|
138
|
+
*/
|
139
|
+
explicit Frame(const ByteVector &data);
|
140
|
+
|
141
|
+
/*!
|
142
|
+
* This creates an Frame using the header \a h.
|
143
|
+
*
|
144
|
+
* The ownership of this header will be assigned to the frame and the
|
145
|
+
* header will be deleted when the frame is destroyed.
|
146
|
+
*/
|
147
|
+
Frame(Header *h);
|
148
|
+
|
149
|
+
/*!
|
150
|
+
* Returns a pointer to the frame header.
|
151
|
+
*/
|
152
|
+
Header *header() const;
|
153
|
+
|
154
|
+
/*!
|
155
|
+
* Sets the header to \a h. If \a deleteCurrent is true, this will free
|
156
|
+
* the memory of the current header.
|
157
|
+
*
|
158
|
+
* The ownership of this header will be assigned to the frame and the
|
159
|
+
* header will be deleted when the frame is destroyed.
|
160
|
+
*/
|
161
|
+
void setHeader(Header *h, bool deleteCurrent = true);
|
162
|
+
|
163
|
+
/*!
|
164
|
+
* Called by setData() to parse the frame data. It makes this information
|
165
|
+
* available through the public API.
|
166
|
+
*/
|
167
|
+
void parse(const ByteVector &data);
|
168
|
+
|
169
|
+
/*!
|
170
|
+
* Called by parse() to parse the field data. It makes this information
|
171
|
+
* available through the public API. This must be overridden by the
|
172
|
+
* subclasses.
|
173
|
+
*/
|
174
|
+
virtual void parseFields(const ByteVector &data) = 0;
|
175
|
+
|
176
|
+
/*!
|
177
|
+
* Render the field data back to a binary format in a ByteVector. This
|
178
|
+
* must be overridden by subclasses.
|
179
|
+
*/
|
180
|
+
virtual ByteVector renderFields() const = 0;
|
181
|
+
|
182
|
+
/*!
|
183
|
+
* Returns a ByteVector containing the field data given the frame data.
|
184
|
+
* This correctly adjusts for the header size plus any additional frame
|
185
|
+
* data that's specified in the frame header flags.
|
186
|
+
*/
|
187
|
+
ByteVector fieldData(const ByteVector &frameData) const;
|
188
|
+
|
189
|
+
/*!
|
190
|
+
* Reads a String of type \a encodiong from the ByteVector \a data. If \a
|
191
|
+
* position is passed in it is used both as the starting point and is
|
192
|
+
* updated to replect the position just after the string that has been read.
|
193
|
+
* This is useful for reading strings sequentially.
|
194
|
+
*/
|
195
|
+
String readStringField(const ByteVector &data, String::Type encoding,
|
196
|
+
int *positon = 0);
|
197
|
+
|
198
|
+
/*!
|
199
|
+
* Checks a the list of string values to see if they can be used with the
|
200
|
+
* specified encoding and returns the recommended encoding.
|
201
|
+
*/
|
202
|
+
static String::Type checkEncoding(const StringList &fields,
|
203
|
+
String::Type encoding);
|
204
|
+
|
205
|
+
private:
|
206
|
+
Frame(const Frame &);
|
207
|
+
Frame &operator=(const Frame &);
|
208
|
+
|
209
|
+
class FramePrivate;
|
210
|
+
friend class FramePrivate;
|
211
|
+
FramePrivate *d;
|
212
|
+
};
|
213
|
+
|
214
|
+
//! ID3v2 frame header implementation
|
215
|
+
|
216
|
+
/*!
|
217
|
+
* The ID3v2 Frame Header (Structure, <a href="id3v2-structure.html#4">4</a>)
|
218
|
+
*
|
219
|
+
* Every ID3v2::Frame has an associated header that gives some general
|
220
|
+
* properties of the frame and also makes it possible to identify the frame
|
221
|
+
* type.
|
222
|
+
*
|
223
|
+
* As such when reading an ID3v2 tag ID3v2::FrameFactory first creates the
|
224
|
+
* frame headers and then creates the appropriate Frame subclass based on
|
225
|
+
* the type and attaches the header.
|
226
|
+
*/
|
227
|
+
|
228
|
+
class TAGLIB_EXPORT Frame::Header
|
229
|
+
{
|
230
|
+
public:
|
231
|
+
/*!
|
232
|
+
* Construct a Frame Header based on \a data. \a data must at least
|
233
|
+
* contain a 4 byte frame ID, and optionally can contain flag data and the
|
234
|
+
* frame size. i.e. Just the frame id -- "TALB" -- is a valid value.
|
235
|
+
*
|
236
|
+
* \deprecated Please use the constructor below that accepts a version
|
237
|
+
* number.
|
238
|
+
*/
|
239
|
+
Header(const ByteVector &data, bool synchSafeInts);
|
240
|
+
|
241
|
+
/*!
|
242
|
+
* Construct a Frame Header based on \a data. \a data must at least
|
243
|
+
* contain a 4 byte frame ID, and optionally can contain flag data and the
|
244
|
+
* frame size. i.e. Just the frame id -- "TALB" -- is a valid value.
|
245
|
+
*
|
246
|
+
* \a version should be the ID3v2 version of the tag.
|
247
|
+
*/
|
248
|
+
explicit Header(const ByteVector &data, uint version = 4);
|
249
|
+
|
250
|
+
/*!
|
251
|
+
* Destroys this Header instance.
|
252
|
+
*/
|
253
|
+
virtual ~Header();
|
254
|
+
|
255
|
+
/*!
|
256
|
+
* Sets the data for the Header.
|
257
|
+
*
|
258
|
+
* \deprecated Please use the version below that accepts an ID3v2 version
|
259
|
+
* number.
|
260
|
+
*/
|
261
|
+
void setData(const ByteVector &data, bool synchSafeInts);
|
262
|
+
|
263
|
+
/*!
|
264
|
+
* Sets the data for the Header. \a version should indicate the ID3v2
|
265
|
+
* version number of the tag that this frame is contained in.
|
266
|
+
*/
|
267
|
+
void setData(const ByteVector &data, uint version = 4);
|
268
|
+
|
269
|
+
/*!
|
270
|
+
* Returns the Frame ID (Structure, <a href="id3v2-structure.html#4">4</a>)
|
271
|
+
* (Frames, <a href="id3v2-frames.html#4">4</a>)
|
272
|
+
*/
|
273
|
+
ByteVector frameID() const;
|
274
|
+
|
275
|
+
/*!
|
276
|
+
* Sets the frame's ID to \a id. Only the first four bytes of \a id will
|
277
|
+
* be used.
|
278
|
+
*
|
279
|
+
* \warning This method should in general be avoided. It exists simply to
|
280
|
+
* provide a mechanism for transforming frames from a deprecated frame type
|
281
|
+
* to a newer one -- i.e. TYER to TDRC from ID3v2.3 to ID3v2.4.
|
282
|
+
*/
|
283
|
+
void setFrameID(const ByteVector &id);
|
284
|
+
|
285
|
+
/*!
|
286
|
+
* Returns the size of the frame data portion, as set when setData() was
|
287
|
+
* called or set explicitly via setFrameSize().
|
288
|
+
*/
|
289
|
+
uint frameSize() const;
|
290
|
+
|
291
|
+
/*!
|
292
|
+
* Sets the size of the frame data portion.
|
293
|
+
*/
|
294
|
+
void setFrameSize(uint size);
|
295
|
+
|
296
|
+
/*!
|
297
|
+
* Returns the ID3v2 version of the header (as passed in from the
|
298
|
+
* construction of the header).
|
299
|
+
*/
|
300
|
+
uint version() const;
|
301
|
+
|
302
|
+
/*!
|
303
|
+
* Returns the size of the frame header in bytes.
|
304
|
+
*
|
305
|
+
* \deprecated Please use the version of this method that accepts a
|
306
|
+
* version. This is only accurate for ID3v2.3 and ID3v2.4. This will be
|
307
|
+
* removed in the next binary incompatible release (2.0) and will be
|
308
|
+
* replaced with a non-static method that checks the frame version.
|
309
|
+
*/
|
310
|
+
static uint size();
|
311
|
+
|
312
|
+
/*!
|
313
|
+
* Returns the size of the frame header in bytes for the ID3v2 version
|
314
|
+
* that's given.
|
315
|
+
*
|
316
|
+
* \deprecated Please see the explanation in the version above.
|
317
|
+
*/
|
318
|
+
static uint size(uint version);
|
319
|
+
|
320
|
+
/*!
|
321
|
+
* Returns true if the flag for tag alter preservation is set.
|
322
|
+
*
|
323
|
+
* The semantics are a little backwards from what would seem natural
|
324
|
+
* (setting the preservation flag to throw away the frame), but this
|
325
|
+
* follows the ID3v2 standard.
|
326
|
+
*
|
327
|
+
* \see setTagAlterPreservation()
|
328
|
+
*/
|
329
|
+
bool tagAlterPreservation() const;
|
330
|
+
|
331
|
+
/*!
|
332
|
+
* Sets the flag for preservation of this frame if the tag is set. If
|
333
|
+
* this is set to true the frame will not be written when the tag is
|
334
|
+
* saved.
|
335
|
+
*
|
336
|
+
* The semantics are a little backwards from what would seem natural
|
337
|
+
* (setting the preservation flag to throw away the frame), but this
|
338
|
+
* follows the ID3v2 standard.
|
339
|
+
*
|
340
|
+
* \see tagAlterPreservation()
|
341
|
+
*/
|
342
|
+
void setTagAlterPreservation(bool discard);
|
343
|
+
|
344
|
+
/*!
|
345
|
+
* Returns true if the flag for file alter preservation is set.
|
346
|
+
*
|
347
|
+
* \note This flag is currently ignored internally in TagLib.
|
348
|
+
*/
|
349
|
+
bool fileAlterPreservation() const;
|
350
|
+
|
351
|
+
/*!
|
352
|
+
* Returns true if the frame is meant to be read only.
|
353
|
+
*
|
354
|
+
* \note This flag is currently ignored internally in TagLib.
|
355
|
+
*/
|
356
|
+
bool readOnly() const;
|
357
|
+
|
358
|
+
/*!
|
359
|
+
* Returns true if the flag for the grouping identifity is set.
|
360
|
+
*
|
361
|
+
* \note This flag is currently ignored internally in TagLib.
|
362
|
+
*/
|
363
|
+
bool groupingIdentity() const;
|
364
|
+
|
365
|
+
/*!
|
366
|
+
* Returns true if compression is enabled for this frame.
|
367
|
+
*
|
368
|
+
* \note This flag is currently ignored internally in TagLib.
|
369
|
+
*/
|
370
|
+
bool compression() const;
|
371
|
+
|
372
|
+
/*!
|
373
|
+
* Returns true if encryption is enabled for this frame.
|
374
|
+
*
|
375
|
+
* \note This flag is currently ignored internally in TagLib.
|
376
|
+
*/
|
377
|
+
bool encryption() const;
|
378
|
+
|
379
|
+
#ifndef DO_NOT_DOCUMENT
|
380
|
+
bool unsycronisation() const;
|
381
|
+
#endif
|
382
|
+
|
383
|
+
/*!
|
384
|
+
* Returns true if unsynchronisation is enabled for this frame.
|
385
|
+
*/
|
386
|
+
bool unsynchronisation() const;
|
387
|
+
|
388
|
+
/*!
|
389
|
+
* Returns true if the flag for a data length indicator is set.
|
390
|
+
*/
|
391
|
+
bool dataLengthIndicator() const;
|
392
|
+
|
393
|
+
/*!
|
394
|
+
* Render the Header back to binary format in a ByteVector.
|
395
|
+
*/
|
396
|
+
ByteVector render() const;
|
397
|
+
|
398
|
+
/*!
|
399
|
+
* \deprecated
|
400
|
+
*/
|
401
|
+
bool frameAlterPreservation() const;
|
402
|
+
|
403
|
+
private:
|
404
|
+
Header(const Header &);
|
405
|
+
Header &operator=(const Header &);
|
406
|
+
|
407
|
+
class HeaderPrivate;
|
408
|
+
HeaderPrivate *d;
|
409
|
+
};
|
410
|
+
|
411
|
+
}
|
412
|
+
}
|
413
|
+
|
414
|
+
#endif
|