Remove __media_svc_resize_artwork() 63/257163/4
authorMinje Ahn <minje.ahn@samsung.com>
Tue, 20 Apr 2021 07:43:52 +0000 (16:43 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Tue, 20 Apr 2021 07:54:33 +0000 (16:54 +0900)
There were no memory or storage related issues after resizing was prevented.
So, remove __media_svc_resize_artwork() function.

[Information]
Prevent resize for performance (2020.02.07)
In most cases, artwork's format is jpeg and size is under MEDIA_SVC_ARTWORK_SIZE * MEDIA_SVC_ARTWORK_SIZE.
So, doing mm_util_extract_image_info to check image size is a time-consuming task.

Change-Id: I42e400c7acaac0da1f97ff52e7c3d988f4bc892d
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
packaging/libmedia-service.spec
src/common/media-svc-media.c
src/common/media-svc-util.c

index 59649073e7eb5edbb8dccc7f9c5b73949d858d73..8198defffe0be199fbe3183b24e34aaa14e75535 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmedia-service
 Summary:    Media information service library for multimedia applications
-Version:    0.4.18
+Version:    0.4.19
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0 and PD
index 1a5ac5af9f8225566b756948b0aa000556c43c94..702cf0a91b0eb4a782866ae07482065de6c7ee8e 100755 (executable)
@@ -468,6 +468,7 @@ int _media_svc_get_media(sqlite3 *handle, const char *sql, GList **path_list)
 
        ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt);
        media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "_media_svc_sql_prepare_to_step_simple() failed [%d]", ret);
+
        while (sqlite3_step(sql_stmt) == SQLITE_ROW)
                *path_list = g_list_append(*path_list, g_strdup((const char *)sqlite3_column_text(sql_stmt, 0)));
 
index 5c08dd9d27ae2bddd4051d5ad705fce01ad2b6df..e5bf9198cd3ab3a515bdde7f2d508fb09f5201b9 100644 (file)
@@ -477,46 +477,7 @@ static bool __media_svc_get_file_ext(const char *file_path, char *file_ext)
        }
        return false;
 }
-#if 0
-static int __media_svc_resize_artwork(const char *path, const char *img_format)
-{
-       int ret = MS_MEDIA_ERR_NONE;
-       unsigned int width = 0;
-       unsigned int height = 0;
-       unsigned int resized_width = 0;
-       unsigned int resized_height = 0;
-       mm_util_img_codec_type img_type = IMG_CODEC_UNKNOWN_TYPE;
-
-       if ((strstr(img_format, "jpeg") != NULL) || (strstr(img_format, "jpg") != NULL) || (strstr(img_format, "JPG") != NULL)) {
-               media_svc_debug("type [jpeg]");
-
-               mm_util_extract_image_info(path, &img_type, &width, &height);
-
-               if (width <= MEDIA_SVC_ARTWORK_SIZE || height <= MEDIA_SVC_ARTWORK_SIZE) {
-                       media_svc_debug("No need resizing");
-                       return MS_MEDIA_ERR_NONE;
-               }
-
-               /* resizing */
-               if (width > height) {
-                       resized_height = MEDIA_SVC_ARTWORK_SIZE;
-                       resized_width = width * MEDIA_SVC_ARTWORK_SIZE / height;
-               } else {
-                       resized_width = MEDIA_SVC_ARTWORK_SIZE;
-                       resized_height = height * MEDIA_SVC_ARTWORK_SIZE / width;
-               }
 
-               ret = mm_util_resize_P_P(path, resized_width, resized_height, path);
-
-       } else if ((strstr(img_format, "png") != NULL) || (strstr(img_format, "PNG") != NULL)) {
-               media_svc_debug("type [png]");
-       } else {
-               media_svc_debug("Not proper img format");
-       }
-
-       return ret;
-}
-#endif
 static int __media_svc_safe_atoi(char *buffer, int *si)
 {
        char *end = NULL;
@@ -1194,21 +1155,6 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                                                        media_svc_error("Fail to Save Image");
                                                } else {
                                                        content_info->thumbnail_path = g_strdup(thumb_path);
-                                                       /* NOTICE : Prevent resize for performance (2020.02.07)
-                                                       *  In most cases, artwork's format is jpeg and size is under MEDIA_SVC_ARTWORK_SIZE * MEDIA_SVC_ARTWORK_SIZE.
-                                                       *  So, doing mm_util_extract_image_info to check image size is a time-consuming task.
-                                                       */
-#if 0
-                                                       /* albumart resizing */
-                                                       ret = __media_svc_resize_artwork(thumb_path, p);
-                                                       if (ret != MS_MEDIA_ERR_NONE) {
-                                                               media_svc_error("Fail to Make Thumbnail Image");
-                                                               _media_svc_remove_file(thumb_path);
-
-                                                       } else {
-                                                               content_info->thumbnail_path = g_strdup(thumb_path);
-                                                       }
-#endif
                                                }
                                        }
                                }