mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
should restore dynamic connection of pads (couldn't really test it though)
Original commit message from CVS: should restore dynamic connection of pads (couldn't really test it though)
This commit is contained in:
parent
4af8c58268
commit
933a7aeff4
1 changed files with 78 additions and 82 deletions
160
gst/gstparse.c
160
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; (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)));
|
||||
|
||||
// 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(srcpads);
|
||||
srcpads = NULL;
|
||||
|
||||
g_slist_free(sinkpads);
|
||||
sinkpads = NULL;
|
||||
}
|
||||
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) 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<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;
|
||||
|
||||
// thomas: if we're the first element, connect eos signal
|
||||
if (elementcount == 1)
|
||||
|
|
Loading…
Reference in a new issue