Add network.ethernet key to check network feature in emulator 99/43399/2
authorHyunil Park <hyunil46.park@samsung.com>
Thu, 9 Jul 2015 01:28:25 +0000 (10:28 +0900)
committerHeechul Jeon <heechul.jeon@samsung.com>
Thu, 9 Jul 2015 05:55:25 +0000 (22:55 -0700)
Change-Id: I434f216c9bfa7bda58596cf041c989d86e0f716c
Signed-off-by: Hyunil Park <hyunil46.park@samsung.com>
include/player_private.h
packaging/capi-media-player.spec
src/player.c

index db01284..eee43ac 100755 (executable)
@@ -60,36 +60,6 @@ extern "C" {
 #define PLAYER_TRACE_ASYNC_END(NAME, KEY)
 #endif
 
-#define PLAYER_NETWORK_AVAILABLE_CHECK() \
-do \
-{ \
-       bool enabled = FALSE; \
-       bool supported = FALSE; \
-       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool("http://tizen.org/feature/network.wifi", &enabled)) \
-       { \
-               LOGI("[%s] wifi status = %d", __FUNCTION__, enabled); \
-               if (enabled) supported = TRUE; \
-       } \
-       else \
-       { \
-               LOGE("[%s] SYSTEM_INFO_ERROR", __FUNCTION__); \
-       } \
-       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool("http://tizen.org/feature/network.telephony", &enabled)) \
-       { \
-               LOGI("[%s] telephony status = %d", __FUNCTION__, enabled); \
-               if (enabled) supported = TRUE; \
-       } \
-       else \
-       { \
-               LOGE("[%s] SYSTEM_INFO_ERROR", __FUNCTION__); \
-       } \
-       if (!supported) \
-       { \
-               LOGE("[%s] PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE", __FUNCTION__); \
-               return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; \
-       } \
-} while (0)
-
 typedef enum {
        _PLAYER_EVENT_TYPE_PREPARE,
        _PLAYER_EVENT_TYPE_COMPLETE,
index c247978..a0a2260 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:       capi-media-player
 Summary:    A Media Player library in Tizen Native API
-Version:    0.2.3
+Version:    0.2.4
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 8c8b23d..2190672 100644 (file)
@@ -407,6 +407,49 @@ 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;
@@ -465,9 +508,13 @@ static int __set_callback(_player_event_e type, player_h player, void* callback,
 {
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(callback);
-       player_s * handle = (player_s *) player;
        if (_PLAYER_EVENT_TYPE_BUFFERING == type)
-               PLAYER_NETWORK_AVAILABLE_CHECK();
+       {
+               if (!_player_network_availability_check())
+               return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
+       }
+
+       player_s * handle = (player_s *) player;
        handle->user_cb[type] = callback;
        handle->user_data[type] = user_data;
        LOGI("[%s] Event type : %d ",__FUNCTION__, type);
@@ -2522,7 +2569,9 @@ int player_set_progressive_download_path(player_h player, const char *path)
 {
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(path);
-       PLAYER_NETWORK_AVAILABLE_CHECK();
+       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);
 
@@ -2725,9 +2774,11 @@ int player_set_progressive_download_message_cb(player_h player, player_pd_messag
 {
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(callback);
-       PLAYER_NETWORK_AVAILABLE_CHECK();
+       if (!_player_network_availability_check())
+               return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
 
        player_s * handle = (player_s *) player;
+
        if (handle->state != PLAYER_STATE_IDLE  &&  handle->state != PLAYER_STATE_READY)
        {
                LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);