Commits

shuerhaaken committed 4cc8889

cleanups

Comments (0)

Files changed (6)

bindings/c/taginfo_c.h

 } TagInfo_Image;
 
 
-//FREE FUNCTIONS
+/*----------------------------------------------------------------------------------------*/
+//Info FREE FUNCTION
 void taginfo_info_free(TagInfo_Info *info);
-
-void taginfo_image_free(TagInfo_Image * img);
-void taginfo_image_array_free(TagInfo_Image ** img_arr);
+/*----------------------------------------------------------------------------------------*/
 
 
 
+/*----------------------------------------------------------------------------------------*/
 // FACTORY CREATION
 TagInfo_Info *taginfo_info_create(const char *filename);
 TagInfo_Info *taginfo_info_create_with_format(const char *filename, TagInfo_MediaFileType format);
 TagInfo_Info *taginfo_info_create_from_mime(const char *filename, const char *mime_type);
+/*----------------------------------------------------------------------------------------*/
 
-
+/*----------------------------------------------------------------------------------------*/
 // LOAD / SAVE
-BOOL taginfo_info_load(TagInfo_Info *info);
-BOOL taginfo_info_save(TagInfo_Info *info);
+BOOL  taginfo_info_load(TagInfo_Info *info);
+BOOL  taginfo_info_save(TagInfo_Info *info);
+/*----------------------------------------------------------------------------------------*/
 
 
+/*----------------------------------------------------------------------------------------*/
 // STRING MANAGEMENT
-void taginfo_info_enable_string_management(BOOL management);
-void taginfo_info_free_strings();
+void  taginfo_info_enable_string_management(BOOL management);
+void  taginfo_info_free_strings();
+/*----------------------------------------------------------------------------------------*/
 
 
+/*----------------------------------------------------------------------------------------*/
 // TAG ACCESS
 char *taginfo_info_get_album(const TagInfo_Info *info);
 void  taginfo_info_set_album(TagInfo_Info *info, const char *album);
 int  taginfo_info_get_track_number(const TagInfo_Info *info);
 void taginfo_info_set_track_number(TagInfo_Info *info, int track_number);
 
-int taginfo_info_get_volume_count(const TagInfo_Info *info);
+int  taginfo_info_get_volume_count(const TagInfo_Info *info);
 void taginfo_info_set_volume_count(TagInfo_Info *info, int count);
 
-int taginfo_info_get_volume_number(const TagInfo_Info *info);
+int  taginfo_info_get_volume_number(const TagInfo_Info *info);
 void taginfo_info_set_volume_number(TagInfo_Info *info, int number);
 
-int taginfo_info_get_year(const TagInfo_Info *info);
+int  taginfo_info_get_year(const TagInfo_Info *info);
 void taginfo_info_set_year(TagInfo_Info *info, int year);
 
 
 // AUDIO PROPERTIES
-int taginfo_info_get_length(const TagInfo_Info *info);
-int taginfo_info_get_bitrate(const TagInfo_Info *info);
-int taginfo_info_get_samplerate(const TagInfo_Info *info);
-int taginfo_info_get_channels(const TagInfo_Info *info);
+int  taginfo_info_get_length(const TagInfo_Info *info);
+int  taginfo_info_get_bitrate(const TagInfo_Info *info);
+int  taginfo_info_get_samplerate(const TagInfo_Info *info);
+int  taginfo_info_get_channels(const TagInfo_Info *info);
 
 // USER LABELS
