static GHashTable* gst_gl_display_map = NULL;
//all glut functions and opengl primitives are called in this thread
-static GThread* gst_gl_display_glutThread = NULL;
+static GThread* gst_gl_display_gl_thread = NULL;
//-timepoped by glutIdleFunc
static GAsyncQueue* gst_gl_display_messageQueue = NULL;
if (display->use_fbo_stuff)
display->use_fbo_stuff = NULL;
- //at this step, the next condition imply that the last display has been pushed
+ //at this step, the next condition implies that
+ //the last display has been removed
if (g_hash_table_size (gst_gl_display_map) == 0)
{
- g_thread_join (gst_gl_display_glutThread);
+ g_thread_join (gst_gl_display_gl_thread);
g_print ("gl thread joined\n");
- gst_gl_display_glutThread = NULL;
+ gst_gl_display_gl_thread = NULL;
g_async_queue_unref (gst_gl_display_messageQueue);
g_hash_table_unref (gst_gl_display_map);
gst_gl_display_map = NULL;
//Should be pass through a glimagesink property
glutInit(&argc, &argv);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
+ //glutSetOption(GLUT_RENDERING_CONTEXT, GLUT_USE_CURRENT_CONTEXT);
glutIdleFunc (gst_gl_display_thread_loop);
{
gst_gl_display_messageQueue = g_async_queue_new ();
gst_gl_display_map = g_hash_table_new (g_direct_hash, g_direct_equal);
- gst_gl_display_glutThread = g_thread_create (
+ gst_gl_display_gl_thread = g_thread_create (
(GThreadFunc) gst_gl_display_thread_func, display, TRUE, NULL);
g_cond_wait (display->cond_create_context, display->mutex);
}
{
static gint y_pos = 0;
+#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
+
+ gst_gl_display_lock (display);
+ display->winId = winId;
+ 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);
+
+#else
+
gst_gl_display_lock (display);
- //display->winId = winId;
- //gst_gl_display_post_message (GST_GL_DISPLAY_ACTION_CHANGE_CONTEXT, display);
gst_gl_display_post_message (GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT, display);
- //g_cond_wait (display->cond_change_context, display->mutex);
g_cond_wait (display->cond_destroy_context, display->mutex);
gst_gl_display_unlock (display);
if (g_hash_table_size (gst_gl_display_map) == 0)
{
- g_thread_join (gst_gl_display_glutThread);
+ g_thread_join (gst_gl_display_gl_thread);
g_print ("gl thread joined when setting winId\n");
- gst_gl_display_glutThread = NULL;
+ gst_gl_display_gl_thread = NULL;
g_async_queue_unref (gst_gl_display_messageQueue);
g_hash_table_unref (gst_gl_display_map);
gst_gl_display_map = NULL;
//init colorspace conversion if needed
gst_gl_display_init_upload (display, display->upload_video_format,
display->upload_width, display->upload_height);
+#endif
}