mpegheader.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2002 - 2008 by Scott Wheeler
00003     email                : wheeler@kde.org
00004  ***************************************************************************/
00005 
00006 /***************************************************************************
00007  *   This library is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU Lesser General Public License version   *
00009  *   2.1 as published by the Free Software Foundation.                     *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful, but   *
00012  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the Free Software   *
00018  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA         *
00019  *   02110-1301  USA                                                       *
00020  *                                                                         *
00021  *   Alternatively, this file is available under the Mozilla Public        *
00022  *   License Version 1.1.  You may obtain a copy of the License at         *
00023  *   http://www.mozilla.org/MPL/                                           *
00024  ***************************************************************************/
00025 
00026 #ifndef TAGLIB_MPEGHEADER_H
00027 #define TAGLIB_MPEGHEADER_H
00028 
00029 #include "taglib_export.h"
00030 
00031 namespace TagLib {
00032 
00033   class ByteVector;
00034   class File;
00035 
00036   namespace MPEG {
00037 
00039 
00047     class TAGLIB_EXPORT Header
00048     {
00049     public:
00055       Header(const ByteVector &data);
00056 
00064       Header(File *file, long offset, bool checkLength = true);
00065 
00069       Header(const Header &h);
00070 
00074       virtual ~Header();
00075 
00080       bool isValid() const;
00081 
00085       enum Version {
00087         Version1 = 0,
00089         Version2 = 1,
00091         Version2_5 = 2
00092       };
00093 
00097       Version version() const;
00098 
00102       int layer() const;
00103 
00107       bool protectionEnabled() const;
00108 
00112       int bitrate() const;
00113 
00117       int sampleRate() const;
00118 
00122       bool isPadded() const;
00123 
00128       enum ChannelMode {
00130         Stereo        = 0,
00132         JointStereo   = 1,
00134         DualChannel   = 2,
00136         SingleChannel = 3
00137       };
00138 
00142       ChannelMode channelMode() const;
00143 
00147       bool isCopyrighted() const;
00148 
00152       bool isOriginal() const;
00153 
00157       int frameLength() const;
00158 
00162       int samplesPerFrame() const;
00163 
00167       Header &operator=(const Header &h);
00168 
00169     private:
00170       void parse(File *file, long offset, bool checkLength);
00171 
00172       class HeaderPrivate;
00173       HeaderPrivate *d;
00174     };
00175   }
00176 }
00177 
00178 #endif