From 3aa927ac2ff9017de58ee064999f8b4beedc2233 Mon Sep 17 00:00:00 2001 From: "Joshua N. Pritikin" Date: Mon, 17 Sep 2001 23:44:58 +0000 Subject: [PATCH] add temporary diagnostic code Original commit message from CVS: add temporary diagnostic code --- gst/gstpad.c | 27 ++++++++++++++++++++++++--- gst/gstutils.h | 3 +++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index 8221253d91..b099ca196e 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -24,6 +24,7 @@ #include "gst_private.h" #include "gstpad.h" +#include "gstutils.h" #include "gstelement.h" #include "gsttype.h" #include "gstbin.h" @@ -554,15 +555,35 @@ gst_pad_disconnect (GstPad *srcpad, * @sinkpad: the sink pad to connect * * Connects the source pad to the sink pad. + * + * You shouldn't use this API in a real application because the + * failure mode dumps detailed diagnostics to stderr. A professional + * application should always use gst_pad_try_connect and check + * the return code. + * + * This API will probably be moved out of the main gstreamer library. */ void gst_pad_connect (GstPad *srcpad, GstPad *sinkpad) { if (!gst_pad_try_connect (srcpad, sinkpad)) - g_critical ("couldn't connect %s:%s and %s:%s", - GST_DEBUG_PAD_NAME (srcpad), - GST_DEBUG_PAD_NAME (sinkpad)); + { + GString *buf; + + buf = g_string_new (NULL); + g_string_printf (buf, "\nCouldn't connect %s:%s and %s:%s -- details:\n", + GST_DEBUG_PAD_NAME (srcpad), + GST_DEBUG_PAD_NAME (sinkpad)); + gst_print_pad_caps (buf, 2, srcpad); + gst_print_pad_caps (buf, 2, sinkpad); + + g_critical (buf->str, + GST_DEBUG_PAD_NAME (srcpad), + GST_DEBUG_PAD_NAME (sinkpad)); + + g_string_free (buf, TRUE); + } } /** diff --git a/gst/gstutils.h b/gst/gstutils.h index daf2b2aa53..3bd3832ee1 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -44,6 +44,9 @@ void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar void gst_util_dump_mem (guchar *mem, guint size); + +void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad); + #ifdef __cplusplus } #endif /* __cplusplus */