mpegfile.h
Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, Boston, MA *
19  * 02110-1301 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 
41 
42  namespace MPEG {
43 
45 
53  {
54  public:
59  enum TagTypes {
61  NoTags = 0x0000,
63  ID3v1 = 0x0001,
65  ID3v2 = 0x0002,
67  APE = 0x0004,
69  AllTags = 0xffff
70  };
71 
80  File(FileName file, bool readProperties = true,
81  Properties::ReadStyle propertiesStyle = Properties::Average);
82 
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 
97  virtual ~File();
98 
116  virtual Tag *tag() const;
117 
122  virtual Properties *audioProperties() const;
123 
139  virtual bool save();
140 
150  bool save(int tags);
151 
161  // BIC: combine with the above method
162  bool save(int tags, bool stripOthers);
163 
175  ID3v2::Tag *ID3v2Tag(bool create = false);
176 
188  ID3v1::Tag *ID3v1Tag(bool create = false);
189 
201  APE::Tag *APETag(bool create = false);
202 
213  bool strip(int tags = AllTags);
214 
223  // BIC: merge with the method above
224  bool strip(int tags, bool freeMemory);
225 
231  void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
232 
236  long firstFrameOffset();
237 
242  long nextFrameOffset(long position);
243 
248  long previousFrameOffset(long position);
249 
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 
269  static bool secondSynchByte(char byte);
270 
271  class FilePrivate;
272  FilePrivate *d;
273  };
274  }
275 }
276 
277 #endif