From 321cbb17e9be81f790ee48be7a3f5a5f23d4c0c1 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 21 Oct 2011 15:00:41 +0000 Subject: [PATCH] emotion: disable direct rendering path if window manager doesn't handle it. SVN revision: 64256 --- .../src/modules/gstreamer/emotion_gstreamer.c | 54 ++++++++++++ .../src/modules/gstreamer/emotion_gstreamer.h | 1 + .../src/modules/gstreamer/emotion_sink.c | 83 ++++++++++--------- 3 files changed, 98 insertions(+), 40 deletions(-) diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c index 1e9a40fd58..b9ba0dac63 100644 --- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c +++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c @@ -7,6 +7,7 @@ #include "emotion_gstreamer.h" #include "Emotion.h" +Eina_Bool window_manager_video = EINA_FALSE; int _emotion_gstreamer_log_domain = -1; Eina_Bool debug_fps = EINA_FALSE; @@ -1259,6 +1260,11 @@ module_open(Evas_Object *obj, void **video, Emotion_Module_Options *opt) { +#ifdef HAVE_ECORE_X + Ecore_X_Window *roots; + int num; +#endif + if (!module) return EINA_FALSE; @@ -1284,6 +1290,54 @@ module_open(Evas_Object *obj, eina_threads_init(); +#ifdef HAVE_ECORE_X + /* Check if the window manager is able to handle our special Xv window. */ + roots = ecore_x_window_root_list(&num); + if (roots && num > 0) + { + Ecore_X_Window win, twin; + int nwins; + + nwins = ecore_x_window_prop_window_get(roots[0], + ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, + &win, 1); + if (nwins > 0) + { + nwins = ecore_x_window_prop_window_get(win, + ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, + &twin, 1); + if (nwins > 0 && twin == win) + { + Ecore_X_Atom *supported; + int supported_num; + int i; + + if (ecore_x_netwm_supported_get(roots[0], &supported, &supported_num)) + { + Eina_Bool parent = EINA_FALSE; + Eina_Bool video_position = EINA_FALSE; + + for (i = 0; i < supported_num; ++i) + { + if (supported[i] == ECORE_X_ATOM_E_VIDEO_PARENT) + parent = EINA_TRUE; + else if (supported[i] == ECORE_X_ATOM_E_VIDEO_POSITION) + video_position = EINA_TRUE; + if (parent && video_position) + break; + } + + if (parent && video_position) + { + window_manager_video = EINA_TRUE; + } + } + } + } + } + free(roots); +#endif + *module = &em_module; return EINA_TRUE; } diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h index 51e728106e..517ff4fc25 100644 --- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h +++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h @@ -206,6 +206,7 @@ struct _Emotion_Gstreamer_Message GstMessage *msg; }; +extern Eina_Bool window_manager_video; extern Eina_Bool debug_fps; extern int _emotion_gstreamer_log_domain; #define DBG(...) EINA_LOG_DOM_DBG(_emotion_gstreamer_log_domain, __VA_ARGS__) diff --git a/legacy/emotion/src/modules/gstreamer/emotion_sink.c b/legacy/emotion/src/modules/gstreamer/emotion_sink.c index 623bb5ea5f..3e71d8fe1c 100644 --- a/legacy/emotion/src/modules/gstreamer/emotion_sink.c +++ b/legacy/emotion/src/modules/gstreamer/emotion_sink.c @@ -1173,59 +1173,62 @@ gstreamer_video_sink_new(Emotion_Gstreamer_Video *ev, } #if defined HAVE_ECORE_X && defined HAVE_XOVERLAY_H - engines = evas_render_method_list(); - - engine = eina_list_nth(engines, evas_output_method_get(evas_object_evas_get(obj)) - 1); - - if (ev->priority && engine && strstr(engine, "_x11") != NULL) + if (window_manager_video) { - Ecore_Evas *ee; - Evas_Coord x, y, w, h; - Ecore_X_Window win; - Ecore_X_Window parent; + engines = evas_render_method_list(); - evas_object_geometry_get(obj, &x, &y, &w, &h); + engine = eina_list_nth(engines, evas_output_method_get(evas_object_evas_get(obj)) - 1); - ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); + if (ev->priority && engine && strstr(engine, "_x11") != NULL) + { + Ecore_Evas *ee; + Evas_Coord x, y, w, h; + Ecore_X_Window win; + Ecore_X_Window parent; - if (w < 4) w = 4; - if (h < 2) h = 2; + evas_object_geometry_get(obj, &x, &y, &w, &h); - /* Here we really need to have the help of the window manager, this code will change when we update E17. */ - parent = (Ecore_X_Window) ecore_evas_window_get(ee); - fprintf(stderr, "parent: %x\n", parent); + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - win = ecore_x_window_new(0, x, y, w, h); - fprintf(stderr, "creating window: %x [%i, %i, %i, %i]\n", win, x, y, w, h); - if (win) - { - ecore_x_mwm_borderless_set(win, EINA_TRUE); - ecore_x_window_show(win); - xvsink = gst_element_factory_make("xvimagesink", NULL); - if (xvsink) - { - unsigned int pos[2]; + if (w < 4) w = 4; + if (h < 2) h = 2; + + /* Here we really need to have the help of the window manager, this code will change when we update E17. */ + parent = (Ecore_X_Window) ecore_evas_window_get(ee); + fprintf(stderr, "parent: %x\n", parent); + + win = ecore_x_window_new(0, x, y, w, h); + fprintf(stderr, "creating window: %x [%i, %i, %i, %i]\n", win, x, y, w, h); + if (win) + { + /* ecore_x_mwm_borderless_set(win, EINA_TRUE); */ + ecore_x_window_hide(win); + xvsink = gst_element_factory_make("xvimagesink", NULL); + if (xvsink) + { + unsigned int pos[2]; #ifdef HAVE_X_OVERLAY_SET - gst_x_overlay_set_window_handle(GST_X_OVERLAY(xvsink), win); + gst_x_overlay_set_window_handle(GST_X_OVERLAY(xvsink), win); #else - gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), win); + gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(xvsink), win); #endif - ev->win = win; + ev->win = win; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_PARENT, &parent, 1); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_PARENT, &parent, 1); - pos[0] = x; pos[1] = y; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_POSITION, pos, 2); - } - else - { - fprintf(stderr, "destroying win: %x\n", win); - ecore_x_window_free(win); - } - } + pos[0] = x; pos[1] = y; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIDEO_POSITION, pos, 2); + } + else + { + fprintf(stderr, "destroying win: %x\n", win); + ecore_x_window_free(win); + } + } + } + evas_render_method_list_free(engines); } - evas_render_method_list_free(engines); #else # warning "no ecore_x or xoverlay" #endif