TagLib  2.2.1
mpegheader.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_MPEGHEADER_H
27 #define TAGLIB_MPEGHEADER_H
28 
29 #include <memory>
30 
31 #include "taglib.h"
32 #include "taglib_export.h"
33 
34 namespace TagLib {
35 
36  class ByteVector;
37  class File;
38 
39  namespace MPEG {
40 
42 
54  {
55  public:
63  Header(File *file, offset_t offset, bool checkLength = true);
64 
68  Header(const Header &h);
69 
73  ~Header();
74 
79  bool isValid() const;
80 
84  enum Version {
86  Version1 = 0,
88  Version2 = 1,
90  Version2_5 = 2,
92  Version4 = 3
93  };
94 
98  Version version() const;
99 
103  int layer() const;
104 
108  bool protectionEnabled() const;
109 
113  int bitrate() const;
114 
118  int sampleRate() const;
119 
123  bool isPadded() const;
124 
129  enum ChannelMode {
131  Stereo = 0,
133  JointStereo = 1,
135  DualChannel = 2,
137  SingleChannel = 3
138  };
139 
143  ChannelMode channelMode() const;
144 
150  Custom = 0,
152  FrontCenter = 1,
154  FrontLeftRight = 2,
156  FrontCenterLeftRight = 3,
158  FrontCenterLeftRightBackCenter = 4,
161  FrontCenterLeftRightBackLeftRight = 5,
164  FrontCenterLeftRightBackLeftRightLFE = 6,
167  FrontCenterLeftRightSideLeftRightBackLeftRightLFE = 7
168  };
169 
173  ChannelConfiguration channelConfiguration() const;
174 
179  bool isADTS() const;
180 
184  bool isCopyrighted() const;
185 
189  bool isOriginal() const;
190 
194  int frameLength() const;
195 
199  int samplesPerFrame() const;
200 
204  Header &operator=(const Header &h);
205 
206  private:
207  void parse(File *file, offset_t offset, bool checkLength);
208 
209  class HeaderPrivate;
211  std::shared_ptr<HeaderPrivate> d;
212  };
213  } // namespace MPEG
214 } // namespace TagLib
215 
216 #endif
An MPEG file class with some useful methods specific to MPEG.
Definition: mpegfile.h:53
ChannelConfiguration
Definition: mpegheader.h:148
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
Version
Definition: id3v2.h:27
off_t offset_t
Definition: taglib.h:64
An implementation of MP3 frame headers.
Definition: mpegheader.h:53
ChannelMode
Definition: mpegheader.h:129
Version
Definition: mpegheader.h:84
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41