Add new internal api for setting ecore wayland display 54/67054/1
authorHyunil <hyunil46.park@samsung.com>
Mon, 25 Apr 2016 02:21:28 +0000 (11:21 +0900)
committerHyunil <hyunil46.park@samsung.com>
Mon, 25 Apr 2016 02:21:28 +0000 (11:21 +0900)
Change-Id: I5554e86240d4410845a1f628ee775d8b87960277
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
include/common/player_internal.h
src/player.c
src/player_internal.c

index 7ecd169ffe75de9947ce4ed7f8be6304eb0aa6e5..0a9007298f2f28c4f8704668819ef2398481e305 100644 (file)
@@ -20,6 +20,9 @@
 #ifdef TIZEN_TV
 #include <glib.h>
 #endif
+#ifdef HAVE_WAYLAND
+#include <Ecore_Wayland.h>
+#endif
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -379,6 +382,31 @@ int player_set_display_parent_win_id(player_h player, int win_id);
 
 #endif
 
+#ifdef HAVE_WAYLAND
+/**
+ * @brief Sets the ecore wayland video display.
+ * @since_tizen 3.0
+ * @remarks This API support PLAYER_DISPLAY_TYPE_OVERLAY type only.
+ * @param[in]   player The handle to the media player
+ * @param[in]   type The display type
+ * @param[in]   ecore_wl_window The ecore wayland window handle
+ * @param[in]   x the x coordinate of window
+ * @param[in]   y the y coordinate of window
+ * @param[in]   width the width of window
+ * @param[in]   height the height of window
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
+ * @see player_set_display_rotation
+ */
+int player_set_ecore_wl_display(player_h player, player_display_type_e type, Ecore_Wl_Window *ecore_wl_window, int x, int y, int  width, int height);
+
+#endif
+
 /**
  * @}
  */
index aba0b271f70317cc87a9d1ed4b9ba71fc2b9ab28..c640c4810251adbca3bd3bd1c8236e9bde54661f 100644 (file)
@@ -1775,6 +1775,9 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                                        LOGD("wl_surface_id = %d", wl_surface_id);
                                        wl_win.wl_surface_id = wl_surface_id;
                                        LOGD("wl_win.wl_surface_id = %d", wl_win.wl_surface_id);
+                               } else {
+                                       LOGE("Fail to get wl_surface or wl_display");
+                                       return PLAYER_ERROR_INVALID_OPERATION;
                                }
                                if (pc->wlclient) {
                                        g_free(pc->wlclient);
index dec427ce0fc3b33dd8b13975fdf1a08891ca3930..fd88744f76e35aff8ca75b84efdaba0ec8c03093 100644 (file)
@@ -254,3 +254,75 @@ int player_unset_evas_object_cb(player_h player)
 
        return MM_ERROR_NONE;
 }
+
+#ifdef HAVE_WAYLAND
+int player_set_ecore_wl_display(player_h player, player_display_type_e type, Ecore_Wl_Window *ecore_wl_window, int x, int y, int  width, int height)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY;
+       player_cli_s *pc = (player_cli_s *) player;
+       char *ret_buf = NULL;
+       wl_win_msg_type wl_win;
+       char *wl_win_msg = (char *)&wl_win;
+       unsigned int wl_surface_id;
+       struct wl_surface *wl_surface;
+       struct wl_display *wl_display;
+       Ecore_Wl_Window *wl_window = NULL;
+
+       LOGD("ENTER");
+       if (type !=PLAYER_DISPLAY_TYPE_OVERLAY) {
+               LOGE("Display type(%d) is not overlay", type);
+               return PLAYER_ERROR_INVALID_PARAMETER;
+       }
+       if (!ecore_wl_window)
+               return PLAYER_ERROR_INVALID_PARAMETER;
+
+       LOGI("Wayland overlay surface type");
+       LOGD("Ecore Wayland Window handle(%p), size (%d, %d, %d, %d)", ecore_wl_window, x, y, width, height);
+       wl_window = ecore_wl_window;
+
+       /* set wl_win */
+       wl_win.type = type;
+       wl_win.wl_window_x = x;
+       wl_win.wl_window_y = y;
+       wl_win.wl_window_width = width;
+       wl_win.wl_window_height = height;
+
+       wl_surface = (struct wl_surface *)ecore_wl_window_surface_get(wl_window);
+       /* get wl_display */
+       wl_display = (struct wl_display *)ecore_wl_display_get();
+
+       if (!pc->wlclient) {
+               ret = _wlclient_create(&pc->wlclient);
+               if (ret != MM_ERROR_NONE) {
+                       LOGE("Wayland client create failure");
+                       return ret;
+               }
+       }
+
+       if (wl_surface && wl_display) {
+               LOGD("surface = %p, wl_display = %p", wl_surface, wl_display);
+               wl_surface_id = _wlclient_get_wl_window_wl_surface_id(pc->wlclient, wl_surface, wl_display);
+               LOGD("wl_surface_id = %d", wl_surface_id);
+               wl_win.wl_surface_id = wl_surface_id;
+               LOGD("wl_win.wl_surface_id = %d", wl_win.wl_surface_id);
+       } else {
+               LOGE("Fail to get wl_surface or wl_display");
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
+
+       if (pc->wlclient) {
+               g_free(pc->wlclient);
+               pc->wlclient = NULL;
+       }
+
+       player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
+
+       g_free(ret_buf);
+
+       return ret;
+}
+
+#endif
+