summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-03-02 20:31:58 (GMT)
committerTim-Philipp Müller <tim@centricular.com>2015-03-02 20:31:58 (GMT)
commita988871074c3467aaf0a5f714b55b8272c0813bc (patch)
treefda724a3271df2fe75588bd43babe43ae7cd9fcf
parent49a4951a0c842c5c8b1117cdf4afd82e17a14eea (diff)
downloadgstreamer-a988871074c3467aaf0a5f714b55b8272c0813bc.tar.gz
gstreamer-a988871074c3467aaf0a5f714b55b8272c0813bc.tar.xz
utils: improve warning when linking elements without common ancestor
This comes up quite a lot and it's a common mistake, so let's try to improve the warning message a little.
-rw-r--r--gst/gstutils.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gst/gstutils.c b/gst/gstutils.c
index 54b2d80..2d7d23c 100644
--- a/gst/gstutils.c
+++ b/gst/gstutils.c
@@ -1446,8 +1446,24 @@ prepare_link_maybe_ghosting (GstPad ** src, GstPad ** sink,
/* we need to setup some ghost pads */
root = find_common_root (e1, e2);
if (!root) {
- g_warning ("Trying to connect elements that don't share a common "
- "ancestor: %s and %s", GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2));
+ if (GST_OBJECT_PARENT (e1) == NULL)
+ g_warning ("Trying to link elements %s and %s that don't share a common "
+ "ancestor: %s hasn't been added to a bin or pipeline, but %s is in %s",
+ GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2),
+ GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2),
+ GST_ELEMENT_NAME (GST_OBJECT_PARENT (e2)));
+ else if (GST_OBJECT_PARENT (e2) == NULL)
+ g_warning ("Trying to link elements %s and %s that don't share a common "
+ "ancestor: %s hasn't been added to a bin or pipeline, and %s is in %s",
+ GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2),
+ GST_ELEMENT_NAME (e2), GST_ELEMENT_NAME (e1),
+ GST_ELEMENT_NAME (GST_OBJECT_PARENT (e1)));
+ else
+ g_warning ("Trying to link elements %s and %s that don't share a common "
+ "ancestor: %s is in %s, and %s is in %s",
+ GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (e2),
+ GST_ELEMENT_NAME (e1), GST_ELEMENT_NAME (GST_OBJECT_PARENT (e1)),
+ GST_ELEMENT_NAME (e2), GST_ELEMENT_NAME (GST_OBJECT_PARENT (e2)));
return FALSE;
}