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., 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_MPEGFILE_H
00027 #define TAGLIB_MPEGFILE_H
00028 
00029 #include "taglib_export.h"
00030 #include "tfile.h"
00031 #include "tag.h"
00032 
00033 #include "mpegproperties.h"
00034 
00035 namespace TagLib {
00036 
00037   namespace ID3v2 { class Tag; class FrameFactory; }
00038   namespace ID3v1 { class Tag; }
00039   namespace APE { class Tag; }
00040 
00042 
00043   namespace MPEG {
00044 
00046 
00053     class TAGLIB_EXPORT File : public TagLib::File
00054     {
00055     public:
00060       enum TagTypes {
00062         NoTags  = 0x0000,
00064         ID3v1   = 0x0001,
00066         ID3v2   = 0x0002,
00068         APE     = 0x0004,
00070         AllTags = 0xffff
00071       };
00072 
00082       File(FileName file, bool readProperties = true,
00083            Properties::ReadStyle propertiesStyle = Properties::Average);
00084 
00094       // BIC: merge with the above constructor
00095       File(FileName file, ID3v2::FrameFactory *frameFactory,
00096            bool readProperties = true,
00097            Properties::ReadStyle propertiesStyle = Properties::Average);
00098 
00111       File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
00112            bool readProperties = true,
00113            Properties::ReadStyle propertiesStyle = Properties::Average);
00114 
00118       virtual ~File();
00119 
00137       virtual Tag *tag() const;
00138 
00145       PropertyMap properties() const;
00146 
00147       void removeUnsupportedProperties(const StringList &properties);
00148 
00157       PropertyMap setProperties(const PropertyMap &);
00158 
00163       virtual Properties *audioProperties() const;
00164 
00180       virtual bool save();
00181 
00191       bool save(int tags);
00192 
00202       // BIC: combine with the above method
00203       bool save(int tags, bool stripOthers);
00204 
00217       // BIC: combine with the above method
00218       bool save(int tags, bool stripOthers, int id3v2Version);
00219 
00235       // BIC: combine with the above method
00236       bool save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags);
00237 
00255       ID3v2::Tag *ID3v2Tag(bool create = false);
00256 
00274       ID3v1::Tag *ID3v1Tag(bool create = false);
00275 
00293       APE::Tag *APETag(bool create = false);
00294 
00307       bool strip(int tags = AllTags);
00308 
00319       // BIC: merge with the method above
00320       bool strip(int tags, bool freeMemory);
00321 
00328       void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
00329 
00333       long firstFrameOffset();
00334 
00339       long nextFrameOffset(long position);
00340 
00345       long previousFrameOffset(long position);
00346 
00350       long lastFrameOffset();
00351 
00357       bool hasID3v1Tag() const;
00358 
00364       bool hasID3v2Tag() const;
00365 
00371       bool hasAPETag() const;
00372 
00373     private:
00374       File(const File &);
00375       File &operator=(const File &);
00376 
00377       void read(bool readProperties);
00378       long findID3v2();
00379 
00380       class FilePrivate;
00381       FilePrivate *d;
00382     };
00383   }
00384 }
00385 
00386 #endif