From 7d200edadf140177db7e8ffeb60a9a2a3097d551 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Thu, 20 Oct 2016 17:03:48 +0900 Subject: [PATCH 01/16] [v0.2.31] fix svace issue and sync param name with player api pkg Change-Id: I6d1ff2645f3ba5a438c0d7309af4a86d1ad94f0c --- muse/src/muse_player.c | 24 +++++++++++++++--------- packaging/mmsvc-player.spec | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index 41cb2d0..19f8d36 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -932,6 +932,11 @@ int player_disp_prepare_async(muse_module_h module) muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); prepare_data = g_new(prepare_data_s, 1); + if (!prepare_data) { + ret = PLAYER_ERROR_INVALID_OPERATION; + goto ERROR; + } + prepare_data->player = muse_player->player_handle; prepare_data->module = module; @@ -939,10 +944,11 @@ int player_disp_prepare_async(muse_module_h module) if (ret == PLAYER_ERROR_NONE) { legacy_player_get_timeout_for_muse(muse_player->player_handle, &timeout); player_msg_return1(api, ret, module, INT, timeout); - } else { - player_msg_return(api, ret, module); - } + return ret; + } /* else is error */ +ERROR: + player_msg_return(api, ret, module); return ret; } @@ -1817,12 +1823,12 @@ int player_disp_set_progressive_download_path(muse_module_h module) int ret = PLAYER_ERROR_NONE; muse_player_handle_s *muse_player = NULL; muse_player_api_e api = MUSE_PLAYER_API_SET_PROGRESSIVE_DOWNLOAD_PATH; - char path[MUSE_URI_MAX_LENGTH] = { 0, }; + char dw_path[MUSE_URI_MAX_LENGTH] = { 0, }; muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); - player_msg_get_string(path, muse_core_client_get_msg(module)); + player_msg_get_string(dw_path, muse_core_client_get_msg(module)); - ret = legacy_player_set_progressive_download_path(muse_player->player_handle, path); + ret = legacy_player_set_progressive_download_path(muse_player->player_handle, dw_path); player_msg_return(api, ret, module); return ret; @@ -1959,12 +1965,12 @@ int player_disp_set_subtitle_path(muse_module_h module) int ret = PLAYER_ERROR_NONE; muse_player_handle_s *muse_player = NULL; muse_player_api_e api = MUSE_PLAYER_API_SET_SUBTITLE_PATH; - char path[MUSE_URI_MAX_LENGTH] = { 0, }; + char subtitle_path[MUSE_URI_MAX_LENGTH] = { 0, }; muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); - player_msg_get_string(path, muse_core_client_get_msg(module)); + player_msg_get_string(subtitle_path, muse_core_client_get_msg(module)); - ret = legacy_player_set_subtitle_path(muse_player->player_handle, path); + ret = legacy_player_set_subtitle_path(muse_player->player_handle, subtitle_path); player_msg_return(api, ret, module); diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index a1a5a6c..f7abf34 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.30 +Version: 0.2.31 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From c3ec5d6b5e19733d21afffea9d04df2fb0a48b7b Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Thu, 20 Oct 2016 21:08:25 +0900 Subject: [PATCH 02/16] [v0.2.32] apply new muse send/recv interface for multiple fds Change-Id: I7914c25190e62ac697f600607824a77eacb403ff --- legacy/src/legacy_player.c | 1 + muse/include/muse_player_msg.h | 20 +++++++++++++++----- muse/src/muse_player.c | 38 ++++++++++++++++++++++++++++++-------- packaging/mmsvc-player.spec | 2 +- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index 5e4bdb2..74156c0 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -2186,6 +2186,7 @@ int legacy_player_get_codec_info(player_h player, char **audio_codec, char **vid else *video_codec = strndup("", 0); + LOGD("codec info: %s, %s", *audio_codec, *video_codec); return PLAYER_ERROR_NONE; } } diff --git a/muse/include/muse_player_msg.h b/muse/include/muse_player_msg.h index d7124cb..0fe24fe 100644 --- a/muse/include/muse_player_msg.h +++ b/muse/include/muse_player_msg.h @@ -439,12 +439,15 @@ typedef struct { int __len__; \ type1 __value1__ = (type1)param1; \ type2 __value2__ = (type2)param2; \ + int __tfd__[MUSE_NUM_FD]; \ + memset(__tfd__, -1, sizeof(__tfd__)); \ + __tfd__[0] = tfd; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ MUSE_TYPE_INT, MUSE_PARAM_RETURN, ret, \ MUSE_TYPE_##type1, #param1, __value1__, \ MUSE_TYPE_##type2, #param2, __value2__, \ 0); \ - __len__ = muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), tfd, __sndMsg__); \ + __len__ = muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), __tfd__, __sndMsg__); \ if (__len__ <= 0) { \ LOGE("sending message failed"); \ ret = PLAYER_ERROR_INVALID_OPERATION; \ @@ -605,11 +608,14 @@ typedef struct { do { \ char *__sndMsg__; \ type __value__ = (type)param; \ + int __tfd__[MUSE_NUM_FD]; \ + memset(__tfd__, -1, sizeof(__tfd__)); \ + __tfd__[0] = tfd; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \ MUSE_TYPE_##type, #param, __value__, \ 0); \ - muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), tfd, __sndMsg__); \ + muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), __tfd__, __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ } while (0) @@ -630,6 +636,9 @@ typedef struct { type2 __value2__ = (type2)param2; \ type3 __value3__ = (type3)param3; \ type4 __value4__ = (type4)param4; \ + int __tfd__[MUSE_NUM_FD]; \ + memset(__tfd__, -1, sizeof(__tfd__)); \ + __tfd__[0] = tfd; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ MUSE_TYPE_INT, MUSE_PARAM_EVENT, event, \ MUSE_TYPE_##type1, #param1, __value1__, \ @@ -637,7 +646,7 @@ typedef struct { MUSE_TYPE_##type3, #param3, __value3__, \ MUSE_TYPE_##type4, #param4, __value4__, \ 0); \ - muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), tfd, __sndMsg__); \ + muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), __tfd__, __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ } while (0) @@ -822,8 +831,9 @@ typedef struct { * @param[in] arr_param the name of param is key, must be local array/pointer variable. * @param[in] length The size of array. * @param[in] datum_size The size of a array's datum. + * @param[in] tfd the array of tbm_fd from tbm_bo_export_fd(). */ -#define player_msg_event7_array(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7, arr_param, length, datum_size) \ +#define player_msg_event7_array_fd(api, event, module, type1, param1, type2, param2, type3, param3, type4, param4, type5, param5, type6, param6, type7, param7, arr_param, length, datum_size, tfd) \ do { \ char *__sndMsg__; \ type1 __value1__ = (type1)param1; \ @@ -849,7 +859,7 @@ typedef struct { length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ __arr_value__, \ 0); \ - muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ + muse_core_ipc_send_fd_msg(muse_core_client_get_msg_fd(module), tfd, __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ } while (0) diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index 19f8d36..7e362ce 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -328,7 +328,8 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data) tbm_surface_h suf; tbm_bo bo[4]; int bo_num; - tbm_key key[4] = {0, }; + tbm_fd tfd[4]; + int key[4]; tbm_surface_info_s sinfo; int i; char *surface_info = (char *)&sinfo; @@ -339,6 +340,8 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data) uint64_t pts = 0; memset(&sinfo, 0, sizeof(tbm_surface_info_s)); + memset(tfd, INVALID_DEFAULT_VALUE, sizeof(tfd)); + memset(key, INVALID_DEFAULT_VALUE, sizeof(key)); ret = media_packet_get_tbm_surface(pkt, &suf); if (ret != MEDIA_PACKET_ERROR_NONE) { @@ -349,23 +352,33 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data) bo_num = tbm_surface_internal_get_num_bos(suf); for (i = 0; i < bo_num; i++) { bo[i] = tbm_surface_internal_get_bo(suf, i); - if (bo[i]) - key[i] = tbm_bo_export(bo[i]); - else + if (bo[i]) { + key[i] = tbm_bo_export(bo[i]); /* FIXME: will be exchanged to unique mm key */ + tfd[i] = tbm_bo_export_fd(bo[i]); + if (i == 0 && tfd[0] <= INVALID_DEFAULT_VALUE) { + LOGE("failed to get tbm fd from %p", bo[0]); + media_packet_destroy(pkt); + return; + } + /* LOGD(" tbm fd = %d:%d", key[i], tfd[i]); */ + } else { LOGE("bo_num is %d, bo[%d] is NULL", bo_num, i); + } } ret = tbm_surface_get_info(suf, &sinfo); if (ret != TBM_SURFACE_ERROR_NONE) { LOGE("tbm_surface_get_info error %d", ret); - return; + media_packet_destroy(pkt); + goto ERROR; } /* add packet to the data_list */ muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); if (muse_player == NULL) { LOGE("handle is NULL"); - return; + media_packet_destroy(pkt); + goto ERROR; } g_mutex_lock(&muse_player->list_lock); @@ -373,7 +386,7 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data) LOGE("Too many buffers are not released. packet(%p) will be drop.", pkt); g_mutex_unlock(&muse_player->list_lock); media_packet_destroy(pkt); - return; + goto ERROR; } muse_player->packet_list = g_list_append(muse_player->packet_list, (gpointer)pkt); @@ -383,7 +396,16 @@ static void _media_packet_video_decoded_cb(media_packet_h pkt, void *user_data) media_format_get_video_info(fmt, &mimetype, NULL, NULL, NULL, NULL); media_format_unref(fmt); media_packet_get_pts(pkt, &pts); - player_msg_event7_array(api, ev, module, INT, key[0], INT, key[1], INT, key[2], INT, key[3], POINTER, packet, INT, mimetype, INT64, pts, surface_info, surface_info_size, sizeof(char)); + player_msg_event7_array_fd(api, ev, module, INT, key[0], INT, key[1], INT, key[2], INT, key[3], POINTER, packet, INT, mimetype, INT64, pts, surface_info, surface_info_size, sizeof(char), tfd); + +ERROR: + + for (i = 0; i < bo_num; i++) { + if (tfd[i] > INVALID_DEFAULT_VALUE) + close(tfd[i]); + } + + return; } static void _video_stream_changed_cb(int width, int height, int fps, int bit_rate, void *user_data) diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index f7abf34..7390a4f 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.31 +Version: 0.2.32 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 597ad66688191ec2002591e68d101032e49bbc09 Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Fri, 28 Oct 2016 14:31:17 +0900 Subject: [PATCH 03/16] [v0.2.33] enable evas surface on wearable device Change-Id: I30736d8dae17a3ebf843ba9c5cc0a28cdf9aa62d --- packaging/mmsvc-player.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 7390a4f..60bb1b4 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.32 +Version: 0.2.33 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -55,7 +55,7 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" export CFLAGS+=" -DTIZEN_FEATURE_ASM" MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ -%if "%{?profile}" == "tv" || "%{?profile}" == "wearable" +%if "%{?profile}" == "tv" -DTIZEN_FEATURE_EVAS_RENDERER=Off %else -DTIZEN_FEATURE_EVAS_RENDERER=On -- 2.7.4 From 7664865830dd9c289a8bbd46cd7c55227a4c293f Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Fri, 28 Oct 2016 15:15:48 +0900 Subject: [PATCH 04/16] [v0.2.32] change test file name Change-Id: I7626786daa1c07cce206f57879f039374e6b9eef --- legacy/test/legacy_player_es_push_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy/test/legacy_player_es_push_test.c b/legacy/test/legacy_player_es_push_test.c index e6ac5e6..13e868f 100644 --- a/legacy/test/legacy_player_es_push_test.c +++ b/legacy/test/legacy_player_es_push_test.c @@ -27,7 +27,7 @@ #define KEY_END "XF86Stop" #define ES_DEFAULT_DIR_PATH "/home/owner/content/" -#define ES_DEFAULT_H264_VIDEO_PATH ES_DEFAULT_DIR_PATH"Simpsons.h264" +#define ES_DEFAULT_H264_VIDEO_PATH ES_DEFAULT_DIR_PATH"test.h264" #define ES_DEFAULT_VIDEO_FORMAT_TYPE MEDIA_FORMAT_H264_SP #define ES_DEFAULT_VIDEO_FORMAT_WIDTH 1280 #define ES_DEFAULT_VIDEO_FORMAT_HEIGHT 544 -- 2.7.4 From 3f3306b4a35ea95226a3e5dda648e1881ef008ad Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Tue, 1 Nov 2016 21:13:58 +0900 Subject: [PATCH 05/16] [v0.2.33] add privilege check and remove internet feature check at legacy_player - add privilege check about storage and internet - move feature check to api/player Change-Id: I2a0df265053840615e3cd2cf6e0d9118dfe9ae09 Signed-off-by: Eunhae Choi --- legacy/CMakeLists.txt | 2 +- legacy/include/legacy_player_private.h | 1 - legacy/src/legacy_player.c | 46 --------- muse/CMakeLists.txt | 2 +- muse/src/muse_player.c | 176 ++++++++++++++++++++++++++++++--- packaging/mmsvc-player.spec | 3 +- 6 files changed, 167 insertions(+), 63 deletions(-) diff --git a/legacy/CMakeLists.txt b/legacy/CMakeLists.txt index 6b46f2a..c7b4166 100644 --- a/legacy/CMakeLists.txt +++ b/legacy/CMakeLists.txt @@ -4,7 +4,7 @@ SET(service "legacy") SET(submodule "player") # for package file -SET(dependents "dlog mm-player capi-base-common capi-media-tool libtbm evas ecore elementary capi-system-info") +SET(dependents "dlog mm-player capi-base-common capi-media-tool libtbm evas ecore elementary") SET(fw_name "${service}-${submodule}") diff --git a/legacy/include/legacy_player_private.h b/legacy/include/legacy_player_private.h index 4d9efd5..253f385 100644 --- a/legacy/include/legacy_player_private.h +++ b/legacy/include/legacy_player_private.h @@ -17,7 +17,6 @@ #ifndef __TIZEN_MEDIA_LEGACY_PLAYER_PRIVATE_H__ #define __TIZEN_MEDIA_LEGACY_PLAYER_PRIVATE_H__ #include -#include #include "muse_player.h" #include "legacy_player.h" diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index 74156c0..8371eee 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -434,44 +434,6 @@ int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user return MEDIA_PACKET_FINALIZE; } -static bool _player_network_availability_check() -{ -#define _FEATURE_NAME_WIFI "http://tizen.org/feature/network.wifi" -#define _FEATURE_NAME_TELEPHONY "http://tizen.org/feature/network.telephony" -#define _FEATURE_NAME_ETHERNET "http://tizen.org/feature/network.ethernet" - bool enabled = FALSE; - bool supported = FALSE; - - if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled)) { - LOGI("wifi status = %d", enabled); - if (enabled) - supported = TRUE; - } else { - LOGE("SYSTEM_INFO_ERROR"); - } - - if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled)) { - LOGI("telephony status = %d", enabled); - if (enabled) - supported = TRUE; - } else { - LOGE("SYSTEM_INFO_ERROR"); - } - - if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled)) { - LOGI("ethernet status = %d", enabled); - if (enabled) - supported = TRUE; - } else { - LOGE("SYSTEM_INFO_ERROR"); - } - - if (!supported) - return FALSE; - - return TRUE; -} - static player_interrupted_code_e __convert_interrupted_code(int code) { player_interrupted_code_e ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT; @@ -526,10 +488,6 @@ static int __set_callback(muse_player_event_e type, player_h player, void *callb { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); - if (MUSE_PLAYER_EVENT_TYPE_BUFFERING == type) { - if (!_player_network_availability_check()) - return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; - } player_s *handle = (player_s *)player; handle->user_cb[type] = callback; @@ -2425,8 +2383,6 @@ int legacy_player_set_progressive_download_path(player_h player, const char *pat { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(path); - if (!_player_network_availability_check()) - return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; player_s *handle = (player_s *)player; PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE); @@ -2606,8 +2562,6 @@ int legacy_player_set_progressive_download_message_cb(player_h player, player_pd { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(callback); - if (!_player_network_availability_check()) - return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; player_s *handle = (player_s *)player; diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt index 9529a02..f1b6e15 100644 --- a/muse/CMakeLists.txt +++ b/muse/CMakeLists.txt @@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(service "muse") SET(submodule "player") -SET(dependents "dlog mused mm-common libtbm capi-system-info") +SET(dependents "dlog mused mm-common libtbm capi-system-info libtzplatform-config") SET(fw_name "${service}-${submodule}") PROJECT(${fw_name}) diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index 7e362ce..c024191 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -20,6 +20,9 @@ #include #include #include +#include +#include +#include #include "muse_player.h" #include "muse_player_msg.h" #include "muse_player_private.h" @@ -32,6 +35,20 @@ #define INVALID_DEFAULT_VALUE -1 +#define MEDIA_PATH_EXTERNAL tzplatform_getenv(TZ_SYS_STORAGE) /* external storage */ +#define MEDIA_STORAGE_PRIVILEGE_NAME "http://tizen.org/privilege/mediastorage" +#define EXTERNAL_STORAGE_PRIVILEGE_NAME "http://tizen.org/privilege/externalstorage" +#define INTERNET_PRIVILEGE_NAME "http://tizen.org/privilege/internet" +#define NUM_OF_URI_PREFIX 6 +static const char *uri_prefix[NUM_OF_URI_PREFIX] = { + "http://", + "https://", + "mms://", + "rtsp://", + "rtspu://", + "rtspr://" +}; + /** * msg dispatcher functions * To add new disp function with new player API, @@ -213,6 +230,138 @@ static void _remove_export_media_packet(muse_module_h module) } } +/* check the given path is indicating sdp file */ +static bool _is_sdp_file(const char *path) +{ + gboolean ret = FALSE; + gchar* uri = NULL; + + if (!path) { + LOGE("invalid path param"); + return ret; + } + + uri = g_ascii_strdown(path, -1); + + if (uri == NULL) + return FALSE; + + /* trimming */ + g_strstrip(uri); + + /* strlen(".sdp") == 4 */ + if (strlen(uri) <= 4) { + LOGW("path is too short.\n"); + return ret; + } + + /* first, check extension name */ + ret = g_str_has_suffix(uri, "sdp"); + + /* second, if no suffix is there, check it's contents */ + if (!ret) + /* FIXIT : do it soon */ + LOGD("no suffix"); + + g_free(uri); + uri = NULL; + + return ret; +} + +static bool _check_network_availability(void) +{ +#define _FEATURE_NAME_WIFI "http://tizen.org/feature/network.wifi" +#define _FEATURE_NAME_TELEPHONY "http://tizen.org/feature/network.telephony" +#define _FEATURE_NAME_ETHERNET "http://tizen.org/feature/network.ethernet" + bool enabled = FALSE; + bool supported = FALSE; + + if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled)) { + LOGI("wifi status = %d", enabled); + if (enabled) + supported = TRUE; + } else { + LOGE("SYSTEM_INFO_ERROR"); + } + + if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled)) { + LOGI("telephony status = %d", enabled); + if (enabled) + supported = TRUE; + } else { + LOGE("SYSTEM_INFO_ERROR"); + } + + if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled)) { + LOGI("ethernet status = %d", enabled); + if (enabled) + supported = TRUE; + } else { + LOGE("SYSTEM_INFO_ERROR"); + } + + if (!supported) + return FALSE; + + return TRUE; +} + +static int _check_supportable(muse_module_h module, char *path) +{ + int ret = PLAYER_ERROR_NONE; + int client_fd = -1; + int idx = 0; + char *privilege = NULL; + + if (!path) { + LOGE("invalid path param"); + return PLAYER_ERROR_INVALID_PARAMETER; + } + + client_fd = muse_core_client_get_msg_fd(module); + + for (idx = 0; idx < NUM_OF_URI_PREFIX; idx++) { + if (strncmp(path, uri_prefix[idx], strlen(uri_prefix[idx])) == 0) { + LOGD("internet privilege will be checked for %s path", uri_prefix[idx]); + break; + } + } + + if (idx != NUM_OF_URI_PREFIX) { + privilege = INTERNET_PRIVILEGE_NAME; + } else { + char *file_path = path; + + if (strncmp(path, "file://", strlen("file://")) == 0) { + if (_is_sdp_file(path)) /* check internet privilege */ + privilege = INTERNET_PRIVILEGE_NAME; + else + file_path = path+7; /* remove file prefix */ + } + + if (strncmp(file_path, MEDIA_PATH_EXTERNAL, strlen(MEDIA_PATH_EXTERNAL)) == 0) + privilege = EXTERNAL_STORAGE_PRIVILEGE_NAME; + else + privilege = MEDIA_STORAGE_PRIVILEGE_NAME; + } + + if (!muse_core_security_check_cynara(client_fd, privilege)) { + ret = PLAYER_ERROR_PERMISSION_DENIED; + LOGE("security check failed %s", privilege); + } else { + if (strncmp(privilege, INTERNET_PRIVILEGE_NAME, strlen(INTERNET_PRIVILEGE_NAME))) { + /*check internet feature*/ + if (!_check_network_availability()) { + ret = PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; + LOGE("feature is not supportable."); + } + } + } + + return ret; +} + static void _prepare_async_cb(void *user_data) { muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_PREPARE; @@ -673,7 +822,6 @@ static void _set_media_stream_video_buffer_cb_ex(player_h player, void *data, bo player_msg_return(api, ret, module); } - static void (*set_callback_func[MUSE_PLAYER_EVENT_TYPE_NUM])(player_h player, void *user_data, bool set) = { NULL, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */ _set_completed_cb, /* MUSE_PLAYER_EVENT_TYPE_COMPLETE */ @@ -1004,16 +1152,19 @@ int player_disp_set_uri(muse_module_h module) muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); player_msg_get_string(path, muse_core_client_get_msg(module)); - ret = legacy_player_set_uri(muse_player->player_handle, path); - player_msg_return(api, ret, module); + if ((ret = _check_supportable(module, path)) == PLAYER_ERROR_NONE) + ret = legacy_player_set_uri(muse_player->player_handle, path); - const char* file_buffering_path = muse_core_client_get_temporal_path(); + player_msg_return(api, ret, module); - LOGD("file buffering path : %s", file_buffering_path); - if (file_buffering_path) - legacy_player_set_file_buffering_path(muse_player->player_handle, file_buffering_path); + if (ret == PLAYER_ERROR_NONE) { + const char* file_buffering_path = muse_core_client_get_temporal_path(); + LOGD("file buffering path : %s", file_buffering_path); + if (file_buffering_path) + legacy_player_set_file_buffering_path(muse_player->player_handle, file_buffering_path); + } return ret; } @@ -1101,13 +1252,11 @@ int player_disp_set_memory_buffer(muse_module_h module) * it will be released at player_disp_deinit_memory_buffer() */ close(tfd); - muse_core_ipc_set_fd(module, INVALID_DEFAULT_VALUE); return ret; ERROR: if (tfd > INVALID_DEFAULT_VALUE) close(tfd); - muse_core_ipc_set_fd(module, INVALID_DEFAULT_VALUE); if (bo) tbm_bo_unref(bo); @@ -1850,9 +1999,10 @@ int player_disp_set_progressive_download_path(muse_module_h module) muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); player_msg_get_string(dw_path, muse_core_client_get_msg(module)); - ret = legacy_player_set_progressive_download_path(muse_player->player_handle, dw_path); - player_msg_return(api, ret, module); + if ((ret = _check_supportable(module, dw_path)) == PLAYER_ERROR_NONE) + ret = legacy_player_set_progressive_download_path(muse_player->player_handle, dw_path); + player_msg_return(api, ret, module); return ret; } @@ -1992,7 +2142,8 @@ int player_disp_set_subtitle_path(muse_module_h module) muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); player_msg_get_string(subtitle_path, muse_core_client_get_msg(module)); - ret = legacy_player_set_subtitle_path(muse_player->player_handle, subtitle_path); + if ((ret = _check_supportable(module, subtitle_path)) == PLAYER_ERROR_NONE) + ret = legacy_player_set_subtitle_path(muse_player->player_handle, subtitle_path); player_msg_return(api, ret, module); @@ -2082,7 +2233,6 @@ push_media_stream_exit2: push_media_stream_exit1: if (tfd > INVALID_DEFAULT_VALUE) close(tfd); - muse_core_ipc_set_fd(module, INVALID_DEFAULT_VALUE); if (jobj) muse_core_msg_json_object_free(jobj); diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 7390a4f..aded923 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.32 +Version: 0.2.33 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -26,6 +26,7 @@ BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(mm-session) BuildRequires: pkgconfig(eom) +BuildRequires: pkgconfig(libtzplatform-config) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig -- 2.7.4 From 14765d575d8669a8d76890e7edcb4fd6a58610f9 Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Wed, 2 Nov 2016 16:05:06 +0900 Subject: [PATCH 06/16] [v0.2.33] fix bug about setting subtitle_path to NULL Change-Id: I1c70735f434ab0338d4a84559719468a253d0d3d --- muse/src/muse_player.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index c024191..bf709df 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -2142,8 +2142,12 @@ int player_disp_set_subtitle_path(muse_module_h module) muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); player_msg_get_string(subtitle_path, muse_core_client_get_msg(module)); - if ((ret = _check_supportable(module, subtitle_path)) == PLAYER_ERROR_NONE) - ret = legacy_player_set_subtitle_path(muse_player->player_handle, subtitle_path); + if (strncmp(subtitle_path, "", 1)) { + if ((ret = _check_supportable(module, subtitle_path)) == PLAYER_ERROR_NONE) + ret = legacy_player_set_subtitle_path(muse_player->player_handle, subtitle_path); + } else { + ret = legacy_player_set_subtitle_path(muse_player->player_handle, NULL); + } player_msg_return(api, ret, module); -- 2.7.4 From 453e8a315cda4951baa52eea050ccedd94797671 Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Mon, 7 Nov 2016 11:09:31 +0900 Subject: [PATCH 07/16] [v0.2.33] fix bug Change-Id: I6e5eb4d04a91ffe1bd6823eecc0eb5c18612f3f8 --- muse/src/muse_player.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index bf709df..d22349d 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -1664,13 +1664,13 @@ int player_disp_is_display_visible(muse_module_h module) int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_IS_DISPLAY_VISIBLE; muse_player_handle_s *muse_player = NULL; - bool visible = 0; + bool value = 0; muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); - ret = legacy_player_is_display_visible(muse_player->player_handle, &visible); + ret = legacy_player_is_display_visible(muse_player->player_handle, &value); - player_msg_return1(api, ret, module, INT, visible); + player_msg_return1(api, ret, module, INT, value); return ret; } -- 2.7.4 From 6138fd88612e80b528d110ab3afcb689ebf73d75 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Tue, 8 Nov 2016 17:35:47 +0900 Subject: [PATCH 08/16] [v0.2.34] not to post error msg twice Change-Id: I630f03c0483d293792a6fc9df93a3a09381b3dc6 --- legacy/src/legacy_player.c | 13 +++++++------ packaging/mmsvc-player.spec | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index 8371eee..bf8b3e1 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -1205,12 +1205,13 @@ static void *__prepare_async_thread_func(void *data) ret = mm_player_pause(handle->mm_handle); if (ret != MM_ERROR_NONE) { LOGE("[%s] Failed to pause - core fw error(0x%x)", __FUNCTION__, ret); - /*MM_MESSAGE_ERROR will not be posted as legacy_player_prepare(sync API) works with return value - of mm_player_pause So in case of async API we post the error message to application from here */ - MMMessageParamType msg_param; - msg_param.code = ret; - __msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle); - + if (handle->error_code == PLAYER_ERROR_NONE) { + /*MM_MESSAGE_ERROR will not be posted as legacy_player_prepare(sync API) works with return value + of mm_player_pause So in case of async API we post the error message to application from here */ + MMMessageParamType msg_param; + msg_param.code = ret; + __msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle); + } ret = mm_player_unrealize(handle->mm_handle); if (ret != MM_ERROR_NONE) LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__, ret); diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 83af0e2..66822ad 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.33 +Version: 0.2.34 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From d22f2aa21b913efcc9f3e88bf375b42526a18667 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Tue, 8 Nov 2016 17:35:47 +0900 Subject: [PATCH 09/16] [v0.2.34] not to post error msg twice Change-Id: I630f03c0483d293792a6fc9df93a3a09381b3dc6 --- legacy/src/legacy_player.c | 13 +++++++------ packaging/mmsvc-player.spec | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index 8371eee..bf8b3e1 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -1205,12 +1205,13 @@ static void *__prepare_async_thread_func(void *data) ret = mm_player_pause(handle->mm_handle); if (ret != MM_ERROR_NONE) { LOGE("[%s] Failed to pause - core fw error(0x%x)", __FUNCTION__, ret); - /*MM_MESSAGE_ERROR will not be posted as legacy_player_prepare(sync API) works with return value - of mm_player_pause So in case of async API we post the error message to application from here */ - MMMessageParamType msg_param; - msg_param.code = ret; - __msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle); - + if (handle->error_code == PLAYER_ERROR_NONE) { + /*MM_MESSAGE_ERROR will not be posted as legacy_player_prepare(sync API) works with return value + of mm_player_pause So in case of async API we post the error message to application from here */ + MMMessageParamType msg_param; + msg_param.code = ret; + __msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle); + } ret = mm_player_unrealize(handle->mm_handle); if (ret != MM_ERROR_NONE) LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__, ret); diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 83af0e2..66822ad 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.33 +Version: 0.2.34 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 9a232c963c110e860a122c9f8a95c0adb7863693 Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Wed, 9 Nov 2016 17:37:58 +0900 Subject: [PATCH 10/16] [v0.2.34] fix format for converting correctly to tbm Change-Id: I005d61b55a6716b02b9423028eebe1b6030033df --- legacy/src/legacy_player.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index bf8b3e1..238ee87 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -312,7 +312,7 @@ int _player_get_tbm_surface_format(int in_format, uint32_t *out_format) *out_format = TBM_FORMAT_RGB888; break; case MM_PIXEL_FORMAT_RGBA: - *out_format = TBM_FORMAT_RGBA8888; + *out_format = TBM_FORMAT_XRGB8888; break; case MM_PIXEL_FORMAT_ARGB: *out_format = TBM_FORMAT_ARGB8888; @@ -412,7 +412,7 @@ int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user if (tsurf) { if (tbm_surface_get_format(tsurf) == TBM_FORMAT_YUV420 || - tbm_surface_get_format(tsurf) == TBM_FORMAT_RGBA8888) { + tbm_surface_get_format(tsurf) == TBM_FORMAT_XRGB8888) { #define NUM_OF_SW_CODEC_BO 1 int bo_num = 0; tbm_bo bo = NULL; -- 2.7.4 From 08fa20d220fc2e1fb5c052fb9c3d7f40f479841f Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Thu, 10 Nov 2016 10:42:32 +0900 Subject: [PATCH 11/16] [v0.2.34] fix format for converting correctly to tbm Change-Id: I5a3908af62ece4c121ac6781d5caa1557daca873 --- legacy/src/legacy_player.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index 238ee87..f783ab7 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -312,7 +312,7 @@ int _player_get_tbm_surface_format(int in_format, uint32_t *out_format) *out_format = TBM_FORMAT_RGB888; break; case MM_PIXEL_FORMAT_RGBA: - *out_format = TBM_FORMAT_XRGB8888; + *out_format = TBM_FORMAT_ARGB8888; break; case MM_PIXEL_FORMAT_ARGB: *out_format = TBM_FORMAT_ARGB8888; @@ -412,7 +412,7 @@ int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user if (tsurf) { if (tbm_surface_get_format(tsurf) == TBM_FORMAT_YUV420 || - tbm_surface_get_format(tsurf) == TBM_FORMAT_XRGB8888) { + tbm_surface_get_format(tsurf) == TBM_FORMAT_ARGB8888) { #define NUM_OF_SW_CODEC_BO 1 int bo_num = 0; tbm_bo bo = NULL; -- 2.7.4 From 57cfd7a984dcd8eeab3ee9f7db4d95b1add346cc Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Fri, 11 Nov 2016 16:54:05 +0900 Subject: [PATCH 12/16] [v0.2.34] enable evas surface on tv platform Change-Id: I3da18a3914d56320ef6947982371eb3f0105d8bb --- packaging/mmsvc-player.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 66822ad..07581a2 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -56,7 +56,7 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" export CFLAGS+=" -DTIZEN_FEATURE_ASM" MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ -%if "%{?profile}" == "tv" +%if "%{TIZEN_PRODUCT_TV}" == "1" -DTIZEN_FEATURE_EVAS_RENDERER=Off %else -DTIZEN_FEATURE_EVAS_RENDERER=On -- 2.7.4 From 7adafcd524f62d90397a88d208048eda5f5bc8cf Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Mon, 14 Nov 2016 14:35:25 +0900 Subject: [PATCH 13/16] [v0.2.35] remove fixed val of lang cond len, fix feature check condition Change-Id: If72d051b3b595aafa7fed20040fcb2fc84038a30 Signed-off-by: Eunhae Choi --- legacy/include/legacy_player.h | 3 ++- legacy/src/legacy_player.c | 4 +++- legacy/test/legacy_player_test.c | 4 +++- muse/src/muse_player.c | 6 +++--- packaging/mmsvc-player.spec | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/legacy/include/legacy_player.h b/legacy/include/legacy_player.h index 330175b..fc91c4e 100644 --- a/legacy/include/legacy_player.h +++ b/legacy/include/legacy_player.h @@ -1923,6 +1923,7 @@ int legacy_player_get_current_track(player_h player, player_stream_type_e type, * @param[in] type The type of target stream * @param[in] index The index of track * @param[out] code A language code in ISO 639-1. "und" will be returned if the language is undefined. + * @param[out] len length of language code. * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful @@ -1932,7 +1933,7 @@ int legacy_player_get_current_track(player_h player, player_stream_type_e type, * @retval #PLAYER_ERROR_NOT_SUPPORTD Not supported * @pre The player state must be one of these: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED */ -int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code); +int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code, int *len); /** * @brief Gets the track count. diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index f783ab7..8d982b5 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -3044,10 +3044,11 @@ int legacy_player_select_track(player_h player, player_stream_type_e type, int i return PLAYER_ERROR_NONE; } -int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code) +int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code, int *len) { PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(code); + PLAYER_NULL_ARG_CHECK(len); player_s *handle = (player_s *)player; if (!__player_state_validate(handle, PLAYER_STATE_READY)) { LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state); @@ -3088,6 +3089,7 @@ int legacy_player_get_track_language_code(player_h player, player_stream_type_e code_len = 3; *code = strndup("und", code_len); } + *len = code_len; if (language_code) free(language_code); diff --git a/legacy/test/legacy_player_test.c b/legacy/test/legacy_player_test.c index a961496..d3a8af0 100644 --- a/legacy/test/legacy_player_test.c +++ b/legacy/test/legacy_player_test.c @@ -1205,11 +1205,13 @@ static void input_subtitle_filename(char *subtitle_filename) static void switch_subtitle(int index) { + int len = 0; char *lang_code = NULL; + if (legacy_player_select_track(g_player[0], PLAYER_STREAM_TYPE_TEXT, index) != PLAYER_ERROR_NONE) g_print("legacy_player_select_track failed\n"); - if (legacy_player_get_track_language_code(g_player[0], PLAYER_STREAM_TYPE_TEXT, index, &lang_code) == PLAYER_ERROR_NONE) { + if (legacy_player_get_track_language_code(g_player[0], PLAYER_STREAM_TYPE_TEXT, index, &lang_code, &len) == PLAYER_ERROR_NONE) { g_print("selected track code %s\n", lang_code); free(lang_code); } diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index d22349d..3fd69fe 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -350,7 +350,7 @@ static int _check_supportable(muse_module_h module, char *path) ret = PLAYER_ERROR_PERMISSION_DENIED; LOGE("security check failed %s", privilege); } else { - if (strncmp(privilege, INTERNET_PRIVILEGE_NAME, strlen(INTERNET_PRIVILEGE_NAME))) { + if (strncmp(privilege, INTERNET_PRIVILEGE_NAME, strlen(INTERNET_PRIVILEGE_NAME)) == 0) { /*check internet feature*/ if (!_check_network_availability()) { ret = PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; @@ -2526,13 +2526,13 @@ int player_disp_get_track_language_code(muse_module_h module) player_stream_type_e type = PLAYER_STREAM_TYPE_DEFAULT; int index = 0; char *code = NULL; - const int code_len = 2; + int code_len = 0; bool ret_val = TRUE; player_msg_get2(muse_core_client_get_msg(module), type, INT, index, INT, ret_val); if (ret_val) { muse_player = (muse_player_handle_s *)muse_core_ipc_get_handle(module); - ret = legacy_player_get_track_language_code(muse_player->player_handle, type, index, &code); + ret = legacy_player_get_track_language_code(muse_player->player_handle, type, index, &code, &code_len); } else { ret = PLAYER_ERROR_INVALID_OPERATION; } diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 07581a2..423dd9b 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.34 +Version: 0.2.35 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 9dda9cb122a1260c65e247f3fd9967e694c40b1b Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Tue, 15 Nov 2016 14:30:11 +0900 Subject: [PATCH 14/16] [v0.2.36] add path condition to check user media storage privilege Change-Id: I6e1d29624a5eedca4e8b9217e9041be0f94daa93 --- muse/src/muse_player.c | 17 ++++++++++++----- packaging/mmsvc-player.spec | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/muse/src/muse_player.c b/muse/src/muse_player.c index 3fd69fe..6e5cd87 100644 --- a/muse/src/muse_player.c +++ b/muse/src/muse_player.c @@ -35,7 +35,9 @@ #define INVALID_DEFAULT_VALUE -1 -#define MEDIA_PATH_EXTERNAL tzplatform_getenv(TZ_SYS_STORAGE) /* external storage */ +#define MEDIA_PATH_EXTERNAL tzplatform_getenv(TZ_SYS_STORAGE) /* external storage, or TZ_SYS_MEDIA */ +#define MEDIA_PATH_USER tzplatform_getenv(TZ_USER_CONTENT) /* user media storage */ + #define MEDIA_STORAGE_PRIVILEGE_NAME "http://tizen.org/privilege/mediastorage" #define EXTERNAL_STORAGE_PRIVILEGE_NAME "http://tizen.org/privilege/externalstorage" #define INTERNET_PRIVILEGE_NAME "http://tizen.org/privilege/internet" @@ -340,12 +342,17 @@ static int _check_supportable(muse_module_h module, char *path) file_path = path+7; /* remove file prefix */ } - if (strncmp(file_path, MEDIA_PATH_EXTERNAL, strlen(MEDIA_PATH_EXTERNAL)) == 0) - privilege = EXTERNAL_STORAGE_PRIVILEGE_NAME; - else - privilege = MEDIA_STORAGE_PRIVILEGE_NAME; + if (!privilege) { + if (strncmp(file_path, MEDIA_PATH_EXTERNAL, strlen(MEDIA_PATH_EXTERNAL)) == 0) + privilege = EXTERNAL_STORAGE_PRIVILEGE_NAME; + else if (strncmp(file_path, MEDIA_PATH_USER, strlen(MEDIA_PATH_USER)) == 0) + privilege = MEDIA_STORAGE_PRIVILEGE_NAME; + else + return PLAYER_ERROR_NONE; + } } + LOGD("privilege check : %s", privilege); if (!muse_core_security_check_cynara(client_fd, privilege)) { ret = PLAYER_ERROR_PERMISSION_DENIED; LOGE("security check failed %s", privilege); diff --git a/packaging/mmsvc-player.spec b/packaging/mmsvc-player.spec index 423dd9b..92757f9 100644 --- a/packaging/mmsvc-player.spec +++ b/packaging/mmsvc-player.spec @@ -1,6 +1,6 @@ Name: mmsvc-player Summary: A Media Player module for muse server -Version: 0.2.35 +Version: 0.2.36 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From e04d745cef9d3042e502bd2781c1be7e4435f057 Mon Sep 17 00:00:00 2001 From: Hyongtaek Lim Date: Tue, 15 Nov 2016 15:02:02 +0900 Subject: [PATCH 15/16] Move the is_doing_jobs flag in USE_ECORE_FUNCTIONS Change-Id: I623f9644aac69d6dc0cf0931df041faba64e5ee7 Signed-off-by: Hyongtaek Lim (cherry picked from commit 788ccd974df36d644c05ad39998f6aa256da1678) --- legacy/include/legacy_player_private.h | 2 +- legacy/src/legacy_player.c | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/legacy/include/legacy_player_private.h b/legacy/include/legacy_player_private.h index 253f385..40895bc 100644 --- a/legacy/include/legacy_player_private.h +++ b/legacy/include/legacy_player_private.h @@ -89,6 +89,7 @@ typedef struct _player_s{ pthread_t prepare_async_thread; #ifdef USE_ECORE_FUNCTIONS GHashTable *ecore_jobs; + bool is_doing_jobs; #else pthread_t message_thread; GQueue *message_queue; @@ -97,7 +98,6 @@ typedef struct _player_s{ int current_message; #endif player_error_e error_code; - bool is_doing_jobs; media_format_h pkt_fmt; } player_s; diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index 8d982b5..d916282 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -573,12 +573,10 @@ static void __message_cb_loop(void *data) { LOGW("PLAYER_MESSAGE_PREPARED"); if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) { - handle->is_doing_jobs = TRUE; handle->state = PLAYER_STATE_READY; ((player_prepared_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]); handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL; handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL; - handle->is_doing_jobs = FALSE; } else { LOGE("null handle in PLAYER_MESSAGE_PREPARED"); } @@ -588,9 +586,7 @@ static void __message_cb_loop(void *data) { LOGW("PLAYER_MESSAGE_ERROR"); if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR]) { - handle->is_doing_jobs = TRUE; ((player_error_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_ERROR])(handle->error_code, handle->user_data[MUSE_PLAYER_EVENT_TYPE_ERROR]); - handle->is_doing_jobs = FALSE; } else { LOGE("null handle in PLAYER_MESSAGE_ERROR"); } @@ -600,11 +596,9 @@ static void __message_cb_loop(void *data) { LOGW("PLAYER_MESSAGE_SEEK_DONE"); if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) { - handle->is_doing_jobs = TRUE; ((player_seek_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK]); handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL; handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL; - handle->is_doing_jobs = FALSE; } else { LOGE("null handle in PLAYER_MESSAGE_SEEK_DONE"); } @@ -614,9 +608,7 @@ static void __message_cb_loop(void *data) { LOGW("PLAYER_MESSAGE_EOS"); if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE]) { - handle->is_doing_jobs = TRUE; ((player_completed_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_COMPLETE]); - handle->is_doing_jobs = FALSE; } else { LOGE("null handle in PLAYER_MESSAGE_EOS"); } @@ -1147,11 +1139,11 @@ int legacy_player_destroy(player_h player) PLAYER_TRACE_BEGIN("MM:PLAYER:DESTROY"); PLAYER_INSTANCE_CHECK(player); player_s *handle = (player_s *)player; +#ifdef USE_ECORE_FUNCTIONS if (handle->is_doing_jobs) { LOGE("jobs not completed. can't do destroy"); return PLAYER_ERROR_INVALID_OPERATION; } -#ifdef USE_ECORE_FUNCTIONS g_hash_table_remove_all(handle->ecore_jobs); g_hash_table_unref(handle->ecore_jobs); handle->ecore_jobs = NULL; -- 2.7.4 From 6015b10aef2edfe5c97675ede953ecd2ff2b38b4 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Fri, 25 Nov 2016 18:31:41 +0900 Subject: [PATCH 16/16] [v0.2.36] modify about evas renderer feature option Change-Id: Ic3f775537278c4abca85e6c3c7f6b78cd8e9c4e0 Signed-off-by: Eunhae Choi --- legacy/include/legacy_player.h | 2 -- legacy/src/legacy_player.c | 23 +++++------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/legacy/include/legacy_player.h b/legacy/include/legacy_player.h index fc91c4e..e8bb0b7 100644 --- a/legacy/include/legacy_player.h +++ b/legacy/include/legacy_player.h @@ -117,9 +117,7 @@ typedef enum { */ typedef enum { PLAYER_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ -#ifdef TIZEN_FEATURE_EVAS_RENDERER PLAYER_DISPLAY_TYPE_EVAS, /**< Evas image object surface display */ -#endif PLAYER_DISPLAY_TYPE_NONE, /**< This disposes off buffers */ } player_display_type_e; diff --git a/legacy/src/legacy_player.c b/legacy/src/legacy_player.c index d916282..ebbd66a 100644 --- a/legacy/src/legacy_player.c +++ b/legacy/src/legacy_player.c @@ -1074,12 +1074,11 @@ static MMDisplaySurfaceType __player_convet_display_type(player_display_type_e t switch (type) { case PLAYER_DISPLAY_TYPE_OVERLAY: return MM_DISPLAY_SURFACE_OVERLAY; + case PLAYER_DISPLAY_TYPE_EVAS: /* fall through ifndef TIZEN_FEATURE_EVAS_RENDERER */ #ifdef TIZEN_FEATURE_EVAS_RENDERER - case PLAYER_DISPLAY_TYPE_EVAS: return MM_DISPLAY_SURFACE_REMOTE; #endif - case PLAYER_DISPLAY_TYPE_NONE: - return MM_DISPLAY_SURFACE_NULL; + case PLAYER_DISPLAY_TYPE_NONE: /* fall through */ default: return MM_DISPLAY_SURFACE_NULL; } @@ -1585,15 +1584,8 @@ int legacy_player_start(player_h player) player_s *handle = (player_s *)player; int ret; if (handle->state == PLAYER_STATE_READY || handle->state == PLAYER_STATE_PAUSED) { - if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY -#ifdef TIZEN_FEATURE_EVAS_RENDERER - || handle->display_type == PLAYER_DISPLAY_TYPE_EVAS -#endif - ) { - - if (handle->is_display_visible) - ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 1, (char *)NULL); - } + if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY && handle->is_display_visible) + ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 1, (char *)NULL); if (handle->is_stopped) { if (handle->is_progressive_download) { @@ -1632,13 +1624,8 @@ int legacy_player_stop(player_h player) if (handle->state == PLAYER_STATE_PLAYING || handle->state == PLAYER_STATE_PAUSED) { int ret = mm_player_stop(handle->mm_handle); - if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY -#ifdef TIZEN_FEATURE_EVAS_RENDERER - || handle->display_type == PLAYER_DISPLAY_TYPE_EVAS -#endif - ) { + if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY) ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 0, (char *)NULL); - } if (ret != MM_ERROR_NONE) { return __player_convert_error_code(ret, (char *)__FUNCTION__); -- 2.7.4