diff options
author | Edward Hervey <edward.hervey@collabora.co.uk> | 2011-10-06 10:50:12 +0200 |
---|---|---|
committer | Edward Hervey <edward.hervey@collabora.co.uk> | 2011-10-06 10:50:12 +0200 |
commit | 471611456ec71ca96430d2835ce8e4745e8a0701 (patch) | |
tree | 83f665636a008ce482c0f31423240f4f541c76f4 | |
parent | ef911cd42be1f56646a1d2b0bf1b1acb4f5ffa5b (diff) |
gnlsource: Don't use _accept_caps to figure out compatible pads
It isn't reliable due to issues with gst_caps_is_subset.
Instead we just check if a pad caps intersect with the target caps
-rw-r--r-- | gnl/gnlsource.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gnl/gnlsource.c b/gnl/gnlsource.c index 2f13bd1..0d7d501 100644 --- a/gnl/gnlsource.c +++ b/gnl/gnlsource.c @@ -199,6 +199,8 @@ static void element_pad_added_cb (GstElement * element G_GNUC_UNUSED, GstPad * pad, GnlSource * source) { + GstCaps *srccaps; + GST_DEBUG_OBJECT (source, "pad %s:%s", GST_DEBUG_PAD_NAME (pad)); if (source->priv->ghostpad || source->priv->pendingblock) { @@ -209,10 +211,13 @@ element_pad_added_cb (GstElement * element G_GNUC_UNUSED, GstPad * pad, return; } - if (!(gst_pad_accept_caps (pad, GNL_OBJECT (source)->caps))) { + srccaps = gst_pad_get_caps (pad, NULL); + if (!gst_caps_can_intersect (srccaps, GNL_OBJECT (source)->caps)) { + gst_caps_unref (srccaps); GST_DEBUG_OBJECT (source, "Pad doesn't have valid caps, ignoring"); return; } + gst_caps_unref (srccaps); GST_DEBUG_OBJECT (pad, "valid pad, about to add event probe and pad block"); @@ -266,12 +271,17 @@ compare_src_pad (GValue * item, GstCaps * caps) { gint ret = 1; GstPad *pad = g_value_get_object (item); + GstCaps *padcaps; GST_DEBUG_OBJECT (pad, "Trying pad for caps %" GST_PTR_FORMAT, caps); - if (gst_pad_accept_caps (pad, caps)) + padcaps = gst_pad_get_caps (pad, NULL); + + if (gst_caps_can_intersect (padcaps, caps)) ret = 0; + gst_caps_unref (padcaps); + return ret; } |