From: hj kim Date: Tue, 12 May 2020 11:16:09 +0000 (+0900) Subject: Apply tizen coding rule X-Git-Tag: submit/tizen/20200602.021203~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6236e096c810b77ad37e6b97b470047829e53427;p=platform%2Fcore%2Fapi%2Fmetadata-editor.git Apply tizen coding rule Change-Id: Ib5238374d93a580bc9b7cd9cf4d8df5b3a1afc5c --- diff --git a/src/metadata_editor.cpp b/src/metadata_editor.cpp index 80d3be3..216c0f7 100755 --- a/src/metadata_editor.cpp +++ b/src/metadata_editor.cpp @@ -26,21 +26,6 @@ #define MIME_TYPE_JPEG "image/jpeg" #define MIME_TYPE_PNG "image/png" -static int __ID3_getTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* frameID, char** value); -static int __ID3_setTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* frameID, const char* value); -static int __ID3_getFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, const char* frameID, char** value); -static int __ID3_setFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, const char* frameID, const char* value); -static int __ID3_getLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, char** value); -static int __ID3_setTwixCommentFrame(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* value); -static int __ID3_setLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, const char* value); -static int __MP4_getStringItem(metadata_editor_s* _metadata, const char* itemname, char** value); -static int __MP4_getIntegerItem(metadata_editor_s* _metadata, const char* itemname, char** value); -static int __MP4_updateStringItem(metadata_editor_s* _metadata, const char* itemname, const char* value); -static int __MP4_updateIntegerItem(metadata_editor_s* _metadata, const char* itemname, const char* value); -#if 0 -static int __xiph_getFieldValue(metadata_editor_s* _metadata, TagLib::Ogg::XiphComment* xtag, const char* fieldname, char** value); -static int __xiph_updateFieldValue(metadata_editor_s* _metadata, TagLib::Ogg::XiphComment* xtag, const char* fieldname, const char* value); -#endif typedef enum { METADATA_EDITOR_FORMAT_MP3 = 0, /**< MP3 File */ METADATA_EDITOR_FORMAT_MP4, /**< MP4 File */ @@ -126,10 +111,8 @@ static int __ID3_getTwixFrameByName(metadata_editor_s *_metadata, TagLib::ID3v1: return METADATA_EDITOR_ERROR_NONE; } - -// *** This is an auxiliary function that is used to write the new value to the frame *** // -// *** It operates with frames that exists both in ID3v1 and ID3v2 tags *** // -static int __ID3_setTwixFrameByName(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* frameID, const char* value) { +static int __ID3_setTwixFrameByName(metadata_editor_s *_metadata, TagLib::ID3v1::Tag *tag1, TagLib::ID3v2::Tag *tag2, const char *frameID, const char *value) +{ int ret = METADATA_EDITOR_ERROR_NONE; ret = __check_metadata_set_parameter(_metadata); @@ -208,8 +191,8 @@ static int __ID3_getFrameByName(metadata_editor_s *_metadata, TagLib::ID3v2::Tag return METADATA_EDITOR_ERROR_NONE; } -// *** This function writes frames that exist only in ID3v2 tag *** // -static int __ID3_setFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, const char* frameID, const char* value) { +static int __ID3_setFrameByName(metadata_editor_s *_metadata, TagLib::ID3v2::Tag *tag2, const char *frameID, const char *value) +{ int ret = METADATA_EDITOR_ERROR_NONE; ret = __check_metadata_set_parameter(_metadata); @@ -241,7 +224,7 @@ static int __ID3_setFrameByName(metadata_editor_s* _metadata, TagLib::ID3v2::Tag return METADATA_EDITOR_ERROR_NONE; } -static int __ID3_getNumberOfPictures(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, char** value) +static int __ID3_getNumberOfPictures(metadata_editor_s *_metadata, TagLib::ID3v2::Tag *tag2, char **value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -274,9 +257,9 @@ static int __ID3_getLyricsFrame(metadata_editor_s *_metadata, TagLib::ID3v2::Tag return METADATA_EDITOR_ERROR_NONE; } -// *** This function is used to set text in comment frame. It processes both ID3v1 and ID3v2 tags *** // // *** Comment frame is different from other string-type frames. It uses CommentsFrame instead of TextIdentificationFrame *** // -static int __ID3_setTwixCommentFrame(metadata_editor_s* _metadata, TagLib::ID3v1::Tag* tag1, TagLib::ID3v2::Tag* tag2, const char* value) { +static int __ID3_setTwixCommentFrame(metadata_editor_s *_metadata, TagLib::ID3v1::Tag *tag1, TagLib::ID3v2::Tag *tag2, const char *value) +{ int ret = METADATA_EDITOR_ERROR_NONE; ret = __check_metadata_set_parameter(_metadata); @@ -312,9 +295,9 @@ static int __ID3_setTwixCommentFrame(metadata_editor_s* _metadata, TagLib::ID3v1 return METADATA_EDITOR_ERROR_NONE; } -// *** This function is used to set text in Lyrics frame *** // // *** Lyrics frame is different from other string-type frames and uses UnsynchronizedLyricsFrame instead of TextIdentificationFrame *** // -static int __ID3_setLyricsFrame(metadata_editor_s* _metadata, TagLib::ID3v2::Tag* tag2, const char* value) { +static int __ID3_setLyricsFrame(metadata_editor_s *_metadata, TagLib::ID3v2::Tag *tag2, const char *value) +{ int ret = METADATA_EDITOR_ERROR_NONE; ret = __check_metadata_set_parameter(_metadata); @@ -392,7 +375,7 @@ static int __MP4_getIntegerItem(metadata_editor_s *_metadata, const char *itemna return METADATA_EDITOR_ERROR_NONE; } -static int __MP4_updateStringItem(metadata_editor_s* _metadata, const char* itemname, const char* value) +static int __MP4_updateStringItem(metadata_editor_s *_metadata, const char *itemname, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -419,7 +402,7 @@ static int __MP4_updateStringItem(metadata_editor_s* _metadata, const char* item return METADATA_EDITOR_ERROR_NONE; } -static int __MP4_updateIntegerItem(metadata_editor_s* _metadata, const char* itemname, const char* value) +static int __MP4_updateIntegerItem(metadata_editor_s *_metadata, const char *itemname, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -452,7 +435,7 @@ static int __MP4_updateIntegerItem(metadata_editor_s* _metadata, const char* ite } } -static int __MP4_getNumberOfPictures(metadata_editor_s* _metadata, char** value) +static int __MP4_getNumberOfPictures(metadata_editor_s *_metadata, char **value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -489,7 +472,8 @@ static int __xiph_getFieldValue(metadata_editor_s *_metadata, TagLib::Ogg::XiphC } // *** This function is used to write string into Xiph Comment fields *** // -static int __xiph_updateFieldValue(metadata_editor_s* _metadata, TagLib::Ogg::XiphComment* xtag, const char* fieldname, const char* value) { +static int __xiph_updateFieldValue(metadata_editor_s *_metadata, TagLib::Ogg::XiphComment *xtag, const char *fieldname, const char *value) +{ int ret = METADATA_EDITOR_ERROR_NONE; ret = __check_metadata_set_parameter(_metadata); @@ -509,21 +493,22 @@ static int __xiph_updateFieldValue(metadata_editor_s* _metadata, TagLib::Ogg::Xi return METADATA_EDITOR_ERROR_NONE; } -static int __FLAC_getNumberOfPictures(metadata_editor_s* _metadata, char** value) +static int __FLAC_getNumberOfPictures(metadata_editor_s *_metadata, 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); - TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file; + TagLib::FLAC::File *_file = (TagLib::FLAC::File*) _metadata->file; *value = g_strdup_printf("%u", _file->pictureList().size()); return METADATA_EDITOR_ERROR_NONE; } #endif -int __metadata_editor_get_file_ext(const char *file_path, char *file_ext, int max_len) { +static int __metadata_editor_get_file_ext(const char *file_path, char *file_ext, int max_len) +{ int i = 0; unsigned int path_len = strlen(file_path); @@ -541,7 +526,8 @@ int __metadata_editor_get_file_ext(const char *file_path, char *file_ext, int ma return -1; } -int __metadata_editor_get_file_type(const char *path) { +static int __metadata_editor_get_file_type(const char *path) +{ int ret = 0; char mimetype[255] = {0, }; @@ -573,7 +559,8 @@ int __metadata_editor_get_file_type(const char *path) { return METADATA_EDITOR_FORMAT_NOTYPE; } -static int __metadata_editor_get_picture_type(const char *path, char **type) { +static int __metadata_editor_get_picture_type(const char *path, char **type) +{ int ret = 0; char mimetype[255] = {0, }; @@ -611,7 +598,8 @@ static int __metadata_editor_get_picture_type(const char *path, char **type) { return METADATA_EDITOR_ERROR_NOT_SUPPORTED; } -int __metadata_editor_get_picture_info(const char *path, void **picture, size_t *size, char **type) { +static int __metadata_editor_get_picture_info(const char *path, void **picture, size_t *size, char **type) +{ int ret; ret = __metadata_editor_get_picture_type(path, type); @@ -619,7 +607,7 @@ int __metadata_editor_get_picture_info(const char *path, void **picture, size_t return METADATA_EDITOR_ERROR_OPERATION_FAILED; //IF ok.. read file - FILE* fin = fopen(path, "rb"); + FILE *fin = fopen(path, "rb"); size_t file_size = 0; if (fin) { @@ -649,9 +637,8 @@ int __metadata_editor_get_picture_info(const char *path, void **picture, size_t return METADATA_EDITOR_ERROR_NONE; } -// *** This function is used to allocate the metadata_editor_s in memory *** // -// *** The structure metadata_editor_s contains all information about the file *** // -extern "C" int metadata_editor_create(metadata_editor_h *metadata) { +extern "C" int metadata_editor_create(metadata_editor_h *metadata) +{ metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata"); metadata_editor_s *_metadata = g_new0(metadata_editor_s, 1); @@ -665,11 +652,11 @@ extern "C" int metadata_editor_create(metadata_editor_h *metadata) { return METADATA_EDITOR_ERROR_NONE; } -// *** This function is used to open the file. It creates the instance that is responsible for connection with file *** // -extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char *path) { +extern "C" int metadata_editor_set_path(metadata_editor_h metadata, const char *path) +{ int media_type = METADATA_EDITOR_FORMAT_NOTYPE; metadata_editor_s *_metadata = (metadata_editor_s*)metadata; - TagLib::File* _file = NULL; + TagLib::File *_file = NULL; metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata"); metadata_editor_retvm_if(!path, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid path"); @@ -751,9 +738,9 @@ static int __metadata_editor_get_mp3_metadata(metadata_editor_s *metadata, metad metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); // Bring the pointer to actual file type and make tag pointers - TagLib::MPEG::File* _file = (TagLib::MPEG::File*)metadata->file; - TagLib::ID3v1::Tag* tag1 = _file->ID3v1Tag(); - TagLib::ID3v2::Tag* tag2 = _file->ID3v2Tag(); + TagLib::MPEG::File *_file = (TagLib::MPEG::File*)metadata->file; + TagLib::ID3v1::Tag *tag1 = _file->ID3v1Tag(); + TagLib::ID3v2::Tag *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); @@ -809,8 +796,8 @@ static int __metadata_editor_get_flac_metadata(metadata_editor_s *metadata, meta metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::FLAC::File* _file = (TagLib::FLAC::File*)metadata->file; - TagLib::Ogg::XiphComment* xtag = _file->xiphComment(false); + TagLib::FLAC::File *_file = (TagLib::FLAC::File*)metadata->file; + TagLib::Ogg::XiphComment *xtag = _file->xiphComment(false); if (!xtag) { // Check if we have a valid tag for processing metadata_editor_error("Tag does not exist"); *value = NULL; @@ -843,8 +830,8 @@ static int __metadata_editor_get_ogg_vorbis_metadata(metadata_editor_s *metadata metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)metadata->file; - TagLib::Ogg::XiphComment* xtag = _file->tag(); + TagLib::Ogg::Vorbis::File *_file = (TagLib::Ogg::Vorbis::File*)metadata->file; + TagLib::Ogg::XiphComment *xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing metadata_editor_error("Tag does not exist"); *value = NULL; @@ -876,8 +863,8 @@ static int __metadata_editor_get_ogg_flac_metadata(metadata_editor_s *metadata, metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)metadata->file; - TagLib::Ogg::XiphComment* xtag = _file->tag(); + TagLib::Ogg::FLAC::File *_file = (TagLib::Ogg::FLAC::File*)metadata->file; + TagLib::Ogg::XiphComment *xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing metadata_editor_error("Tag does not exist"); *value = NULL; @@ -909,8 +896,8 @@ static int __metadata_editor_get_wav_metadata(metadata_editor_s *metadata, metad metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); // Bring the pointer to actual file type and make tag pointers - TagLib::RIFF::WAV::File* _file = (TagLib::RIFF::WAV::File*)metadata->file; - TagLib::ID3v2::Tag* tag2 = _file->tag(); + TagLib::RIFF::WAV::File *_file = (TagLib::RIFF::WAV::File*)metadata->file; + TagLib::ID3v2::Tag *tag2 = _file->tag(); if (tag2 == NULL) { // Check if we have a valid tag for processing metadata_editor_error("Error. ID3v2 tag does not exist. Can not proceed metadata extraction"); @@ -938,8 +925,8 @@ static int __metadata_editor_get_wav_metadata(metadata_editor_s *metadata, metad } #endif -// *** This function is used to get the tag frame (field, item - each tag has its own name for data unit) from file *** // -extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata_editor_attr_e attribute, char **value) { +extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata_editor_attr_e attribute, char **value) +{ metadata_editor_s *_metadata = (metadata_editor_s*)metadata; metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata"); @@ -971,7 +958,7 @@ extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata } } -static int __metadata_editor_set_mp3_metadata(metadata_editor_s* metadata, metadata_editor_attr_e attribute, const char* value) +static int __metadata_editor_set_mp3_metadata(metadata_editor_s *metadata, metadata_editor_attr_e attribute, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -979,9 +966,9 @@ static int __metadata_editor_set_mp3_metadata(metadata_editor_s* metadata, metad metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::MPEG::File* _file = (TagLib::MPEG::File*)metadata->file; - TagLib::ID3v1::Tag* tag1 = _file->ID3v1Tag(); - TagLib::ID3v2::Tag* tag2 = _file->ID3v2Tag(true); + TagLib::MPEG::File *_file = (TagLib::MPEG::File*)metadata->file; + TagLib::ID3v1::Tag *tag1 = _file->ID3v1Tag(); + TagLib::ID3v2::Tag *tag2 = _file->ID3v2Tag(true); metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); @@ -1003,7 +990,7 @@ static int __metadata_editor_set_mp3_metadata(metadata_editor_s* metadata, metad } } -static int __metadata_editor_set_mp4_metadata(metadata_editor_s* metadata, metadata_editor_attr_e attribute, const char* value) +static int __metadata_editor_set_mp4_metadata(metadata_editor_s *metadata, metadata_editor_attr_e attribute, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -1029,7 +1016,7 @@ static int __metadata_editor_set_mp4_metadata(metadata_editor_s* metadata, metad } #if 0 -static int __metadata_editor_set_flac_metadata(metadata_editor_s* metadata, metadata_editor_attr_e attribute, const char* value) +static int __metadata_editor_set_flac_metadata(metadata_editor_s *metadata, metadata_editor_attr_e attribute, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -1037,8 +1024,8 @@ static int __metadata_editor_set_flac_metadata(metadata_editor_s* metadata, meta metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::FLAC::File* _file = (TagLib::FLAC::File*)metadata->file; - TagLib::Ogg::XiphComment* xtag = _file->xiphComment(true); + TagLib::FLAC::File *_file = (TagLib::FLAC::File*)metadata->file; + TagLib::Ogg::XiphComment *xtag = _file->xiphComment(true); if (!xtag) { // Check if we have a valid tag for processing metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; @@ -1061,7 +1048,7 @@ static int __metadata_editor_set_flac_metadata(metadata_editor_s* metadata, meta } } -static int __metadata_editor_set_ogg_vorbis_metadata(metadata_editor_s* metadata, metadata_editor_attr_e attribute, const char* value) +static int __metadata_editor_set_ogg_vorbis_metadata(metadata_editor_s *metadata, metadata_editor_attr_e attribute, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -1069,8 +1056,8 @@ static int __metadata_editor_set_ogg_vorbis_metadata(metadata_editor_s* metadata metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)metadata->file; - TagLib::Ogg::XiphComment* xtag = _file->tag(); + TagLib::Ogg::Vorbis::File *_file = (TagLib::Ogg::Vorbis::File*)metadata->file; + TagLib::Ogg::XiphComment *xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; @@ -1093,7 +1080,7 @@ static int __metadata_editor_set_ogg_vorbis_metadata(metadata_editor_s* metadata } } -static int __metadata_editor_set_ogg_flac_metadata(metadata_editor_s* metadata, metadata_editor_attr_e attribute, const char* value) +static int __metadata_editor_set_ogg_flac_metadata(metadata_editor_s *metadata, metadata_editor_attr_e attribute, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -1101,8 +1088,8 @@ static int __metadata_editor_set_ogg_flac_metadata(metadata_editor_s* metadata, metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)metadata->file; - TagLib::Ogg::XiphComment* xtag = _file->tag(); + TagLib::Ogg::FLAC::File *_file = (TagLib::Ogg::FLAC::File*)metadata->file; + TagLib::Ogg::XiphComment *xtag = _file->tag(); if (!xtag) { // Check if we have a valid tag for processing metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating"); return METADATA_EDITOR_ERROR_OPERATION_FAILED; @@ -1125,7 +1112,7 @@ static int __metadata_editor_set_ogg_flac_metadata(metadata_editor_s* metadata, } } -static int __metadata_editor_set_wav_metadata(metadata_editor_s* metadata, metadata_editor_attr_e attribute, const char* value) +static int __metadata_editor_set_wav_metadata(metadata_editor_s *metadata, metadata_editor_attr_e attribute, const char *value) { int ret = METADATA_EDITOR_ERROR_NONE; @@ -1133,8 +1120,8 @@ static int __metadata_editor_set_wav_metadata(metadata_editor_s* metadata, metad metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); // Bring the pointer to actual file type and make tags pointers - TagLib::RIFF::WAV::File* _file = (TagLib::RIFF::WAV::File*)metadata->file; - TagLib::ID3v2::Tag* tag2 = _file->tag(); + TagLib::RIFF::WAV::File *_file = (TagLib::RIFF::WAV::File*)metadata->file; + TagLib::ID3v2::Tag *tag2 = _file->tag(); // Check if the valid tag pointer exist if (tag2 == NULL) { metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating"); @@ -1160,10 +1147,10 @@ static int __metadata_editor_set_wav_metadata(metadata_editor_s* metadata, metad } #endif -// *** This function is used to modify the metadata (frame in tag). But it does not apply changes to file *** // -extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_attr_e attribute, const char* value) { +extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_attr_e attribute, const char *value) +{ - metadata_editor_s* _metadata = (metadata_editor_s*) metadata; + metadata_editor_s *_metadata = (metadata_editor_s*) metadata; metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata"); switch (_metadata->filetype) { @@ -1193,18 +1180,18 @@ extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata } } -// *** This function apply all changes done in the tag(s) and update them to file *** // -extern "C" int metadata_editor_update_metadata(metadata_editor_h metadata) { +extern "C" int metadata_editor_update_metadata(metadata_editor_h metadata) +{ int ret = METADATA_EDITOR_ERROR_NONE; - metadata_editor_s* _metadata = (metadata_editor_s*) metadata; + metadata_editor_s *_metadata = (metadata_editor_s*) metadata; ret = __check_metadata_set_parameter(_metadata); metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); switch (_metadata->filetype) { case METADATA_EDITOR_FORMAT_MP3: { - TagLib::MPEG::File* _file = (TagLib::MPEG::File*)_metadata->file; - TagLib::ID3v1::Tag* tag1 = _file->ID3v1Tag(); + TagLib::MPEG::File *_file = (TagLib::MPEG::File*)_metadata->file; + TagLib::ID3v1::Tag *tag1 = _file->ID3v1Tag(); if (!tag1 || tag1->isEmpty()) { // If no ID3v1 tag - prevent its creation if (_file->save(TagLib::MPEG::File::ID3v2 | TagLib::MPEG::File::APE)) @@ -1254,7 +1241,7 @@ static char * __get_mime_type_from_cover_art(const TagLib::MP4::CoverArt& cover_ return NULL; } -static int __get_APIC(TagLib::ID3v2::Tag* tag, int index, void **picture, int *size, char **mime_type) +static int __get_APIC(TagLib::ID3v2::Tag *tag, int index, void **picture, int *size, char **mime_type) { metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. No ID3v2 tag in file."); @@ -1286,12 +1273,12 @@ static int __get_APIC(TagLib::ID3v2::Tag* tag, int index, void **picture, int *s return METADATA_EDITOR_ERROR_NONE; } -static int __get_mp3_picture(metadata_editor_s* metadata, int index, void **picture, int *size, char **mime_type) +static int __get_mp3_picture(metadata_editor_s *metadata, int index, void **picture, int *size, char **mime_type) { return __get_APIC(dynamic_cast(metadata->file)->ID3v2Tag(), index, picture, size, mime_type); } -static int __get_mp4_picture(metadata_editor_s* metadata, int index, void **picture, int *size, char **mime_type) +static int __get_mp4_picture(metadata_editor_s *metadata, int index, void **picture, int *size, char **mime_type) { auto tag = dynamic_cast(metadata->file->tag()); metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); @@ -1322,9 +1309,9 @@ static int __get_mp4_picture(metadata_editor_s* metadata, int index, void **pict } #if 0 -static int __get_flac_picture(metadata_editor_s* metadata, int index, void **picture, int *size, char **mime_type) +static int __get_flac_picture(metadata_editor_s *metadata, int index, void **picture, int *size, char **mime_type) { - TagLib::FLAC::File* _file = (TagLib::FLAC::File*) metadata->file; + TagLib::FLAC::File *_file = (TagLib::FLAC::File*) metadata->file; TagLib::List lst = _file->pictureList(); if (lst.isEmpty()) { @@ -1350,18 +1337,18 @@ static int __get_flac_picture(metadata_editor_s* metadata, int index, void **pic return METADATA_EDITOR_ERROR_NONE; } -static int __get_wav_picture(metadata_editor_s* metadata, int index, void **picture, int *size, char **mime_type) +static int __get_wav_picture(metadata_editor_s *metadata, int index, void **picture, int *size, char **mime_type) { - TagLib::RIFF::WAV::File* _file = (TagLib::RIFF::WAV::File*)metadata->file; + TagLib::RIFF::WAV::File *_file = (TagLib::RIFF::WAV::File*)metadata->file; return __get_APIC(_file->tag(), index, picture, size, mime_type); } #endif -// *** This function returns buffer with picture under the specified index and buffer's (picture's) size *** // -extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **picture, int *size, char **mime_type) { +extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index, void **picture, int *size, char **mime_type) +{ int ret = METADATA_EDITOR_ERROR_NONE; - metadata_editor_s* _metadata = (metadata_editor_s*) metadata; + metadata_editor_s *_metadata = (metadata_editor_s*) metadata; ret = __check_metadata_get_parameter(_metadata, mime_type); metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret); @@ -1388,7 +1375,7 @@ extern "C" int metadata_editor_get_picture(metadata_editor_h metadata, int index } } -static int __append_APIC(TagLib::ID3v2::Tag* tag, void *picture, size_t size, const char *mime_type) +static int __append_APIC(TagLib::ID3v2::Tag *tag, void *picture, size_t size, const char *mime_type) { metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. No ID3v2 tag in file."); @@ -1405,12 +1392,12 @@ static int __append_APIC(TagLib::ID3v2::Tag* tag, void *picture, size_t size, co return METADATA_EDITOR_ERROR_NONE; } -static int __append_mp3_picture(metadata_editor_s* metadata, void *picture ,size_t size, const char *mime_type) +static int __append_mp3_picture(metadata_editor_s *metadata, void *picture ,size_t size, const char *mime_type) { return __append_APIC(dynamic_cast(metadata->file)->ID3v2Tag(true), picture, size, mime_type); } -static int __append_mp4_picture(metadata_editor_s* metadata, void *picture, size_t size, const char *mime_type) +static int __append_mp4_picture(metadata_editor_s *metadata, void *picture, size_t size, const char *mime_type) { auto tag = dynamic_cast(metadata->file->tag()); metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); @@ -1434,9 +1421,9 @@ static int __append_mp4_picture(metadata_editor_s* metadata, void *picture, size } #if 0 -static int __append_flac_picture(metadata_editor_s* metadata, void *picture, size_t size, const char *mime_type) +static int __append_flac_picture(metadata_editor_s *metadata, void *picture, size_t size, const char *mime_type) { - TagLib::FLAC::File* _file = (TagLib::FLAC::File*) metadata->file; + TagLib::FLAC::File *_file = (TagLib::FLAC::File*) metadata->file; auto frontCover = new TagLib::FLAC::Picture; metadata_editor_debug_fenter(); @@ -1450,20 +1437,19 @@ static int __append_flac_picture(metadata_editor_s* metadata, void *picture, siz return METADATA_EDITOR_ERROR_NONE; } -static int __append_wav_picture(metadata_editor_s* metadata, void *picture, size_t size, const char *mime_type) +static int __append_wav_picture(metadata_editor_s *metadata, void *picture, size_t size, const char *mime_type) { return __append_APIC(dynamic_cast(metadata->file->tag()), picture, size, mime_type); } #endif -// *** This function appends a cover art picture to the file *** // -extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const char *path) { +extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const char *path) +{ int ret = METADATA_EDITOR_ERROR_NONE; void *picture = NULL; size_t size = 0; char *mime_type = NULL; - - metadata_editor_s* _metadata = (metadata_editor_s*) metadata; + metadata_editor_s *_metadata = (metadata_editor_s*) metadata; ret = __check_metadata_set_parameter(_metadata); metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); @@ -1503,7 +1489,7 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const return ret; } -static int __remove_APIC(TagLib::ID3v2::Tag* tag, int index) +static int __remove_APIC(TagLib::ID3v2::Tag *tag, int index) { metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating"); @@ -1519,12 +1505,12 @@ static int __remove_APIC(TagLib::ID3v2::Tag* tag, int index) return METADATA_EDITOR_ERROR_NONE; } -static int __remove_mp3_picture(metadata_editor_s* metadata, int index) +static int __remove_mp3_picture(metadata_editor_s *metadata, int index) { return __remove_APIC(dynamic_cast(metadata->file)->ID3v2Tag(true), index); } -static int __remove_mp4_picture(metadata_editor_s* metadata, int index) +static int __remove_mp4_picture(metadata_editor_s *metadata, int index) { auto tag = dynamic_cast(metadata->file->tag()); metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist"); @@ -1556,9 +1542,9 @@ static int __remove_mp4_picture(metadata_editor_s* metadata, int index) } #if 0 -static int __remove_flac_picture(metadata_editor_s* metadata, int index) +static int __remove_flac_picture(metadata_editor_s *metadata, int index) { - TagLib::FLAC::File* _file = (TagLib::FLAC::File*) metadata->file; + TagLib::FLAC::File *_file = (TagLib::FLAC::File*) metadata->file; TagLib::List lst = _file->pictureList(); if (lst.isEmpty()) { @@ -1583,16 +1569,16 @@ static int __remove_flac_picture(metadata_editor_s* metadata, int index) return METADATA_EDITOR_ERROR_NONE; } -static int __remove_wav_picture(metadata_editor_s* metadata, int index) +static int __remove_wav_picture(metadata_editor_s *metadata, int index) { return __remove_APIC(dynamic_cast(metadata->file->tag()), index); } #endif -// *** This function is used to delete picture with specified index *** // -extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int index) { +extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int index) +{ int ret = METADATA_EDITOR_ERROR_NONE; - metadata_editor_s* _metadata = (metadata_editor_s*) metadata; + metadata_editor_s *_metadata = (metadata_editor_s*) metadata; ret = __check_metadata_set_parameter(_metadata); metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret); @@ -1616,7 +1602,8 @@ extern "C" int metadata_editor_remove_picture(metadata_editor_h metadata, int in } } -extern "C" int metadata_editor_destroy(metadata_editor_h metadata) { +extern "C" int metadata_editor_destroy(metadata_editor_h metadata) +{ metadata_editor_s *_metadata = (metadata_editor_s*)metadata; metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");