From: Michael Helmling Date: Sun, 26 Feb 2012 09:43:08 +0000 (+0100) Subject: Fix USLT frame creation in Frame::createTextualFrame() X-Git-Tag: v1.8beta~24^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a3b998ca598ae7c36d719c613163ae634fd0555;p=taglib Fix USLT frame creation in Frame::createTextualFrame() --- diff --git a/taglib/mpeg/id3v2/id3v2frame.cpp b/taglib/mpeg/id3v2/id3v2frame.cpp index 16b02d55..be566ca1 100644 --- a/taglib/mpeg/id3v2/id3v2frame.cpp +++ b/taglib/mpeg/id3v2/id3v2frame.cpp @@ -102,6 +102,7 @@ ByteVector Frame::textDelimiter(String::Type t) const String Frame::instrumentPrefix("PERFORMER:"); const String Frame::commentPrefix("COMMENT:"); +const String Frame::lyricsPrefix("LYRICS:"); const String Frame::urlPrefix("URL:"); //////////////////////////////////////////////////////////////////////////////// @@ -125,8 +126,9 @@ Frame *Frame::createTextualFrame(const String &key, const StringList &values) // } // now we check if it's one of the "special" cases: // -LYRICS: depending on the number of values, use USLT or TXXX (with description=LYRICS) - if(key == "LYRICS" && values.size() == 1){ + if((key == "LYRICS" || key.startsWith(lyricsPrefix)) && values.size() == 1){ UnsynchronizedLyricsFrame *frame = new UnsynchronizedLyricsFrame(); + frame->setDescription(key == "LYRICS" ? key : key.substr(lyricsPrefix.size())); frame->setText(values.front()); return frame; } diff --git a/taglib/mpeg/id3v2/id3v2frame.h b/taglib/mpeg/id3v2/id3v2frame.h index 3a9ade26..95c4070b 100644 --- a/taglib/mpeg/id3v2/id3v2frame.h +++ b/taglib/mpeg/id3v2/id3v2frame.h @@ -146,6 +146,11 @@ namespace TagLib { * frame for a non-standard key. In the current implementation, this is "COMMENT:". */ static const String commentPrefix; + /*! + * The PropertyMap key prefix which triggers the use of a USLT frame instead of a TXXX + * frame for a non-standard key. In the current implementation, this is "LYRICS:". + */ + static const String lyricsPrefix; /*! * The PropertyMap key prefix which triggers the use of a WXXX frame instead of a TXX * frame for a non-standard key. In the current implementation, this is "URL:".