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 
00183       virtual bool save();
00184 
00197       bool save(int tags);
00198 
00211       // BIC: combine with the above method
00212       bool save(int tags, bool stripOthers);
00213 
00229       // BIC: combine with the above method
00230       bool save(int tags, bool stripOthers, int id3v2Version);
00231 
00250       // BIC: combine with the above method
00251       bool save(int tags, bool stripOthers, int id3v2Version, bool duplicateTags);
00252 
00270       ID3v2::Tag *ID3v2Tag(bool create = false);
00271 
00289       ID3v1::Tag *ID3v1Tag(bool create = false);
00290 
00308       APE::Tag *APETag(bool create = false);
00309 
00322       bool strip(int tags = AllTags);
00323 
00334       // BIC: merge with the method above
00335       bool strip(int tags, bool freeMemory);
00336 
00343       void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
00344 
00348       long firstFrameOffset();
00349 
00354       long nextFrameOffset(long position);
00355 
00360       long previousFrameOffset(long position);
00361 
00365       long lastFrameOffset();
00366 
00372       bool hasID3v1Tag() const;
00373 
00379       bool hasID3v2Tag() const;
00380 
00386       bool hasAPETag() const;
00387 
00388     private:
00389       File(const File &);
00390       File &operator=(const File &);
00391 
00392       void read(bool readProperties);
00393       long findID3v2(long offset);
00394       long findID3v1();
00395       void findAPE();
00396 
00397       class FilePrivate;
00398       FilePrivate *d;
00399     };
00400   }
00401 }
00402 
00403 #endif