diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-03-06 18:15:11 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-03-06 18:53:13 +0100 |
commit | b81823e7dba96bfe502c376b0539e84ddf45a0c5 (patch) | |
tree | dd9417655e34deca3b471decda34a08bd6adc842 /ext | |
parent | 50d2d9ac08945d0036638442f72a4c4915bffc23 (diff) | |
download | gstreamer-plugins-bad-b81823e7dba96bfe502c376b0539e84ddf45a0c5.tar.gz |
gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/gl/gstglimagesink.c | 41 | ||||
-rw-r--r-- | ext/gl/gstglmixer.c | 51 | ||||
-rw-r--r-- | ext/gl/gstgltestsrc.c | 56 |
3 files changed, 9 insertions, 139 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 7c2c70a08..4ce32115a 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -785,42 +785,6 @@ gst_glimage_sink_get_times (GstBaseSink * bsink, GstBuffer * buf, } } -/* copies the given caps */ -static GstCaps * -gst_glimage_sink_caps_remove_format_info (GstCaps * caps) -{ - GstStructure *st; - GstCapsFeatures *f; - gint i, n; - GstCaps *res; - - res = gst_caps_new_empty (); - - n = gst_caps_get_size (caps); - for (i = 0; i < n; i++) { - st = gst_caps_get_structure (caps, i); - f = gst_caps_get_features (caps, i); - - /* If this is already expressed by the existing caps - * skip this structure */ - if (i > 0 && gst_caps_is_subset_structure_full (res, st, f)) - continue; - - st = gst_structure_copy (st); - /* Only remove format info for the cases when we can actually convert */ - if (!gst_caps_features_is_any (f) - && gst_caps_features_is_equal (f, - GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) - gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site", - NULL); - gst_structure_remove_fields (st, "width", "height", NULL); - - gst_caps_append_structure_full (res, st, gst_caps_features_copy (f)); - } - - return res; -} - static GstCaps * gst_glimage_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) { @@ -830,11 +794,6 @@ gst_glimage_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) tmp = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA"); - result = gst_glimage_sink_caps_remove_format_info (tmp); - gst_caps_unref (tmp); - tmp = result; - GST_DEBUG_OBJECT (bsink, "remove format returned caps %" GST_PTR_FORMAT, tmp); - result = gst_gl_color_convert_transform_caps (gl_sink->context, GST_PAD_SRC, tmp, NULL); diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c index 2cdf46fb9..36952f870 100644 --- a/ext/gl/gstglmixer.c +++ b/ext/gl/gstglmixer.c @@ -326,60 +326,17 @@ gst_gl_mixer_set_caps_features (const GstCaps * caps, return ret; } -/* copies the given caps */ -static GstCaps * -gst_gl_mixer_caps_remove_format_info (GstCaps * caps) -{ - GstStructure *st; - GstCapsFeatures *f; - gint i, n; - GstCaps *res; - - res = gst_caps_new_empty (); - - n = gst_caps_get_size (caps); - for (i = 0; i < n; i++) { - st = gst_caps_get_structure (caps, i); - f = gst_caps_get_features (caps, i); - - /* If this is already expressed by the existing caps - * skip this structure */ - if (i > 0 && gst_caps_is_subset_structure_full (res, st, f)) - continue; - - st = gst_structure_copy (st); - /* Only remove format info for the cases when we can actually convert */ - if (!gst_caps_features_is_any (f) - && gst_caps_features_is_equal (f, - GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) - gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site", - NULL); - gst_structure_remove_fields (st, "width", "height", NULL); - - gst_caps_append_structure_full (res, st, gst_caps_features_copy (f)); - } - - return res; -} - GstCaps * gst_gl_mixer_update_caps (GstGLMixer * mix, GstCaps * caps) { - GstCaps *result, *tmp, *gl_caps; - - gl_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA"); + GstCaps *result, *tmp; result = - gst_gl_color_convert_transform_caps (mix->context, GST_PAD_SRC, gl_caps, + gst_gl_color_convert_transform_caps (mix->context, GST_PAD_SRC, caps, NULL); tmp = result; GST_DEBUG_OBJECT (mix, "convert returned caps %" GST_PTR_FORMAT, tmp); - result = gst_gl_mixer_caps_remove_format_info (tmp); - gst_caps_unref (tmp); - tmp = result; - GST_DEBUG_OBJECT (mix, "remove format returned caps %" GST_PTR_FORMAT, tmp); - result = gst_gl_upload_transform_caps (mix->context, GST_PAD_SRC, tmp, NULL); gst_caps_unref (tmp); tmp = result; @@ -740,10 +697,6 @@ gst_gl_mixer_query_caps (GstPad * pad, GstAggregator * agg, GstQuery * query) NULL); retcaps = gst_caps_merge (gl_caps, retcaps); gst_caps_unref (current_caps); - current_caps = retcaps; - - retcaps = gst_gl_mixer_caps_remove_format_info (current_caps); - gst_caps_unref (current_caps); if (filter) { current_caps = diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c index b760a70ba..caae141b5 100644 --- a/ext/gl/gstgltestsrc.c +++ b/ext/gl/gstgltestsrc.c @@ -468,42 +468,6 @@ wrong_caps: } } -/* copies the given caps */ -static GstCaps * -gst_gl_test_src_caps_remove_format_info (GstCaps * caps) -{ - GstStructure *st; - GstCapsFeatures *f; - gint i, n; - GstCaps *res; - - res = gst_caps_new_empty (); - - n = gst_caps_get_size (caps); - for (i = 0; i < n; i++) { - st = gst_caps_get_structure (caps, i); - f = gst_caps_get_features (caps, i); - - /* If this is already expressed by the existing caps - * skip this structure */ - if (i > 0 && gst_caps_is_subset_structure_full (res, st, f)) - continue; - - st = gst_structure_copy (st); - /* Only remove format info for the cases when we can actually convert */ - if (!gst_caps_features_is_any (f) - && gst_caps_features_is_equal (f, - GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)) - gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site", - NULL); - gst_structure_remove_fields (st, "width", "height", NULL); - - gst_caps_append_structure_full (res, st, gst_caps_features_copy (f)); - } - - return res; -} - static GstCaps * gst_gl_test_src_set_caps_features (const GstCaps * caps, const gchar * feature_name) @@ -517,32 +481,26 @@ static GstCaps * gst_gl_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter) { GstGLTestSrc *src = GST_GL_TEST_SRC (bsrc); - GstCaps *tmp = NULL; + GstCaps *tmp; GstCaps *result = NULL; GstCaps *gl_caps; GstCaps *caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA"); - tmp = gst_gl_test_src_caps_remove_format_info (caps); - GST_DEBUG_OBJECT (bsrc, "remove format returned caps %" GST_PTR_FORMAT, tmp); - gl_caps = - gst_caps_merge (gst_gl_test_src_set_caps_features (tmp, + gst_caps_merge (gst_gl_test_src_set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY), - gst_gl_test_src_set_caps_features (tmp, + gst_gl_test_src_set_caps_features (caps, GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META)); result = - gst_gl_download_transform_caps (src->context, GST_PAD_SINK, tmp, NULL); + gst_gl_download_transform_caps (src->context, GST_PAD_SINK, caps, NULL); result = gst_caps_merge (gl_caps, result); - gst_caps_unref (tmp); - tmp = result; - GST_DEBUG_OBJECT (bsrc, "transfer returned caps %" GST_PTR_FORMAT, tmp); + GST_DEBUG_OBJECT (bsrc, "transfer returned caps %" GST_PTR_FORMAT, result); if (filter) { - result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (tmp); - } else { + tmp = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (result); result = tmp; } |