element: Check %u too when trying to find a pad template for a request pad

This commit is contained in:
Sebastian Dröge 2011-03-29 11:52:06 +02:00
parent 86bbc85ab1
commit c9238f6f56

View file

@ -1047,7 +1047,7 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
break; break;
} }
/* Because of sanity checks in gst_pad_template_new(), we know that %s /* 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 and %d and %u, occurring at the end of the name_template, are the only
possibilities. */ possibilities. */
else if ((str = strchr (templ->name_template, '%')) else if ((str = strchr (templ->name_template, '%'))
&& strncmp (templ->name_template, name, && strncmp (templ->name_template, name,
@ -1065,6 +1065,16 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
req_name = name; req_name = name;
break; break;
} }
} else if (*(str + 1) == 'u') {
guint tmp;
/* it's an int */
tmp = strtoul (data, &endptr, 10);
if (tmp != G_MAXULONG && endptr && *endptr == '\0') {
templ_found = TRUE;
req_name = name;
break;
}
} else { } else {
/* it's a string */ /* it's a string */
templ_found = TRUE; templ_found = TRUE;
@ -1333,8 +1343,7 @@ gst_element_class_set_icon_name (GstElementClass * klass, const gchar * name)
*/ */
#ifndef GST_REMOVE_DEPRECATED #ifndef GST_REMOVE_DEPRECATED
#ifdef GST_DISABLE_DEPRECATED #ifdef GST_DISABLE_DEPRECATED
void void gst_element_class_set_details (GstElementClass * klass,
gst_element_class_set_details (GstElementClass * klass,
const GstElementDetails * details); const GstElementDetails * details);
#endif #endif
void void
@ -1418,8 +1427,8 @@ gst_element_class_get_pad_template_list (GstElementClass * element_class)
* if none was found. No unreferencing is necessary. * if none was found. No unreferencing is necessary.
*/ */
GstPadTemplate * GstPadTemplate *
gst_element_class_get_pad_template (GstElementClass * element_class, gst_element_class_get_pad_template (GstElementClass *
const gchar * name) element_class, const gchar * name)
{ {
GList *padlist; GList *padlist;
@ -1441,8 +1450,8 @@ gst_element_class_get_pad_template (GstElementClass * element_class,
} }
static GstPadTemplate * static GstPadTemplate *
gst_element_class_get_request_pad_template (GstElementClass * element_class, gst_element_class_get_request_pad_template (GstElementClass *
const gchar * name) element_class, const gchar * name)
{ {
GstPadTemplate *tmpl; GstPadTemplate *tmpl;
@ -1457,8 +1466,8 @@ gst_element_class_get_request_pad_template (GstElementClass * element_class,
* The pad is random in a sense that it is the first pad that is (optionaly) linked. * The pad is random in a sense that it is the first pad that is (optionaly) linked.
*/ */
static GstPad * static GstPad *
gst_element_get_random_pad (GstElement * element, gboolean need_linked, gst_element_get_random_pad (GstElement * element,
GstPadDirection dir) gboolean need_linked, GstPadDirection dir)
{ {
GstPad *result = NULL; GstPad *result = NULL;
GList *pads; GList *pads;
@ -1969,7 +1978,8 @@ gst_element_set_locked_state (GstElement * element, gboolean locked_state)
was_ok: was_ok:
{ {
GST_CAT_DEBUG (GST_CAT_STATES, "elements %s was already in locked state %d", GST_CAT_DEBUG (GST_CAT_STATES,
"elements %s was already in locked state %d",
GST_ELEMENT_NAME (element), old); GST_ELEMENT_NAME (element), old);
GST_OBJECT_UNLOCK (element); GST_OBJECT_UNLOCK (element);