From fb0d6c5b4e8465caf8066c4e0f0ea7c5a1926f84 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Wed, 18 Jul 2007 17:08:09 +0000 Subject: [PATCH] Update APE location after adding new tags. BUG:122700 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@689608 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- taglib/mpeg/mpegfile.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/taglib/mpeg/mpegfile.cpp b/taglib/mpeg/mpegfile.cpp index 9bfa64ec..aec87821 100644 --- a/taglib/mpeg/mpegfile.cpp +++ b/taglib/mpeg/mpegfile.cpp @@ -304,6 +304,18 @@ bool MPEG::File::save(int tags, bool stripOthers) d->ID3v2Location = 0; insert(d->ID3v2Tag->render(), d->ID3v2Location, d->ID3v2OriginalSize); + + d->hasID3v2 = true; + + // v1 tag location has changed, update if it exists + + if(d->ID3v1Tag) + d->ID3v1Location = findID3v1(); + + // APE tag location has changed, update if it exists + + if(d->APETag) + d->APELocation = findAPE(); } else if(stripOthers) success = strip(ID3v2, false) && success; @@ -316,6 +328,8 @@ bool MPEG::File::save(int tags, bool stripOthers) int offset = d->hasID3v1 ? -128 : 0; seek(offset, End); writeBlock(d->ID3v1Tag->render()); + d->hasID3v1 = true; + d->ID3v1Location = findID3v1(); } else if(stripOthers) success = strip(ID3v1) && success; @@ -407,8 +421,14 @@ bool MPEG::File::strip(int tags, bool freeMemory) } // v1 tag location has changed, update if it exists + if(d->ID3v1Tag) d->ID3v1Location = findID3v1(); + + // APE tag location has changed, update if it exists + + if(d->APETag) + d->APELocation = findAPE(); } if((tags & ID3v1) && d->hasID3v1) {