From: Minje Ahn Date: Thu, 17 Aug 2017 05:09:51 +0000 (+0900) Subject: Modify parameters X-Git-Tag: submit/tizen/20170817.064526^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca462b40739adb2e182f13a35f2d1a9a0e44d14d;p=platform%2Fcore%2Fmultimedia%2Flibmedia-service.git Modify parameters Change structure list to g_list Use define instead of parameters Change-Id: I9f7c83a6c01b2675e86830ddd9765cf2731fa974 Signed-off-by: Minje Ahn --- diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index 4181dd5..217a5be 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -32,10 +32,6 @@ #define MEDIA_SVC_MAX_COMMIT_SIZE 200 -typedef struct { - char thumbnail_path[MEDIA_SVC_PATHNAME_SIZE]; -} media_svc_thumbnailpath_s; - static __thread GList *g_media_svc_item_validity_query_list = NULL; static __thread GList *g_media_svc_insert_item_query_list = NULL; __thread GList *g_media_svc_move_item_query_list = NULL; @@ -43,111 +39,48 @@ static __thread GList *g_media_svc_update_item_query_list = NULL; static __thread GList *g_media_svc_update_list = NULL; static __thread int g_media_svc_update_list_count = 0; -static int __media_svc_count_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int *count); -static int __media_svc_get_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int count, media_svc_thumbnailpath_s *thumb_path); -static int __media_svc_count_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *storage_id, const char *folder_path, const char *folder_uuid, bool is_recursive, int *count); -static int __media_svc_get_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *storage_id, const char *folder_path, const char *folder_uuid, bool is_recursive, int count, media_svc_thumbnailpath_s *thumb_path); - -static int __media_svc_count_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, int *count) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3_stmt *sql_stmt = NULL; - char *sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE validity=0 AND storage_type=%d AND thumbnail_path IS NOT NULL", - storage_id, storage_type); - - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when __media_svc_count_invalid_records_with_thumbnail. err = [%d]", ret); - return ret; - } - - *count = sqlite3_column_int(sql_stmt, 0); - - SQLITE3_FINALIZE(sql_stmt); - - return MS_MEDIA_ERR_NONE; - -} - -static int __media_svc_get_invalid_records_with_thumbnail(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, - int count, media_svc_thumbnailpath_s * thumb_path) +static int __media_svc_get_invalid_records_with_thumbnail(sqlite3 *handle, media_svc_storage_type_e storage_type, GArray **thumb_path) { int ret = MS_MEDIA_ERR_NONE; sqlite3_stmt *sql_stmt = NULL; - int idx = 0; - - char *sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE storage_type=%d AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", - MEDIA_SVC_DB_TABLE_MEDIA, storage_type); + char *sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE validity=0 AND storage_type=%d AND thumbnail_path IS NOT NULL", MEDIA_SVC_DB_TABLE_MEDIA, storage_type); media_svc_debug("[SQL query] : %s", sql); - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when __media_svc_get_invalid_records_with_thumbnail. err = [%d]", ret); - return ret; - } + ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt); + media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Query failed. err[%d]", ret); while (sqlite3_step(sql_stmt) == SQLITE_ROW) { - SAFE_STRLCPY(thumb_path[idx].thumbnail_path, (const char *)sqlite3_column_text(sql_stmt, 0), sizeof(thumb_path[idx])); - idx++; - } - - SQLITE3_FINALIZE(sql_stmt); - - return MS_MEDIA_ERR_NONE; -} - -static int __media_svc_count_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *storage_id, const char *folder_path, const char *folder_uuid, bool is_recursive, int *count) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3_stmt *sql_stmt = NULL; - char *sql = NULL; - - if (is_recursive) - sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE validity=0 AND path LIKE '%q/%%' AND thumbnail_path IS NOT NULL", storage_id, folder_path); - else - sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE validity=0 AND folder_uuid = '%q' AND thumbnail_path IS NOT NULL", storage_id, folder_uuid); - - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when __media_svc_count_invalid_folder_records_with_thumbnail. err = [%d]", ret); - return ret; + char *path = NULL; + path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0)); + g_array_append_val(*thumb_path, path); } - *count = sqlite3_column_int(sql_stmt, 0); - SQLITE3_FINALIZE(sql_stmt); return MS_MEDIA_ERR_NONE; - } -static int __media_svc_get_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *storage_id, const char *folder_path, const char *folder_uuid, bool is_recursive, - int count, media_svc_thumbnailpath_s * thumb_path) +static int __media_svc_get_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *folder_path, const char *folder_uuid, bool is_recursive, GArray **thumb_path) { int ret = MS_MEDIA_ERR_NONE; sqlite3_stmt *sql_stmt = NULL; - int idx = 0; char *sql = NULL; if (is_recursive) - sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE path LIKE '%q/%%' AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", storage_id, folder_path); + sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE validity=0 AND path LIKE '%q/%%' AND thumbnail_path IS NOT NULL", MEDIA_SVC_DB_TABLE_MEDIA, folder_path); else - sql = sqlite3_mprintf("SELECT thumbnail_path from (select thumbnail_path, validity from '%s' WHERE folder_uuid = '%q' AND thumbnail_path IS NOT NULL GROUP BY thumbnail_path HAVING count() = 1) WHERE validity=0", storage_id, folder_uuid); + sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE validity=0 AND folder_uuid = '%q' AND thumbnail_path IS NOT NULL", MEDIA_SVC_DB_TABLE_MEDIA, folder_uuid); media_svc_debug("[SQL query] : %s", sql); ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when __media_svc_get_invalid_folder_records_with_thumbnail. err = [%d]", ret); - return ret; - } + media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Query failed. err[%d]", ret); while (sqlite3_step(sql_stmt) == SQLITE_ROW) { - SAFE_STRLCPY(thumb_path[idx].thumbnail_path, (const char *)sqlite3_column_text(sql_stmt, 0), sizeof(thumb_path[idx])); - idx++; + char *path = NULL; + path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0)); + g_array_append_val(*thumb_path, path); } SQLITE3_FINALIZE(sql_stmt); @@ -495,12 +428,12 @@ int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_i return ret; } -int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *storage_id, const char *path, char *thumbnail_path) +int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path) { int ret = MS_MEDIA_ERR_NONE; sqlite3_stmt *sql_stmt = NULL; - char *sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE path='%q'", storage_id, path); + char *sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE path='%q'", MEDIA_SVC_DB_TABLE_MEDIA, path); ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); @@ -575,31 +508,20 @@ int _media_svc_truncate_table(const char *storage_id, media_svc_storage_type_e s int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid) { - int idx = 0; - media_svc_thumbnailpath_s *thumbpath_record = NULL; - int invalid_count = 0; int ret = MS_MEDIA_ERR_NONE; + GArray *thumb_list = NULL; - ret = __media_svc_count_invalid_records_with_thumbnail(handle, storage_id, storage_type, &invalid_count); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - media_svc_debug("invalid count: %d", invalid_count); - - if (invalid_count > 0) { - thumbpath_record = (media_svc_thumbnailpath_s *)calloc(invalid_count, sizeof(media_svc_thumbnailpath_s)); - if (thumbpath_record == NULL) { - media_svc_error("fail to memory allocation"); - return MS_MEDIA_ERR_OUT_OF_MEMORY; - } + thumb_list = g_array_new(FALSE, FALSE, sizeof(char*)); - ret = __media_svc_get_invalid_records_with_thumbnail(handle, storage_id, storage_type, invalid_count, thumbpath_record); + /*If external USB, no need this process */ + if (storage_type != MEDIA_SVC_STORAGE_EXTERNAL_USB) { + ret = __media_svc_get_invalid_records_with_thumbnail(handle, storage_type, &thumb_list); if (ret != MS_MEDIA_ERR_NONE) { media_svc_error("error when get thumbnail record"); - SAFE_FREE(thumbpath_record); + g_array_free(thumb_list, false); + thumb_list = NULL; return ret; } - } else { - media_svc_debug("There is no item with thumbnail"); } char *sql = sqlite3_mprintf("DELETE FROM '%s' WHERE validity = 0;", storage_id); @@ -607,57 +529,55 @@ int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, med ret = _media_svc_sql_query(sql, uid); SQLITE3_SAFE_FREE(sql); if (ret != MS_MEDIA_ERR_NONE) { - SAFE_FREE(thumbpath_record); + while (thumb_list->len != 0) { + char *thumb_path = NULL; + thumb_path = g_array_index(thumb_list , char*, 0); + g_array_remove_index(thumb_list, 0); + SAFE_FREE(thumb_path); + } + g_array_free(thumb_list, false); + thumb_list = NULL; return ret; } /*Delete thumbnails*/ - for (idx = 0; idx < invalid_count; idx++) { - if (STRING_VALID(thumbpath_record[idx].thumbnail_path)) { - ret = _media_svc_remove_file(thumbpath_record[idx].thumbnail_path); - if (ret != MS_MEDIA_ERR_NONE) - media_svc_error("fail to remove thumbnail file."); - } + while (thumb_list->len != 0) { + char *thumb_path = NULL; + thumb_path = g_array_index(thumb_list , char*, 0); + g_array_remove_index(thumb_list, 0); + + ret = _media_svc_remove_file(thumb_path); + if (ret != MS_MEDIA_ERR_NONE) + media_svc_error("fail to remove thumbnail file."); + + SAFE_FREE(thumb_path); } - SAFE_FREE(thumbpath_record); + g_array_free(thumb_list, false); + thumb_list = NULL; return MS_MEDIA_ERR_NONE; } int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid) { - int idx = 0; - media_svc_thumbnailpath_s *thumbpath_record = NULL; - int invalid_count = 0; int ret = MS_MEDIA_ERR_NONE; char folder_uuid[MEDIA_SVC_UUID_SIZE+1] = {0,}; + GArray *thumb_list = NULL; char *sql = NULL; /*get folder uuid from DB*/ ret = _media_svc_get_folder_id_by_foldername(handle, storage_id, folder_path, folder_uuid, uid); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - ret = __media_svc_count_invalid_folder_records_with_thumbnail(handle, storage_id, folder_path, folder_uuid, is_recursive, &invalid_count); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - media_svc_debug("invalid count: %d", invalid_count); - - if (invalid_count > 0) { - thumbpath_record = (media_svc_thumbnailpath_s *)calloc(invalid_count, sizeof(media_svc_thumbnailpath_s)); - if (thumbpath_record == NULL) { - media_svc_error("fail to memory allocation"); - return MS_MEDIA_ERR_OUT_OF_MEMORY; - } + thumb_list = g_array_new(FALSE, FALSE, sizeof(char*)); - ret = __media_svc_get_invalid_folder_records_with_thumbnail(handle, storage_id, folder_path, folder_uuid, is_recursive, invalid_count, thumbpath_record); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when get thumbnail record"); - SAFE_FREE(thumbpath_record); - return ret; - } - } else { - media_svc_debug("There is no item with thumbnail"); + ret = __media_svc_get_invalid_folder_records_with_thumbnail(handle, folder_path, folder_uuid, is_recursive, &thumb_list); + if (ret != MS_MEDIA_ERR_NONE) { + media_svc_error("error when get thumbnail record"); + g_array_free(thumb_list, false); + thumb_list = NULL; + return ret; } if (is_recursive) @@ -668,23 +588,34 @@ int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_ ret = _media_svc_sql_query(sql, uid); SQLITE3_SAFE_FREE(sql); if (ret != MS_MEDIA_ERR_NONE) { - SAFE_FREE(thumbpath_record); + while (thumb_list->len != 0) { + char *thumb_path = NULL; + thumb_path = g_array_index(thumb_list , char*, 0); + g_array_remove_index(thumb_list, 0); + SAFE_FREE(thumb_path); + } + g_array_free(thumb_list, false); + thumb_list = NULL; + return ret; } /*Delete thumbnails*/ - if (thumbpath_record != NULL) { - for (idx = 0; idx < invalid_count; idx++) { - if (STRING_VALID(thumbpath_record[idx].thumbnail_path)) { - ret = _media_svc_remove_file(thumbpath_record[idx].thumbnail_path); - if (ret != MS_MEDIA_ERR_NONE) - media_svc_error("fail to remove thumbnail file."); - } - } + while (thumb_list->len != 0) { + char *thumb_path = NULL; + thumb_path = g_array_index(thumb_list , char*, 0); + g_array_remove_index(thumb_list, 0); + + ret = _media_svc_remove_file(thumb_path); + if (ret != MS_MEDIA_ERR_NONE) + media_svc_error("fail to remove thumbnail file."); - SAFE_FREE(thumbpath_record); + SAFE_FREE(thumb_path); } + g_array_free(thumb_list, false); + thumb_list = NULL; + return MS_MEDIA_ERR_NONE; } @@ -704,11 +635,11 @@ int _media_svc_update_item_validity(const char *storage_id, const char *path, in return ret; } -int _media_svc_update_thumbnail_path(const char *storage_id, const char *path, const char *thumb_path, uid_t uid) +int _media_svc_update_thumbnail_path(const char *path, const char *thumb_path, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; - char *sql = sqlite3_mprintf("UPDATE '%s' SET thumbnail_path=%Q WHERE path= %Q;", storage_id, thumb_path, path); + char *sql = sqlite3_mprintf("UPDATE '%s' SET thumbnail_path=%Q WHERE path= %Q;", MEDIA_SVC_DB_TABLE_MEDIA, thumb_path, path); ret = _media_svc_sql_query(sql, uid); SQLITE3_SAFE_FREE(sql); @@ -773,7 +704,7 @@ int _media_svc_update_recursive_folder_item_validity(const char *storage_id, con return ret; } -int _media_svc_update_item_by_path(const char *storage_id, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, +int _media_svc_update_item_by_path(const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, const char *thumb_path, bool stack_query, uid_t uid) { /* update path, filename, modified_time, folder_uuid, thumbnail_path, */ @@ -785,11 +716,11 @@ int _media_svc_update_item_by_path(const char *storage_id, const char *src_path, if (thumb_path != NULL) { sql = sqlite3_mprintf("UPDATE '%s' SET path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, thumbnail_path=%Q, storage_type=%d, \ played_count=0, last_played_time=0, last_played_position=0 WHERE path=%Q;", - storage_id, dest_path, file_name, modified_time, folder_uuid, thumb_path, dest_storage, src_path); + MEDIA_SVC_DB_TABLE_MEDIA, dest_path, file_name, modified_time, folder_uuid, thumb_path, dest_storage, src_path); } else { sql = sqlite3_mprintf("UPDATE '%s' SET path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, storage_type=%d, \ played_count=0, last_played_time=0, last_played_position=0 WHERE path=%Q;", - storage_id, dest_path, file_name, modified_time, folder_uuid, dest_storage, src_path); + MEDIA_SVC_DB_TABLE_MEDIA, dest_path, file_name, modified_time, folder_uuid, dest_storage, src_path); } if (!stack_query) { diff --git a/src/common/media-svc.c b/src/common/media-svc.c index 773ab39..f4070d0 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -194,15 +194,7 @@ int media_svc_create_table(uid_t uid) media_svc_error("_media_svc_make_table_query fail."); goto ERROR; } -#if 0 - /*init storage table*/ - ret = _media_svc_init_storage(db_handle, uid); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("_media_svc_make_table_query fail."); - goto ERROR; - } -#endif /*create face table. from tizen 3.0*/ ret = _media_svc_make_table_query(MEDIA_SVC_DB_TABLE_FACE_SCAN_LIST, MEDIA_SVC_DB_LIST_FACE_SCAN_LIST, uid); if (ret != MS_MEDIA_ERR_NONE) { @@ -527,7 +519,7 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) { /*get old thumbnail_path*/ - ret = _media_svc_get_thumbnail_path_by_path(db_handle, storage_id, src_path, old_thumb_path); + ret = _media_svc_get_thumbnail_path_by_path(db_handle, src_path, old_thumb_path); if ((ret != MS_MEDIA_ERR_NONE) && (ret != MS_MEDIA_ERR_DB_NO_RECORD)) { media_svc_error("_media_svc_get_thumbnail_path_by_path failed"); SAFE_FREE(file_name); @@ -541,9 +533,9 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv /*update item*/ if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) - ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, FALSE, uid); + ret = _media_svc_update_item_by_path(src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, FALSE, uid); else - ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, FALSE, uid); + ret = _media_svc_update_item_by_path(src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, FALSE, uid); SAFE_FREE(file_name); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); @@ -572,9 +564,9 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv /*update item*/ if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) - ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid); + ret = _media_svc_update_item_by_path(src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid); else - ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid); + ret = _media_svc_update_item_by_path(src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid); SAFE_FREE(file_name); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); @@ -590,9 +582,9 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv } else if (g_media_svc_move_item_cur_data_cnt == (g_media_svc_move_item_data_cnt - 1)) { /*update item*/ if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) - ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid); + ret = _media_svc_update_item_by_path(src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid); else - ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid); + ret = _media_svc_update_item_by_path(src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid); SAFE_FREE(file_name); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); @@ -708,7 +700,7 @@ int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *storage_id media_svc_retv_if((ret != MS_MEDIA_ERR_NONE), ret); /*Get thumbnail path to delete*/ - ret = _media_svc_get_thumbnail_path_by_path(db_handle, storage_id, path, thumb_path); + ret = _media_svc_get_thumbnail_path_by_path(db_handle, path, thumb_path); media_svc_retv_if((ret != MS_MEDIA_ERR_NONE) && (ret != MS_MEDIA_ERR_DB_NO_RECORD), ret); if (g_media_svc_insert_item_data_cnt == 1) { @@ -858,7 +850,7 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media /* Initialize thumbnail information to remake thumbnail. */ char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1]; - ret = _media_svc_get_thumbnail_path_by_path(db_handle, storage_id, path, thumb_path); + ret = _media_svc_get_thumbnail_path_by_path(db_handle, path, thumb_path); if (ret != MS_MEDIA_ERR_NONE) { _media_svc_destroy_content_info(&content_info); return ret; @@ -870,7 +862,7 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media media_svc_error("_media_svc_remove_file failed : %s", thumb_path); } - ret = _media_svc_update_thumbnail_path(storage_id, path, NULL, uid); + ret = _media_svc_update_thumbnail_path(path, NULL, uid); if (ret != MS_MEDIA_ERR_NONE) { _media_svc_destroy_content_info(&content_info); return ret; diff --git a/src/include/common/media-svc-media.h b/src/include/common/media-svc-media.h index 567e51c..805d1ff 100755 --- a/src/include/common/media-svc-media.h +++ b/src/include/common/media-svc-media.h @@ -31,7 +31,7 @@ int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count); int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid); int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_info_s *content_info, uid_t uid); -int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *storage_id, const char *path, char *thumbnail_path); +int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path); int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, const char *path, int *media_type); int _media_svc_get_burst_id(sqlite3 *handle, const char *storage_id, int *id); int _media_svc_delete_item_by_path(const char *storage_id, const char *path, bool stack_query, uid_t uid); @@ -42,9 +42,9 @@ int _media_svc_update_storage_item_validity(const char *storage_id, media_svc_st int _media_svc_update_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, uid_t uid); int _media_svc_update_recursive_folder_item_validity(const char *storage_id, const char *folder_path, int validity, uid_t uid); int _media_svc_update_item_validity(const char *storage_id, const char *path, int validity, bool stack_query, uid_t uid); -int _media_svc_update_item_by_path(const char *storage_id, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, const char *thumb_path, bool stack_query, uid_t uid); +int _media_svc_update_item_by_path(const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, const char *thumb_path, bool stack_query, uid_t uid); int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid); -int _media_svc_update_thumbnail_path(const char *storage_id, const char *path, const char *thumb_path, uid_t uid); +int _media_svc_update_thumbnail_path(const char *path, const char *thumb_path, uid_t uid); int _media_svc_get_noti_info(sqlite3 *handle, const char *storage_id, const char *path, int update_item, media_svc_noti_item **item); int _media_svc_count_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, int *count); int _media_svc_get_fileinfo_by_path(sqlite3 *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size);