From bb27b4d8153a3cb91996bf884d3c3602942e273a Mon Sep 17 00:00:00 2001 From: hj kim Date: Mon, 25 May 2020 15:24:08 +0900 Subject: [PATCH] Remove unnecessary parameter Change-Id: Ie1d7fc71dbb4fee4b49e0c0b0e0ac0043aa00f1e --- src/metadata_editor.cpp | 308 +++++++++++++++++++++--------------------------- 1 file changed, 134 insertions(+), 174 deletions(-) diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index da684d0..576a400 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -94,12 +94,8 @@ static int __check_metadata_get_parameter(metadata_editor_s *metadata, char **va return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_getTwixFrameByName(metadata_editor_s *_metadata, ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *frameID, char **value) +static int __ID3_getTwixFrameByName(ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *frameID, char **value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_get_parameter(_metadata, value); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); metadata_editor_retvm_if(!frameID, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid frameID"); if (tag2 && !(tag2->frameListMap()[frameID].isEmpty())) { @@ -139,12 +135,8 @@ static int __ID3_getTwixFrameByName(metadata_editor_s *_metadata, ID3v1::Tag *ta return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_setTwixFrameByName(metadata_editor_s *_metadata, ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *frameID, const char *value) +static int __ID3_setTwixFrameByName(ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *frameID, const char *value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_set_parameter(_metadata); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); 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"); @@ -203,12 +195,8 @@ static int __ID3_setTwixFrameByName(metadata_editor_s *_metadata, ID3v1::Tag *ta return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_getFrameByName(metadata_editor_s *_metadata, ID3v2::Tag *tag2, const char *frameID, char **value) +static int __ID3_getFrameByName(ID3v2::Tag *tag2, const char *frameID, char **value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_get_parameter(_metadata, value); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); metadata_editor_retvm_if(!frameID, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid frameID"); metadata_editor_retvm_if(!tag2 || tag2->frameListMap()[frameID].isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame %s does not exist", frameID); @@ -219,12 +207,8 @@ static int __ID3_getFrameByName(metadata_editor_s *_metadata, ID3v2::Tag *tag2, return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_setFrameByName(metadata_editor_s *_metadata, ID3v2::Tag *tag2, const char *frameID, const char *value) +static int __ID3_setFrameByName(ID3v2::Tag *tag2, const char *frameID, const char *value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_set_parameter(_metadata); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); 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"); @@ -252,12 +236,8 @@ static int __ID3_setFrameByName(metadata_editor_s *_metadata, ID3v2::Tag *tag2, return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_getNumberOfPictures(metadata_editor_s *_metadata, ID3v2::Tag *tag2, char **value) +static int __ID3_getNumberOfPictures(ID3v2::Tag *tag2, char **value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_get_parameter(_metadata, value); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further"); *value = g_strdup_printf("%u", tag2->frameListMap()["APIC"].size()); @@ -265,12 +245,8 @@ static int __ID3_getNumberOfPictures(metadata_editor_s *_metadata, ID3v2::Tag *t return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_getLyricsFrame(metadata_editor_s *_metadata, ID3v2::Tag *tag2, char **value) +static int __ID3_getLyricsFrame(ID3v2::Tag *tag2, char **value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_get_parameter(_metadata, value); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further"); auto lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag @@ -286,12 +262,8 @@ static int __ID3_getLyricsFrame(metadata_editor_s *_metadata, ID3v2::Tag *tag2, return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_setTwixCommentFrame(metadata_editor_s *_metadata, ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *value) +static int __ID3_setTwixCommentFrame(ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_set_parameter(_metadata); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); 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 @@ -323,12 +295,8 @@ static int __ID3_setTwixCommentFrame(metadata_editor_s *_metadata, ID3v1::Tag *t return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_setLyricsFrame(metadata_editor_s *_metadata, ID3v2::Tag *tag2, const char *value) +static int __ID3_setLyricsFrame(ID3v2::Tag *tag2, const char *value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_set_parameter(_metadata); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); auto lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag @@ -477,14 +445,10 @@ static int __MP4_getNumberOfPictures(metadata_editor_s *_metadata, char **value) } #if 0 -static int __xiph_getFieldValue(metadata_editor_s *_metadata, Ogg::XiphComment *xtag, const char *fieldname, char **value) +static int __xiph_getFieldValue(Ogg::XiphComment *xtag, const char *fieldname, char **value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_get_parameter(_metadata, value); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); - metadata_editor_retvm_if(!fieldname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid fieldname"); metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); + metadata_editor_retvm_if(!fieldname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid fieldname"); auto &fieldMap = xtag->fieldListMap(); auto it = fieldMap.find(fieldname); @@ -497,14 +461,10 @@ static int __xiph_getFieldValue(metadata_editor_s *_metadata, Ogg::XiphComment * return METADATA_EDITOR_ERROR_NONE; } -static int __xiph_updateFieldValue(metadata_editor_s *_metadata, Ogg::XiphComment *xtag, const char *fieldname, const char *value) +static int __xiph_updateFieldValue(Ogg::XiphComment *xtag, const char *fieldname, const char *value) { - int ret = METADATA_EDITOR_ERROR_NONE; - - ret = __check_metadata_set_parameter(_metadata); - metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); - metadata_editor_retvm_if(!fieldname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid fieldname"); metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); + metadata_editor_retvm_if(!fieldname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid fieldname"); // Check if it is a request for deletion if ((value == NULL) || value[0] == '\0') { @@ -751,19 +711,19 @@ static int __metadata_editor_get_mp3_metadata(metadata_editor_s *metadata, metad auto tag2 = _file->ID3v2Tag(); switch (attribute) { // Check which one of frame types was given to the function for processing - case METADATA_EDITOR_ATTR_ARTIST: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TPE1", value); - case METADATA_EDITOR_ATTR_TITLE: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TIT2", value); - case METADATA_EDITOR_ATTR_ALBUM: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TALB", value); - case METADATA_EDITOR_ATTR_GENRE: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TCON", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __ID3_getFrameByName(metadata, tag2, "TCOM", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __ID3_getFrameByName(metadata, tag2, "TCOP", value); - case METADATA_EDITOR_ATTR_DATE: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TDRC", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_getFrameByName(metadata, tag2, "TIT3", value); - case METADATA_EDITOR_ATTR_COMMENT: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "COMM", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TRCK", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __ID3_getFrameByName(metadata, tag2, "TPE3", value); - case METADATA_EDITOR_ATTR_PICTURE_NUM: return __ID3_getNumberOfPictures(metadata, tag2, value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_getLyricsFrame(metadata, tag2, value); + case METADATA_EDITOR_ATTR_ARTIST: return __ID3_getTwixFrameByName(tag1, tag2, "TPE1", value); + case METADATA_EDITOR_ATTR_TITLE: return __ID3_getTwixFrameByName(tag1, tag2, "TIT2", value); + case METADATA_EDITOR_ATTR_ALBUM: return __ID3_getTwixFrameByName(tag1, tag2, "TALB", value); + case METADATA_EDITOR_ATTR_GENRE: return __ID3_getTwixFrameByName(tag1, tag2, "TCON", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __ID3_getFrameByName(tag2, "TCOM", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __ID3_getFrameByName(tag2, "TCOP", value); + case METADATA_EDITOR_ATTR_DATE: return __ID3_getTwixFrameByName(tag1, tag2, "TDRC", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_getFrameByName(tag2, "TIT3", value); + case METADATA_EDITOR_ATTR_COMMENT: return __ID3_getTwixFrameByName(tag1, tag2, "COMM", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __ID3_getTwixFrameByName(tag1, tag2, "TRCK", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __ID3_getFrameByName(tag2, "TPE3", value); + case METADATA_EDITOR_ATTR_PICTURE_NUM: return __ID3_getNumberOfPictures(tag2, value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_getLyricsFrame(tag2, value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -814,18 +774,18 @@ static int __metadata_editor_get_flac_metadata(metadata_editor_s *metadata, meta return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame types was given to the function for processing - case METADATA_EDITOR_ATTR_ARTIST: return __xiph_getFieldValue(metadata, xtag, "ARTIST", value); - case METADATA_EDITOR_ATTR_TITLE: return __xiph_getFieldValue(metadata, xtag, "TITLE", value); - case METADATA_EDITOR_ATTR_ALBUM: return __xiph_getFieldValue(metadata, xtag, "ALBUM", value); - case METADATA_EDITOR_ATTR_GENRE: return __xiph_getFieldValue(metadata, xtag, "GENRE", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_getFieldValue(metadata, xtag, "COMPOSER", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_getFieldValue(metadata, xtag, "COPYRIGHT", value); - case METADATA_EDITOR_ATTR_DATE: return __xiph_getFieldValue(metadata, xtag, "DATE", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_getFieldValue(metadata, xtag, "DESCRIPTION", value); - case METADATA_EDITOR_ATTR_COMMENT: return __xiph_getFieldValue(metadata, xtag, "COMMENT", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_getFieldValue(metadata, xtag, "TRACKNUMBER", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_getFieldValue(metadata, xtag, "CONDUCTOR", value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_getFieldValue(metadata, xtag, "LYRICS", value); + case METADATA_EDITOR_ATTR_ARTIST: return __xiph_getFieldValue(xtag, "ARTIST", value); + case METADATA_EDITOR_ATTR_TITLE: return __xiph_getFieldValue(xtag, "TITLE", value); + case METADATA_EDITOR_ATTR_ALBUM: return __xiph_getFieldValue(xtag, "ALBUM", value); + case METADATA_EDITOR_ATTR_GENRE: return __xiph_getFieldValue(xtag, "GENRE", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_getFieldValue(xtag, "COMPOSER", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_getFieldValue(xtag, "COPYRIGHT", value); + case METADATA_EDITOR_ATTR_DATE: return __xiph_getFieldValue(xtag, "DATE", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_getFieldValue(xtag, "DESCRIPTION", value); + case METADATA_EDITOR_ATTR_COMMENT: return __xiph_getFieldValue(xtag, "COMMENT", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_getFieldValue(xtag, "TRACKNUMBER", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_getFieldValue(xtag, "CONDUCTOR", value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_getFieldValue(xtag, "LYRICS", value); case METADATA_EDITOR_ATTR_PICTURE_NUM: return __FLAC_getNumberOfPictures(metadata, value); default: metadata_editor_error("Invalid attribute [%d]", attribute); @@ -849,18 +809,18 @@ static int __metadata_editor_get_ogg_vorbis_metadata(metadata_editor_s *metadata return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame types was given to the function for processing - case METADATA_EDITOR_ATTR_ARTIST: return __xiph_getFieldValue(metadata, xtag, "ARTIST", value); - case METADATA_EDITOR_ATTR_TITLE: return __xiph_getFieldValue(metadata, xtag, "TITLE", value); - case METADATA_EDITOR_ATTR_ALBUM: return __xiph_getFieldValue(metadata, xtag, "ALBUM", value); - case METADATA_EDITOR_ATTR_GENRE: return __xiph_getFieldValue(metadata, xtag, "GENRE", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_getFieldValue(metadata, xtag, "COMPOSER", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_getFieldValue(metadata, xtag, "COPYRIGHT", value); - case METADATA_EDITOR_ATTR_DATE: return __xiph_getFieldValue(metadata, xtag, "DATE", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_getFieldValue(metadata, xtag, "DESCRIPTION", value); - case METADATA_EDITOR_ATTR_COMMENT: return __xiph_getFieldValue(metadata, xtag, "COMMENT", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_getFieldValue(metadata, xtag, "TRACKNUMBER", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_getFieldValue(metadata, xtag, "CONDUCTOR", value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_getFieldValue(metadata, xtag, "LYRICS", value); + case METADATA_EDITOR_ATTR_ARTIST: return __xiph_getFieldValue(xtag, "ARTIST", value); + case METADATA_EDITOR_ATTR_TITLE: return __xiph_getFieldValue(xtag, "TITLE", value); + case METADATA_EDITOR_ATTR_ALBUM: return __xiph_getFieldValue(xtag, "ALBUM", value); + case METADATA_EDITOR_ATTR_GENRE: return __xiph_getFieldValue(xtag, "GENRE", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_getFieldValue(xtag, "COMPOSER", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_getFieldValue(xtag, "COPYRIGHT", value); + case METADATA_EDITOR_ATTR_DATE: return __xiph_getFieldValue(xtag, "DATE", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_getFieldValue(xtag, "DESCRIPTION", value); + case METADATA_EDITOR_ATTR_COMMENT: return __xiph_getFieldValue(xtag, "COMMENT", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_getFieldValue(xtag, "TRACKNUMBER", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_getFieldValue(xtag, "CONDUCTOR", value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_getFieldValue(xtag, "LYRICS", value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -883,18 +843,18 @@ static int __metadata_editor_get_ogg_flac_metadata(metadata_editor_s *metadata, return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame types was given to the function for processing - case METADATA_EDITOR_ATTR_ARTIST: return __xiph_getFieldValue(metadata, xtag, "ARTIST", value); - case METADATA_EDITOR_ATTR_TITLE: return __xiph_getFieldValue(metadata, xtag, "TITLE", value); - case METADATA_EDITOR_ATTR_ALBUM: return __xiph_getFieldValue(metadata, xtag, "ALBUM", value); - case METADATA_EDITOR_ATTR_GENRE: return __xiph_getFieldValue(metadata, xtag, "GENRE", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_getFieldValue(metadata, xtag, "COMPOSER", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_getFieldValue(metadata, xtag, "COPYRIGHT", value); - case METADATA_EDITOR_ATTR_DATE: return __xiph_getFieldValue(metadata, xtag, "DATE", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_getFieldValue(metadata, xtag, "DESCRIPTION", value); - case METADATA_EDITOR_ATTR_COMMENT: return __xiph_getFieldValue(metadata, xtag, "COMMENT", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_getFieldValue(metadata, xtag, "TRACKNUMBER", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_getFieldValue(metadata, xtag, "CONDUCTOR", value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_getFieldValue(metadata, xtag, "LYRICS", value); + case METADATA_EDITOR_ATTR_ARTIST: return __xiph_getFieldValue(xtag, "ARTIST", value); + case METADATA_EDITOR_ATTR_TITLE: return __xiph_getFieldValue(xtag, "TITLE", value); + case METADATA_EDITOR_ATTR_ALBUM: return __xiph_getFieldValue(xtag, "ALBUM", value); + case METADATA_EDITOR_ATTR_GENRE: return __xiph_getFieldValue(xtag, "GENRE", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_getFieldValue(xtag, "COMPOSER", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_getFieldValue(xtag, "COPYRIGHT", value); + case METADATA_EDITOR_ATTR_DATE: return __xiph_getFieldValue(xtag, "DATE", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_getFieldValue(xtag, "DESCRIPTION", value); + case METADATA_EDITOR_ATTR_COMMENT: return __xiph_getFieldValue(xtag, "COMMENT", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_getFieldValue(xtag, "TRACKNUMBER", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_getFieldValue(xtag, "CONDUCTOR", value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_getFieldValue(xtag, "LYRICS", value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -919,19 +879,19 @@ static int __metadata_editor_get_wav_metadata(metadata_editor_s *metadata, metad } switch (attribute) { // Check which one of frame types was given to the function for processing - case METADATA_EDITOR_ATTR_ARTIST: return __ID3_getFrameByName(metadata, tag2, "TPE1", value); - case METADATA_EDITOR_ATTR_TITLE: return __ID3_getFrameByName(metadata, tag2, "TIT2", value); - case METADATA_EDITOR_ATTR_ALBUM: return __ID3_getFrameByName(metadata, tag2, "TALB", value); - case METADATA_EDITOR_ATTR_GENRE: return __ID3_getFrameByName(metadata, tag2, "TCON", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __ID3_getFrameByName(metadata, tag2, "TCOM", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __ID3_getFrameByName(metadata, tag2, "TCOP", value); - case METADATA_EDITOR_ATTR_DATE: return __ID3_getFrameByName(metadata, tag2, "TDRC", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_getFrameByName(metadata, tag2, "TIT3", value); - case METADATA_EDITOR_ATTR_COMMENT: return __ID3_getFrameByName(metadata, tag2, "COMM", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __ID3_getFrameByName(metadata, tag2, "TRCK", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __ID3_getFrameByName(metadata, tag2, "TPE3", value); - case METADATA_EDITOR_ATTR_PICTURE_NUM: return __ID3_getNumberOfPictures(metadata, tag2, value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_getLyricsFrame(metadata, tag2, value); + case METADATA_EDITOR_ATTR_ARTIST: return __ID3_getFrameByName(tag2, "TPE1", value); + case METADATA_EDITOR_ATTR_TITLE: return __ID3_getFrameByName(tag2, "TIT2", value); + case METADATA_EDITOR_ATTR_ALBUM: return __ID3_getFrameByName(tag2, "TALB", value); + case METADATA_EDITOR_ATTR_GENRE: return __ID3_getFrameByName(tag2, "TCON", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __ID3_getFrameByName(tag2, "TCOM", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __ID3_getFrameByName(tag2, "TCOP", value); + case METADATA_EDITOR_ATTR_DATE: return __ID3_getFrameByName(tag2, "TDRC", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_getFrameByName(tag2, "TIT3", value); + case METADATA_EDITOR_ATTR_COMMENT: return __ID3_getFrameByName(tag2, "COMM", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __ID3_getFrameByName(tag2, "TRCK", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __ID3_getFrameByName(tag2, "TPE3", value); + case METADATA_EDITOR_ATTR_PICTURE_NUM: return __ID3_getNumberOfPictures(tag2, value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_getLyricsFrame(tag2, value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -987,18 +947,18 @@ static int __metadata_editor_set_mp3_metadata(metadata_editor_s *metadata, metad metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); switch (attribute) { // Check which one of frame type was given for processing - case METADATA_EDITOR_ATTR_ARTIST: return __ID3_setTwixFrameByName(metadata, tag1, tag2, "TPE1", value); - case METADATA_EDITOR_ATTR_TITLE: return __ID3_setTwixFrameByName(metadata, tag1, tag2, "TIT2", value); - case METADATA_EDITOR_ATTR_ALBUM: return __ID3_setTwixFrameByName(metadata, tag1, tag2, "TALB", value); - case METADATA_EDITOR_ATTR_GENRE: return __ID3_setTwixFrameByName(metadata, tag1, tag2, "TCON", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __ID3_setFrameByName(metadata, tag2, "TCOM", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __ID3_setFrameByName(metadata, tag2, "TCOP", value); - case METADATA_EDITOR_ATTR_DATE: return __ID3_setTwixFrameByName(metadata, tag1, tag2, "TDRC", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_setFrameByName(metadata, tag2, "TIT3", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __ID3_setTwixFrameByName(metadata, tag1, tag2, "TRCK", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __ID3_setFrameByName(metadata, tag2, "TPE3", value); - case METADATA_EDITOR_ATTR_COMMENT: return __ID3_setTwixCommentFrame(metadata, tag1, tag2, value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_setLyricsFrame(metadata, tag2, value); + case METADATA_EDITOR_ATTR_ARTIST: return __ID3_setTwixFrameByName(tag1, tag2, "TPE1", value); + 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_DATE: return __ID3_setTwixFrameByName(tag1, tag2, "TDRC", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_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_COMMENT: return __ID3_setTwixCommentFrame(tag1, tag2, value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_setLyricsFrame(tag2, value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -1047,18 +1007,18 @@ static int __metadata_editor_set_flac_metadata(metadata_editor_s *metadata, meta return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame type was given for processing - case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(metadata, xtag, "ARTIST", value); - case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(metadata, xtag, "TITLE", value); - case METADATA_EDITOR_ATTR_ALBUM: return __xiph_updateFieldValue(metadata, xtag, "ALBUM", value); - case METADATA_EDITOR_ATTR_GENRE: return __xiph_updateFieldValue(metadata, xtag, "GENRE", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_updateFieldValue(metadata, xtag, "COMPOSER", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_updateFieldValue(metadata, xtag, "COPYRIGHT", value); - case METADATA_EDITOR_ATTR_DATE: return __xiph_updateFieldValue(metadata, xtag, "DATE", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_updateFieldValue(metadata, xtag, "DESCRIPTION", value); - case METADATA_EDITOR_ATTR_COMMENT: return __xiph_updateFieldValue(metadata, xtag, "COMMENT", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_updateFieldValue(metadata, xtag, "TRACKNUMBER", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_updateFieldValue(metadata, xtag, "CONDUCTOR", value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_updateFieldValue(metadata, xtag, "LYRICS", value); + case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(xtag, "ARTIST", value); + case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(xtag, "TITLE", value); + case METADATA_EDITOR_ATTR_ALBUM: return __xiph_updateFieldValue(xtag, "ALBUM", value); + case METADATA_EDITOR_ATTR_GENRE: return __xiph_updateFieldValue(xtag, "GENRE", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_updateFieldValue(xtag, "COMPOSER", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_updateFieldValue(xtag, "COPYRIGHT", value); + case METADATA_EDITOR_ATTR_DATE: return __xiph_updateFieldValue(xtag, "DATE", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_updateFieldValue(xtag, "DESCRIPTION", value); + case METADATA_EDITOR_ATTR_COMMENT: return __xiph_updateFieldValue(xtag, "COMMENT", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_updateFieldValue(xtag, "TRACKNUMBER", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_updateFieldValue(xtag, "CONDUCTOR", value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_updateFieldValue(xtag, "LYRICS", value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -1080,18 +1040,18 @@ static int __metadata_editor_set_ogg_vorbis_metadata(metadata_editor_s *metadata return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame type was given for processing - case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(metadata, xtag, "ARTIST", value); - case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(metadata, xtag, "TITLE", value); - case METADATA_EDITOR_ATTR_ALBUM: return __xiph_updateFieldValue(metadata, xtag, "ALBUM", value); - case METADATA_EDITOR_ATTR_GENRE: return __xiph_updateFieldValue(metadata, xtag, "GENRE", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_updateFieldValue(metadata, xtag, "COMPOSER", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_updateFieldValue(metadata, xtag, "COPYRIGHT", value); - case METADATA_EDITOR_ATTR_DATE: return __xiph_updateFieldValue(metadata, xtag, "DATE", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_updateFieldValue(metadata, xtag, "DESCRIPTION", value); - case METADATA_EDITOR_ATTR_COMMENT: return __xiph_updateFieldValue(metadata, xtag, "COMMENT", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_updateFieldValue(metadata, xtag, "TRACKNUMBER", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_updateFieldValue(metadata, xtag, "CONDUCTOR", value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_updateFieldValue(metadata, xtag, "LYRICS", value); + case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(xtag, "ARTIST", value); + case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(xtag, "TITLE", value); + case METADATA_EDITOR_ATTR_ALBUM: return __xiph_updateFieldValue(xtag, "ALBUM", value); + case METADATA_EDITOR_ATTR_GENRE: return __xiph_updateFieldValue(xtag, "GENRE", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_updateFieldValue(xtag, "COMPOSER", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_updateFieldValue(xtag, "COPYRIGHT", value); + case METADATA_EDITOR_ATTR_DATE: return __xiph_updateFieldValue(xtag, "DATE", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_updateFieldValue(xtag, "DESCRIPTION", value); + case METADATA_EDITOR_ATTR_COMMENT: return __xiph_updateFieldValue(xtag, "COMMENT", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_updateFieldValue(xtag, "TRACKNUMBER", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_updateFieldValue(xtag, "CONDUCTOR", value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_updateFieldValue(xtag, "LYRICS", value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -1113,18 +1073,18 @@ static int __metadata_editor_set_ogg_flac_metadata(metadata_editor_s *metadata, return METADATA_EDITOR_ERROR_OPERATION_FAILED; } switch (attribute) { // Check which one of frame type was given for processing - case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(metadata, xtag, "ARTIST", value); - case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(metadata, xtag, "TITLE", value); - case METADATA_EDITOR_ATTR_ALBUM: return __xiph_updateFieldValue(metadata, xtag, "ALBUM", value); - case METADATA_EDITOR_ATTR_GENRE: return __xiph_updateFieldValue(metadata, xtag, "GENRE", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_updateFieldValue(metadata, xtag, "COMPOSER", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_updateFieldValue(metadata, xtag, "COPYRIGHT", value); - case METADATA_EDITOR_ATTR_DATE: return __xiph_updateFieldValue(metadata, xtag, "DATE", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_updateFieldValue(metadata, xtag, "DESCRIPTION", value); - case METADATA_EDITOR_ATTR_COMMENT: return __xiph_updateFieldValue(metadata, xtag, "COMMENT", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_updateFieldValue(metadata, xtag, "TRACKNUMBER", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_updateFieldValue(metadata, xtag, "CONDUCTOR", value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_updateFieldValue(metadata, xtag, "LYRICS", value); + case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(xtag, "ARTIST", value); + case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(xtag, "TITLE", value); + case METADATA_EDITOR_ATTR_ALBUM: return __xiph_updateFieldValue(xtag, "ALBUM", value); + case METADATA_EDITOR_ATTR_GENRE: return __xiph_updateFieldValue(xtag, "GENRE", value); + case METADATA_EDITOR_ATTR_AUTHOR: return __xiph_updateFieldValue(xtag, "COMPOSER", value); + case METADATA_EDITOR_ATTR_COPYRIGHT: return __xiph_updateFieldValue(xtag, "COPYRIGHT", value); + case METADATA_EDITOR_ATTR_DATE: return __xiph_updateFieldValue(xtag, "DATE", value); + case METADATA_EDITOR_ATTR_DESCRIPTION: return __xiph_updateFieldValue(xtag, "DESCRIPTION", value); + case METADATA_EDITOR_ATTR_COMMENT: return __xiph_updateFieldValue(xtag, "COMMENT", value); + case METADATA_EDITOR_ATTR_TRACK_NUM: return __xiph_updateFieldValue(xtag, "TRACKNUMBER", value); + case METADATA_EDITOR_ATTR_CONDUCTOR: return __xiph_updateFieldValue(xtag, "CONDUCTOR", value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __xiph_updateFieldValue(xtag, "LYRICS", value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; @@ -1148,18 +1108,18 @@ 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(metadata, tag2, "TPE1", value); - case METADATA_EDITOR_ATTR_TITLE: return __ID3_setFrameByName(metadata, tag2, "TIT2", value); - case METADATA_EDITOR_ATTR_ALBUM: return __ID3_setFrameByName(metadata, tag2, "TALB", value); - case METADATA_EDITOR_ATTR_GENRE: return __ID3_setFrameByName(metadata, tag2, "TCON", value); - case METADATA_EDITOR_ATTR_AUTHOR: return __ID3_setFrameByName(metadata, tag2, "TCOM", value); - case METADATA_EDITOR_ATTR_COPYRIGHT: return __ID3_setFrameByName(metadata, tag2, "TCOP", value); - case METADATA_EDITOR_ATTR_DATE: return __ID3_setFrameByName(metadata, tag2, "TDRC", value); - case METADATA_EDITOR_ATTR_DESCRIPTION: return __ID3_setFrameByName(metadata, tag2, "TIT3", value); - case METADATA_EDITOR_ATTR_TRACK_NUM: return __ID3_setFrameByName(metadata, tag2, "TRCK", value); - case METADATA_EDITOR_ATTR_CONDUCTOR: return __ID3_setFrameByName(metadata, tag2, "TPE3", value); - case METADATA_EDITOR_ATTR_COMMENT: return __ID3_setTwixCommentFrame(metadata, NULL, tag2, value); - case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_setLyricsFrame(metadata, tag2, value); + 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_COMMENT: return __ID3_setTwixCommentFrame(NULL, tag2, value); + case METADATA_EDITOR_ATTR_UNSYNCLYRICS: return __ID3_setLyricsFrame(tag2, value); default: metadata_editor_error("Invalid attribute [%d]", attribute); return METADATA_EDITOR_ERROR_INVALID_PARAMETER; -- 2.7.4