From a988871074c3467aaf0a5f714b55b8272c0813bc Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Mon, 2 Mar 2015 20:31:58 +0000 Subject: 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. --- gst/gstutils.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gst/gstutils.c b/gst/gstutils.c index 54b2d80b2..2d7d23cce 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; } -- cgit v1.2.3