[ACR-874] Support Old Apps with Mismatched Enums 05/111705/4
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 23 Jan 2017 12:46:17 +0000 (21:46 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 1 Feb 2017 01:44:55 +0000 (10:44 +0900)
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 <myungjoo.ham@samsung.com>
include/player.h
src/player.c

index e2bbc74d421b375278d04c57da267f5a367c6520..eb9f066747339cc473c9a52e91686f828b8bf345 100644 (file)
@@ -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;
 
 /**
index 95bbf82bd5a7253513113f213402d238180f4efd..0556f89c8b50f6e152109ab5ba7cbb1440120501 100644 (file)
 #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)