mpegfile.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2002, 2003 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   USA                                                                   *
00020  ***************************************************************************/
00021 
00022 #ifndef TAGLIB_MPEGFILE_H
00023 #define TAGLIB_MPEGFILE_H
00024 
00025 #include <tfile.h>
00026 
00027 #include "mpegproperties.h"
00028 
00029 namespace TagLib {
00030 
00031   namespace ID3v2 { class Tag; class FrameFactory; }
00032   namespace ID3v1 { class Tag; }
00033   namespace APE { class Tag; }
00034 
00036 
00037   namespace MPEG {
00038 
00040 
00047     class File : public TagLib::File
00048     {
00049     public:
00054       enum TagTypes {
00056         NoTags  = 0x0000,
00058         ID3v1   = 0x0001,
00060         ID3v2   = 0x0002,
00062         APE     = 0x0004,
00064         AllTags = 0xffff
00065       };
00066 
00075       File(const char *file, bool readProperties = true,
00076            Properties::ReadStyle propertiesStyle = Properties::Average);
00077 
00084       // BIC: merge with the above constructor
00085       File(const char *file, ID3v2::FrameFactory *frameFactory,
00086            bool readProperties = true,
00087            Properties::ReadStyle propertiesStyle = Properties::Average);
00088 
00092       virtual ~File();
00093 
00111       virtual Tag *tag() const;
00112 
00117       virtual Properties *audioProperties() const;
00118 
00134       virtual bool save();
00135 
00145       bool save(int tags);
00146 
00158       ID3v2::Tag *ID3v2Tag(bool create = false);
00159 
00171       ID3v1::Tag *ID3v1Tag(bool create = false);
00172 
00184       APE::Tag *APETag(bool create = false);
00185 
00196       bool strip(int tags = AllTags);
00197 
00206       // BIC: merge with the method above
00207       bool strip(int tags, bool freeMemory);
00208 
00214       void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
00215 
00219       long firstFrameOffset();
00220 
00225       long nextFrameOffset(long position);
00226 
00231       long previousFrameOffset(long position);
00232 
00236       long lastFrameOffset();
00237 
00238     private:
00239       File(const File &);
00240       File &operator=(const File &);
00241 
00242       void read(bool readProperties, Properties::ReadStyle propertiesStyle);
00243       long findID3v2();
00244       long findID3v1();
00245       long findAPE();
00246 
00252       static bool secondSynchByte(char byte);
00253 
00254       class FilePrivate;
00255       FilePrivate *d;
00256     };
00257   }
00258 }
00259 
00260 #endif