From f292e785cec4ca40113735d24e61b7f15890968b Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Fri, 21 Feb 2014 13:28:16 +1100 Subject: [PATCH] [884/906] filter: return the pad template caps in transform_caps We can transform from any input in our caps to any output. With the following pipeline snippet: ... ! vaapidecode ! glcolorscale ! xvimagesink GstVideoGLTextureUploadMeta was being used on both src and sink pads causing linking to fail. This allows the usage of the meta on either pad without affecting whether the meta is chosen on the other pad. --- gst-libs/gst/gl/gstglfilter.c | 42 +++++++---------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index d6a0b9d67d..f91d0ec79f 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -638,42 +638,16 @@ static GstCaps * gst_gl_filter_transform_caps (GstBaseTransform * bt, GstPadDirection direction, GstCaps * caps, GstCaps * filter) { - //GstGLFilter* filter = GST_GL_FILTER (bt); - GstStructure *structure; - GstCapsFeatures *features; GstCaps *newcaps, *result; - const GValue *par; - guint i, n; - par = NULL; - newcaps = gst_caps_new_empty (); - n = gst_caps_get_size (caps); - - for (i = 0; i < n; i++) { - structure = gst_caps_get_structure (caps, i); - features = gst_caps_get_features (caps, i); - - if (i > 0 - && gst_caps_is_subset_structure_full (newcaps, structure, features)) - continue; - - structure = gst_structure_copy (structure); - features = gst_caps_features_copy (features); - - gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); - - gst_structure_remove_field (structure, "format"); - - if ((par = gst_structure_get_value (structure, "pixel-aspect-ratio"))) { - gst_structure_set (structure, - "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, - NULL); - } - - gst_caps_append_structure_full (newcaps, structure, features); - } + if (direction == GST_PAD_SINK) + newcaps = + gst_static_pad_template_get_caps (&gst_gl_filter_src_pad_template); + else if (direction == GST_PAD_SRC) + newcaps = + gst_static_pad_template_get_caps (&gst_gl_filter_sink_pad_template); + else + newcaps = gst_caps_new_any (); if (filter) { result =