Revise the internal function name __ID3_setFrameByName() to __ID3v2_setFrameByName() 98/234298/6
authorhj kim <backto.kim@samsung.com>
Mon, 25 May 2020 07:35:15 +0000 (16:35 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 27 May 2020 03:11:32 +0000 (03:11 +0000)
because __ID3_setFrameByName() is used only for ID3v2 tag.

Change-Id: I4bf870b5cdd1d9713101d594f7ff126e2ce03878

src/metadata_editor.cpp

index 95ce276..a383d53 100755 (executable)
@@ -135,6 +135,35 @@ static int __ID3_getTwixFrameByName(ID3v1::Tag *tag1, ID3v2::Tag *tag2, const ch
        return METADATA_EDITOR_ERROR_NONE;
 }
 
+static int __ID3v2_setFrameByName(ID3v2::Tag *tag2, const char *frameID, const char *value)
+{
+       metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
+       metadata_editor_retvm_if(!frameID, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid frameID");
+
+       // If the pointer is NULL or c-string is empty - handle as request for deletion
+       if (!value || (*value == '\0')) {
+               metadata_editor_info("Request for frame %s deletion", frameID);
+               tag2->removeFrames(frameID);
+               return METADATA_EDITOR_ERROR_NONE;
+       }
+
+       // Check if the ID3v2 tag exists
+       if (tag2->frameListMap()[frameID].isEmpty()) {
+               metadata_editor_info("The frame %s does not exist. Creating", frameID);
+               // This is a common frame type for textural frames except comment frame
+               auto fr = new ID3v2::TextIdentificationFrame(frameID);
+
+               fr->setTextEncoding(String::UTF8);
+               fr->setText(String(value, String::UTF8));
+               tag2->addFrame(fr);
+       } else {                // if not - just modify the data in the existing frame
+               metadata_editor_info("The frame %s exists. Changing", frameID);
+               tag2->frameListMap()[frameID][0]->setText(String(value, String::UTF8));
+       }
+
+       return METADATA_EDITOR_ERROR_NONE;
+}
+
 static int __ID3_setTwixFrameByName(ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *frameID, const char *value)
 {
        metadata_editor_retvm_if(!frameID, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid frameID");
@@ -207,35 +236,6 @@ static int __ID3_getFrameByName(ID3v2::Tag *tag2, const char *frameID, char **va
        return METADATA_EDITOR_ERROR_NONE;
 }
 
-static int __ID3_setFrameByName(ID3v2::Tag *tag2, const char *frameID, const char *value)
-{
-       metadata_editor_retvm_if(!frameID, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid frameID");
-       metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
-
-       // If the pointer is NULL or c-string is empty - handle as request for deletion
-       if (!value || (*value == '\0')) {
-               metadata_editor_info("Request for frame %s deletion", frameID);
-               tag2->removeFrames(frameID);
-               return METADATA_EDITOR_ERROR_NONE;
-       }
-
-       // Check if the ID3v2 tag exists
-       if (tag2->frameListMap()[frameID].isEmpty()) {
-               metadata_editor_info("The frame %s does not exist. Creating", frameID);
-               // This is a common frame type for textural frames except comment frame
-               auto fr = new ID3v2::TextIdentificationFrame(frameID);
-
-               fr->setTextEncoding(String::UTF8);
-               fr->setText(String(value, String::UTF8));
-               tag2->addFrame(fr);
-       } else {                // if not - just modify the data in the existing frame
-               metadata_editor_info("The frame %s exists. Changing", frameID);
-               tag2->frameListMap()[frameID][0]->setText(String(value, String::UTF8));
-       }
-
-       return METADATA_EDITOR_ERROR_NONE;
-}
-
 static int __ID3_getNumberOfPictures(ID3v2::Tag *tag2, char **value)
 {
        metadata_editor_retvm_if(!value, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid value");
@@ -920,12 +920,12 @@ static int __metadata_editor_set_mp3_metadata(metadata_editor_s *metadata, metad
                case METADATA_EDITOR_ATTR_TITLE:                        return __ID3_setTwixFrameByName(tag1, tag2, "TIT2", value);
                case METADATA_EDITOR_ATTR_ALBUM:                        return __ID3_setTwixFrameByName(tag1, tag2, "TALB", value);
                case METADATA_EDITOR_ATTR_GENRE:                        return __ID3_setTwixFrameByName(tag1, tag2, "TCON", value);
-               case METADATA_EDITOR_ATTR_AUTHOR:                       return __ID3_setFrameByName(tag2, "TCOM", value);
-               case METADATA_EDITOR_ATTR_COPYRIGHT:            return __ID3_setFrameByName(tag2, "TCOP", value);
+               case METADATA_EDITOR_ATTR_AUTHOR:                       return __ID3v2_setFrameByName(tag2, "TCOM", value);
+               case METADATA_EDITOR_ATTR_COPYRIGHT:            return __ID3v2_setFrameByName(tag2, "TCOP", value);
                case METADATA_EDITOR_ATTR_DATE:                 return __ID3_setTwixFrameByName(tag1, tag2, "TDRC", value);
-               case METADATA_EDITOR_ATTR_DESCRIPTION:          return __ID3_setFrameByName(tag2, "TIT3", value);
+               case METADATA_EDITOR_ATTR_DESCRIPTION:          return __ID3v2_setFrameByName(tag2, "TIT3", value);
                case METADATA_EDITOR_ATTR_TRACK_NUM:            return __ID3_setTwixFrameByName(tag1, tag2, "TRCK", value);
-               case METADATA_EDITOR_ATTR_CONDUCTOR:            return __ID3_setFrameByName(tag2, "TPE3", value);
+               case METADATA_EDITOR_ATTR_CONDUCTOR:            return __ID3v2_setFrameByName(tag2, "TPE3", value);
                case METADATA_EDITOR_ATTR_COMMENT:              return __ID3_setTwixCommentFrame(tag1, tag2, value);
                case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_setLyricsFrame(tag2, value);
                default:
@@ -1077,16 +1077,16 @@ static int __metadata_editor_set_wav_metadata(metadata_editor_s *metadata, metad
        }
 
        switch (attribute) {                                    // Check which one of frame type was given for processing
-               case METADATA_EDITOR_ATTR_ARTIST:                       return __ID3_setFrameByName(tag2, "TPE1", value);
-               case METADATA_EDITOR_ATTR_TITLE:                        return __ID3_setFrameByName(tag2, "TIT2", value);
-               case METADATA_EDITOR_ATTR_ALBUM:                        return __ID3_setFrameByName(tag2, "TALB", value);
-               case METADATA_EDITOR_ATTR_GENRE:                        return __ID3_setFrameByName(tag2, "TCON", value);
-               case METADATA_EDITOR_ATTR_AUTHOR:                       return __ID3_setFrameByName(tag2, "TCOM", value);
-               case METADATA_EDITOR_ATTR_COPYRIGHT:            return __ID3_setFrameByName(tag2, "TCOP", value);
-               case METADATA_EDITOR_ATTR_DATE:                 return __ID3_setFrameByName(tag2, "TDRC", value);
-               case METADATA_EDITOR_ATTR_DESCRIPTION:          return __ID3_setFrameByName(tag2, "TIT3", value);
-               case METADATA_EDITOR_ATTR_TRACK_NUM:            return __ID3_setFrameByName(tag2, "TRCK", value);
-               case METADATA_EDITOR_ATTR_CONDUCTOR:            return __ID3_setFrameByName(tag2, "TPE3", value);
+               case METADATA_EDITOR_ATTR_ARTIST:                       return __ID3v2_setFrameByName(tag2, "TPE1", value);
+               case METADATA_EDITOR_ATTR_TITLE:                        return __ID3v2_setFrameByName(tag2, "TIT2", value);
+               case METADATA_EDITOR_ATTR_ALBUM:                        return __ID3v2_setFrameByName(tag2, "TALB", value);
+               case METADATA_EDITOR_ATTR_GENRE:                        return __ID3v2_setFrameByName(tag2, "TCON", value);
+               case METADATA_EDITOR_ATTR_AUTHOR:                       return __ID3v2_setFrameByName(tag2, "TCOM", value);
+               case METADATA_EDITOR_ATTR_COPYRIGHT:            return __ID3v2_setFrameByName(tag2, "TCOP", value);
+               case METADATA_EDITOR_ATTR_DATE:                 return __ID3v2_setFrameByName(tag2, "TDRC", value);
+               case METADATA_EDITOR_ATTR_DESCRIPTION:          return __ID3v2_setFrameByName(tag2, "TIT3", value);
+               case METADATA_EDITOR_ATTR_TRACK_NUM:            return __ID3v2_setFrameByName(tag2, "TRCK", value);
+               case METADATA_EDITOR_ATTR_CONDUCTOR:            return __ID3v2_setFrameByName(tag2, "TPE3", value);
                case METADATA_EDITOR_ATTR_COMMENT:              return __ID3_setTwixCommentFrame(NULL, tag2, value);
                case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_setLyricsFrame(tag2, value);
                default: