[gst-devel] gst_pad_try_connect

vishnu at pobox.com vishnu at pobox.com
Fri Sep 14 12:31:04 CEST 2001


Almost nobody checks the return value.  OK to commit?

-- 
Victory to the Divine Mother!!
  http://sahajayoga.org
-------------- next part --------------
Index: gst/gstpad.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstpad.c,v
retrieving revision 1.107
diff -u -p -r1.107 gstpad.c
--- gst/gstpad.c	2001/09/14 01:57:09	1.107
+++ gst/gstpad.c	2001/09/14 19:28:07
@@ -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;
Index: gst/gstpad.h
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstpad.h,v
retrieving revision 1.62
diff -u -p -r1.62 gstpad.h
--- gst/gstpad.h	2001/08/22 21:45:25	1.62
+++ gst/gstpad.h	2001/09/14 19:28:07
@@ -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);
Index: gst/autoplug/gststaticautoplugrender.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/autoplug/gststaticautoplugrender.c,v
retrieving revision 1.14
diff -u -p -r1.14 gststaticautoplugrender.c
--- gst/autoplug/gststaticautoplugrender.c	2001/08/21 20:16:45	1.14
+++ gst/autoplug/gststaticautoplugrender.c	2001/09/14 19:28:09
@@ -187,7 +187,7 @@ gst_autoplug_pads_autoplug_func (GstElem
       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;


More information about the gstreamer-devel mailing list