Remove hardcoded path for multiuser support 91/16491/4 tizen_3.0.m14.2_ivi submit/tizen_common/20140521.163740 submit/tizen_common/20140522.130648 submit/tizen_common/20140522.135644 submit/tizen_ivi/20140618.000000 submit/tizen_ivi/20140618.000001 submit/tizen_ivi/20140619.000000 submit/tizen_ivi/20140622.000000 submit/tizen_ivi/20140623.000000 submit/tizen_ivi/20140624.064036 submit/tizen_ivi/20140626.125712 submit/tizen_ivi/20140626.130032 submit/tizen_ivi/20140626.144348 tizen_3.0.m14.2_ivi_release
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Mon, 10 Feb 2014 14:11:37 +0000 (15:11 +0100)
committerSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Fri, 28 Feb 2014 10:05:28 +0000 (11:05 +0100)
Bug-Tizen: PTREL-189

Change-Id: I507ef086d0ae897cbc43394f6159b5f291c2e258
Signed-off-by: Sabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
packaging/libmedia-service.spec
src/include/common/media-svc-env.h
test/CMakeLists.txt
test/media-service-test.c
test/plugin/media_svc_plugin_test.c

index f3e5c992834a3170eafadeee249da900b9ce7424..646b79efa820ad4d6fc57a5a4030fe6f52c08072 100755 (executable)
@@ -22,6 +22,7 @@ BuildRequires:  pkgconfig(mm-fileinfo)
 BuildRequires:  pkgconfig(media-thumbnail)
 BuildRequires:  pkgconfig(drm-client)
 BuildRequires:  pkgconfig(libmedia-utils)
+BuildRequires:  pkgconfig(libtzplatform-config)
 
 %description
 Media information service library for multimedia applications
index 5ab11998eb0bcabb46b25a84c139c23bb7773f9f..393c65d0efa6a65b75908ca9141f6d964465170b 100755 (executable)
@@ -26,6 +26,7 @@
 
 #include <time.h>
 #include <media-util.h>
+#include <tzplatform_config.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -58,11 +59,11 @@ extern "C" {
 #define MEDIA_SVC_UUID_SIZE                                            36                                              /**< Length of UUID*/
 
 #define MEDIA_SVC_TAG_UNKNOWN                          "Unknown"
-#define MEDIA_SVC_MEDIA_PATH                           MEDIA_DATA_PATH                 /**<  Media path*/
-#define MEDIA_SVC_THUMB_PATH_PREFIX                    MEDIA_SVC_MEDIA_PATH"/.thumb"                   /**< Thumbnail path prefix*/
-#define MEDIA_SVC_THUMB_INTERNAL_PATH          MEDIA_SVC_THUMB_PATH_PREFIX"/phone"     /**<  Phone thumbnail path*/
-#define MEDIA_SVC_THUMB_EXTERNAL_PATH          MEDIA_SVC_THUMB_PATH_PREFIX"/mmc"               /**<  MMC thumbnail path*/
-#define MEDIA_SVC_THUMB_DEFAULT_PATH           MEDIA_SVC_THUMB_PATH_PREFIX"/thumb_default.png" /** default thumbnail */
+#define MEDIA_SVC_MEDIA_PATH                           tzplatform_mkpath(TZ_USER_DATA, "file-manager-service")                 /**<  Media path*/
+#define MEDIA_SVC_THUMB_PATH_PREFIX                    tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb")                  /**< Thumbnail path prefix*/
+#define MEDIA_SVC_THUMB_INTERNAL_PATH          tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/phone")    /**<  Phone thumbnail path*/
+#define MEDIA_SVC_THUMB_EXTERNAL_PATH          tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/mmc")              /**<  MMC thumbnail path*/
+#define MEDIA_SVC_THUMB_DEFAULT_PATH           tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/thumb_default.png") /** default thumbnail */
 
 #define MEDIA_SVC_DEFAULT_GPS_VALUE                    -200                    /**<  Default GPS Value*/
 #define THUMB_EXT      "jpg"
index bc924e51240ac15f352f677b45117e4693b0e794..eb0dd53aaa32314408b8c601cc9b66ddc5b012f5 100755 (executable)
@@ -2,7 +2,7 @@ SET(fw_name "media-service")
 SET(fw_test "${fw_name}-test")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog libmedia-utils)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog libmedia-utils libtzplatform-config)
 FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
index 3d7a51a2ce627ac5490892bbd4c26747166de62e..c161ee450948614ed9ad98b4dea025561f9f18bb 100644 (file)
@@ -61,7 +61,7 @@ gboolean _send_noti_batch_operations(gpointer data)
     media_db_update_subscribe(_noti_cb, (void*)user_str);
 
     /* 1. media_svc_insert_item_immediately */
