{
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;
}