From fc1645131b2a6b865812f7752464bad87e900548 Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Wed, 3 Jan 2001 20:44:28 +0000 Subject: [PATCH] debug updates and a padtemplate counter added Original commit message from CVS: debug updates and a padtemplate counter added --- gst/gstelement.c | 16 +++++++++++----- gst/gstelement.h | 1 + gst/gstelementfactory.c | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gst/gstelement.c b/gst/gstelement.c index f2948dec44..8c6f7b52c3 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -237,20 +237,26 @@ gst_element_get_pad (GstElement *element, gchar *name) g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); - - if (name == NULL) - return NULL; + g_return_val_if_fail (name != NULL, NULL); + + // if there aren't any pads, well, we're not likely to find one if (!element->numpads) return NULL; - /* look through the list, matching by name */ + GST_DEBUG(GST_CAT_ELEMENT_PADS,"searching for pad '%s' in element %s\n", + name,gst_element_get_name(element)); + + // look through the list, matching by name walk = element->pads; while (walk) { - if (!strcmp ((GST_PAD(walk->data))->name, name)) + if (!strcmp ((GST_PAD(walk->data))->name, name)) { + GST_DEBUG(GST_CAT_ELEMENT_PADS,"found pad '%s'\n",name); return GST_PAD(walk->data); + } walk = g_list_next (walk); } + GST_DEBUG(GST_CAT_ELEMENT_PADS,"no such pad '%s'\n",name); return NULL; } diff --git a/gst/gstelement.h b/gst/gstelement.h index b7bf039ffd..eff5846717 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -173,6 +173,7 @@ struct _GstElementFactory { GstElementDetails *details; /* pointer to details struct */ GList *padtemplates; + guint16 numpadtemplates; }; GtkType gst_element_get_type (void); diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 002842ca3a..ef949606be 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -118,6 +118,7 @@ gst_elementfactory_new (gchar *name, GtkType type, factory->type = type; factory->details = details; factory->padtemplates = NULL; + factory->numpadtemplates = 0; _gst_elementfactories = g_list_prepend (_gst_elementfactories, factory); @@ -215,6 +216,7 @@ gst_elementfactory_add_padtemplate (GstElementFactory *factory, g_return_if_fail(temp != NULL); factory->padtemplates = g_list_append (factory->padtemplates, temp); + factory->numpadtemplates++; } /**