mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
[070/906] implement and fix onClose: when a user click on the cross of an internal window (there is not this issue when using the gstxoverlay interface)
git-svn-id: svn://svn.wobow.com/GStreamer_playground/gst-plugins-gl@436 93df14bb-0f41-7a43-8087-d3e2a2f0e464
This commit is contained in:
parent
76fa1292f8
commit
870fff7ac8
3 changed files with 20 additions and 15 deletions
|
@ -25,16 +25,6 @@
|
|||
#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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue