From 75a30f1f6146d43b9cfa07d1c01aaa80613b9007 Mon Sep 17 00:00:00 2001 From: "Joshua N. Pritikin" Date: Fri, 14 Sep 2001 19:45:20 +0000 Subject: [PATCH] Nobody checks the return value of gst_pad_connect. This patch renames gst_pad_connect to gst_pad_try_connect and mak... Original commit message from CVS: Nobody checks the return value of gst_pad_connect. This patch renames gst_pad_connect to gst_pad_try_connect and makes gst_pad_connect return void. --- gst/autoplug/gststaticautoplugrender.c | 2 +- gst/gstpad.c | 21 ++++++++++++++++++++- gst/gstpad.h | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gst/autoplug/gststaticautoplugrender.c b/gst/autoplug/gststaticautoplugrender.c index 94b5295ffd..0c71fffc08 100644 --- a/gst/autoplug/gststaticautoplugrender.c +++ b/gst/autoplug/gststaticautoplugrender.c @@ -187,7 +187,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink) if (state == GST_STATE_PLAYING) gst_element_set_state (GST_ELEMENT (gst_element_get_parent (src)), GST_STATE_PAUSED); - if ((connected = gst_pad_connect (pad, sinkpad))) { + if ((connected = gst_pad_try_connect (pad, sinkpad))) { if (state == GST_STATE_PLAYING) gst_element_set_state (GST_ELEMENT (gst_element_get_parent (src)), GST_STATE_PLAYING); break; diff --git a/gst/gstpad.c b/gst/gstpad.c index 11a881c224..a4a72ba6de 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -555,9 +555,28 @@ gst_pad_disconnect (GstPad *srcpad, * * Returns: TRUE if the pad could be connected */ -gboolean +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)); +} + +/** + * gst_pad_try_connect: + * @srcpad: the source pad to connect + * @sinkpad: the sink pad to connect + * + * Connects the source pad to the sink pad. + * + * Returns: TRUE if the pad could be connected + */ +gboolean +gst_pad_try_connect (GstPad *srcpad, + GstPad *sinkpad) { GstRealPad *realsrc, *realsink; gboolean negotiated = FALSE; diff --git a/gst/gstpad.h b/gst/gstpad.h index 239d3e7128..a108191dbb 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -336,7 +336,8 @@ GstPad* gst_pad_get_peer (GstPad *pad); GstBufferPool* gst_pad_get_bufferpool (GstPad *pad); -gboolean gst_pad_connect (GstPad *srcpad, GstPad *sinkpad); +gboolean gst_pad_try_connect (GstPad *srcpad, GstPad *sinkpad); +void gst_pad_connect (GstPad *srcpad, GstPad *sinkpad); void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad); gboolean gst_pad_renegotiate (GstPad *pad);