[gst-devel] easy gst_pad_connect debugging

vishnu at pobox.com vishnu at pobox.com
Mon Sep 17 15:28:02 CEST 2001


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.110
diff -u -p -r1.110 gstpad.c
--- gst/gstpad.c	2001/09/14 22:16:47	1.110
+++ gst/gstpad.c	2001/09/17 22:25:24
@@ -24,6 +24,7 @@
 #include "gst_private.h"
 
 #include "gstpad.h"
+#include "gstutils.h"
 #include "gstelement.h"
 #include "gsttype.h"
 #include "gstbin.h"
@@ -560,9 +561,22 @@ 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);
+    }
 }
 
 /**
Index: gst/gstparse.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstparse.c,v
retrieving revision 1.24
diff -u -p -r1.24 gstparse.c
--- gst/gstparse.c	2001/09/14 22:16:47	1.24
+++ gst/gstparse.c	2001/09/17 22:25:24
@@ -396,8 +396,10 @@ gst_parse_launch_cmdline(int argc,char *
           srcpadname,
           GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(sinkpads)));
 
-        g_signal_connect (G_OBJECT (previous), "new_pad", dynamic_connect, connect);
-        g_signal_connect (G_OBJECT (previous), "new_ghost_pad", dynamic_connect, connect);
+        g_signal_connect (G_OBJECT (previous), "new_pad",
+			  G_CALLBACK (dynamic_connect), connect);
+        g_signal_connect (G_OBJECT (previous), "new_ghost_pad",
+			  G_CALLBACK (dynamic_connect), connect);
       }
       else {
         for (j=0; (j<numsrcpads) && (j<numsinkpads); j++){
Index: gst/gstutils.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstutils.c,v
retrieving revision 1.16
diff -u -p -r1.16 gstutils.c
--- gst/gstutils.c	2001/09/14 22:16:47	1.16
+++ gst/gstutils.c	2001/09/17 22:25:24
@@ -324,3 +324,110 @@ gst_util_set_object_arg (GObject *object
     }
   }
 }
+
+// -----------------------------------------------------
+
+#include "gstpad.h"
+#include "gsttype.h"
+#include "gstprops.h"
+#include "gstpropsprivate.h"
+
+static void string_append_indent (GString *str, gint count)
+{
+  gint xx;
+  for (xx=0; xx < count; xx++)
+    g_string_append_c (str, ' ');
+}
+
+static void 
+gst_print_props (GString *buf, gint indent,
+		 GList *props, gboolean showname)
+{
+  GList *elem;
+	    
+  for (elem = props; elem; elem = g_list_next (elem))
+    {
+      GstPropsEntry *prop = elem->data;
+
+      string_append_indent (buf, indent);
+      if (showname)
+	g_string_append (buf, g_quark_to_string (prop->propid));
+
+      switch (prop->propstype) {
+      case GST_PROPS_INT_ID:
+	g_string_printfa (buf, "%d (int)\n", prop->data.int_data);
+	break;
+      case GST_PROPS_INT_RANGE_ID:
+	g_string_printfa (buf, "%d - %d (int)\n",
+			  prop->data.int_range_data.min,
+			  prop->data.int_range_data.max);
+	break;
+      case GST_PROPS_FLOAT_ID:
+	g_string_printfa (buf, "%f (float)\n", prop->data.float_data);
+      break;
+      case GST_PROPS_FLOAT_RANGE_ID:
+	g_string_printfa (buf, "%f - %f (float)\n",
+			  prop->data.float_range_data.min,
+			  prop->data.float_range_data.max);
+	break;
+      case GST_PROPS_BOOL_ID:
+	g_string_printfa (buf, "%s\n",
+			  prop->data.bool_data ? "TRUE" : "FALSE");
+	break;
+      case GST_PROPS_STRING_ID:
+	g_string_printfa (buf, "\"%s\"\n", prop->data.string_data.string);
+	break;
+      case GST_PROPS_FOURCC_ID:
+	g_string_printfa (buf, "'%c%c%c%c' (fourcc)\n",
+			  prop->data.fourcc_data & 0xff,
+			  prop->data.fourcc_data>>8 & 0xff,
+			  prop->data.fourcc_data>>16 & 0xff,
+			  prop->data.fourcc_data>>24 & 0xff);
+	break;
+      case GST_PROPS_LIST_ID:
+	gst_print_props (buf, indent+2, prop->data.list_data.entries, FALSE);
+	break;
+      default:
+	g_string_printfa (buf, "unknown proptype %d\n", prop->propstype);
+	break;
+      }
+  }
+}
+
+void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad)
+{
+  GstRealPad *realpad;
+  GstCaps *caps;
+
+  realpad = GST_PAD_REALIZE(pad);
+  caps = realpad->caps;
+
+  if (!caps)
+    {
+      string_append_indent (buf, indent);
+      g_string_printf (buf, "%s:%s has no capabilities",
+		       GST_DEBUG_PAD_NAME (pad));
+    }
+  else
+    {
+      gint capx = 0;
+
+      while (caps) {
+	GstType *type;
+
+	string_append_indent (buf, indent);
+	g_string_printfa (buf, "Cap[%d]: %s\n", capx++, caps->name);
+
+	type = gst_type_find_by_id (caps->id);
+	string_append_indent (buf, indent+2);
+	g_string_printfa (buf, "MIME type: %s\n",
+			  type->mime? type->mime : "unknown/unknown");
+
+	if (caps->properties)
+	  gst_print_props (buf, indent + 2,
+			   caps->properties->properties, TRUE);
+
+	caps = caps->next;
+      }
+    }
+}
Index: gst/gstutils.h
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstutils.h,v
retrieving revision 1.8
diff -u -p -r1.8 gstutils.h
--- gst/gstutils.h	2001/06/25 01:20:08	1.8
+++ gst/gstutils.h	2001/09/17 22:25:24
@@ -44,6 +44,9 @@ void 		gst_util_set_object_arg 	(GObject
 	
 void 		gst_util_dump_mem		(guchar *mem, guint size);
 
+
+void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: plugins/a52dec/gsta52dec.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/a52dec/gsta52dec.c,v
retrieving revision 1.3
diff -u -p -r1.3 gsta52dec.c
--- plugins/a52dec/gsta52dec.c	2001/09/17 17:32:15	1.3
+++ plugins/a52dec/gsta52dec.c	2001/09/17 22:25:25
@@ -48,6 +48,11 @@ enum {
   /* FILL ME */
 };
 
