]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
gst/gstelement.c: Make padtemplates also work when they don't contain %s or %d.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 5 Apr 2007 10:08:21 +0000 (10:08 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 5 Apr 2007 10:08:21 +0000 (10:08 +0000)
Original commit message from CVS:
* gst/gstelement.c: (gst_element_get_request_pad):
Make padtemplates also work when they don't contain %s or %d.

ChangeLog
gst/gstelement.c

index 4b546a07f0d8ca447fce1a0417d90fa5aae46997..d7148e1d3ea61b06fc29ca9308639f86c438e6ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-05  Wim Taymans  <wim@fluendo.com>
+
+       * gst/gstelement.c: (gst_element_get_request_pad):
+       Make padtemplates also work when they don't contain %s or %d.
+
 2007-04-05  Wim Taymans  <wim@fluendo.com>
 
        * docs/gst/gstreamer-sections.txt:
index f27ae9540ee444b0664b58e8b67a5b30ccc51b22..9392ff37b4102da60bc02b4544021675b0ab4c66 100644 (file)
@@ -925,22 +925,31 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
 
   class = GST_ELEMENT_GET_CLASS (element);
 
+  /* if the name contains a %, we assume it's the complete template name. Get
+   * the template and try to get a pad */
   if (strstr (name, "%")) {
     templ = gst_element_class_get_request_pad_template (class, name);
     req_name = NULL;
     if (templ)
       templ_found = TRUE;
   } else {
+    /* there is no % in the name, try to find a matching template */
     list = gst_element_class_get_pad_template_list (class);
     while (!templ_found && list) {
       templ = (GstPadTemplate *) list->data;
       if (templ->presence == GST_PAD_REQUEST) {
+        GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name,
+            templ->name_template);
+        /* see if we find an exact match */
+        if (strcmp (name, templ->name_template) == 0) {
+          templ_found = TRUE;
+          req_name = name;
+          break;
+        }
         /* Because of sanity checks in gst_pad_template_new(), we know that %s
            and %d, occurring at the end of the name_template, are the only
            possibilities. */
-        GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name,
-            templ->name_template);
-        if ((str = strchr (templ->name_template, '%'))
+        else if ((str = strchr (templ->name_template, '%'))
             && strncmp (templ->name_template, name,
                 str - templ->name_template) == 0
             && strlen (name) > str - templ->name_template) {