Support for proprietary frames Apple iTunes uses to tag podcast files.

This commit is contained in:
Hasso Tepper 2012-07-07 01:25:27 +03:00 committed by Urs Fleisch
parent 5ca4cd2f52
commit 9ad5bb1d62
2 changed files with 20 additions and 3 deletions

View File

@ -117,7 +117,8 @@ Frame *Frame::createTextualFrame(const String &key, const StringList &values) //
// check if the key is contained in the key<=>frameID mapping
ByteVector frameID = keyToFrameID(key);
if(!frameID.isNull()) {
if(frameID[0] == 'T'){ // text frame
// Apple proprietary WFED (Podcast URL) is in fact a text frame.
if(frameID[0] == 'T' || frameID == "WFED"){ // text frame
TextIdentificationFrame *frame = new TextIdentificationFrame(frameID, String::UTF8);
frame->setText(values);
return frame;
@ -427,6 +428,12 @@ static const char *frameTranslation[][2] = {
// Other frames
{ "COMM", "COMMENT" },
//{ "USLT", "LYRICS" }, handled specially
// Apple iTunes proprietary frames
{ "PCST", "PODCAST" },
{ "TCAT", "PODCASTCATEGORY" },
{ "TDES", "PODCASTDESC" },
{ "TGID", "PODCASTID" },
{ "WFED", "PODCASTURL" },
};
static const TagLib::uint txxxFrameTranslationSize = 8;
@ -532,7 +539,8 @@ PropertyMap Frame::asProperties() const
// workaround until this function is virtual
if(id == "TXXX")
return dynamic_cast< const UserTextIdentificationFrame* >(this)->asProperties();
else if(id[0] == 'T')
// Apple proprietary WFED (Podcast URL) is in fact a text frame.
else if(id[0] == 'T' || id == "WFED")
return dynamic_cast< const TextIdentificationFrame* >(this)->asProperties();
else if(id == "WXXX")
return dynamic_cast< const UserUrlLinkFrame* >(this)->asProperties();

View File

@ -167,7 +167,8 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader)
// Text Identification (frames 4.2)
if(frameID.startsWith("T")) {
// Apple proprietary WFED (Podcast URL) is in fact a text frame.
if(frameID.startsWith("T") || frameID == "WFED") {
TextIdentificationFrame *f = frameID != "TXXX"
? new TextIdentificationFrame(data, header)
@ -423,6 +424,14 @@ bool FrameFactory::updateFrame(Frame::Header *header) const
convertFrame("WPB", "WPUB", header);
convertFrame("WXX", "WXXX", header);
// Apple iTunes nonstandard frames
convertFrame("PCS", "PCST", header);
convertFrame("TCT", "TCAT", header);
convertFrame("TDR", "TDRL", header);
convertFrame("TDS", "TDES", header);
convertFrame("TID", "TGID", header);
convertFrame("WFD", "WFED", header);
break;
}