[v0.3.26] use storage api to convert file path for tizen 2.4 compatibility 41/90341/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 29 Sep 2016 11:49:07 +0000 (20:49 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 29 Sep 2016 11:49:07 +0000 (20:49 +0900)
Change-Id: Id222b7ad25ad732ddf7d845f1b98b7cdc0b53eee

CMakeLists.txt
include/player_private.h
packaging/capi-media-player.spec
src/player.c
src/player_internal.c

index b37d04a..f14d13f 100644 (file)
@@ -17,9 +17,9 @@ SET(INC_COM_DIR include)
 
 INCLUDE_DIRECTORIES(${INC_DIR}, ${INC_COM_DIR})
 IF (TIZEN_FEATURE_EVAS_RENDERER)
-SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common mused mm-common tizen-extension-client evas ecore elementary mm-evas-renderer libtzplatform-config")
+SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common mused mm-common tizen-extension-client evas ecore elementary mm-evas-renderer storage")
 ELSE (TIZEN_FEATURE_EVAS_RENDERER)
-SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common mused mm-common tizen-extension-client evas ecore elementary libtzplatform-config")
+SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common mused mm-common tizen-extension-client evas ecore elementary storage")
 ENDIF (TIZEN_FEATURE_EVAS_RENDERER)
 SET(pc_dependents "libtbm capi-media-tool capi-base-common capi-media-sound-manager ecore-wayland")
 
index 7aebbe8..a5ea70f 100644 (file)
@@ -145,7 +145,6 @@ typedef struct _player_cli_s {
 
 int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api);
 int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out);
-void _player_replace_old_path(const char *in_path, char *out_path);
 
 #ifdef __cplusplus
 }
index b7be8df..40f018a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.25
+Version:    0.3.26
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -24,7 +24,7 @@ BuildRequires:  pkgconfig(mmsvc-player)
 BuildRequires:  pkgconfig(json-c)
 BuildRequires:  pkgconfig(libtbm)
 BuildRequires:  pkgconfig(eom)
-BuildRequires:  pkgconfig(libtzplatform-config)
+BuildRequires:  pkgconfig(storage)
 %if "%{?profile}" != "tv" && "%{?profile}" != "wearable"
 BuildRequires:  pkgconfig(mm-evas-renderer)
 %endif
index 1938623..2abcfd6 100644 (file)
@@ -36,7 +36,7 @@
 #include <muse_player_msg.h>
 #include <sound_manager.h>
 #include <sound_manager_internal.h>
-#include <tzplatform_config.h>
+#include <storage-internal.h>
 #include "player_internal.h"
 #include "player_private.h"
 #include "player_display.h"
@@ -1778,22 +1778,6 @@ int player_unprepare(player_h player)
        return ret;
 }
 
-/* for backward compatability, to make the old path accessable */
-void _player_replace_old_path(const char *in_path, char *out_path)
-{
-       const char *old_path = "/opt/usr/media";
-
-       LOGD("input file_path : %s", in_path);
-
-       if (strncmp(in_path, old_path, strlen(old_path)) == 0)
-               snprintf(out_path, MAX_URL_LEN, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), in_path+strlen(old_path));
-       else
-               snprintf(out_path, MAX_URL_LEN, "%s", in_path);
-
-       LOGD("replaced path : %s", out_path);
-       return;
-}
-
 int player_set_uri(player_h player, const char *uri)
 {
        PLAYER_INSTANCE_CHECK(player);
@@ -1802,11 +1786,17 @@ int player_set_uri(player_h player, const char *uri)
        muse_player_api_e api = MUSE_PLAYER_API_SET_URI;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
-       char path[MAX_URL_LEN];
+       char path[MAX_URL_LEN] = {0, };
 
        LOGD("ENTER");
 
-       _player_replace_old_path(uri, path);
+       if (storage_get_origin_internal_path(uri, MAX_URL_LEN, path) < 0) {
+               /* cannot convert path. use the original one. */
+               strncpy(path, uri, MAX_URL_LEN-1);
+       } else {
+               /* need to use converted path. */
+               LOGD("Converted path : %s -> %s", uri, path);
+       }
 
        player_msg_send1(api, pc, ret_buf, ret, STRING, path);
        pc->push_media_stream = FALSE;
index c1af60e..2c32cbc 100644 (file)
@@ -27,6 +27,7 @@
 #include <Ecore_Wayland.h>
 #include <muse_player.h>
 #include <muse_player_msg.h>
+#include <storage-internal.h>
 #include "player_private.h"
 #include "player_msg.h"
 #include "player_internal.h"
@@ -263,11 +264,18 @@ int player_set_next_uri(player_h player, const char *uri)
        muse_player_api_e api = MUSE_PLAYER_API_SET_NEXT_URI;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
-       char path[MAX_URL_LEN];
+       char path[MAX_URL_LEN] = {0, };
 
        LOGD("ENTER");
 
-       _player_replace_old_path(uri, path);
+       if (storage_get_origin_internal_path(uri, MAX_URL_LEN, path) < 0) {
+               /* cannot convert path. use the original one. */
+               strncpy(path, uri, MAX_URL_LEN-1);
+       } else {
+               /* need to use converted path. */
+               LOGD("Converted path : %s -> %s", uri, path);
+       }
+
        player_msg_send1(api, pc, ret_buf, ret, STRING, path);
 
        g_free(ret_buf);
@@ -289,7 +297,16 @@ int player_get_next_uri(player_h player, char **uri)
        player_msg_send(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
                player_msg_get_string(next_uri, ret_buf);
-               *uri = strndup(next_uri, MUSE_MSG_MAX_LENGTH);
+
+               char dest[MUSE_MSG_MAX_LENGTH] = {0,};
+               if(storage_get_compat_internal_path(next_uri, sizeof(dest), dest) < 0) {
+                       /* cannot convert path. use the original one. */
+                       *uri = strndup(next_uri, MUSE_MSG_MAX_LENGTH);
+               } else {
+                       /* need to use converted path. */
+                       LOGD("Converted path : %s -> %s", next_uri, dest);
+                       *uri = strndup(dest, MUSE_MSG_MAX_LENGTH);
+               }
        }
        g_free(ret_buf);
        return ret;