rtaglib 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +84 -9
  3. data/README.txt +0 -0
  4. data/Rakefile +30 -27
  5. data/{test/data → data}/440Hz-5sec.flac +0 -0
  6. data/{test/data → data}/440Hz-5sec.mp3 +0 -0
  7. data/{test/data → data}/440Hz-5sec.mpc +0 -0
  8. data/{test/data → data}/440Hz-5sec.ogg +0 -0
  9. data/{test/data → data}/440Hz-5sec.wv +0 -0
  10. data/data/test_jason.mp3 +0 -0
  11. data/data/test_jason.ogg +0 -0
  12. data/ext/Rakefile +10 -0
  13. data/ext/tagfile/Rakefile.rb +42 -0
  14. data/ext/tagfile/rake_ext_conf.rb +29 -0
  15. data/ext/tagfile/tagfile.c +11 -7
  16. data/ext/taglib/Rakefile.rb +48 -0
  17. data/ext/taglib/rake_ext_conf.rb +33 -0
  18. data/ext/taglib/taglib-mswin32/bin/tag.dll +0 -0
  19. data/ext/taglib/taglib-mswin32/bin/tag_c.dll +0 -0
  20. data/ext/taglib/taglib-mswin32/bin/tag_cd.dll +0 -0
  21. data/ext/taglib/taglib-mswin32/bin/tagd.dll +0 -0
  22. data/ext/taglib/taglib-mswin32/bin/taglib-config +55 -0
  23. data/ext/taglib/taglib-mswin32/include/taglib/apefooter.h +173 -0
  24. data/ext/taglib/taglib-mswin32/include/taglib/apeitem.h +204 -0
  25. data/ext/taglib/taglib-mswin32/include/taglib/apetag.h +162 -0
  26. data/ext/taglib/taglib-mswin32/include/taglib/attachedpictureframe.h +220 -0
  27. data/ext/taglib/taglib-mswin32/include/taglib/audioproperties.h +110 -0
  28. data/ext/taglib/taglib-mswin32/include/taglib/commentsframe.h +168 -0
  29. data/ext/taglib/taglib-mswin32/include/taglib/fileref.h +262 -0
  30. data/ext/taglib/taglib-mswin32/include/taglib/flacfile.h +201 -0
  31. data/ext/taglib/taglib-mswin32/include/taglib/flacproperties.h +92 -0
  32. data/ext/taglib/taglib-mswin32/include/taglib/generalencapsulatedobjectframe.h +174 -0
  33. data/ext/taglib/taglib-mswin32/include/taglib/id3v1genres.h +66 -0
  34. data/ext/taglib/taglib-mswin32/include/taglib/id3v1tag.h +180 -0
  35. data/ext/taglib/taglib-mswin32/include/taglib/id3v2extendedheader.h +93 -0
  36. data/ext/taglib/taglib-mswin32/include/taglib/id3v2footer.h +82 -0
  37. data/ext/taglib/taglib-mswin32/include/taglib/id3v2frame.h +414 -0
  38. data/ext/taglib/taglib-mswin32/include/taglib/id3v2framefactory.h +167 -0
  39. data/ext/taglib/taglib-mswin32/include/taglib/id3v2header.h +175 -0
  40. data/ext/taglib/taglib-mswin32/include/taglib/id3v2synchdata.h +70 -0
  41. data/ext/taglib/taglib-mswin32/include/taglib/id3v2tag.h +300 -0
  42. data/ext/taglib/taglib-mswin32/include/taglib/mpcfile.h +175 -0
  43. data/ext/taglib/taglib-mswin32/include/taglib/mpcproperties.h +85 -0
  44. data/ext/taglib/taglib-mswin32/include/taglib/mpegfile.h +277 -0
  45. data/ext/taglib/taglib-mswin32/include/taglib/mpegheader.h +166 -0
  46. data/ext/taglib/taglib-mswin32/include/taglib/mpegproperties.h +118 -0
  47. data/ext/taglib/taglib-mswin32/include/taglib/oggfile.h +112 -0
  48. data/ext/taglib/taglib-mswin32/include/taglib/oggflacfile.h +118 -0
  49. data/ext/taglib/taglib-mswin32/include/taglib/oggpage.h +203 -0
  50. data/ext/taglib/taglib-mswin32/include/taglib/oggpageheader.h +232 -0
  51. data/ext/taglib/taglib-mswin32/include/taglib/relativevolumeframe.h +274 -0
  52. data/ext/taglib/taglib-mswin32/include/taglib/speexfile.h +99 -0
  53. data/ext/taglib/taglib-mswin32/include/taglib/speexproperties.h +89 -0
  54. data/ext/taglib/taglib-mswin32/include/taglib/tag.h +173 -0
  55. data/ext/taglib/taglib-mswin32/include/taglib/tag_c.h +288 -0
  56. data/ext/taglib/taglib-mswin32/include/taglib/taglib.h +177 -0
  57. data/ext/taglib/taglib-mswin32/include/taglib/taglib_export.h +39 -0
  58. data/ext/taglib/taglib-mswin32/include/taglib/tbytevector.h +409 -0
  59. data/ext/taglib/taglib-mswin32/include/taglib/tbytevectorlist.h +91 -0
  60. data/ext/taglib/taglib-mswin32/include/taglib/textidentificationframe.h +258 -0
  61. data/ext/taglib/taglib-mswin32/include/taglib/tfile.h +271 -0
  62. data/ext/taglib/taglib-mswin32/include/taglib/tlist.h +252 -0
  63. data/ext/taglib/taglib-mswin32/include/taglib/tlist.tcc +316 -0
  64. data/ext/taglib/taglib-mswin32/include/taglib/tmap.h +200 -0
  65. data/ext/taglib/taglib-mswin32/include/taglib/tmap.tcc +196 -0
  66. data/ext/taglib/taglib-mswin32/include/taglib/trueaudiofile.h +180 -0
  67. data/ext/taglib/taglib-mswin32/include/taglib/trueaudioproperties.h +93 -0
  68. data/ext/taglib/taglib-mswin32/include/taglib/tstring.h +456 -0
  69. data/ext/taglib/taglib-mswin32/include/taglib/tstringlist.h +115 -0
  70. data/ext/taglib/taglib-mswin32/include/taglib/uniquefileidentifierframe.h +113 -0
  71. data/ext/taglib/taglib-mswin32/include/taglib/unknownframe.h +79 -0
  72. data/ext/taglib/taglib-mswin32/include/taglib/unsynchronizedlyricsframe.h +157 -0
  73. data/ext/taglib/taglib-mswin32/include/taglib/urllinkframe.h +172 -0
  74. data/ext/taglib/taglib-mswin32/include/taglib/vorbisfile.h +118 -0
  75. data/ext/taglib/taglib-mswin32/include/taglib/vorbisproperties.h +125 -0
  76. data/ext/taglib/taglib-mswin32/include/taglib/wavpackfile.h +164 -0
  77. data/ext/taglib/taglib-mswin32/include/taglib/wavpackproperties.h +94 -0
  78. data/ext/taglib/taglib-mswin32/include/taglib/xingheader.h +100 -0
  79. data/ext/taglib/taglib-mswin32/include/taglib/xiphcomment.h +202 -0
  80. data/ext/taglib/taglib-mswin32/lib/pkgconfig/taglib_c.pc +12 -0
  81. data/ext/taglib/taglib-mswin32/lib/tag.lib +0 -0
  82. data/ext/taglib/taglib-mswin32/lib/tag_c.lib +0 -0
  83. data/ext/taglib/taglib_i386-mingw32.source +22645 -0
  84. data/ext/taglib/taglib_i386-mswin32.source +22645 -0
  85. data/ext/taglib/{taglib.cxx → taglib_x86_64-linux.source} +508 -75
  86. data/lib/TagLib.rb +3 -2
  87. data/lib/TagLib_doc.rb +1532 -1526
  88. data/lib/rtaglib_mswin32.rb +4 -0
  89. data/lib/tagfile.rb +6 -0
  90. data/swig/Doxyfile +0 -0
  91. data/swig/Rakefile +44 -19
  92. data/swig/TagLib_doc.rb +2755 -0
  93. data/swig/make_doc.rb +5 -4
  94. data/swig/process_cxx.rb +2 -2
  95. data/swig/rake_ext_conf.rb +33 -0
  96. data/swig/taglib.i +8 -5
  97. data/swig/test.rb +47 -39
  98. data/test/test_read.rb +4 -3
  99. data/test/test_taglib.rb +47 -39
  100. data/test/test_write.rb +4 -3
  101. metadata +96 -20
  102. data/ext/tagfile/extconf.rb +0 -14
  103. data/ext/taglib/extconf.rb +0 -22
  104. data/swig/extconf.rb +0 -22
