]> granicus.if.org Git - taglib/commitdiff
Added removePicture() to FLAC::File
authorTim De Baets <tdebaets@gmail.com>
Mon, 15 Aug 2011 23:57:01 +0000 (01:57 +0200)
committerTim De Baets <tdebaets@gmail.com>
Mon, 15 Aug 2011 23:57:01 +0000 (01:57 +0200)
taglib/flac/flacfile.cpp
taglib/flac/flacfile.h

index 8c43a8c12234f88831561420f02244f1a603ced5..5065cd29770c2205e5fb75c1f52ff8b49c4b923e 100644 (file)
@@ -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<MetadataBlock *>::Iterator it = d->blocks.find(block);
+  if(it != d->blocks.end())
+    d->blocks.erase(it);
+
+  if(del)
+    delete picture;
+}
+
 void FLAC::File::removePictures()
 {
   List<MetadataBlock *> newBlocks;
index e9251fedb1b6425096a81ca68e532d21094b2904..01466a2ddbd6cdafaa405e2a759775df34c9b34c 100644 (file)
@@ -201,6 +201,12 @@ namespace TagLib {
        * Returns a list of pictures attached to the FLAC file.
        */
       List<Picture *> 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.