-char **taginfo_info_get_track_labels(const TagInfo_Info *info,
+char ** taginfo_info_get_track_labels(const TagInfo_Info *info,
                                      int *data_length);
-void taginfo_info_set_track_labels(TagInfo_Info *info,
+void    taginfo_info_set_track_labels(TagInfo_Info *info,
                                    const char* const* data, int data_length);
 
-char **taginfo_info_get_album_labels(const TagInfo_Info *info,
+char ** taginfo_info_get_album_labels(const TagInfo_Info *info,
                                      int *data_length);
-void taginfo_info_set_album_labels(TagInfo_Info *info,
+void    taginfo_info_set_album_labels(TagInfo_Info *info,
                                    const char* const* data, int data_length);
 
-char **taginfo_info_get_artist_labels(const TagInfo_Info *info,
+char ** taginfo_info_get_artist_labels(const TagInfo_Info *info,
                                       int *data_length);
-void taginfo_info_set_artist_labels(TagInfo_Info *info,
+void    taginfo_info_set_artist_labels(TagInfo_Info *info,
                                     const char* const* data,
                                     int data_length);
 
-// IMAGE Extraction
-TagInfo_Image ** taginfo_info_get_images(const TagInfo_Info *info,
-                                         int *image_count);
-void taginfo_info_set_images(TagInfo_Info *info,
-                             const TagInfo_Image ** images,
-                             const int image_count);
+// LYRICS
+char *                  taginfo_info_get_lyrics(const TagInfo_Info *info);
+void                    taginfo_info_set_lyrics(TagInfo_Info *info,
+                                                const char *lyrics);
+/*----------------------------------------------------------------------------------------*/
 
+/*----------------------------------------------------------------------------------------*/
+// IMAGE Extraction
+TagInfo_Image **        taginfo_info_get_images(const TagInfo_Info *info,
+                                                int *image_count);
+void                    taginfo_info_set_images(TagInfo_Info *info,
+                                                const TagInfo_Image ** images,
+                                                const int image_count);
+/*----------------------------------------------------------------------------------------*/
 
 
+/*----------------------------------------------------------------------------------------*/
 // IMAGE API
-TagInfo_Image * taginfo_image_new();
+TagInfo_Image *         taginfo_image_new();
 
-char * taginfo_image_get_data(const TagInfo_Image * img, unsigned int * bin_data_length);
-void taginfo_image_set_data(TagInfo_Image * img, char * bin_data, unsigned int bin_data_length);
+void                    taginfo_image_free(TagInfo_Image * img);
+void                    taginfo_image_array_free(TagInfo_Image ** img_arr);
 
-TagInfo_ImageType taginfo_image_get_image_type(const TagInfo_Image * img);
-void taginfo_image_set_image_type(TagInfo_Image * img, TagInfo_ImageType itype);
+char *                  taginfo_image_get_data(const TagInfo_Image * img, unsigned int * bin_data_length);
+void                    taginfo_image_set_data(TagInfo_Image * img,
+                                               char * bin_data, 
+                                               unsigned int bin_data_length);
 
-TagInfo_ImageFileType taginfo_image_get_image_file_type(const TagInfo_Image * img);
-void taginfo_image_set_image_file_type(TagInfo_Image * img, TagInfo_ImageFileType image_f_type);
+TagInfo_ImageType       taginfo_image_get_image_type(const TagInfo_Image * img);
+void                    taginfo_image_set_image_type(TagInfo_Image * img,
+                                                     TagInfo_ImageType itype);
 
-char * taginfo_image_get_description(const TagInfo_Image * img);
-void taginfo_image_set_description(TagInfo_Image * img, const char * new_description);
+TagInfo_ImageFileType   taginfo_image_get_image_file_type(const TagInfo_Image * img);
+void                    taginfo_image_set_image_file_type(TagInfo_Image * img,
+                                                          TagInfo_ImageFileType image_f_type);
 
-// LYRICS
-char * taginfo_info_get_lyrics(const TagInfo_Info *info);
-void taginfo_info_set_lyrics(TagInfo_Info *info,
-                             const char *lyrics);
+char *                  taginfo_image_get_description(const TagInfo_Image * img);
+void                    taginfo_image_set_description(TagInfo_Image * img,
+                                                      const char * new_description);
+/*----------------------------------------------------------------------------------------*/
 
 
 #ifdef __cplusplus

libtaginfo/asfinfo.cc

                     Image * image = new Image();
                     if(pict_data.size() > 0) {
                         image->set_data(pict_data);
-//                        image->data_length = pict_data.size();
-//                        image->data = new char[image->data_length];
-//                        memcpy(image->data, pict_data.data(), pict_data.size());
                         
                         String mimetype = pict.mimeType();
                         if(mimetype.find("/jpeg") != -1 || mimetype.find("/jpg") != -1)
                             image->set_image_file_type(IMAGE_FILE_TYPE_GIF);
                         
                         image->set_image_type(get_image_type_from_pic_type(pict.type())); 
-//                        const char * cstr = pict.description().toCString(false);
-//                        if(cstr)
-//                            image->description = ::strdup(cstr);
                         image->set_description(pict.description());
                         images[i] = image;
                         i--;
             if( image->get_data().isEmpty())
                 continue;
             ASF::Picture picture = ASF::Picture();
-            if(image->get_image_file_type() == IMAGE_FILE_TYPE_JPEG || 
-               image->get_image_file_type() == IMAGE_FILE_TYPE_UNKNOWN) //default to jpeg
+            if(image->get_image_file_type() == IMAGE_FILE_TYPE_JPEG) //default to jpeg
                 picture.setMimeType("image/jpeg");
             else if(image->get_image_file_type() == IMAGE_FILE_TYPE_PNG)
                 picture.setMimeType("image/png");
             else if(image->get_image_file_type() == IMAGE_FILE_TYPE_BMP)
                 picture.setMimeType("image/bmp");
             
-            ByteVector ImgData(image->get_data());// = ;//ByteVector((uint) image->data_length);
-//            memcpy(ImgData.data(), image->data, image->data_length);
-//            if(image->description) {
-//                String desc = String(image->description);
-                picture.setDescription(image->get_description());
-//            }
-            picture.setPicture(ImgData);
+            ByteVector img_vect(image->get_data());
+            picture.setDescription(image->get_description());
+            picture.setPicture(img_vect);
             picture.setType(image_type_to_picture_type(image->get_image_type()));
             ASF::Attribute attr = ASF::Attribute(picture);
             asf_tag->addAttribute(PICTURE_FLAG, attr);
 
 String AsfInfo::get_lyrics(void) const {
     if(asf_tag) {
-            if(asf_tag->attributeListMap().contains(LYRICS)) {
+        if(asf_tag->attributeListMap().contains(LYRICS))
             return asf_tag->attributeListMap()[ LYRICS ].front().toString();
-        }
     }
     return String();
 }

libtaginfo/id3info.cc

             pic_frame = static_cast<ID3v2::AttachedPictureFrame *>(*iter);
             Image * image = new Image();
             image->set_image_type(get_image_type_from_pic_frame_type(pic_frame->type()));
-//            if(image) {
-                if(pic_frame->picture().size() > 0) {
-                    image->set_data(pic_frame->picture());
-//                    image->data_length = pic_frame->picture().size();
-//                    image->data = new char[image->data_length];
-//                    memcpy(image->data, pic_frame->picture().data(), pic_frame->picture().size());
-                    String mimetype = pic_frame->mimeType();
-                    if(mimetype.find("/jpeg") != -1 || mimetype.find("/jpg") != -1)
-                        image->set_image_file_type(IMAGE_FILE_TYPE_JPEG);
-                    else if(mimetype.find("/png") != -1)
-                        image->set_image_file_type(IMAGE_FILE_TYPE_PNG);
-                    else if(mimetype.find("/gif") != -1)
-                        image->set_image_file_type(IMAGE_FILE_TYPE_GIF);
-                    else if(mimetype.find("/bmp") != -1)
-                        image->set_image_file_type(IMAGE_FILE_TYPE_BMP);
-                    image->set_description(pic_frame->description());// = ::strdup(pic_frame->description().toCString(false));
-                }
-//                if(image->data && image->data_length > 0) {
-                    images[i] = image;
-                    i++;
-//                }
-//                else
-//                    delete image;
-//            }
+            if(pic_frame->picture().size() > 0) {
+                image->set_data(pic_frame->picture());
+                String mimetype = pic_frame->mimeType();
+                if(mimetype.find("/jpeg") != -1 || mimetype.find("/jpg") != -1)
+                    image->set_image_file_type(IMAGE_FILE_TYPE_JPEG);
+                else if(mimetype.find("/png") != -1)
+                    image->set_image_file_type(IMAGE_FILE_TYPE_PNG);
+                else if(mimetype.find("/gif") != -1)
+                    image->set_image_file_type(IMAGE_FILE_TYPE_GIF);
+                else if(mimetype.find("/bmp") != -1)
+                    image->set_image_file_type(IMAGE_FILE_TYPE_BMP);
+                image->set_description(pic_frame->description());
+            }
+            images[i] = image;
+            i++;
         }
         image_count = i;
         return images;
         for(int p = 0; p < image_count; p++) {
             if(images[p]->get_data().isEmpty())
                 continue;
-//            if(!images[p] || !images[p]->data || images[p]->data_length == 0)
-//                continue;
             
             for(list<ID3v2::Frame*>::iterator iter = frameList.begin(); iter != frameList.end(); iter++) {
                 PicFrame = static_cast<ID3v2::AttachedPictureFrame *>(*iter);
             else if(images[p]->get_image_file_type() == IMAGE_FILE_TYPE_BMP)
                 PicFrame->setMimeType("image/bmp");
             PicFrame->setType(image_type_to_picframetype(images[p]->get_image_type()));
-//            if(images[p]->description) {
-//                String desc = String(::strdup(images[p]->description));
+            if(!images[p]->get_description().isEmpty())
                 PicFrame->setDescription(images[p]->get_description());
-//            }
-            ByteVector ImgData(images[p]->get_data());//((uint) images[p]->data_length);
-//            memcpy(ImgData.data(), images[p]->data, images[p]->data_length);
-            PicFrame->setPicture(ImgData);
+            ByteVector img_vect(images[p]->get_data());//((uint) images[p]->data_length);
+            PicFrame->setPicture(img_vect);
             taglib_tagId3v2->addFrame(PicFrame);
         }
     }

libtaginfo/mp4info.cc

 #define COMPOSER            "\xA9wrt"
 #define ORIGINAL_ARTIST     "\xa9prf"
 #define ENCODER             "\xa9too"
+#define COVER_IMAGES        "covr"
+#define VOLUME              "disk"
+#define COMPILATION         "cpil"
+#define RATING              "----:com.apple.iTunes:RATING"
+#define PLAYCOUNT           "----:com.apple.iTunes:PLAY_COUNTER"
+#define TRACK_LABELS        "----:com.apple.iTunes:TRACK_LABELS"
+#define ARTIST_LABELS       "----:com.apple.iTunes:ARTIST_LABELS"
+#define ALBUM_LABELS        "----:com.apple.iTunes:ALBUM_LABELS"
+#define TRACKNUMBER         "trkn"
+#define ALBUM_ARTIST        "aART"
 
-using namespace TagInfo;
 
+using namespace TagInfo;
 
 // MP4
 
         if(mp4_tag && !mp4_tag->isEmpty()) {
             if(!taglib_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(ALBUM_ARTIST)) {
+                album_artist = mp4_tag->itemListMap()[ALBUM_ARTIST].toStringList().front();
             }
-            if(mp4_tag->itemListMap().contains("trkn") ) { //&& !mp4_tag->itemListMap()["trkn"].isValid()
-                track_number = mp4_tag->itemListMap()["trkn"].toIntPair().first;
-                track_count  = mp4_tag->itemListMap()["trkn"].toIntPair().second;
+            if(mp4_tag->itemListMap().contains(TRACKNUMBER) ) { //&& !mp4_tag->itemListMap()[TRACKNUMBER].isValid()
+                track_number = mp4_tag->itemListMap()[TRACKNUMBER].toIntPair().first;
+                track_count  = mp4_tag->itemListMap()[TRACKNUMBER].toIntPair().second;
             }
             if(mp4_tag->itemListMap().contains(COMPOSER)) {
                 composer = mp4_tag->itemListMap()[COMPOSER].toStringList().front();
             if(mp4_tag->itemListMap().contains(HOMEPAGE)) {
                 homepage = mp4_tag->itemListMap()[HOMEPAGE].toStringList().front();
             }
-            if(mp4_tag->itemListMap().contains("disk")) {
-                volume_number = mp4_tag->itemListMap()["disk"].toIntPair().first;
-                volume_count = mp4_tag->itemListMap()["disk"].toIntPair().second;
+            if(mp4_tag->itemListMap().contains(VOLUME)) {
+                volume_number = mp4_tag->itemListMap()[VOLUME].toIntPair().first;
+                volume_count = mp4_tag->itemListMap()[VOLUME].toIntPair().second;
             }
-            if(mp4_tag->itemListMap().contains("cpil")) {
-                is_compilation = mp4_tag->itemListMap()["cpil"].toBool();
+            if(mp4_tag->itemListMap().contains(COMPILATION)) {
+                is_compilation = mp4_tag->itemListMap()[COMPILATION].toBool();
             }
             // Rating
-            if(mp4_tag->itemListMap().contains("----:com.apple.iTunes:RATING")) {
+            if(mp4_tag->itemListMap().contains(RATING)) {
                 long rat = 0;
-                rat = atol(mp4_tag->itemListMap()["----:com.apple.iTunes:RATING"].toStringList().front().toCString(true));
+                rat = atol(mp4_tag->itemListMap()[RATING].toStringList().front().toCString(true));
                 if(rat) {
                     if(rat > 5) {
                         rating = popularity_to_rating(rat);
                     }
                 }
             }
-            if(mp4_tag->itemListMap().contains("----:com.apple.iTunes:PLAY_COUNTER")) {
-                long PlayCount = 0;
-                PlayCount = atol(mp4_tag->itemListMap()["----:com.apple.iTunes:PLAY_COUNTER"].toStringList().front().toCString(true));
-                playcount = PlayCount;
+            if(mp4_tag->itemListMap().contains(PLAYCOUNT)) {
+                playcount = atol(mp4_tag->itemListMap()[PLAYCOUNT].toStringList().front().toCString(true));
             }
             // Labels
             if(track_labels.size() == 0) {
-                if(mp4_tag->itemListMap().contains("----:com.apple.iTunes:TRACK_LABELS")) {
-                    track_labels_string = mp4_tag->itemListMap()["----:com.apple.iTunes:TRACK_LABELS"].toStringList().front();
+                if(mp4_tag->itemListMap().contains(TRACK_LABELS)) {
+                    track_labels_string = mp4_tag->itemListMap()[TRACK_LABELS].toStringList().front();
                     track_labels = split(track_labels_string, "|");
                 }
             }
             if(artist_labels.size() == 0) {
-                if(mp4_tag->itemListMap().contains("----:com.apple.iTunes:ARTIST_LABELS")) {
-                    artist_labels_string = mp4_tag->itemListMap()["----:com.apple.iTunes:ARTIST_LABELS"].toStringList().front();
+                if(mp4_tag->itemListMap().contains(ARTIST_LABELS)) {
+                    artist_labels_string = mp4_tag->itemListMap()[ARTIST_LABELS].toStringList().front();
                     artist_labels = split(artist_labels_string, "|");
                 }
             }
             if(album_labels.size() == 0) {
-                if(mp4_tag->itemListMap().contains("----:com.apple.iTunes:ALBUM_LABELS")) {
-                    album_labels_string = mp4_tag->itemListMap()["----:com.apple.iTunes:ALBUM_LABELS"].toStringList().front();
+                if(mp4_tag->itemListMap().contains(ALBUM_LABELS)) {
+                    album_labels_string = mp4_tag->itemListMap()[ALBUM_LABELS].toStringList().front();
                     album_labels = split(album_labels_string, "|");
                 }
             }
-            if(mp4_tag->itemListMap().contains("covr")) {
-                MP4::CoverArtList covers = mp4_tag->itemListMap()[ "covr" ].toCoverArtList();
+            if(mp4_tag->itemListMap().contains(COVER_IMAGES)) {
+                MP4::CoverArtList covers = mp4_tag->itemListMap()[ COVER_IMAGES ].toCoverArtList();
                 has_image = (covers.size() > 0);
             }
             return true;
     if(mp4_tag) {
         if(changedflag) {
             if(changedflag & CHANGED_DATA_ALBUMARTIST)
-                mp4_tag->itemListMap()["aART"] = StringList(album_artist);
+                mp4_tag->itemListMap()[ALBUM_ARTIST] = StringList(album_artist);
             if(changedflag & CHANGED_COMPOSER_TAG)
                 mp4_tag->itemListMap()[COMPOSER] = StringList(composer);
             if(changedflag & CHANGED_ORIGINALARTIST_TAG)
                     // prevent overwrite in save_base_tags()
                     changedflag &= ~(CHANGED_TRACK_NUMBER);
                     changedflag &= ~(CHANGED_TRACK_COUNT);
-                    mp4_tag->itemListMap()["trkn"] = MP4::Item(track_number, track_count);
+                    mp4_tag->itemListMap()[TRACKNUMBER] = 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"] = MP4::Item(track_number, track_count);
+                mp4_tag->itemListMap()[TRACKNUMBER] = MP4::Item(track_number, track_count);
             }
             if(changedflag & CHANGED_DATA_VOL_NUM) {
-                mp4_tag->itemListMap()["disk"] = MP4::Item(volume_number, volume_count);
+                mp4_tag->itemListMap()[VOLUME] = MP4::Item(volume_number, volume_count);
             }
             if(changedflag & CHANGED_IS_COMPILATION_TAG)
-                mp4_tag->itemListMap()["cpil"] = MP4::Item(is_compilation);
+                mp4_tag->itemListMap()[COMPILATION] = MP4::Item(is_compilation);
             if(changedflag & CHANGED_DATA_RATING) {
-                mp4_tag->itemListMap()["----:com.apple.iTunes:RATING" ] =
+                mp4_tag->itemListMap()[RATING ] =
                     MP4::Item(format("%u", rating_to_popularity(rating)));
                 
             }
             if(changedflag & CHANGED_DATA_PLAYCOUNT) {
-                mp4_tag->itemListMap()[ "----:com.apple.iTunes:PLAY_COUNTER" ] =
+                mp4_tag->itemListMap()[ PLAYCOUNT ] =
                     MP4::Item(format("%u", playcount));
             }
             // The Labels
             if(changedflag & CHANGED_ARTIST_LABELS)
-                mp4_check_label_frame(mp4_tag, "----:com.apple.iTunes:ARTIST_LABELS", artist_labels_string);
+                mp4_check_label_frame(mp4_tag, ARTIST_LABELS, artist_labels_string);
             if(changedflag & CHANGED_ALBUM_LABELS)
-                mp4_check_label_frame(mp4_tag, "----:com.apple.iTunes:ALBUM_LABELS", album_labels_string);
+                mp4_check_label_frame(mp4_tag, ALBUM_LABELS, album_labels_string);
             if(changedflag & CHANGED_TRACK_LABELS)
-                mp4_check_label_frame(mp4_tag, "----:com.apple.iTunes:TRACK_LABELS", track_labels_string);
+                mp4_check_label_frame(mp4_tag, TRACK_LABELS, track_labels_string);
             
             
             if(changedflag & CHANGED_COPYRIGHT_TAG)
     image_count = 0;
     if(mp4_tag) {
         Image** images;
-        if(mp4_tag && mp4_tag->itemListMap().contains("covr")) {
-            MP4::CoverArtList covers = mp4_tag->itemListMap()[ "covr" ].toCoverArtList();
+        if(mp4_tag && mp4_tag->itemListMap().contains(COVER_IMAGES)) {
+            MP4::CoverArtList covers = mp4_tag->itemListMap()[ COVER_IMAGES ].toCoverArtList();
             int cnt = covers.size();
             images = new Image*[cnt];
             Image * image = NULL;
                 image = new Image();
                 image->set_image_type(IMAGE_TYPE_OTHER);
                 image->set_data(it->data());
-//                image->data_length = it->data().size();
-//                image->data = new char[image->data_length];
-//                memcpy(image->data, it->data().data(), it->data().size());
                 image->set_image_file_type(get_image_file_type_from_format(it->format()));
-                
-//                if(image->data && image->data_length > 0) {
-//                    image->description = NULL;
-                    images[i] = image;
-                    i++;
-//                }
+                images[i] = image;
+                i++;
             }
             image_count = i;
         }
 
 void Mp4Info::set_images(const Image ** images, const int image_count) {
     if(mp4_tag) {
-        if(mp4_tag->itemListMap().contains("covr")) {
-            mp4_tag->itemListMap().erase("covr");
+        if(mp4_tag->itemListMap().contains(COVER_IMAGES)) {
+            mp4_tag->itemListMap().erase(COVER_IMAGES);
         }
         MP4::CoverArtList cover_list;
         for(int p = 0; p < image_count; p++) {
             const Image * image = images[p];
             if(!image->get_data().isEmpty()) {
-                ByteVector image_data = image->get_data();//((uint) image->data_length);
-//                memcpy(image_data.data(), image->data, image->data_length);
+                ByteVector image_data = image->get_data();
                 MP4::CoverArt::Format format = get_format_from_image_file_type(image->get_image_file_type());
                 MP4::CoverArt cover(format, image_data);
                 cover_list.append(cover);
             }
         }
         if(0 < cover_list.size())
-            mp4_tag->itemListMap()[ "covr" ] = cover_list;
+            mp4_tag->itemListMap()[ COVER_IMAGES ] = cover_list;
     }
 }
 

libtaginfo/xiphinfo.cc

         Image** images = new Image*[cnt];
         for(int i = 0; i < cnt; i++) {
             Image * image = new Image();
-//            image->image_type = IMAGE_TYPE_COVER_FRONT;
             String mimetype;
             String description;
             String itype;
             }
             if(i < descr_cnt) {
                 description = pic_descr[i];
-                image->set_description(description);// = ::strdup(description.toCString(false));
+                image->set_description(description);
             }
             const char* CoverEncData = pics[i].toCString(false);
             
             
             ByteVector bv(CoverDecData.data(), CoverDecData.size());
             image->set_data(bv);
-            
-//            if(image->data && image->data_length > 0) {
-                images[i] = image;
-                image_count++;
-//            }
-//            else
-//                delete image;
+            images[i] = image;
+            image_count++;
         }
         return images;
     }
                 else if(image->get_image_file_type() == IMAGE_FILE_TYPE_BMP)
                     xiphcomment->addField(COVERARTMIME, "image/bmp", false);
                 String b64Encoded = base64encode(image->get_data().data(), image->get_data().size());
-//                cout << "64bitEncoded " << b64Encoded << endl;
                 xiphcomment->addField(COVERART, 
                                       b64Encoded.toCString(false),
                                       false);
                 xiphcomment->addField(COVERARTTYPE, format("%d", (int)image->get_image_type()), false);
                 
-                if(!image->get_description().isEmpty()) {
-//                    const char* ds = ::strdup(image->description);
-//                    String desc = String(ds);
+                if(!image->get_description().isEmpty())
                     xiphcomment->addField(COVERARTDESCRIPTION, image->get_description(), false);
-                }
             }
         }
     }

tests/lyrics_aif/main.cc

 #include <sys/stat.h>
 
 using namespace TagInfo;
-//using namespace std;
 
 
 int main( void ) {