From b226f949c61c17925a610a8d4963e3e9eb963f66 Mon Sep 17 00:00:00 2001 From: Hyunil Date: Wed, 24 Aug 2016 18:14:57 +0900 Subject: [PATCH] 1. Remove set render rectangle for setting window rectangle 2. resize window callback waylandsink can set window rectangle automatically. Change-Id: Icce8fe4756c583177e04321a5eda53bd348aac65 Signed-off-by: Hyunil --- include/player_display.h | 4 -- packaging/capi-media-player.spec | 2 +- src/player.c | 16 ++---- src/player_display.c | 105 --------------------------------------- 4 files changed, 6 insertions(+), 121 deletions(-) diff --git a/include/player_display.h b/include/player_display.h index ad55ce5..8cc546c 100644 --- a/include/player_display.h +++ b/include/player_display.h @@ -38,10 +38,6 @@ typedef struct { int _wl_client_create(wl_client ** wlclient); int _wl_client_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display); void _wl_client_finalize(wl_client * wlclient); -int _wl_window_geometry_get(Evas_Object *eo, Evas *e, int *x, int *y, int *width, int *height); -int _wl_window_evas_object_cb_add(player_h player, Evas_Object *eo); -int _wl_window_evas_object_cb_del(player_h player); - #ifdef __cplusplus } #endif diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index a232a69..0ede44e 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.15 +Version: 0.3.16 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index a1877dc..6d75185 100644 --- a/src/player.c +++ b/src/player.c @@ -1486,9 +1486,6 @@ int player_destroy(player_h player) } #endif - if (_wl_window_evas_object_cb_del(player) != MM_ERROR_NONE) - LOGW("fail to unset evas object callback"); - if (CALLBACK_INFO(pc)) { __player_remove_tsurf_list(pc); _player_event_queue_destroy(CALLBACK_INFO(pc)); @@ -2081,6 +2078,11 @@ int player_set_display(player_h player, player_display_type_e type, player_displ struct wl_display *wl_display; Ecore_Wl_Window *wl_window = NULL; Evas *e; + /* init */ + wl_win.wl_window_x = 0; + wl_win.wl_window_y = 0; + wl_win.wl_window_width = 0; + wl_win.wl_window_height = 0; LOGD("ENTER type: %d", type); @@ -2099,14 +2101,10 @@ int player_set_display(player_h player, player_display_type_e type, player_displ e = evas_object_evas_get(obj); return_val_if_fail(e != NULL, PLAYER_ERROR_INVALID_OPERATION); - ret = _wl_window_geometry_get(obj, e, &wl_win.wl_window_x, &wl_win.wl_window_y, - &wl_win.wl_window_width, &wl_win.wl_window_height); if (ret != MM_ERROR_NONE) { LOGE("Fail to get window geometry"); return ret; } - if (_wl_window_evas_object_cb_add(player, obj) != MM_ERROR_NONE) - LOGW("fail to set evas object callback"); wl_window = elm_win_wl_window_get(obj); return_val_if_fail(wl_window != NULL, PLAYER_ERROR_INVALID_OPERATION); @@ -2166,10 +2164,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ } else { /* PLAYER_DISPLAY_TYPE_NONE */ LOGI("Wayland surface type is NONE"); wl_win.type = type; - wl_win.wl_window_x = 0; - wl_win.wl_window_y = 0; - wl_win.wl_window_width = 0; - wl_win.wl_window_height = 0; } player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char)); g_free(ret_buf); diff --git a/src/player_display.c b/src/player_display.c index 102d741..abc6084 100644 --- a/src/player_display.c +++ b/src/player_display.c @@ -143,108 +143,3 @@ void _wl_client_finalize(wl_client * wlclient) wl_registry_destroy(wlclient->registry); return; } - -static void __evas_resize_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) -{ - player_cli_s *pc = (player_cli_s *) data; - wl_win_msg_type wl_win; - char *wl_win_msg = (char *)&wl_win; - char *ret_buf = NULL; - muse_player_api_e api = MUSE_PLAYER_API_RESIZE_VIDEO_RENDER_RECT; - int ret = PLAYER_ERROR_NONE; - LOGD("ret =%d", ret); - - ret = _wl_window_geometry_get(eo, e, &wl_win.wl_window_x, &wl_win.wl_window_y, - &wl_win.wl_window_width, &wl_win.wl_window_height); - if (ret != PLAYER_ERROR_NONE) { - LOGE("Fail to get window geometry"); - return; - } - wl_win.type = 0; /*init but not use */ - wl_win.wl_surface_id = 0; /*init but not use */ - - player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char)); - - g_free(ret_buf); - return; - -} - -static void __evas_del_cb(void *data, Evas * e, Evas_Object * eo, void *event_info) -{ - - player_cli_s *pc = (player_cli_s *) data; - - evas_object_event_callback_del(eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); - evas_object_event_callback_del(eo, EVAS_CALLBACK_DEL, __evas_del_cb); - - LOGD("evas callback del %p", eo); - pc->have_evas_callback = FALSE; - - return; -} - -int _wl_window_geometry_get(Evas_Object *eo, Evas *e, int *x, int *y, int *width, int *height) -{ - Ecore_Evas *ecore_evas; - int rotation; - return_val_if_fail(eo != NULL || e != NULL || x != NULL || y != NULL || width != NULL || height != NULL, - PLAYER_ERROR_INVALID_OPERATION); - - evas_object_geometry_get(eo, x, y, width, height); - LOGD("get window geometroy : x(%d) y(%d) width(%d) height(%d)", *x, *y, *width, *height); - /* get rotaion */ - ecore_evas = ecore_evas_ecore_evas_get(e); - return_val_if_fail(ecore_evas != NULL, PLAYER_ERROR_INVALID_OPERATION); - rotation = ecore_evas_rotation_get(ecore_evas); - - LOGD("rotation(%d)", rotation); - /* swap */ - if (rotation == 270 || rotation == 90) { - LOGD("swap width with height"); - int temp; - temp = *width; - *width = *height; - *height = temp; - LOGD("get window geometroy : x(%d) y(%d) width(%d) height(%d)", *x, *y, *width, *height); - } - - return MM_ERROR_NONE; -} - -int _wl_window_evas_object_cb_add(player_h player, Evas_Object *eo) -{ - - PLAYER_INSTANCE_CHECK(player); - return_val_if_fail(eo != NULL, MM_ERROR_INVALID_ARGUMENT); - - player_cli_s *pc = (player_cli_s *) player; - - if (pc->have_evas_callback && pc->eo == eo) { - LOGW("evas object had callback already %p", pc->eo); - return MM_ERROR_UNKNOWN; - } - pc->eo = eo; - evas_object_event_callback_add(eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb, player); - evas_object_event_callback_add(eo, EVAS_CALLBACK_DEL, __evas_del_cb, player); - LOGD("evas callback add %p", pc->eo); - pc->have_evas_callback = TRUE; - - return MM_ERROR_NONE; -} - -int _wl_window_evas_object_cb_del(player_h player) -{ - PLAYER_INSTANCE_CHECK(player); - player_cli_s *pc = (player_cli_s *) player; - return_val_if_fail(pc->eo != NULL, MM_ERROR_INVALID_ARGUMENT); - - evas_object_event_callback_del(pc->eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); - evas_object_event_callback_del(pc->eo, EVAS_CALLBACK_DEL, __evas_del_cb); - LOGD("evas callback del %p", pc->eo); - pc->eo = NULL; - pc->have_evas_callback = FALSE; - - return MM_ERROR_NONE; -} - -- 2.7.4