[v0.3.21] convert /opt/usr/media path to make it accessable 35/89335/2 accepted/tizen/common/20160923.161130 accepted/tizen/ivi/20160927.074653 accepted/tizen/mobile/20160927.074849 accepted/tizen/tv/20160927.075008 accepted/tizen/wearable/20160927.073949 submit/tizen/20160923.095911
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 23 Sep 2016 06:33:52 +0000 (15:33 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 23 Sep 2016 06:55:23 +0000 (15:55 +0900)
and fix svace issue

Change-Id: I6ecd68ab56c1b300df096c67c6b622b11bbd0665

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

index 5efda6d..b37d04a 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")
+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")
 
index 151b89c..b97357a 100644 (file)
@@ -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
 }
index 2e5f216..c131210 100644 (file)
@@ -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
index 6e43c5d..8325414 100644 (file)
@@ -36,6 +36,7 @@
 #include <muse_player_msg.h>
 #include <sound_manager.h>
 #include <sound_manager_internal.h>
+#include <tzplatform_config.h>
 #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);
index 9ed4a5a..c1af60e 100644 (file)
@@ -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;