From: Eunhae Choi Date: Thu, 29 Sep 2016 11:49:07 +0000 (+0900) Subject: [v0.3.26] use storage api to convert file path for tizen 2.4 compatibility X-Git-Tag: submit/tizen/20161005.055916~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da8faa98206ab33af871ac4114e1753514694e31;p=platform%2Fcore%2Fapi%2Fplayer.git [v0.3.26] use storage api to convert file path for tizen 2.4 compatibility Change-Id: Id222b7ad25ad732ddf7d845f1b98b7cdc0b53eee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b37d04a..f14d13f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/include/player_private.h b/include/player_private.h index 7aebbe8..a5ea70f 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -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 } diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index b7be8df..40f018a 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -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 diff --git a/src/player.c b/src/player.c index 1938623..2abcfd6 100644 --- a/src/player.c +++ b/src/player.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #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; diff --git a/src/player_internal.c b/src/player_internal.c index c1af60e..2c32cbc 100644 --- a/src/player_internal.c +++ b/src/player_internal.c @@ -27,6 +27,7 @@ #include #include #include +#include #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;