[563/906] readd support for hanging GL pipelines e.g. ... ! gleffects ! fakesink

This commit is contained in:
Matthew Waters 2012-08-15 16:52:48 +10:00
parent 6de0b127d7
commit 3f94f31c3d
6 changed files with 77 additions and 17 deletions

View file

@ -53,7 +53,7 @@ enum
#define DEBUG_INIT \
GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0, "glfilter element");
#define gst_gl_filter_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_BASE_TRANSFORM,
DEBUG_INIT);
@ -62,6 +62,8 @@ static void gst_gl_filter_set_property (GObject * object, guint prop_id,
static void gst_gl_filter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_gl_filter_query (GstBaseTransform * trans,
GstPadDirection direction, GstQuery * query);
static GstCaps *gst_gl_filter_transform_caps (GstBaseTransform * bt,
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
static void gst_gl_filter_reset (GstGLFilter * filter);
@ -97,6 +99,7 @@ gst_gl_filter_class_init (GstGLFilterClass * klass)
GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
gst_gl_filter_transform_caps;
GST_BASE_TRANSFORM_CLASS (klass)->transform = gst_gl_filter_transform;
GST_BASE_TRANSFORM_CLASS (klass)->query = gst_gl_filter_query;
GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_filter_start;
GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_filter_stop;
GST_BASE_TRANSFORM_CLASS (klass)->set_caps = gst_gl_filter_set_caps;
@ -164,6 +167,40 @@ gst_gl_filter_get_property (GObject * object, guint prop_id,
}
}
static gboolean
gst_gl_filter_query (GstBaseTransform * trans, GstPadDirection direction,
GstQuery * query)
{
GstGLFilter *filter;
gboolean res;
filter = GST_GL_FILTER (trans);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CUSTOM:
{
GstStructure *structure = gst_query_writable_structure (query);
if (direction == GST_PAD_SINK &&
gst_structure_has_name (structure, "gstgldisplay")) {
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER,
filter->display, NULL);
res = TRUE;
} else
res =
GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
query);
break;
}
default:
res =
GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
query);
break;
}
return res;
}
static void
gst_gl_filter_reset (GstGLFilter * filter)
{
@ -204,8 +241,8 @@ gst_gl_filter_start (GstBaseTransform * bt)
display_query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
if (!gst_pad_peer_query (bt->srcpad, display_query)) {
GST_WARNING ("Could not query GstGLDisplay from downstream");
return FALSE;
GST_WARNING
("Could not query GstGLDisplay from downstream (peer query failed)");
}
id_value = gst_structure_get_value (structure, "gstgldisplay");
@ -214,8 +251,13 @@ gst_gl_filter_start (GstBaseTransform * bt)
filter->display =
g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
else {
GST_WARNING ("Incorrect GstGLDisplay from downstream");
return FALSE;
GST_INFO ("Creating GstGLDisplay");
filter->display = gst_gl_display_new ();
if (!gst_gl_display_create_context (filter->display, 0)) {
GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
GST_GL_DISPLAY_ERR_MSG (filter->display), (NULL));
return FALSE;
}
}
if (filter_class->onStart)

View file

@ -970,8 +970,8 @@ gst_gl_mixer_activate (GstGLMixer * mix, gboolean activate)
display_query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
if (!gst_pad_peer_query (mix->srcpad, display_query)) {
GST_WARNING ("Could not query GstGLDisplay from downstream");
return FALSE;
GST_WARNING
("Could not query GstGLDisplay from downstream (peer query failed)");
}
id_value = gst_structure_get_value (structure, "gstgldisplay");
@ -979,8 +979,13 @@ gst_gl_mixer_activate (GstGLMixer * mix, gboolean activate)
mix->display =
g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
else {
GST_WARNING ("Incorrect GstGLDisplay from downstream");
return FALSE;
GST_INFO ("Creating GstGLDisplay");
mix->display = gst_gl_display_new ();
if (!gst_gl_display_create_context (mix->display, 0)) {
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
GST_GL_DISPLAY_ERR_MSG (mix->display), (NULL));
return FALSE;
}
}
}

View file

@ -238,6 +238,7 @@ gst_gl_download_start (GstBaseTransform * bt)
{
GstGLDownload *download = GST_GL_DOWNLOAD (bt);
GST_INFO ("Creating GstGLDisplay");
download->display = gst_gl_display_new ();
if (!gst_gl_display_create_context (download->display, 0)) {
GST_ELEMENT_ERROR (download, RESOURCE, NOT_FOUND,

View file

@ -373,6 +373,8 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!glimage_sink->display) {
gboolean ok = FALSE;
GST_INFO ("Creating GstGLDisplay");
glimage_sink->display = gst_gl_display_new ();
/* init opengl context */

View file

@ -516,8 +516,8 @@ gst_gl_test_src_start (GstBaseSrc * basesrc)
display_query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
if (!gst_pad_peer_query (basesrc->srcpad, display_query)) {
GST_WARNING ("Could not query GstGLDisplay from downstream");
return FALSE;
GST_WARNING
("Could not query GstGLDisplay from downstream (peer query failed)");
}
id_value = gst_structure_get_value (structure, "gstgldisplay");
@ -526,8 +526,13 @@ gst_gl_test_src_start (GstBaseSrc * basesrc)
src->display =
g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
else {
GST_WARNING ("Incorrect GstGLDisplay from downstream");
return FALSE;
GST_INFO ("Creating GstGLDisplay");
src->display = gst_gl_display_new ();
if (!gst_gl_display_create_context (src->display, 0)) {
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
GST_GL_DISPLAY_ERR_MSG (src->display), (NULL));
return FALSE;
}
}
src->running_time = 0;

View file

@ -262,8 +262,8 @@ gst_gl_upload_start (GstBaseTransform * bt)
display_query = gst_query_new_custom (GST_QUERY_CUSTOM, structure);
if (!gst_pad_peer_query (bt->srcpad, display_query)) {
GST_WARNING ("Could not query GstGLDisplay from downstream");
return FALSE;
GST_WARNING
("Could not query GstGLDisplay from downstream (peer query failed)");
}
id_value = gst_structure_get_value (structure, "gstgldisplay");
@ -272,8 +272,13 @@ gst_gl_upload_start (GstBaseTransform * bt)
upload->display =
g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
else {
GST_WARNING ("Incorrect GstGLDisplay from downstream");
return FALSE;
GST_INFO ("Creating GstGLDisplay");
upload->display = gst_gl_display_new ();
if (!gst_gl_display_create_context (upload->display, 0)) {
GST_ELEMENT_ERROR (upload, RESOURCE, NOT_FOUND,
GST_GL_DISPLAY_ERR_MSG (upload->display), (NULL));
return FALSE;
}
}
return TRUE;