diff options
author | Matthew Waters <matthew@centricular.com> | 2016-03-16 22:48:00 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2016-03-17 02:37:15 +1100 |
commit | 993ec87ae6f19f189938bc7cd97a928fec70a2f8 (patch) | |
tree | b13c3c8c1b6414853e4fa60bcfbbe7ce36b12ce5 | |
parent | 16dec9eaccd7aa6ebc2e123172ac05ef16e21bef (diff) | |
download | gstreamer-plugins-bad-993ec87ae6f19f189938bc7cd97a928fec70a2f8.tar.gz |
glupload: deal with the ANY caps feature correctly
When transforming, xplode it out into the necessary caps features both
with and without the passthough features.
Fixes negotiation in the following class of pipelines:
gl ! textoverlay ! glupload ! glimagesinkelement
https://bugzilla.gnome.org/show_bug.cgi?id=763756
-rw-r--r-- | gst-libs/gst/gl/gstglupload.c | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index eb25e15ac..32e6150fa 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -111,32 +111,50 @@ _set_caps_features_with_passthrough (const GstCaps * caps, guint i, j, m, n; GstCaps *tmp; - tmp = gst_caps_copy (caps); + tmp = gst_caps_new_empty (); n = gst_caps_get_size (caps); for (i = 0; i < n; i++) { GstCapsFeatures *features, *orig_features; + GstStructure *s = gst_caps_get_structure (caps, i); orig_features = gst_caps_get_features (caps, i); features = gst_caps_features_new (feature_name, NULL); - m = gst_caps_features_get_size (orig_features); - for (j = 0; j < m; j++) { - const gchar *feature = gst_caps_features_get_nth (orig_features, j); + if (gst_caps_features_is_any (orig_features)) { + /* if we have any features, we add both the features with and without @passthrough */ + gst_caps_append_structure_full (tmp, gst_structure_copy (s), + gst_caps_features_copy (features)); - /* if we already have the features */ - if (gst_caps_features_contains (features, feature)) - continue; + m = gst_caps_features_get_size (passthrough); + for (j = 0; j < m; j++) { + const gchar *feature = gst_caps_features_get_nth (passthrough, j); - if (g_strcmp0 (feature, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY) == 0) - continue; + /* if we already have the features */ + if (gst_caps_features_contains (features, feature)) + continue; - if (gst_caps_features_contains (passthrough, feature)) { gst_caps_features_add (features, feature); } + } else { + m = gst_caps_features_get_size (orig_features); + for (j = 0; j < m; j++) { + const gchar *feature = gst_caps_features_get_nth (orig_features, j); + + /* if we already have the features */ + if (gst_caps_features_contains (features, feature)) + continue; + + if (g_strcmp0 (feature, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY) == 0) + continue; + + if (gst_caps_features_contains (passthrough, feature)) { + gst_caps_features_add (features, feature); + } + } } - gst_caps_set_features (tmp, i, features); + gst_caps_append_structure_full (tmp, gst_structure_copy (s), features); } return tmp; @@ -297,8 +315,8 @@ _gl_memory_upload_propose_allocation (gpointer impl, GstQuery * decide_query, gst_allocation_params_init (¶ms); allocator = - GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload->upload-> - context)); + GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload-> + upload->context)); gst_query_add_allocation_param (query, allocator, ¶ms); gst_object_unref (allocator); } @@ -584,8 +602,8 @@ _egl_image_upload_perform_gl_thread (GstGLContext * context, } if (GST_IS_GL_BUFFER_POOL (image->buffer->pool)) - gst_gl_buffer_pool_replace_last_buffer (GST_GL_BUFFER_POOL (image->buffer-> - pool), image->buffer); + gst_gl_buffer_pool_replace_last_buffer (GST_GL_BUFFER_POOL (image-> + buffer->pool), image->buffer); } static GstGLUploadReturn @@ -1026,11 +1044,11 @@ _upload_meta_upload_propose_allocation (gpointer impl, GstQuery * decide_query, gpointer handle; gl_apis = - gst_gl_api_to_string (gst_gl_context_get_gl_api (upload-> - upload->context)); + gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->upload-> + context)); platform = - gst_gl_platform_to_string (gst_gl_context_get_gl_platform - (upload->upload->context)); + gst_gl_platform_to_string (gst_gl_context_get_gl_platform (upload-> + upload->context)); handle = (gpointer) gst_gl_context_get_gl_context (upload->upload->context); gl_context = |