From 478b7a8eb49d285c3ff0b73e1fe2929b9418be91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 18 May 2017 11:21:55 +0300 Subject: [PATCH] discoverer: Consider parent/child streams the same if they have caps with the same name Child streams could have more accurate width/height or various other information added. If they have the same name, they are likely to be the same streams. https://bugzilla.gnome.org/show_bug.cgi?id=782697 --- gst-libs/gst/pbutils/gstdiscoverer.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 5d742a66c2..92cf092542 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1052,33 +1052,21 @@ find_stream_for_node (GstDiscoverer * dc, const GstStructure * topology) /* this can fail due to {framed,parsed}={TRUE,FALSE} differences, thus we filter * the parent */ static gboolean -child_is_same_stream (const GstCaps * _parent, const GstCaps * child) +child_is_same_stream (const GstCaps * parent, const GstCaps * child) { - GstCaps *parent; - guint i, size; - gboolean res; + const GstStructure *s1, *s2; - if (_parent == child) + if (parent == child) return TRUE; - if (!_parent) + if (!parent) return FALSE; if (!child) return FALSE; - parent = gst_caps_copy (_parent); - size = gst_caps_get_size (parent); + s1 = gst_caps_get_structure (parent, 0); + s2 = gst_caps_get_structure (child, 0); - for (i = 0; i < size; i++) { - gst_structure_remove_field (gst_caps_get_structure (parent, i), "parsed"); - gst_structure_remove_field (gst_caps_get_structure (parent, i), "framed"); - gst_structure_remove_field (gst_caps_get_structure (parent, i), - "stream-format"); - gst_structure_remove_field (gst_caps_get_structure (parent, i), - "alignment"); - } - res = gst_caps_can_intersect (parent, child); - gst_caps_unref (parent); - return res; + return gst_structure_has_name (s1, gst_structure_get_name (s2)); }