-    char *path = "/opt/usr/media/test/image1.jpg";
+    char *path = tzplatform_mkpath(TZ_USER_CONTENT, "test/image1.jpg");
 
        media_svc_storage_type_e storage_type;
 
@@ -78,7 +78,7 @@ gboolean _send_noti_batch_operations(gpointer data)
        //ret = media_svc_insert_item_begin(g_db_handle, 100);
        for (i = 0; i < 16; i++) {
                char filepath[255] = {0,};
-               snprintf(filepath, sizeof(filepath), "%s%d.jpg", "/opt/usr/media/test/image", i+1);
+               snprintf(filepath, sizeof(filepath), "%s%d.jpg", tzplatform_mkpath(TZ_USER_CONTENT,"test/image"), i+1);
                media_svc_debug("File : %s\n", filepath);
                file_list[i] = strdup(filepath);
                ret = media_svc_insert_item_bulk(g_db_handle, storage_type, file_list[i], FALSE);
@@ -104,7 +104,7 @@ gboolean _send_noti_operations(gpointer data)
        media_db_update_subscribe(_noti_cb, (void*)user_str);
 
        /* 1. media_svc_insert_item_immediately */
-       char *path = "/opt/usr/media/test/image1.jpg";
+       char *path = tzplatform_mkpath(TZ_USER_CONTENT,"test/image1.jpg");
        media_svc_storage_type_e storage_type;
 
        ret = media_svc_get_storage_type(path, &storage_type);
@@ -130,7 +130,7 @@ gboolean _send_noti_operations(gpointer data)
        media_svc_debug("media_svc_refresh_item success");
 
        /* 2. media_svc_move_item */
-       const char *dst_path = "/opt/usr/media/test/image11.jpg";
+       const char *dst_path = tzplatform_mkpath(TZ_USER_CONTENT, "test/image11.jpg");
        ret = media_svc_move_item(g_db_handle, storage_type, path, storage_type, dst_path);
        if (ret < MEDIA_INFO_ERROR_NONE) {
                media_svc_error("media_svc_move_item failed : %d", ret);
@@ -154,8 +154,8 @@ gboolean _send_noti_operations(gpointer data)
        media_svc_debug("media_svc_delete_item_by_path success");
 
        /* Rename folder */
-       const char *src_folder_path = "/opt/usr/media/test";
-       const char *dst_folder_path = "/opt/usr/media/test_test";
+       const char *src_folder_path = tzplatform_mkpath(TZ_USER_CONTENT, "test");
+       const char *dst_folder_path = tzplatform_mkpath(TZ_USER_CONTENT,"test_test");
        ret = media_svc_rename_folder(g_db_handle, src_folder_path, dst_folder_path);
        if (ret < MEDIA_INFO_ERROR_NONE) {
                media_svc_error("media_svc_rename_folder failed : %d", ret);
index eb4023ff987adde4043ed5d80295f0236a244720..f644d0b5a75f36829396afc9fdbb680b539f3742 100755 (executable)
 #include <dlfcn.h>
 #include <media-svc.h>
 
+#include <tzplatform_config.h>
+
 #define PLUGIN_SO_FILE_NAME  "/usr/lib/libmedia-content-plugin.so"
+#define MEDIA_ROOT_PATH_SDCARD tzplatform_mkpath(TZ_SYS_STORAGE,"sdcard")
 void *funcHandle = NULL;
 
 static void msg_print(int line, char *msg);
@@ -97,7 +100,7 @@ int main()
        }
 
        //check_item ================================================
-       ret = svc_check_item("/opt/usr/media/Music/Over the horizon.mp3", "audio/mpeg", &err_msg);
+       ret = svc_check_item(tzplatform_mkpath(TZ_USER_CONTENT,"Music/Over the horizon.mp3"), "audio/mpeg", &err_msg);
        if(ret < 0) {
                msg_print(__LINE__, "svc_check_item error");
                if(err_msg != NULL) {
@@ -138,7 +141,7 @@ int main()
 #if 1
        while (1) {
 
-       printf("Enter path and mimetype ( ex. /opt/usr/media/a.jpg image ) : ");
+       printf("Enter path and mimetype ( ex. %s image ) : ", tzplatform_mkpath(TZ_USER_CONTENT, "a.jpg"));
        scanf("%s %s", path, type);
 
        //check_item_exist ============================================
@@ -181,7 +184,7 @@ int main()
 #endif
 
        //folder test ==================================================
-       char *folder_path = "/opt/usr/media/Sounds";
+       char *folder_path = tzplatform_mkpath(TZ_USER_CONTENT,"Sounds"));
        ret = svc_set_folder_item_validity(db_handle, folder_path, 0, 1, &err_msg);
        if(ret < 0) {
                msg_print(__LINE__, "svc_set_folder_item_validity error");