mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-10 01:54:11 +00:00
[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
951460cdd1
commit
21e2cff9cc
4 changed files with 27 additions and 13 deletions
|
@ -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 */
|
||||
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_change_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_redisplay (GstGLDisplay* display);
|
||||
|
@ -126,6 +127,7 @@ gst_gl_display_init (GstGLDisplay *display, GstGLDisplayClass *klass)
|
|||
//conditions
|
||||
display->cond_create_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_del_texture = 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);
|
||||
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) {
|
||||
g_cond_free (display->cond_destroy_context);
|
||||
display->cond_destroy_context = NULL;
|
||||
|
@ -515,6 +521,9 @@ gst_gl_display_thread_dispatch_action (GstGLDisplayMsg* msg)
|
|||
break;
|
||||
case GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT:
|
||||
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;
|
||||
case GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT:
|
||||
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)
|
||||
{
|
||||
case GST_GL_DISPLAY_ACTION_CREATE_CONTEXT:
|
||||
//display is not in the map only when we want create one
|
||||
valid = TRUE;
|
||||
break;
|
||||
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_RESIZE_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 */
|
||||
static void
|
||||
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;
|
||||
|
||||
gst_gl_display_lock (display);
|
||||
gst_gl_display_post_message (GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT, display);
|
||||
g_cond_wait (display->cond_destroy_context, display->mutex);
|
||||
//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);
|
||||
|
||||
if (g_hash_table_size (gst_gl_display_map) == 0)
|
||||
|
|
|
@ -60,6 +60,7 @@ typedef enum {
|
|||
typedef enum {
|
||||
GST_GL_DISPLAY_ACTION_CREATE_CONTEXT,
|
||||
GST_GL_DISPLAY_ACTION_DESTROY_CONTEXT,
|
||||
GST_GL_DISPLAY_ACTION_CHANGE_CONTEXT,
|
||||
GST_GL_DISPLAY_ACTION_VISIBLE_CONTEXT,
|
||||
GST_GL_DISPLAY_ACTION_RESIZE_CONTEXT,
|
||||
GST_GL_DISPLAY_ACTION_REDISPLAY_CONTEXT,
|
||||
|
@ -118,6 +119,7 @@ struct _GstGLDisplay {
|
|||
//conditions
|
||||
GCond* cond_create_context;
|
||||
GCond* cond_destroy_context;
|
||||
GCond* cond_change_context;
|
||||
GCond* cond_gen_texture;
|
||||
GCond* cond_del_texture;
|
||||
GCond* cond_init_upload;
|
||||
|
|
|
@ -124,7 +124,7 @@ static void
|
|||
gst_gl_filter_app_get_property (GObject* object, guint prop_id,
|
||||
GValue* value, GParamSpec* pspec)
|
||||
{
|
||||
//GstGLFilterApp *filter = GST_GL_FILTER_APP (object);
|
||||
//GstGLFilterApp* filter = GST_GL_FILTER_APP (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
|
|
@ -277,14 +277,12 @@ gst_glimage_sink_change_state (GstElement* element, GstStateChange transition)
|
|||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
/* FIXME clear window */
|
||||
glimage_sink->fps_n = 0;
|
||||
glimage_sink->fps_d = 1;
|
||||
GST_VIDEO_SINK_WIDTH (glimage_sink) = 0;
|
||||
GST_VIDEO_SINK_HEIGHT (glimage_sink) = 0;
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
/* FIXME dispose of window */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -534,15 +532,7 @@ gst_glimage_sink_set_xwindow_id (GstXOverlay* overlay, gulong window_id)
|
|||
return;
|
||||
|
||||
if (window_id)
|
||||
{
|
||||
//if (glimage_sink->window_id && ddrawsink->isInternal)
|
||||
//close internal window
|
||||
|
||||
glimage_sink->window_id = window_id;
|
||||
}
|
||||
|
||||
//Handle the case where window_id is 0 and we want the sink to
|
||||
//create a new window when playback was already started (after set_caps)
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue