mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
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.
This commit is contained in:
parent
a78857c296
commit
bcc9fc59a9
2 changed files with 17 additions and 3 deletions
|
@ -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>
|
2007-04-05 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* docs/gst/gstreamer-sections.txt:
|
* docs/gst/gstreamer-sections.txt:
|
||||||
|
|
|
@ -925,22 +925,31 @@ gst_element_get_request_pad (GstElement * element, const gchar * name)
|
||||||
|
|
||||||
class = GST_ELEMENT_GET_CLASS (element);
|
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, "%")) {
|
if (strstr (name, "%")) {
|
||||||
templ = gst_element_class_get_request_pad_template (class, name);
|
templ = gst_element_class_get_request_pad_template (class, name);
|
||||||
req_name = NULL;
|
req_name = NULL;
|
||||||
if (templ)
|
if (templ)
|
||||||
templ_found = TRUE;
|
templ_found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
/* there is no % in the name, try to find a matching template */
|
||||||
list = gst_element_class_get_pad_template_list (class);
|
list = gst_element_class_get_pad_template_list (class);
|
||||||
while (!templ_found && list) {
|
while (!templ_found && list) {
|
||||||
templ = (GstPadTemplate *) list->data;
|
templ = (GstPadTemplate *) list->data;
|
||||||
if (templ->presence == GST_PAD_REQUEST) {
|
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
|
/* 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, occurring at the end of the name_template, are the only
|
||||||
possibilities. */
|
possibilities. */
|
||||||
GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name,
|
else if ((str = strchr (templ->name_template, '%'))
|
||||||
templ->name_template);
|
|
||||||
if ((str = strchr (templ->name_template, '%'))
|
|
||||||
&& strncmp (templ->name_template, name,
|
&& strncmp (templ->name_template, name,
|
||||||
str - templ->name_template) == 0
|
str - templ->name_template) == 0
|
||||||
&& strlen (name) > str - templ->name_template) {
|
&& strlen (name) > str - templ->name_template) {
|
||||||
|
|
Loading…
Reference in a new issue