Commit 9e1a254c authored by Urs Fleisch's avatar Urs Fleisch

Fix build with TagLib <= 1.9.1.

parent 3a3e32e5
...@@ -4289,7 +4289,13 @@ static void stripMp4FreeFormName(TagLib::String& name) ...@@ -4289,7 +4289,13 @@ static void stripMp4FreeFormName(TagLib::String& name)
static void prefixMp4FreeFormName(TagLib::String& name, static void prefixMp4FreeFormName(TagLib::String& name,
const TagLib::MP4::Tag* mp4Tag) const TagLib::MP4::Tag* mp4Tag)
{ {
if (!mp4Tag->contains(name) && !name.startsWith("----") && if (
#if TAGLIB_VERSION >= 0x011000
!mp4Tag->contains(name)
#else
!const_cast<TagLib::MP4::Tag*>(mp4Tag)->itemListMap().contains(name)
#endif
&& !name.startsWith("----") &&
!(name.length() == 4 && !(name.length() == 4 &&
(name[0] == '\251' || (name[0] >= 'a' && name[0] <= 'z')))) { (name[0] == '\251' || (name[0] >= 'a' && name[0] <= 'z')))) {
Frame::Type type; Frame::Type type;
...@@ -4299,12 +4305,29 @@ static void prefixMp4FreeFormName(TagLib::String& name, ...@@ -4299,12 +4305,29 @@ static void prefixMp4FreeFormName(TagLib::String& name,
if (name[0] == ':') name = name.substr(1); if (name[0] == ':') name = name.substr(1);
TagLib::String freeFormName = "----:com.apple.iTunes:" + name; TagLib::String freeFormName = "----:com.apple.iTunes:" + name;
unsigned int nameLen; unsigned int nameLen;
if (!mp4Tag->contains(freeFormName) && (nameLen = name.length()) > 0) { if (
#if TAGLIB_VERSION >= 0x011000
!mp4Tag->contains(freeFormName)
#else
!const_cast<TagLib::MP4::Tag*>(mp4Tag)->itemListMap().contains(
freeFormName)
#endif
&& (nameLen = name.length()) > 0) {
// Not an iTunes free form name, maybe using another prefix // Not an iTunes free form name, maybe using another prefix
// (such as "----:com.nullsoft.winamp:"). // (such as "----:com.nullsoft.winamp:").
// Search for a frame which ends with this name. // Search for a frame which ends with this name.
#if TAGLIB_VERSION >= 0x011000
const TagLib::MP4::ItemMap& items = mp4Tag->itemMap(); const TagLib::MP4::ItemMap& items = mp4Tag->itemMap();
for (TagLib::MP4::ItemMap::ConstIterator it = items.begin(); #else
const TagLib::MP4::ItemListMap& items =
const_cast<TagLib::MP4::Tag*>(mp4Tag)->itemListMap();
#endif
for (
#if TAGLIB_VERSION >= 0x011000
TagLib::MP4::ItemMap::ConstIterator it = items.begin();
#else
TagLib::MP4::ItemListMap::ConstIterator it = items.begin();
#endif
it != items.end(); it != items.end();
++it) { ++it) {
const TagLib::String& key = it->first; const TagLib::String& key = it->first;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment