emotion: disable direct rendering path if window manager doesn't handle it.

SVN revision: 64256
This commit is contained in:
Cedric BAIL 2011-10-21 15:00:41 +00:00
parent 0acd0ff100
commit 321cbb17e9
3 changed files with 98 additions and 40 deletions

View File

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

View File

@ -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__)

View File

@ -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