diff --git a/gst/gstparse.c b/gst/gstparse.c index 380a709703..7c8e5ce897 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -278,95 +278,91 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr gst_bin_add (GST_BIN (parent), element); elementcount++; - if (srcpads != NULL) { + g_slist_free(sinkpads); + sinkpads = NULL; + numsinkpads=0; + tempname=NULL; - g_slist_free(sinkpads); - sinkpads = NULL; - numsinkpads=0; - tempname=NULL; - - // find sink pads - if (sinkpadname != NULL) { - while (1){ - // split name at commas - if ((ptr = strchr(sinkpadname,','))){ - tempname = g_strndup(sinkpadname,(ptr-sinkpadname)); - sinkpadname = &ptr[1]; - } else { - tempname = sinkpadname; - } - - // look for pad with that name - if ((temppad = gst_element_get_pad(element,tempname))){ - sinkpads = g_slist_append(sinkpads,temppad); - numsinkpads++; - } - - // try to create a pad using that padtemplate name - else if ((temppad = gst_element_request_pad_by_name(element,tempname))) { - sinkpads = g_slist_append(sinkpads,temppad); - numsinkpads++; - } - if (!temppad) { - GST_DEBUG(0,"NO SUCH pad %s in element %s\n",tempname,GST_ELEMENT_NAME(element)); - } else { - GST_DEBUG(0,"have sink pad %s:%s\n",GST_DEBUG_PAD_NAME(temppad)); - } - - // if there is no more commas in sinkpadname then we're done - if (tempname == sinkpadname) break; - g_free(tempname); + // find sink pads + if (sinkpadname != NULL) { + while (1){ + // split name at commas + if ((ptr = strchr(sinkpadname,','))){ + tempname = g_strndup(sinkpadname,(ptr-sinkpadname)); + sinkpadname = &ptr[1]; + } else { + tempname = sinkpadname; } - } - else { - // check through the list to find the first sink pad - pads = gst_element_get_pad_list(element); - while (pads) { - temppad = GST_PAD(pads->data); - pads = g_list_next (pads); - if (gst_pad_get_direction (temppad) == GST_PAD_SINK){ - sinkpads = g_slist_append(sinkpads,temppad); - numsinkpads++; - break; - } + + // look for pad with that name + if ((temppad = gst_element_get_pad(element,tempname))){ + sinkpads = g_slist_append(sinkpads,temppad); + numsinkpads++; } - } - - if (!sinkpads) DEBUG("error, can't find a sink pad!!!\n"); - else DEBUG("have sink pad %s:%s\n",GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(sinkpads))); - - if (!srcpads) { - dyn_connect *connect = g_malloc (sizeof (dyn_connect)); - - connect->srcpadname = srcpadname; - connect->target = GST_PARSE_LISTPAD(sinkpads); - - GST_DEBUG(0,"SETTING UP dynamic connection %s:%s and %s:%s\n", - gst_element_get_name (previous), - srcpadname, - GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(sinkpads))); - - gtk_signal_connect (GTK_OBJECT (previous), "new_pad", dynamic_connect, connect); - gtk_signal_connect (GTK_OBJECT (previous), "new_ghost_pad", dynamic_connect, connect); - } - else { - for (j=0; (jdata); + pads = g_list_next (pads); + if (gst_pad_get_direction (temppad) == GST_PAD_SINK){ + sinkpads = g_slist_append(sinkpads,temppad); + numsinkpads++; + break; + } + } + } + + if (!sinkpads) GST_DEBUG(0,"can't find a sink pad for %s\n", gst_element_get_name (previous)); + else GST_DEBUG(0,"have sink pad %s:%s\n",GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(sinkpads))); + + if (!srcpads && sinkpads) { + dyn_connect *connect = g_malloc (sizeof (dyn_connect)); + + connect->srcpadname = srcpadname; + connect->target = GST_PARSE_LISTPAD(sinkpads); + + GST_DEBUG(0,"SETTING UP dynamic connection %s:%s and %s:%s\n", + gst_element_get_name (previous), + srcpadname, + GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(sinkpads))); + + gtk_signal_connect (GTK_OBJECT (previous), "new_pad", dynamic_connect, connect); + gtk_signal_connect (GTK_OBJECT (previous), "new_ghost_pad", dynamic_connect, connect); + } + else { + for (j=0; (j