summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-04-05 10:08:21 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-04-05 10:08:21 +0000
commitbcc9fc59a9d586c0126cb12dc1248779bddbe6b1 (patch)
tree1f117394a95f4dcd4d652a96cb02600282782b0c /gst
parenta78857c2968d9e980ccb84a0c418025c6dc5c403 (diff)
gst/gstelement.c: Make padtemplates also work when they don't contain %s or %d.
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.
Diffstat (limited to 'gst')
-rw-r--r--gst/gstelement.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gst/gstelement.c b/gst/gstelement.c
index f27ae9540..9392ff37b 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -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) {