Use defines for mime 18/232718/3
authorhj kim <backto.kim@samsung.com>
Thu, 7 May 2020 08:27:48 +0000 (17:27 +0900)
committerhj kim <backto.kim@samsung.com>
Fri, 8 May 2020 01:50:29 +0000 (01:50 +0000)
Change-Id: I5de8de8a0f6325dab8850bd25c8ac99be79c56e9

src/metadata_editor.cpp

index 0d6f146..9a60fcb 100755 (executable)
@@ -699,8 +699,6 @@ int __metadata_editor_get_file_type(const char *path) {
 static int __metadata_editor_get_picture_type(const char *path, char **type) {
        int ret = 0;
        char mimetype[255] = {0, };
-       const char *type_jpeg = "image/jpeg";
-       const char *type_png = "image/png";
 
        /* get content type and mime type from file. */
        ret = aul_get_mime_from_file(path, mimetype, sizeof(mimetype));
@@ -712,10 +710,10 @@ static int __metadata_editor_get_picture_type(const char *path, char **type) {
                metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_ERROR_OPERATION_FAILED, "__metadata_editor_get_file_ext failed");
 
                if (strcasecmp(ext, "JPG") == 0 || strcasecmp(ext, "JPEG") == 0) {
-                       *type = g_strndup(type_jpeg, strlen(type_jpeg));
+                       *type = g_strdup(MIME_TYPE_JPEG);
                        return METADATA_EDITOR_ERROR_NONE;
                } else if (strcasecmp(ext, "PNG") == 0) {
-                       *type = g_strndup(type_png, strlen(type_png));
+                       *type = g_strdup(MIME_TYPE_JPEG);
                        return METADATA_EDITOR_ERROR_NONE;
                } else {
                        return METADATA_EDITOR_ERROR_NOT_SUPPORTED;
@@ -1580,9 +1578,9 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const
                                metadata_editor_info("The item <covr> exists. Adding picture");
                                TagLib::MP4::CoverArtList lst = it->second.toCoverArtList();
                                TagLib::MP4::CoverArt::Format format;
-                               if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0)
+                               if (strncmp(type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0)
                                        format = TagLib::MP4::CoverArt::JPEG;
-                               else if (strncmp(type, "image/png", strlen("image/jpeg")) == 0)
+                               else if (strncmp(type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0)
                                        format = TagLib::MP4::CoverArt::PNG;
                                else
                                        format = (TagLib::MP4::CoverArt::Format)0xFFFF;
@@ -1595,9 +1593,9 @@ extern "C" int metadata_editor_append_picture(metadata_editor_h metadata, const
                        } else {                                                                                        // Item was not found
                                metadata_editor_info("The item <covr> does not exist. Adding picture");
                                TagLib::MP4::CoverArt::Format format;
-                               if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0)
+                               if (strncmp(type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0)
                                        format = TagLib::MP4::CoverArt::JPEG;
-                               else if (strncmp(type, "image/png", strlen("image/jpeg")) == 0)
+                               else if (strncmp(type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0)
                                        format = TagLib::MP4::CoverArt::PNG;
                                else
                                        format = (TagLib::MP4::CoverArt::Format)0xFFFF;