Multiuser features 50/27350/2 accepted/tizen_3.0.2014.q3_common accepted/tizen_3.0.m14.3_ivi tizen_3.0.2014.q3_common tizen_3.0.m14.3_ivi tizen_3.0_ivi accepted/tizen/common/20141001.131248 accepted/tizen/ivi/20141008.075207 submit/tizen_common/20141001.125034 submit/tizen_ivi/20141007.222222 submit/tizen_mobile/20141120.000000 tizen_3.0.2014.q3_common_release tizen_3.0.m14.3_ivi_release tizen_3.0_ivi_release
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Tue, 26 Aug 2014 14:29:32 +0000 (16:29 +0200)
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Tue, 30 Sep 2014 12:10:06 +0000 (14:10 +0200)
Use new API of media-server

Fix-Tizen: TC-1482

Change-Id: I37a12d93a141da354138f273bf7ba63955e8a82d
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
include/media_info_private.h
packaging/capi-content-media-content.spec
src/media_content.c
src/media_db.c
src/media_folder.c
src/media_info.c

index c27f644..8cfd764 100755 (executable)
@@ -50,7 +50,7 @@ extern "C" {
 
 #define MEDIA_CONTENT_PATH_PHONE       MEDIA_ROOT_PATH_INTERNAL        /**< File path prefix of files stored in phone */
 #define MEDIA_CONTENT_PATH_MMC                 MEDIA_ROOT_PATH_SDCARD          /**< File path prefix of files stored in mmc card */
-#define MEDIA_CONTENT_THUMB_DEFAULT_PATH       tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/thumb_default.png")
+#define MEDIA_CONTENT_THUMB_DEFAULT_PATH       tzplatform_mkpath(TZ_SYS_DATA, "file-manager-service/.thumb/thumb_default.png")
 #define MEDIA_CONTENT_INSERT_FILES_PATH                tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/")
 
 #define MAX_QUERY_SIZE 4096
index be25bc7..889da04 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in SLP C API
-Version:    0.2.58
+Version:    0.2.59
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index a9a3c57..c59daf1 100755 (executable)
@@ -538,7 +538,7 @@ int _content_query_sql(char *query_str)
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        //DB will be updated by Media Server.
-       ret = media_svc_request_update_db(query_str);
+       ret = media_svc_request_update_db(query_str,tzplatform_getuid(TZ_USER_NAME));
 
        return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
 
@@ -597,7 +597,7 @@ int media_content_connect(void)
                {
                        if(db_handle == NULL)
                        {
-                               ret = media_svc_connect(&db_handle);
+                               ret = media_svc_connect(&db_handle,tzplatform_getuid(TZ_USER_NAME));
                        }
 
                        ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
@@ -690,7 +690,7 @@ int media_content_scan_file(const char *path)
                        ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), path);
                        if (ret == MEDIA_INFO_ERROR_NONE) {
                                /* Refresh */
-                               ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, path);
+                               ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, path, tzplatform_getuid(TZ_USER_NAME));
                                if (ret < 0) {
                                        media_content_error("media_svc_refresh_item failed : %d", ret);
                                        return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
@@ -698,7 +698,7 @@ int media_content_scan_file(const char *path)
 
                        } else if (ret == MEDIA_INFO_ERROR_DATABASE_NO_RECORD) {
                                /* Insert */
-                               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path);
+                               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, path, tzplatform_getuid(TZ_USER_NAME));
                                if (ret < 0) {
                                        media_content_error("media_svc_insert_item_immediately failed : %d", ret);
                                        return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
@@ -715,7 +715,7 @@ int media_content_scan_file(const char *path)
        } else {
                /* This means this path has to be deleted */
                media_content_debug("This path doesn't exists in file system... So now start to delete it from DB");
-               ret = media_svc_delete_item_by_path(_content_get_db_handle(), path);
+               ret = media_svc_delete_item_by_path(_content_get_db_handle(), path, tzplatform_getuid(TZ_USER_NAME));
                if (ret < 0) {
                        media_content_error("media_svc_delete_item_by_path failed : %d", ret);
                        return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
@@ -761,7 +761,7 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co
        cb_data->callback = callback;
        cb_data->user_data = user_data;
 
-       ret = media_directory_scanning_async(path, is_recursive, _media_content_scan_cb, cb_data);
+       ret = media_directory_scanning_async(path, is_recursive, _media_content_scan_cb, cb_data, tzplatform_getuid(TZ_USER_NAME));
        if (ret < 0) {
                media_content_error("media_directory_scanning_async failed : %d", ret);
        }
index cfaead3..ed289a6 100755 (executable)
@@ -88,6 +88,7 @@ static char * __media_db_get_group_name(media_group_e group)
 int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *group_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
        char select_query[DEFAULT_QUERY_SIZE];
@@ -194,13 +195,13 @@ int _media_db_get_group_count(filter_h filter, group_list_e group_type, int *gro
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *group_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
        char select_query[DEFAULT_QUERY_SIZE];
@@ -260,13 +261,13 @@ int _media_db_get_media_group_count(media_group_e group, filter_h filter, int *g
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -325,13 +326,13 @@ int _media_db_get_media_group(media_group_e group, filter_h filter, media_group_
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -408,18 +409,19 @@ int _media_db_get_album(filter_h filter, media_album_cb callback, void *user_dat
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
+       
 
        memset(select_query, 0x00, sizeof(select_query));
 
@@ -493,13 +495,13 @@ int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_d
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -575,13 +577,13 @@ int _media_db_get_playlist(filter_h filter, media_playlist_cb callback, void *us
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -646,7 +648,6 @@ int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_membe
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
@@ -654,6 +655,7 @@ int _media_db_get_playlist_item(int playlist_id, filter_h filter, playlist_membe
 int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -736,13 +738,13 @@ int _media_db_get_tag(const char *media_id, filter_h filter, media_tag_cb callba
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -828,7 +830,6 @@ int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 
 }
@@ -836,6 +837,7 @@ int _media_db_get_bookmark(const char *media_id, filter_h filter, media_bookmark
 int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_list_e group_type, int *item_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
        char select_query[DEFAULT_QUERY_SIZE];
@@ -908,6 +910,7 @@ int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_li
                SAFE_FREE(option_query);
        }
 */
+
        ret = _content_query_prepare(&stmt, select_query, condition_query, option_query);
        SAFE_FREE(condition_query);
        SAFE_FREE(option_query);
@@ -920,13 +923,13 @@ int _media_db_get_group_item_count_by_id(int group_id, filter_h filter, group_li
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_group_item_count(const char *group_name, filter_h filter, group_list_e group_type, int *item_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
        char complete_select_query[DEFAULT_QUERY_SIZE];
@@ -1034,13 +1037,13 @@ int _media_db_get_group_item_count(const char *group_name, filter_h filter, grou
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        char *condition_query = NULL;
        char *option_query = NULL;
@@ -1118,13 +1121,13 @@ int _media_db_get_group_item_by_id(int group_id, filter_h filter, media_info_cb
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_group_item(const char *group_name, filter_h filter, media_info_cb callback, void *user_data, group_list_e group_type)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char complete_select_query[DEFAULT_QUERY_SIZE];
        char *select_query = NULL;
        char *condition_query = NULL;
@@ -1212,13 +1215,13 @@ int _media_db_get_group_item(const char *group_name, filter_h filter, media_info
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_media_group_item_count(const char *group_name, media_group_e group, filter_h filter, int *item_count)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        filter_s *_filter = NULL;
        char complete_select_query[DEFAULT_QUERY_SIZE];
@@ -1291,13 +1294,13 @@ int _media_db_get_media_group_item_count(const char *group_name, media_group_e g
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
 int _media_db_get_media_group_item(const char *group_name, media_group_e group, filter_h filter, media_info_cb callback, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char complete_select_query[DEFAULT_QUERY_SIZE];
        char *select_query = NULL;
        char *condition_query = NULL;
@@ -1374,6 +1377,5 @@ int _media_db_get_media_group_item(const char *group_name, media_group_e group,
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
index 8de45eb..46d07b3 100755 (executable)
@@ -323,6 +323,7 @@ int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e
 int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folder)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        char select_query[DEFAULT_QUERY_SIZE];
 
@@ -363,7 +364,6 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
@@ -408,7 +408,7 @@ int media_folder_update_to_db(media_folder_h folder)
                sqlite3_free(where_sql);
 
                /* Do folder rename operation using libmedia-service */
-               ret = media_svc_rename_folder(_content_get_db_handle(), g_src_path, _folder->path);
+               ret = media_svc_rename_folder(_content_get_db_handle(), g_src_path, _folder->path, tzplatform_getuid(TZ_USER_NAME));
                return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
        }
        else
index 55feff3..298c5f4 100755 (executable)
@@ -31,6 +31,7 @@ static int __media_info_insert_batch(media_batch_insert_e insert_type, const cha
 static int __media_info_get_media_info_from_db(char *path, media_info_h media)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        char *select_query = NULL;
        media_info_s *_media = (media_info_s*)media;
@@ -69,6 +70,7 @@ static int __media_info_get_media_info_from_db(char *path, media_info_h media)
 static int __media_info_get_media_path_by_id_from_db(const char *media_id, char **path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        sqlite3_stmt *stmt = NULL;
        char *select_query = NULL;
 
@@ -95,7 +97,6 @@ static int __media_info_get_media_path_by_id_from_db(const char *media_id, char
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
@@ -405,7 +406,7 @@ int media_info_insert_to_db (const char *path, media_info_h *info)
                }
 
                media_content_debug("media_svc_insert_item_immediately: %s", _path);
-               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, _path);
+               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_type, _path, tzplatform_getuid(TZ_USER_NAME));
 
                if (ret < 0) {
                        media_content_error("media_svc_insert_item_immediately failed : %d (%s)", ret, _path);
@@ -511,9 +512,9 @@ static int __media_info_insert_batch(media_batch_insert_e insert_type, const cha
        _cb_data->insert_list_path = strdup(list_path);
 
        if(insert_type == MEDIA_BATCH_INSERT_NORMAL)
-               ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data);
+               ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data, tzplatform_getuid(TZ_USER_NAME));
        else if(insert_type == MEDIA_BATCH_INSERT_BURSTSHOT)
-               ret = media_burstshot_register(list_path, __media_info_insert_completed_cb, _cb_data);
+               ret = media_burstshot_register(list_path, __media_info_insert_completed_cb, _cb_data, tzplatform_getuid(TZ_USER_NAME));
        else
                ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
 
@@ -595,7 +596,7 @@ int media_info_delete_from_db(const char *media_id)
                return ret;
        }
 
-       ret = media_svc_delete_item_by_path(_content_get_db_handle(), path);
+       ret = media_svc_delete_item_by_path(_content_get_db_handle(), path, tzplatform_getuid(TZ_USER_NAME));
        SAFE_FREE(path);
 
        return _content_error_capi(ret,MEDIA_CONTENT_TYPE);
@@ -2155,6 +2156,7 @@ int media_info_get_storage_type(media_info_h media, media_content_storage_e *sto
 int media_info_get_media_from_db(const char *media_id, media_info_h *media)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
+       int ret_view = MEDIA_CONTENT_ERROR_NONE;
        char select_query[DEFAULT_QUERY_SIZE];
        sqlite3_stmt *stmt = NULL;
 
@@ -2187,7 +2189,6 @@ int media_info_get_media_from_db(const char *media_id, media_info_h *media)
        }
 
        SQLITE3_FINALIZE(stmt);
-
        return ret;
 }
 
@@ -2664,7 +2665,7 @@ int media_info_refresh_metadata_to_db(const char *media_id)
                return ret;
        }
 
-       ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, file_path);
+       ret = media_svc_refresh_item(_content_get_db_handle(), storage_type, file_path, tzplatform_getuid(TZ_USER_NAME));
 
        SAFE_FREE(file_path);
        media_info_destroy(media);
@@ -2692,7 +2693,7 @@ int media_info_move_to_db(media_info_h media, const char* dst_path)
        ret = _media_util_get_store_type_by_path(dst_path, &dst_storage_type);
        media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-       ret = media_svc_move_item(_content_get_db_handle(), src_storage_type, _media->file_path, dst_storage_type, dst_path);
+       ret = media_svc_move_item(_content_get_db_handle(), src_storage_type, _media->file_path, dst_storage_type, dst_path, tzplatform_getuid(TZ_USER_NAME));
        return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
 }
 
@@ -2708,7 +2709,7 @@ int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb
                _thumb_cb->user_data = user_data;
                _thumb_cb->thumbnail_completed_cb = callback;
 
-               ret = thumbnail_request_from_db_async(_media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb);
+               ret = thumbnail_request_from_db_async(_media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, tzplatform_getuid(TZ_USER_NAME));
                ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
        }
        else
@@ -2727,7 +2728,7 @@ int media_info_cancel_thumbnail(media_info_h media)
 
        if(_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path))
        {
-               ret = thumbnail_request_cancel_media(_media->file_path);
+               ret = thumbnail_request_cancel_media(_media->file_path, tzplatform_getuid(TZ_USER_NAME));
                ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
        }
        else