From bec3875b947970463ac4665e51e662cd0d572e74 Mon Sep 17 00:00:00 2001 From: Tim De Baets Date: Tue, 16 Aug 2011 01:57:01 +0200 Subject: [PATCH] Added removePicture() to FLAC::File --- taglib/flac/flacfile.cpp | 11 +++++++++++ taglib/flac/flacfile.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp index 8c43a8c1..5065cd29 100644 --- a/taglib/flac/flacfile.cpp +++ b/taglib/flac/flacfile.cpp @@ -493,6 +493,17 @@ void FLAC::File::addPicture(Picture *picture) d->blocks.append(picture); } +void FLAC::File::removePicture(Picture *picture, bool del) +{ + MetadataBlock *block = picture; + List::Iterator it = d->blocks.find(block); + if(it != d->blocks.end()) + d->blocks.erase(it); + + if(del) + delete picture; +} + void FLAC::File::removePictures() { List newBlocks; diff --git a/taglib/flac/flacfile.h b/taglib/flac/flacfile.h index e9251fed..01466a2d 100644 --- a/taglib/flac/flacfile.h +++ b/taglib/flac/flacfile.h @@ -201,6 +201,12 @@ namespace TagLib { * Returns a list of pictures attached to the FLAC file. */ List pictureList(); + + /*! + * Removes an attached picture. If \a del is true the picture's memory + * will be freed; if it is false, it must be deleted by the user. + */ + void removePicture(Picture *picture, bool del = true); /*! * Remove all attached images. -- 2.40.0