Fix USLT frame creation in Frame::createTextualFrame()

This commit is contained in:
Michael Helmling
2012-02-26 10:43:08 +01:00
parent fa0656e3c6
commit 0a3b998ca5
2 changed files with 8 additions and 1 deletions

View File

@ -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;
}

View File

@ -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:".