TagLib  1.13.1
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 #include "tag.h"
32 
33 #include "mpegproperties.h"
34 
35 #include "id3v2.h"
36 
37 namespace TagLib {
38 
39  namespace ID3v2 { class Tag; class FrameFactory; }
40  namespace ID3v1 { class Tag; }
41  namespace APE { class Tag; }
42 
44 
45  namespace MPEG {
46 
48 
56  {
57  public:
62  enum TagTypes {
64  NoTags = 0x0000,
66  ID3v1 = 0x0001,
68  ID3v2 = 0x0002,
70  APE = 0x0004,
72  AllTags = 0xffff
73  };
74 
84  File(FileName file, bool readProperties = true,
85  Properties::ReadStyle propertiesStyle = Properties::Average);
86 
96  // BIC: merge with the above constructor
97  File(FileName file, ID3v2::FrameFactory *frameFactory,
98  bool readProperties = true,
99  Properties::ReadStyle propertiesStyle = Properties::Average);
100 
113  File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
114  bool readProperties = true,
115  Properties::ReadStyle propertiesStyle = Properties::Average);
116 
120  virtual ~File();
121 
139  virtual Tag *tag() const;
140 
148 
149  void removeUnsupportedProperties(const StringList &properties);
150 
160 
165  virtual Properties *audioProperties() const;
166 
182  virtual bool save();
183 
193  bool save(int tags);
194 
198  // BIC: combine with the above method
199  TAGLIB_DEPRECATED bool save(int tags, bool stripOthers);
200 
204  // BIC: combine with the above method
205  TAGLIB_DEPRECATED bool save(int tags, bool stripOthers, int id3v2Version);
206 
210  // BIC: combine with the above method
211  TAGLIB_DEPRECATED bool save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags);
212 
226  bool save(int tags, StripTags strip,
227  ID3v2::Version version = ID3v2::v4,
228  DuplicateTags duplicate = Duplicate);
229 
247  ID3v2::Tag *ID3v2Tag(bool create = false);
248 
266  ID3v1::Tag *ID3v1Tag(bool create = false);
267 
285  APE::Tag *APETag(bool create = false);
286 
299  bool strip(int tags = AllTags);
300 
311  // BIC: merge with the method above
312  bool strip(int tags, bool freeMemory);
313 
321 
326 
331  long nextFrameOffset(long position);
332 
337  long previousFrameOffset(long position);
338 
343 
349  bool hasID3v1Tag() const;
350 
356  bool hasID3v2Tag() const;
357 
363  bool hasAPETag() const;
364 
372  static bool isSupported(IOStream *stream);
373 
374  private:
375  File(const File &);
376  File &operator=(const File &);
377 
378  void read(bool readProperties);
379  long findID3v2();
380 
381  class FilePrivate;
382  FilePrivate *d;
383  };
384  } // namespace MPEG
385 } // namespace TagLib
386 
387 #endif
An APE tag implementation.
Definition: apetag.h:58
ReadStyle
Definition: audioproperties.h:53
@ Average
Read more of the file and make better values guesses.
Definition: audioproperties.h:57
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
StripTags
Definition: tfile.h:68
DuplicateTags
Definition: tfile.h:77
The main class in the ID3v1 implementation.
Definition: id3v1tag.h:106
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:66
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:128
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:63
An MPEG file class with some useful methods specific to MPEG.
Definition: mpegfile.h:56
bool strip(int tags, bool freeMemory)
bool hasID3v2Tag() const
TagTypes
Definition: mpegfile.h:62
PropertyMap properties() const
virtual Properties * audioProperties() const
TAGLIB_DEPRECATED bool save(int tags, bool stripOthers)
bool hasID3v1Tag() const
PropertyMap setProperties(const PropertyMap &)
TAGLIB_DEPRECATED bool save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags)
ID3v1::Tag * ID3v1Tag(bool create=false)
static bool isSupported(IOStream *stream)
TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
virtual Tag * tag() const
bool save(int tags, StripTags strip, ID3v2::Version version=ID3v2::v4, DuplicateTags duplicate=Duplicate)
File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties=true, Properties::ReadStyle propertiesStyle=Properties::Average)
File(FileName file, bool readProperties=true, Properties::ReadStyle propertiesStyle=Properties::Average)
void removeUnsupportedProperties(const StringList &properties)
bool save(int tags)
File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties=true, Properties::ReadStyle propertiesStyle=Properties::Average)
TAGLIB_DEPRECATED bool save(int tags, bool stripOthers, int id3v2Version)
long previousFrameOffset(long position)
bool strip(int tags=AllTags)
ID3v2::Tag * ID3v2Tag(bool create=false)
bool hasAPETag() const
APE::Tag * APETag(bool create=false)
virtual bool save()
long nextFrameOffset(long position)
An implementation of audio property reading for MP3.
Definition: mpegproperties.h:49
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:119
A list of strings.
Definition: tstringlist.h:46
Definition: tag.h:47
Version
Definition: id3v2.h:17
@ v4
Definition: id3v2.h:19
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
const char * FileName
Definition: tiostream.h:57
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
#define TAGLIB_EXPORT
Definition: taglib_export.h:40