From: MyungJoo Ham Date: Mon, 23 Jan 2017 12:46:17 +0000 (+0900) Subject: [ACR-874] Support Old Apps with Mismatched Enums X-Git-Tag: submit/tizen/20170210.083202^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=006bfe52966343e974f665f2ea85f05ec62de45e;p=platform%2Fcore%2Fapi%2Fplayer.git [ACR-874] Support Old Apps with Mismatched Enums In order to unify enum values across profiles, which were inconsistent until Tizen 3.0, we have improvised enum symbols. Change-Id: I1f7acb3899f608057bdc574403a79042e36485b5 Signed-off-by: MyungJoo Ham --- diff --git a/include/player.h b/include/player.h index e2bbc74..eb9f066 100644 --- a/include/player.h +++ b/include/player.h @@ -116,9 +116,21 @@ typedef enum { * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif */ typedef enum { - PLAYER_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ - PLAYER_DISPLAY_TYPE_EVAS, /**< Evas image object surface display */ - PLAYER_DISPLAY_TYPE_NONE, /**< This disposes off buffers */ + PLAYER_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ + PLAYER_DISPLAY_TYPE_OBSOLETE_EVAS_WNONE = 1, + /**< Obsolete. Acts as #PLAYER_DISPLAY_TYPE_NONE on Wearable, + #PLAYER_DISPLAY_TYPE_EVAS in all other cases. + This symbol was added for backward compatibility reasons. + It should not be used. (Deprecated since 4.0) */ + + PLAYER_DISPLAY_TYPE_OBSOLETE_NONE_WEVAS = 2, + /**< Obsolete. Acts as #PLAYER_DISPLAY_TYPE_EVAS on Wearable 3.0 and later, + #PLAYER_DISPLAY_TYPE_NONE in all other cases. + This symbol was added for backward compatibility reasons. + It should not be used. (Deprecated since 4.0) */ + + PLAYER_DISPLAY_TYPE_EVAS = 3, /**< Evas image object surface display (Since 4.0) */ + PLAYER_DISPLAY_TYPE_NONE = 4, /**< This disposes of buffers (Since 4.0) */ } player_display_type_e; /** diff --git a/src/player.c b/src/player.c index 95bbf82..0556f89 100644 --- a/src/player.c +++ b/src/player.c @@ -49,6 +49,47 @@ #define INVALID_DEFAULT_VALUE -1 #define MAX_S_PATH_LEN 32 +typedef enum { + TIZEN_PROFILE_UNKNOWN = 0, + TIZEN_PROFILE_MOBILE = 0x1, + TIZEN_PROFILE_WEARABLE = 0x2, + TIZEN_PROFILE_TV = 0x4, + TIZEN_PROFILE_IVI = 0x8, + TIZEN_PROFILE_COMMON = 0x10, +} tizen_profile_t; +static tizen_profile_t _get_tizen_profile() +{ + char *profileName; + static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN; + + if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1)) + return profile; + + system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); + switch (*profileName) { + case 'm': + case 'M': + profile = TIZEN_PROFILE_MOBILE; + break; + case 'w': + case 'W': + profile = TIZEN_PROFILE_WEARABLE; + break; + case 't': + case 'T': + profile = TIZEN_PROFILE_TV; + break; + case 'i': + case 'I': + profile = TIZEN_PROFILE_IVI; + break; + default: // common or unknown ==> ALL ARE COMMON. + profile = TIZEN_PROFILE_COMMON; + } + free(profileName); + + return profile; +} typedef struct { tbm_fd tfd[MUSE_NUM_FD]; @@ -2462,6 +2503,18 @@ int _player_convert_display_type(player_display_type_e type, player_private_disp case PLAYER_DISPLAY_TYPE_OVERLAY: *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY; break; + case PLAYER_DISPLAY_TYPE_OBSOLETE_EVAS_WNONE: + if (_get_tizen_profile() == TIZEN_PROFILE_WEARABLE) + *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE; + else + *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS; + break; + case PLAYER_DISPLAY_TYPE_OBSOLETE_NONE_WEVAS: + if (_get_tizen_profile() == TIZEN_PROFILE_WEARABLE) + *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS; + else + *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE; + break; case PLAYER_DISPLAY_TYPE_EVAS: *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS; break; @@ -2502,6 +2555,10 @@ int player_set_display(player_h player, player_display_type_e type, player_displ wl_win.wl_window_height = 0; LOGD("ENTER type: %d", type); + if (type == PLAYER_DISPLAY_TYPE_OBSOLETE_EVAS_WNONE || + type == PLAYER_DISPLAY_TYPE_OBSOLETE_NONE_WEVAS) { + LOGW("DEPRECATION WARNING: display type(%d) is deprecated and will be removed from next release. Use newly defined type value instead.", type); + } ret = _player_convert_display_type(type, &conv_type); if (ret != PLAYER_ERROR_NONE)