1 /***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
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. *
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. *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
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 ***************************************************************************/
26 #ifndef TAGLIB_MPEGHEADER_H
27 #define TAGLIB_MPEGHEADER_H
29 #include "taglib_export.h"
37 //! An implementation of MP3 frame headers
40 * This is an implementation of MPEG Layer III headers. The API follows more
41 * or less the binary format of these headers. I've used
42 * <a href="http://www.mp3-tech.org/programmer/frame_header.html">this</a>
43 * document as a reference.
46 class TAGLIB_EXPORT Header
50 * Parses an MPEG header based on \a data.
52 Header(const ByteVector &data);
55 * Does a shallow copy of \a h.
57 Header(const Header &h);
60 * Destroys this Header instance.
65 * Returns true if the frame is at least an appropriate size and has
83 * Returns the MPEG Version of the header.
85 Version version() const;
88 * Returns the layer version. This will be between the values 1-3.
93 * Returns true if the MPEG protection bit is enabled.
95 bool protectionEnabled() const;
98 * Returns the bitrate encoded in the header.
103 * Returns the sample rate in Hz.
105 int sampleRate() const;
108 * Returns true if the frame is padded.
110 bool isPadded() const;
113 * There are a few combinations or one or two channel audio that are
128 * Returns the channel mode for this frame.
130 ChannelMode channelMode() const;
133 * Returns true if the copyrighted bit is set.
135 bool isCopyrighted() const;
138 * Returns true if the "original" bit is set.
140 bool isOriginal() const;
143 * Returns the frame length.
145 int frameLength() const;
148 * Returns the number of frames per sample.
150 int samplesPerFrame() const;
153 * Makes a shallow copy of the header.
155 Header &operator=(const Header &h);
158 void parse(const ByteVector &data);