+//
+// a52 and ac3 are actually the same format.  a52 is the new
+// name because ac3 ran into legal problems.  We support both
+// of them here.  i hope that is OK.
+//
 GST_PADTEMPLATE_FACTORY (sink_factory,
   "sink",
   GST_PAD_SINK,
@@ -55,6 +60,11 @@ GST_PADTEMPLATE_FACTORY (sink_factory,
   GST_CAPS_NEW (
     "a52dec_sink",
     "audio/a52",
+     NULL
+  ),
+  GST_CAPS_NEW (
+    "ac3dec_sink",
+    "audio/ac3",
      NULL
   )
 );
Index: plugins/dvdsrc/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/dvdsrc/Makefile.am,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.am
--- plugins/dvdsrc/Makefile.am	2001/01/14 21:55:39	1.7
+++ plugins/dvdsrc/Makefile.am	2001/09/17 22:25:25
@@ -14,3 +14,5 @@ endif
 libdvdsrc_la_SOURCES = dvdsrc.c $(CSSAUTH_SRC)
 
 noinst_HEADERS = dvdsrc.h $(CSSAUTH_HDR)
+
+EXTRA_DIST = README
Index: plugins/mpeg2/parse/README
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse/README,v
retrieving revision 1.2
diff -u -p -r1.2 README
--- plugins/mpeg2/parse/README	2001/09/17 18:45:47	1.2
+++ plugins/mpeg2/parse/README	2001/09/17 22:25:25
@@ -4,9 +4,3 @@ MPEG-2 System Stream Parser
 This element will parse MPEG-2 Program Streams (and eventually Transport
 Streams, though likely as a second element) into its elemental streams.
 
-
-Various Info
-============
-
-http://members.aol.com/mpucoder/DVD/index.html
-http://dvd.sourceforge.net/
Index: plugins/mpeg2/parse/mpeg2parse.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse/mpeg2parse.c,v
retrieving revision 1.33
diff -u -p -r1.33 mpeg2parse.c
--- plugins/mpeg2/parse/mpeg2parse.c	2001/09/14 03:53:30	1.33
+++ plugins/mpeg2/parse/mpeg2parse.c	2001/09/17 22:25:25
@@ -89,7 +89,7 @@ GST_PADTEMPLATE_FACTORY (private1_factor
   GST_CAPS_NEW (
     "mpeg2parse_private1",
     "audio/ac3",
-    "framed",   GST_PROPS_BOOLEAN (FALSE)
+    NULL
   )
 );
 


More information about the gstreamer-devel mailing list