gst_bin_add (GST_BIN (parent), element);
elementcount++;
- if (srcpads != 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);
+ 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);
}
- 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;
- }
+ }
+ 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;
}
}
+ }
- 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 (!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) {
- dyn_connect *connect = g_malloc (sizeof (dyn_connect));
+ if (!srcpads && sinkpads) {
+ dyn_connect *connect = g_malloc (sizeof (dyn_connect));
- connect->srcpadname = srcpadname;
- connect->target = GST_PARSE_LISTPAD(sinkpads);
+ 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)));
+ 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<numsrcpads) && (j<numsinkpads); j++){
- GST_DEBUG(0,"CONNECTING %s:%s and %s:%s\n",
- GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(g_slist_nth(srcpads,j))),
- GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(g_slist_nth(sinkpads,j))));
- gst_pad_connect(
- GST_PARSE_LISTPAD(g_slist_nth(srcpads,j)),
- GST_PARSE_LISTPAD(g_slist_nth(sinkpads,j)));
- }
+ 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<numsrcpads) && (j<numsinkpads); j++){
+ GST_DEBUG(0,"CONNECTING %s:%s and %s:%s\n",
+ GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(g_slist_nth(srcpads,j))),
+ GST_DEBUG_PAD_NAME(GST_PARSE_LISTPAD(g_slist_nth(sinkpads,j))));
+ gst_pad_connect(
+ GST_PARSE_LISTPAD(g_slist_nth(srcpads,j)),
+ GST_PARSE_LISTPAD(g_slist_nth(sinkpads,j)));
}
-
- g_slist_free(srcpads);
- srcpads = NULL;
-
- g_slist_free(sinkpads);
- sinkpads = NULL;
}
+
+ g_slist_free(srcpads);
+ srcpads = NULL;
+ g_slist_free(sinkpads);
+ sinkpads = NULL;
// thomas: if we're the first element, connect eos signal
if (elementcount == 1)