TagLib 1.10 (TagLib: synchronizedlyricsframe.h Source File)

synchronizedlyricsframe.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2014 by Urs Fleisch
00003     email                : ufleisch@users.sourceforge.net
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_SYNCHRONIZEDLYRICSFRAME_H
00027 #define TAGLIB_SYNCHRONIZEDLYRICSFRAME_H
00028 
00029 #include "id3v2frame.h"
00030 #include "tlist.h"
00031 
00032 namespace TagLib {
00033 
00034   namespace ID3v2 {
00035 
00037 
00040     class TAGLIB_EXPORT SynchronizedLyricsFrame : public Frame
00041     {
00042       friend class FrameFactory;
00043 
00044     public:
00045 
00049       enum TimestampFormat {
00051         Unknown              = 0x00,
00054         AbsoluteMpegFrames   = 0x01,
00057         AbsoluteMilliseconds = 0x02
00058       };
00059 
00063       enum Type {
00065         Other             = 0x00,
00067         Lyrics            = 0x01,
00069         TextTranscription = 0x02,
00071         Movement          = 0x03,
00073         Events            = 0x04,
00075         Chord             = 0x05,
00077         Trivia            = 0x06,
00079         WebpageUrls       = 0x07,
00081         ImageUrls         = 0x08
00082       };
00083 
00087       struct SynchedText {
00088         SynchedText(uint ms, String str) : time(ms), text(str) {}
00089         uint time;
00090         String text;
00091       };
00092 
00096       typedef TagLib::List<SynchedText> SynchedTextList;
00097 
00102       explicit SynchronizedLyricsFrame(String::Type encoding = String::Latin1);
00103 
00107       explicit SynchronizedLyricsFrame(const ByteVector &data);
00108 
00112       virtual ~SynchronizedLyricsFrame();
00113 
00119       virtual String toString() const;
00120 
00129       String::Type textEncoding() const;
00130 
00139       ByteVector language() const;
00140 
00144       TimestampFormat timestampFormat() const;
00145 
00149       Type type() const;
00150 
00158       String description() const;
00159 
00163       SynchedTextList synchedText() const;
00164 
00172       void setTextEncoding(String::Type encoding);
00173 
00181       void setLanguage(const ByteVector &languageCode);
00182 
00188       void setTimestampFormat(TimestampFormat f);
00189 
00195       void setType(Type t);
00196 
00202       void setDescription(const String &s);
00203 
00209       void setSynchedText(const SynchedTextList &t);
00210 
00211     protected:
00212       // Reimplementations.
00213 
00214       virtual void parseFields(const ByteVector &data);
00215       virtual ByteVector renderFields() const;
00216 
00217     private:
00221       SynchronizedLyricsFrame(const ByteVector &data, Header *h);
00222       SynchronizedLyricsFrame(const SynchronizedLyricsFrame &);
00223       SynchronizedLyricsFrame &operator=(const SynchronizedLyricsFrame &);
00224 
00225       class SynchronizedLyricsFramePrivate;
00226       SynchronizedLyricsFramePrivate *d;
00227     };
00228 
00229   }
00230 }
00231 #endif