@@ -0,0 +1,175 @@
1
+ /***************************************************************************
2
+ copyright : (C) 2004 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_MPCFILE_H
27
+ #define TAGLIB_MPCFILE_H
28
+
29
+ #include "taglib_export.h"
30
+ #include "tfile.h"
31
+
32
+ #include "mpcproperties.h"
33
+
34
+ namespace TagLib {
35
+
36
+ class Tag;
37
+
38
+ namespace ID3v1 { class Tag; }
39
+ namespace APE { class Tag; }
40
+
41
+ //! An implementation of MPC metadata
42
+
43
+ /*!
44
+ * This is implementation of MPC metadata.
45
+ *
46
+ * This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
47
+ * properties from the file. ID3v2 tags are invalid in MPC-files, but will be skipped
48
+ * and ignored.
49
+ */
50
+
51
+ namespace MPC {
52
+
53
+ //! An implementation of TagLib::File with MPC specific methods
54
+
55
+ /*!
56
+ * This implements and provides an interface for MPC files to the
57
+ * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
58
+ * the abstract TagLib::File API as well as providing some additional
59
+ * information specific to MPC files.
60
+ * The only invalid tag combination supported is an ID3v1 tag after an APE tag.
61
+ */
62
+
63
+ class TAGLIB_EXPORT File : public TagLib::File
64
+ {
65
+ public:
66
+ /*!
67
+ * This set of flags is used for various operations and is suitable for
68
+ * being OR-ed together.
69
+ */
70
+ enum TagTypes {
71
+ //! Empty set. Matches no tag types.
72
+ NoTags = 0x0000,
73
+ //! Matches ID3v1 tags.
74
+ ID3v1 = 0x0001,
75
+ //! Matches ID3v2 tags.
76
+ ID3v2 = 0x0002,
77
+ //! Matches APE tags.
78
+ APE = 0x0004,
79
+ //! Matches all tag types.
80
+ AllTags = 0xffff
81
+ };
82
+
83
+ /*!
84
+ * Contructs an MPC file from \a file. If \a readProperties is true the
85
+ * file's audio properties will also be read using \a propertiesStyle. If
86
+ * false, \a propertiesStyle is ignored.
87
+ */
88
+ File(FileName file, bool readProperties = true,
89
+ Properties::ReadStyle propertiesStyle = Properties::Average);
90
+
91
+ /*!
92
+ * Destroys this instance of the File.
93
+ */
94
+ virtual ~File();
95
+
96
+ /*!
97
+ * Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
98
+ * or a combination of the two.
99
+ */
100
+ virtual TagLib::Tag *tag() const;
101
+
102
+ /*!
103
+ * Returns the MPC::Properties for this file. If no audio properties
104
+ * were read then this will return a null pointer.
105
+ */
106
+ virtual Properties *audioProperties() const;
107
+
108
+ /*!
109
+ * Saves the file.
110
+ */
111
+ virtual bool save();
112
+
113
+ /*!
114
+ * Returns a pointer to the ID3v1 tag of the file.
115
+ *
116
+ * If \a create is false (the default) this will return a null pointer
117
+ * if there is no valid ID3v1 tag. If \a create is true it will create
118
+ * an ID3v1 tag if one does not exist. If there is already an APE tag, the
119
+ * new ID3v1 tag will be placed after it.
120
+ *
121
+ * \note The Tag <b>is still</b> owned by the APE::File and should not be
122
+ * deleted by the user. It will be deleted when the file (object) is
123
+ * destroyed.
124
+ */
125
+ ID3v1::Tag *ID3v1Tag(bool create = false);
126
+
127
+ /*!
128
+ * Returns a pointer to the APE tag of the file.
129
+ *
130
+ * If \a create is false (the default) this will return a null pointer
131
+ * if there is no valid APE tag. If \a create is true it will create
132
+ * a APE tag if one does not exist. If there is already an ID3v1 tag, thes
133
+ * new APE tag will be placed before it.
134
+ *
135
+ * \note The Tag <b>is still</b> owned by the APE::File and should not be
136
+ * deleted by the user. It will be deleted when the file (object) is
137
+ * destroyed.
138
+ */
139
+ APE::Tag *APETag(bool create = false);
140
+
141
+ /*!
142
+ * This will remove the tags that match the OR-ed together TagTypes from the
143
+ * file. By default it removes all tags.
144
+ *
145
+ * \warning This will also invalidate pointers to the tags
146
+ * as their memory will be freed.
147
+ *
148
+ * \note In order to make the removal permanent save() still needs to be called.
149
+ */
150
+ void strip(int tags = AllTags);
151
+
152
+ /*!
153
+ * \deprecated
154
+ * \see strip
155
+ */
156
+ void remove(int tags = AllTags);
157
+
158
+
159
+ private:
160
+ File(const File &);
161
+ File &operator=(const File &);
162
+
163
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
164
+ void scan();
165
+ long findAPE();
166
+ long findID3v1();
167
+ long findID3v2();
168
+
169
+ class FilePrivate;
170
+ FilePrivate *d;
171
+ };
172
+ }
173
+ }
174
+
175
+ #endif
@@ -0,0 +1,85 @@
1
+ /***************************************************************************
2
+ copyright : (C) 2004 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_MPCPROPERTIES_H
27
+ #define TAGLIB_MPCPROPERTIES_H
28
+
29
+ #include "taglib_export.h"
30
+ #include "audioproperties.h"
31
+
32
+ namespace TagLib {
33
+
34
+ namespace MPC {
35
+
36
+ class File;
37
+
38
+ static const uint HeaderSize = 8*7;
39
+
40
+ //! An implementation of audio property reading for MPC
41
+
42
+ /*!
43
+ * This reads the data from an MPC stream found in the AudioProperties
44
+ * API.
45
+ */
46
+
47
+ class TAGLIB_EXPORT Properties : public AudioProperties
48
+ {
49
+ public:
50
+ /*!
51
+ * Create an instance of MPC::Properties with the data read from the
52
+ * ByteVector \a data.
53
+ */
54
+ Properties(const ByteVector &data, long streamLength, ReadStyle style = Average);
55
+
56
+ /*!
57
+ * Destroys this MPC::Properties instance.
58
+ */
59
+ virtual ~Properties();
60
+
61
+ // Reimplementations.
62
+
63
+ virtual int length() const;
64
+ virtual int bitrate() const;
65
+ virtual int sampleRate() const;
66
+ virtual int channels() const;
67
+
68
+ /*!
69
+ * Returns the version of the bitstream (SV4-SV7)
70
+ */
71
+ int mpcVersion() const;
72
+
73
+ private:
74
+ Properties(const Properties &);
75
+ Properties &operator=(const Properties &);
76
+
77
+ void read();
78
+
79
+ class PropertiesPrivate;
80
+ PropertiesPrivate *d;
81
+ };
82
+ }
83
+ }
84
+
85
+ #endif
@@ -0,0 +1,277 @@
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_MPEGFILE_H
27
+ #define TAGLIB_MPEGFILE_H
28
+
29
+ #include "taglib_export.h"
30
+ #include "tfile.h"
31
+
32
+ #include "mpegproperties.h"
33
+
34
+ namespace TagLib {
35
+
36
+ namespace ID3v2 { class Tag; class FrameFactory; }
37
+ namespace ID3v1 { class Tag; }
38
+ namespace APE { class Tag; }
39
+
40
+ //! An implementation of TagLib::File with MPEG (MP3) specific methods
41
+
42
+ namespace MPEG {
43
+
44
+ //! An MPEG file class with some useful methods specific to MPEG
45
+
46
+ /*!
47
+ * This implements the generic TagLib::File API and additionally provides
48
+ * access to properties that are distinct to MPEG files, notably access
49
+ * to the different ID3 tags.
50
+ */
51
+
52
+ class TAGLIB_EXPORT File : public TagLib::File
53
+ {
54
+ public:
55
+ /*!
56
+ * This set of flags is used for various operations and is suitable for
57
+ * being OR-ed together.
58
+ */
59
+ enum TagTypes {
60
+ //! Empty set. Matches no tag types.
61
+ NoTags = 0x0000,
62
+ //! Matches ID3v1 tags.
63
+ ID3v1 = 0x0001,
64
+ //! Matches ID3v2 tags.
65
+ ID3v2 = 0x0002,
66
+ //! Matches APE tags.
67
+ APE = 0x0004,
68
+ //! Matches all tag types.
69
+ AllTags = 0xffff
70
+ };
71
+
72
+ /*!
73
+ * Contructs an MPEG file from \a file. If \a readProperties is true the
74
+ * file's audio properties will also be read using \a propertiesStyle. If
75
+ * false, \a propertiesStyle is ignored.
76
+ *
77
+ * \deprecated This constructor will be dropped in favor of the one below
78
+ * in a future version.
79
+ */
80
+ File(FileName file, bool readProperties = true,
81
+ Properties::ReadStyle propertiesStyle = Properties::Average);
82
+
83
+ /*!
84
+ * Contructs an MPEG file from \a file. If \a readProperties is true the
85
+ * file's audio properties will also be read using \a propertiesStyle. If
86
+ * false, \a propertiesStyle is ignored. The frames will be created using
87
+ * \a frameFactory.
88
+ */
89
+ // BIC: merge with the above constructor
90
+ File(FileName file, ID3v2::FrameFactory *frameFactory,
91
+ bool readProperties = true,
92
+ Properties::ReadStyle propertiesStyle = Properties::Average);
93
+
94
+ /*!
95
+ * Destroys this instance of the File.
96
+ */
97
+ virtual ~File();
98
+
99
+ /*!
100
+ * Returns a pointer to a tag that is the union of the ID3v2 and ID3v1
101
+ * tags. The ID3v2 tag is given priority in reading the information -- if
102
+ * requested information exists in both the ID3v2 tag and the ID3v1 tag,
103
+ * the information from the ID3v2 tag will be returned.
104
+ *
105
+ * If you would like more granular control over the content of the tags,
106
+ * with the concession of generality, use the tag-type specific calls.
107
+ *
108
+ * \note As this tag is not implemented as an ID3v2 tag or an ID3v1 tag,
109
+ * but a union of the two this pointer may not be cast to the specific
110
+ * tag types.
111
+ *
112
+ * \see ID3v1Tag()
113
+ * \see ID3v2Tag()
114
+ * \see APETag()
115
+ */
116
+ virtual Tag *tag() const;
117
+
118
+ /*!
119
+ * Returns the MPEG::Properties for this file. If no audio properties
120
+ * were read then this will return a null pointer.
121
+ */
122
+ virtual Properties *audioProperties() const;
123
+
124
+ /*!
125
+ * Save the file. If at least one tag -- ID3v1 or ID3v2 -- exists this
126
+ * will duplicate its content into the other tag. This returns true
127
+ * if saving was successful.
128
+ *
129
+ * If neither exists or if both tags are empty, this will strip the tags
130
+ * from the file.
131
+ *
132
+ * This is the same as calling save(AllTags);
133
+ *
134
+ * If you would like more granular control over the content of the tags,
135
+ * with the concession of generality, use paramaterized save call below.
136
+ *
137
+ * \see save(int tags)
138
+ */
139
+ virtual bool save();
140
+
141
+ /*!
142
+ * Save the file. This will attempt to save all of the tag types that are
143
+ * specified by OR-ing together TagTypes values. The save() method above
144
+ * uses AllTags. This returns true if saving was successful.
145
+ *
146
+ * This strips all tags not included in the mask, but does not modify them
147
+ * in memory, so later calls to save() which make use of these tags will
148
+ * remain valid. This also strips empty tags.
149
+ */
150
+ bool save(int tags);
151
+
152
+ /*!
153
+ * Save the file. This will attempt to save all of the tag types that are
154
+ * specified by OR-ing together TagTypes values. The save() method above
155
+ * uses AllTags. This returns true if saving was successful.
156
+ *
157
+ * If \a stripOthers is true this strips all tags not included in the mask,
158
+ * but does not modify them in memory, so later calls to save() which make
159
+ * use of these tags will remain valid. This also strips empty tags.
160
+ */
161
+ // BIC: combine with the above method
162
+ bool save(int tags, bool stripOthers);
163
+
164
+ /*!
165
+ * Returns a pointer to the ID3v2 tag of the file.
166
+ *
167
+ * If \a create is false (the default) this will return a null pointer
168
+ * if there is no valid ID3v2 tag. If \a create is true it will create
169
+ * an ID3v2 tag if one does not exist.
170
+ *
171
+ * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
172
+ * deleted by the user. It will be deleted when the file (object) is
173
+ * destroyed.
174
+ */
175
+ ID3v2::Tag *ID3v2Tag(bool create = false);
176
+
177
+ /*!
178
+ * Returns a pointer to the ID3v1 tag of the file.
179
+ *
180
+ * If \a create is false (the default) this will return a null pointer
181
+ * if there is no valid ID3v1 tag. If \a create is true it will create
182
+ * an ID3v1 tag if one does not exist.
183
+ *
184
+ * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
185
+ * deleted by the user. It will be deleted when the file (object) is
186
+ * destroyed.
187
+ */
188
+ ID3v1::Tag *ID3v1Tag(bool create = false);
189
+
190
+ /*!
191
+ * Returns a pointer to the APE tag of the file.
192
+ *
193
+ * If \a create is false (the default) this will return a null pointer
194
+ * if there is no valid APE tag. If \a create is true it will create
195
+ * an APE tag if one does not exist.
196
+ *
197
+ * \note The Tag <b>is still</b> owned by the MPEG::File and should not be
198
+ * deleted by the user. It will be deleted when the file (object) is
199
+ * destroyed.
200
+ */
201
+ APE::Tag *APETag(bool create = false);
202
+
203
+ /*!
204
+ * This will strip the tags that match the OR-ed together TagTypes from the
205
+ * file. By default it strips all tags. It returns true if the tags are
206
+ * successfully stripped.
207
+ *
208
+ * This is equivalent to strip(tags, true)
209
+ *
210
+ * \note This will also invalidate pointers to the ID3 and APE tags
211
+ * as their memory will be freed.
212
+ */
213
+ bool strip(int tags = AllTags);
214
+
215
+ /*!
216
+ * This will strip the tags that match the OR-ed together TagTypes from the
217
+ * file. By default it strips all tags. It returns true if the tags are
218
+ * successfully stripped.
219
+ *
220
+ * If \a freeMemory is true the ID3 and APE tags will be deleted and
221
+ * pointers to them will be invalidated.
222
+ */
223
+ // BIC: merge with the method above
224
+ bool strip(int tags, bool freeMemory);
225
+
226
+ /*!
227
+ * Set the ID3v2::FrameFactory to something other than the default.
228
+ *
229
+ * \see ID3v2FrameFactory
230
+ */
231
+ void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
232
+
233
+ /*!
234
+ * Returns the position in the file of the first MPEG frame.
235
+ */
236
+ long firstFrameOffset();
237
+
238
+ /*!
239
+ * Returns the position in the file of the next MPEG frame,
240
+ * using the current position as start
241
+ */
242
+ long nextFrameOffset(long position);
243
+
244
+ /*!
245
+ * Returns the position in the file of the previous MPEG frame,
246
+ * using the current position as start
247
+ */
248
+ long previousFrameOffset(long position);
249
+
250
+ /*!
251
+ * Returns the position in the file of the last MPEG frame.
252
+ */
253
+ long lastFrameOffset();
254
+
255
+ private:
256
+ File(const File &);
257
+ File &operator=(const File &);
258
+
259
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
260
+ long findID3v2();
261
+ long findID3v1();
262
+ void findAPE();
263
+
264
+ /*!
265
+ * MPEG frames can be recognized by the bit pattern 11111111 111, so the
266
+ * first byte is easy to check for, however checking to see if the second byte
267
+ * starts with \e 111 is a bit more tricky, hence this member function.
268
+ */
269
+ static bool secondSynchByte(char byte);
270
+
271
+ class FilePrivate;
272
+ FilePrivate *d;
273
+ };
274
+ }
275
+ }
276
+
277
+ #endif