diff options
author | David Schleef <ds@schleef.org> | 2006-09-23 00:28:35 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2006-09-23 00:28:35 +0000 |
commit | 33ae52e8a330d153c63634ed0198145ebe62cd45 (patch) | |
tree | 73d5b857ca534a96a5b39bc0d93be58deff63359 | |
parent | 0a1f778b366c03539f7366ed8e1383e7e44553f4 (diff) | |
download | gst-plugins-bad-33ae52e8a330d153c63634ed0198145ebe62cd45.tar.gz gst-plugins-bad-33ae52e8a330d153c63634ed0198145ebe62cd45.tar.bz2 gst-plugins-bad-33ae52e8a330d153c63634ed0198145ebe62cd45.zip |
sys/glsink/glimagesink.c: Fix problems when the element cannot open the display. (fixes #357212)
Original commit message from CVS:
* sys/glsink/glimagesink.c:
Fix problems when the element cannot open the display.
(fixes #357212)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sys/glsink/glimagesink.c | 25 |
2 files changed, 22 insertions, 9 deletions
@@ -1,3 +1,9 @@ +2006-09-22 David Schleef <ds@schleef.org> + + * sys/glsink/glimagesink.c: + Fix problems when the element cannot open the display. + (fixes #357212) + 2006-09-22 Tim-Philipp Müller <tim at centricular dot net> * configure.ac: diff --git a/sys/glsink/glimagesink.c b/sys/glsink/glimagesink.c index ad1cee14..920f5158 100644 --- a/sys/glsink/glimagesink.c +++ b/sys/glsink/glimagesink.c @@ -180,10 +180,11 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink, int screen; glimage_sink->display = XOpenDisplay (NULL); + if (glimage_sink->display) { + screen = DefaultScreen (glimage_sink->display); - screen = DefaultScreen (glimage_sink->display); - - XSynchronize (glimage_sink->display, True); + XSynchronize (glimage_sink->display, True); + } /* XSetErrorHandler (error_handler); */ glimage_sink->width = 400; glimage_sink->height = 400; @@ -204,6 +205,7 @@ gst_glimage_sink_set_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_DISPLAY: + /* FIXME this should close/reopen display */ if (glimage_sink->display_name) { g_free (glimage_sink->display_name); } @@ -224,9 +226,14 @@ gst_glimage_sink_finalize (GObject * object) glimage_sink = GST_GLIMAGE_SINK (object); - gst_caps_unref (glimage_sink->caps); + if (glimage_sink->caps) { + gst_caps_unref (glimage_sink->caps); + } g_free (glimage_sink->display_name); + if (glimage_sink->display) { + XCloseDisplay (glimage_sink->display); + } } static void @@ -453,8 +460,11 @@ gst_glimage_sink_update_caps (GstGLImageSink * glimage_sink) GstCaps *caps; int max_size; - if (glimage_sink->display == NULL) { + if (glimage_sink->caps) { gst_caps_unref (glimage_sink->caps); + } + + if (glimage_sink->display == NULL) { glimage_sink->caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (glimage_sink))); @@ -480,9 +490,6 @@ gst_glimage_sink_update_caps (GstGLImageSink * glimage_sink) "width", GST_TYPE_INT_RANGE, 16, max_size, "height", GST_TYPE_INT_RANGE, 16, max_size, NULL); - if (glimage_sink->caps) { - gst_caps_unref (glimage_sink->caps); - } glimage_sink->caps = caps; } @@ -571,7 +578,7 @@ gst_glimage_sink_init_display (GstGLImageSink * glimage_sink) glimage_sink->display = XOpenDisplay (NULL); if (glimage_sink->display == NULL) { - GST_ERROR_OBJECT (glimage_sink, "Could not open display"); + GST_DEBUG_OBJECT (glimage_sink, "Could not open display"); return FALSE; } |