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 "taglib_export.h"
30 
31 namespace TagLib {
32 
33  class ByteVector;
34 
35  namespace MPEG {
36 
38 
47  {
48  public:
52  Header(const ByteVector &data);
53 
57  Header(const Header &h);
58 
62  virtual ~Header();
63 
68  bool isValid() const;
69 
73  enum Version {
75  Version1 = 0,
77  Version2 = 1,
79  Version2_5 = 2
80  };
81 
85  Version version() const;
86 
90  int layer() const;
91 
95  bool protectionEnabled() const;
96 
100  int bitrate() const;
101 
105  int sampleRate() const;
106 
110  bool isPadded() const;
111 
116  enum ChannelMode {
118  Stereo = 0,
120  JointStereo = 1,
122  DualChannel = 2,
124  SingleChannel = 3
125  };
126 
130  ChannelMode channelMode() const;
131 
135  bool isCopyrighted() const;
136 
140  bool isOriginal() const;
141 
145  int frameLength() const;
146 
150  int samplesPerFrame() const;
151 
155  Header &operator=(const Header &h);
156 
157  private:
158  void parse(const ByteVector &data);
159 
160  class HeaderPrivate;
161  HeaderPrivate *d;
162  };
163  }
164 }
165 
166 #endif