diff options
author | Lionel Landwerlin <llandwerlin@gmail.com> | 2013-09-17 16:23:33 +0100 |
---|---|---|
committer | Lionel Landwerlin <llandwerlin@gmail.com> | 2013-09-17 16:24:05 +0100 |
commit | bd146283361f38a195abcaa7b01ccb531df930d0 (patch) | |
tree | be5362c0b2274628faecc68f53ad7131881fd2fd | |
parent | 03f0d8f48bd7f60e582e6185cb73a07038e8d55d (diff) | |
download | clutter-gst-bd146283361f38a195abcaa7b01ccb531df930d0.tar.gz |
hw: fix crash when running on Wayland with X11 backend compiled
https://bugzilla.gnome.org/show_bug.cgi?id=707406
-rw-r--r-- | clutter-gst/clutter-gst-player.c | 5 | ||||
-rw-r--r-- | clutter-gst/clutter-gst-video-sink.c | 79 |
2 files changed, 44 insertions, 40 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; } |