Commits

shuerhaaken committed 7125741

refactor

  • Participants
  • Parent commits 38804c3

Comments (0)

Files changed (33)

bindings/c/taginfo_c.h

 //! TagInfo_Info is an abstraction for accessing media file tags. 
 //! The caller should destroy TagInfo_Info with taginfo_info_free() after usage. Internal data will then automatically be removed.
 typedef struct { 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-    int dummy; 
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+    //#ifndef DOXYGEN_SHOULD_SKIP_THIS
+    //int dummy; 
+    //#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 } TagInfo_Info;
 
 

bindings/vala/libtaginfo_c.vapi

 		public uint8[]          data;
 		public ImageType        image_type;
 		public ImageFileType    image_file_type;
-		public char*            description;
+		public string           description;
 	}
-
+	
 	[Compact]
 	[CCode (free_function = "taginfo_info_free")]
 	protected class Info

libtaginfo/aiffinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::RIFF::AIFF::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new RIFF::AIFF::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagId3v2 = ((TagLib::RIFF::AIFF::File *) taglib_file)->tag();
+        taglib_tagId3v2 = ((RIFF::AIFF::File *) taglib_file)->tag();
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) { 
             // Use fallback for id3v1 or extended header
             taglib_tag = taglib_file->tag();

libtaginfo/apeinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::APE::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new APE::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_apetag = ((TagLib::APE::File *) taglib_file)->APETag(true);
+        taglib_apetag = ((APE::File *) taglib_file)->APETag(true);
         if(!taglib_apetag || taglib_apetag->isEmpty()) { // Use fallback
-            taglib_tag = ((TagLib::APE::File *) taglib_file)->tag();
+            taglib_tag = ((APE::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/apetaginfo.cc

 
 
 
-void set_item(TagLib::APE::Tag * apetag, const char * key, const String &value, bool replace = true) {
+void set_item(APE::Tag * apetag, const char * key, const String &value, bool replace = true) {
     apetag->removeItem(key);
     if(!value.isEmpty())
         apetag->addValue(key, value, replace);
 }
 
-void extract_image(const TagLib::APE::Item &image_item, Image *& image) {
+void extract_image(const APE::Item &image_item, Image *& image) {
     image->image_file_type = IMAGE_FILE_TYPE_UNKNOWN;
     image->description = NULL; // description not supported in APE tags!
-    if(image_item.type() == TagLib::APE::Item::Binary) {
-        TagLib::ByteVector CoverData = image_item.binaryData();
+    if(image_item.type() == APE::Item::Binary) {
+        ByteVector CoverData = image_item.binaryData();
         if(CoverData.size() > 0) {
             image->data_length = CoverData.size();
             image->data = new char[image->data_length];
     if(Info::load()) {
         if(taglib_apetag && !taglib_apetag->isEmpty()) {
             if(!taglib_tag)
-                load_base_tags((TagLib::Tag *)taglib_apetag);
+                load_base_tags((Tag *)taglib_apetag);
             if(taglib_apetag->itemListMap().contains(APE_TAG_COMPOSER)) {
                 composer = taglib_apetag->itemListMap()[APE_TAG_COMPOSER].toStringList().front();
             }
                 set_item(taglib_apetag, ARTIST_LABELS, artist_labels_string, true);
             if(changedflag & CHANGED_ALBUM_LABELS)
                 set_item(taglib_apetag, ALBUM_LABELS, album_labels_string, true);
-            save_base_tags((TagLib::Tag *)taglib_apetag);
+            save_base_tags((Tag *)taglib_apetag);
         }
     }
     return Info::save();
             if(!images[p]->data || images[p]->data_length == 0)
                 continue;
             
-            ByteVector ImgData = ByteVector((TagLib::uint) images[p]->data_length);
+            ByteVector ImgData = ByteVector((uint) images[p]->data_length);
             memcpy(ImgData.data(), images[p]->data, images[p]->data_length);
             
             APE::Item imageItem = APE::Item();
-            imageItem.setType(TagLib::APE::Item::Binary);
+            imageItem.setType(APE::Item::Binary);
             String key = image_type_to_ape_image_name(images[p]->image_type);
             imageItem.setKey(key);
             imageItem.setBinaryData(ImgData);

libtaginfo/asfinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::ASF::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new ASF::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        asf_tag = ((TagLib::ASF::File *) taglib_file)->tag();
+        asf_tag = ((ASF::File *) taglib_file)->tag();
         if(!asf_tag)
             valid = false;
     }
 bool AsfInfo::load(void) {
     if(Info::load()) {
         if(asf_tag) {
-            load_base_tags((TagLib::Tag *)asf_tag);
+            load_base_tags((Tag *)asf_tag);
             
             if(asf_tag->attributeListMap().contains(VOLUME_NUMBER) && !asf_tag->attributeListMap()[ VOLUME_NUMBER ].isEmpty()) {
                 StringList list = asf_tag->attributeListMap()[ VOLUME_NUMBER ].front().toString().split("/");
                 check_asf_label_frame(asf_tag, ARTIST_LABELS, artist_labels_string);
             if(changedflag & CHANGED_ALBUM_LABELS)
                 check_asf_label_frame(asf_tag, ALBUM_LABELS, album_labels_string);
-            save_base_tags((TagLib::Tag *)asf_tag);
+            save_base_tags((Tag *)asf_tag);
         }
     }
     return Info::save();
             else if(image->image_file_type == IMAGE_FILE_TYPE_BMP)
                 picture.setMimeType("image/bmp");
             
-            ByteVector ImgData = ByteVector((TagLib::uint) image->data_length);
+            ByteVector ImgData = ByteVector((uint) image->data_length);
             memcpy(ImgData.data(), image->data, image->data_length);
             if(image->description) {
                 String desc = String(image->description);

libtaginfo/flacinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::FLAC::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new FLAC::File(file_name.toCString(false), true, AudioProperties::Fast);
         if(taglib_file) {
-            flac_file = ((TagLib::FLAC::File *) taglib_file);
+            flac_file = ((FLAC::File *) taglib_file);
         }
         else {
-            printf("TagLib::File creation failed for '%s'\n", file_name.toCString(false));
+            printf("File creation failed for '%s'\n", file_name.toCString(false));
             printf("Cant get xiphcomment from '%s'\n", file_name.toCString(false));
         }
     }
         for(int p = 0; p < image_count; p++) {
             if(!images[p]->data || images[p]->data_length == 0)
                 continue;
-            ByteVector vect((TagLib::uint) images[p]->data_length);
+            ByteVector vect((uint) images[p]->data_length);
             memcpy(vect.data(), images[p]->data, images[p]->data_length);
             FLAC::Picture * picture = new FLAC::Picture();
             if(!picture) {
                 picture->setDescription(desc);
             }
             picture->setMimeType("image/jpeg"); //TODO
-            picture->setType((TagLib::FLAC::Picture::Type) images[p]->image_type);
+            picture->setType((FLAC::Picture::Type) images[p]->image_type);
             //std::cout << "pic size:" << picture->data().size() << std::endl;
             flac_file->addPicture(picture);
         }

libtaginfo/id3info.cc

 // Common stuff
 
 
-void id3v2_check_label_frame(ID3v2::Tag * tagv2, const String& description, const String &value) {
+void set_user_textid_frame(ID3v2::Tag * tagv2, const String& description, const String &value) {
     ID3v2::UserTextIdentificationFrame * frame;
     frame = ID3v2::UserTextIdentificationFrame::find(tagv2, description);
     if(!frame) {
-        frame = new ID3v2::UserTextIdentificationFrame(TagLib::String::UTF8);
-        tagv2->addFrame(frame);
+        frame = new ID3v2::UserTextIdentificationFrame();
         frame->setDescription(description);
+        tagv2->addFrame(frame);
     }
-    if(frame) {
+    if(frame)
         frame->setText(value);
-    }
 }
 
 
-TagLib::ID3v2::PopularimeterFrame * get_popularity_frame(TagLib::ID3v2::Tag * tag, const TagLib::String &email) {
-    TagLib::ID3v2::FrameList popularity_frame_list = tag->frameList("POPM");
-    for(TagLib::ID3v2::FrameList::Iterator it = popularity_frame_list.begin(); it != popularity_frame_list.end(); ++it) {
-        TagLib::ID3v2::PopularimeterFrame * popularity_frame = static_cast<TagLib::ID3v2::PopularimeterFrame *>(* it);
-        if(email.isEmpty() ||(popularity_frame->email() == email)) {
+ID3v2::PopularimeterFrame * get_popularity_frame(ID3v2::Tag * tag, const String &email) {
+    ID3v2::FrameList popularity_frame_list = tag->frameList("POPM");
+    for(ID3v2::FrameList::Iterator it = popularity_frame_list.begin(); it != popularity_frame_list.end(); ++it) {
+        ID3v2::PopularimeterFrame * popularity_frame = static_cast<ID3v2::PopularimeterFrame *>(* it);
+        if(email.isEmpty() ||(popularity_frame->email() == email))
             return popularity_frame;
-        }
     }
     return NULL;
 }
 
 
 
-TagLib::ID3v2::AttachedPictureFrame::Type image_type_to_picframetype(const ImageType& image_type) {
-    TagLib::ID3v2::AttachedPictureFrame::Type itp;
+ID3v2::AttachedPictureFrame::Type image_type_to_picframetype(const ImageType& image_type) {
     switch(image_type) {
         case IMAGE_TYPE_COVER_FRONT :
             return ID3v2::AttachedPictureFrame::FrontCover;
             return ID3v2::AttachedPictureFrame::Other;
         case IMAGE_TYPE_FILE_ICON :
             return ID3v2::AttachedPictureFrame::FileIcon;
-//            
         case IMAGE_TYPE_OTHER_FILE_ICON :
             return ID3v2::AttachedPictureFrame::OtherFileIcon;
-//            
         case IMAGE_TYPE_LEAFLET_PAGE :
             return ID3v2::AttachedPictureFrame::LeafletPage;
-//            break;
         case IMAGE_TYPE_MEDIA  :
             return ID3v2::AttachedPictureFrame::Media;
-//            break;
         case IMAGE_TYPE_LEAD_ARTIST :
             return ID3v2::AttachedPictureFrame::LeadArtist;
-//            break;
         case IMAGE_TYPE_ARTIST :
             return ID3v2::AttachedPictureFrame::Artist;
-//            break;
         case IMAGE_TYPE_CONDUCTOR :
             return ID3v2::AttachedPictureFrame::Conductor;
-//            break;
         case IMAGE_TYPE_BAND :
             return ID3v2::AttachedPictureFrame::Band;
-//            break;
         case IMAGE_TYPE_COMPOSER :
             return ID3v2::AttachedPictureFrame::Composer;
-//            break;
         case IMAGE_TYPE_LYRICIST :
             return ID3v2::AttachedPictureFrame::Lyricist;
-//            break;
         case IMAGE_TYPE_RECORDING_LOCATION :
             return ID3v2::AttachedPictureFrame::RecordingLocation;
-//            break;
         case IMAGE_TYPE_DURING_RECORDING :
             return ID3v2::AttachedPictureFrame::DuringRecording;
-//            break;
         case IMAGE_TYPE_DURING_PERFORMANCE :
             return ID3v2::AttachedPictureFrame::DuringPerformance;
-//            break;
         case IMAGE_TYPE_MOVIESCREENCAPTURE :
             return ID3v2::AttachedPictureFrame::MovieScreenCapture;
-//            break;
         case IMAGE_TYPE_COLOURED_FISH :
             return ID3v2::AttachedPictureFrame::ColouredFish;
-//            break;
         case IMAGE_TYPE_ILLUSTRATION :
             return ID3v2::AttachedPictureFrame::Illustration;
-//            break;
         case IMAGE_TYPE_ARTIST_LOGO :
             return ID3v2::AttachedPictureFrame::BandLogo;
-//            break;
         case IMAGE_TYPE_PUBLISHER_LOGO :
             return ID3v2::AttachedPictureFrame::PublisherLogo;
-//            break;
         default:
             return ID3v2::AttachedPictureFrame::Other;
-//            break;
-        return itp;
     }
 }
 
             // If its a ID3v2 Tag try to load the labels
         if(taglib_tagId3v2 && !taglib_tagId3v2->isEmpty()) {
             if(!taglib_tag)
-                load_base_tags((TagLib::Tag *)taglib_tagId3v2);
+                load_base_tags((Tag *)taglib_tagId3v2);
             if(taglib_tagId3v2->frameListMap().contains(VOLUME) && !taglib_tagId3v2->frameListMap()[VOLUME].isEmpty()) {
                 StringList list = taglib_tagId3v2->frameListMap()[ VOLUME ].front()->toString().split("/");
                 if(list.size() == 2) {
             }
             if(taglib_tagId3v2->frameListMap().contains(HOMEPAGE)) {
                 ID3v2::FrameList l = taglib_tagId3v2->frameList(HOMEPAGE);
-                TagLib::ID3v2::UserUrlLinkFrame *f = 
-                    dynamic_cast<TagLib::ID3v2::UserUrlLinkFrame *>(l.front());
+                ID3v2::UserUrlLinkFrame *f = 
+                    dynamic_cast<ID3v2::UserUrlLinkFrame *>(l.front());
                 homepage = f->url();
             }
             
-            TagLib::ID3v2::PopularimeterFrame * popularity_frame = NULL;
+            ID3v2::PopularimeterFrame * popularity_frame = NULL;
             
             popularity_frame = get_popularity_frame(taglib_tagId3v2, "LibTagInfo");
             if(!popularity_frame)
                 }
             }
             if(artist_labels.size() == 0) {
-                ID3v2::UserTextIdentificationFrame * frame = ID3v2::UserTextIdentificationFrame::find(taglib_tagId3v2, ARTIST_LABELS);
+                ID3v2::UserTextIdentificationFrame * frame = 
+                    ID3v2::UserTextIdentificationFrame::find(taglib_tagId3v2, ARTIST_LABELS);
                 if(!frame)
                     frame = ID3v2::UserTextIdentificationFrame::find(taglib_tagId3v2, "ARTISTLABELS");
                 if(frame) {
                     StringList artist_labels_list = frame->fieldList();
                     if(artist_labels_list.size()) {
-                        artist_labels_string = artist_labels_list[1];//.toCString(true);
-//std::cout << "artist_labels_string: " << artist_labels_string << std::endl;
+                        artist_labels_string = artist_labels_list[1];
                         artist_labels = split(artist_labels_string, "|");
                     }
                 }
-/*                else {
-std::cout << "NO artit label frame " << std::endl;
-                }
-*/            
             }
             if(album_labels.size() == 0) {
                 ID3v2::UserTextIdentificationFrame * frame = ID3v2::UserTextIdentificationFrame::find(taglib_tagId3v2, ALBUM_LABELS);
                 if(frame) {
                     StringList album_labels_list = frame->fieldList();
                     if(album_labels_list.size()) {
-                        album_labels_string = album_labels_list[1];//.toCString(true);
+                        album_labels_string = album_labels_list[1];
                         album_labels = split(album_labels_string, "|");
                     }
                 }
             }
             // Image availability
-            TagLib::ID3v2::FrameList frame_list = taglib_tagId3v2->frameListMap()[IMAGES];
+            ID3v2::FrameList frame_list = taglib_tagId3v2->frameListMap()[IMAGES];
             has_image =(frame_list.size() > 0); //something is there
         }
     }
 bool Id3Info::save(void) {
     if(taglib_tagId3v2) {
         if(changedflag) {
-            TagLib::ID3v2::TextIdentificationFrame * frame;
+            ID3v2::TextIdentificationFrame * frame;
             if(changedflag & CHANGED_DATA_VOL_NUM || changedflag & CHANGED_DATA_VOL_CNT) {
                 taglib_tagId3v2->removeFrames(VOLUME);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(VOLUME);
+                frame = new ID3v2::TextIdentificationFrame(VOLUME);
                 frame->setText(format("%u/%u", volume_number, volume_count));
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_COMPOSER_TAG) {
                 taglib_tagId3v2->removeFrames(COMPOSER);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(COMPOSER);
+                frame = new ID3v2::TextIdentificationFrame(COMPOSER);
                 frame->setText(composer);
                 taglib_tagId3v2->addFrame(frame);
             }
                     // prevent overwrite in save_base_tags()
                     changedflag &= ~(CHANGED_TRACK_NUMBER);
                     changedflag &= ~(CHANGED_TRACK_COUNT);
-                    frame = new TagLib::ID3v2::TextIdentificationFrame(TRACKNUMBER);
+                    frame = new ID3v2::TextIdentificationFrame(TRACKNUMBER);
                     frame->setText(format("%d/%d", track_number, track_count));
                     taglib_tagId3v2->addFrame(frame);
                 }
                 changedflag &= ~(CHANGED_TRACK_NUMBER);
                 changedflag &= ~(CHANGED_TRACK_COUNT);
                 taglib_tagId3v2->removeFrames(TRACKNUMBER);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(TRACKNUMBER);
+                frame = new ID3v2::TextIdentificationFrame(TRACKNUMBER);
                 frame->setText(format("%d/%d", track_number, track_count));
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_ORIGINALARTIST_TAG) {
                 taglib_tagId3v2->removeFrames(ORIGINAL_ARTIST);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(ORIGINAL_ARTIST);
+                frame = new ID3v2::TextIdentificationFrame(ORIGINAL_ARTIST);
                 frame->setText(original_artist);
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_DATA_ALBUMARTIST) {
                 taglib_tagId3v2->removeFrames(ALBUM_ARTIST);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(ALBUM_ARTIST);
+                frame = new ID3v2::TextIdentificationFrame(ALBUM_ARTIST);
                 frame->setText(album_artist);
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_IS_COMPILATION_TAG) {
                 taglib_tagId3v2->removeFrames(COMPILATION);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(COMPILATION);
+                frame = new ID3v2::TextIdentificationFrame(COMPILATION);
                 if(is_compilation)
                     frame->setText("1");
                 else
                     frame->setText("0");
                 taglib_tagId3v2->addFrame(frame);
             }
-            TagLib::ID3v2::PopularimeterFrame * popularity_frame;
+            ID3v2::PopularimeterFrame * popularity_frame;
             if(changedflag & CHANGED_DATA_RATING) {
                 popularity_frame = get_popularity_frame(taglib_tagId3v2, "LibTagInfo");
                 if(!popularity_frame) {
-                    popularity_frame = new TagLib::ID3v2::PopularimeterFrame();
+                    popularity_frame = new ID3v2::PopularimeterFrame();
                     taglib_tagId3v2->addFrame(popularity_frame);
                     popularity_frame->setEmail("LibTagInfo");
                 }
                 if(!popularity_frame)
                     popularity_frame = get_popularity_frame(taglib_tagId3v2, "LibTagInfo");
                 if(!popularity_frame) {
-                    popularity_frame = new TagLib::ID3v2::PopularimeterFrame();
+                    popularity_frame = new ID3v2::PopularimeterFrame();
                     taglib_tagId3v2->addFrame(popularity_frame);
                     popularity_frame->setEmail("LibTagInfo");
                 }
             
             if(changedflag & CHANGED_COPYRIGHT_TAG) {
                 taglib_tagId3v2->removeFrames(COPYRIGHT);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(COPYRIGHT);
+                frame = new ID3v2::TextIdentificationFrame(COPYRIGHT);
                 frame->setText(copyright);
                 taglib_tagId3v2->addFrame(frame);
             }
             if(changedflag & CHANGED_ENCODER_TAG) {
                 taglib_tagId3v2->removeFrames(ENCODER);
-                frame = new TagLib::ID3v2::TextIdentificationFrame(ENCODER);
+                frame = new ID3v2::TextIdentificationFrame(ENCODER);
                 frame->setText(encoder);
                 taglib_tagId3v2->addFrame(frame);
             }
             
             // The Labels
             if(changedflag & CHANGED_TRACK_LABELS)
-                id3v2_check_label_frame(taglib_tagId3v2, TRACK_LABELS, track_labels_string);
+                set_user_textid_frame(taglib_tagId3v2, TRACK_LABELS, track_labels_string);
             if(changedflag & CHANGED_ARTIST_LABELS)
-                id3v2_check_label_frame(taglib_tagId3v2, ARTIST_LABELS, artist_labels_string);
+                set_user_textid_frame(taglib_tagId3v2, ARTIST_LABELS, artist_labels_string);
             if(changedflag & CHANGED_ALBUM_LABELS)
-                id3v2_check_label_frame(taglib_tagId3v2, ALBUM_LABELS, album_labels_string);
+                set_user_textid_frame(taglib_tagId3v2, ALBUM_LABELS, album_labels_string);
             
-            save_base_tags((TagLib::Tag *)taglib_tagId3v2);
+            save_base_tags((Tag *)taglib_tagId3v2);
         }
     }
     return Info::save();
 }
 
 ImageType get_image_type_from_pic_frame_type(const ID3v2::AttachedPictureFrame::Type &tpe) {
-    ImageType itp;
     switch(tpe) {
-        case TagLib::ID3v2::AttachedPictureFrame::FrontCover:
+        case ID3v2::AttachedPictureFrame::FrontCover:
             return IMAGE_TYPE_COVER_FRONT;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::BackCover:
+        case ID3v2::AttachedPictureFrame::BackCover:
             return IMAGE_TYPE_COVER_BACK;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Other:
+        case ID3v2::AttachedPictureFrame::Other:
             return IMAGE_TYPE_OTHER;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::FileIcon:
+        case ID3v2::AttachedPictureFrame::FileIcon:
             return IMAGE_TYPE_FILE_ICON;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::OtherFileIcon:
+        case ID3v2::AttachedPictureFrame::OtherFileIcon:
             return IMAGE_TYPE_OTHER_FILE_ICON;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::LeafletPage:
+        case ID3v2::AttachedPictureFrame::LeafletPage:
             return IMAGE_TYPE_LEAFLET_PAGE;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Media:
+        case ID3v2::AttachedPictureFrame::Media:
             return IMAGE_TYPE_MEDIA;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::LeadArtist:
+        case ID3v2::AttachedPictureFrame::LeadArtist:
             return IMAGE_TYPE_LEAD_ARTIST;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Artist:
+        case ID3v2::AttachedPictureFrame::Artist:
             return IMAGE_TYPE_ARTIST;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Conductor:
+        case ID3v2::AttachedPictureFrame::Conductor:
             return IMAGE_TYPE_CONDUCTOR;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Band:
+        case ID3v2::AttachedPictureFrame::Band:
             return IMAGE_TYPE_BAND;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Composer:
+        case ID3v2::AttachedPictureFrame::Composer:
             return IMAGE_TYPE_COMPOSER;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Lyricist:
+        case ID3v2::AttachedPictureFrame::Lyricist:
             return IMAGE_TYPE_LYRICIST;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::RecordingLocation:
+        case ID3v2::AttachedPictureFrame::RecordingLocation:
             return IMAGE_TYPE_RECORDING_LOCATION;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::DuringRecording:
+        case ID3v2::AttachedPictureFrame::DuringRecording:
             return IMAGE_TYPE_DURING_RECORDING;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::DuringPerformance:
+        case ID3v2::AttachedPictureFrame::DuringPerformance:
             return IMAGE_TYPE_DURING_PERFORMANCE;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::MovieScreenCapture:
+        case ID3v2::AttachedPictureFrame::MovieScreenCapture:
             return IMAGE_TYPE_MOVIESCREENCAPTURE;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::ColouredFish:
+        case ID3v2::AttachedPictureFrame::ColouredFish:
             return IMAGE_TYPE_COLOURED_FISH;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::Illustration:
+        case ID3v2::AttachedPictureFrame::Illustration:
             return IMAGE_TYPE_ILLUSTRATION;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::BandLogo:
+        case ID3v2::AttachedPictureFrame::BandLogo:
             return IMAGE_TYPE_ARTIST_LOGO;
-            
-        case TagLib::ID3v2::AttachedPictureFrame::PublisherLogo:
+        case ID3v2::AttachedPictureFrame::PublisherLogo:
             return IMAGE_TYPE_PUBLISHER_LOGO;
-            
         default:
             return IMAGE_TYPE_OTHER;
-            
     }
-    return itp;
 }
 
 Image ** Id3Info::get_images(int &image_count) const {
     if(taglib_tagId3v2) {
         Image** images;
-        TagLib::ID3v2::FrameList framelist = taglib_tagId3v2->frameListMap()[IMAGES];
-        TagLib::ID3v2::AttachedPictureFrame * pic_frame = NULL;
+        ID3v2::FrameList framelist = taglib_tagId3v2->frameListMap()[IMAGES];
+        ID3v2::AttachedPictureFrame * pic_frame = NULL;
         int cnt = framelist.size();
         images = new Image*[cnt];
         int i = 0;
-        for(list<TagLib::ID3v2::Frame*>::iterator iter = framelist.begin(); iter != framelist.end(); iter++) {
-            pic_frame = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(*iter);
+        for(list<ID3v2::Frame*>::iterator iter = framelist.begin(); iter != framelist.end(); iter++) {
+            pic_frame = static_cast<ID3v2::AttachedPictureFrame *>(*iter);
             Image * image = new Image();
-//            cout << "image_type_to_picframetype(get_image_type_from_pic_frame_type(pic_frame->type()))" << image_type_to_picframetype(get_image_type_from_pic_frame_type(pic_frame->type())) << endl;
             image->image_type = get_image_type_from_pic_frame_type(pic_frame->type());
             if(image) {
                 if(pic_frame->picture().size() > 0) {
                         image->image_file_type = IMAGE_FILE_TYPE_GIF;
                     else if(mimetype.find("/bmp") != -1)
                         image->image_file_type = IMAGE_FILE_TYPE_BMP;
-                    image->description = ::strdup(pic_frame->description().toCString(true));
+                    image->description = ::strdup(pic_frame->description().toCString(false));
                 }
                 if(image->data && image->data_length > 0) {
                     images[i] = image;
 
 void Id3Info::set_images(const Image ** images, const int image_count) {
     if(taglib_tagId3v2) {
-        TagLib::ID3v2::AttachedPictureFrame * PicFrame = NULL;
-        TagLib::ID3v2::FrameList frameList = taglib_tagId3v2->frameListMap()[IMAGES];
+        ID3v2::AttachedPictureFrame * PicFrame = NULL;
+        ID3v2::FrameList frameList = taglib_tagId3v2->frameListMap()[IMAGES];
         for(int p = 0; p < image_count; p++) {
             if(!images[p] || !images[p]->data || images[p]->data_length == 0)
                 continue;
             
-            for(list<TagLib::ID3v2::Frame*>::iterator iter = frameList.begin(); iter != frameList.end(); iter++) {
-                PicFrame = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(*iter);
+            for(list<ID3v2::Frame*>::iterator iter = frameList.begin(); iter != frameList.end(); iter++) {
+                PicFrame = static_cast<ID3v2::AttachedPictureFrame *>(*iter);
                 if((PicFrame->type() == image_type_to_picframetype(images[p]->image_type)))
                     taglib_tagId3v2->removeFrame(PicFrame, true);
             }
-            
-            PicFrame = new TagLib::ID3v2::AttachedPictureFrame;
+            PicFrame = new ID3v2::AttachedPictureFrame;
             if(images[p]->image_file_type == IMAGE_FILE_TYPE_JPEG || 
                images[p]->image_file_type == IMAGE_FILE_TYPE_UNKNOWN) //default to jpeg
                 PicFrame->setMimeType("image/jpeg");
                 PicFrame->setMimeType("image/bmp");
             PicFrame->setType(image_type_to_picframetype(images[p]->image_type));
             if(images[p]->description) {
-                const char* ds = ::strdup(images[p]->description);
-                String desc = String(ds);
+                String desc = String(::strdup(images[p]->description));
                 PicFrame->setDescription(desc);
             }
-            ByteVector ImgData((TagLib::uint) images[p]->data_length);
+            ByteVector ImgData((uint) images[p]->data_length);
             memcpy(ImgData.data(), images[p]->data, images[p]->data_length);
             PicFrame->setPicture(ImgData);
             taglib_tagId3v2->addFrame(PicFrame);
 
 String Id3Info::get_lyrics(void) const {
     if(taglib_tagId3v2) {
-        TagLib::ID3v2::FrameList frameList = taglib_tagId3v2->frameList(LYRICS);
+        ID3v2::FrameList frameList = taglib_tagId3v2->frameList(LYRICS);
         if(!frameList.isEmpty()) {
-            TagLib::ID3v2::UnsynchronizedLyricsFrame * lyrics_frame = 
-                static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame * >(frameList.front());
+            ID3v2::UnsynchronizedLyricsFrame * lyrics_frame = 
+                static_cast<ID3v2::UnsynchronizedLyricsFrame * >(frameList.front());
             if(lyrics_frame)
                 return lyrics_frame->text();
         }
 
 bool Id3Info::set_lyrics(const String &lyrics) {
     if(taglib_tagId3v2) {
-        TagLib::ID3v2::UnsynchronizedLyricsFrame * lyrics_frame;
-        TagLib::ID3v2::FrameList frameList = taglib_tagId3v2->frameListMap()[LYRICS];
-        for(list<TagLib::ID3v2::Frame*>::iterator iter = frameList.begin(); iter != frameList.end(); iter++) {
-            lyrics_frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*iter);
+        ID3v2::UnsynchronizedLyricsFrame * lyrics_frame;
+        ID3v2::FrameList frameList = taglib_tagId3v2->frameListMap()[LYRICS];
+        for(list<ID3v2::Frame*>::iterator iter = frameList.begin(); iter != frameList.end(); iter++) {
+            lyrics_frame = static_cast<ID3v2::UnsynchronizedLyricsFrame*>(*iter);
             taglib_tagId3v2->removeFrame(lyrics_frame, true);
         }
         if(!lyrics.isEmpty()) {
-            lyrics_frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame(TagLib::String::UTF8);
+            lyrics_frame = new ID3v2::UnsynchronizedLyricsFrame();
             lyrics_frame->setText(lyrics);
             taglib_tagId3v2->addFrame(lyrics_frame);
         }

libtaginfo/info.cc

  * \return the according Info subclass
  * \param filename is the path to a media file.
  * \param mime_type is the mime type of the media file (e.g. "audio/x-vorbis+ogg") 
- * as TagLib::String.
+ * as String.
  */
 Info * Info::create_from_mime(const String &filename, const String &mime_type) {
     MediaFileType format = MEDIA_FILE_TYPE_UNKNOWN;
 }
 
 
-void Info::load_base_tags(TagLib::Tag * tag) {
+void Info::load_base_tags(Tag * tag) {
     if(tag) {
         title        = tag->title();
         artist       = tag->artist();
 }
 
 
-void Info::save_base_tags(TagLib::Tag * tag) {
+void Info::save_base_tags(Tag * tag) {
     if(changedflag & CHANGED_TITLE_TAG)
         tag->setTitle(title);
     if(changedflag & CHANGED_ARTIST_TAG)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_title is a TagLib::String.
+\param new_title is a String.
 */
 void Info::set_title(const String new_title) {
     title = new_title;
 }
 //! Get the title of a media track.
 /*!
-\return The title as %TagLib::String
+\return The title as %String
 */
 String Info::get_title() const {
     if(String::null != title)
 }
 //! Get the genre of a media track.
 /*!
-\return The genre as TagLib::String
+\return The genre as String
 */
 String Info::get_genre() const {
     if(String::null != genre)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_artist as TagLib::String
+\param new_artist as String
 */
 void Info::set_artist(const String new_artist) {
     artist = new_artist;
 }
 //! Get the artist tag of a media track.
 /*!
-\return The artist tag as TagLib::String
+\return The artist tag as String
 */
 String Info::get_artist() const {
     if(String::null != artist)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_artist as TagLib::String
+\param new_artist as String
 */
 void Info::set_original_artist (const String new_artist) {
     original_artist = new_artist;
 }
 //! Get the original artist tag of a media track.
 /*!
-\return The original artist tag as TagLib::String
+\return The original artist tag as String
 */
 String Info::get_original_artist() const {
     if(String::null != original_artist)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_encoder as TagLib::String
+\param new_encoder as String
 */
 void Info::set_encoder(const String new_encoder) {
     encoder = new_encoder;
 }
 //! Get the encoder tag of a media track.
 /*!
-\return The encoder tag as TagLib::String
+\return The encoder tag as String
 */
 String Info::get_encoder() const {
     if(String::null != encoder)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_homepage as TagLib::String
+\param new_homepage as String
 */
 void Info::set_homepage(const String new_homepage) {
     homepage = new_homepage;
 }
 //! Get the homepage tag of a media track.
 /*!
-\return The homepage tag as TagLib::String
+\return The homepage tag as String
 */
 String Info::get_homepage() const {
     if(String::null != homepage)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_copyright as TagLib::String
+\param new_copyright as String
 */
 void Info::set_copyright(const String new_copyright) {
     copyright = new_copyright;
 }
 //! Get the copyright tag of a media track.
 /*!
-\return The copyright tag as TagLib::String
+\return The copyright tag as String
 */
 String Info::get_copyright() const {
     if(String::null != copyright)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_album_artist as TagLib::String
+\param new_album_artist as String
 */
 void Info::set_album_artist(const String new_album_artist) {
     album_artist = new_album_artist;
 }
 //! Get the album artist tag of a media track.
 /*!
-\return The album artist tag as TagLib::String
+\return The album artist tag as String
 */
 String Info::get_album_artist() const {
     if(String::null != album_artist)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_album as TagLib::String
+\param new_album as String
 */
 void Info::set_album(const String new_album) {
     album = new_album;
 }
 //! Get the album tag of a media track.
 /*!
-\return The album tag as TagLib::String
+\return The album tag as String
 */
 String Info::get_album() const {
     if(String::null != album)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_composer as TagLib::String
+\param new_composer as String
 */
 void Info::set_composer(const String new_composer) {
     composer = new_composer;
 }
 //! Get the composer tag of a media track.
 /*!
-\return The composer tag as TagLib::String
+\return The composer tag as String
 */
 String Info::get_composer() const {
     if(String::null != composer)
 //! This function will set the according ChangedData flag
 //! This will not be saved to file before save() is called on the Info object.
 /*!
-\param new_comments as TagLib::String
+\param new_comments as String
 */
 void Info::set_comments(const String new_comments) {
     comments = new_comments.stripWhiteSpace();
 }
 //! Get the comments tag of a media track.
 /*!
-\return The comments tag as TagLib::String
+\return The comments tag as String
 */
 String Info::get_comments(void) const {
     if(String::null != comments)

libtaginfo/itinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::IT::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new IT::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagMod = (TagLib::Mod::Tag *)((TagLib::IT::File *) taglib_file)->tag();
+        taglib_tagMod = (Mod::Tag *)((IT::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
-            taglib_tag = ((TagLib::IT::File *) taglib_file)->tag();
+            taglib_tag = ((IT::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/modtaginfo.cc

     if(Info::load()) {
         if(taglib_tagMod && !taglib_tagMod->isEmpty()) {
             if(!taglib_tag)
-                load_base_tags((TagLib::Tag *)taglib_tagMod);
+                load_base_tags((Tag *)taglib_tagMod);
         }
     }
     else {
 bool ModTagInfo::save(void) {
     if(taglib_tagMod) {
         if(changedflag) {
-            save_base_tags((TagLib::Tag *)taglib_tagMod);
+            save_base_tags((Tag *)taglib_tagMod);
         }
     }
     return Info::save();

libtaginfo/mp3info.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::MPEG::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new MPEG::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagId3v2 = ((TagLib::MPEG::File *) taglib_file)->ID3v2Tag(true);
+        taglib_tagId3v2 = ((MPEG::File *) taglib_file)->ID3v2Tag(true);
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) { 
             // Use fallback for id3v1 or extended header
             //printf("Use mp3 fallback! %s\n", filename.c_str());
-            taglib_tag = ((TagLib::MPEG::File *) taglib_file)->tag();
+            taglib_tag = ((MPEG::File *) taglib_file)->tag();
             if(!taglib_tag) {
-                taglib_fileref = new TagLib::FileRef(filename.toCString(false),
-                                                     true, TagLib::AudioProperties::Fast);
+                taglib_fileref = new FileRef(filename.toCString(false),
+                                                     true, AudioProperties::Fast);
                 taglib_tag = taglib_fileref->tag();
             }
             if(!taglib_tag) {

libtaginfo/mp4info.cc

         valid = false;
         printf("File name empty!\n");
     } else {
-        taglib_file = new TagLib::MP4::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new MP4::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        mp4_tag = ((TagLib::MP4::File *) taglib_file)->tag();
+        mp4_tag = ((MP4::File *) taglib_file)->tag();
         if(!mp4_tag || mp4_tag->isEmpty()) {
             if(!mp4_tag)
                 printf("Mp4tag null for %s\n", filename.toCString(false));
             if(!taglib_tag)
                 taglib_tag = taglib_file->tag();
             if(!taglib_tag) {
-                taglib_fileref = new TagLib::FileRef(filename.toCString(false),
-                                                     true, TagLib::AudioProperties::Fast);
+                taglib_fileref = new FileRef(filename.toCString(false),
+                                                     true, AudioProperties::Fast);
                 taglib_tag = taglib_fileref->tag();
             }
             if(!taglib_tag) {
     if(Info::load()) {
         if(mp4_tag && !mp4_tag->isEmpty()) {
             if(!taglib_tag)
-                load_base_tags((TagLib::Tag *)mp4_tag);
+                load_base_tags((Tag *)mp4_tag);
             if(mp4_tag->itemListMap().contains("aART")) {
                 album_artist = mp4_tag->itemListMap()["aART"].toStringList().front();
             }
                 }
             }
             if(mp4_tag->itemListMap().contains("covr")) {
-                TagLib::MP4::CoverArtList covers = mp4_tag->itemListMap()[ "covr" ].toCoverArtList();
+                MP4::CoverArtList covers = mp4_tag->itemListMap()[ "covr" ].toCoverArtList();
                 has_image = (covers.size() > 0);
             }
             return true;
 }
 
 
-void mp4_check_label_frame(TagLib::MP4::Tag * mp4tag, const char * description, const String &value) {
+void mp4_check_label_frame(MP4::Tag * mp4tag, const char * description, const String &value) {
     if(mp4tag->itemListMap().contains(description)) {
             if(!value.isEmpty()) {
-            mp4tag->itemListMap()[ description ] = TagLib::MP4::Item(TagLib::StringList(value));
+            mp4tag->itemListMap()[ description ] = MP4::Item(StringList(value));
         }
         else {
             mp4tag->itemListMap().erase(description);
     }
     else {
             if(!value.isEmpty()) {
-            mp4tag->itemListMap().insert(description, TagLib::MP4::Item(TagLib::StringList(value)));
+            mp4tag->itemListMap().insert(description, MP4::Item(StringList(value)));
         }
     }
 }
     if(mp4_tag) {
         if(changedflag) {
             if(changedflag & CHANGED_DATA_ALBUMARTIST)
-                mp4_tag->itemListMap()["aART"] = TagLib::StringList(album_artist);
+                mp4_tag->itemListMap()["aART"] = StringList(album_artist);
             if(changedflag & CHANGED_COMPOSER_TAG)
-                mp4_tag->itemListMap()["\xA9wrt"] = TagLib::StringList(composer);
+                mp4_tag->itemListMap()["\xA9wrt"] = StringList(composer);
             if(changedflag & CHANGED_ORIGINALARTIST_TAG)
-                mp4_tag->itemListMap()["\xa9prf"] = TagLib::StringList(original_artist);
+                mp4_tag->itemListMap()["\xa9prf"] = StringList(original_artist);
             if(changedflag & CHANGED_TRACK_NUMBER) {
                 if(!(changedflag & CHANGED_TRACK_COUNT)) {
                     // prevent overwrite in save_base_tags()
                     // prevent overwrite in save_base_tags()
                     changedflag &= ~(CHANGED_TRACK_NUMBER);
                     changedflag &= ~(CHANGED_TRACK_COUNT);
-                    mp4_tag->itemListMap()["trkn"] = TagLib::MP4::Item(track_number, track_count);
+                    mp4_tag->itemListMap()["trkn"] = MP4::Item(track_number, track_count);
                 }
             }
             if(changedflag & CHANGED_TRACK_COUNT) {
                 // prevent overwrite in save_base_tags()
                 changedflag &= ~(CHANGED_TRACK_NUMBER);
                 changedflag &= ~(CHANGED_TRACK_COUNT);
-                mp4_tag->itemListMap()["trkn"] = TagLib::MP4::Item(track_number, track_count);
+                mp4_tag->itemListMap()["trkn"] = MP4::Item(track_number, track_count);
             }
             if(changedflag & CHANGED_DATA_VOL_NUM) {
-                mp4_tag->itemListMap()["disk"] = TagLib::MP4::Item(volume_number, volume_count);
+                mp4_tag->itemListMap()["disk"] = MP4::Item(volume_number, volume_count);
             }
             if(changedflag & CHANGED_IS_COMPILATION_TAG)
-                mp4_tag->itemListMap()["cpil"] = TagLib::MP4::Item(is_compilation);
+                mp4_tag->itemListMap()["cpil"] = MP4::Item(is_compilation);
             if(changedflag & CHANGED_DATA_RATING) {
                 mp4_tag->itemListMap()["----:com.apple.iTunes:RATING" ] =
-                    TagLib::MP4::Item(format("%u", rating_to_popularity(rating)));
+                    MP4::Item(format("%u", rating_to_popularity(rating)));
                 
             }
             if(changedflag & CHANGED_DATA_PLAYCOUNT) {
                 mp4_tag->itemListMap()[ "----:com.apple.iTunes:PLAY_COUNTER" ] =
-                    TagLib::MP4::Item(format("%u", playcount));
+                    MP4::Item(format("%u", playcount));
             }
             // The Labels
             if(changedflag & CHANGED_ARTIST_LABELS)
             
             
             if(changedflag & CHANGED_COPYRIGHT_TAG)
-                mp4_tag->itemListMap()["\xa9" "cpy"] = TagLib::StringList(copyright);
+                mp4_tag->itemListMap()["\xa9" "cpy"] = StringList(copyright);
             if(changedflag & CHANGED_ENCODER_TAG)
-                mp4_tag->itemListMap()["\xa9too"] = TagLib::StringList(encoder);
+                mp4_tag->itemListMap()["\xa9too"] = StringList(encoder);
             if(changedflag & CHANGED_HOMEPAGE_TAG)
-                mp4_tag->itemListMap()["\xa9src"] = TagLib::StringList(homepage);
+                mp4_tag->itemListMap()["\xa9src"] = StringList(homepage);
             
-            save_base_tags((TagLib::Tag *)mp4_tag);
+            save_base_tags((Tag *)mp4_tag);
         }
     }
     return Info::save();
 }
 
 
-ImageFileType get_image_file_type_from_format(TagLib::MP4::CoverArt::Format format) {
+ImageFileType get_image_file_type_from_format(MP4::CoverArt::Format format) {
     switch(format) {
         case MP4::CoverArt::JPEG:
             return IMAGE_FILE_TYPE_JPEG;
     }
 }
 
-TagLib::MP4::CoverArt::Format get_format_from_image_file_type(ImageFileType image_file_type) {
+MP4::CoverArt::Format get_format_from_image_file_type(ImageFileType image_file_type) {
     switch(image_file_type) {
         case IMAGE_FILE_TYPE_JPEG:
             return MP4::CoverArt::JPEG;
     if(mp4_tag) {
         Image** images;
         if(mp4_tag && mp4_tag->itemListMap().contains("covr")) {
-            TagLib::MP4::CoverArtList covers = mp4_tag->itemListMap()[ "covr" ].toCoverArtList();
+            MP4::CoverArtList covers = mp4_tag->itemListMap()[ "covr" ].toCoverArtList();
             int cnt = covers.size();
             images = new Image*[cnt];
             Image * image = NULL;
             int i = 0;
-            for(TagLib::MP4::CoverArtList::Iterator it = covers.begin(); it != covers.end(); it++) {
+            for(MP4::CoverArtList::Iterator it = covers.begin(); it != covers.end(); it++) {
                 image = new Image();
                 image->image_type = IMAGE_TYPE_OTHER;
                 image->data_length = it->data().size();
         if(mp4_tag->itemListMap().contains("covr")) {
             mp4_tag->itemListMap().erase("covr");
         }
-        TagLib::MP4::CoverArtList cover_list;
+        MP4::CoverArtList cover_list;
         for(int p = 0; p < image_count; p++) {
             const Image * image = images[p];
             if(image->data && image->data_length > 0) {
-                ByteVector image_data((TagLib::uint) image->data_length);
+                ByteVector image_data((uint) image->data_length);
                 memcpy(image_data.data(), image->data, image->data_length);
-                TagLib::MP4::CoverArt::Format format = get_format_from_image_file_type(image->image_file_type);
-                TagLib::MP4::CoverArt cover(format, image_data);
+                MP4::CoverArt::Format format = get_format_from_image_file_type(image->image_file_type);
+                MP4::CoverArt cover(format, image_data);
                 cover_list.append(cover);
             }
         }
             mp4_tag->itemListMap().erase("\xa9lyr");
         }
         if(!lyrics.isEmpty()) {
-            mp4_tag->itemListMap()[ "\xa9lyr" ] = TagLib::StringList(lyrics);
+            mp4_tag->itemListMap()[ "\xa9lyr" ] = StringList(lyrics);
         }
         return true;
     }

libtaginfo/mpcinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::MPC::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new MPC::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_apetag = ((TagLib::MPC::File *) taglib_file)->APETag();
+        taglib_apetag = ((MPC::File *) taglib_file)->APETag();
         if(!taglib_apetag || taglib_apetag->isEmpty()) { // Use fallback for id3v1 or extended header
             //printf("Use fallback! %s\n", filename.c_str());
-            taglib_tag = ((TagLib::MPC::File *) taglib_file)->tag();
+            taglib_tag = ((MPC::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/ogginfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::Ogg::Vorbis::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new Ogg::Vorbis::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        xiphcomment = ((TagLib::Ogg::Vorbis::File *) taglib_file)->tag();
+        xiphcomment = ((Ogg::Vorbis::File *) taglib_file)->tag();
         if(!xiphcomment || xiphcomment->isEmpty()) {
-            taglib_tag = ((TagLib::Ogg::Vorbis::File *) taglib_file)->tag();
+            taglib_tag = ((Ogg::Vorbis::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/opusinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::Ogg::Opus::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new Ogg::Opus::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        xiphcomment = ((TagLib::Ogg::Opus::File *) taglib_file)->tag();
+        xiphcomment = ((Ogg::Opus::File *) taglib_file)->tag();
         if(!xiphcomment || xiphcomment->isEmpty()) {
-            taglib_tag = ((TagLib::Ogg::Opus::File *) taglib_file)->tag();
+            taglib_tag = ((Ogg::Opus::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/s3minfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::S3M::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new S3M::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagMod = (TagLib::Mod::Tag *)((TagLib::S3M::File *) taglib_file)->tag();
+        taglib_tagMod = (Mod::Tag *)((S3M::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
-            taglib_tag = ((TagLib::S3M::File *) taglib_file)->tag();
+            taglib_tag = ((S3M::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/speexinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::Ogg::Speex::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new Ogg::Speex::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        xiphcomment = ((TagLib::Ogg::Speex::File *) taglib_file)->tag();
+        xiphcomment = ((Ogg::Speex::File *) taglib_file)->tag();
         if(!xiphcomment || xiphcomment->isEmpty()) {
-            taglib_tag = ((TagLib::Ogg::Speex::File *) taglib_file)->tag();
+            taglib_tag = ((Ogg::Speex::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/taginfo_internal.h

 
 
 inline int popularity_to_rating(const int rating) {
-    if(rating < 0)
-        return 0;
-    if(rating == 0)
+    if(rating <= 0)
         return 0;
     if(rating < 64)
         return 1;

libtaginfo/trueaudioinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::TrueAudio::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new TrueAudio::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagId3v2 = ((TagLib::TrueAudio::File *) taglib_file)->ID3v2Tag(true);
+        taglib_tagId3v2 = ((TrueAudio::File *) taglib_file)->ID3v2Tag(true);
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) { // Use fallback for id3v1 or extended header
             //printf("Use fallback! %s\n", filename.toCString(false));
-            taglib_tag = ((TagLib::TrueAudio::File *) taglib_file)->tag();
+            taglib_tag = ((TrueAudio::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/waveinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::RIFF::WAV::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new RIFF::WAV::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagId3v2 = (TagLib::ID3v2::Tag *)((TagLib::RIFF::WAV::File *) taglib_file)->tag();
+        taglib_tagId3v2 = (ID3v2::Tag *)((RIFF::WAV::File *) taglib_file)->tag();
         if(!taglib_tagId3v2 || taglib_tagId3v2->isEmpty()) {
             // Use fallback for id3v1 or extended header
-            taglib_tag = ((TagLib::RIFF::WAV::File *) taglib_file)->tag();
+            taglib_tag = ((RIFF::WAV::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/wavpackinfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::WavPack::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new WavPack::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_apetag = ((TagLib::WavPack::File *) taglib_file)->APETag(true);
+        taglib_apetag = ((WavPack::File *) taglib_file)->APETag(true);
         if(!taglib_apetag || taglib_apetag->isEmpty()) {
-            taglib_tag = ((TagLib::WavPack::File *) taglib_file)->tag();
+            taglib_tag = ((WavPack::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

libtaginfo/xiphinfo.cc

     if(Info::load()) {
         if(xiphcomment && !xiphcomment->isEmpty()) {
             if(!taglib_tag)
-                load_base_tags((TagLib::Tag *)xiphcomment);
+                load_base_tags((Tag *)xiphcomment);
             
             if(xiphcomment->fieldListMap().contains(COMPOSER)) {
                 composer = xiphcomment->fieldListMap()[COMPOSER].front();
             if(changedflag & CHANGED_HOMEPAGE_TAG)
                 xiphcomment->addField(LICENSE, homepage, true);
             
-            save_base_tags((TagLib::Tag *)xiphcomment);
+            save_base_tags((Tag *)xiphcomment);
         }
     }
     return Info::save();

libtaginfo/xminfo.cc

         printf("File name empty!\n");
     }
     else {
-        taglib_file = new TagLib::XM::File(file_name.toCString(false), true, TagLib::AudioProperties::Fast);
+        taglib_file = new XM::File(file_name.toCString(false), true, AudioProperties::Fast);
     }
     if(taglib_file) {
-        taglib_tagMod = (TagLib::Mod::Tag *)((TagLib::XM::File *) taglib_file)->tag();
+        taglib_tagMod = (Mod::Tag *)((XM::File *) taglib_file)->tag();
         if(!taglib_tagMod || taglib_tagMod->isEmpty()) { 
-            taglib_tag = ((TagLib::XM::File *) taglib_file)->tag();
+            taglib_tag = ((XM::File *) taglib_file)->tag();
             if(!taglib_tag) {
                 printf("Cant get tag object from '%s'\n", file_name.toCString(false));
                 valid = false;

tests/ctest_write/main.c

 
 #define TESTTITLE "test title äöüß"
 
-int cp(const char *from, const char *to)
-{
+int cp(const char *from, const char *to) {
     int fd_to, fd_from;
     char buf[4096];
     ssize_t nread;
     if (fd_to < 0)
         goto out_error;
     
-    while (nread = read(fd_from, buf, sizeof buf), nread > 0)
-    {
+    while (nread = read(fd_from, buf, sizeof buf), nread > 0) {
         char *out_ptr = buf;
         ssize_t nwritten;
-        
         do {
             nwritten = write(fd_to, out_ptr, nread);
             
-            if (nwritten >= 0)
-            {
+            if (nwritten >= 0) {
                 nread -= nwritten;
                 out_ptr += nwritten;
             }
-            else if (errno != EINTR)
-            {
+            else if (errno != EINTR) {
                 goto out_error;
             }
         } while (nread > 0);
     }
-    
-    if (nread == 0)
-    {
-        if (close(fd_to) < 0)
-        {
+    if (nread == 0) {
+        if (close(fd_to) < 0) {
             fd_to = -1;
             goto out_error;
         }
         close(fd_from);
-        
-        /* Success! */
-        return 0;
+        return 0; /* Success! */
     }
     
   out_error:
     for(; i < labels_length; i++) {
         const char* first = labels[i];
         const char* second = out_labels[i];
-
         if(strcmp(labels[i], out_labels[i]) != 0)
             return 0; // not equal
     }
     return 1; //EQUAL
 }
 
-int main(void)
-{
+int main(void) {
     TagInfo_Info *info;
     char val[200] = TESTDIR "samples/sample.flac";
     const char* target = "/tmp/out_03.flac";
     labels[0] = strdup("label 1 äöü");
     labels[1] = strdup("label 2 äéü");
     taginfo_info_set_artist_labels(info, (const char * const*)labels, labels_length);
-    taginfo_info_set_album_labels(info, (const char * const*)labels, labels_length);
-    taginfo_info_set_track_labels(info, (const char * const*)labels, labels_length);
+    taginfo_info_set_album_labels(info,  (const char * const*)labels, labels_length);
+    taginfo_info_set_track_labels(info,  (const char * const*)labels, labels_length);
     taginfo_info_save(info);
     taginfo_info_free(info);
     info = taginfo_info_create(target);

tests/lyrics_mp3/main.cc

     struct stat filestatus;
     
     
-    std::string lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
+    String lyrics = "these are lyrics öäüß\n ldskjfslkd\n öäüß";
     
     info = Info::create(target);
     if(info) {
-        if(!info->set_lyrics(lyrics.c_str())) {
+        if(!info->set_lyrics(lyrics)) {
             delete info;
             return EXIT_FAILURE;
         }
     char* read;
     if(info) {
         if(info->load()) {
-            const char* res = info->get_lyrics().toCString(false);
-            if(strcmp(lyrics.c_str(), res) != 0) {
+            String res = info->get_lyrics();
+            if(lyrics != res) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
                     return EXIT_FAILURE;

tests/write_image_ape/main.cc

     img->image_file_type = IMAGE_FILE_TYPE_JPEG;
     img->image_type      = IMAGE_TYPE_COVER_FRONT;
     // Image description not supported by APE
-    //img->description     = ::strdup(String("Bescräibunk").toCString(false));
     
     Image * img2 = new Image();
     img2->image_file_type = IMAGE_FILE_TYPE_JPEG;
     img2->image_type      = IMAGE_TYPE_COVER_BACK;
     // Image description not supported by APE
-    //img2->description     = ::strdup(String("Beßcräibunk").toCString(false));
-
+    
     struct stat filestatus;
     stat( image.c_str(), &filestatus );
     //cout << filestatus.st_size << " bytes\n";

tests/write_image_mp3/main.cc

                     delete read_image;
                 return EXIT_FAILURE;
             }
-            String st = String(read_image->description, String::UTF8);
+            String st = String(read_image->description);
             if(strcmp(img->description, st.toCString(false)) != 0) {
                 if(images)
                     delete [] images;
                     delete read_image;
                 return EXIT_FAILURE;
             }
-            st = String(read_image2->description, String::UTF8);
+            st = String(read_image2->description);
             if(strcmp(img2->description, st.toCString(false)) != 0) {
                 if(images)
                     delete [] images;

tests/write_image_mpc/main.cc

     Info * info;
     std::string val   = TESTDIR "samples/sample.mpc";
     std::string image = TESTDIR "samples/test.jpg";
-    
-    //std::cout << std::endl << "val: " << val << std::endl;
     std::string target = "/tmp/out_01.mpc";
     
     std::ifstream  src(val.c_str());
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-
     Image * img = new Image();
     img->image_file_type = IMAGE_FILE_TYPE_JPEG;
-    img->image_type      = IMAGE_TYPE_OTHER;
-
+    img->image_type      = IMAGE_TYPE_COVER_FRONT;
+    
+    Image * img2 = new Image();
+    img2->image_file_type = IMAGE_FILE_TYPE_JPEG;
+    img2->image_type      = IMAGE_TYPE_COVER_BACK;
+    
     struct stat filestatus;
     stat( image.c_str(), &filestatus );
     //cout << filestatus.st_size << " bytes\n";
     img->data_length = filestatus.st_size;
+    img2->data_length = filestatus.st_size;
     int fd;
+    
     fd = open(image.c_str(), O_RDONLY);
     if (fd == -1) {
         perror("Error opening file for reading");
         EXIT_FAILURE;
     }
     
-    img->data = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
-    if(img->data == MAP_FAILED) {
+    img->data  = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    img2->data = (char*)mmap(0, img2->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    if(img->data == MAP_FAILED || img2->data == MAP_FAILED) {
         close(fd);
         perror("Error mmapping the file");
         EXIT_FAILURE;
     
     info = Info::create(target);
     if(info) {
-        Image ** imgs = new Image*[1];
+        Image ** imgs = new Image*[2];
         imgs[0] = img;
-        info->set_images((const Image **)imgs, 1);
+        imgs[1] = img2;
+        info->set_images((const Image **)imgs, 2);
+        if(imgs)
+            delete [] imgs;
         info->save();
     }
     delete info;
     info = NULL;
     
     info = Info::create(target);
-    Image * read_image = NULL;
-    
+    Image * read_image;
+    Image * read_image2;
     if(info) {
         if(info->load()) {
             int len = 0;
                 }
                 return EXIT_FAILURE;
             }
-            read_image = images[0];
-            if(!images[0] || !read_image) {
+            read_image  = images[0];
+            read_image2 = images[1];
+            if(!images[0] || !read_image|| !read_image2) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
-                    if(img)
-                        delete img;
+                    if(images)
+                        delete [] images;
                     return EXIT_FAILURE;
                 }
+            }
+            if(img->image_type != read_image->image_type) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            if(img2->image_type != read_image2->image_type) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
                 return EXIT_FAILURE;
             }
             int i;
                 if(img->data[i] != read_image->data[i]) {
                     if(images)
                         delete [] images;
-                    if(read_image)
-                        delete read_image;
+                    return EXIT_FAILURE;
+                }
+            }
+            for(i = 0; i<img2->data_length; i++) {
+                if(img2->data[i] != read_image2->data[i]) {
+                    if(images)
+                        delete [] images;
                     return EXIT_FAILURE;
                 }
             }
     return EXIT_FAILURE;
 }
 
+

tests/write_image_tta/main.cc

     Info * info;
     std::string val   = TESTDIR "samples/sample.tta";
     std::string image = TESTDIR "samples/test.jpg";
-    
-    //std::cout << std::endl << "val: " << val << std::endl;
     std::string target = "/tmp/out_01.tta";
     
     std::ifstream  src(val.c_str());
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-
     Image * img = new Image();
     img->image_file_type = IMAGE_FILE_TYPE_JPEG;
-    img->image_type      = IMAGE_TYPE_OTHER;
+    img->image_type      = IMAGE_TYPE_COVER_FRONT;
+    img->description     = ::strdup(String("Bescräibunk").toCString(false));
+    
+    Image * img2 = new Image();
+    img2->image_file_type = IMAGE_FILE_TYPE_JPEG;
+    img2->image_type      = IMAGE_TYPE_COVER_BACK;
+    img2->description     = ::strdup(String("Beßcräibunk").toCString(false));
 
     struct stat filestatus;
     stat( image.c_str(), &filestatus );
     //cout << filestatus.st_size << " bytes\n";
     img->data_length = filestatus.st_size;
+    img2->data_length = filestatus.st_size;
     int fd;
+    
     fd = open(image.c_str(), O_RDONLY);
     if (fd == -1) {
         perror("Error opening file for reading");
         EXIT_FAILURE;
     }
     
-    img->data = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
-    if(img->data == MAP_FAILED) {
+    img->data  = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    img2->data = (char*)mmap(0, img2->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    if(img->data == MAP_FAILED || img2->data == MAP_FAILED) {
         close(fd);
         perror("Error mmapping the file");
         EXIT_FAILURE;
     
     info = Info::create(target);
     if(info) {
-        Image ** imgs = new Image*[1];
+        Image ** imgs = new Image*[2];
         imgs[0] = img;
-        info->set_images((const Image **)imgs, 1);
+        imgs[1] = img2;
+        info->set_images((const Image **)imgs, 2);
+        if(imgs)
+            delete [] imgs;
         info->save();
     }
     delete info;
     info = NULL;
     
     info = Info::create(target);
-    Image * read_image = NULL;
-    
+    Image * read_image;
+    Image * read_image2;
     if(info) {
         if(info->load()) {
             int len = 0;
                 }
                 return EXIT_FAILURE;
             }
-            read_image = images[0];
-            if(!images[0] || !read_image) {
+            read_image  = images[0];
+            read_image2 = images[1];
+            if(!images[0] || !read_image|| !read_image2) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
-                    if(img)
-                        delete img;
+                    if(images)
+                        delete [] images;
                     return EXIT_FAILURE;
                 }
             }
+            if(img->image_type != read_image->image_type) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            String st = String(read_image->description);
+            if(strcmp(img->description, st.toCString(false)) != 0) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            st = String(read_image2->description);
+            if(strcmp(img2->description, st.toCString(false)) != 0) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            if(img2->image_type != read_image2->image_type) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
             int i;
             for(i = 0; i<img->data_length; i++) {
                 if(img->data[i] != read_image->data[i]) {
                     if(images)
                         delete [] images;
-                    if(read_image)
-                        delete read_image;
+                    return EXIT_FAILURE;
+                }
+            }
+            for(i = 0; i<img2->data_length; i++) {
+                if(img2->data[i] != read_image2->data[i]) {
+                    if(images)
+                        delete [] images;
                     return EXIT_FAILURE;
                 }
             }
     }
     return EXIT_FAILURE;
 }
+
+

tests/write_image_wav/main.cc

     Info * info;
     std::string val   = TESTDIR "samples/sample.wav";
     std::string image = TESTDIR "samples/test.jpg";
-    
-    //std::cout << std::endl << "val: " << val << std::endl;
     std::string target = "/tmp/out_01.wav";
     
     std::ifstream  src(val.c_str());
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-
     Image * img = new Image();
     img->image_file_type = IMAGE_FILE_TYPE_JPEG;
-    img->image_type      = IMAGE_TYPE_OTHER;
+    img->image_type      = IMAGE_TYPE_COVER_FRONT;
+    img->description     = ::strdup(String("Bescräibunk").toCString(false));
+    
+    Image * img2 = new Image();
+    img2->image_file_type = IMAGE_FILE_TYPE_JPEG;
+    img2->image_type      = IMAGE_TYPE_COVER_BACK;
+    img2->description     = ::strdup(String("Beßcräibunk").toCString(false));
 
     struct stat filestatus;
     stat( image.c_str(), &filestatus );
     //cout << filestatus.st_size << " bytes\n";
     img->data_length = filestatus.st_size;
+    img2->data_length = filestatus.st_size;
     int fd;
+    
     fd = open(image.c_str(), O_RDONLY);
     if (fd == -1) {
         perror("Error opening file for reading");
         EXIT_FAILURE;
     }
     
-    img->data = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
-    if(img->data == MAP_FAILED) {
+    img->data  = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    img2->data = (char*)mmap(0, img2->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    if(img->data == MAP_FAILED || img2->data == MAP_FAILED) {
         close(fd);
         perror("Error mmapping the file");
         EXIT_FAILURE;
     
     info = Info::create(target);
     if(info) {
-        Image ** imgs = new Image*[1];
+        Image ** imgs = new Image*[2];
         imgs[0] = img;
-        info->set_images((const Image **)imgs, 1);
+        imgs[1] = img2;
+        info->set_images((const Image **)imgs, 2);
+        if(imgs)
+            delete [] imgs;
         info->save();
     }
     delete info;
     info = NULL;
     
     info = Info::create(target);
-    Image * read_image = NULL;
-    
+    Image * read_image;
+    Image * read_image2;
     if(info) {
         if(info->load()) {
             int len = 0;
                 }
                 return EXIT_FAILURE;
             }
-            read_image = images[0];
-            if(!images[0] || !read_image) {
+            read_image  = images[0];
+            read_image2 = images[1];
+            if(!images[0] || !read_image|| !read_image2) {
                 delete info;
                 if(remove(target.c_str()) != 0 ) {
-                    if(img)
-                        delete img;
+                    if(images)
+                        delete [] images;
                     return EXIT_FAILURE;
                 }
             }
+            if(img->image_type != read_image->image_type) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            String st = String(read_image->description);
+            if(strcmp(img->description, st.toCString(false)) != 0) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            st = String(read_image2->description);
+            if(strcmp(img2->description, st.toCString(false)) != 0) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
+            if(img2->image_type != read_image2->image_type) {
+                if(images)
+                    delete [] images;
+                if(read_image)
+                    delete read_image;
+                return EXIT_FAILURE;
+            }
             int i;
             for(i = 0; i<img->data_length; i++) {
                 if(img->data[i] != read_image->data[i]) {
                     if(images)
                         delete [] images;
-                    if(read_image)
-                        delete read_image;
+                    return EXIT_FAILURE;
+                }
+            }
+            for(i = 0; i<img2->data_length; i++) {
+                if(img2->data[i] != read_image2->data[i]) {
+                    if(images)
+                        delete [] images;
                     return EXIT_FAILURE;
                 }
             }
     }
     return EXIT_FAILURE;
 }
+
+

tests/write_image_wv/main.cc

     Info * info;
     std::string val   = TESTDIR "samples/sample.wv";
     std::string image = TESTDIR "samples/test.jpg";
-    
-    //std::cout << std::endl << "val: " << val << std::endl;
     std::string target = "/tmp/out_01.wv";
     
     std::ifstream  src(val.c_str());
     std::ofstream  dst(target.c_str());
     dst << src.rdbuf();
     
-
     Image * img = new Image();
     img->image_file_type = IMAGE_FILE_TYPE_JPEG;
-    img->image_type      = IMAGE_TYPE_OTHER;
+    img->image_type      = IMAGE_TYPE_COVER_FRONT;
+    
+    Image * img2 = new Image();
+    img2->image_file_type = IMAGE_FILE_TYPE_JPEG;
+    img2->image_type      = IMAGE_TYPE_COVER_BACK;
 
     struct stat filestatus;
     stat( image.c_str(), &filestatus );
     //cout << filestatus.st_size << " bytes\n";
     img->data_length = filestatus.st_size;
+    img2->data_length = filestatus.st_size;
     int fd;
+    
     fd = open(image.c_str(), O_RDONLY);
     if (fd == -1) {
         perror("Error opening file for reading");
         EXIT_FAILURE;
     }
     
-    img->data = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
-    if(img->data == MAP_FAILED) {
+    img->data  = (char*)mmap(0, img->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    img2->data = (char*)mmap(0, img2->data_length, PROT_READ, MAP_SHARED, fd, 0);
+    if(img->data == MAP_FAILED || img2->data == MAP_FAILED) {
         close(fd);
         perror("Error mmapping the file");
         EXIT_FAILURE;
     
     info = Info::create(target);
     if(info) {
-        Image ** imgs = new Image*[1];
+        Image ** imgs = new Image*[2];
         imgs[0] = img;
-        info->set_images((const Image **)imgs, 1);
+        imgs[1] = img2;
+        info->set_images((const Image **)imgs, 2);
+        if(imgs)
+            delete [] imgs;
         info->save();
     }
     delete info;
     info = NULL;
     
     info = Info::create(target);
-    Image * read_image = NULL;
-    
+    Image * read_image;
+    Image * read_image2;
     if(info) {
         if(info->load()) {</