From 9f1fb61d53067592e5cbc40cd62d50ca1de3ddd9 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Fri, 23 Sep 2016 15:33:52 +0900 Subject: [PATCH] [v0.3.21] convert /opt/usr/media path to make it accessable and fix svace issue Change-Id: I6ecd68ab56c1b300df096c67c6b622b11bbd0665 --- CMakeLists.txt | 4 ++-- include/player_private.h | 3 ++- packaging/capi-media-player.spec | 3 ++- src/player.c | 28 ++++++++++++++++++++++++++-- src/player_internal.c | 4 +++- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5efda6d..b37d04a 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") +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") 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") +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") 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 151b89c..b97357a 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -50,7 +50,7 @@ extern "C" { #define CREATE_CB_TIME_OUT 400 /* ms */ #define CALLBACK_TIME_OUT 5000 /* ms */ #define MAX_SERVER_TIME_OUT 35000 /* ms */ - +#define MAX_URL_LEN 2048 /**< Maximum length of the maximum URL */ typedef struct _ret_msg_s { gint api; @@ -142,6 +142,7 @@ 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 2e5f216..c131210 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.20 +Version: 0.3.21 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -24,6 +24,7 @@ BuildRequires: pkgconfig(mmsvc-player) BuildRequires: pkgconfig(json-c) BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(eom) +BuildRequires: pkgconfig(libtzplatform-config) %if "%{?profile}" != "tv" && "%{?profile}" != "wearable" BuildRequires: pkgconfig(mm-evas-renderer) %endif diff --git a/src/player.c b/src/player.c index 6e43c5d..8325414 100644 --- a/src/player.c +++ b/src/player.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "player_internal.h" #include "player_private.h" #include "player_display.h" @@ -1636,6 +1637,23 @@ 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); @@ -1644,10 +1662,13 @@ 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]; LOGD("ENTER"); - player_msg_send1(api, pc, ret_buf, ret, STRING, uri); + _player_replace_old_path(uri, path); + + player_msg_send1(api, pc, ret_buf, ret, STRING, path); pc->push_media_stream = FALSE; g_free(ret_buf); @@ -2391,6 +2412,7 @@ int player_set_display_visible(player_h player, bool visible) return PLAYER_ERROR_NONE; } #endif + player_msg_send1(api, pc, ret_buf, ret, INT, visible); g_free(ret_buf); return ret; @@ -2656,7 +2678,9 @@ EXIT: if (tfd > INVALID_DEFAULT_VALUE) close(tfd); - pc->cb_info->tfd = INVALID_DEFAULT_VALUE; + + if (CALLBACK_INFO(pc)) + pc->cb_info->tfd = INVALID_DEFAULT_VALUE; if (bo) tbm_bo_unref(bo); diff --git a/src/player_internal.c b/src/player_internal.c index 9ed4a5a..c1af60e 100644 --- a/src/player_internal.c +++ b/src/player_internal.c @@ -263,10 +263,12 @@ 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]; LOGD("ENTER"); - player_msg_send1(api, pc, ret_buf, ret, STRING, uri); + _player_replace_old_path(uri, path); + player_msg_send1(api, pc, ret_buf, ret, STRING, path); g_free(ret_buf); return ret; -- 2.7.4