diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index 1f2604cad5..c92e20049b 100644 --- a/gst-libs/gst/gl/gstgldisplay.c +++ b/gst-libs/gst/gl/gstgldisplay.c @@ -25,16 +25,6 @@ #include "gstgldisplay.h" #include - -//------------------------------------------------------------------------------------------- -//--------------------------- TODO ---------------------------------------------------------- -// - send EOS when the user click on the window cross -//------------------------------------------------------------------------------------------- - - -//------------------------------------------------------------ -//-------------------- Private d�clarations ------------------ -//------------------------------------------------------------ static void gst_gl_display_finalize (GObject * object); static gpointer gst_gl_display_glutThreadFunc (GstGLDisplay* display); static void gst_gl_display_glutCreateWindow (GstGLDisplay* display); @@ -159,6 +149,7 @@ gst_gl_display_init (GstGLDisplay *display, GstGLDisplayClass *klass) display->glcontext_width = 0; display->glcontext_height = 0; display->visible = FALSE; + display->isAlive = TRUE; display->clientReshapeCallback = NULL; display->clientDrawCallback = NULL; display->title = g_string_new ("OpenGL renderer "); @@ -1042,12 +1033,18 @@ gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format, /* Called by gst_gl elements */ -void +gboolean gst_gl_display_postRedisplay (GstGLDisplay* display) { + gboolean isAlive = TRUE; + gst_gl_display_lock (display); + isAlive = display->isAlive; gst_gl_display_postMessage (GST_GL_DISPLAY_ACTION_REDISPLAY, display); gst_gl_display_unlock (display); + + return isAlive; + } @@ -1207,7 +1204,10 @@ void gst_gl_display_onClose (void) if (display == NULL) return; g_print ("on close\n"); - //gst_event_new_eos(); + + gst_gl_display_lock (display); + display->isAlive = FALSE; + gst_gl_display_unlock (display); } diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h index 9130d300a4..f45d4dc6b7 100644 --- a/gst-libs/gst/gl/gstgldisplay.h +++ b/gst-libs/gst/gl/gstgldisplay.h @@ -97,6 +97,7 @@ struct _GstGLDisplay { gint glcontext_width; gint glcontext_height; gboolean visible; + gboolean isAlive; //intput frame buffer object (video -> GL) GLuint fbo; @@ -209,7 +210,7 @@ void gst_gl_display_clearTexture (GstGLDisplay* display, guint texture, void gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format, gpointer data); -void gst_gl_display_postRedisplay (GstGLDisplay* display); +gboolean gst_gl_display_postRedisplay (GstGLDisplay* display); void gst_gl_display_set_windowId (GstGLDisplay* display, gulong winId); #endif diff --git a/gst/gl/gstglimagesink.c b/gst/gl/gstglimagesink.c index 6d2a4e3839..cdab44c142 100644 --- a/gst/gl/gstglimagesink.c +++ b/gst/gl/gstglimagesink.c @@ -397,6 +397,7 @@ gst_glimage_sink_render (GstBaseSink * bsink, GstBuffer * buf) { GstGLImageSink *glimage_sink = NULL; GstGLBuffer *gl_buffer = NULL; + gboolean isAlive = TRUE; glimage_sink = GST_GLIMAGE_SINK (bsink); @@ -469,9 +470,12 @@ gst_glimage_sink_render (GstBaseSink * bsink, GstBuffer * buf) glimage_sink->stored_buffer = gl_buffer; //redisplay opengl scene - gst_gl_display_postRedisplay (glimage_sink->display); + isAlive = gst_gl_display_postRedisplay (glimage_sink->display); - return GST_FLOW_OK; + if (isAlive) + return GST_FLOW_OK; + else + return GST_FLOW_UNEXPECTED;; }