mpegfile.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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   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_MPEGFILE_H
00027 #define TAGLIB_MPEGFILE_H
00028 
00029 #include "taglib_export.h"
00030 #include "tfile.h"
00031 
00032 #include "mpegproperties.h"
00033 
00034 namespace TagLib {
00035 
00036   namespace ID3v2 { class Tag; class FrameFactory; }
00037   namespace ID3v1 { class Tag; }
00038   namespace APE { class Tag; }
00039 
00041 
00042   namespace MPEG {
00043 
00045 
00052     class TAGLIB_EXPORT File : public TagLib::File
00053     {
00054     public:
00059       enum TagTypes {
00061         NoTags  = 0x0000,
00063         ID3v1   = 0x0001,
00065         ID3v2   = 0x0002,
00067         APE     = 0x0004,
00069         AllTags = 0xffff
00070       };
00071 
00080       File(FileName file, bool readProperties = true,
00081            Properties::ReadStyle propertiesStyle = Properties::Average);
00082 
00089       // BIC: merge with the above constructor
00090       File(FileName file, ID3v2::FrameFactory *frameFactory,
00091            bool readProperties = true,
00092            Properties::ReadStyle propertiesStyle = Properties::Average);
00093 
00097       virtual ~File();
00098 
00116       virtual Tag *tag() const;
00117 
00122       virtual Properties *audioProperties() const;
00123 
00139       virtual bool save();
00140 
00150       bool save(int tags);
00151 
00161       // BIC: combine with the above method
00162       bool save(int tags, bool stripOthers);
00163 
00175       ID3v2::Tag *ID3v2Tag(bool create = false);
00176 
00188       ID3v1::Tag *ID3v1Tag(bool create = false);
00189 
00201       APE::Tag *APETag(bool create = false);
00202 
00213       bool strip(int tags = AllTags);
00214 
00223       // BIC: merge with the method above
00224       bool strip(int tags, bool freeMemory);
00225 
00231       void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
00232 
00236       long firstFrameOffset();
00237 
00242       long nextFrameOffset(long position);
00243 
00248       long previousFrameOffset(long position);
00249 
00253       long lastFrameOffset();
00254 
00255     private:
00256       File(const File &);
00257       File &operator=(const File &);
00258 
00259       void read(bool readProperties, Properties::ReadStyle propertiesStyle);
00260       long findID3v2();
00261       long findID3v1();
00262       void findAPE();
00263 
00269       static bool secondSynchByte(char byte);
00270 
00271       class FilePrivate;
00272       FilePrivate *d;
00273     };
00274   }
00275 }
00276 
00277 #endif