APIC タグを除くすべてのタグを MPEG ファイルから削除する機能を作成しましたが、結果がまちまちで予測不能です。「年」以外のすべてのタグが正しく削除される場合があり (これはほとんどの場合に発生します)、「年」タグに追加で 1 つ以上のタグが残る場合があります。
私は確かに何か間違ったことをしています。これが私の機能です:
void stripTags(const char* path) {
MPEG::File m(path);
m.strip(MPEG::File::ID3v1 | MPEG::File::APE, true); //I added this because otherwise, all tags would stay the first time I executed stripTags(). The second time I would execute it then the tags would be mostly gone (except for "year" as mentioned)
ByteVector handle = "APIC";
ID3v2::Tag *t = m.ID3v2Tag();
if (t) {
for (ID3v2::FrameList::ConstIterator it = t->frameList().begin(); it != t->frameList().end(); it++) {
if ((*it)->frameID() != handle) {
t->removeFrames((*it)->frameID());
it = t->frameList().begin(); //since the doc says that removeFrames invalidates the pointer returned by frameList, I update this pointer after each removal
}
}
m.save();
}
m.strip(MPEG::File::ID3v1 | MPEG::File::APE, true);
}
助けてくれてありがとう