[119/906] git-svn-id: svn://svn.wobow.com/GStreamer_playground/gst-plugins-gl@579 93df14bb-0f41-7a43-8087-d3e2a2f0e464
This commit is contained in:
parent
f4b54bd934
commit
8b14eea6ec
@ -37,6 +37,7 @@ static gboolean gst_gl_display_thread_check_msg_validity (GstGLDisplayMsg *msg);
|
|||||||
/* Called in the gl thread, protected by lock and unlock */
|
/* Called in the gl thread, protected by lock and unlock */
|
||||||
static void gst_gl_display_thread_create_context (GstGLDisplay* display);
|
static void gst_gl_display_thread_create_context (GstGLDisplay* display);
|
||||||
static void gst_gl_display_thread_destroy_context (GstGLDisplay* display);
|
static void gst_gl_display_thread_destroy_context (GstGLDisplay* display);
|
||||||
|
static void gst_gl_display_thread_change_context (GstGLDisplay* display);
|
||||||
static void gst_gl_display_thread_set_visible_context (GstGLDisplay* display);
|
static void gst_gl_display_thread_set_visible_context (GstGLDisplay* display);
|
||||||
static void gst_gl_display_thread_resize_context (GstGLDisplay* display);
|
static void gst_gl_display_thread_resize_context (GstGLDisplay* display);
|
||||||
static void gst_gl_display_thread_redisplay (GstGLDisplay* display);
|
static void gst_gl_display_thread_redisplay (GstGLDisplay* display);
|
||||||
@ -126,6 +127,7 @@ gst_gl_display_init (GstGLDisplay *display, GstGLDisplayClass *klass)
|
|||||||
//conditions
|
//conditions
|
||||||
display->cond_create_context = g_cond_new ();
|
display->cond_create_context = g_cond_new ();
|
||||||
display->cond_destroy_context = g_cond_new ();
|
display->cond_destroy_context = g_cond_new ();
|
||||||
|
display->cond_change_context = g_cond_new ();
|
||||||
display->cond_gen_texture = g_cond_new ();
|
display->cond_gen_texture = g_cond_new ();
|
||||||
display->cond_del_texture = g_cond_new ();
|
display->cond_del_texture = g_cond_new ();
|
||||||
display->cond_init_upload = g_cond_new ();
|
display->cond_init_upload = g_cond_new ();
|
||||||
@ -414,6 +416,10 @@ gst_gl_display_finalize (GObject* object)
|
|||||||
g_cond_free (display->cond_gen_texture);
|
g_cond_free (display->cond_gen_texture);
|
||||||
display->cond_gen_texture = NULL;
|
display->cond_gen_texture = NULL;
|
||||||
}
|
}
|
||||||
|
if (display->cond_change_context) {
|
||||||
|
g_cond_free (display->cond_change_context);
|
||||||
|
display->cond_change_context = NULL;
|
||||||
|
}
|
||||||
if (display->cond_destroy_context) {
|
if (display->cond_destroy_context) {
|
||||||
g_cond_free (display->cond_destroy_context);
|
g_cond_free (display->cond_destroy_context);
|
||||||
display->cond_destroy_context = NULL;
|
display->cond_destroy_context = NULL;
|
||||||
@ -515,6 +521,9 @@ gst_gl_display_thread_dispatch_action (GstGLDisplayMsg* msg)
|
|||||||
break;
|
break;
|
||||||
case GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT:
|
||||||
gst_gl_display_thread_destroy_context (msg->display);
|
gst_gl_display_thread_destroy_context (msg->display);
|
||||||
|
break;
|
||||||
|
case GST_GL_DISPLAY_ACTION_CHANGE_CONTEXT:
|
||||||
|
gst_gl_display_thread_change_context (msg->display);
|
||||||
break;
|
break;
|
||||||
case GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT:
|
||||||
gst_gl_display_thread_set_visible_context (msg->display);
|
gst_gl_display_thread_set_visible_context (msg->display);
|
||||||
@ -576,9 +585,11 @@ gst_gl_display_thread_check_msg_validity (GstGLDisplayMsg *msg)
|
|||||||
switch (msg->action)
|
switch (msg->action)
|
||||||
{
|
{
|
||||||
case GST_GL_DISPLAY_ACTION_CREATE_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_CREATE_CONTEXT:
|
||||||
|
//display is not in the map only when we want create one
|
||||||
valid = TRUE;
|
valid = TRUE;
|
||||||
break;
|
break;
|
||||||
case GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT:
|
||||||
|
case GST_GL_DISPLAY_ACTION_CHANGE_CONTEXT:
|
||||||
case GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT:
|
||||||
case GST_GL_DISPLAY_ACTION_RESIZE_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_RESIZE_CONTEXT:
|
||||||
case GST_GL_DISPLAY_ACTION_REDISPLAY_CONTEXT:
|
case GST_GL_DISPLAY_ACTION_REDISPLAY_CONTEXT:
|
||||||
@ -748,6 +759,16 @@ gst_gl_display_thread_destroy_context (GstGLDisplay *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Called in the gl thread */
|
||||||
|
static void
|
||||||
|
gst_gl_display_thread_change_context (GstGLDisplay *display)
|
||||||
|
{
|
||||||
|
glutSetWindow (display->glutWinId);
|
||||||
|
glutChangeWindow (display->winId);
|
||||||
|
g_cond_signal (display->cond_change_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Called in the gl thread */
|
/* Called in the gl thread */
|
||||||
static void
|
static void
|
||||||
gst_gl_display_thread_set_visible_context (GstGLDisplay *display)
|
gst_gl_display_thread_set_visible_context (GstGLDisplay *display)
|
||||||
@ -1884,8 +1905,9 @@ gst_gl_display_set_window_id (GstGLDisplay* display, gulong winId)
|
|||||||
static gint y_pos = 0;
|
static gint y_pos = 0;
|
||||||
|
|
||||||
gst_gl_display_lock (display);
|
gst_gl_display_lock (display);
|
||||||
gst_gl_display_post_message (GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT, display);
|
//display->winId = winId;
|
||||||
g_cond_wait (display->cond_destroy_context, display->mutex);
|
gst_gl_display_post_message (GST_GL_DISPLAY_ACTION_CHANGE_CONTEXT, display);
|
||||||
|
g_cond_wait (display->cond_change_context, display->mutex);
|
||||||
gst_gl_display_unlock (display);
|
gst_gl_display_unlock (display);
|
||||||
|
|
||||||
if (g_hash_table_size (gst_gl_display_map) == 0)
|
if (g_hash_table_size (gst_gl_display_map) == 0)
|
||||||
|
@ -60,6 +60,7 @@ typedef enum {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
GST_GL_DISPLAY_ACTION_CREATE_CONTEXT,
|
GST_GL_DISPLAY_ACTION_CREATE_CONTEXT,
|
||||||
GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT,
|
GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT,
|
||||||
|
GST_GL_DISPLAY_ACTION_CHANGE_CONTEXT,
|
||||||
GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT,
|
GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT,
|
||||||
GST_GL_DISPLAY_ACTION_RESIZE_CONTEXT,
|
GST_GL_DISPLAY_ACTION_RESIZE_CONTEXT,
|
||||||
GST_GL_DISPLAY_ACTION_REDISPLAY_CONTEXT,
|
GST_GL_DISPLAY_ACTION_REDISPLAY_CONTEXT,
|
||||||
@ -118,6 +119,7 @@ struct _GstGLDisplay {
|
|||||||
//conditions
|
//conditions
|
||||||
GCond* cond_create_context;
|
GCond* cond_create_context;
|
||||||
GCond* cond_destroy_context;
|
GCond* cond_destroy_context;
|
||||||
|
GCond* cond_change_context;
|
||||||
GCond* cond_gen_texture;
|
GCond* cond_gen_texture;
|
||||||
GCond* cond_del_texture;
|
GCond* cond_del_texture;
|
||||||
GCond* cond_init_upload;
|
GCond* cond_init_upload;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user