emotion: properly test the existence of an X connection in gstreamer backend.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 28 Dec 2011 16:08:38 +0000 (16:08 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 28 Dec 2011 16:08:38 +0000 (16:08 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/emotion@66606 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/gstreamer/emotion_gstreamer.c
src/modules/gstreamer/emotion_gstreamer.h

index 4382a4e..7296cbb 100644 (file)
@@ -10,6 +10,7 @@
 Eina_Bool window_manager_video = EINA_FALSE;
 int _emotion_gstreamer_log_domain = -1;
 Eina_Bool debug_fps = EINA_FALSE;
+Eina_Bool _ecore_x_available = EINA_FALSE;
 
 /* Callbacks to get the eos */
 static void _for_each_tag    (GstTagList const* list, gchar const* tag, void *data);
@@ -1277,8 +1278,13 @@ module_open(Evas_Object           *obj,
    eina_threads_init();
 
 #ifdef HAVE_ECORE_X
+   if (ecore_x_init(NULL) > 0)
+     {
+        _ecore_x_available = EINA_TRUE;
+     }
+
    /* Check if the window manager is able to handle our special Xv window. */
-   roots = ecore_x_window_root_list(&num);
+   roots = _ecore_x_available ? ecore_x_window_root_list(&num) : NULL;
    if (roots && num > 0)
      {
         Ecore_X_Window  win, twin;
@@ -1334,6 +1340,13 @@ module_close(Emotion_Video_Module *module __UNUSED__,
 {
    em_module.shutdown(video);
 
+#ifdef HAVE_ECORE_X
+   if (_ecore_x_available)
+     {
+        ecore_x_shutdown();
+     }
+#endif
+
    eina_threads_shutdown();
 }
 
index 93a638d..e69f30d 100644 (file)
@@ -209,6 +209,7 @@ struct _Emotion_Gstreamer_Message
 extern Eina_Bool window_manager_video;
 extern Eina_Bool debug_fps;
 extern int _emotion_gstreamer_log_domain;
+extern Eina_Bool _ecore_x_available;
 #define DBG(...) EINA_LOG_DOM_DBG(_emotion_gstreamer_log_domain, __VA_ARGS__)
 #define INF(...) EINA_LOG_DOM_INFO(_emotion_gstreamer_log_domain, __VA_ARGS__)
 #define WRN(...) EINA_LOG_DOM_WARN(_emotion_gstreamer_log_domain, __VA_ARGS__)