[clutter-gst/clutter-gst-2.0] hw: fix crash when running on Wayland with X11 backend compiled
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gst/clutter-gst-2.0] hw: fix crash when running on Wayland with X11 backend compiled
- Date: Tue, 17 Sep 2013 15:30:13 +0000 (UTC)
commit bd146283361f38a195abcaa7b01ccb531df930d0
Author: Lionel Landwerlin <llandwerlin gmail com>
Date: Tue Sep 17 16:23:33 2013 +0100
hw: fix crash when running on Wayland with X11 backend compiled
https://bugzilla.gnome.org/show_bug.cgi?id=707406
clutter-gst/clutter-gst-player.c | 5 +-
clutter-gst/clutter-gst-video-sink.c | 81 +++++++++++++++++----------------
2 files changed, 45 insertions(+), 41 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-player.c b/clutter-gst/clutter-gst-player.c
index badea37..0cd1e05 100644
--- a/clutter-gst/clutter-gst-player.c
+++ b/clutter-gst/clutter-gst-player.c
@@ -2075,8 +2075,9 @@ clutter_gst_player_init (ClutterGstPlayer *player)
player);
#if defined(CLUTTER_WINDOWING_X11) && defined (HAVE_HW_DECODER_SUPPORT)
- gst_bus_set_sync_handler (priv->bus, on_sync_message,
- clutter_x11_get_default_display (), NULL);
+ if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
+ gst_bus_set_sync_handler (priv->bus, on_sync_message,
+ clutter_x11_get_default_display (), NULL);
#endif
gst_object_unref (GST_OBJECT (priv->bus));
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 0de05bd..3c8e300 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -1122,46 +1122,49 @@ static gboolean
clutter_gst_hw_init_pixmap (ClutterGstVideoSink * sink,
GstSurfaceMeta * surface, GstBuffer * buffer)
{
-#ifdef CLUTTER_WINDOWING_X11
ClutterGstVideoSinkPrivate * const priv = sink->priv;
- Display * const dpy = clutter_x11_get_default_display ();
- int screen = clutter_x11_get_default_screen ();
- ClutterBackend *backend;
- CoglContext *context;
- CoglHandle tex;
- GValue value = { 0 };
-
- priv->pixmap = XCreatePixmap(dpy, clutter_x11_get_root_window (),
- priv->info.width, priv->info.height, DefaultDepth (dpy, screen));
- if (!priv->pixmap)
- return FALSE;
-
- backend = clutter_get_default_backend ();
- context = clutter_backend_get_cogl_context (backend);
- tex = cogl_texture_pixmap_x11_new (context, priv->pixmap, FALSE, NULL);
- if (!tex)
- goto error;
- if (!cogl_texture_pixmap_x11_is_using_tfp_extension (tex))
- goto error;
- if (!clutter_gst_hw_set_texture (sink, tex))
- goto error;
-
- g_value_init (&value, G_TYPE_UINT);
- g_value_set_uint (&value, priv->pixmap);
-
- priv->converter =
- gst_surface_meta_create_converter (surface, "x11-pixmap", &value);
- if (!priv->converter)
- goto error;
- return TRUE;
+#ifdef CLUTTER_WINDOWING_X11
+ if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
+ {
+ Display * const dpy = clutter_x11_get_default_display ();
+ int screen = clutter_x11_get_default_screen ();
+ ClutterBackend *backend;
+ CoglContext *context;
+ CoglHandle tex;
+ GValue value = { 0 };
+
+ priv->pixmap = XCreatePixmap(dpy, clutter_x11_get_root_window (),
+ priv->info.width, priv->info.height, DefaultDepth (dpy, screen));
+ if (!priv->pixmap)
+ return FALSE;
+
+ backend = clutter_get_default_backend ();
+ context = clutter_backend_get_cogl_context (backend);
+ tex = cogl_texture_pixmap_x11_new (context, priv->pixmap, FALSE, NULL);
+ if (!tex)
+ goto error;
+ if (!cogl_texture_pixmap_x11_is_using_tfp_extension (tex))
+ goto error;
+ if (!clutter_gst_hw_set_texture (sink, tex))
+ goto error;
+
+ g_value_init (&value, G_TYPE_UINT);
+ g_value_set_uint (&value, priv->pixmap);
+
+ priv->converter =
+ gst_surface_meta_create_converter (surface, "x11-pixmap", &value);
+ if (!priv->converter)
+ goto error;
+ return TRUE;
- /* ERRORS */
- error:
- if (tex)
- cogl_object_unref (tex);
- XFreePixmap (dpy, priv->pixmap);
- priv->pixmap = None;
- return FALSE;
+ /* ERRORS */
+ error:
+ if (tex)
+ cogl_object_unref (tex);
+ XFreePixmap (dpy, priv->pixmap);
+ priv->pixmap = None;
+ return FALSE;
+ }
#endif
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]