[070/906] implement and fix onClose: when a user click on the cross of an internal...
authorJulien Isorce <julien.isorce@gmail.com>
Mon, 19 May 2008 18:45:46 +0000 (18:45 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:16 +0000 (19:31 +0000)
git-svn-id: svn://svn.wobow.com/GStreamer_playground/gst-plugins-gl@436 93df14bb-0f41-7a43-8087-d3e2a2f0e464

gst-libs/gst/gl/gstgldisplay.c
gst-libs/gst/gl/gstgldisplay.h

index 1f2604c..c92e200 100644 (file)
 #include "gstgldisplay.h"
 #include <gst/gst.h>
 
-
-//-------------------------------------------------------------------------------------------
-//--------------------------- 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);
 }
 
 
index 9130d30..f45d4dc 100644 (file)
@@ -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