TagLib API Documentation
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 "tfile.h"
30#include "taglib_export.h"
31#include "tag.h"
32#include "mpegproperties.h"
33#include "id3v2.h"
34
35namespace TagLib {
36
37 namespace ID3v2 { class Tag; class FrameFactory; }
38 namespace ID3v1 { class Tag; }
39 namespace APE { class Tag; }
40
42
43 namespace MPEG {
44
46
54 {
55 public:
60 enum TagTypes {
62 NoTags = 0x0000,
64 ID3v1 = 0x0001,
66 ID3v2 = 0x0002,
68 APE = 0x0004,
70 AllTags = 0xffff
71 };
72
83 File(FileName file, bool readProperties = true,
85 ID3v2::FrameFactory *frameFactory = nullptr);
86
100 File(FileName file, ID3v2::FrameFactory *frameFactory,
101 bool readProperties = true,
103
120 File(IOStream *stream, bool readProperties = true,
122 ID3v2::FrameFactory *frameFactory = nullptr);
123
140 File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
141 bool readProperties = true,
143
147 ~File() override;
148
149 File(const File &) = delete;
150 File &operator=(const File &) = delete;
151
169 Tag *tag() const override;
170
177 PropertyMap properties() const override;
178
179 void removeUnsupportedProperties(const StringList &properties) override;
180
190
195 Properties *audioProperties() const override;
196
212 bool save() override;
213
227 bool save(int tags, StripTags strip = StripOthers,
228 ID3v2::Version version = ID3v2::v4,
229 DuplicateTags duplicate = Duplicate);
230
248 ID3v2::Tag *ID3v2Tag(bool create = false);
249
267 ID3v1::Tag *ID3v1Tag(bool create = false);
268
286 APE::Tag *APETag(bool create = false);
287
298 bool strip(int tags = AllTags, bool freeMemory = true);
299
304
310
316
321
327 bool hasID3v1Tag() const;
328
334 bool hasID3v2Tag() const;
335
341 bool hasAPETag() const;
342
350 static bool isSupported(IOStream *stream);
351
352 private:
353 void read(bool readProperties, Properties::ReadStyle readStyle);
354 offset_t findID3v2(Properties::ReadStyle readStyle);
355
356 class FilePrivate;
358 std::unique_ptr<FilePrivate> d;
359 };
360 } // namespace MPEG
361} // namespace TagLib
362
363#endif
An APE tag implementation.
Definition: apetag.h:57
ReadStyle
Definition: audioproperties.h:56
@ Average
Read more of the file and make better values guesses.
Definition: audioproperties.h:60
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:115
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:68
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:134
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:65
An MPEG file class with some useful methods specific to MPEG.
Definition: mpegfile.h:54
APE::Tag * APETag(bool create=false)
bool save(int tags, StripTags strip=StripOthers, ID3v2::Version version=ID3v2::v4, DuplicateTags duplicate=Duplicate)
offset_t previousFrameOffset(offset_t position)
bool hasID3v2Tag() const
PropertyMap setProperties(const PropertyMap &) override
offset_t lastFrameOffset()
TagTypes
Definition: mpegfile.h:60
PropertyMap properties() const override
File(FileName file, bool readProperties=true, Properties::ReadStyle readStyle=Properties::Average, ID3v2::FrameFactory *frameFactory=nullptr)
File(const File &)=delete
bool hasID3v1Tag() const
ID3v1::Tag * ID3v1Tag(bool create=false)
File(IOStream *stream, bool readProperties=true, Properties::ReadStyle readStyle=Properties::Average, ID3v2::FrameFactory *frameFactory=nullptr)
bool strip(int tags=AllTags, bool freeMemory=true)
File & operator=(const File &)=delete
TAGLIB_DEPRECATED File(FileName file, ID3v2::FrameFactory *frameFactory, bool readProperties=true, Properties::ReadStyle readStyle=Properties::Average)
offset_t firstFrameOffset()
ID3v2::Tag * ID3v2Tag(bool create=false)
void removeUnsupportedProperties(const StringList &properties) override
bool save() override
static bool isSupported(IOStream *stream)
offset_t nextFrameOffset(offset_t position)
Properties * audioProperties() const override
TAGLIB_DEPRECATED File(IOStream *stream, ID3v2::FrameFactory *frameFactory, bool readProperties=true, Properties::ReadStyle readStyle=Properties::Average)
bool hasAPETag() const
Tag * tag() const override
An implementation of audio property reading for MP3.
Definition: mpegproperties.h:48
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:123
A list of strings.
Definition: tstringlist.h:44
A simple, generic interface to common audio metadata fields.
Definition: tag.h:49
Version
Definition: id3v2.h:27
@ v4
ID3v2.4.
Definition: id3v2.h:29
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
off_t offset_t
Definition: taglib.h:64
const char * FileName
Definition: tiostream.h:59
#define TAGLIB_DEPRECATED
Definition: taglib.h:39
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55