mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
Allow elements to be given custom names with [] syntax. ie, gstreamer-launch disksrc[mysrc] ! ...
Original commit message from CVS: Allow elements to be given custom names with [] syntax. ie, gstreamer-launch disksrc[mysrc] ! ... makes a disksrc element named mysrc, rather than disksrc0 Suggestion: don't name things with names with numbers at the end, or they may conflict with names allocated automatically.
This commit is contained in:
parent
beb29ac257
commit
1c3b5dc57b
1 changed files with 27 additions and 1 deletions
|
@ -239,6 +239,28 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
|
|||
g_free(argname);
|
||||
|
||||
// element or argument, or beginning of bin or thread
|
||||
} else if (arg[0] == '[') {
|
||||
// we have the start of a name of the preceding element.
|
||||
// rename previous element to next arg.
|
||||
if (arg[1] != '\0') {
|
||||
fprintf(stderr,"error, unexpected junk after [\n");
|
||||
exit(-1);
|
||||
}
|
||||
i++;
|
||||
if (i < argc) {
|
||||
gst_element_set_name(previous, argv[i]);
|
||||
} else {
|
||||
fprintf(stderr,"error, expected element name, found end of arguments\n");
|
||||
exit(-1);
|
||||
}
|
||||
i++;
|
||||
if (i >= argc) {
|
||||
fprintf(stderr,"error, expected ], found end of arguments\n");
|
||||
exit(-1);
|
||||
} else if (strcmp(argv[i], "]") != 0) {
|
||||
fprintf(stderr,"error, expected ], found '%s'\n", argv[i]);
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
DEBUG("have element or bin/thread\n");
|
||||
// if we have a bin or thread starting
|
||||
|
@ -259,7 +281,11 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
|
|||
// exit(-1);
|
||||
}
|
||||
GST_DEBUG(0,"CREATED thread %s\n",GST_ELEMENT_NAME(element));
|
||||
}
|
||||
} else {
|
||||
DEBUG("error in parser, unexpected symbol, FIXME\n");
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
i += gst_parse_launch_cmdline(argc - i, argv + i + 1, GST_BIN (element), priv);
|
||||
|
||||
|
|
Loading…
Reference in a new issue