Change attribute value type of display_overlay 26/209726/8
authorHyunil <hyunil46.park@samsung.com>
Wed, 10 Jul 2019 08:29:12 +0000 (17:29 +0900)
committerHyunil <hyunil46.park@samsung.com>
Thu, 11 Jul 2019 02:42:40 +0000 (11:42 +0900)
Change-Id: I1d73932f10311ce94624b3310985554ff9bc5254
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
legacy/include/legacy_player_private.h
legacy/src/legacy_player.c

index 867be3b..23cffe5 100644 (file)
@@ -83,7 +83,6 @@ typedef struct {
        void *user_data[MUSE_PLAYER_EVENT_TYPE_NUM];
        GMutex user_cb_lock[MUSE_PLAYER_EVENT_TYPE_NUM];
        void *wl_display;
-       void *display_handle;
        player_display_type_e display_type;
        player_state_e state;
        player_internal_state_e internal_state;
index 9baf87a..cb435ba 100644 (file)
@@ -2317,78 +2317,34 @@ int legacy_player_set_display(legacy_player_h player, player_display_type_e type
 {
        legacy_player_t *handle = (legacy_player_t *)player;
        int ret = MM_ERROR_NONE;
-       void *set_handle = NULL;
-       void *temp = NULL;
+       static const char * display_str[] = {"OVERLAY", "EVAS", "NONE"};
        MMDisplaySurfaceType surface_type = __lplayer_convert_display_type(type);
+
        PLAYER_INSTANCE_CHECK(player);
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
                return PLAYER_ERROR_INVALID_STATE;
        }
 
-       if (type == PLAYER_DISPLAY_TYPE_NONE) {
-               /* NULL surface */
-               handle->display_handle = 0;
-               handle->display_type = type;
-               set_handle = NULL;
-       } else {
-               /* get handle from overlay or evas surface */
-               temp = handle->display_handle;
+       LOGW("display type: current(%s), new(%s)", display_str[handle->display_type], display_str[type]);
+       if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE ||
+               handle->display_type == type) {
                if (type == PLAYER_DISPLAY_TYPE_OVERLAY) {
-                       LOGI("Wayland overlay surface type");
-                       LOGI("wl_surface_id %d", wl_surface_id);
-                       handle->display_handle = (void *)(uintptr_t)wl_surface_id;
-                       set_handle = &(handle->display_handle);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-               } else if (type == PLAYER_DISPLAY_TYPE_EVAS) {
-                       LOGI("Evas surface type");
-                       set_handle = &(handle->display_handle);
-#endif
-               } else {
-                       LOGE("invalid surface type");
-                       return PLAYER_ERROR_INVALID_PARAMETER;
-               }
-       }
-
-       /* set display handle */
-       if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE || type == handle->display_type) {
-               /* first time or same type */
-               LOGW("first time or same type");
-               ret = mm_player_set_attribute(handle->mm_handle, NULL,
-                                       "display_surface_type", surface_type, "display_overlay", set_handle, sizeof(wl_surface_id), NULL);
-
-               if (ret != MM_ERROR_NONE) {
-                       handle->display_handle = temp;
-                       LOGE("Failed to display surface change: %d", ret);
-               } else {
-                       if (type != PLAYER_DISPLAY_TYPE_NONE) {
-                               handle->display_type = type;
-                               LOGI("video display has been changed- type: %d, addr: %p", handle->display_type, handle->display_handle);
-                       } else {
-                               LOGI("NULL surface");
-                       }
+                       ret = mm_player_set_attribute(handle->mm_handle, NULL,
+                                               "display_surface_type", surface_type,
+                                               "display_overlay", (int)wl_surface_id, NULL);
                }
        } else {
-               /* changing surface case */
-               ret = mm_player_change_videosink(handle->mm_handle, surface_type, set_handle);
-               if (ret != MM_ERROR_NONE) {
-                       handle->display_handle = temp;
-                       if (ret == MM_ERROR_NOT_SUPPORT_API) {
-                               LOGE("change video sink is not available.");
-                               ret = PLAYER_ERROR_NONE;
-                       } else {
-                               LOGE("Failed to display surface change: %d", ret);
-                       }
-               } else {
-                       handle->display_type = type;
-                       LOGI("video display has been changed- type: %d, addr: %p", handle->display_type, handle->display_handle);
-               }
+               ret = mm_player_change_videosink(handle->mm_handle, surface_type, wl_surface_id);
        }
+       handle->display_type = type;
 
        if (ret != MM_ERROR_NONE) {
+               LOGE("Failed to display surface change: 0x%X, set type to none", ret);
                handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
        }
+       LOGI("Result display type: %s, wl_surface_id: %d", display_str[handle->display_type], wl_surface_id);
 
        return PLAYER_ERROR_NONE;
 }